import{r as Ge}from"./vendor-react-DSIERL8z.js";const O=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,U=globalThis,sn="10.43.0";function yn(){return rs(U),U}function rs(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||sn,t[sn]=t[sn]||{}}function pi(e,t,n=U){const r=n.__SENTRY__=n.__SENTRY__||{},i=r[sn]=r[sn]||{};return i[e]||(i[e]=t())}const Ju=["debug","info","warn","error","log","assert","trace"],lv="Sentry Logger ",Mo={};function jn(e){if(!("console"in U))return e();const t=U.console,n={},r=Object.keys(Mo);r.forEach(i=>{const s=Mo[i];n[i]=t[i],t[i]=s});try{return e()}finally{r.forEach(i=>{t[i]=n[i]})}}function dv(){Qu().enabled=!0}function fv(){Qu().enabled=!1}function pm(){return Qu().enabled}function pv(...e){Xu("log",...e)}function hv(...e){Xu("warn",...e)}function mv(...e){Xu("error",...e)}function Xu(e,...t){O&&pm()&&jn(()=>{U.console[e](`${lv}[${e}]:`,...t)})}function Qu(){return O?pi("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const y={enable:dv,disable:fv,isEnabled:pm,log:pv,warn:hv,error:mv},hm=50,jt="?",Gd=/\(error: (.*)\)/,Vd=/captureMessage|captureException/;function mm(...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=Gd.test(c)?c.replace(Gd,"$1"):c;if(!u.match(/\S*Error: /)){for(const d of t){const l=d(u);if(l){s.push(l);break}}if(s.length>=hm+i)break}}return _v(s.slice(i))}}function gv(e){return Array.isArray(e)?mm(...e):e}function _v(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Ds(t).function||"")&&t.pop(),t.reverse(),Vd.test(Ds(t).function||"")&&(t.pop(),Vd.test(Ds(t).function||"")&&t.pop()),t.slice(0,hm).map(n=>({...n,filename:n.filename||Ds(t).filename,function:n.function||jt}))}function Ds(e){return e[e.length-1]||{}}const cc="";function dn(e){try{return!e||typeof e!="function"?cc:e.name||cc}catch{return cc}}function Zc(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 gm(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function yv(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}const co={},Kd={};function Wn(e,t){co[e]=co[e]||[],co[e].push(t)}function zn(e,t){if(!Kd[e]){Kd[e]=!0;try{t()}catch(n){O&&y.error(`Error while instrumenting ${e}`,n)}}}function yt(e,t){const n=e&&co[e];if(n)for(const r of n)try{r(t)}catch(i){O&&y.error(`Error while triggering instrumentation handler. Type: ${e} Name: ${dn(r)} Error:`,i)}}let uc=null;function _m(e){const t="error";Wn(t,e),zn(t,bv)}function bv(){uc=U.onerror,U.onerror=function(e,t,n,r,i){return yt("error",{column:r,error:i,line:n,msg:e,url:t}),uc?uc.apply(this,arguments):!1},U.onerror.__SENTRY_INSTRUMENTED__=!0}let lc=null;function ym(e){const t="unhandledrejection";Wn(t,e),zn(t,Sv)}function Sv(){lc=U.onunhandledrejection,U.onunhandledrejection=function(e){return yt("unhandledrejection",e),lc?lc.apply(this,arguments):!0},U.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const bm=Object.prototype.toString;function Ht(e){switch(bm.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return fn(e,Error)}}function hi(e,t){return bm.call(e)===`[object ${t}]`}function Sm(e){return hi(e,"ErrorEvent")}function Yd(e){return hi(e,"DOMError")}function vv(e){return hi(e,"DOMException")}function xt(e){return hi(e,"String")}function ga(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function $n(e){return e===null||ga(e)||typeof e!="object"&&typeof e!="function"}function ot(e){return hi(e,"Object")}function _a(e){return typeof Event<"u"&&fn(e,Event)}function Ev(e){return typeof Element<"u"&&fn(e,Element)}function Tv(e){return hi(e,"RegExp")}function qn(e){return!!(e?.then&&typeof e.then=="function")}function wv(e){return ot(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function fn(e,t){try{return e instanceof t}catch{return!1}}function vm(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}function Zu(e){return typeof Request<"u"&&fn(e,Request)}const el=U,Iv=80;function ct(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||Iv;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 kv(e,t){const n=e,r=[];if(!n?.tagName)return"";if(el.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(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(i?.length)i.forEach(o=>{r.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const o=n.className;if(o&&xt(o)){const a=o.split(/\s+/);for(const c of a)r.push(`.${c}`)}}const s=["aria-label","type","name","title","alt"];for(const o of s){const a=n.getAttribute(o);a&&r.push(`[${o}="${a}"]`)}return r.join("")}function Ir(){try{return el.document.location.href}catch{return""}}function Em(e){if(!el.HTMLElement)return null;let t=e;const n=5;for(let r=0;r"}}function Xd(e){if(typeof e=="object"&&e!==null){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function Av(e){const t=Object.keys(wm(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}let Or;function is(e){if(Or!==void 0)return Or?Or(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=U;return t in n&&typeof n[t]=="function"?(Or=n[t],Or(e)):(Or=null,e())}function on(){return is(()=>Math.random())}function ss(){return is(()=>Date.now())}function Vi(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function dc(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}`),suo(e,r,n))}function Rv(){const e=U;return e.crypto||e.msCrypto}let fc;function Cv(){return on()*16}function Be(e=Rv()){try{if(e?.randomUUID)return is(()=>e.randomUUID()).replace(/-/g,"")}catch{}return fc||(fc="10000000100040008000"+1e11),fc.replace(/[018]/g,t=>(t^(Cv()&15)>>t/4).toString(16))}function Im(e){return e.exception?.values?.[0]}function tr(e){const{message:t,event_id:n}=e;if(t)return t;const r=Im(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"":n||""}function eu(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 pn(e,t){const n=Im(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 xv(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=>dc(o,0));const s=Math.min(r-1,i);t.context_line=dc(e[s],t.colno||0),t.post_context=e.slice(Math.min(i+1,r),i+1+n).map(o=>dc(o,0))}function Qd(e){if(Ov(e))return!0;try{Pe(e,"__sentry_captured__",!0)}catch{}return!1}function Ov(e){try{return e.__sentry_captured__}catch{}}const km=1e3;function kr(){return ss()/km}function Mv(){const{performance:e}=U;if(!e?.now||!e.timeOrigin)return kr;const t=e.timeOrigin;return()=>(t+is(()=>e.now()))/km}let Zd;function Ee(){return(Zd??(Zd=Mv()))()}let pc=null;function Nv(){const{performance:e}=U;if(!e?.now)return;const t=3e5,n=is(()=>e.now()),r=ss(),i=e.timeOrigin;if(typeof i=="number"&&Math.abs(i+n-r)Dv(n)};return e&&Jr(n,e),n}function Jr(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Ee(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:Be()),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 Lv(e,t){let n={};e.status==="ok"&&(n={status:"exited"}),Jr(e,n)}function Dv(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 os(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]=os(r[i],t[i],n-1));return r}function Wt(){return Be()}function an(){return Be().substring(16)}const tu="_sentrySpan";function zt(e,t){t?Pe(e,tu,t):delete e[tu]}function Xr(e){return e[tu]}const Fv=100;class Mt{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:Wt(),sampleRand:on()}}clone(){const t=new Mt;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,zt(t,Xr(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&&Jr(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 Mt?n.getScopeData():ot(n)?t:void 0,{tags:i,attributes:s,extra:o,user:a,contexts:c,level:u,fingerprint:d=[],propagationContext:l,conversationId:f}=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),f&&(this._conversationId=f),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,zt(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Wt(),sampleRand:on()}),this._notifyScopeListeners(),this}addBreadcrumb(t,n){const r=typeof n=="number"?n:Fv;if(r<=0)return this;const i={timestamp:kr(),...t,message:t.message?Vi(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:Xr(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=os(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,n){const r=n?.event_id||Be();if(!this._client)return O&&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||Be();if(!this._client)return O&&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||Be();return this._client?(this._client.captureEvent(t,{...n,event_id:r},this),r):(O&&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 $v(){return pi("defaultCurrentScope",()=>new Mt)}function Uv(){return pi("defaultIsolationScope",()=>new Mt)}class Bv{constructor(t,n){let r;t?r=t:r=new Mt;let i;n?i=n:i=new Mt,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 qn(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(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 Qr(){const e=yn(),t=rs(e);return t.stack=t.stack||new Bv($v(),Uv())}function Hv(e){return Qr().withScope(e)}function jv(e,t){const n=Qr();return n.withScope(()=>(n.getStackTop().scope=e,t(e)))}function ef(e){return Qr().withScope(()=>e(Qr().getIsolationScope()))}function Wv(){return{withIsolationScope:ef,withScope:Hv,withSetScope:jv,withSetIsolationScope:(e,t)=>ef(t),getCurrentScope:()=>Qr().getScope(),getIsolationScope:()=>Qr().getIsolationScope()}}function Gn(e){const t=rs(e);return t.acs?t.acs:Wv()}function z(){const e=yn();return Gn(e).getCurrentScope()}function Le(){const e=yn();return Gn(e).getIsolationScope()}function cr(){return pi("globalScope",()=>new Mt)}function ut(...e){const t=yn(),n=Gn(t);if(e.length===2){const[r,i]=e;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(e[0])}function zv(...e){const t=yn(),n=Gn(t);if(e.length===2){const[r,i]=e;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(e[0])}function M(){return z().getClient()}function Am(e){const t=e.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=t,s={trace_id:n,span_id:i||an()};return r&&(s.parent_span_id=r),s}const fe="sentry.source",ya="sentry.sample_rate",Rm="sentry.previous_trace_sample_rate",me="sentry.op",Y="sentry.origin",Ki="sentry.idle_span_finish_reason",as="sentry.measurement_unit",cs="sentry.measurement_value",nu="sentry.custom_span_name",nl="sentry.profile_id",mi="sentry.exclusive_time",qv="http.request.method",Gv="url.full",Vv="sentry.link.type",Kv="gen_ai.conversation.id",Yv=0,ba=1,ae=2;function Cm(e){if(e<400&&e>=100)return{code:ba};if(e>=400&&e<500)switch(e){case 401:return{code:ae,message:"unauthenticated"};case 403:return{code:ae,message:"permission_denied"};case 404:return{code:ae,message:"not_found"};case 409:return{code:ae,message:"already_exists"};case 413:return{code:ae,message:"failed_precondition"};case 429:return{code:ae,message:"resource_exhausted"};case 499:return{code:ae,message:"cancelled"};default:return{code:ae,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:ae,message:"unimplemented"};case 503:return{code:ae,message:"unavailable"};case 504:return{code:ae,message:"deadline_exceeded"};default:return{code:ae,message:"internal_error"}}return{code:ae,message:"internal_error"}}function Yi(e,t){e.setAttribute("http.response.status_code",t);const n=Cm(t);n.message!=="unknown_error"&&e.setStatus(n)}const xm="_sentryScope",Om="_sentryIsolationScope";function Jv(e){try{const t=U.WeakRef;if(typeof t=="function")return new t(e)}catch{}return e}function Xv(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function Qv(e,t,n){e&&(Pe(e,Om,Jv(n)),Pe(e,xm,t))}function Po(e){const t=e;return{scope:t[xm],isolationScope:Xv(t[Om])}}const rl="sentry-",Zv=/^sentry-/,eE=8192;function il(e){const t=tE(e);if(!t)return;const n=Object.entries(t).reduce((r,[i,s])=>{if(i.match(Zv)){const o=i.slice(rl.length);r[o]=s}return r},{});if(Object.keys(n).length>0)return n}function Mm(e){if(!e)return;const t=Object.entries(e).reduce((n,[r,i])=>(i&&(n[`${rl}${r}`]=i),n),{});return nE(t)}function tE(e){if(!(!e||!xt(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,n)=>{const r=tf(n);return Object.entries(r).forEach(([i,s])=>{t[i]=s}),t},{}):tf(e)}function tf(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 nE(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>eE?(O&&y.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),t):o},"")}const rE=/^o(\d+)\./,iE=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function sE(e){return e==="http"||e==="https"}function bn(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 Nm(e){const t=iE.exec(e);if(!t){jn(()=>{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 Pm({host:s,pass:i,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function Pm(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function oE(e){if(!O)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+$/)?sE(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 aE(e){return e.match(rE)?.[1]}function Lm(e){const t=e.getOptions(),{host:n}=e.getDsn()||{};let r;return t.orgId?r=String(t.orgId):n&&(r=aE(n)),r}function Dm(e){const t=typeof e=="string"?Nm(e):Pm(e);if(!(!t||!oE(t)))return t}function hr(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 Fm=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function cE(e){if(!e)return;const t=e.match(Fm);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 $m(e,t){const n=cE(e),r=il(t);if(!n?.traceId)return{traceId:Wt(),sampleRand:on()};const i=uE(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 Um(e=Wt(),t=an(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${e}-${t}${r}`}function Bm(e=Wt(),t=an(),n){return`00-${e}-${t}-${n?"01":"00"}`}function uE(e,t){const n=hr(t?.sample_rand);if(n!==void 0)return n;const r=hr(t?.sample_rate);return r&&e?.parentSampled!==void 0?e.parentSampled?on()*r:r+on()*(1-r):on()}function lE(e,t){const n=Lm(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 Hm=0,sl=1;let nf=!1;function dE(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:s,status:o,origin:a,links:c}=$(e);return{parent_span_id:s,span_id:t,trace_id:n,data:r,op:i,status:o,origin:a,links:c}}function jm(e){const{spanId:t,traceId:n,isRemote:r}=e.spanContext(),i=r?t:$(e).parent_span_id,s=Po(e).scope,o=r?s?.getPropagationContext().propagationSpanId||an():t;return{parent_span_id:i,span_id:o,trace_id:n}}function Wm(e){const{traceId:t,spanId:n}=e.spanContext(),r=Vn(e);return Um(t,n,r)}function fE(e){const{traceId:t,spanId:n}=e.spanContext(),r=Vn(e);return Bm(t,n,r)}function zm(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===sl,attributes:s,...i}))}function ur(e){return typeof e=="number"?rf(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?rf(e.getTime()):Ee()}function rf(e){return e>9999999999?e/1e3:e}function $(e){if(hE(e))return e.getSpanJSON();const{spanId:t,traceId:n}=e.spanContext();if(pE(e)){const{attributes:r,startTime:i,name:s,endTime:o,status:a,links:c}=e,u="parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0;return{span_id:t,trace_id:n,data:r,description:s,parent_span_id:u,start_timestamp:ur(i),timestamp:ur(o)||void 0,status:qm(a),op:r[me],origin:r[Y],links:zm(c)}}return{span_id:t,trace_id:n,start_timestamp:0,data:{}}}function pE(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function hE(e){return typeof e.getSpanJSON=="function"}function Vn(e){const{traceFlags:t}=e.spanContext();return t===sl}function qm(e){if(!(!e||e.code===Yv))return e.code===ba?"ok":e.message||"internal_error"}const lr="_sentryChildSpans",ru="_sentryRootSpan";function Gm(e,t){const n=e[ru]||e;Pe(t,ru,n),e[lr]?e[lr].add(t):Pe(e,lr,new Set([t]))}function mE(e,t){e[lr]&&e[lr].delete(t)}function Hi(e){const t=new Set;function n(r){if(!t.has(r)&&Vn(r)){t.add(r);const i=r[lr]?Array.from(r[lr]):[];for(const s of i)n(s)}}return n(e),Array.from(t)}function xe(e){return e[ru]||e}function Oe(){const e=yn(),t=Gn(e);return t.getActiveSpan?t.getActiveSpan():Xr(z())}function iu(){nf||(jn(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),nf=!0)}function gE(e,t){e.updateName(t),e.setAttributes({[fe]:"custom",[nu]:t})}let sf=!1;function Vm(){if(sf)return;function e(){const t=Oe(),n=t&&xe(t);if(n){const r="internal_error";O&&y.log(`[Tracing] Root span: ${r} -> Global error occurred`),n.setStatus({code:ae,message:r})}}e.tag="sentry_tracingErrorCallback",sf=!0,_m(e),ym(e)}function bt(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=e||M()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function of(e){y.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Lo(e,t){if(!t?.length||!e.description)return!1;for(const n of t){if(yE(n)){if(uo(e.description,n))return O&&of(e),!0;continue}if(!n.name&&!n.op)continue;const r=n.name?uo(e.description,n.name):!0,i=n.op?e.op&&uo(e.op,n.op):!0;if(r&&i)return O&&of(e),!0}return!1}function _E(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 yE(e){return typeof e=="string"||e instanceof RegExp}const Sa="production",Km="_frozenDsc";function lo(e,t){Pe(e,Km,t)}function Ym(e,t){const n=t.getOptions(),{publicKey:r}=t.getDsn()||{},i={environment:n.environment||Sa,release:n.release,public_key:r,trace_id:e,org_id:Lm(t)};return t.emit("createDsc",i),i}function ol(e,t){const n=t.getPropagationContext();return n.dsc||Ym(n.traceId,e)}function Nt(e){const t=M();if(!t)return{};const n=xe(e),r=$(n),i=r.data,s=n.spanContext().traceState,o=s?.get("sentry.sample_rate")??i[ya]??i[Rm];function a(h){return(typeof o=="number"||typeof o=="string")&&(h.sample_rate=`${o}`),h}const c=n[Km];if(c)return a(c);const u=s?.get("sentry.dsc"),d=u&&il(u);if(d)return a(d);const l=Ym(e.spanContext().traceId,t),f=i[fe],p=r.description;return f!=="url"&&p&&(l.transaction=p),bt()&&(l.sampled=String(Vn(n)),l.sample_rand=s?.get("sentry.sample_rand")??Po(n).scope?.getPropagationContext().sampleRand.toString()),a(l),t.emit("createDsc",l,n),l}function bE(e){const t=Nt(e);return Mm(t)}class hn{constructor(t={}){this._traceId=t.traceId||Wt(),this._spanId=t.spanId||an()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Hm}}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 Ye(e,t=100,n=1/0){try{return su("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Jm(e,t=3,n=100*1024){const r=Ye(e,t);return TE(r)>n?Jm(e,t-1,n):r}function su(e,t,n=1/0,r=1/0,i=wE()){const[s,o]=i;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=SE(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const c=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(t))return"[Circular ~]";const u=t;if(u&&typeof u.toJSON=="function")try{const p=u.toJSON();return su("",p,c-1,r,i)}catch{}const d=Array.isArray(t)?[]:{};let l=0;const f=wm(t);for(const p in f){if(!Object.prototype.hasOwnProperty.call(f,p))continue;if(l>=r){d[p]="[MaxProperties ~]";break}const h=f[p];d[p]=su(p,h,c-1,r,i),l++}return o(t),d}function SE(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(vm(t))return gm(t);if(wv(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${dn(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const n=vE(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function vE(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function EE(e){return~-encodeURI(e).split(/%..|./).length}function TE(e){return EE(JSON.stringify(e))}function wE(){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 Lt(e,t=[]){return[e,t]}function IE(e,t){const[n,r]=e;return[n,[...r,t]]}function mr(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 ou(e,t){return mr(e,(n,r)=>t.includes(r))}function Do(e){const t=rs(U);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function kE(e){const t=rs(U);return t.decodePolyfill?t.decodePolyfill(e):new TextDecoder().decode(e)}function Fo(e){const[t,n]=e;let r=JSON.stringify(t);function i(s){typeof r=="string"?r=typeof s=="string"?r+s:[Do(r),s]:r.push(typeof s=="string"?Do(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(Ye(a))}i(c)}}return typeof r=="string"?r:AE(r)}function AE(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 RE(e){let t=typeof e=="string"?Do(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(kE(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 CE(e){return[{type:"span"},e]}function xE(e){const t=typeof e.data=="string"?Do(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const OE={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function af(e){return OE[e]}function va(e){if(!e?.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function Xm(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:bn(r)},...i&&{trace:i}}}function ME(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 NE(e,t,n,r){const i=va(n),s={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:bn(t)}},o="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return Lt(s,[o])}function PE(e,t,n,r){const i=va(n),s=e.type&&e.type!=="replay_event"?e.type:"event";ME(e,n?.sdk);const o=Xm(e,i,r,t);return delete e.sdkProcessingMetadata,Lt(o,[[{type:s},e]])}function LE(e,t){function n(p){return!!p.trace_id&&!!p.public_key}const r=Nt(e[0]),i=t?.getDsn(),s=t?.getOptions().tunnel,o={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&i&&{dsn:bn(i)}},{beforeSendSpan:a,ignoreSpans:c}=t?.getOptions()||{},u=c?.length?e.filter(p=>!Lo($(p),c)):e,d=e.length-u.length;d&&t?.recordDroppedEvent("before_send","span",d);const l=a?p=>{const h=$(p),m=a(h);return m||(iu(),h)}:$,f=[];for(const p of u){const h=l(p);h&&f.push(CE(h))}return Lt(o,f)}function DE(e){if(!O)return;const{description:t="< unknown name >",op:n="< unknown op >",parent_span_id:r}=$(e),{spanId:i}=e.spanContext(),s=Vn(e),o=xe(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}=$(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 FE(e){if(!O)return;const{description:t="< unknown name >",op:n="< unknown op >"}=$(e),{spanId:r}=e.spanContext(),s=xe(e)===e,o=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${t}" with ID ${r}`;y.log(o)}function Qm(e,t,n,r=Oe()){const i=r&&xe(r);i&&(O&&y.log(`[Measurement] Setting measurement on root span: ${e} = ${t} ${n}`),i.addEvent(e,{[cs]:t,[as]:n}))}function cf(e){if(!e||e.length===0)return;const t={};return e.forEach(n=>{const r=n.attributes||{},i=r[as],s=r[cs];typeof i=="string"&&typeof s=="number"&&(t[n.name]={value:s,unit:i})}),t}const uf=1e3;class Ea{constructor(t={}){this._traceId=t.traceId||Wt(),this._spanId=t.spanId||an(),this._startTime=t.startTimestamp||Ee(),this._links=t.links,this._attributes={},this.setAttributes({[Y]:"manual",[me]: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?sl:Hm}}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=ur(t)}setStatus(t){return this._status=t,this}updateName(t){return this._name=t,this.setAttribute(fe,"custom"),this}end(t){this._endTime||(this._endTime=ur(t),FE(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[me],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:qm(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[Y],profile_id:this._attributes[nl],exclusive_time:this._attributes[mi],measurements:cf(this._events),is_segment:this._isStandaloneSpan&&xe(this)===this||void 0,segment_id:this._isStandaloneSpan?xe(this).spanContext().spanId:void 0,links:zm(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(t,n,r){O&&y.log("[Tracing] Adding an event to span:",t);const i=lf(n)?n:r||Ee(),s=lf(n)?{}:n||{},o={name:t,time:ur(i),attributes:s};return this._events.push(o),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const t=M();if(t&&t.emit("spanEnd",this),!(this._isStandaloneSpan||this===xe(this)))return;if(this._isStandaloneSpan){this._sampled?UE(LE([this],t)):(O&&y.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),t&&t.recordDroppedEvent("sample_rate","span"));return}const r=this._convertSpanToTransaction();r&&(Po(this).scope||z()).captureEvent(r)}_convertSpanToTransaction(){if(!df($(this)))return;this._name||(O&&y.warn("Transaction has no name, falling back to ``."),this._name="");const{scope:t,isolationScope:n}=Po(this),r=t?.getScopeData().sdkProcessingMetadata?.normalizedRequest;if(this._sampled!==!0)return;const s=Hi(this).filter(d=>d!==this&&!$E(d)).map(d=>$(d)).filter(df),o=this._attributes[fe];delete this._attributes[nu],s.forEach(d=>{delete d.data[nu]});const a={contexts:{trace:dE(this)},spans:s.length>uf?s.sort((d,l)=>d.start_timestamp-l.start_timestamp).slice(0,uf):s,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:t,capturedSpanIsolationScope:n,dynamicSamplingContext:Nt(this)},request:r,...o&&{transaction_info:{source:o}}},c=cf(this._events);return c&&Object.keys(c).length&&(O&&y.log("[Measurements] Adding measurements to transaction event",JSON.stringify(c,void 0,2)),a.measurements=c),a}}function lf(e){return e&&typeof e=="number"||e instanceof Date||Array.isArray(e)}function df(e){return!!e.start_timestamp&&!!e.timestamp&&!!e.span_id&&!!e.trace_id}function $E(e){return e instanceof Ea&&e.isStandaloneSpan()}function UE(e){const t=M();if(!t)return;const n=e[1];if(!n||n.length===0){t.recordDroppedEvent("before_send","span");return}t.sendEnvelope(e)}function Ta(e,t,n=()=>{},r=()=>{}){let i;try{i=e()}catch(s){throw t(s),n(),s}return BE(i,t,n,r)}function BE(e,t,n,r){return qn(e)?e.then(i=>(n(),r(i),i),i=>{throw t(i),n(),i}):(n(),r(e),e)}function HE(e,t,n){if(!bt(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=hr(i);if(s===void 0)return O&&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 O&&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=ntg(s)(()=>{const u=z(),d=ul(u,s),f=e.onlyIfParent&&!d?new hn:al({parentSpan:d,spanArguments:r,forceTransaction:i,scope:u});return zt(u,f),Ta(()=>t(f),()=>{const{status:p}=$(f);f.isRecording()&&(!p||p==="ok")&&f.setStatus({code:ae,message:"internal_error"})},()=>{f.end()})}))}function tn(e,t){const n=us();if(n.startSpanManual)return n.startSpanManual(e,t);const r=cl(e),{forceTransaction:i,parentSpan:s,scope:o}=e,a=o?.clone();return ut(a,()=>tg(s)(()=>{const u=z(),d=ul(u,s),f=e.onlyIfParent&&!d?new hn:al({parentSpan:d,spanArguments:r,forceTransaction:i,scope:u});return zt(u,f),Ta(()=>t(f,()=>f.end()),()=>{const{status:p}=$(f);f.isRecording()&&(!p||p==="ok")&&f.setStatus({code:ae,message:"internal_error"})})}))}function St(e){const t=us();if(t.startInactiveSpan)return t.startInactiveSpan(e);const n=cl(e),{forceTransaction:r,parentSpan:i}=e;return(e.scope?o=>ut(e.scope,o):i!==void 0?o=>gr(i,o):o=>o())(()=>{const o=z(),a=ul(o,i);return e.onlyIfParent&&!a?new hn:al({parentSpan:a,spanArguments:n,forceTransaction:r,scope:o})})}const jE=(e,t)=>{const n=yn(),r=Gn(n);if(r.continueTrace)return r.continueTrace(e,t);const{sentryTrace:i,baggage:s}=e,o=M(),a=il(s);return o&&!lE(o,a?.org_id)?eg(t):ut(c=>{const u=$m(i,s);return c.setPropagationContext(u),zt(c,void 0),t()})};function gr(e,t){const n=us();return n.withActiveSpan?n.withActiveSpan(e,t):ut(r=>(zt(r,e||void 0),t(r)))}function Zm(e){const t=us();return t.suppressTracing?t.suppressTracing(e):ut(n=>{n.setSDKProcessingMetadata({[$o]:!0});const r=e();return n.setSDKProcessingMetadata({[$o]:void 0}),r})}function eg(e){return ut(t=>(t.setPropagationContext({traceId:Wt(),sampleRand:on()}),O&&y.log(`Starting a new trace with id ${t.getPropagationContext().traceId}`),gr(null,e)))}function al({parentSpan:e,spanArguments:t,forceTransaction:n,scope:r}){if(!bt()){const o=new hn;if(n||!e){const a={sampled:"false",sample_rate:"0",transaction:t.name,...Nt(o)};lo(o,a)}return o}const i=Le();let s;if(e&&!n)s=WE(e,r,t),Gm(e,s);else if(e){const o=Nt(e),{traceId:a,spanId:c}=e.spanContext(),u=Vn(e);s=ff({traceId:a,parentSpanId:c,...t},r,u),lo(s,o)}else{const{traceId:o,dsc:a,parentSpanId:c,sampled:u}={...i.getPropagationContext(),...r.getPropagationContext()};s=ff({traceId:o,parentSpanId:c,...t},r,u),a&&lo(s,a)}return DE(s),Qv(s,r,i),s}function cl(e){const n={isStandalone:(e.experimental||{}).standalone,...e};if(e.startTime){const r={...n};return r.startTimestamp=ur(e.startTime),delete r.startTime,r}return n}function us(){const e=yn();return Gn(e)}function ff(e,t,n){const r=M(),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,l,f]=t.getScopeData().sdkProcessingMetadata[$o]?[!1]:HE(i,{name:s,parentSampled:a,attributes:c,parentSampleRate:hr(u.dsc?.sample_rate)},u.sampleRand),p=new Ea({...e,attributes:{[fe]:"custom",[ya]:l!==void 0&&f?l:void 0,...c},sampled:d});return!d&&r&&(O&&y.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",p),p}function WE(e,t,n){const{spanId:r,traceId:i}=e.spanContext(),s=t.getScopeData().sdkProcessingMetadata[$o]?!1:Vn(e),o=s?new Ea({...n,parentSpanId:r,traceId:i,sampled:s}):new hn({traceId:i});Gm(e,o);const a=M();return a&&(a.emit("spanStart",o),n.endTimestamp&&a.emit("spanEnd",o)),o}function ul(e,t){if(t)return t;if(t===null)return;const n=Xr(e);if(!n)return;const r=M();return(r?r.getOptions():{}).parentSpanIsAlwaysRootSpan?xe(n):n}function tg(e){return e!==void 0?t=>gr(e,t):t=>t()}const fo={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},zE="heartbeatFailed",qE="idleTimeout",GE="finalTimeout",VE="externalFinish";function ng(e,t={}){const n=new Map;let r=!1,i,s=VE,o=!t.disableAutoFinish;const a=[],{idleTimeout:c=fo.idleTimeout,finalTimeout:u=fo.finalTimeout,childSpanTimeout:d=fo.childSpanTimeout,beforeSpanEnd:l,trimIdleSpanEndTimestamp:f=!0}=t,p=M();if(!p||!bt()){const b=new hn,k={sample_rate:"0",sampled:"false",...Nt(b)};return lo(b,k),b}const h=z(),m=Oe(),g=KE(e);g.end=new Proxy(g.end,{apply(b,k,F){if(l&&l(g),k instanceof hn)return;const[I,...L]=F,C=I||Ee(),P=ur(C),D=Hi(g).filter(R=>R!==g),ee=$(g);if(!D.length||!f)return E(P),Reflect.apply(b,k,[P,...L]);const V=p.getOptions().ignoreSpans,Q=D?.reduce((R,W)=>{const ie=$(W);return!ie.timestamp||V&&Lo(ie,V)?R:R?Math.max(R,ie.timestamp):ie.timestamp},void 0),A=ee.start_timestamp,B=Math.min(A?A+u/1e3:1/0,Math.max(A||-1/0,Math.min(P,Q||1/0)));return E(B),Reflect.apply(b,k,[B,...L])}});function _(){i&&(clearTimeout(i),i=void 0)}function S(b){_(),i=setTimeout(()=>{!r&&n.size===0&&o&&(s=qE,g.end(b))},c)}function T(b){i=setTimeout(()=>{!r&&o&&(s=zE,g.end(b))},d)}function v(b){_(),n.set(b,!0);const k=Ee();T(k+d/1e3)}function w(b){if(n.has(b)&&n.delete(b),n.size===0){const k=Ee();S(k+c/1e3)}}function E(b){r=!0,n.clear(),a.forEach(D=>D()),zt(h,m);const k=$(g),{start_timestamp:F}=k;if(!F)return;k.data[Ki]||g.setAttribute(Ki,s);const L=k.status;(!L||L==="unknown")&&g.setStatus({code:ba}),y.log(`[Tracing] Idle span "${k.op}" finished`);const C=Hi(g).filter(D=>D!==g);let P=0;C.forEach(D=>{D.isRecording()&&(D.setStatus({code:ae,message:"cancelled"}),D.end(b),O&&y.log("[Tracing] Cancelling span since span ended early",JSON.stringify(D,void 0,2)));const ee=$(D),{timestamp:V=0,start_timestamp:Q=0}=ee,A=Q<=b,B=(u+c)/1e3,R=V-Q<=B;if(O){const W=JSON.stringify(D,void 0,2);A?R||y.log("[Tracing] Discarding span since it finished after idle span final timeout",W):y.log("[Tracing] Discarding span since it happened after idle span was finished",W)}(!R||!A)&&(mE(g,D),P++)}),P>0&&g.setAttribute("sentry.idle_span_discarded_spans",P)}return a.push(p.on("spanStart",b=>{if(r||b===g||$(b).timestamp||b instanceof Ea&&b.isStandaloneSpan())return;Hi(g).includes(b)&&v(b.spanContext().spanId)})),a.push(p.on("spanEnd",b=>{r||w(b.spanContext().spanId)})),a.push(p.on("idleSpanEnableAutoFinish",b=>{b===g&&(o=!0,S(),n.size&&T())})),t.disableAutoFinish||S(),setTimeout(()=>{r||(g.setStatus({code:ae,message:"deadline_exceeded"}),s=GE,g.end())},u),g}function KE(e){const t=St(e);return zt(z(),t),O&&y.log("[Tracing] Started span is an idle span"),t}const hc=0,pf=1,hf=2;function ls(e){return new Ji(t=>{t(e)})}function ll(e){return new Ji((t,n)=>{n(e)})}class Ji{constructor(t){this._state=hc,this._handlers=[],this._runExecutor(t)}then(t,n){return new Ji((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 Ji((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===hc)return;const t=this._handlers.slice();this._handlers=[],t.forEach(n=>{n[0]||(this._state===pf&&n[1](this._value),this._state===hf&&n[2](this._value),n[0]=!0)})}_runExecutor(t){const n=(s,o)=>{if(this._state===hc){if(qn(o)){o.then(r,i);return}this._state=s,this._value=o,this._executeHandlers()}},r=s=>{n(pf,s)},i=s=>{n(hf,s)};try{t(r,i)}catch(s){i(s)}}}function YE(e,t,n,r=0){try{const i=au(t,n,e,r);return qn(i)?i:ls(i)}catch(i){return ll(i)}}function au(e,t,n,r){const i=n[r];if(!e||!i)return e;const s=i({...e},t);return O&&s===null&&y.log(`Event processor "${i.id||"?"}" dropped event`),qn(s)?s.then(o=>au(o,t,n,r+1)):au(s,t,n,r+1)}let Zn,mf,gf,wn;function rg(e){const t=U._sentryDebugIds,n=U._debugIds;if(!t&&!n)return{};const r=t?Object.keys(t):[],i=n?Object.keys(n):[];if(wn&&r.length===mf&&i.length===gf)return wn;mf=r.length,gf=i.length,wn={},Zn||(Zn={});const s=(o,a)=>{for(const c of o){const u=a[c],d=Zn?.[c];if(d&&wn&&u)wn[d[0]]=u,Zn&&(Zn[c]=[d[0],u]);else if(u){const l=e(c);for(let f=l.length-1;f>=0;f--){const h=l[f]?.filename;if(h&&wn&&Zn){wn[h]=u,Zn[c]=[h,u];break}}}}};return t&&s(r,t),n&&s(i,n),wn}function JE(e,t){const n=rg(e);if(!n)return[];const r=[];for(const i of t){const s=yv(i);s&&n[s]&&r.push({type:"sourcemap",code_file:i,debug_id:n[s]})}return r}function XE(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=t;QE(e,t),r&&t0(e,r),n0(e,n),ZE(e,i),e0(e,s)}function _f(e,t){const{extra:n,tags:r,attributes:i,user:s,contexts:o,level:a,sdkProcessingMetadata:c,breadcrumbs:u,fingerprint:d,eventProcessors:l,attachments:f,propagationContext:p,transactionName:h,span:m}=t;Oi(e,"extra",n),Oi(e,"tags",r),Oi(e,"attributes",i),Oi(e,"user",s),Oi(e,"contexts",o),e.sdkProcessingMetadata=os(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]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...p}}function Oi(e,t,n){e[t]=os(e[t],n,1)}function wa(e,t){const n=cr().getScopeData();return e&&_f(n,e.getScopeData()),t&&_f(n,t.getScopeData()),n}function QE(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 ZE(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function e0(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function t0(e,t){e.contexts={trace:jm(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Nt(t),...e.sdkProcessingMetadata};const n=xe(t),r=$(n).description;r&&!e.transaction&&e.type==="transaction"&&(e.transaction=r)}function n0(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}function ig(e,t,n,r,i,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Be(),timestamp:t.timestamp||kr()},u=n.integrations||e.integrations.map(_=>_.name);r0(c,e),o0(c,u),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&i0(c,e.stackParser);const d=c0(r,n.captureContext);n.mechanism&&pn(c,n.mechanism);const l=i?i.getEventProcessors():[],f=wa(s,d),p=[...n.attachments||[],...f.attachments];p.length&&(n.attachments=p),XE(c,f);const h=[...l,...f.eventProcessors];return(n.data&&n.data.__sentry__===!0?ls(c):YE(h,c,n)).then(_=>(_&&s0(_),typeof o=="number"&&o>0?a0(_,o,a):_))}function r0(e,t){const{environment:n,release:r,dist:i,maxValueLength:s}=t;e.environment=e.environment||n||Sa,!e.release&&r&&(e.release=r),!e.dist&&i&&(e.dist=i);const o=e.request;o?.url&&s&&(o.url=Vi(o.url,s)),s&&e.exception?.values?.forEach(a=>{a.value&&(a.value=Vi(a.value,s))})}function i0(e,t){const n=rg(t);e.exception?.values?.forEach(r=>{r.stacktrace?.frames?.forEach(i=>{i.filename&&(i.debug_id=n[i.filename])})})}function s0(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 o0(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function a0(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:Ye(i.data,t,n)}}))},...e.user&&{user:Ye(e.user,t,n)},...e.contexts&&{contexts:Ye(e.contexts,t,n)},...e.extra&&{extra:Ye(e.extra,t,n)}};return e.contexts?.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=Ye(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(i=>({...i,...i.data&&{data:Ye(i.data,t,n)}}))),e.contexts?.flags&&r.contexts&&(r.contexts.flags=Ye(e.contexts.flags,3,n)),r}function c0(e,t){if(!t)return e;const n=e?e.clone():new Mt;return n.update(t),n}function u0(e){if(e)return l0(e)?{captureContext:e}:f0(e)?{captureContext:e}:e}function l0(e){return e instanceof Mt||typeof e=="function"}const d0=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function f0(e){return Object.keys(e).some(t=>d0.includes(t))}function Ie(e,t){return z().captureException(e,u0(t))}function sg(e,t){const n=typeof t=="string"?t:void 0,r=typeof t!="string"?{captureContext:t}:void 0;return z().captureMessage(e,n,r)}function gi(e,t){return z().captureEvent(e,t)}function dl(e,t){Le().setContext(e,t)}function p0(e){Le().setExtras(e)}function h0(e,t){Le().setExtra(e,t)}function m0(e){Le().setTags(e)}function g0(e,t){Le().setTag(e,t)}function _0(e){Le().setUser(e)}function og(){return Le().lastEventId()}async function y0(e){const t=M();return t?t.flush(e):(O&&y.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function b0(e){const t=M();return t?t.close(e):(O&&y.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function S0(){return!!M()}function ag(){const e=M();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function cg(e){Le().addEventProcessor(e)}function cu(e){const t=Le(),{user:n}=wa(t,z()),{userAgent:r}=U.navigator||{},i=Pv({user:n,...r&&{userAgent:r},...e}),s=t.getSession();return s?.status==="ok"&&Jr(s,{status:"exited"}),fl(),t.setSession(i),i}function fl(){const e=Le(),n=z().getSession()||e.getSession();n&&Lv(n),ug(),e.setSession()}function ug(){const e=Le(),t=M(),n=e.getSession();n&&t&&t.captureSession(n)}function po(e=!1){if(e){fl();return}ug()}const v0="7";function lg(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}function E0(e){return`${lg(e)}${e.projectId}/envelope/`}function T0(e,t){const n={sentry_version:v0};return e.publicKey&&(n.sentry_key=e.publicKey),t&&(n.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(n).toString()}function dg(e,t,n){return t||`${E0(e)}?${T0(e,n)}`}function w0(e,t){const n=Dm(e);if(!n)return"";const r=`${lg(n)}embed/error-page/`;let i=`dsn=${bn(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 yf=[];function I0(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 k0(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 I0(r)}function A0(e,t){const n={};return t.forEach(r=>{r&&fg(e,r,n)}),n}function bf(e,t){for(const n of t)n?.afterAllSetup&&n.afterAllSetup(e)}function fg(e,t,n){if(n[t.name]){O&&y.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,!yf.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),yf.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)}O&&y.log(`Integration installed: ${t.name}`)}function uu(e){const t=M();if(!t){O&&y.warn(`Cannot add integration "${e.name}" because no SDK Client is available.`);return}t.addIntegration(e)}function R0(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function C0(e,t){const{value:n,unit:r}=R0(e)?e:{value:e,unit:void 0},i=x0(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 Uo(e,t=!1){const n={};for(const[r,i]of Object.entries(e??{})){const s=C0(i,t);s&&(n[r]=s)}return n}function x0(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 pg(e,t){return t?ut(t,()=>{const n=Oe(),r=n?jm(n):Am(t);return[n?Nt(n):ol(e,t),r]}):[void 0,void 0]}const O0={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function M0(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function N0(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=bn(r)),Lt(i,[M0(e)])}const P0=100;function $t(e,t,n,r=!0){n&&(!e[t]||r)&&(e[t]=n)}function L0(e,t){const n=pl(),r=hg(e);r===void 0?n.set(e,[t]):r.length>=P0?(Ho(e,r),n.set(e,[t])):n.set(e,[...r,t])}function Bo(e,t=z(),n=L0){const r=t?.getClient()??M();if(!r){O&&y.warn("No client available to capture log.");return}const{release:i,environment:s,enableLogs:o=!1,beforeSendLog:a}=r.getOptions();if(!o){O&&y.warn("logging option not enabled, log will not be captured.");return}const[,c]=pg(r,t),u={...e.attributes},{user:{id:d,email:l,username:f},attributes:p={}}=wa(Le(),t);$t(u,"user.id",d,!1),$t(u,"user.email",l,!1),$t(u,"user.name",f,!1),$t(u,"sentry.release",i),$t(u,"sentry.environment",s);const{name:h,version:m}=r.getSdkMetadata()?.sdk??{};$t(u,"sentry.sdk.name",h),$t(u,"sentry.sdk.version",m);const g=r.getIntegrationByName("Replay"),_=g?.getReplayId(!0);$t(u,"sentry.replay_id",_),_&&g?.getRecordingMode()==="buffer"&&$t(u,"sentry._internal.replay_is_buffering",!0);const S=e.message;if(ga(S)){const{__sentry_template_string__:L,__sentry_template_values__:C=[]}=S;C?.length&&(u["sentry.message.template"]=L),C.forEach((P,D)=>{u[`sentry.message.parameter.${D}`]=P})}const T=Xr(t);$t(u,"sentry.trace.parent_span_id",T?.spanContext().spanId);const v={...e,attributes:u};r.emit("beforeCaptureLog",v);const w=a?jn(()=>a(v)):v;if(!w){r.recordDroppedEvent("before_send","log_item",1),O&&y.warn("beforeSendLog returned null, log will not be captured.");return}const{level:E,message:b,attributes:k={},severityNumber:F}=w,I={timestamp:Ee(),level:E,body:b,trace_id:c?.trace_id,severity_number:F??O0[E],attributes:{...Uo(p),...Uo(k,!0)}};n(r,I),r.emit("afterCaptureLog",w)}function Ho(e,t){const n=t??hg(e)??[];if(n.length===0)return;const r=e.getOptions(),i=N0(n,r._metadata,r.tunnel,e.getDsn());pl().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(i)}function hg(e){return pl().get(e)}function pl(){return pi("clientToLogBufferMap",()=>new WeakMap)}function D0(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function F0(e,t,n,r){const i={};return t?.sdk&&(i.sdk={name:t.sdk.name,version:t.sdk.version}),n&&r&&(i.dsn=bn(r)),Lt(i,[D0(e)])}const $0=1e3;function Qt(e,t,n,r=!0){n&&(r||!(t in e))&&(e[t]=n)}function U0(e,t){const n=ml(),r=mg(e);r===void 0?n.set(e,[t]):r.length>=$0?(hl(e,r),n.set(e,[t])):n.set(e,[...r,t])}function B0(e,t,n){const{release:r,environment:i}=t.getOptions(),s={...e.attributes};Qt(s,"user.id",n.id,!1),Qt(s,"user.email",n.email,!1),Qt(s,"user.name",n.username,!1),Qt(s,"sentry.release",r),Qt(s,"sentry.environment",i);const{name:o,version:a}=t.getSdkMetadata()?.sdk??{};Qt(s,"sentry.sdk.name",o),Qt(s,"sentry.sdk.version",a);const c=t.getIntegrationByName("Replay"),u=c?.getReplayId(!0);return Qt(s,"sentry.replay_id",u),u&&c?.getRecordingMode()==="buffer"&&Qt(s,"sentry._internal.replay_is_buffering",!0),{...e,attributes:s}}function H0(e,t,n,r){const[,i]=pg(t,n),s=Xr(n),o=s?s.spanContext().traceId:i?.trace_id,a=s?s.spanContext().spanId:void 0;return{timestamp:Ee(),trace_id:o??"",span_id:a,name:e.name,type:e.type,unit:e.unit,value:e.value,attributes:{...Uo(r),...Uo(e.attributes,"skip-undefined")}}}function j0(e,t){const n=t?.scope??z(),r=t?.captureSerializedMetric??U0,i=n?.getClient()??M();if(!i){O&&y.warn("No client available to capture metric.");return}const{_experiments:s,enableMetrics:o,beforeSendMetric:a}=i.getOptions();if(!(o??s?.enableMetrics??!0)){O&&y.warn("metrics option not enabled, metric will not be captured.");return}const{user:u,attributes:d}=wa(Le(),n),l=B0(e,i,u);i.emit("processMetric",l);const f=a||s?.beforeSendMetric,p=f?f(l):l;if(!p){O&&y.log("`beforeSendMetric` returned `null`, will not send metric.");return}const h=H0(p,i,n,d);O&&y.log("[Metric]",h),r(i,h),i.emit("afterCaptureMetric",p)}function hl(e,t){const n=t??mg(e)??[];if(n.length===0)return;const r=e.getOptions(),i=F0(n,r._metadata,r.tunnel,e.getDsn());ml().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(i)}function mg(e){return ml().get(e)}function ml(){return pi("clientToMetricBufferMap",()=>new WeakMap)}function gl(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}const _l=Symbol.for("SentryBufferFullError");function yl(e=100){const t=new Set;function n(){return t.sizer(a),()=>r(a)),a}function s(o){if(!t.size)return ls(!0);const a=Promise.allSettled(Array.from(t)).then(()=>!0);if(!o)return a;const c=[a,new Promise(u=>gl(setTimeout(()=>u(!1),o)))];return Promise.race(c)}return{get $(){return Array.from(t)},add:i,drain:s}}const W0=60*1e3;function gg(e,t=ss()){const n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${e}`);return isNaN(r)?W0:r-t}function z0(e,t){return e[t]||e.all||0}function _g(e,t,n=ss()){return z0(e,t)>n}function yg(e,{statusCode:t,headers:n},r=ss()){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),f=(isNaN(l)?60:l)*1e3;if(!u)i.all=r+f;else for(const p of u.split(";"))p==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[p]=r+f):i[p]=r+f}else o?i.all=r+gg(o,r):t===429&&(i.all=r+60*1e3);return i}const bg=64;function Sg(e,t,n=yl(e.bufferSize||bg)){let r={};const i=o=>n.drain(o);function s(o){const a=[];if(mr(o,(l,f)=>{const p=af(f);_g(r,p)?e.recordDroppedEvent("ratelimit_backoff",p):a.push(l)}),a.length===0)return Promise.resolve({});const c=Lt(o[0],a),u=l=>{if(ou(c,["client_report"])){O&&y.warn(`Dropping client report. Will not send outcomes (reason: ${l}).`);return}mr(c,(f,p)=>{e.recordDroppedEvent(l,af(p))})},d=()=>t({body:Fo(c)}).then(l=>l.statusCode===413?(O&&y.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),u("send_error"),l):(O&&l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&y.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=yg(r,l),l),l=>{throw u("network_error"),O&&y.error("Encountered error running transport request:",l),l});return n.add(d).then(l=>l,l=>{if(l===_l)return O&&y.error("Skipped sending event because buffer is full."),u("queue_overflow"),Promise.resolve({});throw l})}return{send:s,flush:i}}function q0(e,t,n){const r=[{type:"client_report"},{timestamp:kr(),discarded_events:e}];return Lt(t?{dsn:t}:{},[r])}function vg(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 G0(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?.[nl],exclusive_time:o?.[mi],measurements:e.measurements,is_segment:!0}}function V0(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&&{[nl]:e.profile_id},...e.exclusive_time&&{[mi]:e.exclusive_time}}}},measurements:e.measurements}}const Sf="Not capturing exception because it's already been captured.",vf="Discarded session because of missing or non-string release",Eg=Symbol.for("SentryInternalError"),Tg=Symbol.for("SentryDoNotSendEventError"),K0=5e3;function ho(e){return{message:e,[Eg]:!0}}function mc(e){return{message:e,[Tg]:!0}}function Ef(e){return!!e&&typeof e=="object"&&Eg in e}function Tf(e){return!!e&&typeof e=="object"&&Tg in e}function wf(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=gl(setTimeout(()=>{i(e)},K0)))}),e.on("flush",()=>{i(e)})}class Y0{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=yl(t.transportOptions?.bufferSize??bg),t.dsn?this._dsn=Dm(t.dsn):O&&y.warn("No DSN provided, client will not send events."),this._dsn){const r=dg(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&&wf(this,"afterCaptureLog","flushLogs",Z0,Ho),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&wf(this,"afterCaptureMetric","flushMetrics",Q0,hl)}captureException(t,n,r){const i=Be();if(Qd(t))return O&&y.log(Sf),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:Be(),...r},o=ga(t)?t:String(t),a=$n(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=Be();if(n?.originalException&&Qd(n.originalException))return O&&y.log(Sf),i;const s={event_id:i,...n},o=t.sdkProcessingMetadata||{},a=o.capturedSpanScope,c=o.capturedSpanIsolationScope,u=If(t.type);return this._process(()=>this._captureEvent(t,s,a||r,c),u),s.event_id}captureSession(t){this.sendSession(t),Jr(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(!n)return!0;this.emit("flush");const r=await this._isClientDoneProcessing(t),i=await n.flush(t);return r&&i}async close(t){Ho(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];fg(this,t,this._integrations),n||bf(this,[t])}sendEvent(t,n={}){this.emit("beforeSendEvent",t,n);let r=PE(t,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])r=IE(r,xE(i));this.sendEnvelope(r).then(i=>this.emit("afterSendEvent",t,i))}sendSession(t){const{release:n,environment:r=Sa}=this._options;if("aggregates"in t){const s=t.attrs||{};if(!s.release&&!n){O&&y.warn(vf);return}s.release=s.release||n,s.environment=s.environment||r,t.attrs=s}else{if(!t.release&&!n){O&&y.warn(vf);return}t.release=t.release||n,t.environment=t.environment||r}this.emit("beforeSendSession",t);const i=NE(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}`;O&&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 O&&y.error("Error while sending envelope:",n),{}}return O&&y.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){const{integrations:t}=this._options;this._integrations=A0(this,t),bf(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)&&(Jr(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),ig(s,t,n,r,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...a.contexts?.trace,...Am(r)},...a.contexts};const c=ol(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(t,n={},r=z(),i=Le()){return O&&lu(t)&&y.log(`Captured error event \`${vg(t)[0]||""}\``),this._processEvent(t,n,r,i).then(s=>s.event_id,s=>{O&&(Tf(s)?y.log(s.message):Ef(s)?y.warn(s.message):y.warn(s))})}_processEvent(t,n,r,i){const s=this.getOptions(),{sampleRate:o}=s,a=wg(t),c=lu(t),d=`before send for type \`${t.type||"error"}\``,l=typeof o>"u"?void 0:hr(o);if(c&&typeof l=="number"&&on()>l)return this.recordDroppedEvent("sample_rate","error"),ll(mc(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const f=If(t.type);return this._prepareEvent(t,n,r,i).then(p=>{if(p===null)throw this.recordDroppedEvent("event_processor",f),mc("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return p;const m=X0(this,s,p,n);return J0(m,d)}).then(p=>{if(p===null){if(this.recordDroppedEvent("before_send",f),a){const _=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",_)}throw mc(`${d} returned \`null\`, will not send event.`)}const h=r.getSession()||i.getSession();if(c&&h&&this._updateSessionFromEvent(h,p),a){const g=p.sdkProcessingMetadata?.spanCountBeforeProcessing||0,_=p.spans?p.spans.length:0,S=g-_;S>0&&this.recordDroppedEvent("before_send","span",S)}const m=p.transaction_info;if(a&&m&&p.transaction!==t.transaction){const g="custom";p.transaction_info={...m,source:g}}return this.sendEvent(p,n),p}).then(null,p=>{throw Tf(p)||Ef(p)?p:(this.captureException(p,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:p}),ho(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. Reason: ${p}`))})}_process(t,n){this._numProcessing++,this._promiseBuffer.add(t).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===_l&&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(){O&&y.log("Flushing outcomes...");const t=this._clearOutcomes();if(t.length===0){O&&y.log("No outcomes to send");return}if(!this._dsn){O&&y.log("No dsn provided, will not send outcomes");return}O&&y.log("Sending outcomes:",t);const n=q0(t,this._options.tunnel&&bn(this._dsn));this.sendEnvelope(n)}}function If(e){return e==="replay_event"?"replay":e||"error"}function J0(e,t){const n=`${t} must return \`null\` or a valid event.`;if(qn(e))return e.then(r=>{if(!ot(r)&&r!==null)throw ho(n);return r},r=>{throw ho(`${t} rejected with ${r}`)});if(!ot(e)&&e!==null)throw ho(n);return e}function X0(e,t,n,r){const{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o,ignoreSpans:a}=t;let c=n;if(lu(c)&&i)return i(c,r);if(wg(c)){if(o||a){const u=G0(c);if(a?.length&&Lo(u,a))return null;if(o){const d=o(u);d?c=os(n,V0(d)):iu()}if(c.spans){const d=[],l=c.spans;for(const p of l){if(a?.length&&Lo(p,a)){_E(l,p);continue}if(o){const h=o(p);h?d.push(h):(iu(),d.push(p))}else d.push(p)}const f=c.spans.length-d.length;f&&e.recordDroppedEvent("before_send","span",f),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 lu(e){return e.type===void 0}function wg(e){return e.type==="transaction"}function Q0(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+Ig(e.attributes)}function Z0(e){let t=0;return e.message&&(t+=e.message.length*2),t+Ig(e.attributes)}function Ig(e){if(!e)return 0;let t=0;return Object.values(e).forEach(n=>{Array.isArray(n)?t+=n.length*kf(n[0]):$n(n)?t+=kf(n):t+=100}),t}function kf(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function eT(e){return Ht(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function Af(e){return eT(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function tT(e,t){t.debug===!0&&(O?y.enable():jn(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),z().update(t.initialScope);const r=new e(t);return kg(r),r.init(),r}function kg(e){z().setClient(e)}const gc=100,_c=5e3,nT=36e5;function rT(e){function t(...n){O&&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=_c,o;function a(l,f,p){return ou(l,["client_report"])?!1:n.shouldStore?n.shouldStore(l,f,p):!0}function c(l){o&&clearTimeout(o),o=gl(setTimeout(async()=>{o=void 0;const f=await i.shift();f&&(t("Attempting to send previously queued event"),f[0].sent_at=new Date().toISOString(),d(f,!0).catch(p=>{t("Failed to retry sending",p)}))},l))}function u(){o||(c(s),s=Math.min(s*2,nT))}async function d(l,f=!1){if(!f&&ou(l,["replay_event","replay_recording"]))return await i.push(l),c(gc),{};try{if(n.shouldSend&&await n.shouldSend(l)===!1)throw new Error("Envelope not sent because `shouldSend` callback returned false");const p=await r.send(l);let h=gc;if(p){if(p.headers?.["retry-after"])h=gg(p.headers["retry-after"]);else if(p.headers?.["x-sentry-rate-limits"])h=6e4;else if((p.statusCode||0)>=400)return p}return c(h),s=_c,p}catch(p){if(await a(l,p,s))return f?await i.unshift(l):await i.push(l),u(),t("Error sending. Event queued.",p),{};throw p}}return n.flushAtStartup&&u(),{send:d,flush:l=>(l===void 0&&(s=_c,c(gc)),r.flush(l))}}}const mo="MULTIPLEXED_TRANSPORT_EXTRA_KEY";function Ag(e,t){let n;return mr(e,(r,i)=>(t.includes(i)&&(n=Array.isArray(r)?r[1]:void 0),!!n)),n}function iT(e,t){return n=>{const r=e(n);return{...r,send:async i=>{const s=Ag(i,["event","transaction","profile","replay_event"]);return s&&(s.release=t),r.send(i)}}}}function sT(e,t){return Lt(t?{...e[0],dsn:t}:e[0],e[1])}function oT(e,t){return n=>{const r=e(n),i=new Map,s=t||(u=>{const d=u.getEvent();return d?.extra?.[mo]&&Array.isArray(d.extra[mo])?d.extra[mo]:[]});function o(u,d){const l=d?`${u}:${d}`:u;let f=i.get(l);if(!f){const p=Nm(u);if(!p)return;const h=dg(p,n.tunnel);f=d?iT(e,d)({...n,url:h}):e({...n,url:h}),i.set(l,f)}return[u,f]}async function a(u){function d(h){const m=h?.length?h:["event"];return Ag(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),f=l.length?l:[["",r]];return(await Promise.all(f.map(([h,m])=>m.send(sT(u,h)))))[0]}async function c(u){const d=[...i.values(),r];return(await Promise.all(d.map(f=>f.flush(u)))).every(f=>f)}return{send:a,flush:c}}}const aT="thismessage:/";function bl(e){return"isRelative"in e}function Sl(e,t){const n=e.indexOf("://")<=0&&e.indexOf("//")!==0,r=n?aT: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 cT(e){if(bl(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 dr(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 Rg(e){return e.split(/[?#]/,1)[0]}function xn(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 Cg(e,t){const n=t?.getDsn(),r=t?.getOptions().tunnel;return lT(e,n)||uT(e,r)}function uT(e,t){return t?Rf(e)===Rf(t):!1}function lT(e,t){const n=Sl(e);return!n||bl(n)?!1:t?n.host.includes(t.host)&&/(^|&|\?)sentry_key=/.test(n.search):!1}function Rf(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function xg(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 dT=xg;function fT(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 Og(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:sn})),i.version=sn)}function vl(e={}){const t=e.client||M();if(!ag()||!t)return{};const n=yn(),r=Gn(n);if(r.getTraceData)return r.getTraceData(e);const i=e.scope||z(),s=e.span||Oe(),o=s?Wm(s):pT(i),a=s?Nt(s):ol(t,i),c=Mm(a);if(!Fm.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?fE(s):hT(i)),d}function pT(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Um(t,r,n)}function hT(e){const{traceId:t,sampled:n,propagationSpanId:r}=e.getPropagationContext();return Bm(t,r,n)}function mT(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 gT=100;function Pt(e,t){const n=M(),r=Le();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:s=gT}=n.getOptions();if(s<=0)return;const a={timestamp:kr(),...e},c=i?jn(()=>i(a,t)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,t),r.addBreadcrumb(c,s))}let Cf;const _T="FunctionToString",xf=new WeakMap,yT=(()=>({name:_T,setupOnce(){Cf=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=tl(this),n=xf.has(M())&&t!==void 0?t:this;return Cf.apply(n,e)}}catch{}},setup(e){xf.set(e,!0)}})),Mg=yT,bT=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],ST="EventFilters",Ng=(e={})=>{let t;return{name:ST,setup(n){const r=n.getOptions();t=Of(e,r)},processEvent(n,r,i){if(!t){const s=i.getOptions();t=Of(e,s)}return vT(n,t)?null:n}}},Pg=((e={})=>({...Ng(e),name:"InboundFilters"}));function Of(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:bT],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function vT(e,t){if(e.type){if(e.type==="transaction"&&TT(e,t.ignoreTransactions))return O&&y.warn(`Event dropped due to being matched by \`ignoreTransactions\` option. Event: ${tr(e)}`),!0}else{if(ET(e,t.ignoreErrors))return O&&y.warn(`Event dropped due to being matched by \`ignoreErrors\` option. Event: ${tr(e)}`),!0;if(AT(e))return O&&y.warn(`Event dropped due to not having an error message, error type or stacktrace. Event: ${tr(e)}`),!0;if(wT(e,t.denyUrls))return O&&y.warn(`Event dropped due to being matched by \`denyUrls\` option. Event: ${tr(e)}. Url: ${jo(e)}`),!0;if(!IT(e,t.allowUrls))return O&&y.warn(`Event dropped due to not being matched by \`allowUrls\` option. Event: ${tr(e)}. Url: ${jo(e)}`),!0}return!1}function ET(e,t){return t?.length?vg(e).some(n=>Ot(n,t)):!1}function TT(e,t){if(!t?.length)return!1;const n=e.transaction;return n?Ot(n,t):!1}function wT(e,t){if(!t?.length)return!1;const n=jo(e);return n?Ot(n,t):!1}function IT(e,t){if(!t?.length)return!0;const n=jo(e);return n?Ot(n,t):!0}function kT(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 jo(e){try{const n=[...e.exception?.values??[]].reverse().find(r=>r.mechanism?.parent_id===void 0&&r.stacktrace?.frames?.length)?.stacktrace?.frames;return n?kT(n):null}catch{return O&&y.error(`Cannot extract url for event ${tr(e)}`),null}}function AT(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function RT(e,t,n,r,i,s){if(!i.exception?.values||!s||!fn(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=du(e,t,r,s.originalException,n,i.exception.values,o,0))}function du(e,t,n,r,i,s,o,a){if(s.length>=n+1)return s;let c=[...s];if(fn(r[i],Error)){Mf(o,a,r);const u=e(t,r[i]),d=c.length;Nf(u,i,d,a),c=du(e,t,n,r[i],i,[u,...c],u,d)}return Lg(r)&&r.errors.forEach((u,d)=>{if(fn(u,Error)){Mf(o,a,r);const l=e(t,u),f=c.length;Nf(l,`errors[${d}]`,f,a),c=du(e,t,n,u,i,[l,...c],l,f)}}),c}function Lg(e){return Array.isArray(e.errors)}function Mf(e,t,n){e.mechanism={handled:!0,type:"auto.core.linked_errors",...Lg(n)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function Nf(e,t,n,r){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}const Dg=new Map,Pf=new Set;function CT(e){if(U._sentryModuleMetadata)for(const t of Object.keys(U._sentryModuleMetadata)){const n=U._sentryModuleMetadata[t];if(Pf.has(t))continue;Pf.add(t);const r=e(t);for(const i of r.reverse())if(i.filename){Dg.set(i.filename,n);break}}}function xT(e,t){return CT(e),Dg.get(t)}function Fg(e,t){t.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(r=>{if(!r.filename||r.module_metadata)return;const i=xT(e,r.filename);i&&(r.module_metadata=i)})})}function $g(e){e.exception?.values?.forEach(t=>{t.stacktrace?.frames?.forEach(n=>{delete n.module_metadata})})}const OT=()=>({name:"ModuleMetadata",setup(e){e.on("beforeEnvelope",t=>{mr(t,(n,r)=>{if(r==="event"){const i=Array.isArray(n)?n[1]:void 0;i&&($g(i),n[1]=i)}})}),e.on("applyFrameMetadata",t=>{if(t.type)return;const n=e.getOptions().stackParser;Fg(n,t)})}});function El(e){const t="console";Wn(t,e),zn(t,MT)}function MT(){"console"in U&&Ju.forEach(function(e){e in U.console&&Je(U.console,e,function(t){return Mo[e]=t,function(...n){yt("console",{args:n,level:e}),Mo[e]?.apply(U.console,n)}})})}function Wo(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}const NT="CaptureConsole",PT=((e={})=>{const t=e.levels||Ju,n=e.handled??!0;return{name:NT,setup(r){"console"in U&&El(({args:i,level:s})=>{M()!==r||!t.includes(s)||DT(i,s,n)})}}}),LT=PT;function DT(e,t,n){const r=Wo(t),i=new Error,s={level:Wo(t),extra:{arguments:e}};ut(o=>{if(o.addEventProcessor(u=>(u.logger="console",pn(u,{handled:n,type:"auto.core.capture_console"}),u)),t==="assert"){if(!e[0]){const u=`Assertion failed: ${No(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){Ie(a,s);return}const c=No(e," ");o.captureMessage(c,r,{captureContext:s,syntheticException:i})})}const FT="Dedupe",$T=(()=>{let e;return{name:FT,processEvent(t){if(t.type)return t;try{if(UT(t,e))return O&&y.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}}),Ug=$T;function UT(e,t){return t?!!(BT(e,t)||HT(e,t)):!1}function BT(e,t){const n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Hg(e,t)||!Bg(e,t))}function HT(e,t){const n=Lf(t),r=Lf(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Hg(e,t)||!Bg(e,t))}function Bg(e,t){let n=Zc(e),r=Zc(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:jT,processEvent(r,i,s){const{maxValueLength:o}=s.getOptions();return qT(r,i,t,n,o)}}}),zT=WT;function qT(e,t={},n,r,i){if(!t.originalException||!Ht(t.originalException))return e;const s=t.originalException.name||t.originalException.constructor.name,o=jg(t.originalException,r,i);if(o){const a={...e.contexts},c=Ye(o,n);return ot(c)&&(Pe(c,"__sentry_skip_normalization__",!0),a[s]=c),{...e,contexts:a}}return e}function jg(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]=Ht(o)||typeof o=="string"?n?Vi(`${o}`,n):`${o}`:o}if(t&&e.cause!==void 0)if(Ht(e.cause)){const s=e.cause.name||e.cause.constructor.name;i.cause={[s]:jg(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]=Ht(a)?a.toString():a}}return i}catch(r){O&&y.error("Unable to extract extra data from the Error object:",r)}return null}function GT(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 VT=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function KT(e){const t=e.length>1024?`${e.slice(-1024)}`:e,n=VT.exec(t);return n?n.slice(1):[]}function Df(...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=GT(t.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+t||"."}function Ff(e){let t=0;for(;t=0&&e[n]==="";n--);return t>n?[]:e.slice(t,n-t+1)}function YT(e,t){e=Df(e).slice(1),t=Df(t).slice(1);const n=Ff(e.split("/")),r=Ff(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 U&&!!U.window,i=e.iteratee||ZT({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:XT,processEvent(a){let c=a;return a.exception&&Array.isArray(a.exception.values)&&(c=s(c)),c}}};function ZT({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?YT(t,o):JT(o);r.filename=`${n}${a}`}return r}}const ew=["reauthenticate","signInAnonymously","signInWithOAuth","signInWithIdToken","signInWithOtp","signInWithPassword","signInWithSSO","signOut","signUp","verifyOtp"],tw=["createUser","deleteUser","listUsers","getUserById","updateUserById","inviteUserByEmail"],nw={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"},Wg=["select","insert","upsert","update","delete"];function Ia(e){try{e.__SENTRY_INSTRUMENTED__=!0}catch{}}function ka(e){try{return e.__SENTRY_INSTRUMENTED__}catch{return!1}}function rw(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 iw(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&&nw[n]||"filter",`${i}(${e}, ${r.join(".")})`}function $f(e,t=!1){return new Proxy(e,{apply(n,r,i){return Sn({name:`auth ${t?"(admin) ":""}${e.name}`,attributes:{[Y]:"auto.db.supabase",[me]:"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:ae}),Ie(o.error,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}})):s.setStatus({code:ba}),s.end(),o)).catch(o=>{throw s.setStatus({code:ae}),s.end(),Ie(o,{mechanism:{handled:!1,type:"auto.db.supabase.auth"}}),o}).then(...i))}})}function sw(e){const t=e.auth;if(!(!t||ka(e.auth))){for(const n of ew){const r=t[n];r&&typeof e.auth[n]=="function"&&(e.auth[n]=$f(r))}for(const n of tw){const r=t.admin[n];r&&typeof e.auth.admin[n]=="function"&&(e.auth.admin[n]=$f(r,!0))}Ia(e.auth)}}function ow(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 cw(s),i}}),Ia(e.prototype.from))}function aw(e){ka(e.prototype.then)||(e.prototype.then=new Proxy(e.prototype.then,{apply(t,n,r){const i=Wg,s=n,o=rw(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[p,h]of s.url.searchParams.entries())u.push(iw(p,h));const d=Object.create(null);if(ot(s.body))for(const[p,h]of Object.entries(s.body))d[p]=h;const l=`${o==="select"?"":`${o}${d?"(...) ":""}`}${u.join(" ")} from(${c})`,f={"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,[Y]:"auto.db.supabase",[me]:"db"};return u.length&&(f["db.query"]=u),Object.keys(d).length&&(f["db.body"]=d),Sn({name:l,attributes:f},p=>Reflect.apply(t,n,[]).then(h=>{if(p&&(h&&typeof h=="object"&&"status"in h&&Yi(p,h.status||500),p.end()),h.error){const _=new Error(h.error.message);h.error.code&&(_.code=h.error.code),h.error.details&&(_.details=h.error.details);const S={};u.length&&(S.query=u),Object.keys(d).length&&(S.body=d),Ie(_,T=>(T.addEventProcessor(v=>(pn(v,{handled:!1,type:"auto.db.supabase.postgres"}),v)),T.setContext("supabase",S),T))}const m={type:"supabase",category:`db.${o}`,message:l},g={};return u.length&&(g.query=u),Object.keys(d).length&&(g.body=d),Object.keys(g).length&&(m.data=g),Pt(m),h},h=>{throw p&&(Yi(p,500),p.end()),h}).then(...r))}}),Ia(e.prototype.then))}function cw(e){for(const t of Wg)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 O&&y.log(`Instrumenting ${t} operation's PostgRESTFilterBuilder`),aw(o),s}}),Ia(e.prototype[t]))}const zg=e=>{if(!e){O&&y.warn("Supabase integration was not installed because no Supabase client was provided.");return}const t=e.constructor===Function?e:e.constructor;ow(t),sw(e)},uw="Supabase",lw=(e=>({setupOnce(){zg(e)},name:uw})),dw=e=>lw(e.supabaseClient),fw=10,pw="ZodErrors";function hw(e){return Ht(e)&&e.name==="ZodError"&&Array.isArray(e.issues)}function mw(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 gw(e){return e.map(t=>typeof t=="number"?"":t).join(".")}function _w(e){const t=new Set;for(const r of e.issues){const i=gw(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: ${Vi(n.join(", "),100)}`}function yw(e,t=!1,n,r){if(!n.exception?.values||!r.originalException||!hw(r.originalException)||r.originalException.issues.length===0)return n;try{const s=(t?r.originalException.issues:r.originalException.issues.slice(0,e)).map(mw);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:_w(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 bw=((e={})=>{const t=e.limit??fw;return{name:pw,processEvent(n,r){return yw(t,e.saveZodIssuesAsAttachment,n,r)}}}),Sw=bw,vw=e=>({name:"ThirdPartyErrorsFilter",setup(t){t.on("beforeEnvelope",n=>{mr(n,(r,i)=>{if(i==="event"){const s=Array.isArray(r)?r[1]:void 0;s&&($g(s),r[1]=s)}})}),t.on("applyFrameMetadata",n=>{if(n.type)return;const r=t.getOptions().stackParser;Fg(r,n)})},processEvent(t){const n=Tw(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 Ew(e,t){if(t!==0||!e.context_line||!e.filename||!e.filename.includes("sentry")||!e.filename.includes("helpers")||!e.context_line.includes(Iw))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||!Ew(r,i)).map(r=>r.module_metadata?Object.keys(r.module_metadata).filter(i=>i.startsWith(Uf)).map(i=>i.slice(Uf.length)):[])}const Uf="_sentryBundlerPluginAppKey:",ww="Attempt to invoke user-land function",Iw="fn.apply(this, wrappedArguments)",kw=100,Aw=10,Fs="flag.evaluation.";function _i(e){const n=z().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(e.contexts===void 0&&(e.contexts={}),e.contexts.flags={values:[...r]}),e}function _r(e,t,n=kw){const r=z().getScopeData().contexts;r.flags||(r.flags={values:[]});const i=r.flags.values;Rw(i,e,t,n)}function Rw(e,t,n,r){if(typeof n!="boolean")return;if(e.length>r){O&&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 yr(e,t,n=Aw){if(typeof t!="boolean")return;const r=Oe();if(!r)return;const i=$(r).data;if(`${Fs}${e}`in i){r.setAttribute(`${Fs}${e}`,t);return}Object.keys(i).filter(o=>o.startsWith(Fs)).length({name:"FeatureFlags",processEvent(e,t,n){return _i(e)},addFeatureFlag(e,t){_r(e,t),yr(e,t)}}),xw=({growthbookClass:e})=>({name:"GrowthBook",setupOnce(){const t=e.prototype;typeof t.isOn=="function"&&Je(t,"isOn",Bf),typeof t.getFeatureValue=="function"&&Je(t,"getFeatureValue",Bf)},processEvent(t,n,r){return _i(t)}});function Bf(e){return function(...t){const n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"&&(_r(n,r),yr(n,r)),r}}const Ow="ConversationId",Mw=(()=>({name:Ow,setup(e){e.on("spanStart",t=>{const n=z().getScopeData(),r=Le().getScopeData(),i=n.conversationId||r.conversationId;i&&t.setAttribute(Kv,i)})}})),Nw=Mw;function Pw(e,t,n,r,i){if(!e.fetchData)return;const{method:s,url:o}=e.fetchData,a=bt()&&t(o);if(e.endTimestamp){const p=e.fetchData.__span;if(!p)return;const h=r[p];h&&(a&&(Fw(h,e),Lw(h,e,i)),delete r[p]);return}const{spanOrigin:c="auto.http.browser",propagateTraceparent:u=!1}=typeof i=="object"?i:{spanOrigin:i},d=!!Oe(),l=a&&d?St(Uw(o,s,c)):new hn;if(e.fetchData.__span=l.spanContext().spanId,r[l.spanContext().spanId]=l,n(e.fetchData.url)){const p=e.args[0],h={...e.args[1]||{}},m=Dw(p,h,bt()&&d?l:void 0,u);m&&(e.args[1]=h,h.headers=m)}const f=M();if(f){const p={input:e.args,response:e.response,startTimestamp:e.startTimestamp,endTimestamp:e.endTimestamp};f.emit("beforeOutgoingRequestSpan",l,p)}return l}function Lw(e,t,n){(typeof n=="object"&&n!==null?n.onRequestSpanEnd:void 0)?.(e,{headers:t.response?.headers,error:t.error})}function Dw(e,t,n,r){const i=vl({span:n,propagateTraceparent:r}),s=i["sentry-trace"],o=i.baggage,a=i.traceparent;if(!s)return;const c=t.headers||(Zu(e)?e.headers:void 0);if(c)if($w(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?$s(d)||u.set("baggage",`${d},${o}`):u.set("baggage",o)}return u}else if(Array.isArray(c)){const u=[...c];c.find(l=>l[0]==="sentry-trace")||u.push(["sentry-trace",s]),r&&a&&!c.find(l=>l[0]==="traceparent")&&u.push(["traceparent",a]);const d=c.find(l=>l[0]==="baggage"&&$s(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,f=l?Array.isArray(l)?[...l]:[l]:[],p=l&&(Array.isArray(l)?l.find(m=>$s(m)):$s(l));o&&!p&&f.push(o);const h={...c,"sentry-trace":u??s,baggage:f.length>0?f.join(","):void 0};return r&&a&&!d&&(h.traceparent=a),h}else return{...i}}function Fw(e,t){if(t.response){Yi(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:ae,message:"internal_error"});e.end()}function $s(e){return e.split(",").some(t=>t.trim().startsWith(rl))}function $w(e){return typeof Headers<"u"&&fn(e,Headers)}function Uw(e,t,n){if(e.startsWith("data:")){const s=xn(e);return{name:`${t} ${s}`,attributes:Hf(e,void 0,t,n)}}const r=Sl(e),i=r?cT(r):e;return{name:`${t} ${i}`,attributes:Hf(e,r,t,n)}}function Hf(e,t,n,r){const i={url:xn(e),type:"fetch","http.method":n,[Y]:r,[me]:"http.client"};return t&&(bl(t)||(i["http.url"]=xn(t.href),i["server.address"]=t.host),t.search&&(i["http.query"]=t.search),t.hash&&(i["http.fragment"]=t.hash)),i}function qg(e,t={},n=z()){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()||M();return l&&l.emit("beforeSendFeedback",d,t),n.captureEvent(d,t)}function yi(e,t,n,r,i){Bo({level:e,message:t,attributes:n,severityNumber:i},r)}function Bw(e,t,{scope:n}={}){yi("trace",e,t,n)}function Hw(e,t,{scope:n}={}){yi("debug",e,t,n)}function jw(e,t,{scope:n}={}){yi("info",e,t,n)}function Ww(e,t,{scope:n}={}){yi("warn",e,t,n)}function zw(e,t,{scope:n}={}){yi("error",e,t,n)}function qw(e,t,{scope:n}={}){yi("fatal",e,t,n)}const Gw=Object.freeze(Object.defineProperty({__proto__:null,debug:Hw,error:zw,fatal:qw,fmt:dT,info:jw,trace:Bw,warn:Ww},Symbol.toStringTag,{value:"Module"}));function zo(e,t,n){return"util"in U&&typeof U.util.format=="function"?U.util.format(...e):Vw(e,t,n)}function Vw(e,t,n){return e.map(r=>$n(r)?String(r):JSON.stringify(Ye(r,t,n))).join(" ")}function Gg(e){return/%[sdifocO]/.test(e)}function Vg(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 Kw="ConsoleLogs",jf={[Y]:"auto.log.console"},Yw=((e={})=>{const t=e.levels||Ju;return{name:Kw,setup(n){const{enableLogs:r,normalizeDepth:i=3,normalizeMaxBreadth:s=1e3}=n.getOptions();if(!r){O&&y.warn("`enableLogs` is not enabled, ConsoleLogs integration disabled");return}El(({args:o,level:a})=>{if(M()!==n||!t.includes(a))return;const c=o[0],u=o.slice(1);if(a==="assert"){if(!c){const p=u.length>0?`Assertion failed: ${zo(u,i,s)}`:"Assertion failed";Bo({level:"error",message:p,attributes:jf})}return}const d=a==="log",l=o.length>1&&typeof o[0]=="string"&&!Gg(o[0]),f={...jf,...l?Vg(c,u):{}};Bo({level:d?"info":a,message:zo(o,i,s),severityNumber:d?10:void 0,attributes:f})})}}}),Jw=Yw;function Tl(e,t,n,r){j0({type:e,name:t,value:n,unit:r?.unit,attributes:r?.attributes},{scope:r?.scope})}function Xw(e,t=1,n){Tl("counter",e,t,n)}function Qw(e,t,n){Tl("gauge",e,t,n)}function Zw(e,t,n){Tl("distribution",e,t,n)}const eI=Object.freeze(Object.defineProperty({__proto__:null,count:Xw,distribution:Zw,gauge:Qw},Symbol.toStringTag,{value:"Module"})),tI=["trace","debug","info","warn","error","fatal"];function nI(e={}){const t=new Set(e.levels??tI),n=e.client;return{log(r){const{type:i,level:s,message:o,args:a,tag:c,date:u,...d}=r,l=n||M();if(!l)return;const f=sI(i,s);if(!t.has(f))return;const{normalizeDepth:p=3,normalizeMaxBreadth:h=1e3}=l.getOptions(),m={};for(const[_,S]of Object.entries(d))m[_]=Ye(S,p,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=aI(oI(a,p,h),p,h);g?.attributes&&Object.assign(m,g.attributes),Bo({level:f,message:g?.message||o||a&&zo(a,p,h)||"",attributes:m})}}}const rI={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"},iI={0:"fatal",1:"warn",2:"info",3:"info",4:"debug",5:"trace"};function sI(e,t){if(e==="verbose")return"debug";if(e==="silent")return"trace";if(e){const n=rI[e];if(n)return n}if(typeof t=="number"){const n=iI[t];if(n)return n}return"info"}function oI(e,t,n){if(!e?.length)return{message:""};const r=zo(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"&&!Gg(i);return{message:r,messageTemplate:o?i:void 0,messageParameters:o?s:void 0}}}function aI(e,t,n){const{message:r,attributes:i,messageTemplate:s,messageParameters:o}=e,a={};if(s&&o){const c=Vg(s,o);for(const[u,d]of Object.entries(c))a[u]=u.startsWith("sentry.message.parameter.")?Ye(d,t,n):d}else o&&o.length>0&&o.forEach((c,u)=>{a[`sentry.message.parameter.${u}`]=Ye(c,t,n)});return{message:r,attributes:{...Ye(i,t,n),...a}}}const cI="gen_ai.prompt",Aa="gen_ai.system",at="gen_ai.request.model",wl="gen_ai.request.stream",Ra="gen_ai.request.temperature",Il="gen_ai.request.max_tokens",Ca="gen_ai.request.frequency_penalty",kl="gen_ai.request.presence_penalty",xa="gen_ai.request.top_p",Kg="gen_ai.request.top_k",uI="gen_ai.request.encoding_format",lI="gen_ai.request.dimensions",Kn="gen_ai.response.finish_reasons",vn="gen_ai.response.model",Ar="gen_ai.response.id",dI="gen_ai.response.stop_reason",br="gen_ai.usage.input_tokens",Sr="gen_ai.usage.output_tokens",vr="gen_ai.usage.total_tokens",Un="gen_ai.operation.name",Er="sentry.sdk_meta.gen_ai.input.messages.original_length",bi="gen_ai.input.messages",ds="gen_ai.system_instructions",vt="gen_ai.response.text",Oa="gen_ai.request.available_tools",Ma="gen_ai.response.streaming",Kt="gen_ai.response.tool_calls",Yg="gen_ai.agent.name",fI="gen_ai.pipeline.name",Al="gen_ai.conversation.id",pI="gen_ai.usage.cache_creation_input_tokens",hI="gen_ai.usage.cache_read_input_tokens",mI="gen_ai.invoke_agent",gI="gen_ai.embeddings.input",_I="gen_ai.tool.name",yI="gen_ai.tool.input",bI="gen_ai.tool.output",Jg="openai.response.id",Xg="openai.response.model",Qg="openai.response.timestamp",SI="openai.usage.completion_tokens",vI="openai.usage.prompt_tokens",Li={CHAT:"chat",EMBEDDINGS:"embeddings"},Wf="anthropic.response.timestamp";function Gr(e){return!e||typeof e!="object"?!1:TI(e)||e_(e)||EI(e)||t_(e)||n_(e)||wI(e)||II(e)||kI(e)||AI(e)||RI(e)}function EI(e){return"image_url"in e?typeof e.image_url=="string"?e.image_url.startsWith("data:"):Zg(e):!1}function Zg(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 TI(e){return"type"in e&&typeof e.type=="string"&&"source"in e&&Gr(e.source)}function e_(e){return"inlineData"in e&&!!e.inlineData&&typeof e.inlineData=="object"&&"data"in e.inlineData&&typeof e.inlineData.data=="string"}function t_(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 n_(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 wI(e){return"media_type"in e&&typeof e.media_type=="string"&&"data"in e}function II(e){return"type"in e&&(e.type==="blob"||e.type==="base64")}function kI(e){return"b64_json"in e}function AI(e){return"type"in e&&"result"in e&&e.type==="image_generation"}function RI(e){return"uri"in e&&typeof e.uri=="string"&&e.uri.startsWith("data:")}const Mi="[Blob substitute]",CI=["image_url","data","content","b64_json","result","uri"];function ji(e){const t={...e};Gr(t.source)&&(t.source=ji(t.source)),e_(e)&&(t.inlineData={...e.inlineData,data:Mi}),Zg(e)&&(t.image_url={...e.image_url,url:Mi}),t_(e)&&(t.input_audio={...e.input_audio,data:Mi}),n_(e)&&(t.file={...e.file,file_data:Mi});for(const n of CI)typeof t[n]=="string"&&(t[n]=Mi);return t}const r_=2e4,qo=e=>new TextEncoder().encode(e).length,Rl=e=>qo(JSON.stringify(e));function Na(e,t){if(qo(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);qo(o)<=t?(i=o,n=s+1):r=s-1}return i}function xI(e){return typeof e=="string"?e:"text"in e?e.text:""}function zf(e,t){return typeof e=="string"?t:{...e,text:t}}function OI(e){return e!==null&&typeof e=="object"&&"content"in e&&typeof e.content=="string"}function MI(e){return e!==null&&typeof e=="object"&&"content"in e&&Array.isArray(e.content)}function i_(e){return e!==null&&typeof e=="object"&&"parts"in e&&Array.isArray(e.parts)&&e.parts.length>0}function NI(e,t){const n={...e,content:""},r=Rl(n),i=t-r;if(i<=0)return[];const s=Na(e.content,i);return[{...e,content:s}]}function PI(e,t){const{parts:n}=e,r=n.map(a=>zf(a,"")),i=Rl({...e,parts:r});let s=t-i;if(s<=0)return[];const o=[];for(const a of n){const c=xI(a),u=qo(c);if(u<=s)o.push(a),s-=u;else if(o.length===0){const d=Na(c,s);d&&o.push(zf(a,d));break}else break}return o.length<=0?[]:[{...e,parts:o}]}function LI(e,t){if(!e)return[];if(typeof e=="string"){const n=Na(e,t);return n?[n]:[]}return typeof e!="object"?[]:OI(e)?NI(e,t):i_(e)?PI(e,t):[]}function fu(e){return e.map(n=>{let r;return n&&typeof n=="object"&&(MI(n)?r={...n,content:fu(n.content)}:"content"in n&&Gr(n.content)&&(r={...n,content:ji(n.content)}),i_(n)&&(r={...r??n,parts:fu(n.parts)}),Gr(r)?r=ji(r):Gr(n)&&(r=ji(n))),r??n})}function DI(e,t){if(!Array.isArray(e)||e.length===0)return e;const n=t-2,r=e[e.length-1],i=fu([r]),s=i[0];return Rl(s)<=n?i:LI(s,n)}function Pa(e){return DI(e,r_)}function FI(e){return Na(e,r_)}function fs(e){return e.includes("messages")?"chat":e.includes("completions")?"text_completion":e.includes("generateContent")?"generate_content":e.includes("models")?"models":e.includes("chat")?"chat":e.split(".").pop()||"unknown"}function Go(e){return`gen_ai.${fs(e)}`}function s_(e,t){return e?`${e}.${t}`:t}function Cl(e,t,n,r,i){if(t!==void 0&&e.setAttributes({[br]:t}),n!==void 0&&e.setAttributes({[Sr]: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({[vr]:s})}}function o_(e){if(typeof e=="string")return FI(e);if(Array.isArray(e)){const t=Pa(e);return JSON.stringify(t)}return JSON.stringify(e)}function ps(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}}const $I=["responses.create","chat.completions.create","embeddings.create","conversations.create"],UI=["response.output_item.added","response.function_call_arguments.delta","response.function_call_arguments.done","response.output_item.done"],BI=["response.created","response.in_progress","response.failed","response.completed","response.incomplete","response.queued","response.output_text.delta",...UI];function xl(e){return e.includes("chat.completions")||e.includes("responses")?Li.CHAT:e.includes("embeddings")?Li.EMBEDDINGS:e.includes("conversations")?Li.CHAT:e.split(".").pop()||"unknown"}function HI(e){return`gen_ai.${xl(e)}`}function jI(e){return $I.includes(e)}function WI(e,t){return e?`${e}.${t}`:t}function zI(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion"}function qI(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="response"}function GI(e){if(e===null||typeof e!="object"||!("object"in e))return!1;const t=e;return t.object==="list"&&typeof t.model=="string"&&t.model.toLowerCase().includes("embedding")}function VI(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="conversation"}function KI(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"&&e.type.startsWith("response.")}function YI(e){return e!==null&&typeof e=="object"&&"object"in e&&e.object==="chat.completion.chunk"}function JI(e,t,n){if(Ol(e,t.id,t.model,t.created),t.usage&&La(e,t.usage.prompt_tokens,t.usage.completion_tokens,t.usage.total_tokens),Array.isArray(t.choices)){const r=t.choices.map(i=>i.finish_reason).filter(i=>i!==null);if(r.length>0&&e.setAttributes({[Kn]:JSON.stringify(r)}),n){const i=t.choices.map(s=>s.message?.tool_calls).filter(s=>Array.isArray(s)&&s.length>0).flat();i.length>0&&e.setAttributes({[Kt]:JSON.stringify(i)})}}}function XI(e,t,n){if(Ol(e,t.id,t.model,t.created_at),t.status&&e.setAttributes({[Kn]:JSON.stringify([t.status])}),t.usage&&La(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.total_tokens),n){const r=t;if(Array.isArray(r.output)&&r.output.length>0){const i=r.output.filter(s=>typeof s=="object"&&s!==null&&s.type==="function_call");i.length>0&&e.setAttributes({[Kt]:JSON.stringify(i)})}}}function QI(e,t){e.setAttributes({[Xg]:t.model,[vn]:t.model}),t.usage&&La(e,t.usage.prompt_tokens,void 0,t.usage.total_tokens)}function ZI(e,t){const{id:n,created_at:r}=t;e.setAttributes({[Jg]:n,[Ar]:n,[Al]:n}),r&&e.setAttributes({[Qg]:new Date(r*1e3).toISOString()})}function La(e,t,n,r){t!==void 0&&e.setAttributes({[vI]:t,[br]:t}),n!==void 0&&e.setAttributes({[SI]:n,[Sr]:n}),r!==void 0&&e.setAttributes({[vr]:r})}function Ol(e,t,n,r){e.setAttributes({[Jg]:t,[Ar]:t}),e.setAttributes({[Xg]:n,[vn]:n}),e.setAttributes({[Qg]:new Date(r*1e3).toISOString()})}function ek(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 tk(e){const t={[at]:e.model??"unknown"};"temperature"in e&&(t[Ra]=e.temperature),"top_p"in e&&(t[xa]=e.top_p),"frequency_penalty"in e&&(t[Ca]=e.frequency_penalty),"presence_penalty"in e&&(t[kl]=e.presence_penalty),"stream"in e&&(t[wl]=e.stream),"encoding_format"in e&&(t[uI]=e.encoding_format),"dimensions"in e&&(t[lI]=e.dimensions);const n=ek(e);return n&&(t[Al]=n),t}function nk(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 rk(e,t,n){t.responseId=e.id??t.responseId,t.responseModel=e.model??t.responseModel,t.responseTimestamp=e.created??t.responseTimestamp,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&&nk(r.delta.tool_calls,t)),r.finish_reason&&t.finishReasons.push(r.finish_reason)}function ik(e,t,n,r){if(!(e&&typeof e=="object")){t.eventTypes.push("unknown:non-object");return}if(e instanceof Error){r.setStatus({code:ae,message:"internal_error"}),Ie(e,{mechanism:{handled:!1,type:"auto.ai.openai.stream-response"}});return}if(!("type"in e))return;const i=e;if(!BI.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,t.responseTimestamp=s.created_at??t.responseTimestamp,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*sk(e,t,n){const r={eventTypes:[],responseTexts:[],finishReasons:[],responseId:"",responseModel:"",responseTimestamp:0,promptTokens:void 0,completionTokens:void 0,totalTokens:void 0,chatCompletionToolCalls:{},responsesApiToolCalls:[]};try{for await(const i of e)YI(i)?rk(i,r,n):KI(i)&&ik(i,r,n,t),yield i}finally{Ol(t,r.responseId,r.responseModel,r.responseTimestamp),La(t,r.promptTokens,r.completionTokens,r.totalTokens),t.setAttributes({[Ma]:!0}),r.finishReasons.length&&t.setAttributes({[Kn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length&&t.setAttributes({[vt]:r.responseTexts.join("")});const s=[...Object.values(r.chatCompletionToolCalls),...r.responsesApiToolCalls];s.length>0&&t.setAttributes({[Kt]:JSON.stringify(s)}),t.end()}}function ok(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){O&&y.error("Failed to serialize OpenAI tools:",s);return}}function ak(e,t){const n={[Aa]:"openai",[Un]:xl(t),[Y]:"auto.ai.openai"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const r=e[0],i=ok(r);i&&(n[Oa]=i),Object.assign(n,tk(r))}else n[at]="unknown";return n}function ck(e,t,n){if(!t||typeof t!="object")return;const r=t;if(zI(r)){if(JI(e,r,n),n&&r.choices?.length){const i=r.choices.map(s=>s.message?.content||"");e.setAttributes({[vt]:JSON.stringify(i)})}}else qI(r)?(XI(e,r,n),n&&r.output_text&&e.setAttributes({[vt]:r.output_text})):GI(r)?QI(e,r):VI(r)&&ZI(e,r)}function qf(e,t,n){if(n===Li.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(gI,typeof a=="string"?a:JSON.stringify(a));return}const r="input"in t?t.input:"messages"in t?t.messages:void 0;if(!r||Array.isArray(r)&&r.length===0)return;const{systemInstructions:i,filteredMessages:s}=ps(r);i&&e.setAttribute(ds,i);const o=o_(s);e.setAttribute(bi,o),Array.isArray(s)?e.setAttribute(Er,s.length):e.setAttribute(Er,1)}async function uk(e,t){const n=e.catch(s=>{throw Ie(s,{mechanism:{handled:!1,type:"auto.ai.openai"}}),s}),r=await t,i=await n;return i&&typeof i=="object"&&"data"in i?{...i,data:r}:r}function Gf(e,t){return qn(e)?new Proxy(e,{get(n,r){const s=r in Promise.prototype||r===Symbol.toStringTag?t:n,o=Reflect.get(s,r);return r==="withResponse"&&typeof o=="function"?function(){const c=o.call(n);return uk(c,t)}:typeof o=="function"?o.bind(s):o}}):t}function lk(e,t,n,r){return function(...s){const o=ak(s,t),a=o[at]||"unknown",c=xl(t),u=s[0],d=u&&typeof u=="object"&&u.stream===!0,l={name:`${c} ${a}`,op:HI(t),attributes:o};if(d){let h;const m=tn(l,g=>(h=e.apply(n,s),r.recordInputs&&u&&qf(g,u,c),(async()=>{try{const _=await h;return sk(_,g,r.recordOutputs??!1)}catch(_){throw g.setStatus({code:ae,message:"internal_error"}),Ie(_,{mechanism:{handled:!1,type:"auto.ai.openai.stream",data:{function:t}}}),g.end(),_}})()));return Gf(h,m)}let f;const p=Sn(l,h=>(f=e.apply(n,s),r.recordInputs&&u&&qf(h,u,c),f.then(m=>(ck(h,m,r.recordOutputs),m),m=>{throw Ie(m,{mechanism:{handled:!1,type:"auto.ai.openai",data:{function:t}}}),m})));return Gf(f,p)}}function a_(e,t="",n){return new Proxy(e,{get(r,i){const s=r[i],o=WI(t,String(i));return typeof s=="function"&&jI(o)?lk(s,o,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?a_(s,o,n):s}})}function dk(e,t){const n=!!M()?.getOptions().sendDefaultPii,r={recordInputs:n,recordOutputs:n,...t};return a_(e,"",r)}function fk(e,t){return"type"in e&&typeof e.type=="string"&&e.type==="error"?(t.setStatus({code:ae,message:e.error?.type??"internal_error"}),Ie(e.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}),!0):!1}function pk(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 hk(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 mk(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 gk(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 c_(e,t,n,r){!(e&&typeof e=="object")||fk(e,r)||(pk(e,t),hk(e,t),mk(e,t,n),gk(e,t))}function _k(e,t,n){t.isRecording()&&(e.responseId&&t.setAttributes({[Ar]:e.responseId}),e.responseModel&&t.setAttributes({[vn]:e.responseModel}),Cl(t,e.promptTokens,e.completionTokens,e.cacheCreationInputTokens,e.cacheReadInputTokens),t.setAttributes({[Ma]:!0}),e.finishReasons.length>0&&t.setAttributes({[Kn]:JSON.stringify(e.finishReasons)}),n&&e.responseTexts.length>0&&t.setAttributes({[vt]:e.responseTexts.join("")}),n&&e.toolCalls.length>0&&t.setAttributes({[Kt]:JSON.stringify(e.toolCalls)}),t.end())}async function*yk(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)c_(i,r,n,t),yield i}finally{r.responseId&&t.setAttributes({[Ar]:r.responseId}),r.responseModel&&t.setAttributes({[vn]:r.responseModel}),Cl(t,r.promptTokens,r.completionTokens,r.cacheCreationInputTokens,r.cacheReadInputTokens),t.setAttributes({[Ma]:!0}),r.finishReasons.length>0&&t.setAttributes({[Kn]:JSON.stringify(r.finishReasons)}),n&&r.responseTexts.length>0&&t.setAttributes({[vt]:r.responseTexts.join("")}),n&&r.toolCalls.length>0&&t.setAttributes({[Kt]:JSON.stringify(r.toolCalls)}),t.end()}}function bk(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=>{c_(i,r,n,t)}),e.on("message",()=>{_k(r,t,n)}),e.on("error",i=>{Ie(i,{mechanism:{handled:!1,type:"auto.ai.anthropic.stream_error"}}),t.isRecording()&&(t.setStatus({code:ae,message:"stream_error"}),t.end())}),e}const Sk=["messages.create","messages.stream","messages.countTokens","models.get","completions.create","models.retrieve","beta.messages.create"];function vk(e){return Sk.includes(e)}function Ek(e,t){if(Array.isArray(t)&&t.length===0)return;const{systemInstructions:n,filteredMessages:r}=ps(t);n&&e.setAttributes({[ds]:n});const i=Array.isArray(r)?r.length:1;e.setAttributes({[bi]:o_(r),[Er]:i})}function Tk(e,t){t.error&&(e.setStatus({code:ae,message:t.error.type||"internal_error"}),Ie(t.error,{mechanism:{handled:!1,type:"auto.ai.anthropic.anthropic_error"}}))}function wk(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 Ik(e,t){const n={[Aa]:"anthropic",[Un]:fs(t),[Y]:"auto.ai.anthropic"};if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const r=e[0];r.tools&&Array.isArray(r.tools)&&(n[Oa]=JSON.stringify(r.tools)),n[at]=r.model??"unknown","temperature"in r&&(n[Ra]=r.temperature),"top_p"in r&&(n[xa]=r.top_p),"stream"in r&&(n[wl]=r.stream),"top_k"in r&&(n[Kg]=r.top_k),"frequency_penalty"in r&&(n[Ca]=r.frequency_penalty),"max_tokens"in r&&(n[Il]=r.max_tokens)}else t==="models.retrieve"||t==="models.get"?n[at]=e[0]:n[at]="unknown";return n}function pu(e,t){const n=wk(t);Ek(e,n),"prompt"in t&&e.setAttributes({[cI]:JSON.stringify(t.prompt)})}function kk(e,t){if("content"in t&&Array.isArray(t.content)){e.setAttributes({[vt]: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({[Kt]:JSON.stringify(n)})}"completion"in t&&e.setAttributes({[vt]:t.completion}),"input_tokens"in t&&e.setAttributes({[vt]:JSON.stringify(t.input_tokens)})}function Ak(e,t){"id"in t&&"model"in t&&(e.setAttributes({[Ar]:t.id,[vn]:t.model}),"created"in t&&typeof t.created=="number"&&e.setAttributes({[Wf]:new Date(t.created*1e3).toISOString()}),"created_at"in t&&typeof t.created_at=="number"&&e.setAttributes({[Wf]:new Date(t.created_at*1e3).toISOString()}),"usage"in t&&t.usage&&Cl(e,t.usage.input_tokens,t.usage.output_tokens,t.usage.cache_creation_input_tokens,t.usage.cache_read_input_tokens))}function Rk(e,t,n){if(!(!t||typeof t!="object")){if("type"in t&&t.type==="error"){Tk(e,t);return}n&&kk(e,t),Ak(e,t)}}function Vf(e,t,n){throw Ie(e,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:n}}}),t.isRecording()&&(t.setStatus({code:ae,message:"internal_error"}),t.end()),e}function Ck(e,t,n,r,i,s,o,a,c,u,d){const l=i[at]??"unknown",f={name:`${s} ${l}`,op:Go(o),attributes:i};return u&&!d?tn(f,async p=>{try{c.recordInputs&&a&&pu(p,a);const h=await e.apply(n,r);return yk(h,p,c.recordOutputs??!1)}catch(h){return Vf(h,p,o)}}):tn(f,p=>{try{c.recordInputs&&a&&pu(p,a);const h=t.apply(n,r);return bk(h,p,c.recordOutputs??!1)}catch(h){return Vf(h,p,o)}})}function xk(e,t,n,r){return new Proxy(e,{apply(i,s,o){const a=Ik(o,t),c=a[at]??"unknown",u=fs(t),d=typeof o[0]=="object"?o[0]:void 0,l=!!d?.stream,f=t==="messages.stream";return l||f?Ck(e,i,n,o,a,u,t,d,r,l,f):Sn({name:`${u} ${c}`,op:Go(t),attributes:a},p=>(r.recordInputs&&d&&pu(p,d),Ta(()=>i.apply(n,o),h=>{Ie(h,{mechanism:{handled:!1,type:"auto.ai.anthropic",data:{function:t}}})},()=>{},h=>Rk(p,h,r.recordOutputs))))}})}function u_(e,t="",n){return new Proxy(e,{get(r,i){const s=r[i],o=s_(t,String(i));return typeof s=="function"&&vk(o)?xk(s,o,r,n):typeof s=="function"?s.bind(r):s&&typeof s=="object"?u_(s,o,n):s}})}function Ok(e,t){const n=!!M()?.getOptions().sendDefaultPii,r={recordInputs:n,recordOutputs:n,...t};return u_(e,"",r)}const Kf=["models.generateContent","models.generateContentStream","chats.create","sendMessage","sendMessageStream"],Mk="google_genai",l_="chats.create",Nk="chat";function Pk(e,t){const n=e?.promptFeedback;if(n?.blockReason){const r=n.blockReasonMessage??n.blockReason;return t.setStatus({code:ae,message:`Content blocked: ${r}`}),Ie(`Content blocked: ${r}`,{mechanism:{handled:!1,type:"auto.ai.google_genai"}}),!0}return!1}function Lk(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 Dk(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 Fk(e,t,n,r){!e||Pk(e,r)||(Lk(e,t),Dk(e,t,n))}async function*$k(e,t,n){const r={responseTexts:[],finishReasons:[],toolCalls:[]};try{for await(const i of e)Fk(i,r,n,t),yield i}finally{const i={[Ma]:!0};r.responseId&&(i[Ar]=r.responseId),r.responseModel&&(i[vn]=r.responseModel),r.promptTokens!==void 0&&(i[br]=r.promptTokens),r.completionTokens!==void 0&&(i[Sr]=r.completionTokens),r.totalTokens!==void 0&&(i[vr]=r.totalTokens),r.finishReasons.length&&(i[Kn]=JSON.stringify(r.finishReasons)),n&&r.responseTexts.length&&(i[vt]=r.responseTexts.join("")),n&&r.toolCalls.length&&(i[Kt]=JSON.stringify(r.toolCalls)),t.setAttributes(i),t.end()}}function Uk(e){if(Kf.includes(e))return!0;const t=e.split(".").pop();return Kf.includes(t)}function Bk(e){return e.includes("Stream")}function Di(e,t="user"){return typeof e=="string"?[{role:t,content:e}]:Array.isArray(e)?e.flatMap(n=>Di(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 Yf(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 Hk(e){const t={};return"temperature"in e&&typeof e.temperature=="number"&&(t[Ra]=e.temperature),"topP"in e&&typeof e.topP=="number"&&(t[xa]=e.topP),"topK"in e&&typeof e.topK=="number"&&(t[Kg]=e.topK),"maxOutputTokens"in e&&typeof e.maxOutputTokens=="number"&&(t[Il]=e.maxOutputTokens),"frequencyPenalty"in e&&typeof e.frequencyPenalty=="number"&&(t[Ca]=e.frequencyPenalty),"presencePenalty"in e&&typeof e.presencePenalty=="number"&&(t[kl]=e.presencePenalty),t}function jk(e,t,n){const r={[Aa]:Mk,[Un]:fs(e),[Y]:"auto.ai.google_genai"};if(t){if(r[at]=Yf(t,n),"config"in t&&typeof t.config=="object"&&t.config){const i=t.config;if(Object.assign(r,Hk(i)),"tools"in i&&Array.isArray(i.tools)){const s=i.tools.flatMap(o=>o.functionDeclarations);r[Oa]=JSON.stringify(s)}}}else r[at]=Yf({},n);return r}function Jf(e,t){const n=[];if("config"in t&&t.config&&typeof t.config=="object"&&"systemInstruction"in t.config&&t.config.systemInstruction&&n.push(...Di(t.config.systemInstruction,"system")),"history"in t&&n.push(...Di(t.history,"user")),"contents"in t&&n.push(...Di(t.contents,"user")),"message"in t&&n.push(...Di(t.message,"user")),Array.isArray(n)&&n.length){const{systemInstructions:r,filteredMessages:i}=ps(n);r&&e.setAttribute(ds,r);const s=Array.isArray(i)?i.length:0;e.setAttributes({[Er]:s,[bi]:JSON.stringify(Pa(i))})}}function Wk(e,t,n){if(!(!t||typeof t!="object")){if(t.modelVersion&&e.setAttribute(vn,t.modelVersion),t.usageMetadata&&typeof t.usageMetadata=="object"){const r=t.usageMetadata;typeof r.promptTokenCount=="number"&&e.setAttributes({[br]:r.promptTokenCount}),typeof r.candidatesTokenCount=="number"&&e.setAttributes({[Sr]:r.candidatesTokenCount}),typeof r.totalTokenCount=="number"&&e.setAttributes({[vr]: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({[vt]:r.join("")})}if(n&&t.functionCalls){const r=t.functionCalls;Array.isArray(r)&&r.length>0&&e.setAttributes({[Kt]:JSON.stringify(r)})}}}function Xf(e,t,n,r){const i=t===l_;return new Proxy(e,{apply(s,o,a){const c=a[0],u=jk(t,c,n),d=u[at]??"unknown",l=fs(t);return Bk(t)?tn({name:`${l} ${d}`,op:Go(t),attributes:u},async f=>{try{r.recordInputs&&c&&Jf(f,c);const p=await s.apply(n,a);return $k(p,f,!!r.recordOutputs)}catch(p){throw f.setStatus({code:ae,message:"internal_error"}),Ie(p,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:t}}}),f.end(),p}}):Sn({name:i?`${l} ${d} create`:`${l} ${d}`,op:Go(t),attributes:u},f=>(r.recordInputs&&c&&Jf(f,c),Ta(()=>s.apply(n,a),p=>{Ie(p,{mechanism:{handled:!1,type:"auto.ai.google_genai",data:{function:t}}})},()=>{},p=>{i||Wk(f,p,r.recordOutputs)})))}})}function hu(e,t="",n){return new Proxy(e,{get:(r,i,s)=>{const o=Reflect.get(r,i,s),a=s_(t,String(i));if(typeof o=="function"&&Uk(a)){if(a===l_){const c=Xf(o,a,r,n);return function(...d){const l=c(...d);return l&&typeof l=="object"?hu(l,Nk,n):l}}return Xf(o,a,r,n)}return typeof o=="function"?o.bind(r):o&&typeof o=="object"?hu(o,a,n):o}})}function zk(e,t){const n=!!M()?.getOptions().sendDefaultPii,r={recordInputs:n,recordOutputs:n,...t};return hu(e,"",r)}const Fi="auto.ai.langchain",qk={human:"user",ai:"assistant",assistant:"assistant",system:"system",function:"function",tool:"tool"},_t=(e,t,n)=>{n!=null&&(e[t]=n)},dt=(e,t,n)=>{const r=Number(n);Number.isNaN(r)||(e[t]=r)};function cn(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Mr(e){if(Array.isArray(e))try{const t=e.map(n=>n&&typeof n=="object"&&Gr(n)?ji(n):n);return JSON.stringify(t)}catch{return String(e)}return cn(e)}function Ni(e){const t=e.toLowerCase();return qk[t]??t}function Qf(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 Zf(e){if(!(!e||Array.isArray(e)))return e.invocation_params}function Ml(e){return e.map(t=>{const n=t._getType;if(typeof n=="function"){const i=n.call(t);return{role:Ni(i),content:Mr(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"?Qf(s):"user";return{role:Ni(o),content:Mr(t.kwargs?.content)}}if(t.type){const i=String(t.type).toLowerCase();return{role:Ni(i),content:Mr(t.content)}}if(t.role)return{role:Ni(String(t.role)),content:Mr(t.content)};const r=t.constructor?.name;return r&&r!=="Object"?{role:Ni(Qf(r)),content:Mr(t.content)}:{role:"user",content:Mr(t.content)}})}function Gk(e,t,n){const r={},i="kwargs"in e?e.kwargs:void 0,s=t?.temperature??n?.ls_temperature??i?.temperature;dt(r,Ra,s);const o=t?.max_tokens??n?.ls_max_tokens??i?.max_tokens;dt(r,Il,o);const a=t?.top_p??i?.top_p;dt(r,xa,a);const c=t?.frequency_penalty;dt(r,Ca,c);const u=t?.presence_penalty;return dt(r,kl,u),t&&"stream"in t&&_t(r,wl,!!t.stream),r}function d_(e,t,n,r,i){return{[Aa]:cn(e??"langchain"),[Un]:"chat",[at]:cn(t),[Y]:Fi,...Gk(n,r,i)}}function Vk(e,t,n,r,i){const s=i?.ls_provider,o=r?.model??i?.ls_model_name??"unknown",a=d_(s,o,e,r,i);if(n&&Array.isArray(t)&&t.length>0){_t(a,Er,t.length);const c=t.map(u=>({role:"user",content:u}));_t(a,bi,cn(c))}return a}function Kk(e,t,n,r,i){const s=i?.ls_provider??e.id?.[2],o=r?.model??i?.ls_model_name??"unknown",a=d_(s,o,e,r,i);if(n&&Array.isArray(t)&&t.length>0){const c=Ml(t.flat()),{systemInstructions:u,filteredMessages:d}=ps(c);u&&_t(a,ds,u);const l=Array.isArray(d)?d.length:0;_t(a,Er,l);const f=Pa(d);_t(a,bi,cn(f))}return a}function Yk(e,t){const n=[],r=e.flat();for(const i of r){const s=i.message?.content;if(Array.isArray(s))for(const o of s){const a=o;a.type==="tool_use"&&n.push(a)}}n.length>0&&_t(t,Kt,cn(n))}function Jk(e,t){if(!e)return;const n=e.tokenUsage,r=e.usage;if(n)dt(t,br,n.promptTokens),dt(t,Sr,n.completionTokens),dt(t,vr,n.totalTokens);else if(r){dt(t,br,r.input_tokens),dt(t,Sr,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,vr,o),r.cache_creation_input_tokens!==void 0&&dt(t,pI,r.cache_creation_input_tokens),r.cache_read_input_tokens!==void 0&&dt(t,hI,r.cache_read_input_tokens)}}function Xk(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&&_t(n,Kn,cn(u)),Yk(e.generations,n),t){const d=e.generations.flat().map(l=>l.text??l.message?.content).filter(l=>typeof l=="string");d.length>0&&_t(n,vt,cn(d))}}Jk(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&&_t(n,vn,o);const a=r?.id??s?.id;a&&_t(n,Ar,a);const c=r?.stop_reason??s?.response_metadata?.finish_reason;return c&&_t(n,dI,cn(c)),n}function Qk(e={}){const t=e.recordInputs??!1,n=e.recordOutputs??!1,r=new Map,i=o=>{const a=r.get(o);a?.isRecording()&&(a.end(),r.delete(o))},s={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(o,a,c,u,d,l,f,p){const h=Zf(l),m=Vk(o,a,t,h,f),g=m[at],_=m[Un];tn({name:`${_} ${g}`,op:"gen_ai.chat",attributes:{...m,[me]:"gen_ai.chat"}},S=>(r.set(c,S),S))},handleChatModelStart(o,a,c,u,d,l,f,p){const h=Zf(l),m=Kk(o,a,t,h,f),g=m[at],_=m[Un];tn({name:`${_} ${g}`,op:"gen_ai.chat",attributes:{...m,[me]:"gen_ai.chat"}},S=>(r.set(c,S),S))},handleLLMEnd(o,a,c,u,d){const l=r.get(a);if(l?.isRecording()){const f=Xk(o,n);f&&l.setAttributes(f),i(a)}},handleLLMError(o,a){const c=r.get(a);c?.isRecording()&&(c.setStatus({code:ae,message:"llm_error"}),i(a)),Ie(o,{mechanism:{handled:!1,type:`${Fi}.llm_error_handler`}})},handleChainStart(o,a,c,u,d,l,f,p){const h=p||o.name||"unknown_chain",m={[Y]:"auto.ai.langchain","langchain.chain.name":h};t&&(m["langchain.chain.inputs"]=JSON.stringify(a)),tn({name:`chain ${h}`,op:"gen_ai.invoke_agent",attributes:{...m,[me]:"gen_ai.invoke_agent"}},g=>(r.set(c,g),g))},handleChainEnd(o,a){const c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({"langchain.chain.outputs":JSON.stringify(o)}),i(a))},handleChainError(o,a){const c=r.get(a);c?.isRecording()&&(c.setStatus({code:ae,message:"chain_error"}),i(a)),Ie(o,{mechanism:{handled:!1,type:`${Fi}.chain_error_handler`}})},handleToolStart(o,a,c,u){const d=o.name||"unknown_tool",l={[Y]:Fi,[_I]:d};t&&(l[yI]=a),tn({name:`execute_tool ${d}`,op:"gen_ai.execute_tool",attributes:{...l,[me]:"gen_ai.execute_tool"}},f=>(r.set(c,f),f))},handleToolEnd(o,a){const c=r.get(a);c?.isRecording()&&(n&&c.setAttributes({[bI]:JSON.stringify(o)}),i(a))},handleToolError(o,a){const c=r.get(a);c?.isRecording()&&(c.setStatus({code:ae,message:"tool_error"}),i(a)),Ie(o,{mechanism:{handled:!1,type:`${Fi}.tool_error_handler`}})},copy(){return s},toJSON(){return{lc:1,type:"not_implemented",id:s.lc_id}},toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:s.lc_id}}};return s}const f_="auto.ai.langgraph";function Zk(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 eA(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 tA(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(vn,r.model_name),r.finish_reason&&typeof r.finish_reason=="string"&&e.setAttribute(Kn,[r.finish_reason])}}function nA(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=Zk(o);a&&e.setAttribute(Kt,JSON.stringify(a));const c=Ml(o);e.setAttribute(vt,JSON.stringify(c));let u=0,d=0,l=0;for(const f of o){const p=eA(f);u+=p.inputTokens,d+=p.outputTokens,l+=p.totalTokens,tA(e,f)}u>0&&e.setAttribute(br,u),d>0&&e.setAttribute(Sr,d),l>0&&e.setAttribute(vr,l)}function iA(e,t){return new Proxy(e,{apply(n,r,i){return Sn({op:"gen_ai.create_agent",name:"create_agent",attributes:{[Y]:f_,[me]:"gen_ai.create_agent",[Un]:"create_agent"}},s=>{try{const o=Reflect.apply(n,r,i),a=i.length>0?i[0]:{};a?.name&&typeof a.name=="string"&&(s.setAttribute(Yg,a.name),s.updateName(`create_agent ${a.name}`));const c=o.invoke;return c&&typeof c=="function"&&(o.invoke=sA(c.bind(o),o,a,t)),o}catch(o){throw s.setStatus({code:ae,message:"internal_error"}),Ie(o,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),o}})}})}function sA(e,t,n,r){return new Proxy(e,{apply(i,s,o){return Sn({op:"gen_ai.invoke_agent",name:"invoke_agent",attributes:{[Y]:f_,[me]:mI,[Un]:"invoke_agent"}},async a=>{try{const c=n?.name;c&&typeof c=="string"&&(a.setAttribute(fI,c),a.setAttribute(Yg,c),a.updateName(`invoke_agent ${c}`));const l=(o.length>1?o[1]:void 0)?.configurable?.thread_id;l&&typeof l=="string"&&a.setAttribute(Al,l);const f=nA(t);f&&a.setAttribute(Oa,JSON.stringify(f));const p=r.recordInputs,h=r.recordOutputs,m=o.length>0?o[0]?.messages??[]:[];if(m&&p){const _=Ml(m),{systemInstructions:S,filteredMessages:T}=ps(_);S&&a.setAttribute(ds,S);const v=Pa(T),w=Array.isArray(T)?T.length:0;a.setAttributes({[bi]:JSON.stringify(v),[Er]:w})}const g=await Reflect.apply(i,s,o);return h&&rA(a,m??null,g),g}catch(c){throw a.setStatus({code:ae,message:"internal_error"}),Ie(c,{mechanism:{handled:!1,type:"auto.ai.langgraph.error"}}),c}})}})}function oA(e,t){const n=t||{};return e.compile=iA(e.compile.bind(e),n),e}function p_(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}const Zr=U;function aA(){return"history"in Zr&&!!Zr.history}function cA(){if(!("fetch"in Zr))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function mu(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function h_(){if(typeof EdgeRuntime=="string")return!0;if(!cA())return!1;if(mu(Zr.fetch))return!0;let e=!1;const t=Zr.document;if(t&&typeof t.createElement=="function")try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow?.fetch&&(e=mu(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){O&&y.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e}function uA(){return"ReportingObserver"in Zr}function Nl(e,t){const n="fetch";Wn(n,e),zn(n,()=>m_(void 0,t))}function lA(e){const t="fetch-body-resolved";Wn(t,e),zn(t,()=>m_(fA))}function m_(e,t=!1){t&&!h_()||Je(U,"fetch",function(n){return function(...r){const i=new Error,{method:s,url:o}=pA(r),a={args:r,fetchData:{method:s,url:o},startTimestamp:Ee()*1e3,virtualError:i,headers:hA(r)};return e||yt("fetch",{...a}),n.apply(U,r).then(async c=>(e?e(c):yt("fetch",{...a,endTimestamp:Ee()*1e3,response:c}),c),c=>{yt("fetch",{...a,endTimestamp:Ee()*1e3,error:c}),Ht(c)&&c.stack===void 0&&(c.stack=i.stack,Pe(c,"framesToPop",1));const d=M()?.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 p=new URL(a.fetchData.url).host;d==="always"?c.message=`${c.message} (${p})`:Pe(c,"__sentry_fetch_url_host__",p)}catch{}throw c})}})}async function dA(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 fA(e){let t;try{t=e.clone()}catch{return}dA(t,()=>{yt("fetch-body-resolved",{endTimestamp:Ee()*1e3,response:e})})}function go(e,t){return!!e&&typeof e=="object"&&!!e[t]}function ep(e){return typeof e=="string"?e:e?go(e,"url")?e.url:e.toString?e.toString():"":""}function pA(e){if(e.length===0)return{method:"GET",url:""};if(e.length===2){const[n,r]=e;return{url:ep(n),method:go(r,"method")?String(r.method).toUpperCase():Zu(n)&&go(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:ep(t),method:go(t,"method")?String(t.method).toUpperCase():"GET"}}function hA(e){const[t,n]=e;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(Zu(t))return new Headers(t.headers)}catch{}}function mA(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function gA(){return"npm"}function _A(){return!mA()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function Vo(){return typeof window<"u"&&(!_A()||yA())}function yA(){return U.process?.type==="renderer"}const Ct=U,pe=Ct.document,$i=Ct.navigator,g_="Report a Bug",bA="Cancel",SA="Send Bug Report",vA="Confirm",EA="Report a Bug",TA="your.email@example.org",wA="Email",IA="What's the bug? What did you expect?",kA="Description",AA="Your Name",RA="Name",CA="Thank you for your report!",xA="(required)",OA="Add a screenshot",MA="Remove screenshot",NA="Highlight",PA="Hide",LA="Remove",DA="widget",FA="api",$A=5e3,__=(e,t={includeReplay:!0})=>{if(!e.message)throw new Error("Unable to submit feedback with empty message");const n=M();if(!n)throw new Error("No client setup, cannot send feedback.");e.tags&&Object.keys(e.tags).length&&z().setTags(e.tags);const r=qg({source:FA,url:Ir(),...e},t);return new Promise((i,s)=>{const o=setTimeout(()=>s("Unable to determine if Feedback was correctly sent."),3e4),a=n.on("afterSendEvent",(c,u)=>{if(c.event_id===r)return clearTimeout(o),a(),u?.statusCode&&u.statusCode>=200&&u.statusCode<300?i(r):u?.statusCode===403?s("Unable to send feedback. This could be because this domain is not in your list of allowed domains."):s("Unable to send feedback. This could be because of network issues, or because you are using an ad-blocker.")})})},_o=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function UA(){return!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test($i.userAgent)||/Macintosh/i.test($i.userAgent)&&$i.maxTouchPoints&&$i.maxTouchPoints>1||!isSecureContext)}function Us(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 BA(e){const t=pe.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 ht(e,t){return Object.entries(t).forEach(([n,r])=>{e.setAttributeNS(null,n,r)}),e}const Nr=20,HA="http://www.w3.org/2000/svg";function jA(){const e=a=>Ct.document.createElementNS(HA,a),t=ht(e("svg"),{width:`${Nr}`,height:`${Nr}`,viewBox:`0 0 ${Nr} ${Nr}`,fill:"var(--actor-color, var(--foreground))"}),n=ht(e("g"),{clipPath:"url(#clip0_57_80)"}),r=ht(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=ht(e("clipPath"),{id:"clip0_57_80"}),o=ht(e("rect"),{width:`${Nr}`,height:`${Nr}`,fill:"white"});return s.appendChild(o),i.appendChild(s),t.appendChild(i).appendChild(s).appendChild(o),t}function WA({triggerLabel:e,triggerAriaLabel:t,shadow:n,styleNonce:r}){const i=pe.createElement("button");if(i.type="button",i.className="widget__actor",i.ariaHidden="false",i.ariaLabel=t||e||g_,i.appendChild(jA()),e){const o=pe.createElement("span");o.appendChild(pe.createTextNode(e)),i.appendChild(o)}const s=BA(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 y_="rgba(88, 74, 192, 1)",zA={foreground:"#2b2233",background:"#ffffff",accentForeground:"white",accentBackground:y_,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%)"},tp={foreground:"#ebe6ef",background:"#29232f",accentForeground:"white",accentBackground:y_,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 np(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 rp({colorScheme:e,themeDark:t,themeLight:n,styleNonce:r}){const i=pe.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};`:""} ${np(e==="dark"?{...tp,...t}:{...zA,...n})} } ${e==="system"?` @media (prefers-color-scheme: dark) { :host { color-scheme: only dark; ${np({...tp,...t})} } }`:""} `,r&&i.setAttribute("nonce",r),i}const b_=({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:f={email:"email",name:"username"},tags:p,styleNonce:h,scriptNonce:m,colorScheme:g="system",themeLight:_={},themeDark:S={},addScreenshotButtonLabel:T=OA,cancelButtonLabel:v=bA,confirmButtonLabel:w=vA,emailLabel:E=wA,emailPlaceholder:b=TA,formTitle:k=EA,isRequiredLabel:F=xA,messageLabel:I=kA,messagePlaceholder:L=IA,nameLabel:C=RA,namePlaceholder:P=AA,removeScreenshotButtonLabel:D=MA,submitButtonLabel:ee=SA,successMessageText:V=CA,triggerLabel:Q=g_,triggerAriaLabel:A="",highlightToolText:B=NA,hideToolText:R=PA,removeHighlightText:W=LA,onFormOpen:ie,onFormClose:te,onSubmitSuccess:Te,onSubmitError:je,onFormSubmitted:tt}={})=>{const De={id:i,autoInject:s,showBranding:o,isEmailRequired:a,isNameRequired:c,showEmail:u,showName:d,enableScreenshot:l,useSentryUser:f,tags:p,styleNonce:h,scriptNonce:m,colorScheme:g,themeDark:S,themeLight:_,triggerLabel:Q,triggerAriaLabel:A,cancelButtonLabel:v,submitButtonLabel:ee,confirmButtonLabel:w,formTitle:k,emailLabel:E,emailPlaceholder:b,messageLabel:I,messagePlaceholder:L,nameLabel:C,namePlaceholder:P,successMessageText:V,isRequiredLabel:F,addScreenshotButtonLabel:T,removeScreenshotButtonLabel:D,highlightToolText:B,hideToolText:R,removeHighlightText:W,onFormClose:te,onFormOpen:ie,onSubmitError:je,onSubmitSuccess:Te,onFormSubmitted:tt};let ke=null,nt=null,Ve=[];const Jt=ce=>{if(!ke){const _e=pe.createElement("div");_e.id=String(ce.id),pe.body.appendChild(_e),ke=_e.attachShadow({mode:"open"}),nt=rp(ce),ke.appendChild(nt)}return ke},Tn=async ce=>{const _e=ce.enableScreenshot&&UA();let it,Ae;try{it=(t?t():await e("feedbackModalIntegration",m))(),uu(it)}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 K=_e?n?n():await e("feedbackScreenshotIntegration",m):void 0;K&&(Ae=K(),uu(Ae))}catch{_o&&y.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.")}const We=it.createDialog({options:{...ce,onFormClose:()=>{We?.close(),ce.onFormClose?.()},onFormSubmitted:()=>{We?.close(),ce.onFormSubmitted?.()}},screenshotIntegration:Ae,sendFeedback:__,shadow:Jt(ce)});return We},Xn=(ce,_e={})=>{const it=Us(De,_e),Ae=typeof ce=="string"?pe.querySelector(ce):typeof ce.addEventListener=="function"?ce:null;if(!Ae)throw _o&&y.error("[Feedback] Unable to attach to target element"),new Error("Unable to attach to target element");let We=null;const K=async()=>{We||(We=await Tn({...it,onFormSubmitted:()=>{We?.removeFromDom(),it.onFormSubmitted?.()}})),We.appendToDom(),We.open()};Ae.addEventListener("click",K);const Ke=()=>{Ve=Ve.filter(Z=>Z!==Ke),We?.removeFromDom(),We=null,Ae.removeEventListener("click",K)};return Ve.push(Ke),Ke},rt=(ce={})=>{const _e=Us(De,ce),it=Jt(_e),Ae=WA({triggerLabel:_e.triggerLabel,triggerAriaLabel:_e.triggerAriaLabel,shadow:it,styleNonce:h});return Xn(Ae.el,{..._e,onFormOpen(){Ae.hide()},onFormClose(){Ae.show()},onFormSubmitted(){Ae.show()}}),Ae};return{name:"Feedback",setupOnce(){!Vo()||!De.autoInject||(pe.readyState==="loading"?pe.addEventListener("DOMContentLoaded",()=>rt().appendToDom()):rt().appendToDom())},attachTo:Xn,createWidget(ce={}){const _e=rt(Us(De,ce));return _e.appendToDom(),_e},async createForm(ce={}){return Tn(Us(De,ce))},setTheme(ce){if(De.colorScheme=ce,ke){const _e=rp(De);nt?ke.replaceChild(_e,nt):ke.prepend(_e),nt=_e}},remove(){ke&&(ke.parentElement?.remove(),ke=null,nt=null),Ve.forEach(ce=>ce()),Ve=[]}}});function qA(){return M()?.getIntegrationByName("Feedback")}var Da,ge,S_,nr,ip,v_,gu,Xi={},Pl=[],GA=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ll=Array.isArray;function Cn(e,t){for(var n in t)e[n]=t[n];return e}function E_(e){var t=e.parentNode;t&&t.removeChild(e)}function re(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?Da.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 yo(e,o,r,i,null)}function yo(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??++S_,__i:-1,__u:0};return i==null&&ge.vnode!=null&&ge.vnode(s),s}function hs(e){return e.children}function bo(e,t){this.props=e,this.context=t}function ei(e,t){if(t==null)return e.__?ei(e.__,e.__i+1):null;for(var n;tn?(_u(r,t,i),i.length=r.length=0,t=void 0,nr.sort(gu)):t&&ge.__c&&ge.__c(t,Pl));t&&_u(r,t,i),Ko.__r=0}function w_(e,t,n,r,i,s,o,a,c,u,d){var l,f,p,h,m,g=r&&r.__k||Pl,_=t.length;for(n.__d=c,KA(n,t,g),c=n.__d,l=0;l<_;l++)(p=n.__k[l])!=null&&typeof p!="boolean"&&typeof p!="function"&&(f=p.__i===-1?Xi:g[p.__i]||Xi,p.__i=l,Dl(e,p,f,i,s,o,a,c,u,d),h=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Fl(f.ref,null,p),d.push(p.ref,p.__c||h,p)),m==null&&h!=null&&(m=h),65536&p.__u||f.__k===p.__k?c=I_(p,c,e):typeof p.type=="function"&&p.__d!==void 0?c=p.__d:h&&(c=h.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=c,n.__e=m}function KA(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?yo(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,a=YA(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:So}),n.__[e]}function ir(e){return ti=1,A_(C_,e)}function A_(e,t,n){var r=Rr(mn++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):C_(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=he,!he.u)){var i=function(a,c,u){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(f){return!!f.__c});if(d.every(function(f){return!f.__N}))return!s||s.call(this,a,c,u);var l=!1;return d.forEach(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(l=!0)}}),!(!l&&r.__c.props===a)&&(!s||s.call(this,a,c,u))};he.u=!0;var s=he.shouldComponentUpdate,o=he.componentWillUpdate;he.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)},he.shouldComponentUpdate=i}return r.__N||r.__}function ZA(e,t){var n=Rr(mn++,3);!Ce.__s&&$l(n.__H,t)&&(n.__=e,n.i=t,he.__H.__h.push(n))}function R_(e,t){var n=Rr(mn++,4);!Ce.__s&&$l(n.__H,t)&&(n.__=e,n.i=t,he.__h.push(n))}function eR(e){return ti=5,ms(function(){return{current:e}},[])}function tR(e,t,n){ti=6,R_(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 ms(e,t){var n=Rr(mn++,7);return $l(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Vr(e,t){return ti=8,ms(function(){return e},t)}function nR(e){var t=he.context[e.__c],n=Rr(mn++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(he)),t.props.value):e.__}function rR(e,t){Ce.useDebugValue&&Ce.useDebugValue(t?t(e):e)}function iR(e){var t=Rr(mn++,10),n=ir();return t.__=e,he.componentDidCatch||(he.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function sR(){var e=Rr(mn++,11);if(!e.__){for(var t=he.__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 oR(){for(var e;e=k_.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(vo),e.__H.__h.forEach(bu),e.__H.__h=[]}catch(t){e.__H.__h=[],Ce.__e(t,e.__v)}}Ce.__b=function(e){he=null,lp&&lp(e)},Ce.__=function(e,t){t.__k&&t.__k.__m&&(e.__m=t.__k.__m),mp&&mp(e,t)},Ce.__r=function(e){dp&&dp(e),mn=0;var t=(he=e.__c).__H;t&&(yc===he?(t.__h=[],he.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=So,n.__N=n.i=void 0})):(t.__h.forEach(vo),t.__h.forEach(bu),t.__h=[],mn=0)),yc=he},Ce.diffed=function(e){fp&&fp(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(k_.push(t)!==1&&up===Ce.requestAnimationFrame||((up=Ce.requestAnimationFrame)||aR)(oR)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==So&&(n.__=n.__V),n.i=void 0,n.__V=So})),yc=he=null},Ce.__c=function(e,t){t.some(function(n){try{n.__h.forEach(vo),n.__h=n.__h.filter(function(r){return!r.__||bu(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Ce.__e(r,n.__v)}}),pp&&pp(e,t)},Ce.unmount=function(e){hp&&hp(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{vo(r)}catch(i){t=i}}),n.__H=void 0,t&&Ce.__e(t,n.__v))};var gp=typeof requestAnimationFrame=="function";function aR(e){var t,n=function(){clearTimeout(r),gp&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);gp&&(t=requestAnimationFrame(n))}function vo(e){var t=he,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),he=t}function bu(e){var t=he;e.__c=e.__(),he=t}function $l(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function C_(e,t){return typeof t=="function"?t(e):t}const cR=Object.defineProperty({__proto__:null,useCallback:Vr,useContext:nR,useDebugValue:rR,useEffect:ZA,useErrorBoundary:iR,useId:sR,useImperativeHandle:tR,useLayoutEffect:R_,useMemo:ms,useReducer:A_,useRef:eR,useState:ir},Symbol.toStringTag,{value:"Module"}),uR="http://www.w3.org/2000/svg";function lR(){const e=r=>pe.createElementNS(uR,r),t=ht(e("svg"),{width:"32",height:"30",viewBox:"0 0 72 66",fill:"inherit"}),n=ht(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 dR({options:e}){const t=ms(()=>({__html:lR().outerHTML}),[]);return re("h2",{class:"dialog__header"},re("span",{class:"dialog__title"},e.formTitle),e.showBranding?re("a",{class:"brand-link",target:"_blank",href:"https://sentry.io/welcome/",title:"Powered by Sentry",rel:"noopener noreferrer",dangerouslySetInnerHTML:t}):null)}function fR(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 bc(e,t){const n=e.get(t);return typeof n=="string"?n.trim():""}function pR({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:f,cancelButtonLabel:p,emailLabel:h,emailPlaceholder:m,isEmailRequired:g,isNameRequired:_,messageLabel:S,messagePlaceholder:T,nameLabel:v,namePlaceholder:w,submitButtonLabel:E,isRequiredLabel:b}=e,[k,F]=ir(!1),[I,L]=ir(null),[C,P]=ir(!1),D=u?.input,[ee,V]=ir(null),Q=Vr(R=>{V(R),P(!1)},[]),A=Vr(R=>{const W=fR(R,{emailLabel:h,isEmailRequired:g,isNameRequired:_,messageLabel:S,nameLabel:v});return W.length>0?L(`Please enter in the following required fields: ${W.join(", ")}`):L(null),W.length===0},[h,g,_,S,v]),B=Vr(async R=>{F(!0);try{if(R.preventDefault(),!(R.target instanceof HTMLFormElement))return;const W=new FormData(R.target),ie=await(u&&C?u.value():void 0),te={name:bc(W,"name"),email:bc(W,"email"),message:bc(W,"message"),attachments:ie?[ie]:void 0};if(!A(te))return;try{const Te=await i({name:te.name,email:te.email,message:te.message,source:DA,tags:d},{attachments:te.attachments});s(te,Te)}catch(Te){_o&&y.error(Te),L(Te),o(Te)}}finally{F(!1)}},[u&&C,s,o]);return re("form",{class:"form",onSubmit:B},D&&C?re(D,{onError:Q}):null,re("fieldset",{class:"form__right","data-sentry-feedback":!0,disabled:k},re("div",{class:"form__top"},I?re("div",{class:"form__error-container"},I):null,c?re("label",{for:"name",class:"form__label"},re(Sc,{label:v,isRequiredLabel:b,isRequired:_}),re("input",{class:"form__input",defaultValue:n,id:"name",name:"name",placeholder:w,required:_,type:"text"})):re("input",{"aria-hidden":!0,value:n,name:"name",type:"hidden"}),a?re("label",{for:"email",class:"form__label"},re(Sc,{label:h,isRequiredLabel:b,isRequired:g}),re("input",{class:"form__input",defaultValue:t,id:"email",name:"email",placeholder:m,required:g,type:"email"})):re("input",{"aria-hidden":!0,value:t,name:"email",type:"hidden"}),re("label",{for:"message",class:"form__label"},re(Sc,{label:S,isRequiredLabel:b,isRequired:!0}),re("textarea",{autoFocus:!0,class:"form__input form__input--textarea",id:"message",name:"message",placeholder:T,required:!0,rows:5})),D?re("label",{for:"screenshot",class:"form__label"},re("button",{class:"btn btn--default",disabled:k,type:"button",onClick:()=>{V(null),P(R=>!R)}},C?f:l),ee?re("div",{class:"form__error-container"},ee.message):null):null),re("div",{class:"btn-group"},re("button",{class:"btn btn--primary",disabled:k,type:"submit"},E),re("button",{class:"btn btn--default",disabled:k,type:"button",onClick:r},p))))}function Sc({label:e,isRequired:t,isRequiredLabel:n}){return re("span",{class:"form__label__text"},e,t&&re("span",{class:"form__label__text--required"},n))}const Hs=16,_p=17,hR="http://www.w3.org/2000/svg";function mR(){const e=c=>Ct.document.createElementNS(hR,c),t=ht(e("svg"),{width:`${Hs}`,height:`${_p}`,viewBox:`0 0 ${Hs} ${_p}`,fill:"inherit"}),n=ht(e("g"),{clipPath:"url(#clip0_57_156)"}),r=ht(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=ht(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=ht(e("clipPath"),{id:"clip0_57_156"}),a=ht(e("rect"),{width:`${Hs}`,height:`${Hs}`,fill:"white",transform:"translate(0 0.5)"});return o.appendChild(a),s.appendChild(o),t.appendChild(s).appendChild(o).appendChild(a),t}function gR({open:e,onFormSubmitted:t,...n}){const r=n.options,i=ms(()=>({__html:mR().outerHTML}),[]),[s,o]=ir(null),a=Vr(()=>{s&&(clearTimeout(s),o(null)),t()},[s]),c=Vr((u,d)=>{n.onSubmitSuccess(u,d),o(setTimeout(()=>{t(),o(null)},$A))},[t]);return re(hs,null,s?re("div",{class:"success__position",onClick:a},re("div",{class:"success__content"},r.successMessageText,re("span",{class:"success__icon",dangerouslySetInnerHTML:i}))):re("dialog",{class:"dialog",onClick:r.onFormClose,open:e},re("div",{class:"dialog__position"},re("div",{class:"dialog__content",onClick:u=>{u.stopPropagation()}},re(dR,{options:r}),re(pR,{...n,onSubmitSuccess:c})))))}const _R=` .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; } `,yR=` .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); } `,bR=` .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); } `,SR=` .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)); } `,vR=` .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 ER(e){const t=pe.createElement("style");return t.textContent=` :host { --dialog-inset: var(--inset); } ${_R} ${yR} ${bR} ${SR} ${vR} `,e&&t.setAttribute("nonce",e),t}function TR(){const e=z().getUser(),t=Le().getUser(),n=cr().getUser();return e&&Object.keys(e).length?e:t&&Object.keys(t).length?t:n}const wR=(()=>({name:"FeedbackModal",setupOnce(){},createDialog:({options:e,screenshotIntegration:t,sendFeedback:n,shadow:r})=>{const i=r,s=e.useSentryUser,o=TR(),a=pe.createElement("div"),c=ER(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(),pe.body.style.overflow=u},open(){f(!0),e.onFormOpen?.(),M()?.emit("openFeedbackWidget"),u=pe.body.style.overflow,pe.body.style.overflow="hidden"},close(){f(!1),pe.body.style.overflow=u}},l=t?.createInput({h:re,hooks:cR,dialog:d,options:e}),f=p=>{QA(re(gR,{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:()=>{f(!1),e.onFormClose?.()},onSubmit:n,onSubmitSuccess:(h,m)=>{f(!1),e.onSubmitSuccess?.(h,m)},onSubmitError:h=>{e.onSubmitError?.(h)},onFormSubmitted:()=>{e.onFormSubmitted?.()},open:p}),a)};return d}}));function IR({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 kR(e){const t=pe.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 AR({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 RR({hooks:e}){function t(){const[n,r]=e.useState(Ct.devicePixelRatio??1);return e.useEffect(()=>{const i=()=>{r(Ct.devicePixelRatio)},s=matchMedia(`(resolution: ${Ct.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 $i.mediaDevices.getDisplayMedia({video:{width:Ct.innerWidth*a,height:Ct.innerHeight*a},audio:!1,monitorTypeSurfaces:"exclude",preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"}),d=pe.createElement("video");await new Promise((l,f)=>{d.srcObject=u,d.onloadedmetadata=()=>{i(d,a),u.getTracks().forEach(p=>p.stop()),l()},d.play().catch(f)}),s()})().catch(o)},[])}}function CR(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 kn(e,t,n){if(!e)return;const r=e.getContext("2d",t);r&&n(e,r)}function vc(e,t){kn(e,{alpha:!0},(n,r)=>{r.drawImage(t,0,0,t.width,t.height,0,0,n.width,n.height)})}function Ec(e,t,n){kn(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=>{CR(s,i,t)})})}function xR({h:e,hooks:t,outputBuffer:n,dialog:r,options:i}){const s=RR({hooks:t}),o=AR({h:e}),a=IR({h:e}),c={__html:kR(i.styleNonce).innerText},u=r.el.style,d=({screenshot:l})=>{const[f,p]=t.useState("highlight"),[h,m]=t.useState([]),g=t.useRef(null),_=t.useRef(null),S=t.useRef(null),T=t.useRef(null),[v,w]=t.useState(1),E=t.useMemo(()=>{const C=pe.getElementById(i.id);if(!C)return"white";const P=getComputedStyle(C);return P.getPropertyValue("--button-primary-background")||P.getPropertyValue("--accent-background")},[i.id]);t.useLayoutEffect(()=>{const C=()=>{const P=g.current;P&&(kn(l.canvas,{alpha:!1},D=>{const ee=Math.min(P.clientWidth/D.width,P.clientHeight/D.height);w(ee)}),(P.clientHeight===0||P.clientWidth===0)&&setTimeout(C,0))};return C(),Ct.addEventListener("resize",C),()=>{Ct.removeEventListener("resize",C)}},[l]);const b=t.useCallback((C,P)=>{kn(C,{alpha:!0},(D,ee)=>{ee.scale(P,P),D.width=l.canvas.width,D.height=l.canvas.height})},[l]);t.useEffect(()=>{b(_.current,l.dpi),vc(_.current,l.canvas)},[l]),t.useEffect(()=>{b(S.current,l.dpi),kn(S.current,{alpha:!0},(C,P)=>{P.clearRect(0,0,C.width,C.height)}),Ec(S.current,E,h)},[h,E]),t.useEffect(()=>{b(n,l.dpi),vc(n,l.canvas),kn(pe.createElement("canvas"),{alpha:!0},(C,P)=>{P.scale(l.dpi,l.dpi),C.width=l.canvas.width,C.height=l.canvas.height,Ec(C,E,h),vc(n,C)})},[h,l,E]);const k=C=>{if(!f||!T.current)return;const P=T.current.getBoundingClientRect(),D={type:f,x:C.offsetX/v,y:C.offsetY/v},ee=(A,B)=>{const R=(B.clientX-P.x)/v,W=(B.clientY-P.y)/v;return{type:A.type,x:Math.min(A.x,R),y:Math.min(A.y,W),w:Math.abs(R-A.x),h:Math.abs(W-A.y)}},V=A=>{kn(S.current,{alpha:!0},(B,R)=>{R.clearRect(0,0,B.width,B.height)}),Ec(S.current,E,[...h,ee(D,A)])},Q=A=>{const B=ee(D,A);B.w*v>=1&&B.h*v>=1&&m(R=>[...R,B]),pe.removeEventListener("mousemove",V),pe.removeEventListener("mouseup",Q)};pe.addEventListener("mousemove",V),pe.addEventListener("mouseup",Q)},F=t.useCallback(C=>P=>{P.preventDefault(),P.stopPropagation(),m(D=>{const ee=[...D];return ee.splice(C,1),ee})},[]),I={width:`${l.canvas.width*v}px`,height:`${l.canvas.height*v}px`},L=C=>{C.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:I}),e("canvas",{ref:S,id:"foreground",style:I}),e("div",{ref:T,onMouseDown:k,style:I},h.map((C,P)=>e("div",{key:P,class:"editor__rect",style:{top:`${C.y*v}px`,left:`${C.x*v}px`,width:`${C.w*v}px`,height:`${C.h*v}px`}},e("button",{"aria-label":i.removeHighlightText,onClick:F(P),onMouseDown:L,onMouseUp:L,type:"button"},e(a,null))))))),e(o,{options:i,action:f,setAction:p}))};return function({onError:f}){const[p,h]=t.useState();return s({onBeforeScreenshot:t.useCallback(()=>{u.display="none"},[]),onScreenshot:t.useCallback((m,g)=>{kn(pe.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",f(m)},[])}),p?e(d,{screenshot:p}):e("div",null)}}const OR=(()=>({name:"FeedbackScreenshot",setupOnce(){},createInput:({h:e,hooks:t,dialog:n,options:r})=>{const i=pe.createElement("canvas");return{input:xR({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=U;let Su=0;function x_(){return Su>0}function MR(){Su++,setTimeout(()=>{Su--})}function ni(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(tl(e))return e}catch{return e}const r=function(...i){try{const s=i.map(o=>ni(o,t));return e.apply(this,s)}catch(s){throw MR(),ut(o=>{o.addEventProcessor(a=>(t.mechanism&&(eu(a,void 0),pn(a,t.mechanism)),a.extra={...a.extra,arguments:i},a)),Ie(s)}),s}};try{for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}catch{}Tm(r,e),Pe(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}function Ul(){const e=Ir(),{referrer:t}=N.document||{},{userAgent:n}=N.navigator||{},r={...t&&{Referer:t},...n&&{"User-Agent":n}};return{url:e,headers:r}}const NR={replayIntegration:"replay",replayCanvasIntegration:"replay-canvas",feedbackIntegration:"feedback",feedbackModalIntegration:"feedback-modal",feedbackScreenshotIntegration:"feedback-screenshot",captureConsoleIntegration:"captureconsole",contextLinesIntegration:"contextlines",linkedErrorsIntegration:"linkederrors",dedupeIntegration:"dedupe",extraErrorDataIntegration:"extraerrordata",graphqlClientIntegration:"graphqlclient",httpClientIntegration:"httpclient",reportingObserverIntegration:"reportingobserver",rewriteFramesIntegration:"rewriteframes",browserProfilingIntegration:"browserprofiling",moduleMetadataIntegration:"modulemetadata",instrumentAnthropicAiClient:"instrumentanthropicaiclient",instrumentOpenAiClient:"instrumentopenaiclient",instrumentGoogleGenAIClient:"instrumentgooglegenaiclient",instrumentLangGraph:"instrumentlanggraph",createLangChainCallbackHandler:"createlangchaincallbackhandler"},yp=N;async function O_(e,t){const n=NR[e],r=yp.Sentry=yp.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=PR(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,f)=>{o.addEventListener("load",()=>l()),o.addEventListener("error",f)}),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 PR(e){const n=M()?.getOptions()?.cdnBaseUrl||"https://browser.sentry-cdn.com";return new URL(`/${sn}/${e}.min.js`,n).toString()}const LR=b_({lazyLoadIntegration:O_}),bp=b_({getModalIntegration:()=>wR,getScreenshotIntegration:()=>OR});function Fa(e,t){const n=Bl(e,t),r={type:BR(t),value:HR(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function DR(e,t,n,r){const s=M()?.getOptions().normalizeDepth,o=zR(t),a={__serialized__:Jm(t,s)};if(o)return{exception:{values:[Fa(e,o)]},extra:a};const c={exception:{values:[{type:_a(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:jR(t,{isUnhandledRejection:r})}]},extra:a};if(n){const u=Bl(e,n);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function Tc(e,t){return{exception:{values:[Fa(e,t)]}}}function Bl(e,t){const n=t.stacktrace||t.stack||"",r=$R(t),i=UR(t);try{return e(n,r,i)}catch{}return[]}const FR=/Minified React error #\d+;/i;function $R(e){return e&&FR.test(e.message)?1:0}function UR(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function M_(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function BR(e){const t=e?.name;return!t&&M_(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function HR(e){const t=e?.message;return M_(e)?Array.isArray(e.message)&&e.message.length==2?e.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?Af(t.error):Af(e):"No error message"}function N_(e,t,n,r){const i=n?.syntheticException||void 0,s=$a(e,t,i,r);return pn(s),s.level="error",n?.event_id&&(s.event_id=n.event_id),ls(s)}function P_(e,t,n="info",r,i){const s=r?.syntheticException||void 0,o=vu(e,t,s,i);return o.level=n,r?.event_id&&(o.event_id=r.event_id),ls(o)}function $a(e,t,n,r,i){let s;if(Sm(t)&&t.error)return Tc(e,t.error);if(Yd(t)||vv(t)){const o=t;if("stack"in t)s=Tc(e,t);else{const a=o.name||(Yd(o)?"DOMError":"DOMException"),c=o.message?`${a}: ${o.message}`:a;s=vu(e,c,n,r),eu(s,c)}return"code"in o&&(s.tags={...s.tags,"DOMException.code":`${o.code}`}),s}return Ht(t)?Tc(e,t):ot(t)||_a(t)?(s=DR(e,t,n,i),pn(s,{synthetic:!0}),s):(s=vu(e,t,n,r),eu(s,`${t}`),pn(s,{synthetic:!0}),s)}function vu(e,t,n,r){const i={};if(r&&n){const s=Bl(e,n);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]}),pn(i,{synthetic:!0})}if(ga(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 jR(e,{isUnhandledRejection:t}){const n=Av(e),r=t?"promise rejection":"exception";return Sm(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:_a(e)?`Event \`${WR(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function WR(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function zR(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}class L_ extends Y0{constructor(t){const n=qR(t),r=N.SENTRY_SDK_SOURCE||gA();Og(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&&Ho(this),u&&hl(this))}),i&&this.on("beforeSendSession",fT)}eventFromException(t,n){return N_(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return P_(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 qR(e){return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:N.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...e}}const Tr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,J=U,GR=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",gs=(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=GR(t.value,n),e(t)))}},_s=(e=!0)=>{const t=J.performance?.getEntriesByType?.("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart_s()?.activationStart??0;function On(e,t,n){J.document&&J.addEventListener(e,t,n)}function Yo(e,t,n){J.document&&J.removeEventListener(e,t,n)}let Kr=-1;const D_=new Set,VR=()=>J.document?.visibilityState==="hidden"&&!J.document?.prerendering?0:1/0,Eo=e=>{if(KR(e)&&Kr>-1){if(e.type==="visibilitychange"||e.type==="pagehide")for(const t of D_)t();isFinite(Kr)||(Kr=e.type==="visibilitychange"?e.timeStamp:0,Yo("prerenderingchange",Eo,!0))}},ys=()=>{if(J.document&&Kr<0){const e=Si();Kr=(J.document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(n=>n.name==="hidden"&&n.startTime>e)[0]?.startTime)??VR(),On("visibilitychange",Eo,!0),On("pagehide",Eo,!0),On("prerenderingchange",Eo,!0)}return{get firstHiddenTime(){return Kr},onHidden(e){D_.add(e)}}};function KR(e){return e.type==="pagehide"||J.document?.visibilityState==="hidden"}const YR=()=>`v5-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,bs=(e,t=-1)=>{const n=_s();let r="navigate";return n&&(J.document?.prerendering||Si()>0?r="prerender":J.document?.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:YR(),navigationType:r}},wc=new WeakMap;function Hl(e,t){try{return wc.get(e)||wc.set(e,new t),wc.get(e)}catch{return new t}}class Jo{constructor(){Jo.prototype.__init.call(this),Jo.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 vi=(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{}},jl=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Ua=e=>{J.document?.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},JR=[1800,3e3],XR=(e,t={})=>{Ua(()=>{const n=ys(),r=bs("FCP");let i;const o=vi("paint",a=>{for(const c of a)c.name==="first-contentful-paint"&&(o.disconnect(),c.startTime{XR(jl(()=>{const n=bs("CLS",0);let r;const i=ys(),s=Hl(t,Jo),o=c=>{for(const u of c)s._processEntry(u);s._sessionValue>n.value&&(n.value=s._sessionValue,n.entries=s._sessionEntries,r())},a=vi("layout-shift",o);a&&(r=gs(e,n,QR,t.reportAllChanges),i.onHidden(()=>{o(a.takeRecords()),r(!0)}),J?.setTimeout?.(r))}))};let F_=0,Ic=1/0,js=0;const eC=e=>{e.forEach(t=>{t.interactionId&&(Ic=Math.min(Ic,t.interactionId),js=Math.max(js,t.interactionId),F_=js?(js-Ic)/7+1:0)})};let Eu;const $_=()=>Eu?F_:performance.interactionCount||0,tC=()=>{"interactionCount"in performance||Eu||(Eu=vi("event",eC,{type:"event",buffered:!0,durationThreshold:0}))},kc=10;let U_=0;const nC=()=>$_()-U_;class Xo{constructor(){Xo.prototype.__init.call(this),Xo.prototype.__init2.call(this)}__init(){this._longestInteractionList=[]}__init2(){this._longestInteractionMap=new Map}_resetInteractions(){U_=$_(),this._longestInteractionList.length=0,this._longestInteractionMap.clear()}_estimateP98LongestInteraction(){const t=Math.min(this._longestInteractionList.length-1,Math.floor(nC()/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>kc){const i=this._longestInteractionList.splice(kc);for(const s of i)this._longestInteractionMap.delete(s.id)}this._onAfterProcessingINPCandidate?.(r)}}}const B_=e=>{const t=J.requestIdleCallback||J.setTimeout;J.document?.visibilityState==="hidden"?e():(e=jl(e),On("visibilitychange",e,{once:!0,capture:!0}),On("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),Yo("visibilitychange",e,{capture:!0}),Yo("pagehide",e,{capture:!0})}))},rC=[200,500],iC=40,sC=(e,t={})=>{if(!(globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype))return;const n=ys();Ua(()=>{tC();const r=bs("INP");let i;const s=Hl(t,Xo),o=c=>{B_(()=>{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=vi("event",o,{durationThreshold:t.durationThreshold??iC});i=gs(e,r,rC,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{o(a.takeRecords()),i(!0)}))})};class oC{_processEntry(t){this._onBeforeProcessingEntry?.(t)}}const aC=[2500,4e3],cC=(e,t={})=>{Ua(()=>{const n=ys(),r=bs("LCP");let i;const s=Hl(t,oC),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&&(B_(c),Yo(d.type,u,{capture:!0}))};for(const d of["keydown","click","visibilitychange"])On(d,u,{capture:!0})}})},uC=[800,1800],Tu=e=>{J.document?.prerendering?Ua(()=>Tu(e)):J.document?.readyState!=="complete"?addEventListener("load",()=>Tu(e),!0):setTimeout(e)},lC=(e,t={})=>{const n=bs("TTFB"),r=gs(e,n,uC,t.reportAllChanges);Tu(()=>{const i=_s();i&&(n.value=Math.max(i.responseStart-Si(),0),n.entries=[i],r(!0))})},Wi={},Qo={};let H_,j_,W_,z_;function Wl(e,t=!1){return Ba("cls",e,fC,H_,t)}function zl(e,t=!1){return Ba("lcp",e,pC,j_,t)}function dC(e){return Ba("ttfb",e,hC,W_)}function q_(e){return Ba("inp",e,mC,z_)}function wr(e,t){return G_(e,t),Qo[e]||(gC(e),Qo[e]=!0),V_(e,t)}function Ss(e,t){const n=Wi[e];if(n?.length)for(const r of n)try{r(t)}catch(i){Tr&&y.error(`Error while triggering instrumentation handler. Type: ${e} Name: ${dn(r)} Error:`,i)}}function fC(){return ZR(e=>{Ss("cls",{metric:e}),H_=e},{reportAllChanges:!0})}function pC(){return cC(e=>{Ss("lcp",{metric:e}),j_=e},{reportAllChanges:!0})}function hC(){return lC(e=>{Ss("ttfb",{metric:e}),W_=e})}function mC(){return sC(e=>{Ss("inp",{metric:e}),z_=e})}function Ba(e,t,n,r,i=!1){G_(e,t);let s;return Qo[e]||(s=n(),Qo[e]=!0),r&&t({metric:r}),V_(e,t,i?s:void 0)}function gC(e){const t={};e==="event"&&(t.durationThreshold=0),vi(e,n=>{Ss(e,{entries:n})},t)}function G_(e,t){Wi[e]=Wi[e]||[],Wi[e].push(t)}function V_(e,t,n){return()=>{n&&n();const r=Wi[e];if(!r)return;const i=r.indexOf(t);i!==-1&&r.splice(i,1)}}function _C(e){return"duration"in e}const yC=e=>{const t=n=>{(n.type==="pagehide"||J.document?.visibilityState==="hidden")&&e(n)};On("visibilitychange",t,{capture:!0,once:!0}),On("pagehide",t,{capture:!0,once:!0})};function Ac(e){return typeof e=="number"&&isFinite(e)}function Bn(e,t,n,{...r}){const i=$(e).start_timestamp;return i&&i>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),gr(e,()=>{const s=St({startTime:t,...r});return s&&s.end(n),s})}function ql(e){const t=M();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=z(),f=l.getUser(),p=f!==void 0?f.email||f.id||f.ip_address:void 0;let h;try{h=l.getScopeData().contexts.profile.profile_id}catch{}const m={release:o,environment:a,user:p||void 0,profile_id:h||void 0,replay_id:d||void 0,transaction:r,"user_agent.original":J.navigator?.userAgent,"client.address":c?"{{auto}}":void 0,...i};return St({name:n,attributes:m,startTime:s,experimental:{standalone:!0}})}function vs(){return J.addEventListener&&J.performance}function Ne(e){return e/1e3}function bC(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 K_(e){try{return PerformanceObserver.supportedEntryTypes.includes(e)}catch{return!1}}function Y_(e,t){let n,r=!1;function i(a){!r&&n&&t(a,n),r=!0}yC(()=>{i("pagehide")});const s=e.on("beforeStartNavigationSpan",(a,c)=>{c?.isRedirect||(i("navigation"),s(),o())}),o=e.on("afterStartPageLoadSpan",a=>{n=a.spanContext().spanId,o()})}function SC(e){let t=0,n;if(!K_("layout-shift"))return;const r=Wl(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(t=i.value,n=s)},!0);Y_(e,(i,s)=>{vC(t,n,s,i),r()})}function vC(e,t,n,r){Tr&&y.log(`Sending CLS span (${e})`);const i=t?Ne((Qe()||0)+t.startTime):Ee(),s=z().getScopeData().transactionName,o=t?ct(t.sources[0]?.node):"Layout shift",a={[Y]:"auto.http.browser.cls",[me]:"ui.webvital.cls",[mi]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t?.sources&&t.sources.forEach((u,d)=>{a[`cls.source.${d+1}`]=ct(u.node)});const c=ql({name:o,transaction:s,attributes:a,startTime:i});c&&(c.addEvent("cls",{[as]:"",[cs]:e}),c.end(i))}function EC(e){let t=0,n;if(!K_("largest-contentful-paint"))return;const r=zl(({metric:i})=>{const s=i.entries[i.entries.length-1];s&&(t=i.value,n=s)},!0);Y_(e,(i,s)=>{TC(t,n,s,i),r()})}function TC(e,t,n,r){Tr&&y.log(`Sending LCP span (${e})`);const i=Ne((Qe()||0)+(t?.startTime||0)),s=z().getScopeData().transactionName,o=t?ct(t.element):"Largest contentful paint",a={[Y]:"auto.http.browser.lcp",[me]:"ui.webvital.lcp",[mi]:0,"sentry.pageload.span_id":n,"sentry.report_event":r};t&&(t.element&&(a["lcp.element"]=ct(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=ql({name:o,transaction:s,attributes:a,startTime:i});c&&(c.addEvent("lcp",{[as]:"millisecond",[cs]:e}),c.end(i))}function mt(e){return e&&((Qe()||performance.timeOrigin)+e)/1e3}function J_(e){const t={};if(e.nextHopProtocol!=null){const{name:n,version:r}=bC(e.nextHopProtocol);t["network.protocol.version"]=r,t["network.protocol.name"]=n}return Qe()||vs()?.timeOrigin?wC({...t,"http.request.redirect_start":mt(e.redirectStart),"http.request.redirect_end":mt(e.redirectEnd),"http.request.worker_start":mt(e.workerStart),"http.request.fetch_start":mt(e.fetchStart),"http.request.domain_lookup_start":mt(e.domainLookupStart),"http.request.domain_lookup_end":mt(e.domainLookupEnd),"http.request.connect_start":mt(e.connectStart),"http.request.secure_connection_start":mt(e.secureConnectionStart),"http.request.connection_end":mt(e.connectEnd),"http.request.request_start":mt(e.requestStart),"http.request.response_start":mt(e.responseStart),"http.request.response_end":mt(e.responseEnd),"http.request.time_to_first_byte":e.responseStart!=null?e.responseStart/1e3:void 0}):t}function wC(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null))}const IC=2147483647;let Sp=0,At={},st,Zo;function kC({recordClsStandaloneSpans:e,recordLcpStandaloneSpans:t,client:n}){const r=vs();if(r&&Qe()){r.mark&&J.performance.mark("sentry-tracing-init");const i=t?EC(n):OC(),s=MC(),o=e?SC(n):xC();return()=>{i?.(),s(),o?.()}}return()=>{}}function AC(){wr("longtask",({entries:e})=>{const t=Oe();if(!t)return;const{op:n,start_timestamp:r}=$(t);for(const i of e){const s=Ne(Qe()+i.startTime),o=Ne(i.duration);n==="navigation"&&r&&s{const n=Oe();if(n)for(const r of t.getEntries()){if(!r.scripts[0])continue;const i=Ne(Qe()+r.startTime),{start_timestamp:s,op:o}=$(n);if(o==="navigation"&&s&&i{const t=Oe();if(t){for(const n of e)if(n.name==="click"){const r=Ne(Qe()+n.startTime),i=Ne(n.duration),s={name:ct(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[Y]:"auto.ui.browser.metrics"}},o=Em(n.target);o&&(s.attributes["ui.component_name"]=o),Bn(t,r,r+i,s)}}})}function xC(){return Wl(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(At.cls={value:e.value,unit:""},Zo=t)},!0)}function OC(){return zl(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(At.lcp={value:e.value,unit:"millisecond"},st=t)},!0)}function MC(){return dC(({metric:e})=>{e.entries[e.entries.length-1]&&(At.ttfb={value:e.value,unit:"millisecond"})})}function NC(e,t){const n=vs(),r=Qe();if(!n?.getEntries||!r)return;const i=Ne(r),s=n.getEntries(),{op:o,start_timestamp:a}=$(e);s.slice(Sp).forEach(c=>{const u=Ne(c.startTime),d=Ne(Math.max(0,c.duration));if(!(o==="navigation"&&a&&i+u{Qm(c,u.value,u.unit)}),e.setAttribute("performance.timeOrigin",i),e.setAttribute("performance.activationStart",Si()),jC(e,t)),st=void 0,Zo=void 0,At={}}function PC(e){if(e?.entryType==="measure")try{return e.detail.devtools.track==="Components ⚛"}catch{return}}function LC(e,t,n,r,i,s){if(PC(t)||["mark","measure"].includes(t.entryType)&&Ot(t.name,s))return;const o=_s(!1),a=Ne(o?o.requestStart:0),c=i+Math.max(n,a),u=i+n,d=u+r,l={[Y]:"auto.resource.browser.metrics"};c!==u&&(l["sentry.browser.measure_happened_before_request"]=!0,l["sentry.browser.measure_start_time"]=c),DC(l,t),c<=d&&Bn(e,c,d,{name:t.name,op:t.entryType,attributes:l})}function DC(e,t){try{const n=t.detail;if(!n)return;if(typeof n=="object"){for(const[r,i]of Object.entries(n))if(i&&$n(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($n(n)){e["sentry.browser.measure.detail"]=n;return}try{e["sentry.browser.measure.detail"]=JSON.stringify(n)}catch{}}catch{}}function FC(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Ws(e,t,r,n)}),Ws(e,t,"secureConnection",n,"TLS/SSL"),Ws(e,t,"fetch",n,"cache"),Ws(e,t,"domainLookup",n,"DNS"),UC(e,t,n)}function Ws(e,t,n,r,i=n){const s=$C(n),o=t[s],a=t[`${n}Start`];!a||!o||Bn(e,r+Ne(a),r+Ne(o),{op:`browser.${i}`,name:t.name,attributes:{[Y]:"auto.ui.browser.metrics",...n==="redirect"&&t.redirectCount!=null?{"http.redirect_count":t.redirectCount}:{}}})}function $C(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function UC(e,t,n){const r=n+Ne(t.requestStart),i=n+Ne(t.responseEnd),s=n+Ne(t.responseStart);t.responseEnd&&(Bn(e,r,i,{op:"browser.request",name:t.name,attributes:{[Y]:"auto.ui.browser.metrics"}}),Bn(e,s,i,{op:"browser.response",name:t.name,attributes:{[Y]:"auto.ui.browser.metrics"}}))}function BC(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={[Y]:"auto.resource.browser.metrics"},u=dr(n);u.protocol&&(c["url.scheme"]=u.protocol.split(":").pop()),u.host&&(c["server.address"]=u.host),c["url.same_origin"]=n.includes(J.location.origin),WC(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,...J_(t)},l=s+r,f=l+i;Bn(e,l,f,{name:n.replace(J.location.origin,""),op:a,attributes:d})}function HC(e){const t=J.navigator;if(!t)return;const n=t.connection;n&&(n.effectiveType&&e.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&e.setAttribute("connectionType",n.type),Ac(n.rtt)&&(At["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Ac(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Ac(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function jC(e,t){st&&t.recordLcpOnPageloadSpan&&(st.element&&e.setAttribute("lcp.element",ct(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)),Zo?.sources&&t.recordClsOnPageloadSpan&&Zo.sources.forEach((n,r)=>e.setAttribute(`cls.source.${r+1}`,ct(n.node)))}function WC(e,t,n){n.forEach(([r,i])=>{const s=e[r];s!=null&&(typeof s=="number"&&s{}}const GC=({entries:e})=>{const t=Oe(),n=t?xe(t):void 0,r=n?$(n).description:z().getScopeData().transactionName;e.forEach(i=>{const s=i;if(!s.identifier)return;const o=s.name,a=s.renderTime,c=s.loadTime,[u,d]=c?[Ne(c),"load-time"]:a?[Ne(a),"render-time"]:[Ee(),"entry-emission"],l=o==="image-paint"?Ne(Math.max(0,(a??0)-(c??0))):0,f={[Y]:"auto.ui.browser.elementtiming",[me]:"ui.elementtiming",[fe]:"component","sentry.span_start_time_source":d,"sentry.transaction_name":r,"element.id":s.id,"element.type":s.element?.tagName?.toLowerCase()||"unknown","element.size":s.naturalWidth&&s.naturalHeight?`${s.naturalWidth}x${s.naturalHeight}`:void 0,"element.render_time":a,"element.load_time":c,"element.url":s.url||void 0,"element.identifier":s.identifier,"element.paint_type":o};Sn({name:`element[${s.identifier}]`,attributes:f,startTime:u,onlyIfParent:!0},p=>{p.end(u+l)})})},VC=1e3;let vp,wu,Iu;function X_(e){Wn("dom",e),zn("dom",KC)}function KC(){if(!J.document)return;const e=yt.bind(null,"dom"),t=Ep(e,!0);J.document.addEventListener("click",t,!1),J.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const i=J[n]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(Je(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=Ep(e);d.handler=l,s.call(this,o,l,c)}d.refCount++}catch{}return s.call(this,o,a,c)}}),Je(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 YC(e){if(e.type!==wu)return!1;try{if(!e.target||e.target._sentryId!==Iu)return!1}catch{}return!0}function JC(e,t){return e!=="keypress"?!1:t?.tagName?!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable):!0}function Ep(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=XC(n);if(JC(n.type,r))return;Pe(n,"_sentryCaptured",!0),r&&!r._sentryId&&Pe(r,"_sentryId",Be());const i=n.type==="keypress"?"input":n.type;YC(n)||(e({event:n,name:i,global:t}),wu=n.type,Iu=r?r._sentryId:void 0),clearTimeout(vp),vp=J.setTimeout(()=>{Iu=void 0,wu=void 0},VC)}}function XC(e){try{return e.target}catch{return null}}let zs;function Ha(e){const t="history";Wn(t,e),zn(t,QC)}function QC(){if(J.addEventListener("popstate",()=>{const t=J.location.href,n=zs;if(zs=t,n===t)return;yt("history",{from:n,to:t})}),!aA())return;function e(t){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const i=zs,s=ZC(String(r));if(zs=s,i===s)return t.apply(this,n);yt("history",{from:i,to:s})}return t.apply(this,n)}}Je(J.history,"pushState",e),Je(J.history,"replaceState",e)}function ZC(e){try{return new URL(e,J.location.origin).toString()}catch{return e}}const To={};function Gl(e){const t=To[e];if(t)return t;let n=J[e];if(mu(n))return To[e]=n.bind(J);const r=J.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){Tr&&y.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,i)}return n&&(To[e]=n.bind(J))}function e1(e){To[e]=void 0}function Es(...e){return Gl("setTimeout")(...e)}const nn="__sentry_xhr_v3__";function Vl(e){Wn("xhr",e),zn("xhr",t1)}function t1(){if(!J.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,r){const i=new Error,s=Ee()*1e3,o=xt(r[0])?r[0].toUpperCase():void 0,a=n1(r[1]);if(!o||!a)return t.apply(n,r);n[nn]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const c=()=>{const u=n[nn];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:Ee()*1e3,startTimestamp:s,xhr:n,virtualError:i};yt("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[f,p]=l,h=d[nn];return h&&xt(f)&&xt(p)&&(h.request_headers[f.toLowerCase()]=p),u.apply(d,l)}}),t.apply(n,r)}}),e.send=new Proxy(e.send,{apply(t,n,r){const i=n[nn];if(!i)return t.apply(n,r);r[0]!==void 0&&(i.body=r[0]);const s={startTimestamp:Ee()*1e3,xhr:n};return yt("xhr",s),t.apply(n,r)}})}function n1(e){if(xt(e))return e;try{return e.toString()}catch{}}const r1=Symbol.for("sentry__originalRequestBody");function Q_(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[Q_(e)];if(!e)return[void 0]}catch(n){return Tr&&t.error(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return Tr&&t.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Kl(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][r1];return n!==void 0?n:void 0}}function Z_(e){let t;try{t=e.getAllResponseHeaders()}catch(n){return Tr&&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 Rc=[],wo=new Map,Pr=new Map,i1=60;function s1(){if(vs()&&Qe()){const t=o1();return()=>{t()}}return()=>{}}const ku={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 o1(){return q_(a1)}const a1=({metric:e})=>{if(e.value==null)return;const t=Ne(e.value);if(t>i1)return;const n=e.entries.find(h=>h.duration===e.value&&ku[h.name]);if(!n)return;const{interactionId:r}=n,i=ku[n.name],s=Ne(Qe()+n.startTime),o=Oe(),a=o?xe(o):void 0,c=r!=null?wo.get(r):void 0,u=c?.span||a,d=u?$(u).description:z().getScopeData().transactionName,l=c?.elementName||ct(n.target),f={[Y]:"auto.http.browser.inp",[me]:`ui.interaction.${i}`,[mi]:n.duration},p=ql({name:l,transaction:d,attributes:f,startTime:s});p&&(p.addEvent("inp",{[as]:"millisecond",[cs]:e.value}),p.end(s+t))};function c1(){const e=Object.keys(ku);Vo()&&e.forEach(i=>{J.addEventListener(i,t,{capture:!0,passive:!0})});function t(i){const s=i.target;if(!s)return;const o=ct(s),a=Math.round(i.timeStamp);if(Pr.set(a,o),Pr.size>50){const c=Pr.keys().next().value;c!==void 0&&Pr.delete(c)}}function n(i){const s=Math.round(i.startTime);let o=Pr.get(s);if(!o)for(let a=-5;a<=5;a++){const c=Pr.get(s+a);if(c){o=c;break}}return o||""}const r=({entries:i})=>{const s=Oe(),o=s&&xe(s);i.forEach(a=>{if(!_C(a))return;const c=a.interactionId;if(c==null||wo.has(c))return;const u=a.target?ct(a.target):n(a);if(Rc.length>10){const d=Rc.shift();wo.delete(d)}Rc.push(c),wo.set(c,{span:o,elementName:u})})};wr("event",r),wr("first-input",r)}const u1=40;function Yl(e,t=Gl("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 e1("fetch"),c}finally{n-=o,r--}}return Sg(e,i,yl(e.bufferSize||u1))}const x=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function l1(){const e=M();if(!e){x&&y.warn("No Sentry client available, profiling is not started");return}if(!e.getIntegrationByName("BrowserProfiling")){x&&y.warn("BrowserProfiling integration is not available");return}e.emit("startUIProfiler")}function d1(){const e=M();if(!e){x&&y.warn("No Sentry client available, profiling is not started");return}if(!e.getIntegrationByName("BrowserProfiling")){x&&y.warn("ProfilingIntegration is not available");return}e.emit("stopUIProfiler")}const f1={startProfiler:l1,stopProfiler:d1},p1=10,h1=20,m1=30,g1=40,_1=50;function ri(e,t,n,r){const i={filename:e,function:t===""?jt:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const y1=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,b1=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,S1=/\((\S*)(?::(\d+))(?::(\d+))\)/,v1=/at (.+?) ?\(data:(.+?),/,E1=e=>{const t=e.match(v1);if(t)return{filename:``,function:t[1]};const n=y1.exec(e);if(n){const[,i,s,o]=n;return ri(i,jt,+s,+o)}const r=b1.exec(e);if(r){if(r[2]&&r[2].indexOf("eval")===0){const a=S1.exec(r[2]);a&&(r[2]=a[1],r[3]=a[2],r[4]=a[3])}const[s,o]=iy(r[1]||jt,r[2]);return ri(o,s,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},ey=[m1,E1],T1=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,w1=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,I1=e=>{const t=T1.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const s=w1.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]||jt;return[i,r]=iy(i,r),ri(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},ty=[_1,I1],k1=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,A1=e=>{const t=k1.exec(e);return t?ri(t[2],t[1]||jt,+t[3],t[4]?+t[4]:void 0):void 0},R1=[g1,A1],C1=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,x1=e=>{const t=C1.exec(e);return t?ri(t[2],t[3]||jt,+t[1]):void 0},O1=[p1,x1],M1=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,N1=e=>{const t=M1.exec(e);return t?ri(t[5],t[3]||t[4]||jt,+t[1],+t[2]):void 0},P1=[h1,N1],ny=[ey,ty],ry=mm(...ny),iy=(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]:jt,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};function L1(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:bn(r)}},s=D1(e);return Lt(i,[s])}function D1(e){return[{type:"user_report"},e]}const qs=1024,F1="Breadcrumbs",$1=((e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:F1,setup(n){t.console&&El(H1(n)),t.dom&&X_(B1(n,t.dom)),t.xhr&&Vl(j1(n)),t.fetch&&Nl(W1(n)),t.history&&Ha(z1(n)),t.sentry&&n.on("beforeSendEvent",U1(n))}}}),sy=$1;function U1(e){return function(n){M()===e&&Pt({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:tr(n)},{event:n})}}function B1(e,t){return function(r){if(M()!==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>qs&&(x&&y.warn(`\`dom.maxStringLength\` cannot exceed ${qs}, but a value of ${a} was configured. Sentry will use ${qs} instead.`),a=qs),typeof o=="string"&&(o=[o]);try{const u=r.event,d=q1(u)?u.target:u;i=ct(d,{keyAttrs:o,maxStringLength:a}),s=Em(d)}catch{i=""}if(i.length===0)return;const c={category:`ui.${r.name}`,message:i};s&&(c.data={"ui.component_name":s}),Pt(c,{event:r.event,name:r.name,global:r.global})}}function H1(e){return function(n){if(M()!==e)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:Wo(n.level),message:No(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${No(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;Pt(r,{input:n.args,level:n.level})}}function j1(e){return function(n){if(M()!==e)return;const{startTimestamp:r,endTimestamp:i}=n,s=n.xhr[nn];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},f={category:"xhr",data:d,type:"http",level:p_(c)};e.emit("beforeOutgoingRequestBreadcrumb",f,l),Pt(f,l)}}function W1(e){return function(n){if(M()!==e)return;const{startTimestamp:r,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const s=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:i},a={category:"fetch",data:s,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,o),Pt(a,o)}else{const s=n.response,o={...n.fetchData,status_code:s?.status};n.fetchData.request_body_size,n.fetchData.response_body_size,s?.status;const a={input:n.args,response:s,startTimestamp:r,endTimestamp:i},c={category:"fetch",data:o,type:"http",level:p_(o.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",c,a),Pt(c,a)}}}function z1(e){return function(n){if(M()!==e)return;let r=n.from,i=n.to;const s=dr(N.location.href);let o=r?dr(r):void 0;const a=dr(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),Pt({category:"navigation",data:{from:r,to:i}})}}function q1(e){return!!e&&!!e.target}const G1=["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"],V1="BrowserApiErrors",K1=((e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:V1,setupOnce(){t.setTimeout&&Je(N,"setTimeout",Tp),t.setInterval&&Je(N,"setInterval",Tp),t.requestAnimationFrame&&Je(N,"requestAnimationFrame",Y1),t.XMLHttpRequest&&"XMLHttpRequest"in N&&Je(XMLHttpRequest.prototype,"send",J1);const n=t.eventTarget;n&&(Array.isArray(n)?n:G1).forEach(i=>X1(i,t))}}}),oy=K1;function Tp(e){return function(...t){const n=t[0];return t[0]=ni(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${dn(e)}`}}),e.apply(this,t)}}function Y1(e){return function(t){return e.apply(this,[ni(t,{mechanism:{data:{handler:dn(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function J1(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&Je(n,i,function(s){const o={mechanism:{data:{handler:dn(s)},handled:!1,type:`auto.browser.browserapierrors.xhr.${i}`}},a=tl(s);return a&&(o.mechanism.data.handler=dn(a)),ni(s,o)})}),e.apply(this,t)}}function X1(e,t){const r=N[e]?.prototype;r?.hasOwnProperty?.("addEventListener")&&(Je(r,"addEventListener",function(i){return function(s,o,a){try{Q1(o)&&(o.handleEvent=ni(o.handleEvent,{mechanism:{data:{handler:dn(o),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&Z1(this,s,o),i.apply(this,[s,ni(o,{mechanism:{data:{handler:dn(o),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),a])}}),Je(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 Q1(e){return typeof e.handleEvent=="function"}function Z1(e,t,n){e&&typeof e=="object"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"&&e.removeEventListener(t,n)}const ay=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof N.document>"u"){x&&y.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}cu({ignoreDuration:!0}),po();const n=Le();let r=n.getUser();n.addScopeListener(i=>{const s=i.getUser();(r?.id!==s?.id||r?.ip_address!==s?.ip_address)&&(po(),r=s)}),t==="route"&&Ha(({from:i,to:s})=>{i!==s&&(cu({ignoreDuration:!0}),po())})}}},ex="CultureContext",tx=(()=>({name:ex,preprocessEvent(e){const t=nx();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})}})),cy=tx;function nx(){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 rx="GlobalHandlers",ix=((e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:rx,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(sx(n),wp("onerror")),t.onunhandledrejection&&(ox(n),wp("onunhandledrejection"))}}}),uy=ix;function sx(e){_m(t=>{const{stackParser:n,attachStacktrace:r}=fy();if(M()!==e||x_())return;const{msg:i,url:s,line:o,column:a,error:c}=t,u=ax($a(n,c||i,void 0,r,!1),s,o,a);u.level="error",gi(u,{originalException:c,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function ox(e){ym(t=>{const{stackParser:n,attachStacktrace:r}=fy();if(M()!==e||x_())return;const i=ly(t),s=$n(i)?dy(i):$a(n,i,void 0,r,!0);s.level="error",gi(s,{originalException:i,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function ly(e){if($n(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 dy(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function ax(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||[],u=r,d=n,l=cx(t)??Ir();return c.length===0&&c.push({colno:u,filename:l,function:jt,in_app:!0,lineno:d}),e}function wp(e){x&&y.log(`Global Handler attached: ${e}`)}function fy(){return M()?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function cx(e){if(!(!xt(e)||e.length===0))return e.startsWith("data:")?`<${xn(e,!1)}>`:e}const py=()=>({name:"HttpContext",preprocessEvent(e){if(!N.navigator&&!N.location&&!N.document)return;const t=Ul(),n={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:n}}}),ux="cause",lx=5,dx="LinkedErrors",fx=((e={})=>{const t=e.limit||lx,n=e.key||ux;return{name:dx,preprocessEvent(r,i,s){const o=s.getOptions();RT(Fa,o.stackParser,n,t,r,i)}}}),hy=fx,px="SpotlightBrowser",hx=((e={})=>{const t=e.sidecarUrl||"http://localhost:8969/stream";return{name:px,setup:()=>{x&&y.log("Using Sidecar URL",t)},processEvent:n=>_x(n)?null:n,afterAllSetup:n=>{mx(n,t)}}});function mx(e,t){const n=Gl("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:Fo(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 gx=hx;function _x(e){return!!(e.type==="transaction"&&e.spans&&e.contexts?.trace&&e.contexts.trace.op==="ui.action.click"&&e.spans.some(({description:t})=>t?.includes("#sentry-spotlight")))}function yx(){return bx()?(x&&jn(()=>{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 bx(){if(typeof N.window>"u")return!1;const e=N;if(e.nw||!(e.chrome||e.browser)?.runtime?.id)return!1;const n=Ir(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(N===N.top&&r.some(s=>n.startsWith(`${s}://`)))}function my(e){return[Pg(),Mg(),Nw(),oy(),sy(),uy(),hy(),Ug(),py(),cy(),ay()]}function Sx(e={}){const t=!e.skipBrowserExtensionCheck&&yx();let n=e.defaultIntegrations==null?my():e.defaultIntegrations;const r={...e,enabled:t?!1:e.enabled,stackParser:gv(e.stackParser||ry),integrations:k0({integrations:e.integrations,defaultIntegrations:n}),transport:e.transport||Yl};return tT(L_,r)}function vx(){}function Ex(e){e()}function Au(e={}){const t=N.document,n=t?.head||t?.body;if(!n){x&&y.error("[showReportDialog] Global document not defined");return}const r=z(),s=M()?.getDsn();if(!s){x&&y.error("[showReportDialog] DSN not configured");return}const o={...e,user:{...r.getUser(),...e.user},eventId:e.eventId||og()},a=N.document.createElement("script");a.async=!0,a.crossOrigin="anonymous",a.src=w0(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 Tx=U,wx="ReportingObserver",Ip=new WeakMap,Ix=((e={})=>{const t=e.types||["crash","deprecation","intervention"];function n(r){if(Ip.has(M()))for(const i of r)ut(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}sg(`${o}: ${a}`)})}return{name:wx,setupOnce(){if(!uA())return;new Tx.ReportingObserver(n,{buffered:!0,types:t}).observe()},setup(r){Ip.set(r,!0)}}}),kx=Ix,Ax="HttpClient",Rx=((e={})=>{const t={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...e};return{name:Ax,setup(n){Fx(n,t),$x(n,t)}}}),Cx=Rx;function xx(e,t,n,r,i){if(_y(e,n.status,n.url)){const s=Ux(t,r);let o,a,c,u;by()&&([o,c]=kp("Cookie",s),[a,u]=kp("Set-Cookie",n));const d=yy({url:s.url,method:s.method,status:n.status,requestHeaders:o,responseHeaders:a,requestCookies:c,responseCookies:u,error:i,type:"fetch"});gi(d)}}function kp(e,t){const n=Nx(t.headers);let r;try{const i=n[e]||n[e.toLowerCase()]||void 0;i&&(r=gy(i))}catch{}return[n,r]}function Ox(e,t,n,r,i){if(_y(e,t.status,t.responseURL)){let s,o,a;if(by()){try{const u=t.getResponseHeader("Set-Cookie")||t.getResponseHeader("set-cookie")||void 0;u&&(o=gy(u))}catch{}try{a=Px(t)}catch{}s=r}const c=yy({url:t.responseURL,method:n,status:t.status,requestHeaders:s,responseHeaders:a,responseCookies:o,error:i,type:"xhr"});gi(c)}}function Mx(e){if(e){const t=e["Content-Length"]||e["content-length"];if(t)return parseInt(t,10)}}function gy(e){return e.split("; ").reduce((t,n)=>{const[r,i]=n.split("=");return r&&i&&(t[r]=i),t},{})}function Nx(e){const t={};return e.forEach((n,r)=>{t[r]=n}),t}function Px(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 Lx(e,t){return e.some(n=>typeof n=="string"?t.includes(n):n.test(t))}function Dx(e,t){return e.some(n=>typeof n=="number"?n===t:t>=n[0]&&t<=n[1])}function Fx(e,t){h_()&&Nl(n=>{if(M()!==e)return;const{response:r,args:i,error:s,virtualError:o}=n,[a,c]=i;r&&xx(t,a,r,c,s||o)},!1)}function $x(e,t){"XMLHttpRequest"in U&&Vl(n=>{if(M()!==e)return;const{error:r,virtualError:i}=n,s=n.xhr,o=s[nn];if(!o)return;const{method:a,request_headers:c}=o;try{Ox(t,s,a,c,r||i)}catch(u){x&&y.warn("Error while extracting response event form XHR response",u)}})}function _y(e,t,n){return Dx(e.failedRequestStatusCodes,t)&&Lx(e.failedRequestTargets,n)&&!Cg(n,M())}function yy(e){const t=M(),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:Mx(e.responseHeaders)}}};return pn(s,{type:`auto.http.client.${e.type}`,handled:!1}),s}function Ux(e,t){return!t&&e instanceof Request||e instanceof Request&&e.bodyUsed?e:new Request(e,t)}function by(){const e=M();return e?!!e.getOptions().sendDefaultPii:!1}const Cc=U,Bx=7,Hx="ContextLines",jx=((e={})=>{const t=e.frameContextLines!=null?e.frameContextLines:Bx;return{name:Hx,processEvent(n){return zx(n,t)}}}),Wx=jx;function zx(e,t){const n=Cc.document,r=Cc.location&&Rg(Cc.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=>qx(u,o,r,t)))}),e}function qx(e,t,n,r){return e.filename!==n||!e.lineno||!t.length||xv(t,e,r),e}const Gx="GraphQLClient",Vx=(e=>({name:Gx,setup(t){Kx(t,e),Yx(t,e)}}));function Kx(e,t){e.on("beforeOutgoingRequestSpan",(n,r)=>{const s=$(n).data||{};if(!(s[me]==="http.client"))return;const c=s[Gv]||s["http.url"],u=s[qv]||s["http.method"];if(!xt(c)||!xt(u))return;const{endpoints:d}=t,l=Ot(c,d),f=vy(r);if(l&&f){const p=Ey(f);if(p){const h=Sy(p);n.updateName(`${u} ${c} (${h})`),ja(p)&&n.setAttribute("graphql.document",p.query),Wa(p)&&(n.setAttribute("graphql.persisted_query.hash.sha256",p.extensions.persistedQuery.sha256Hash),n.setAttribute("graphql.persisted_query.version",p.extensions.persistedQuery.version))}}})}function Yx(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,f=Ot(d,l),p=vy(r);if(f&&o&&p){const h=Ey(p);if(!o.graphql&&h){const m=Sy(h);o["graphql.operation"]=m,ja(h)&&(o["graphql.document"]=h.query),Wa(h)&&(o["graphql.persisted_query.hash.sha256"]=h.extensions.persistedQuery.sha256Hash,o["graphql.persisted_query.version"]=h.extensions.persistedQuery.version)}}}})}function Sy(e){if(Wa(e))return`persisted ${e.operationName}`;if(ja(e)){const{query:t,operationName:n}=e,{operationName:r=n,operationType:i}=Jx(t);return r?`${i} ${r}`:`${i}`}return"unknown"}function vy(e){const t="xhr"in e;let n;if(t){const r=e.xhr[nn];n=r&&ea(r.body)[0]}else{const r=Kl(e.input);n=ea(r)[0]}return n}function Jx(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 Io(e){return typeof e=="object"&&e!==null}function ja(e){return Io(e)&&typeof e.query=="string"}function Wa(e){return Io(e)&&typeof e.operationName=="string"&&Io(e.extensions)&&Io(e.extensions.persistedQuery)&&typeof e.extensions.persistedQuery.sha256Hash=="string"&&typeof e.extensions.persistedQuery.version=="number"}function Ey(e){try{const t=JSON.parse(e);return ja(t)||Wa(t)?t:void 0}catch{return}}const Xx=Vx,Se=U,Jl="sentryReplaySession",Qx="replay_event",Xl="Unable to send Replay",Zx=3e5,eO=9e5,tO=5e3,nO=5500,rO=6e4,iO=5e3,sO=3,Ap=15e4,Gs=5e3,oO=3e3,aO=300,Ql=2e7,cO=4999,uO=5e4,Rp=36e5;var lO=Object.defineProperty,dO=(e,t,n)=>t in e?lO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cp=(e,t,n)=>dO(e,typeof t!="symbol"?t+"":t,n),$e=(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))($e||{});function fO(e){return e.nodeType===e.ELEMENT_NODE}function zi(e){return e?.host?.shadowRoot===e}function qi(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function pO(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 hO(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?pO(Array.from(t,Ty).join("")):null}catch{return null}}function mO(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 bO(){return new wy}function za({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 Qi({isMasked:e,element:t,value:n,maskInputFn:r}){let i=n||"";return e?(r&&(i=r(i,t)),"*".repeat(i.length)):i}function ii(e){return e.toLowerCase()}function Ru(e){return e.toUpperCase()}const xp="__rrweb_original__";function SO(e){const t=e.getContext("2d");if(!t)return!0;const n=50;for(let r=0;rc!==0))return!1}return!0}function Zl(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ii(t):null}function na(e,t,n){return t==="INPUT"&&(n==="radio"||n==="checkbox")?e.getAttribute("value")||"":e.value}function Iy(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 Op={};function ky(e){const t=Op[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 Op[e]=r.bind(window)}function Cu(...e){return ky("setTimeout")(...e)}function Ay(...e){return ky("clearTimeout")(...e)}function Ry(e){try{return e.contentDocument}catch{}}let vO=1;const EO=new RegExp("[^a-z0-9-_:]"),Zi=-2;function ed(){return vO++}function TO(e){if(e instanceof HTMLFormElement)return"form";const t=ii(e.tagName);return EO.test(t)?"div":t}function wO(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let Lr,Mp;const IO=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,kO=/^(?:[a-z+]+:)?\/\//i,AO=/^www\..*/i,RO=/^(data:)([^,]*),(.*)/i;function CO(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 ra(e,t){return(e||"").replace(IO,(n,r,i,s,o,a)=>{const c=i||o||a,u=r||s||"";if(!c)return n;if(kO.test(c)||AO.test(c))return`url(${u}${c}${u})`;if(RO.test(c))return`url(${u}${c}${u})`;if(c[0]==="/")return`url(${u}${wO(t)+c}${u})`;const d=t.split("/"),l=c.split("/");d.pop();for(const f of l)f!=="."&&(f===".."?d.pop():d.push(f));return`url(${u}${d.join("/")}${u})`})}const xO=/^[^ \t\n\r\u000c]+/,OO=/^[, \t\n\r\u000c]+/;function MO(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(OO),!(n>=t.length);){let s=r(xO);if(s.slice(-1)===",")s=Br(e,s.substring(0,s.length-1)),i.push(s);else{let o="";s=Br(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 Np=new WeakMap;function Br(e,t){return!t||t.trim()===""?t:qa(e,t)}function NO(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function qa(e,t){let n=Np.get(e);if(n||(n=e.createElement("a"),Np.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function Cy(e,t,n,r,i,s,o){if(!r)return r;if(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#"))return Br(e,r);if(n==="xlink:href"&&r[0]!=="#")return Br(e,r);if(n==="background"&&(t==="table"||t==="td"||t==="th"))return Br(e,r);if(n==="srcset")return MO(e,r);if(n==="style"){let a=ra(r,qa(e));return o&&o.size>0&&(a=CO(a,o)),a}else if(t==="object"&&n==="data")return Br(e,r);return typeof s=="function"?s(n,r,i):r}function xy(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function PO(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 LO(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function sr(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:sr(e.parentNode,t,n,r+1)}function Hr(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(LO(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}function si(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=sr(o,Hr(r,i)),c<0)return!0;a=sr(o,Hr(t,n),c>=0?c:1/0)}else{if(a=sr(o,Hr(t,n)),a<0)return!1;c=sr(o,Hr(r,i),a>=0?a:1/0)}return a>=0?c>=0?a<=c:!0:c>=0?!1:!!s}catch{}return!!s}function DO(e,t,n){const r=e.contentWindow;if(!r)return;let i=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const a=Cu(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{Ay(a),i=!0,t()});return}const o="about:blank";if(r.location.href!==o||e.src===o||e.src==="")return Cu(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function FO(e,t,n){let r=!1,i;try{i=e.sheet}catch{return}if(i)return;const s=Cu(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{Ay(s),r=!0,t()})}function $O(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskAttributeFn:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:f,inlineStylesheet:p,maskInputOptions:h={},maskTextFn:m,maskInputFn:g,dataURLOptions:_={},inlineImages:S,recordCanvas:T,keepIframeSrcFn:v,newlyAddedElement:w=!1,ignoreCSSAttributes:E}=t,b=UO(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:$e.Document,childNodes:[],compatMode:e.compatMode}:{type:$e.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:$e.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return HO(e,{doc:n,blockClass:i,blockSelector:s,unblockSelector:o,inlineStylesheet:p,maskAttributeFn:c,maskInputOptions:h,maskInputFn:g,dataURLOptions:_,inlineImages:S,recordCanvas:T,keepIframeSrcFn:v,newlyAddedElement:w,rootId:b,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:f,ignoreCSSAttributes:E});case e.TEXT_NODE:return BO(e,{doc:n,maskAllText:a,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:f,maskTextFn:m,maskInputOptions:h,maskInputFn:g,rootId:b});case e.CDATA_SECTION_NODE:return{type:$e.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:$e.Comment,textContent:e.textContent||"",rootId:b};default:return!1}}function UO(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return n===1?void 0:n}function BO(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 f=e.textContent;const p=l==="STYLE"?!0:void 0,h=l==="SCRIPT"?!0:void 0,m=l==="TEXTAREA"?!0:void 0;if(p&&f){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(f=ta(e.parentNode.sheet))}catch(_){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${_}`,e)}f=ra(f,qa(t.doc))}h&&(f="SCRIPT_PLACEHOLDER");const g=si(e,r,s,i,o,n);if(!p&&!h&&!m&&f&&g&&(f=a?a(f,e.parentElement):f.replace(/[\S]/g,"*")),m&&f&&(c.textarea||g)&&(f=u?u(f,e.parentNode):f.replace(/[\S]/g,"*")),l==="OPTION"&&f){const _=za({type:null,tagName:l,maskInputOptions:c});f=Qi({isMasked:si(e,r,s,i,o,_),element:e,value:f,maskInputFn:u})}return{type:$e.Text,textContent:f||"",isStyle:p,rootId:d}}function HO(e,t){const{doc:n,blockClass:r,blockSelector:i,unblockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskAttributeFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:l,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:h=!1,rootId:m,maskTextClass:g,unmaskTextClass:_,maskTextSelector:S,unmaskTextSelector:T,ignoreCSSAttributes:v}=t,w=PO(e,r,i,s),E=TO(e);let b={};const k=e.attributes.length;for(let I=0;IC.href===e.href);let L=null;I&&(L=ta(I)),L&&(b.rel=null,b.href=null,b.crossorigin=null,b._cssText=ra(L,I.href))}if(E==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const I=ta(e.sheet);I&&(b._cssText=ra(I,qa(n)))}if(E==="input"||E==="textarea"||E==="select"||E==="option"){const I=e,L=Zl(I),C=na(I,Ru(E),L),P=I.checked;if(L!=="submit"&&L!=="button"&&C){const D=si(I,g,S,_,T,za({type:L,tagName:Ru(E),maskInputOptions:a}));b.value=Qi({isMasked:D,element:I,value:C,maskInputFn:u})}P&&(b.checked=P)}if(E==="option"&&(e.selected&&!a.select?b.selected=!0:delete b.selected),E==="canvas"&&f){if(e.__context==="2d")SO(e)||(b.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){const I=e.toDataURL(d.type,d.quality),L=n.createElement("canvas");L.width=e.width,L.height=e.height;const C=L.toDataURL(d.type,d.quality);I!==C&&(b.rr_dataURL=I)}}if(E==="img"&&l){Lr||(Lr=n.createElement("canvas"),Mp=Lr.getContext("2d"));const I=e,L=I.currentSrc||I.getAttribute("src")||"",C=I.crossOrigin,P=()=>{I.removeEventListener("load",P);try{Lr.width=I.naturalWidth,Lr.height=I.naturalHeight,Mp.drawImage(I,0,0),b.rr_dataURL=Lr.toDataURL(d.type,d.quality)}catch(D){if(I.crossOrigin!=="anonymous"){I.crossOrigin="anonymous",I.complete&&I.naturalWidth!==0?P():I.addEventListener("load",P);return}else console.warn(`Cannot inline img src=${L}! Error: ${D}`)}I.crossOrigin==="anonymous"&&(C?b.crossOrigin=C:I.removeAttribute("crossorigin"))};I.complete&&I.naturalWidth!==0?P():I.addEventListener("load",P)}if((E==="audio"||E==="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:I,height:L}=e.getBoundingClientRect();b={class:b.class,rr_width:`${I}px`,rr_height:`${L}px`}}E==="iframe"&&!p(b.src)&&(!w&&!Ry(e)&&(b.rr_src=b.src),delete b.src);let F;try{customElements.get(E)&&(F=!0)}catch{}return{type:$e.Element,tagName:E,attributes:b,childNodes:[],isSVG:NO(e)||void 0,needBlock:w,rootId:m,isCustom:F}}function be(e){return e==null?"":e.toLowerCase()}function jO(e,t){if(t.comment&&e.type===$e.Comment)return!0;if(e.type===$e.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"&&Iy(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(be(e.attributes.name).match(/^msapplication-tile(image|color)$/)||be(e.attributes.name)==="application-name"||be(e.attributes.rel)==="icon"||be(e.attributes.rel)==="apple-touch-icon"||be(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&be(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(be(e.attributes.property).match(/^(og|twitter|fb):/)||be(e.attributes.name).match(/^(og|twitter):/)||be(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(be(e.attributes.name)==="robots"||be(e.attributes.name)==="googlebot"||be(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(be(e.attributes.name)==="author"||be(e.attributes.name)==="generator"||be(e.attributes.name)==="framework"||be(e.attributes.name)==="publisher"||be(e.attributes.name)==="progid"||be(e.attributes.property).match(/^article:/)||be(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(be(e.attributes.name)==="google-site-verification"||be(e.attributes.name)==="yandex-verification"||be(e.attributes.name)==="csrf-token"||be(e.attributes.name)==="p:domain_verify"||be(e.attributes.name)==="verify-v1"||be(e.attributes.name)==="verification"||be(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function jr(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:f=!1,inlineStylesheet:p=!0,maskInputOptions:h={},maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:T={},inlineImages:v=!1,recordCanvas:w=!1,onSerialize:E,onIframeLoad:b,iframeLoadTimeout:k=5e3,onBlockedImageLoad:F,onStylesheetLoad:I,stylesheetLoadTimeout:L=5e3,keepIframeSrcFn:C=()=>!1,newlyAddedElement:P=!1,ignoreCSSAttributes:D}=t;let{preserveWhiteSpace:ee=!0}=t;const V=$O(e,{doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,dataURLOptions:T,inlineImages:v,recordCanvas:w,keepIframeSrcFn:C,newlyAddedElement:P,ignoreCSSAttributes:D});if(!V)return console.warn(e,"not serialized"),null;let Q;r.hasNode(e)?Q=r.getId(e):jO(V,S)||!ee&&V.type===$e.Text&&!V.isStyle&&!V.textContent.replace(/^\s+|\s+$/gm,"").length?Q=Zi:Q=ed();const A=Object.assign(V,{id:Q});if(r.add(e,A),Q===Zi)return null;E&&E(e);let B=!f;if(A.type===$e.Element){B=B&&!A.needBlock;const R=e.shadowRoot;R&&qi(R)&&(A.isShadowHost=!0)}if((A.type===$e.Document||A.type===$e.Element)&&B){S.headWhitespace&&A.type===$e.Element&&A.tagName==="head"&&(ee=!1);const R={doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:f,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:T,inlineImages:v,recordCanvas:w,preserveWhiteSpace:ee,onSerialize:E,onIframeLoad:b,iframeLoadTimeout:k,onBlockedImageLoad:F,onStylesheetLoad:I,stylesheetLoadTimeout:L,keepIframeSrcFn:C,ignoreCSSAttributes:D},W=e.childNodes?Array.from(e.childNodes):[];for(const ie of W){const te=jr(ie,R);te&&A.childNodes.push(te)}if(fO(e)&&e.shadowRoot)for(const ie of Array.from(e.shadowRoot.childNodes)){const te=jr(ie,R);te&&(qi(e.shadowRoot)&&(te.isShadow=!0),A.childNodes.push(te))}}if(e.parentNode&&zi(e.parentNode)&&qi(e.parentNode)&&(A.isShadow=!0),A.type===$e.Element&&A.tagName==="iframe"&&!A.needBlock&&DO(e,()=>{const R=Ry(e);if(R&&b){const W=jr(R,{doc:R,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:T,inlineImages:v,recordCanvas:w,preserveWhiteSpace:ee,onSerialize:E,onIframeLoad:b,iframeLoadTimeout:k,onStylesheetLoad:I,stylesheetLoadTimeout:L,keepIframeSrcFn:C,ignoreCSSAttributes:D});W&&b(e,W)}},k),A.type===$e.Element&&A.tagName==="img"&&!e.complete&&A.needBlock){const R=e,W=()=>{if(R.isConnected&&!R.complete&&F)try{const ie=R.getBoundingClientRect();ie.width>0&&ie.height>0&&F(R,A,ie)}catch{}R.removeEventListener("load",W)};R.isConnected&&R.addEventListener("load",W)}return A.type===$e.Element&&A.tagName==="link"&&typeof A.attributes.rel=="string"&&(A.attributes.rel==="stylesheet"||A.attributes.rel==="preload"&&typeof A.attributes.href=="string"&&Iy(A.attributes.href)==="css")&&FO(e,()=>{if(I){const R=jr(e,{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:h,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOMOptions:S,dataURLOptions:T,inlineImages:v,recordCanvas:w,preserveWhiteSpace:ee,onSerialize:E,onIframeLoad:b,iframeLoadTimeout:k,onStylesheetLoad:I,stylesheetLoadTimeout:L,keepIframeSrcFn:C,ignoreCSSAttributes:D});R&&I(e,R)}},L),A.type===$e.Element&&delete A.needBlock,A}function WO(e,t){const{mirror:n=new wy,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:f=!1,recordCanvas:p=!1,maskAllInputs:h=!1,maskAttributeFn:m,maskTextFn:g,maskInputFn:_,slimDOM:S=!1,dataURLOptions:T,preserveWhiteSpace:v,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:b,onBlockedImageLoad:k,onStylesheetLoad:F,stylesheetLoadTimeout:I,keepIframeSrcFn:L=()=>!1,ignoreCSSAttributes:C=new Set([])}=t||{};return jr(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:T,inlineImages:f,recordCanvas:p,preserveWhiteSpace:v,onSerialize:w,onIframeLoad:E,iframeLoadTimeout:b,onBlockedImageLoad:k,onStylesheetLoad:F,stylesheetLoadTimeout:I,keepIframeSrcFn:L,newlyAddedElement:!1,ignoreCSSAttributes:C})}function et(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const Fr=`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 Pp={map:{},getId(){return console.error(Fr),-1},getNode(){return console.error(Fr),null},removeNodeFromMap(){console.error(Fr)},has(){return console.error(Fr),!1},reset(){console.error(Fr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Pp=new Proxy(Pp,{get(e,t,n){return t==="map"&&console.error(Fr),Reflect.get(e,t,n)}}));function es(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&&(JO(r),r=null),i=o,e.apply(c,s)):!r&&n.trailing!==!1&&(r=Ga(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(c,s)},a))}}function Oy(e,t,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(o){Ga(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>Oy(e,t,s||{},!0)}function td(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 ia=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(ia=()=>new Date().getTime());function My(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 Ny(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Py(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ly(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=Ly(e);if(!s)return!1;const o=Hr(t,n);if(!i){const u=r&&s.matches(r);return o(s)&&!u}const a=sr(s,o);let c=-1;return a<0?!1:(r&&(c=sr(s,Hr(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 Fy(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function $y(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ou(e){return!!e?.shadowRoot}class GO{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 Uy(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function VO(e){let t=e,n;for(;n=Uy(t);)t=n;return t}function KO(e){const t=e.ownerDocument;if(!t)return!1;const n=VO(e);return t.contains(n)}function By(e){const t=e.ownerDocument;return t?t.contains(e)||KO(e):!1}const Lp={};function nd(e){const t=Lp[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 Lp[e]=r.bind(window)}function YO(...e){return nd("requestAnimationFrame")(...e)}function Ga(...e){return nd("setTimeout")(...e)}function JO(...e){return nd("clearTimeout")(...e)}var ne=(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))(ne||{}),G=(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))(G||{}),Ze=(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))(Ze||{}),Zt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Zt||{}),$r=(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))($r||{});function rd(e){try{return e.contentDocument}catch{}}function XO(e){try{return e.contentWindow}catch{}}function Dp(e){return"__ln"in e}class QO{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 ZO{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 QO,i=c=>{let u=c,d=Zi;for(;d===Zi;)u=u&&u.nextSibling,d=u&&this.mirror.getId(u);return d},s=c=>{if(!c.parentNode||!By(c))return;const u=zi(c.parentNode)?this.mirror.getId(Uy(c)):this.mirror.getId(c.parentNode),d=i(c);if(u===-1||d===-1)return r.addNode(c);const l=jr(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:f=>{Fy(f,this.mirror)&&!ft(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(f),$y(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),Ou(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(f,p)=>{ft(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(f,p),f.contentWindow&&this.canvasManager.addWindow(f.contentWindow),this.shadowDomManager.observeAttachShadow(f))},onStylesheetLoad:(f,p)=>{this.stylesheetManager.attachLinkElement(f,p)},onBlockedImageLoad:(f,p,{width:h,height:m})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:p.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)$p(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!Up(this.droppedSet,c)&&!$p(this.removes,c,this.mirror)||Up(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 p=d.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const h=p.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(!xc(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:si(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,Ly(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=Zl(n),a=n.tagName;i=na(n,a,o);const c=za({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),u=si(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);i=Qi({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(!rd(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"),!xy(n.tagName,r)&&(s.attributes[r]=Cy(this.doc,ii(n.tagName),ii(r),i,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");t.oldValue&&o.setAttribute("style",t.oldValue);for(const a of Array.from(n.style)){const c=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);c!==o.style.getPropertyValue(a)||u!==o.style.getPropertyPriority(a)?u===""?s.styleDiff[a]=c:s.styleDiff[a]=[c,u]:s._unchangedStyles[a]=[c,u]}for(const a of Array.from(o.style))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=zi(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);ft(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||xc(n,this.mirror)||!zO(n,this.mirror)||(this.addedSet.has(n)?(Mu(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Dy(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Fp(r,i)]?Mu(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:zi(t.target)&&qi(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(xc(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[Fp(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)),Ou(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]})}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 Mu(e,t){e.delete(t),t.childNodes?.forEach(n=>Mu(e,n))}function $p(e,t,n){return e.length===0?!1:eM(e,t,n)}function eM(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 Up(e,t){return e.size===0?!1:Hy(e,t)}function Hy(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:Hy(e,n):!1}let Gi;function tM(e){Gi=e}function nM(){Gi=void 0}const ue=e=>Gi?(...n)=>{try{return e(...n)}catch(r){if(Gi&&Gi(r)===!0)return()=>{};throw r}}:e,Wr=[];function Ts(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 jy(e,t){const n=new ZO;Wr.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(ue(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 rM({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=es(ue(l=>{const f=Date.now()-a;e(o.map(p=>(p.timeOffset-=f,p)),l),o=[],a=null}),s),u=ue(es(ue(l=>{const f=Ts(l),{clientX:p,clientY:h}=xu(l)?l.changedTouches[0]:l;a||(a=ia()),o.push({x:p,y:h,id:r.getId(f),timeOffset:ia()-a}),c(typeof DragEvent<"u"&&l instanceof DragEvent?G.Drag:l instanceof MouseEvent?G.MouseMove:G.TouchMove)}),i,{trailing:!1})),d=[et("mousemove",u,n),et("touchmove",u,n),et("drag",u,n)];return ue(()=>{d.forEach(l=>l())})}function iM({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=>f=>{const p=Ts(f);if(ft(p,r,i,s,!0))return;let h=null,m=l;if("pointerType"in f){switch(f.pointerType){case"mouse":h=Zt.Mouse;break;case"touch":h=Zt.Touch;break;case"pen":h=Zt.Pen;break}h===Zt.Touch?Ze[l]===Ze.MouseDown?m="TouchStart":Ze[l]===Ze.MouseUp&&(m="TouchEnd"):Zt.Pen}else xu(f)&&(h=Zt.Touch);h!==null?(u=h,(m.startsWith("Touch")&&h===Zt.Touch||m.startsWith("Mouse")&&h===Zt.Mouse)&&(h=null)):Ze[l]===Ze.Click&&(h=u,u=null);const g=xu(f)?f.changedTouches[0]:f;if(!g)return;const _=n.getId(p),{clientX:S,clientY:T}=g;ue(e)({type:Ze[m],id:_,x:S,y:T,...h!==null&&{pointerType:h}})};return Object.keys(Ze).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let f=ii(l);const p=d(l);if(window.PointerEvent)switch(Ze[l]){case Ze.MouseDown:case Ze.MouseUp:f=f.replace("mouse","pointer");break;case Ze.TouchStart:case Ze.TouchEnd:return}c.push(et(f,p,t))}),ue(()=>{c.forEach(l=>l())})}function Wy({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){const a=ue(es(ue(c=>{const u=Ts(c);if(!u||ft(u,r,i,s,!0))return;const d=n.getId(u);if(u===t&&t.defaultView){const l=My(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 et("scroll",a,t)}function sM({viewportResizeCb:e},{win:t}){let n=-1,r=-1;const i=ue(es(ue(()=>{const s=Ny(),o=Py();(n!==s||r!==o)&&(e({width:Number(o),height:Number(s)}),n=s,r=o)}),200));return et("resize",i,t)}const oM=["INPUT","TEXTAREA","SELECT"],Bp=new WeakMap;function aM({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:f,unmaskTextClass:p,maskTextSelector:h,unmaskTextSelector:m}){function g(b){let k=Ts(b);const F=b.isTrusted,I=k&&Ru(k.tagName);if(I==="OPTION"&&(k=k.parentElement),!k||!I||oM.indexOf(I)<0||ft(k,r,i,s,!0))return;const L=k;if(L.classList.contains(o)||a&&L.matches(a))return;const C=Zl(k);let P=na(L,I,C),D=!1;const ee=za({maskInputOptions:c,tagName:I,type:C}),V=si(k,f,h,p,m,ee);(C==="radio"||C==="checkbox")&&(D=k.checked),P=Qi({isMasked:V,element:k,value:P,maskInputFn:u}),_(k,l?{text:P,isChecked:D,userTriggered:F}:{text:P,isChecked:D});const Q=k.name;C==="radio"&&Q&&D&&t.querySelectorAll(`input[type="radio"][name="${Q}"]`).forEach(A=>{if(A!==k){const B=Qi({isMasked:V,element:A,value:na(A,I,C),maskInputFn:u});_(A,l?{text:B,isChecked:!D,userTriggered:!1}:{text:B,isChecked:!D})}})}function _(b,k){const F=Bp.get(b);if(!F||F.text!==k.text||F.isChecked!==k.isChecked){Bp.set(b,k);const I=n.getId(b);ue(e)({...k,id:I})}}const T=(d.input==="last"?["change"]:["input","change"]).map(b=>et(b,ue(g),t)),v=t.defaultView;if(!v)return()=>{T.forEach(b=>b())};const w=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value"),E=[[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&&T.push(...E.map(b=>Oy(b[0],b[1],{set(){ue(g)({target:this,isTrusted:!1})}},!1,v))),ue(()=>{T.forEach(b=>b())})}function sa(e){const t=[];function n(r,i){if(Vs("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Vs("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Vs("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Vs("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 An(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function cM({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:ue((d,l,f)=>{const[p,h]=f,{id:m,styleId:g}=An(l,t,n.styleMirror);return(m&&m!==-1||g&&g!==-1)&&e({id:m,styleId:g,adds:[{rule:p,index:h}]}),d.apply(l,f)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:ue((d,l,f)=>{const[p]=f,{id:h,styleId:m}=An(l,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,removes:[{index:p}]}),d.apply(l,f)})});let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:ue((d,l,f)=>{const[p]=f,{id:h,styleId:m}=An(l,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replace:p}),d.apply(l,f)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:ue((d,l,f)=>{const[p]=f,{id:h,styleId:m}=An(l,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,replaceSync:p}),d.apply(l,f)})}));const c={};Ks("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(Ks("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),Ks("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),Ks("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:ue((f,p,h)=>{const[m,g]=h,{id:_,styleId:S}=An(p.parentStyleSheet,t,n.styleMirror);return(_&&_!==-1||S&&S!==-1)&&e({id:_,styleId:S,adds:[{rule:m,index:[...sa(p),g||0]}]}),f.apply(p,h)})}),l.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:ue((f,p,h)=>{const[m]=h,{id:g,styleId:_}=An(p.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||_&&_!==-1)&&e({id:g,styleId:_,removes:[{index:[...sa(p),m]}]}),f.apply(p,h)})})}),ue(()=>{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 zy({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}}),ue(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function uM({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:ue((a,c,u)=>{const[d,l,f]=u;if(n.has(d))return s.apply(c,[d,l,f]);const{id:p,styleId:h}=An(c.parentRule?.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,set:{property:d,value:l,priority:f},index:sa(c.parentRule)}),a.apply(c,u)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:ue((a,c,u)=>{const[d]=u;if(n.has(d))return o.apply(c,[d]);const{id:l,styleId:f}=An(c.parentRule?.parentStyleSheet,t,r.styleMirror);return(l&&l!==-1||f&&f!==-1)&&e({id:l,styleId:f,remove:{property:d},index:sa(c.parentRule)}),a.apply(c,u)})}),ue(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o})}function lM({mediaInteractionCb:e,blockClass:t,blockSelector:n,unblockSelector:r,mirror:i,sampling:s,doc:o}){const a=ue(u=>es(ue(d=>{const l=Ts(d);if(!l||ft(l,t,n,r,!0))return;const{currentTime:f,volume:p,muted:h,playbackRate:m}=l;e({type:u,id:i.getId(l),currentTime:f,volume:p,muted:h,playbackRate:m})}),s.media||500)),c=[et("play",a($r.Play),o),et("pause",a($r.Pause),o),et("seeked",a($r.Seeked),o),et("volumechange",a($r.VolumeChange),o),et("ratechange",a($r.RateChange),o)];return ue(()=>{c.forEach(u=>u())})}function dM({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=td(t.fonts,"add",function(a){return function(c){return Ga(ue(()=>{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),ue(()=>{r.forEach(a=>a())})}function fM(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,selectionCb:o}=e;let a=!0;const c=ue(()=>{const u=t.getSelection();if(!u||a&&u?.isCollapsed)return;a=u.isCollapsed||!1;const d=[],l=u.rangeCount||0;for(let f=0;f{}:td(n.customElements,"define",function(i){return function(s,o,a){try{t({define:{name:s}})}catch{}return i.apply(this,[s,o,a])}})}function hM(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;e.recordDOM&&(r=jy(e,e.doc));const i=rM(e),s=iM(e),o=Wy(e),a=sM(e,{win:n}),c=aM(e),u=lM(e);let d=()=>{},l=()=>{},f=()=>{},p=()=>{};e.recordDOM&&(d=cM(e,{win:n}),l=zy(e,e.doc),f=uM(e,{win:n}),e.collectFonts&&(p=dM(e)));const h=fM(e),m=pM(e),g=[];for(const _ of e.plugins)g.push(_.observer(_.callback,n,_.options));return ue(()=>{Wr.forEach(_=>_.reset()),r?.disconnect(),i(),s(),o(),a(),c(),u(),d(),l(),f(),p(),h(),m(),g.forEach(_=>_())})}function Vs(e){return typeof window[e]<"u"}function Ks(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Nu{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 mM{constructor(){this.crossOriginIframeMirror=new Nu(ed),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class gM{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Nu(ed),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Nu(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),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,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&&t.contentWindow?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(t);const r=rd(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 ne.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:ne.IncrementalSnapshot,data:{source:G.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ne.Meta:case ne.Load:case ne.DomContentLoaded:return!1;case ne.Plugin:return n;case ne.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case ne.IncrementalSnapshot:switch(n.data.source){case G.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 G.Drag:case G.TouchMove:case G.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,t,["id"])}),n;case G.ViewportResize:return!1;case G.MediaInteraction:case G.MouseInteraction:case G.Scroll:case G.CanvasMutation:case G.Input:return this.replaceIds(n.data,t,["id"]),n;case G.StyleSheetRule:case G.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case G.Font:return n;case G.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,t,["start","end"])}),n;case G.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!==$e.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class _M{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class yM{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(!qi(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);const r=jy({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Wy({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),Ga(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(zy({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){const n=rd(t),r=XO(t);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(t,n){const r=this;this.restoreHandlers.push(td(t.prototype,"attachShadow",function(i){return function(s){const o=i.call(this,s);return this.shadowRoot&&By(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 Hp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bM=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Ys=0;Ys({rule:Ty(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 vM{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,YO(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}}let Me,oa;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 kt=bO();function un(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:f=null,unmaskTextSelector:p=null,inlineStylesheet:h=!0,maskAllInputs:m,maskInputOptions:g,slimDOMOptions:_,maskAttributeFn:S,maskInputFn:T,maskTextFn:v,maxCanvasSize:w=null,packFn:E,sampling:b={},dataURLOptions:k={},mousemoveWait:F,recordDOM:I=!0,recordCanvas:L=!1,recordCrossOriginIframes:C=!1,recordAfter:P=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:D=!1,collectFonts:ee=!1,inlineImages:V=!1,plugins:Q,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:B=new Set([]),errorHandler:R,onMutation:W,getCanvasManager:ie}=e;tM(R);const te=C?window.parent===window:!0;let Te=!1;if(!te)try{window.parent.document&&(Te=!1)}catch{Te=!0}if(te&&!t)throw new Error("emit function is required");if(!te&&!Te)return()=>{};F!==void 0&&b.mousemove===void 0&&(b.mousemove=F),kt.reset();const je=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:{},tt=_===!0||_==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:_==="all",headMetaDescKeywords:_==="all"}:_||{};qO();let De,ke=0;const nt=K=>{for(const Ke of Q||[])Ke.eventProcessor&&(K=Ke.eventProcessor(K));return E&&!Te&&(K=E(K)),K};Me=(K,Ke)=>{const Z=K;if(Z.timestamp=ia(),Wr[0]?.isFrozen()&&Z.type!==ne.FullSnapshot&&!(Z.type===ne.IncrementalSnapshot&&Z.data.source===G.Mutation)&&Wr.forEach(Re=>Re.unfreeze()),te)t?.(nt(Z),Ke);else if(Te){const Re={type:"rrweb",event:nt(Z),origin:window.location.origin,isCheckout:Ke};window.parent.postMessage(Re,"*")}if(Z.type===ne.FullSnapshot)De=Z,ke=0;else if(Z.type===ne.IncrementalSnapshot){if(Z.data.source===G.Mutation&&Z.data.isAttachIframe)return;ke++;const Re=r&&ke>=r,se=n&&De&&Z.timestamp-De.timestamp>n;(Re||se)&&We(!0)}};const Ve=K=>{Me({type:ne.IncrementalSnapshot,data:{source:G.Mutation,...K}})},Jt=K=>Me({type:ne.IncrementalSnapshot,data:{source:G.Scroll,...K}}),Tn=K=>Me({type:ne.IncrementalSnapshot,data:{source:G.CanvasMutation,...K}}),Xn=K=>Me({type:ne.IncrementalSnapshot,data:{source:G.AdoptedStyleSheet,...K}}),rt=new SM({mutationCb:Ve,adoptedStyleSheetCb:Xn}),ce=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new mM:new gM({mirror:kt,mutationCb:Ve,stylesheetManager:rt,recordCrossOriginIframes:C,wrappedEmit:Me});for(const K of Q||[])K.getMirror&&K.getMirror({nodeMirror:kt,crossOriginIframeMirror:ce.crossOriginIframeMirror,crossOriginIframeStyleMirror:ce.crossOriginIframeStyleMirror});const _e=new vM,it=TM(ie,{mirror:kt,win:window,mutationCb:K=>Me({type:ne.IncrementalSnapshot,data:{source:G.CanvasMutation,...K}}),recordCanvas:L,blockClass:i,blockSelector:s,unblockSelector:o,maxCanvasSize:w,sampling:b.canvas,dataURLOptions:k,errorHandler:R}),Ae=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new _M:new yM({mutationCb:Ve,scrollCb:Jt,bypassOptions:{onMutation:W,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskInputOptions:je,dataURLOptions:k,maskAttributeFn:S,maskTextFn:v,maskInputFn:T,recordCanvas:L,inlineImages:V,sampling:b,slimDOMOptions:tt,iframeManager:ce,stylesheetManager:rt,canvasManager:it,keepIframeSrcFn:A,processedNodeManager:_e,ignoreCSSAttributes:B},mirror:kt}),We=(K=!1)=>{if(!I)return;Me({type:ne.Meta,data:{href:window.location.href,width:Py(),height:Ny()}},K),rt.reset(),Ae.init(),Wr.forEach(Z=>Z.lock());const Ke=WO(document,{mirror:kt,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:f,unmaskTextSelector:p,inlineStylesheet:h,maskAllInputs:je,maskAttributeFn:S,maskInputFn:T,maskTextFn:v,slimDOM:tt,dataURLOptions:k,recordCanvas:L,inlineImages:V,onSerialize:Z=>{Fy(Z,kt)&&ce.addIframe(Z),$y(Z,kt)&&rt.trackLinkElement(Z),Ou(Z)&&Ae.addShadowRoot(Z.shadowRoot,document)},onIframeLoad:(Z,Re)=>{ce.attachIframe(Z,Re),Z.contentWindow&&it.addWindow(Z.contentWindow),Ae.observeAttachShadow(Z)},onStylesheetLoad:(Z,Re)=>{rt.attachLinkElement(Z,Re)},onBlockedImageLoad:(Z,Re,{width:se,height:Qn})=>{Ve({adds:[],removes:[],texts:[],attributes:[{id:Re.id,attributes:{style:{width:`${se}px`,height:`${Qn}px`}}}]})},keepIframeSrcFn:A,ignoreCSSAttributes:B});if(!Ke)return console.warn("Failed to snapshot the document");Me({type:ne.FullSnapshot,data:{node:Ke,initialOffset:My(window)}}),Wr.forEach(Z=>Z.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&rt.adoptStyleSheets(document.adoptedStyleSheets,kt.getId(document))};oa=We;try{const K=[],Ke=Re=>ue(hM)({onMutation:W,mutationCb:Ve,mousemoveCb:(se,Qn)=>Me({type:ne.IncrementalSnapshot,data:{source:Qn,positions:se}}),mouseInteractionCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.MouseInteraction,...se}}),scrollCb:Jt,viewportResizeCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.ViewportResize,...se}}),inputCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.Input,...se}}),mediaInteractionCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.MediaInteraction,...se}}),styleSheetRuleCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.StyleSheetRule,...se}}),styleDeclarationCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.StyleDeclaration,...se}}),canvasMutationCb:Tn,fontCb:se=>Me({type:ne.IncrementalSnapshot,data:{source:G.Font,...se}}),selectionCb:se=>{Me({type:ne.IncrementalSnapshot,data:{source:G.Selection,...se}})},customElementCb:se=>{Me({type:ne.IncrementalSnapshot,data:{source:G.CustomElement,...se}})},blockClass:i,ignoreClass:a,ignoreSelector:c,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:f,unmaskTextSelector:p,maskInputOptions:je,inlineStylesheet:h,sampling:b,recordDOM:I,recordCanvas:L,inlineImages:V,userTriggeredOnInput:D,collectFonts:ee,doc:Re,maskAttributeFn:S,maskInputFn:T,maskTextFn:v,keepIframeSrcFn:A,blockSelector:s,unblockSelector:o,slimDOMOptions:tt,dataURLOptions:k,mirror:kt,iframeManager:ce,stylesheetManager:rt,shadowDomManager:Ae,processedNodeManager:_e,canvasManager:it,ignoreCSSAttributes:B,plugins:Q?.filter(se=>se.observer)?.map(se=>({observer:se.observer,options:se.options,callback:Qn=>Me({type:ne.Plugin,data:{plugin:se.name,payload:Qn}})}))||[]},{});ce.addLoadListener(Re=>{try{K.push(Ke(Re.contentDocument))}catch(se){console.warn(se)}});const Z=()=>{We(),K.push(Ke(document))};return document.readyState==="interactive"||document.readyState==="complete"?Z():(K.push(et("DOMContentLoaded",()=>{Me({type:ne.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&Z()})),K.push(et("load",()=>{Me({type:ne.Load,data:{}}),P==="load"&&Z()},window))),()=>{K.forEach(Re=>Re()),_e.destroy(),oa=void 0,nM()}}catch(K){console.warn(K)}}function EM(e){if(!oa)throw new Error("please take full snapshot after start recording");oa(e)}un.mirror=kt;un.takeFullSnapshot=EM;function TM(e,t){try{return e?e(t):new jp}catch{return console.warn("Unable to initialize CanvasManager"),new jp}}var Wp;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Wp||(Wp={}));const wM=3,IM=5;function id(e){return e>9999999999?e:e*1e3}function Oc(e){return e>9999999999?e/1e3:e}function ws(e,t){t.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>(e.throttledAddEvent({type:ne.Custom,timestamp:(t.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:Ye(t,10,1e3)}}),t.category==="console")))}const kM="button,a";function qy(e){return e.closest(kM)||e}function Gy(e){const t=Vy(e);return!t||!(t instanceof Element)?t:qy(t)}function Vy(e){return AM(e)?e.target:e}function AM(e){return typeof e=="object"&&!!e&&"target"in e}let Rn;function RM(e){return Rn||(Rn=[],CM()),Rn.push(e),()=>{const t=Rn?Rn.indexOf(e):-1;t>-1&&Rn.splice(t,1)}}function CM(){Je(Se,"open",function(e){return function(...t){if(Rn)try{Rn.forEach(n=>n())}catch{}return e.apply(Se,t)}})}const xM=new Set([G.Mutation,G.StyleSheetRule,G.StyleDeclaration,G.AdoptedStyleSheet,G.CanvasMutation,G.Selection,G.MediaInteraction]);function OM(e,t,n){e.handleClick(t,n)}class MM{constructor(t,n,r=ws){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=RM(()=>{this._lastMutation=zp()});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(PM(n,this._ignoreSelector)||!LM(t))return;const r={timestamp:Oc(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=Oc(t)}registerScroll(t=Date.now()){this._lastScroll=Oc(t)}registerClick(t){const n=qy(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=zp();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:Se.location.href,route:n.getCurrentRoute(),clickCount:o,metric:!0}};this._addBreadcrumbEvent(n,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Es(()=>this._checkClicks(),1e3)}}const NM=["A","BUTTON","INPUT"];function PM(e,t){return!!(!NM.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 LM(e){return!!(e.data&&typeof e.data.nodeId=="number"&&e.timestamp)}function zp(){return Date.now()/1e3}function DM(e,t){try{if(!FM(t))return;const{source:n}=t.data;if(xM.has(n)&&e.registerMutation(t.timestamp),n===G.Scroll&&e.registerScroll(t.timestamp),$M(t)){const{type:r,id:i}=t.data,s=un.mirror.getNode(i);s instanceof HTMLElement&&r===Ze.Click&&e.registerClick(s)}}catch{}}function FM(e){return e.type===wM}function $M(e){return e.data.source===G.MouseInteraction}function Ut(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var sd=(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))(sd||{});const UM=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function BM(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(UM.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),t[r]=e[n]}return t}const HM=e=>t=>{if(!e.isEnabled())return;const n=jM(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&&OM(e.clickDetector,n,Gy(t.event)),ws(e,n)};function Ky(e,t){const n=un.mirror.getId(e),r=n&&un.mirror.getNode(n),i=r&&un.mirror.getMeta(r),s=i&&zM(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===sd.Text&&o.textContent).filter(Boolean).map(o=>o.trim()).join(""),attributes:BM(s.attributes)}}:{}}}function jM(e){const{target:t,message:n}=WM(e);return Ut({category:`ui.${e.name}`,...Ky(t,n)})}function WM(e){const t=e.name==="click";let n,r=null;try{r=t?Gy(e.event):Vy(e.event),n=ct(r,{maxStringLength:200})||""}catch{n=""}return{target:r,message:n}}function zM(e){return e.type===sd.Element}function qM(e,t){if(!e.isEnabled())return;e.updateUserActivity();const n=GM(t);n&&ws(e,n)}function GM(e){const{metaKey:t,shiftKey:n,ctrlKey:r,altKey:i,key:s,target:o}=e;if(!o||VM(o)||!s)return null;const a=t||r||i,c=s.length===1;if(!a&&c)return null;const u=ct(o,{maxStringLength:200})||"",d=Ky(o,u);return Ut({category:"ui.keyDown",message:u,data:{...d.data,metaKey:t,shiftKey:n,ctrlKey:r,altKey:i,key:s}})}function VM(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable}const KM={resource:ZM,paint:XM,navigation:QM};function Mc(e,t){return({metric:n})=>{t.replayPerformanceEntries.push(e(n))}}function YM(e){return e.map(JM).filter(Boolean)}function JM(e){const t=KM[e.entryType];return t?t(e):null}function oi(e){return((Qe()||Se.performance.timeOrigin)+e)/1e3}function XM(e){const{duration:t,entryType:n,name:r,startTime:i}=e,s=oi(i);return{type:n,name:r,start:s,end:s+t,data:void 0}}function QM(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:f,startTime:p,transferSize:h,type:m}=e;return i===0?null:{type:`${t}.${m}`,start:oi(p),end:oi(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:f}}}function ZM(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:oi(s),end:oi(i),name:r,data:{size:u,statusCode:c,decodedBodySize:o,encodedBodySize:a}}}function eN(e){const t=e.entries[e.entries.length-1],n=t?.element?[t.element]:void 0;return od(e,"largest-contentful-paint",n)}function tN(e){return e.sources!==void 0}function nN(e){const t=[],n=[];for(const r of e.entries)if(tN(r)){const i=[];for(const s of r.sources)if(s.node){n.push(s.node);const o=un.mirror.getId(s.node);o&&i.push(o)}t.push({value:r.value,nodeIds:i.length?i:void 0})}return od(e,"cumulative-layout-shift",n,t)}function rN(e){const t=e.entries[e.entries.length-1],n=t?.target?[t.target]:void 0;return od(e,"interaction-to-next-paint",n)}function od(e,t,n,r){const i=e.value,s=e.rating,o=oi(i);return{type:"web-vital",name:t,start:o,end:o,data:{value:i,size:i,rating:s,nodeIds:n?n.map(a=>un.mirror.getId(a)):void 0,attributions:r}}}function iN(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(wr(i,n))}),r.push(zl(Mc(eN,e)),Wl(Mc(nN,e)),q_(Mc(rN,e))),()=>{r.forEach(i=>i())}}const H=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sN='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 oN(){const e=new Blob([sN]);return URL.createObjectURL(e)}const qp=["log","warn","error"],ko="[Replay] ";function Nc(e,t="info"){Pt({category:"console",data:{logger:"replay"},level:t,message:`${ko}${e}`},{level:t})}function aN(){let e=!1,t=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{e=!!r.captureExceptions,t=!!r.traceInternals}};return H?(qp.forEach(r=>{n[r]=(...i)=>{y[r](ko,...i),t&&Nc(i.join(""),Wo(r))}}),n.exception=(r,...i)=>{i.length&&n.error&&n.error(...i),y.error(ko,r),e?Ie(r,{mechanism:{handled:!0,type:"auto.function.replay.debug"}}):t&&Nc(r,"error")},n.infoTick=(...r)=>{y.log(ko,...r),t&&setTimeout(()=>Nc(r[0]),0)}):qp.forEach(r=>{n[r]=()=>{}}),n}const j=aN();class ad extends Error{constructor(){super(`Event buffer exceeded maximum size of ${Ql}.`)}}class Yy{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>Ql)throw new ad;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(){const t=this.events.map(n=>n.timestamp).sort()[0];return t?id(t):null}}class cN{constructor(t){this._worker=t,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((t,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?t():(H&&j.warn("Received worker message with unsuccessful status",r),n(new Error("Received worker message with unsuccessful status")))},{once:!0}),this._worker.addEventListener("error",r=>{H&&j.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(){H&&j.log("Destroying compression worker"),this._worker.terminate()}postMessage(t,n){const r=this._getAndIncrementId();return new Promise((i,s)=>{const o=({data:a})=>{const c=a;if(c.method===t&&c.id===r){if(this._worker.removeEventListener("message",o),!c.success){H&&j.error("Error in compression worker: ",c.response),s(new Error("Error in compression worker"));return}i(c.response)}};this._worker.addEventListener("message",o),this._worker.postMessage({id:r,method:t,arg:n})})}_getAndIncrementId(){return this._id++}}class uN{constructor(t){this._worker=new cN(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=id(t.timestamp);(!this._earliestTimestamp||nQl?Promise.reject(new ad):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,t=>{H&&j.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 lN{constructor(t){this._fallback=new Yy,this._compression=new uN(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){H&&j.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){H&&j.exception(s,"Failed to add events when switching buffers.")}}}function dN({useCompression:e,workerUrl:t}){if(e&&window.Worker){const n=fN(t);if(n)return n}return H&&j.log("Using simple buffer"),new Yy}function fN(e){try{const t=e||pN();if(!t)return;H&&j.log(`Using compression worker${e?` from ${e}`:""}`);const n=new Worker(t);return new lN(n)}catch(t){H&&j.exception(t,"Failed to create compression worker")}}function pN(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?oN():""}function cd(){try{return"sessionStorage"in Se&&!!Se.sessionStorage}catch{return!1}}function hN(e){mN(),e.session=void 0}function mN(){if(cd())try{Se.sessionStorage.removeItem(Jl)}catch{}}function Jy(e){return e===void 0?!1:Math.random()e.getContext().initialTimestamp+e.getOptions().maxReplayDuration?(H&&j.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function SN(e,t){try{if(typeof t=="function"&&yN(e))return t(e)}catch(n){return H&&j.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return e}function ld(e){return!e.type}function Lu(e){return e.type==="transaction"}function vN(e){return e.type==="replay_event"}function Vp(e){return e.type==="feedback"}function EN(e){return(t,n)=>{if(!e.isEnabled()||!ld(t)&&!Lu(t))return;const r=n.statusCode;if(!(!r||r<200||r>=300)){if(Lu(t)){TN(e,t);return}wN(e,t)}}}function TN(e,t){const n=e.getContext();t.contexts?.trace?.trace_id&&n.traceIds.size<100&&n.traceIds.add(t.contexts.trace.trace_id)}function wN(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||!t.tags.replayId)return;const{beforeErrorSampling:r}=e.getOptions();typeof r=="function"&&!r(t)||Es(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(i){e.handleException(i)}})}function IN(e){return t=>{!e.isEnabled()||!ld(t)||kN(e,t)}}function kN(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=Ut({category:"replay.hydrate-error",data:{url:Ir()}});ws(e,r)}}function AN(e){const t=M();t&&t.on("beforeAddBreadcrumb",n=>RN(e,n))}function RN(e,t){if(!e.isEnabled()||!nb(t))return;const n=CN(t);n&&ws(e,n)}function CN(e){return!nb(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:e.category==="console"?xN(e):Ut(e)}function xN(e){const t=e.data?.arguments;if(!Array.isArray(t)||t.length===0)return Ut(e);let n=!1;const r=t.map(i=>{if(!i)return i;if(typeof i=="string")return i.length>Gs?(n=!0,`${i.slice(0,Gs)}…`):i;if(typeof i=="object")try{const s=Ye(i,7);return JSON.stringify(s).length>Gs?(n=!0,`${JSON.stringify(s,null,2).slice(0,Gs)}…`):s}catch{}return i});return Ut({...e,data:{...e.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function nb(e){return!!e.category}function ON(e,t){return e.type||!e.exception?.values?.length?!1:!!t.originalException?.__rrweb__}function rb(){const e=z().getPropagationContext().dsc;e&&delete e.replay_id;const t=Oe();if(t){const n=Nt(t);delete n.replay_id}}function MN(e,t){e.triggerUserActivity(),e.addUpdate(()=>t.timestamp?(e.throttledAddEvent({type:ne.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 NN(e,t){return e.recordingMode!=="buffer"||t.message===Xl||!t.exception||t.type?!1:Jy(e.getOptions().errorSampleRate)}function PN(e){return Object.assign((t,n)=>{if(!e.isEnabled()||e.isPaused())return t;if(vN(t))return delete t.breadcrumbs,t;if(!ld(t)&&!Lu(t)&&!Vp(t))return t;if(!e.checkAndHandleExpiredSession())return rb(),t;if(Vp(t))return e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),MN(e,t),t;if(ON(t,n)&&!e.getOptions()._experiments.captureExceptions)return H&&j.log("Ignoring error from rrweb internals",t),null;const i=NN(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&&Va(o)}return t},{id:"Replay"})}function Ka(e,t){return t.map(({type:n,start:r,end:i,name:s,data:o})=>{const a=e.throttledAddEvent({type:ne.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 LN(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 DN(e){return t=>{if(!e.isEnabled())return;const n=LN(t);n!==null&&(e.getContext().urls.push(n.name),e.triggerUserActivity(),e.addUpdate(()=>(Ka(e,[n]),!1)))}}function FN(e,t){return H&&e.getOptions()._experiments.traceInternals?!1:Cg(t,M())}function ib(e,t){e.isEnabled()&&t!==null&&(FN(e,t.name)||e.addUpdate(()=>(Ka(e,[t]),!0)))}function Ya(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=Q_(e);return t.encode(n).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function sb(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}function aa(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 ob(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 ts(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function Mn(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}=$N(n);return r.body=i,s?.length&&(r._meta={warnings:s}),r}function Du(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 $N(e){if(!e||typeof e!="string")return{body:e};const t=e.length>Ap,n=UN(e);if(t){const r=e.slice(0,Ap);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 UN(e){const t=e[0],n=e[e.length-1];return t==="["&&n==="]"||t==="{"&&n==="}"}function ca(e,t){const n=BN(e);return Ot(n,t)}function BN(e,t=Se.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(Se.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 HN(e,t,n){try{const r=await WN(e,t,n),i=ob("resource.fetch",r);ib(n.replay,i)}catch(r){H&&j.exception(r,"Failed to capture fetch breadcrumb")}}function jN(e,t){const{input:n,response:r}=t,i=n?Kl(n):void 0,s=Ya(i),o=r?sb(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 WN(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=ca(o,n.networkDetailAllowUrls)&&!ca(o,n.networkDetailDenyUrls),f=l?zN(n,t.input,u):ts(u),p=await qN(l,n,t.response,d);return{startTimestamp:i,endTimestamp:s,url:o,method:a,statusCode:c,request:f,response:p}}function zN({networkCaptureBodies:e,networkRequestHeaders:t},n,r){const i=n?KN(n,t):{};if(!e)return Mn(i,r,void 0);const s=Kl(n),[o,a]=ea(s,j),c=Mn(i,r,o);return a?aa(c,a):c}async function qN(e,{networkCaptureBodies:t,networkResponseHeaders:n},r,i){if(!e&&i!==void 0)return ts(i);const s=r?ab(r.headers,n):{};if(!r||!t&&i!==void 0)return Mn(s,i,void 0);const[o,a]=await VN(r),c=GN(o,{networkCaptureBodies:t,responseBodySize:i,captureDetails:e,headers:s});return a?aa(c,a):c}function GN(e,{networkCaptureBodies:t,responseBodySize:n,captureDetails:r,headers:i}){try{const s=e?.length&&n===void 0?Ya(e):n;return r?t?Mn(i,s,e):Mn(i,s,void 0):ts(s)}catch(s){return H&&j.exception(s,"Failed to serialize response body"),Mn(i,n,void 0)}}async function VN(e){const t=YN(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{return[await JN(t)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(H&&j.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(H&&j.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function ab(e,t){const n={};return t.forEach(r=>{e.get(r)&&(n[r]=e.get(r))}),n}function KN(e,t){return e.length===1&&typeof e[0]!="string"?Kp(e[0],t):e.length===2?Kp(e[1],t):{}}function Kp(e,t){if(!e)return{};const n=e.headers;return n?n instanceof Headers?ab(n,t):Array.isArray(n)?{}:Du(n,t):{}}function YN(e){try{return e.clone()}catch(t){H&&j.exception(t,"Failed to clone response body")}}function JN(e){return new Promise((t,n)=>{const r=Es(()=>n(new Error("Timeout while trying to read response body")),500);XN(e).then(i=>t(i),i=>n(i)).finally(()=>clearTimeout(r))})}async function XN(e){return await e.text()}async function QN(e,t,n){try{const r=eP(e,t,n),i=ob("resource.xhr",r);ib(n.replay,i)}catch(r){H&&j.exception(r,"Failed to capture xhr breadcrumb")}}function ZN(e,t){const{xhr:n,input:r}=t;if(!n)return;const i=Ya(r),s=n.getResponseHeader("content-length")?sb(n.getResponseHeader("content-length")):rP(n.response,n.responseType);i!==void 0&&(e.data.request_body_size=i),s!==void 0&&(e.data.response_body_size=s)}function eP(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:f}=e.data;if(!c)return null;if(!a||!ca(c,n.networkDetailAllowUrls)||ca(c,n.networkDetailDenyUrls)){const E=ts(l),b=ts(f);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:d,request:E,response:b}}const p=a[nn],h=p?Du(p.request_headers,n.networkRequestHeaders):{},m=Du(Z_(a),n.networkResponseHeaders),[g,_]=n.networkCaptureBodies?ea(o,j):[void 0],[S,T]=n.networkCaptureBodies?tP(a):[void 0],v=Mn(h,l,g),w=Mn(m,f,S);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:d,request:_?aa(v,_):v,response:T?aa(w,T):w}}function tP(e){const t=[];try{return[e.responseText]}catch(n){t.push(n)}try{return nP(e.response,e.responseType)}catch(n){t.push(n)}return H&&j.warn("Failed to get xhr response body",...t),[void 0]}function nP(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 H&&j.exception(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return H&&j.log("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function rP(e,t){try{const n=t==="json"&&e&&typeof e=="object"?JSON.stringify(e):e;return Ya(n)}catch{return}}function iP(e){const t=M();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)=>sP(a,c,u))}catch{}}function sP(e,t,n){if(t.data)try{oP(t)&&cP(n)&&(ZN(t,n),QN(t,n,e)),aP(t)&&uP(n)&&(jN(t,n),HN(t,n,e))}catch(r){H&&j.exception(r,"Error when enriching network breadcrumb")}}function oP(e){return e.category==="xhr"}function aP(e){return e.category==="fetch"}function cP(e){return e?.xhr}function uP(e){return e?.response}function lP(e){const t=M();X_(HM(e)),Ha(DN(e)),AN(e),iP(e);const n=PN(e);cg(n),t&&(t.on("beforeSendEvent",IN(e)),t.on("afterSendEvent",EN(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 dP(e){try{return Promise.all(Ka(e,[fP(Se.performance.memory)]))}catch{return[]}}function fP(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 pP(e,t,n){return mT(e,t,{...n,setTimeoutImpl:Es})}const Js=U.navigator;function hP(){return/iPhone|iPad|iPod/i.test(Js?.userAgent??"")||/Macintosh/i.test(Js?.userAgent??"")&&Js?.maxTouchPoints&&Js?.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function mP(e){let t=!1;return(n,r)=>{if(!e.checkAndHandleExpiredSession()){H&&j.warn("Received replay event after session expired.");return}const i=r||!t;t=!0,e.clickDetector&&DM(e.clickDetector,n),e.addUpdate(()=>{if(e.recordingMode==="buffer"&&i&&e.setInitialState(),!ud(e,n,i))return!0;if(!i)return!1;const s=e.session;if(_P(e,i),e.recordingMode==="buffer"&&s&&e.eventBuffer&&!s.dirty){const o=e.eventBuffer.getEarliestTimestamp();o&&(H&&j.log(`Updating session start time to earliest event in buffer to ${new Date(o)}`),s.started=o,e.getOptions().stickySession&&Va(s))}return s?.previousSessionId||e.recordingMode==="session"&&e.flush(),!0})}}function gP(e){const t=e.getOptions();return{type:ne.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 _P(e,t){!t||!e.session||e.session.segmentId!==0||ud(e,gP(e),!1)}function yP(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function bP(e,t,n,r){return Lt(Xm(e,va(e),r,n),[[{type:"replay_event"},e],[{type:"replay_recording",length:typeof t=="string"?new TextEncoder().encode(t).length:t.length},t]])}function SP({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 vP({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 ig(e.getOptions(),r,s,t,e,Le());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 EP({recordingData:e,replayId:t,segmentId:n,eventContext:r,timestamp:i,session:s}){const o=SP({recordingData:e,headers:{segment_id:n}}),{urls:a,errorIds:c,traceIds:u,initialTimestamp:d}=r,l=M(),f=z(),p=l?.getTransport(),h=l?.getDsn();if(!l||!p||!h||!s.sampled)return Promise.resolve({});const m={type:Qx,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 vP({scope:f,client:l,replayId:t,event:m});if(!g)return l.recordDroppedEvent("event_processor","replay"),H&&j.log("An event processor returned `null`, will not send event."),Promise.resolve({});delete g.sdkProcessingMetadata;const _=bP(g,o,h,l.getOptions().tunnel);let S;try{S=await p.send(_)}catch(v){const w=new Error(Xl);try{w.cause=v}catch{}throw w}const T=yg({},S);if(_g(T,"replay"))throw new dd(T);if(typeof S.statusCode=="number"&&(S.statusCode<200||S.statusCode>=300))throw new cb(S.statusCode);return S}class cb extends Error{constructor(t){super(`Transport returned status code ${t}`)}}class dd extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}}class Yp extends Error{constructor(){super("Session is too long, not sending replay")}}async function ub(e,t={count:0,interval:iO}){const{recordingData:n,onError:r}=e;if(n.length)try{return await EP(e),!0}catch(i){if(i instanceof cb||i instanceof dd)throw i;if(dl("Replays",{_retryCount:t.count}),r&&r(i),t.count>=sO){const s=new Error(`${Xl} - max retries exceeded`);try{s.cause=i}catch{}throw s}return t.interval*=++t.count,new Promise((s,o)=>{Es(async()=>{try{await ub(e,t),s(!0)}catch(a){o(a)}},t.interval)})}}const lb="__THROTTLED",TP="__SKIPPED";function wP(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?TP:lb}o=!1;const u=r.get(c)||0;return r.set(c,u+1),e(...a)}}class IP{constructor({options:t,recordingOptions:n}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:Zx,sessionIdleExpire:eO},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=pP(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=wP((o,a)=>bN(this,o,a),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:i}=this.getOptions(),s=r?{threshold:Math.min(oO,r),timeout:r,scrollTimeout:aO,ignoreSelector:i?i.join(","):""}:void 0;if(s&&(this.clickDetector=new MM(this,s)),H){const o=t._experiments;j.setConfig({captureExceptions:!!o.captureExceptions,traceInternals:!!o.traceInternals})}this._handleVisibilityChange=()=>{Se.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{const o=Ut({category:"ui.blur"});this._doChangeToBackgroundTasks(o)},this._handleWindowFocus=()=>{const o=Ut({category:"ui.focus"});this._doChangeToForegroundTasks(o)},this._handleKeyboardEvent=o=>{qM(this,o)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){H&&j.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){H&&j.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",H&&j.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){H&&j.log("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){H&&j.log("Buffering is in progress, call `flush()` to save the replay");return}H&&j.infoTick("Starting replay in session mode"),this._updateUserActivity();const t=Pc({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){H&&j.log("Buffering is in progress, call `flush()` to save the replay");return}H&&j.infoTick("Starting replay in buffer mode");const t=Pc({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=un({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:rO}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:mP(this),...hP(),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){this._isEnabled=!1,this.recordingMode="buffer";try{H&&j.log(`Stopping Replay${n?` triggered by ${n}`:""}`),rb(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),this.eventBuffer?.destroy(),this.eventBuffer=null,hN(this)}catch(r){this.handleException(r)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),H&&j.log("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),H&&j.log("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();H&&j.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&&Pu(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const t=`${Se.location.pathname}${Se.location.hash}${Se.location.search}`,n=`${Se.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===lb){const i=Ut({category:"replay.throttled"});this.addUpdate(()=>!ud(this,{type:IM,timestamp:i.timestamp||0,data:{tag:"breadcrumb",payload:i,metric:!0}}))}return r}getCurrentRoute(){const t=this.lastActiveSpan||Oe(),n=t&&xe(t),i=(n&&$(n).data||{})[fe];if(!(!n||!i||!["route","custom"].includes(i)))return $(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=dN({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(t){const n=this._options.errorSampleRate>0,r=Pc({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 Zy(t,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(t),!1):!0}async _refreshSession(t){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(t.id))}_addListeners(){try{Se.document.addEventListener("visibilitychange",this._handleVisibilityChange),Se.addEventListener("blur",this._handleWindowBlur),Se.addEventListener("focus",this._handleWindowFocus),Se.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(lP(this),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=iN(this)}_removeListeners(){try{Se.document.removeEventListener("visibilitychange",this._handleVisibilityChange),Se.removeEventListener("blur",this._handleWindowBlur),Se.removeEventListener("focus",this._handleWindowFocus),Se.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}_doChangeToBackgroundTasks(t){!this.session||Qy(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(t&&this._createCustomBreadcrumb(t),this.conditionalFlush())}_doChangeToForegroundTasks(t){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){H&&j.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:ne.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=YM(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(Ka(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 Yp;const r=this._popEventContext(),i=this.session.segmentId++;this._maybeSaveSession();const s=await this.eventBuffer.finish();await ub({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:"sendReplay"});const r=M();if(r){let i;n instanceof dd?i="ratelimit_backoff":n instanceof Yp?i="invalid":i="send_error",r.recordDroppedEvent(i,"replay")}}}async _flush({force:t=!1}={}){if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){H&&j.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){H&&j.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&&H&&j.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&&Va(this.session)}_onMutationHandler(t){const{ignoreMutations:n}=this._options._experiments;if(n?.length&&t.some(a=>{const c=yP(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=Ut({category:"replay.mutations",data:{count:r,limit:o}});this._createCustomBreadcrumb(a)}return o?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}function Pi(e,t){return[...e,...t].join(",")}function kP({mask:e,unmask:t,block:n,unblock:r,ignore:i}){const s=["base","iframe[srcdoc]:not([src])"],o=Pi(e,[".sentry-mask","[data-sentry-mask]"]),a=Pi(t,[]);return{maskTextSelector:o,unmaskTextSelector:a,blockSelector:Pi(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:Pi(r,[]),ignoreSelector:Pi(i,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function AP({el:e,key:t,maskAttributes:n,maskAllText:r,privacyOptions:i,value:s}){return!r||i.unmaskTextSelector&&e.matches(i.unmaskTextSelector)?s:n.includes(t)||t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"")?s.replace(/[\S]/g,"*"):s}const Jp='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',RP=["content-length","content-type","accept"],CP=Symbol.for("sentry__originalRequestBody");let Xp=!1,Qp=!1;function xP(){if(typeof Request>"u"||Qp)return;const e=Request;try{const t=function(n,r){const i=new e(n,r);return r?.body!=null&&(i[CP]=r.body),i};t.prototype=e.prototype,U.Request=t,Qp=!0}catch{}}const OP=(e=>new MP(e));class MP{constructor({flushMinDelay:t=tO,flushMaxDelay:n=nO,minReplayDuration:r=cO,maxReplayDuration:i=Rp,stickySession:s=!0,useCompression:o=!0,workerUrl:a,_experiments:c={},maskAllText:u=!0,maskAllInputs:d=!0,blockAllMedia:l=!0,mutationBreadcrumbLimit:f=750,mutationLimit:p=1e4,slowClickTimeout:h=7e3,slowClickIgnoreSelectors:m=[],networkDetailAllowUrls:g=[],networkDetailDenyUrls:_=[],networkCaptureBodies:S=!0,networkRequestHeaders:T=[],networkResponseHeaders:v=[],mask:w=[],maskAttributes:E=["title","placeholder","aria-label"],unmask:b=[],block:k=[],unblock:F=[],ignore:I=[],maskFn:L,beforeAddRecordingEvent:C,beforeErrorSampling:P,onError:D,attachRawBodyFromRequest:ee=!1}={}){this.name="Replay";const V=kP({mask:w,unmask:b,block:k,unblock:F,ignore:I});if(this._recordingOptions={maskAllInputs:d,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:L,maskInputFn:L,maskAttributeFn:(Q,A,B)=>AP({maskAttributes:E,maskAllText:u,privacyOptions:V,key:Q,value:A,el:B}),...V,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:Q=>{try{Q.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!c.recordCrossOriginIframes},this._initialOptions={flushMinDelay:t,flushMaxDelay:n,minReplayDuration:Math.min(r,uO),maxReplayDuration:Math.min(i,Rp),stickySession:s,useCompression:o,workerUrl:a,blockAllMedia:l,maskAllInputs:d,maskAllText:u,mutationBreadcrumbLimit:f,mutationLimit:p,slowClickTimeout:h,slowClickIgnoreSelectors:m,networkDetailAllowUrls:g,networkDetailDenyUrls:_,networkCaptureBodies:S,networkRequestHeaders:Zp(T),networkResponseHeaders:Zp(v),beforeAddRecordingEvent:C,beforeErrorSampling:P,onError:D,attachRawBodyFromRequest:ee,_experiments:c},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${Jp}`:Jp,this._recordingOptions.ignoreCSSAttributes=new Set(["background-image"])),this._isInitialized&&Vo())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return Xp}set _isInitialized(t){Xp=t}afterAllSetup(t){!Vo()||this._replay||(this._initialOptions.attachRawBodyFromRequest&&xP(),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"}):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=NP(this._initialOptions,t);this._replay=new IP({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{const n=t.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}function NP(e,t){const n=t.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...e},i=hr(n.replaysSessionSampleRate),s=hr(n.replaysOnErrorSampleRate);return i==null&&s==null&&jn(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),i!=null&&(r.sessionSampleRate=i),s!=null&&(r.errorSampleRate=s),r}function Zp(e){return[...RP,...e.map(t=>t.toLowerCase())]}function PP(){return M()?.getIntegrationByName("Replay")}var LP=Object.defineProperty,DP=(e,t,n)=>t in e?LP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eh=(e,t,n)=>DP(e,typeof t!="symbol"?t+"":t,n);class FP{constructor(){eh(this,"idNodeMap",new Map),eh(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 $P(){return new FP}function UP(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function Fu(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:Fu(e.parentNode,t,n,r+1)}function th(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(UP(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}const Ur=`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 nh={map:{},getId(){return console.error(Ur),-1},getNode(){return console.error(Ur),null},removeNodeFromMap(){console.error(Ur)},has(){return console.error(Ur),!1},reset(){console.error(Ur)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(nh=new Proxy(nh,{get(e,t,n){return t==="map"&&console.error(Ur),Reflect.get(e,t,n)}}));function fd(e,t,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(o){fb(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>fd(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()=>{}}}Date.now().toString();function BP(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function Ja(e,t,n,r,i){if(!e)return!1;const s=BP(e);if(!s)return!1;const o=th(t,n),a=Fu(s,o);let c=-1;return a<0?!1:(r&&(c=Fu(s,th(null,r))),a>-1&&c<0?!0:a(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ai||{});let Ao;function HP(e){Ao=e}const Lc=e=>Ao?(...n)=>{try{return e(...n)}catch(r){if(Ao&&Ao(r)===!0)return()=>{};throw r}}:e;var zr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",jP=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Xs=0;Xs>2],i+=zr[(t[n]&3)<<4|t[n+1]>>4],i+=zr[(t[n+1]&15)<<2|t[n+2]>>6],i+=zr[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 ih=new Map;function zP(e,t){let n=ih.get(e);return n||(n=new Map,ih.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const pb=(e,t,n)=>{if(!e||!(mb(e,t)||typeof e=="object"))return;const r=e.constructor.name,i=zP(n,r);let s=i.indexOf(e);return s===-1&&(s=i.length,i.push(e)),s};function Ro(e,t,n){if(e instanceof Array)return e.map(r=>Ro(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=WP(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Ro(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:[Ro(e.data,t,n),e.width,e.height]};if(mb(e,t)||typeof e=="object"){const r=e.constructor.name,i=pb(e,t,n);return{rr_type:r,index:i}}}}return e}const hb=(e,t,n)=>e.map(r=>Ro(r,t,n)),mb=(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 qP(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=pd(t.CanvasRenderingContext2D.prototype,a,function(u){return function(...d){return Ja(this.canvas,n,r,i,!0)||fb(()=>{const l=hb(d,t,this);e(this.canvas,{type:ai["2D"],property:a,args:l})},0),u.apply(this,d)}});s.push(c)}catch{const c=fd(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:ai["2D"],property:a,args:[u],setter:!0})}});s.push(c)}return()=>{s.forEach(a=>a())}}function GP(e){return e==="experimental-webgl"?"webgl":e}function sh(e,t,n,r,i){const s=[];try{const o=pd(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...u){if(!Ja(this,t,n,r,!0)){const d=GP(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 oh(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=pd(e,d,function(f){return function(...p){const h=f.apply(this,p);if(pb(h,a,this),"tagName"in this.canvas&&!Ja(this.canvas,r,i,s,!0)){const m=hb(p,a,this),g={type:t,property:d,args:m};n(this.canvas,g)}return h}});c.push(l)}catch{const l=fd(e,d,{set(f){n(this.canvas,{type:t,property:d,args:[f],setter:!0})}});c.push(l)}return c}function VP(e,t,n,r,i,s){const o=[];return o.push(...oh(t.WebGLRenderingContext.prototype,ai.WebGL,e,n,r,i,s,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...oh(t.WebGL2RenderingContext.prototype,ai.WebGL2,e,n,r,i,s,t)),()=>{o.forEach(a=>a())}}const KP='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 YP(){const e=new Blob([KP]);return URL.createObjectURL(e)}class JP{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&&HP(o),(s&&typeof r=="number"||n)&&(this.worker=this.initFPSWorker()),this.addWindow(i),!n&&Lc(()=>{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}Lc(()=>{if(o&&n==="all"&&this.initCanvasMutationObserver(t,r,i,s),o&&typeof n=="number"){const c=sh(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}er(r=>this.takeSnapshot(r,!0,t))}initFPSWorker(){const t=new Worker(YP());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:ai["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=er(n)};t=er(n),this.restoreHandlers.push(()=>{t&&cancelAnimationFrame(t)})}initCanvasMutationObserver(t,n,r,i){const s=sh(t,n,r,i,!1),o=qP(this.processMutation.bind(this),t,n,r,i),a=VP(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=>{Ja(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=>{Lc(()=>{throw this.snapshotInProgressMap.delete(m),g})()})}}),!0)}startPendingCanvasMutationFlusher(){er(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=n=>{this.rafStamps.latestId=n,er(t)};er(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),er(()=>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)}$P();var ah;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(ah||(ah={}));const ch={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}}},XP="ReplayCanvas",Qs=1280,QP=((e={})=>{const[t,n]=e.maxCanvasSize||[],r={quality:e.quality||"medium",enableManualSnapshot:e.enableManualSnapshot,maxCanvasSize:[t?Math.min(t,Qs):Qs,n?Math.min(n,Qs):Qs]};let i,s;const o=new Promise(a=>s=a);return{name:XP,getOptions(){const{quality:a,enableManualSnapshot:c,maxCanvasSize:u}=r;return{enableManualSnapshot:c,recordCanvas:!0,getCanvasManager:d=>{const l=new JP({...d,enableManualSnapshot:c,maxCanvasSize:u,errorHandler:f=>{try{typeof f=="object"&&(f.__rrweb__=!0)}catch{}}});return i=l,s(l),l},...ch[a]||ch.medium}},async snapshot(a,c){(i||await o).snapshot(a,c)}}}),ZP=QP;function eL(e){return e.split(",").some(t=>t.trim().startsWith("sentry-"))}function gb(e){try{return new URL(e,N.location.origin).href}catch{return}}function tL(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function _b(e){try{return new Headers(e)}catch{return}}const uh=new WeakMap,Dc=new Map,hd={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function yb(e,t){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:s,enableHTTPTimings:o,tracePropagationTargets:a,onRequestSpanStart:c,onRequestSpanEnd:u}={...hd,...t},d=typeof s=="function"?s:h=>!0,l=h=>nL(h,a),f={},p=e.getOptions().propagateTraceparent;n&&(e.addEventProcessor(h=>(h.type==="transaction"&&h.spans&&h.spans.forEach(m=>{if(m.op==="http.client"){const g=Dc.get(m.span_id);g&&(m.timestamp=g/1e3,Dc.delete(m.span_id))}}),h)),i&&lA(h=>{if(h.response){const m=uh.get(h.response);m&&h.endTimestamp&&Dc.set(m,h.endTimestamp)}}),Nl(h=>{const m=Pw(h,d,l,f,{propagateTraceparent:p,onRequestSpanEnd:u});if(h.response&&h.fetchData.__span&&uh.set(h.response,h.fetchData.__span),m){const g=gb(h.fetchData.url),_=g?dr(g).host:void 0;m.setAttributes({"http.url":g?xn(g):void 0,"server.address":_}),o&&lh(m),c?.(m,{headers:h.headers})}})),r&&Vl(h=>{const m=rL(h,d,l,f,p,u);m&&(o&&lh(m),c?.(m,{headers:_b(h.xhr.__sentry_xhr_v3__?.request_headers)}))})}function lh(e){const{url:t}=$(e).data;if(!t||typeof t!="string")return;const n=wr("resource",({entries:r})=>{r.forEach(i=>{tL(i)&&i.name.endsWith(t)&&(e.setAttributes(J_(i)),setTimeout(n))})})}function nL(e,t){const n=Ir();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?Ot(r.toString(),t)||s&&Ot(r.pathname,t):s}else{const r=!!e.match(/^\/(?!\/)/);return t?Ot(e,t):r}}function rL(e,t,n,r,i,s){const o=e.xhr,a=o?.[nn];if(!o||o.__sentry_own_request__||!a)return;const{url:c,method:u}=a,d=bt()&&t(c);if(e.endTimestamp){const _=o.__sentry_xhr_span_id__;if(!_)return;const S=r[_];S&&(d&&a.status_code!==void 0&&(Yi(S,a.status_code),S.end(),s?.(S,{headers:_b(Z_(o)),error:e.error})),delete r[_]);return}const l=gb(c),f=dr(l||c),p=xn(Rg(c)),h=!!Oe(),m=d&&h?St({name:`${u} ${p}`,attributes:{url:xn(c),type:"xhr","http.method":u,"http.url":l?xn(l):void 0,"server.address":f?.host,[Y]:"auto.http.browser",[me]:"http.client",...f?.search&&{"http.query":f?.search},...f?.hash&&{"http.fragment":f?.hash}}}):new hn;o.__sentry_xhr_span_id__=m.spanContext().spanId,r[o.__sentry_xhr_span_id__]=m,n(c)&&iL(o,bt()&&h?m:void 0,i);const g=M();return g&&g.emit("beforeOutgoingRequestSpan",m,e),m}function iL(e,t,n){const{"sentry-trace":r,baggage:i,traceparent:s}=vl({span:t,propagateTraceparent:n});r&&sL(e,r,i,s)}function sL(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||!eL(s))&&e.setRequestHeader("baggage",n)}}catch{}}function oL(){N.document?N.document.addEventListener("visibilitychange",()=>{const e=Oe();if(!e)return;const t=xe(e);if(N.document.hidden&&t){const n="cancelled",{op:r,status:i}=$(t);x&&y.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),i||t.setStatus({code:ae,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):x&&y.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const aL=3600,bb="sentry_previous_trace",cL="sentry.previous_trace";function uL(e,{linkPreviousTrace:t,consistentTraceSampling:n}){const r=t==="session-storage";let i=r?fL():void 0;e.on("spanStart",o=>{if(xe(o)!==o)return;const a=z().getPropagationContext();i=lL(i,o,a),r&&dL(i)});let s=!0;n&&e.on("beforeSampling",o=>{if(!i)return;const a=z(),c=a.getPropagationContext();if(s&&c.parentSpanId){s=!1;return}a.setPropagationContext({...c,dsc:{...c.dsc,sample_rate:String(i.sampleRate),sampled:String($u(i.spanContext))},sampleRand:i.sampleRand}),o.parentSampled=$u(i.spanContext),o.parentSampleRate=i.sampleRate,o.spanAttributes={...o.spanAttributes,[Rm]:i.sampleRate}})}function lL(e,t,n){const r=$(t);function i(){try{return Number(n.dsc?.sample_rate)??Number(r.data?.[ya])}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<=aL&&(x&&y.log(`Adding previous_trace \`${JSON.stringify(o)}\` link to span \`${JSON.stringify({op:r.op,...t.spanContext()})}\``),t.addLink({context:o,attributes:{[Vv]:"previous_trace"}}),t.setAttribute(cL,`${o.traceId}-${o.spanId}-${$u(o)?1:0}`)),s)}function dL(e){try{N.sessionStorage.setItem(bb,JSON.stringify(e))}catch(t){x&&y.warn("Could not store previous trace in sessionStorage",t)}}function fL(){try{const e=N.sessionStorage?.getItem(bb);return JSON.parse(e)}catch{return}}function $u(e){return e.traceFlags===1}const pL="BrowserTracing",hL={...fo,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,enableElementTiming:!0,ignoreResourceSpans:[],ignorePerformanceApiSpans:[],detectRedirects:!0,linkPreviousTrace:"in-memory",consistentTraceSampling:!1,enableReportPageLoaded:!1,_experiments:{},...hd},Ei=((e={})=>{const t={name:void 0,source:void 0},n=N.document,{enableInp:r,enableElementTiming:i,enableLongTask:s,enableLongAnimationFrame:o,_experiments:{enableInteractions:a,enableStandaloneClsSpans:c,enableStandaloneLcpSpans:u},beforeStartSpan:d,idleTimeout:l,finalTimeout:f,childSpanTimeout:p,markBackgroundSpan:h,traceFetch:m,traceXHR:g,trackFetchStreamPerformance:_,shouldCreateSpanForRequest:S,enableHTTPTimings:T,ignoreResourceSpans:v,ignorePerformanceApiSpans:w,instrumentPageLoad:E,instrumentNavigation:b,detectRedirects:k,linkPreviousTrace:F,consistentTraceSampling:I,enableReportPageLoaded:L,onRequestSpanStart:C,onRequestSpanEnd:P}={...hL,...e};let D,ee,V;function Q(A,B,R=!0){const W=B.op==="pageload",ie=B.name,te=d?d(B):B,Te=te.attributes||{};if(ie!==te.name&&(Te[fe]="custom",te.attributes=Te),!R){const De=kr();St({...te,startTime:De}).end(De);return}t.name=te.name,t.source=Te[fe];const je=ng(te,{idleTimeout:l,finalTimeout:f,childSpanTimeout:p,disableAutoFinish:W,beforeSpanEnd:De=>{D?.(),NC(De,{recordClsOnPageloadSpan:!c,recordLcpOnPageloadSpan:!u,ignoreResourceSpans:v,ignorePerformanceApiSpans:w}),ph(A,void 0);const ke=z(),nt=ke.getPropagationContext();ke.setPropagationContext({...nt,traceId:je.spanContext().traceId,sampled:Vn(je),dsc:Nt(De)}),W&&(V=void 0)},trimIdleSpanEndTimestamp:!L});W&&L&&(V=je),ph(A,je);function tt(){n&&["interactive","complete"].includes(n.readyState)&&A.emit("idleSpanEnableAutoFinish",je)}W&&!L&&n&&(n.addEventListener("readystatechange",()=>{tt()}),tt())}return{name:pL,setup(A){if(Vm(),D=kC({recordClsStandaloneSpans:c||!1,recordLcpStandaloneSpans:u||!1,client:A}),r&&s1(),i&&qC(),o&&U.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?RC():s&&AC(),a&&CC(),k&&n){const R=()=>{ee=Ee()};addEventListener("click",R,{capture:!0}),addEventListener("keydown",R,{capture:!0,passive:!0})}function B(){const R=ns(A);R&&!$(R).timestamp&&(x&&y.log(`[Tracing] Finishing current active span with op: ${$(R).op}`),R.setAttribute(Ki,"cancelled"),R.end())}A.on("startNavigationSpan",(R,W)=>{if(M()!==A)return;if(W?.isRedirect){x&&y.warn("[Tracing] Detected redirect, navigation span will not be the root span, but a child span."),Q(A,{op:"navigation.redirect",...R},!1);return}ee=void 0,B(),Le().setPropagationContext({traceId:Wt(),sampleRand:Math.random(),propagationSpanId:bt()?void 0:an()});const ie=z();ie.setPropagationContext({traceId:Wt(),sampleRand:Math.random(),propagationSpanId:bt()?void 0:an()}),ie.setSDKProcessingMetadata({normalizedRequest:void 0}),Q(A,{op:"navigation",...R,parentSpan:null,forceTransaction:!0})}),A.on("startPageLoadSpan",(R,W={})=>{if(M()!==A)return;B();const ie=W.sentryTrace||dh("sentry-trace")||fh("sentry-trace"),te=W.baggage||dh("baggage")||fh("baggage"),Te=$m(ie,te),je=z();je.setPropagationContext(Te),bt()||(je.getPropagationContext().propagationSpanId=an()),je.setSDKProcessingMetadata({normalizedRequest:Ul()}),Q(A,{op:"pageload",...R})}),A.on("endPageloadSpan",()=>{L&&V&&(V.setAttribute(Ki,"reportPageLoaded"),V.end())})},afterAllSetup(A){let B=Ir();if(F!=="off"&&uL(A,{linkPreviousTrace:F,consistentTraceSampling:I}),N.location){if(E){const R=Qe();Ti(A,{name:N.location.pathname,startTime:R?R/1e3:void 0,attributes:{[fe]:"url",[Y]:"auto.pageload.browser"}})}b&&Ha(({to:R,from:W})=>{if(W===void 0&&B?.indexOf(R)!==-1){B=void 0;return}B=void 0;const ie=Sl(R),te=ns(A),Te=te&&k&&gL(te,ee);wi(A,{name:ie?.pathname||N.location.pathname,attributes:{[fe]:"url",[Y]:"auto.navigation.browser"}},{url:R,isRedirect:Te})})}h&&oL(),a&&mL(A,l,f,p,t),r&&c1(),yb(A,{traceFetch:m,traceXHR:g,trackFetchStreamPerformance:_,tracePropagationTargets:A.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:S,enableHTTPTimings:T,onRequestSpanStart:C,onRequestSpanEnd:P})}}});function Ti(e,t,n){e.emit("startPageLoadSpan",t,n),z().setTransactionName(t.name);const r=ns(e);return r&&e.emit("afterStartPageLoadSpan",r),r}function wi(e,t,n){const{url:r,isRedirect:i}=n||{};e.emit("beforeStartNavigationSpan",t,{isRedirect:i}),e.emit("startNavigationSpan",t,{isRedirect:i});const s=z();return s.setTransactionName(t.name),r&&!i&&s.setSDKProcessingMetadata({normalizedRequest:{...Ul(),url:r}}),ns(e)}function dh(e){return N.document?.querySelector(`meta[name=${e}]`)?.getAttribute("content")||void 0}function fh(e){return N.performance?.getEntriesByType?.("navigation")[0]?.serverTiming?.find(r=>r.name===e)?.description}function mL(e,t,n,r,i){const s=N.document;let o;const a=()=>{const c="ui.action.click",u=ns(e);if(u){const d=$(u).op;if(["navigation","pageload"].includes(d)){x&&y.warn(`[Tracing] Did not create ${c} span because a pageload or navigation span is in progress.`);return}}if(o&&(o.setAttribute(Ki,"interactionInterrupted"),o.end(),o=void 0),!i.name){x&&y.warn(`[Tracing] Did not create ${c} transaction because _latestRouteName is missing.`);return}o=ng({name:i.name,op:c,attributes:{[fe]:i.source||"url"}},{idleTimeout:t,finalTimeout:n,childSpanTimeout:r})};s&&addEventListener("click",a,{capture:!0})}const Sb="_sentry_idleSpan";function ns(e){return e[Sb]}function ph(e,t){Pe(e,Sb,t)}const hh=1.5;function gL(e,t){const n=$(e),r=kr(),i=n.start_timestamp;return!(r-i>hh||t&&r-t<=hh)}function _L(e=M()){e?.emit("endPageloadSpan")}function yL(e){const t=Oe();if(t===e)return;const n=z();e.end=new Proxy(e.end,{apply(r,i,s){return zt(n,t),Reflect.apply(r,i,s)}}),zt(n,e)}function ci(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function bL(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=ci(n);return i=>r.then(s=>i(s.transaction(t,"readwrite").objectStore(t)))}function md(e){return ci(e.getAllKeys())}function SL(e,t,n){return e(r=>md(r).then(i=>{if(!(i.length>=n))return r.put(t,Math.max(...i,0)+1),ci(r.transaction)}))}function vL(e,t,n){return e(r=>md(r).then(i=>{if(!(i.length>=n))return r.put(t,Math.min(...i,0)-1),ci(r.transaction)}))}function EL(e){return e(t=>md(t).then(n=>{const r=n[0];if(r!=null)return ci(t.get(r)).then(i=>(t.delete(r),ci(t.transaction).then(()=>i)))}))}function TL(e){let t;function n(){return t==null&&(t=bL(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{push:async r=>{try{const i=await Fo(r);await SL(n(),i,e.maxQueueSize||30)}catch{}},unshift:async r=>{try{const i=await Fo(r);await vL(n(),i,e.maxQueueSize||30)}catch{}},shift:async()=>{try{const r=await EL(n());if(r)return RE(r)}catch{}}}}function wL(e){return t=>{const n=e({...t,createStore:TL});return N.addEventListener("online",async r=>{await n.flush()}),n}}function IL(e=Yl){return wL(rT(e))}const mh=1e6,kL="window"in U&&U.window===U&&typeof importScripts>"u",Nn=String(0),ua=kL?"main":"worker",la=N.navigator;let vb="",Eb="",Tb="",Uu=la?.userAgent||"",wb="";const AL=la?.language||la?.languages?.[0]||"";function RL(e){return typeof e=="object"&&e!==null&&"getHighEntropyValues"in e}const gh=la?.userAgentData;RL(gh)&&gh.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(e=>{if(vb=e.platform||"",Tb=e.architecture||"",wb=e.model||"",Eb=e.platformVersion||"",e.fullVersionList?.length){const t=e.fullVersionList[e.fullVersionList.length-1];Uu=`${t.brand} ${t.version}`}}).catch(e=>{});function CL(e){return!("thread_metadata"in e)}function xL(e){return CL(e)?DL(e):e}function OL(e){const t=e.contexts?.trace?.trace_id;return typeof t=="string"&&t.length!==32&&x&&y.log(`[Profiling] Invalid traceId: ${t} on profiled event`),typeof t!="string"?"":t}function ML(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=OL(r),s=xL(n),o=t||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:Ee()*1e3),a=typeof r.timestamp=="number"?r.timestamp*1e3:Ee()*1e3;return{event_id:e,timestamp:new Date(o).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||Sa,runtime:{name:"javascript",version:N.navigator.userAgent},os:{name:vb,version:Eb,build_number:Uu},device:{locale:AL,model:wb,manufacturer:Uu,architecture:Tb,is_emulator:!1},debug_meta:{images:kb(n.resources)},profile:s,transactions:[{name:r.transaction||"",id:r.event_id||Be(),trace_id:i,active_thread_id:Nn,relative_start_ns:"0",relative_end_ns:((a-o)*1e6).toFixed(0)}]}}function NL(e,t,n){if(e==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${e} instead.`);const r=LL(e),i=t.getOptions(),s=t.getSdkMetadata?.()?.sdk;return{chunk_id:Be(),client_sdk:{name:s?.name??"sentry.javascript.browser",version:s?.version??"0.0.0"},profiler_id:n||Be(),platform:"javascript",version:"2",release:i.release??"",environment:i.environment??"production",debug_meta:{images:kb(e.resources)},profile:r}}function PL(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 LL(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)*mh).toFixed(0),stack_id:t,thread_id:Nn};return}let l=e.stacks[u.stackId];const f=[];for(;l;){f.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 p={elapsed_since_start_ns:((u.timestamp+c-s)*mh).toFixed(0),stack_id:n,thread_id:Nn};r.stacks[n]=f,r.samples[d]=p,n++}),r}function FL(e,t){if(!t.length)return e;for(const n of t)e[1].push([{type:"profile"},n]);return e}function $L(e){const t=[];return mr(e,(n,r)=>{if(r==="transaction")for(let i=1;i1?(x&&y.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${e}.`),!1):!0}function UL(e){return e.samples.length<2?(x&&y.log("[Profiling] Discarding profile because it contains less than 2 samples"),!1):e.frames.length?!0:(x&&y.log("[Profiling] Discarding profile because it contains no frames"),!1)}let gd=!1;const Rb=3e4;function BL(e){return typeof e=="function"}function Cb(){const e=N.Profiler;if(!BL(e)){x&&y.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}const t=10,n=Math.floor(Rb/t);try{return new e({sampleInterval:t,maxBufferSize:n})}catch{x&&(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.")),gd=!0}}function _h(e){if(gd)return x&&y.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!e.isRecording())return x&&y.log("[Profiling] Discarding profile because root span was not sampled."),!1;const n=M()?.getOptions();if(!n)return x&&y.log("[Profiling] Profiling disabled, no options found."),!1;const r=n.profilesSampleRate;return Ab(r)?r?(r===!0?!0:Math.random()30){const n=or.keys().next().value;n!==void 0&&or.delete(n)}}function GL(e){return!e?.contexts?.profile||!e.contexts||(e.contexts.trace?.trace_id&&(e.contexts.trace={...e.contexts.trace,data:{...e.contexts.trace.data??{},"thread.id":Nn,"thread.name":ua}}),e.spans?.forEach(t=>{t.data={...t.data||{},"thread.id":Nn,"thread.name":ua}})),e}function yh(e){let t;Ib(e)&&(t=Ee()*1e3);const n=Cb();if(!n)return;x&&y.log(`[Profiling] started profiling span: ${$(e).description}`);const r=Be();let i=null;z().setContext("profile",{profile_id:r,start_timestamp:t});async function s(){if(e&&n){if(i){x&&y.log("[Profiling] profile for:",$(e).description,"already exists, returning early");return}return n.stop().then(u=>{if(o&&(N.clearTimeout(o),o=void 0),x&&y.log(`[Profiling] stopped profiling of span: ${$(e).description}`),!u){x&&y.log(`[Profiling] profiler returned null profile for: ${$(e).description}`,"this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started");return}i=u,qL(r,u)}).catch(u=>{x&&y.log("[Profiling] error while stopping profiler:",u)})}}let o=N.setTimeout(()=>{x&&y.log("[Profiling] max profile duration elapsed, stopping profiling for:",$(e).description),s()},Rb);const a=e.end.bind(e);function c(){return e?(s().then(()=>{a()},()=>{a()}),e):a()}e.end=c}const VL=6e4,KL=3e5;class YL{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=HL(t.getOptions());x&&y.log(`[Profiling] Initializing profiler (lifecycle='${n}').`),r||x&&y.log("[Profiling] Session not sampled. Skipping lifecycle profiler initialization."),this._profilerId=Be(),this._client=t,this._sessionSampled=r,this._lifecycleMode=n,n==="trace"&&this._setupTraceLifecycleListeners(t)}start(){if(this._lifecycleMode==="trace"){x&&y.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.start()` are ignored in trace mode.');return}if(this._isRunning){x&&y.warn("[Profiling] Profile session is already running, `uiProfiler.start()` is a no-op.");return}if(!this._sessionSampled){x&&y.warn("[Profiling] Session is not sampled, `uiProfiler.start()` is a no-op.");return}this._beginProfiling()}stop(){if(this._lifecycleMode==="trace"){x&&y.warn('[Profiling] `profileLifecycle` is set to "trace". Calls to `uiProfiler.stop()` are ignored in trace mode.');return}if(!this._isRunning){x&&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&&(x&&y.log("[Profiling] Detected already active root span during setup. Active root spans now:",r),this._beginProfiling())}_beginProfiling(){if(!this._isRunning){if(this._isRunning=!0,x&&y.log("[Profiling] Started profiling with profiler ID:",this._profilerId),cr().setContext("profile",{profiler_id:this._profilerId}),this._startProfilerInstance(),!this._profiler){x&&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=>{x&&y.error("[Profiling] Failed to collect current profile chunk on `stop()`:",t)}),this._lifecycleMode==="manual"&&cr().setContext("profile",{}))}_setupTraceLifecycleListeners(t){t.on("spanStart",n=>{if(!this._sessionSampled){x&&y.log("[Profiling] Span not profiled because of negative sampling decision for user session.");return}if(n!==xe(n))return;if(!n.isRecording()){x&&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&&(x&&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;x&&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=>{x&&y.error("[Profiling] Failed to collect current profile chunk on last `spanEnd`:",s)}),this._endProfiling())})}_resetProfilerInfo(){this._isRunning=!1,cr().setContext("profile",{})}_clearAllRootSpanTimeouts(){this._rootSpanTimeouts.forEach(t=>clearTimeout(t)),this._rootSpanTimeouts.clear()}_registerTraceRootSpan(t){this._activeRootSpanIds.add(t);const n=setTimeout(()=>this._onRootSpanTimeout(t),KL);this._rootSpanTimeouts.set(t,n)}_startProfilerInstance(){if(this._profiler?.stopped===!1)return;const t=Cb();if(!t){x&&y.log("[Profiling] Failed to start JS Profiler.");return}this._profiler=t}_startPeriodicChunking(){this._isRunning&&(this._chunkTimer=setTimeout(()=>{if(this._collectCurrentChunk().catch(t=>{x&&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()}},VL))}_onRootSpanTimeout(t){this._rootSpanTimeouts.has(t)&&(this._rootSpanTimeouts.delete(t),this._activeRootSpanIds.has(t)&&(x&&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=NL(n,this._client,this._profilerId),i=PL(r);if("reason"in i){x&&y.log("[Profiling] Discarding invalid profile chunk (this is probably a bug in the SDK):",i.reason);return}this._sendProfileChunk(r),x&&y.log("[Profiling] Collected browser profile chunk.")}catch(n){x&&y.log("[Profiling] Error while stopping JS Profiler for chunk:",n)}}_sendProfileChunk(t){const n=this._client,r=va(n.getSdkMetadata?.()),i=n.getDsn(),s=n.getOptions().tunnel,o=Lt({event_id:Be(),sent_at:new Date().toISOString(),...r&&{sdk:r},...!!s&&i&&{dsn:bn(i)}},[[{type:"profile_chunk",platform:"javascript"},t]]);n.sendEnvelope(o).then(null,a=>{x&&y.error("Error while sending profile chunk envelope:",a)})}}const JL="BrowserProfiling",XL=(()=>({name:JL,setup(e){const t=e.getOptions(),n=new YL;if(!Zs(t)&&!t.profileLifecycle&&(t.profileLifecycle="manual"),Zs(t)&&!t.profilesSampleRate){x&&y.log("[Profiling] Profiling disabled, no profiling options found.");return}const r=Oe(),i=r&&xe(r);if(Zs(t)&&t.profileSessionSampleRate!==void 0&&x&&y.warn("[Profiling] Both legacy profiling (`profilesSampleRate`) and UI profiling settings are defined. `profileSessionSampleRate` has no effect when legacy profiling is enabled."),Zs(t))i&&Ib(i)&&_h(i)&&yh(i),e.on("spanStart",s=>{s===xe(s)&&_h(s)&&yh(s)}),e.on("beforeEnvelope",s=>{if(!WL())return;const o=$L(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"){x&&y.log("[Profiling] cannot find profile for a span without a profile context");continue}if(!d){x&&y.log("[Profiling] cannot find profile for a span without a profile context");continue}u?.profile&&delete u.profile;const f=zL(d);if(!f){x&&y.log(`[Profiling] Could not retrieve profile for span: ${d}`);continue}const p=jL(d,l,f,c);p&&a.push(p)}FL(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(!bt(t)){x&&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=Oe(),a=o&&xe(o);a&&n.notifyRootSpanActive(a)},0)}}},processEvent(e){return GL(e)}})),QL=XL,ZL=()=>({name:"LaunchDarkly",processEvent(e,t,n){return _i(e)}});function eD(){return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:(e,t,n)=>{_r(e,t.value),yr(e,t.value)}}}const tD=()=>({name:"OpenFeature",processEvent(e,t,n){return _i(e)}});class nD{after(t,n){_r(n.flagKey,n.value),yr(n.flagKey,n.value)}error(t,n,r){_r(t.flagKey,t.defaultValue),yr(t.flagKey,t.defaultValue)}}const rD=({featureFlagClientClass:e})=>({name:"Unleash",setupOnce(){const t=e.prototype;Je(t,"isEnabled",iD)},processEvent(t,n,r){return _i(t)}});function iD(e){return function(...t){const n=t[0],r=e.apply(this,t);return typeof n=="string"&&typeof r=="boolean"?(_r(n,r),yr(n,r)):x&&y.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${n} (${typeof n}), result: ${r} (${typeof r})`),r}}const sD=(({growthbookClass:e})=>xw({growthbookClass:e})),oD=({featureFlagClient:e})=>({name:"Statsig",setup(t){e.on("gate_evaluation",n=>{_r(n.gate.name,n.gate.value),yr(n.gate.name,n.gate.value)})},processEvent(t,n,r){return _i(t)}});async function aD(){const e=M();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 Zm(()=>fetch(r,{body:"{}",method:"POST",mode:"cors",credentials:"omit"}))}catch{return"sentry-unreachable"}}const cD="WebWorker",uD=({worker:e})=>({name:cD,setupOnce:()=>{(Array.isArray(e)?e:[e]).forEach(t=>bh(t))},addWorker:t=>bh(t)});function bh(e){e.addEventListener("message",t=>{if(fD(t.data)){if(t.stopImmediatePropagation(),t.data._sentryDebugIds&&(x&&y.log("Sentry debugId web worker message received",t.data),N._sentryDebugIds={...t.data._sentryDebugIds,...N._sentryDebugIds}),t.data._sentryModuleMetadata&&(x&&y.log("Sentry module metadata web worker message received",t.data),N._sentryModuleMetadata={...t.data._sentryModuleMetadata,...N._sentryModuleMetadata}),t.data._sentryWasmImages){x&&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&&(x&&y.log("Sentry worker rejection message received",t.data._sentryWorkerError),lD(t.data._sentryWorkerError))}})}function lD(e){const t=M();if(!t)return;const n=t.getOptions().stackParser,r=t.getOptions().attachStacktrace,i=e.reason,s=$n(i)?dy(i):$a(n,i,void 0,r,!0);s.level="error",e.filename&&(s.contexts={...s.contexts,worker:{filename:e.filename}}),gi(s,{originalException:i,mechanism:{handled:!1,type:"auto.browser.web_worker.onunhandledrejection"}}),x&&y.log("Captured worker unhandled rejection",i)}function dD({self:e}){e.postMessage({_sentryMessage:!0,_sentryDebugIds:e._sentryDebugIds??void 0,_sentryModuleMetadata:e._sentryModuleMetadata??void 0}),e.addEventListener("unhandledrejection",t=>{const r={reason:ly(t),filename:e.location?.href};e.postMessage({_sentryMessage:!0,_sentryWorkerError:r}),x&&y.log("[Sentry Worker] Forwarding unhandled rejection to parent",r)}),x&&y.log("[Sentry Worker] Registered worker with unhandled rejection handling")}function fD(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 pD(e){const t={...e};return Og(t,"react"),dl("react",{version:Ge.version}),Sx(t)}function hD(e){const t=e.match(/^([^.]+)/);return t!==null&&parseInt(t[0])>=17}function mD(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 _d(e,{componentStack:t},n){if(hD(Ge.version)&&Ht(e)&&t){const r=new Error(e.message);r.name=`React ErrorBoundary ${e.name}`,r.stack=t,mD(e,r)}return ut(r=>(r.setContext("react",{componentStack:t}),Ie(e,n)))}function gD(e){return(t,n)=>{const r=!!e,i=_d(t,n,{mechanism:{handled:r,type:"auto.function.react.error_handler"}});r&&e(t,n,i)}}const xb="ui.react.render",_D="ui.react.update",Ob="ui.react.mount",yD={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},bD={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},SD={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Mb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},vD=Symbol.for("react.forward_ref"),Nb=Symbol.for("react.memo");function ED(e){return typeof e=="object"&&e!==null&&e.$$typeof===Nb}const yd={};yd[vD]=SD;yd[Nb]=Mb;function Sh(e){if(ED(e))return Mb;const t=e.$$typeof;return t&&yd[t]||yD}const TD=Object.defineProperty.bind(Object),wD=Object.getOwnPropertyNames.bind(Object),vh=Object.getOwnPropertySymbols?.bind(Object),Eh=Object.getOwnPropertyDescriptor.bind(Object),ID=Object.getPrototypeOf.bind(Object),Th=Object.prototype;function Is(e,t,n){if(typeof t!="string"){if(Th){const o=ID(t);o&&o!==Th&&Is(e,o)}let r=wD(t);vh&&(r=r.concat(vh(t)));const i=Sh(e),s=Sh(t);for(const o of r)if(!bD[o]&&!s?.[o]&&!i?.[o]&&!Eh(e,o)){const a=Eh(t,o);if(a)try{TD(e,o,a)}catch{}}}return e}const kD="unknown";class bd extends Ge.Component{constructor(t){super(t);const{name:n,disabled:r=!1}=this.props;r||(this._mountSpan=St({name:`<${n}>`,onlyIfParent:!0,op:Ob,attributes:{[Y]:"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=Ee();this._updateSpan=gr(this._mountSpan,()=>St({name:`<${this.props.name}>`,onlyIfParent:!0,op:_D,startTime:i,attributes:{[Y]:"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=Ee(),{name:n,includeRender:r=!0}=this.props;if(this._mountSpan&&r){const i=$(this._mountSpan).timestamp;gr(this._mountSpan,()=>{const s=St({onlyIfParent:!0,name:`<${n}>`,op:xb,startTime:i,attributes:{[Y]:"auto.ui.react.profiler","ui.component_name":n}});s&&s.end(t)})}}render(){return this.props.children}}Object.assign(bd,{defaultProps:{disabled:!1,includeRender:!0,includeUpdates:!0}});function AD(e,t){const n=t?.name||e.displayName||e.name||kD,r=i=>Ge.createElement(bd,{...t,name:n,updateProps:i},Ge.createElement(e,{...i}));return r.displayName=`profiler(${n})`,Is(r,e),r}function RD(e,t={disabled:!1,hasRenderSpan:!0}){const[n]=Ge.useState(()=>{if(!t?.disabled)return St({name:`<${e}>`,onlyIfParent:!0,op:Ob,attributes:{[Y]:"auto.ui.react.profiler","ui.component_name":e}})});Ge.useEffect(()=>(n&&n.end(),()=>{if(n&&t.hasRenderSpan){const r=$(n).timestamp,i=Ee(),s=St({name:`<${e}>`,onlyIfParent:!0,op:xb,startTime:r,attributes:{[Y]:"auto.ui.react.profiler","ui.component_name":e}});s&&s.end(i)}}),[])}const He=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,CD="unknown",Fc={componentStack:null,error:null,eventId:null};class Pb extends Ge.Component{constructor(t){super(t),this.state=Fc,this._openFallbackReportDialog=!0;const n=M();n&&t.showDialog&&(this._openFallbackReportDialog=!1,this._cleanupHook=n.on("afterSendEvent",r=>{!r.type&&this._lastEventId&&r.event_id===this._lastEventId&&Au({...t.dialogOptions,eventId:this._lastEventId})}))}componentDidCatch(t,n){const{componentStack:r}=n,{beforeCapture:i,onError:s,showDialog:o,dialogOptions:a}=this.props;ut(c=>{i&&i(c,t,r);const u=this.props.handled!=null?this.props.handled:!!this.props.fallback,d=_d(t,n,{mechanism:{handled:u,type:"auto.function.react.error_boundary"}});s&&s(t,r,d),o&&(this._lastEventId=d,this._openFallbackReportDialog&&Au({...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===Fc?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(Fc)}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"?Ge.createElement(t,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):t;return Ge.isValidElement(i)?i:(t&&He&&y.warn("fallback did not produce a valid ReactElement"),null)}}function xD(e,t){const n=e.displayName||e.name||CD,r=Ge.memo(i=>Ge.createElement(Pb,{...t},Ge.createElement(e,{...i})));return r.displayName=`errorBoundary(${n})`,Is(r,e),r}const OD="redux.action",MD="info",ND={attachReduxState:!0,actionTransformer:e=>e,stateTransformer:e=>e||null};function PD(e){const t={...ND,...e};return n=>(r,i)=>{t.attachReduxState&&cr().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=z(),f=t.actionTransformer(u);typeof f<"u"&&f!==null&&Pt({category:OD,data:f,type:MD});const p=t.stateTransformer(d);if(typeof p<"u"&&p!==null){const _=M()?.getOptions()?.normalizeDepth||3,S={state:{type:"redux",value:p}};Pe(S,"__sentry_override_normalization_depth__",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 LD(e){const t=Ei({...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&&wh(r,N.location,i,(c,u="url")=>{Ti(a,{name:c,attributes:{[me]:"pageload",[Y]:"auto.pageload.react.reactrouter_v3",[fe]:u}})}),o&&n.listen&&n.listen(c=>{(c.action==="PUSH"||c.action==="POP")&&wh(r,c,i,(u,d="url")=>{wi(a,{name:u,attributes:{[me]:"navigation",[Y]:"auto.navigation.react.reactrouter_v3",[fe]:d}})})})}}}function wh(e,t,n,r){let i=t.pathname;n({location:t,routes:e},(s,o,a)=>{if(s||!a)return r(i);const c=DD(a.routes||[]);return c.length===0||c==="/*"?r(i):(i=c,r(i,"route"))})}function DD(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 FD(e,t={}){const n=e,r=Ei({...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;Ti(o,{name:d?d.routeId:a.pathname,attributes:{[me]:"pageload",[Y]:"auto.pageload.react.tanstack_router",[fe]:d?"route":"url",...Ih(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,f=N.location,p=wi(o,{name:l?l.routeId:f.pathname,attributes:{[me]:"navigation",[Y]:"auto.navigation.react.tanstack_router",[fe]:l?"route":"url"}}),h=n.subscribe("onResolved",m=>{if(h(),p){const g=n.matchRoutes(m.toLocation.pathname,m.toLocation.search,{preload:!1,throwOnError:!1}),_=g[g.length-1],S=_?.routeId!=="__root__"?_:void 0;S&&(p.updateName(S.routeId),p.setAttribute(fe,"route"),p.setAttributes(Ih(S)))}})})}}}function Ih(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 $D(e){const t=Ei({...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),Lb(a,s,o,n,"reactrouter_v4",r,i)}}}function UD(e){const t=Ei({...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),Lb(a,s,o,n,"reactrouter_v5",r,i)}}}function Lb(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=Db(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);Ti(e,{name:d,attributes:{[me]:"pageload",[Y]:`auto.pageload.react.${i}`,[fe]:l}})}}n&&r.listen&&r.listen((u,d)=>{if(d&&(d==="PUSH"||d==="POP")){const[l,f]=c(u.pathname);wi(e,{name:l,attributes:{[me]:"navigation",[Y]:`auto.navigation.react.${i}`,[fe]:f}})}})}function Db(e,t,n,r=[]){return e.some(i=>{const s=i.path?n(t,i):r.length?r[r.length-1].match:BD(t);return s&&(r.push({route:i,match:s}),i.routes&&Db(i.routes,t,n,r)),!!s}),r}function BD(e){return{path:"/",url:"/",params:{},isExact:e==="/"}}function HD(e){const t=e.displayName||e.name,n=r=>{if(r?.computedMatch?.isExact){const i=r.computedMatch.path,s=jD();z().setTransactionName(i),s&&(s.updateName(i),s.setAttribute(fe,"route"))}return Ge.createElement(e,{...r})};return n.displayName=`sentryRoute(${t})`,Is(n,e),n}function jD(){const e=Oe(),t=e&&xe(e);if(!t)return;const n=$(t).op;return n==="navigation"||n==="pageload"?t:void 0}function ks(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 kh=new WeakMap;function WD(e,t,n){if(!e||!t||!t.length)return null;const r=n?ks(e,n):e;let i=kh.get(t);i||(i=YD(t),kh.set(t,i),He&&y.log("[React Router] Sorted route manifest by specificity:",i.length,"patterns"));for(const s of i)if(zD(r,s))return He&&y.log("[React Router] Matched pathname",r,"to pattern",s),s;return He&&y.log("[React Router] No manifest match found for pathname:",r),null}function zD(e,t){if(t==="/")return e==="/"||e==="";const n=Rh(e),r=Rh(t);if(r.length>0&&r[r.length-1]==="*"){const s=r.slice(0,-1);if(n.length{const r=Ch(t);return Ch(n)-r})}let Sd,fr=!1;const Pn=[],JD=10;function XD(e,t){const n={};return Pn.length>=JD&&(He&&y.warn("[React Router] Navigation context stack overflow - removing oldest context"),Pn.shift()),Pn.push({token:n,targetPath:e,span:t}),n}function QD(e){Pn[Pn.length-1]?.token===e&&Pn.pop()}function $b(){const e=Pn.length;return e>0?Pn[e-1]??null:null}function ZD(e,t=!1){Sd=e,fr=t}function eF(e){return nF(e.route.path||"")}function tF(e){return e.params["*"]||""}function nF(e){return e[e.length-1]==="*"?e.slice(0,-1):e}function Yr(e){return e[e.length-1]==="/"?e.slice(0,-1):e}function Ub(e){return e.endsWith("*")}function Hn(e){return e.includes("/*")||e.endsWith("*")}function xh(e,t){return Ub(e)&&!!t.route.children?.length||!1}function rF(e){return!!(!e.children&&e.element&&e.path?.endsWith("/*"))}function iF(e,t,n){const r=e&&e.length>0?e:fr?ks(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 Oh(e){return e.split(/\\?\//).filter(t=>t.length>0&&t!==",").length}function da(e){return e[0]==="/"?e:`/${e}`}function Bb(e,t){const n=Sd(e,t);if(!n||n.length===0)return"";for(const r of n)if(r.route.path&&r.route.path!=="*"){const i=eF(r),s=ks(t.pathname,da(r.pathnameBase));return t.pathname===s?Yr(s):Yr(Yr(i||"")+da(Bb(e.filter(o=>o!==r.route),{pathname:s})))}return""}function sF(e,t){const n=Sd(t,e);if(n){for(const r of n)if(rF(r.route)&&tF(r))return!0}return!1}function Mh(e,t){return fr?ks(e.pathname,t):e.pathname||""}function oF(e,t,n,r=""){if(!e||e.length===0)return[fr?ks(t.pathname,r):t.pathname,"url"];if(!n)return[Mh(t,r),"url"];let i="";for(const s of n){const o=s.route;if(!o)continue;if(o.index)return iF(i,s.pathname,r);const a=o.path;if(!a||xh(a,s))continue;const c=a[0]==="/"||i[i.length-1]==="/"?a:`/${a}`;if(i=Yr(i)+da(c),Yr(t.pathname)===Yr(r+s.pathname))return Oh(i)!==Oh(s.pathname)&&!Ub(i)?[(fr?"":r)+c,"route"]:(xh(i,s)&&(i=i.slice(0,-1)),[(fr?"":r)+i,"route"])}return[Mh(t,r),"url"]}function Xa(e,t,n,r,i="",s,o){if(o&&s&&s.length>0){const d=WD(e.pathname,s,i);if(d)return[(fr?"":i)+d,"route"]}let a,c="url";const u=sF(e,n);return u&&(a=da(Bb(n,e)),c="route"),(!u||!a)&&([a,c]=oF(t,e,r,i)),[a||e.pathname,c]}function qt(){const e=Oe(),t=e?xe(e):void 0;if(!t)return;const n=$(t).op;return n==="navigation"||n==="pageload"?t:void 0}function aF(){const e=$b();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{He&&y.warn("[React Router] Could not access window.location")}return null}function cF(){const e=$b();return e?e.span:qt()}function uF(e,t,n,r){const i=new Proxy(e,{apply(s,o,a){const c=aF(),u=cF(),d=s.apply(o,a);return lF(d,t,n,r,c,u),d}});return Pe(i,"__sentry_proxied__",!0),i}function lF(e,t,n,r,i,s){qn(e)?e.then(o=>{Array.isArray(o)&&r(o,t,i??void 0,s)}).catch(o=>{He&&y.warn(`Error resolving async handler '${n}' for route`,t,o)}):Array.isArray(e)&&r(e,t,i??void 0,s)}function Qa(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]=uF(r,e,n,t))}if(Array.isArray(e.children))for(const n of e.children)Qa(n,t)}let Ln,Dn,Fn,Co,Et,Yn=!1,ar=3e3,As,vd="";const Hb=new WeakSet,rr=new WeakMap,ze=new Set,xo=new WeakMap,Bu=new WeakMap;function dF(e){return N?.requestAnimationFrame?N.requestAnimationFrame(e):setTimeout(e,0)}function Nh(e){N?.cancelAnimationFrame?N.cancelAnimationFrame(e):clearTimeout(e)}function jb(e){return`${e.pathname}${e.search||""}${e.hash||""}`}function Ph(e){return e.includes(":")||e.includes("*")}function fF(e,t,n,r){if(!e)return{skip:!1,shouldUpdate:!1};if(e.locationKey===t&&(e.isPlaceholder||!r)){const s=!!e.routeName&&Hn(e.routeName),o=Hn(n),a=!!e.routeName&&Ph(e.routeName),c=Ph(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 Wb(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 zb(e,t){let n=xo.get(e);n||(n=new Set,xo.set(e,n)),n.add(t),t.finally(()=>{const r=xo.get(e);r&&r.delete(t)})}function qb(e){const t=new Promise(n=>{Bu.set(e,n)});zb(e,t)}function pF(e){const t=Bu.get(e);t&&(t(),Bu.delete(e),e.__sentry_may_have_lazy_routes__&&(e.__sentry_may_have_lazy_routes__=!1))}function Ed(e,t,n=null,r){e.forEach(s=>{ze.add(s),Yn&&Qa(s,Ed)}),t&&Wb(e,t);const i=r??qt();if(i){const s=$(i);if(s.timestamp){He&&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"?Cs({activeRootSpan:i,location:{pathname:a.pathname},routes:Array.from(ze),allRoutes:Array.from(ze)}):o==="navigation"&&Hu(i,a,Array.from(ze),!1,Et))}}function Hu(e,t,n,r=!1,i){const s=$(e),o=s.description,a=e?.__sentry_navigation_name_set__,c=o&&Hn(o);if((!a||r||c)&&!s.timestamp){const d=i(n,t),[l,f]=Xa(t,n,n,d||[],vd,As,Yn),p=s.data?.[fe];l&&(!o||!a&&(p!=="route"||f==="route")||p!=="route"&&f==="route"||p==="route"&&f==="route"&&c)&&(e.updateName(l),e.setAttribute(fe,f),!Hn(l)&&f==="route"&&Pe(e,"__sentry_navigation_name_set__",!0))}}function Gb(e,t,n,r,i){let s=!1,o=!!i&&$(i).op==="pageload",a=!1,c=null,u=null;e.subscribe(d=>{if(!s){const f=qt();f&&$(f).op==="pageload"?o=!0:o&&(d.historyAction==="POP"&&!a?a=!0:s=!0)}if(d.historyAction==="PUSH"||d.historyAction==="POP"&&s){const f=jb(d.location),p=()=>{u!==f&&(u=f,c=null,Td({location:d.location,routes:t,navigationType:d.historyAction,version:n,basename:r,allRoutes:Array.from(ze)}))};d.navigation.state!=="idle"?(u!==f&&(u=null),c!==null&&Nh(c),c=dF(p)):(c!==null&&(Nh(c),c=null),p())}})}function Vb(e,t){return!Ln||!Dn||!Fn||!Et?(He&&y.warn(`reactRouterV${t}Instrumentation was unable to wrap the \`createRouter\` function because of one or more missing parameters.`),e):function(n,r){if(Rs(n),Yn)for(const u of n)Qa(u,Ed);const i=qt();r&&"patchRoutesOnNavigation"in r&&typeof r.patchRoutesOnNavigation=="function"&&i&&(Pe(i,"__sentry_may_have_lazy_routes__",!0),qb(i));const o=Xb(r,!1,i),a=e(n,o),c=r?.basename;return a.state.historyAction==="POP"&&i&&Cs({activeRootSpan:i,location:a.state.location,routes:n,basename:c,allRoutes:Array.from(ze)}),vd=c||"",Gb(a,n,t,c,i),a}}function Kb(e,t){return!Ln||!Dn||!Fn||!Et?(He&&y.warn(`reactRouterV${t}Instrumentation was unable to wrap the \`createMemoryRouter\` function because of one or more missing parameters.`),e):function(n,r){if(Rs(n),Yn)for(const g of n)Qa(g,Ed);const i=qt();r&&"patchRoutesOnNavigation"in r&&typeof r.patchRoutesOnNavigation=="function"&&i&&(Pe(i,"__sentry_may_have_lazy_routes__",!0),qb(i));const o=Xb(r,!0,i),a=e(n,o),c=r?.basename;let u;const d=r?.initialEntries,l=r?.initialIndex,f=d&&d.length===1,p=l!==void 0&&d&&d[l];u=f?d[0]:p?d[l]:void 0;const h=u?typeof u=="string"?{pathname:u}:u:a.state.location,m=qt();return a.state.historyAction==="POP"&&m&&Cs({activeRootSpan:m,location:h,routes:n,basename:c,allRoutes:Array.from(ze)}),vd=c||"",Gb(a,n,t,c,m),a}}function Yb(e,t){const n=Ei({...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:f,lazyRouteManifest:p}=e;return{...n,setup(h){n.setup(h);const m=e.finalTimeout??3e4,g=(e.idleTimeout??1e3)*3,_=f??g;_===1/0?(ar=m,He&&y.log("[React Router] lazyRouteTimeout set to Infinity, capping at finalTimeout:",m,"ms to prevent indefinite hangs")):Number.isNaN(_)?(He&&y.warn("[React Router] lazyRouteTimeout must be a number, falling back to default:",g),ar=g):_<0?(He&&y.warn("[React Router] lazyRouteTimeout must be non-negative or Infinity, got:",_,"falling back to:",g),ar=g):ar=_,Ln=r,Dn=i,Fn=s,Et=a,Co=o,Yn=u,As=p,ZD(a,c||!1)},afterAllSetup(h){n.afterAllSetup(h);const m=N.location?.pathname;d&&m&&Ti(h,{name:m,attributes:{[fe]:"url",[me]:"pageload",[Y]:`auto.pageload.react.reactrouter_v${t}`}}),l&&Hb.add(h)}}}function Jb(e,t){if(!Ln||!Dn||!Fn||!Et)return He&&y.warn("reactRouterV6Instrumentation was unable to wrap `useRoutes` because of one or more missing parameters."),e;const n=r=>{const i=Ge.useRef(!0),{routes:s,locationArg:o}=r,a=e(s,o),c=Dn(),u=Fn(),d=typeof o=="string"||o?.pathname?o:c;return Ln(()=>{const l=typeof d=="string"?{pathname:d}:d;i.current?(Rs(s),Cs({activeRootSpan:qt(),location:l,routes:s,allRoutes:Array.from(ze)}),i.current=!1):Td({location:l,routes:s,navigationType:u,version:t,allRoutes:Array.from(ze)})},[u,d]),a};return(r,i)=>Ge.createElement(n,{routes:r,locationArg:i})}function Xb(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=qt()??n;if(!t){const c=i?.patch,u=i?.matches;c&&(i.patch=(d,l)=>{if(Rs(l),u&&u.length>0){const h=u[u.length-1]?.route;if(h){const m=Array.from(ze).find(g=>{const _=g.id!==void 0&&g.id===d,S=g===h,T=g.path!==void 0&&h.path!==void 0&&g.path===h.path;return _||S||T});m&&Wb(l,m)}}const f=o?$(o):void 0;return s&&o&&f&&!f.timestamp&&f.op==="navigation"&&Hu(o,{pathname:s,search:"",hash:"",state:null,key:"default"},Array.from(ze),!0,Et),c(d,l)})}const a=(async()=>{const c=XD(s,o);let u;try{u=await r(i)}finally{QD(c),o&&pF(o)}const d=o?$(o):void 0;if(o&&d&&!d.timestamp&&d.op==="navigation"){const l=s;l&&Hu(o,{pathname:l,search:"",hash:"",state:null,key:"default"},Array.from(ze),!1,Et)}return u})();return o&&zb(o,a),a}}}function Td(e){const{location:t,routes:n,navigationType:r,version:i,matches:s,basename:o,allRoutes:a}=e,c=Array.isArray(s)?s:Et(a||n,t,o),u=M();if(!u||!Hb.has(u))return;const d=qt();if(!(d&&$(d).op==="pageload"&&r==="POP")&&(r==="PUSH"||r==="POP")&&c){const[l,f]=Xa(t,a||n,a||n,c,o,As,Yn),p=jb(t),h=rr.get(u),m=h&&!h.isPlaceholder?!!$(h.span).timestamp:!1,{skip:g,shouldUpdate:_}=fF(h,p,l,m);if(g){if(_&&h){const w=h.routeName;h.isPlaceholder?(h.routeName=l,He&&y.log(`[Tracing] Updated placeholder navigation name from "${w}" to "${l}" (will apply to real span)`)):(h.span.updateName(l),h.span.setAttribute(fe,f),Pe(h.span,"__sentry_navigation_name_set__",!0),h.routeName=l,He&&y.log(`[Tracing] Updated navigation span name from "${w}" to "${l}"`))}else He&&y.log(`[Tracing] Skipping duplicate navigation for location: ${p}`);return}const T={span:{end:()=>{}},routeName:l,pathname:t.pathname,locationKey:p,isPlaceholder:!0};rr.set(u,T);let v;try{v=wi(u,{name:T.routeName,attributes:{[fe]:f,[me]:"navigation",[Y]:`auto.navigation.react.reactrouter_v${i}`}})}catch(w){throw rr.delete(u),w}v?(rr.set(u,{span:v,routeName:T.routeName,pathname:t.pathname,locationKey:p}),ju(v,t,n,o,"navigation")):rr.delete(u)}}function Rs(e){e.forEach(t=>{Qb(t).forEach(r=>{ze.add(r)})})}function Qb(e,t=new Set){return t.has(e)||(t.add(e),e.children&&!e.index&&e.children.forEach(n=>{Qb(n,t).forEach(i=>{t.add(i)})})),t}function Cs({activeRootSpan:e,location:t,routes:n,matches:r,basename:i,allRoutes:s}){const o=Array.isArray(r)?r:Et(s||n,t,i);if(o){const[a,c]=Xa(t,s||n,s||n,o,i,As,Yn);z().setTransactionName(a||"/"),e&&(e.updateName(a),e.setAttribute(fe,c),ju(e,t,n,i,"pageload"))}else e&&ju(e,t,n,i,"pageload")}function hF(e,t,n,r,i=!1){return n?!!(!e&&i||e&&Hn(e)&&r==="route"&&!Hn(n)||t!=="route"&&r==="route"):!1}function $c(e,t,n,r,i,s,o,a){try{const c=t.data?.[fe];if(c==="route"&&n&&!Hn(n))return;const u=Array.from(a),d=u.length>0?u:i,l=Et(d,r,s);if(!l)return;const[f,p]=Xa(r,d,d,l,s,As,Yn),h=hF(n,c,f,p,!0),m=o==="pageload"||!t.timestamp;h&&m&&(e.updateName(f),e.setAttribute(fe,p))}catch(c){He&&y.warn(`Error updating span details before ending: ${c}`)}}function ju(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,f=$(e),p=f.description,h=f.data?.[fe],m=()=>{const v=M();if(v&&i==="navigation"){const w=rr.get(v);w&&w.span===e&&rr.delete(v)}},g=xo.get(e),_=e.__sentry_may_have_lazy_routes__;if((g&&g.size>0||_)&&p&&(Hn(p)||h!=="route")){if(ar===0){$c(e,f,p,t,n,r,i,ze),m(),a(l);return}const v=new Promise(E=>setTimeout(E,ar));let w;if(g&&g.size>0){const E=Promise.allSettled(g).then(()=>{});w=ar===1/0?E:Promise.race([E,v])}else w=v;w.then(()=>{const E=$(e);$c(e,E,E.description,t,n,r,i,ze),m(),a(l)}).catch(()=>{m(),a(l)});return}$c(e,f,p,t,n,r,i,ze),m(),a(l)},Pe(e,s,!0)}function Zb(e,t){if(!Ln||!Dn||!Fn||!Co||!Et)return He&&y.warn(`reactRouterV6Instrumentation was unable to wrap Routes because of one or more missing parameters. useEffect: ${Ln}. useLocation: ${Dn}. useNavigationType: ${Fn}. createRoutesFromChildren: ${Co}. matchRoutes: ${Et}.`),e;const n=r=>{const i=Ge.useRef(!0),s=Dn(),o=Fn();return Ln(()=>{const a=Co(r.children);i.current?(Rs(a),Cs({activeRootSpan:qt(),location:s,routes:a,allRoutes:Array.from(ze)}),i.current=!1):Td({location:s,routes:a,navigationType:o,version:t,allRoutes:Array.from(ze)})},[s,o]),Ge.createElement(e,{...r})};return Is(n,e),n}function mF(e){return Yb(e,"6")}function gF(e){return Jb(e,"6")}function _F(e){return Vb(e,"6")}function yF(e){return Kb(e,"6")}function bF(e){return Zb(e,"6")}function SF(e){return Yb(e,"7")}function vF(e){return Zb(e,"7")}function EF(e){return Vb(e,"7")}function TF(e){return Kb(e,"7")}function wF(e){return Jb(e,"7")}const eB=Object.freeze(Object.defineProperty({__proto__:null,BrowserClient:L_,ErrorBoundary:Pb,MULTIPLEXED_TRANSPORT_EXTRA_KEY:mo,OpenFeatureIntegrationHook:nD,Profiler:bd,SDK_VERSION:sn,SEMANTIC_ATTRIBUTE_SENTRY_OP:me,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:Y,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:ya,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:fe,Scope:Mt,WINDOW:N,addBreadcrumb:Pt,addEventProcessor:cg,addIntegration:uu,breadcrumbsIntegration:sy,browserApiErrorsIntegration:oy,browserProfilingIntegration:QL,browserSessionIntegration:ay,browserTracingIntegration:Ei,buildLaunchDarklyFlagUsedHandler:eD,captureConsoleIntegration:LT,captureEvent:gi,captureException:Ie,captureFeedback:qg,captureMessage:sg,captureReactException:_d,captureSession:po,chromeStackLineParser:ey,close:b0,consoleLoggingIntegration:Jw,contextLinesIntegration:Wx,continueTrace:jE,createConsolaReporter:nI,createLangChainCallbackHandler:Qk,createReduxEnhancer:PD,createTransport:Sg,createUserFeedbackEnvelope:L1,cultureContextIntegration:cy,dedupeIntegration:Ug,defaultRequestInstrumentationOptions:hd,defaultStackLineParsers:ny,defaultStackParser:ry,diagnoseSdkConnectivity:aD,endSession:fl,eventFiltersIntegration:Ng,eventFromException:N_,eventFromMessage:P_,exceptionFromError:Fa,extraErrorDataIntegration:zT,featureFlagsIntegration:Cw,feedbackAsyncIntegration:LR,feedbackIntegration:bp,feedbackSyncIntegration:bp,flush:y0,forceLoad:vx,functionToStringIntegration:Mg,geckoStackLineParser:ty,getActiveSpan:Oe,getClient:M,getCurrentScope:z,getDefaultIntegrations:my,getFeedback:qA,getGlobalScope:cr,getIsolationScope:Le,getReplay:PP,getRootSpan:xe,getSpanDescendants:Hi,getSpanStatusFromHttpCode:Cm,getTraceData:vl,globalHandlersIntegration:uy,graphqlClientIntegration:Xx,growthbookIntegration:sD,httpClientIntegration:Cx,httpContextIntegration:py,inboundFiltersIntegration:Pg,init:pD,instrumentAnthropicAiClient:Ok,instrumentGoogleGenAIClient:zk,instrumentLangGraph:oA,instrumentOpenAiClient:dk,instrumentOutgoingRequests:yb,instrumentSupabaseClient:zg,isEnabled:ag,isInitialized:S0,lastEventId:og,launchDarklyIntegration:ZL,lazyLoadIntegration:O_,linkedErrorsIntegration:hy,logger:Gw,makeBrowserOfflineTransport:IL,makeFetchTransport:Yl,makeMultiplexedTransport:oT,metrics:eI,moduleMetadataIntegration:OT,onLoad:Ex,openFeatureIntegration:tD,opera10StackLineParser:O1,opera11StackLineParser:P1,parameterize:xg,reactErrorHandler:gD,reactRouterV3BrowserTracingIntegration:LD,reactRouterV4BrowserTracingIntegration:$D,reactRouterV5BrowserTracingIntegration:UD,reactRouterV6BrowserTracingIntegration:mF,reactRouterV7BrowserTracingIntegration:SF,registerSpanErrorInstrumentation:Vm,registerWebWorker:dD,replayCanvasIntegration:ZP,replayIntegration:OP,reportPageLoaded:_L,reportingObserverIntegration:kx,rewriteFramesIntegration:QT,sendFeedback:__,setActiveSpanInBrowser:yL,setContext:dl,setCurrentClient:kg,setExtra:h0,setExtras:p0,setHttpStatus:Yi,setMeasurement:Qm,setTag:g0,setTags:m0,setUser:_0,showReportDialog:Au,spanToBaggageHeader:bE,spanToJSON:$,spanToTraceHeader:Wm,spotlightBrowserIntegration:gx,startBrowserTracingNavigationSpan:wi,startBrowserTracingPageLoadSpan:Ti,startInactiveSpan:St,startNewTrace:eg,startSession:cu,startSpan:Sn,startSpanManual:tn,statsigIntegration:oD,supabaseIntegration:dw,suppressTracing:Zm,tanstackRouterBrowserTracingIntegration:FD,thirdPartyErrorFilterIntegration:vw,uiProfiler:f1,unleashIntegration:rD,updateSpanName:gE,useProfiler:RD,webWorkerIntegration:uD,winjsStackLineParser:R1,withActiveSpan:gr,withErrorBoundary:xD,withIsolationScope:zv,withProfiler:AD,withScope:ut,withSentryReactRouterV6Routing:bF,withSentryReactRouterV7Routing:vF,withSentryRouting:HD,wrapCreateBrowserRouterV6:_F,wrapCreateBrowserRouterV7:EF,wrapCreateMemoryRouterV6:yF,wrapCreateMemoryRouterV7:TF,wrapUseRoutesV6:gF,wrapUseRoutesV7:wF,zodErrorsIntegration:Sw},Symbol.toStringTag,{value:"Module"})),IF=250,kF=50;class AF{constructor(t,n){var r,i;this.signalBuffer=[],this.itemLimit=(r=n?.itemLimit)!==null&&r!==void 0?r:kF,this.sendTimeout=(i=n?.sendTimeout)!==null&&i!==void 0?i:IF,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 Ue;(function(e){e.EXCEPTION="exception",e.LOG="log",e.MEASUREMENT="measurement",e.TRACE="trace",e.EVENT="event"})(Ue||(Ue={}));const eS={[Ue.EXCEPTION]:"exceptions",[Ue.LOG]:"logs",[Ue.MEASUREMENT]:"measurements",[Ue.TRACE]:"traces",[Ue.EVENT]:"events"};function RF(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(E=>{if(t.debug(`Adding "${E.name}" transport`),s.some(k=>k===E)){t.warn(`Transport ${E.name} is already added`);return}E.unpatchedConsole=e,E.internalLogger=t,E.config=n,E.metas=r,s.push(E)})},u=(...w)=>{t.debug(`Adding beforeSendHooks `,a),w.forEach(E=>{E&&a.push(E)})},d=w=>{let E=w;for(const b of a){const k=E.map(b).filter(Boolean);if(k.length===0)return[];E=CF(k,n)}return E},l=w=>{const E=d(w);if(E.length!==0)for(const b of s)t.debug(`Transporting item using ${b.name} `,E),b.isBatched()&&b.send(E)},f=w=>{var E,b;if(!((E=n.batching)===null||E===void 0)&&E.enabled&&s.every(F=>F.isBatched()))return;const[k]=d([w]);if(k!==void 0)for(const F of s)t.debug(`Transporting item using ${F.name} `,k),F.isBatched()?!((b=n.batching)===null||b===void 0)&&b.enabled||F.send([k]):F.send(k)};let p;return!((i=n.batching)===null||i===void 0)&&i.enabled&&(p=new AF(l,{sendTimeout:n.batching.sendTimeout,itemLimit:n.batching.itemLimit,paused:o})),{add:c,addBeforeSendHooks:u,getBeforeSendHooks:()=>[...a],execute:w=>{var E;o||(!((E=n.batching)===null||E===void 0)&&E.enabled&&p?.addItem(w),f(w))},isPaused:()=>o,pause:()=>{t.debug("Pausing transports"),p?.pause(),o=!0},remove:(...w)=>{t.debug("Removing transports"),w.forEach(E=>{t.debug(`Removing "${E.name}" transport`);const b=s.indexOf(E);if(b===-1){t.warn(`Transport "${E.name}" is not added`);return}s.splice(b,1)})},removeBeforeSendHooks:(...w)=>{a.filter(E=>!w.includes(E))},get transports(){return[...s]},unpause:()=>{t.debug("Unpausing transports"),p?.start(),o=!1}}}function CF(e,t){if(t.preserveOriginalError)for(const n of e)n.type===Ue.EXCEPTION&&delete n.payload.originalError;return e}function Tt(e,t){return typeof e===t}function Ii(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function xs(e,t){try{return e instanceof t}catch{return!1}}const xF=(e=>Tt(e,"undefined")),ki=(e=>Tt(e,"null")),Ai=(e=>Tt(e,"string")),wd=(e=>Tt(e,"number")&&!isNaN(e)||Tt(e,"bigint")),OF=(e=>wd(e)&&Number.isInteger(e)),tS=(e=>Tt(e,"boolean")),MF=(e=>Tt(e,"symbol")),wt=(e=>!ki(e)&&Tt(e,"object")),Cr=(e=>Tt(e,"function")),ui=(e=>Ii(e,"Array")),NF=(e=>Ii(e,"RegExp")),PF=(e=>Cr(e?.then)),nS=(e=>!wt(e)&&!Cr(e)),rS=typeof Event<"u",iS=(e=>rS&&xs(e,Event)),sS=typeof Error<"u",Za=(e=>sS&&xs(e,Error)),oS=(e=>Ii(e,"ErrorEvent")),aS=(e=>Ii(e,"DOMError")),cS=(e=>Ii(e,"DOMException")),uS=typeof Element<"u",LF=(e=>uS&&xs(e,Element)),lS=typeof Map<"u",DF=(e=>lS&&xs(e,Map)),FF=(e=>wt(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e);function En(e){return e==null?!0:ui(e)||Ai(e)?e.length===0:wt(e)?Object.keys(e).length===0:!1}function gn(e,t){if(e===t)return!0;if(Tt(e,"number")&&isNaN(e))return Tt(t,"number")&&isNaN(t);const n=ui(e),r=ui(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(!gn(e[a],t[a]))return!1;return!0}const i=wt(e),s=wt(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(!gn(e[d],t[d]))return!1;return!0}return!1}function li(){return Date.now()}function Os(){return new Date().toISOString()}function ec(e){return new Date(e).toISOString()}var Xe;(function(e){e.TRACE="trace",e.DEBUG="debug",e.INFO="info",e.LOG="log",e.WARN="warn",e.ERROR="error"})(Xe||(Xe={}));const dS=Xe.LOG,fS=[Xe.TRACE,Xe.DEBUG,Xe.INFO,Xe.LOG,Xe.WARN,Xe.ERROR];function Bt(){}function pS(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 Lh="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789";function Jn(e=10){return Array.from(Array(e)).map(()=>Lh[Math.floor(Math.random()*Lh.length)]).join("")}const ln=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:void 0;function $F(e){return ln?.[`__faroBundleId_${e}`]}function UF(){const e=new WeakSet;return function(t,n){if(wt(n)&&n!==null){if(e.has(n))return null;e.add(n)}return n}}function Ms(e={}){return JSON.stringify(e??{},UF())}function Ri(e={}){const t={};for(const[n,r]of Object.entries(e))t[n]=wt(r)&&r!==null?Ms(r):String(r);return t}class qe{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 qe,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 qe,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 qe,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 qe,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 en;(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"})(en||(en={}));const BF="Faro",Id={debug:Bt,error:Bt,info:Bt,prefix:BF,warn:Bt},kd=en.ERROR,Ns=Object.assign({},console);let Uc=Ns;function HF(e){var t;return Uc=(t=e.unpatchedConsole)!==null&&t!==void 0?t:Uc,Uc}function Ad(e=Ns,t=kd){const n=Id;return t>en.OFF&&(n.error=t>=en.ERROR?function(...r){e.error(`${n.prefix} `,...r)}:Bt,n.warn=t>=en.WARN?function(...r){e.warn(`${n.prefix} `,...r)}:Bt,n.info=t>=en.INFO?function(...r){e.info(`${n.prefix} `,...r)}:Bt,n.debug=t>=en.VERBOSE?function(...r){e.debug(`${n.prefix} `,...r)}:Bt),n}let Dh=Id;function jF(e,t){return Dh=Ad(e,t.internalLoggerLevel),Dh}class Rd{constructor(){this.unpatchedConsole=Ns,this.internalLogger=Id,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 Cd extends Rd{isBatched(){return!1}getIgnoreUrls(){return[]}}function WF(e){e.transports.add(...e.config.transports),e.transports.addBeforeSendHooks(e.config.beforeSend)}function zF(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 xd(e){let t={meta:{}};return e[0]!==void 0&&(t.meta=e[0].meta),e.forEach(n=>{switch(n.type){case Ue.LOG:case Ue.EVENT:case Ue.EXCEPTION:case Ue.MEASUREMENT:{const r=eS[n.type],i=t[r];t=Object.assign(Object.assign({},t),{[r]:i===void 0?[n.payload]:[...i,n.payload]});break}case Ue.TRACE:{t=Object.assign(Object.assign({},t),{traces:zF(t.traces,n.payload.resourceSpans)});break}}}),t}const qF="faroApiCall",GF="user_action_start",hS={Normal:"normal"},VF="faro.user.action";var ve;(function(e){e[e.Started=0]="Started",e[e.Halted=1]="Halted",e[e.Cancelled=2]="Cancelled",e[e.Ended=3]="Ended"})(ve||(ve={}));class KF{constructor(){this.buffer=[]}addItem(t){this.buffer.push(t)}flushBuffer(t){if(Cr(t))for(const n of this.buffer)t(n);this.buffer.length=0}size(){return this.buffer.length}}class YF extends qe{constructor({name:t,parentId:n,trigger:r,transports:i,attributes:s,trackUserActionsExcludeItem:o,importance:a=hS.Normal,pushEvent:c}){super(),this.name=t,this.attributes=s,this.id=Jn(),this.trigger=r,this.parentId=n??this.id,this.trackUserActionsExcludeItem=o,this.importance=a,this._pushEvent=c,this._itemBuffer=new KF,this._transports=i,this._state=ve.Started,this._start()}addItem(t){return this._state===ve.Started?(this._itemBuffer.addItem(t),!0):!1}_start(){this._state=ve.Started,this._state===ve.Started&&(this.startTime=li())}halt(){this._state===ve.Started&&(this._state=ve.Halted,this.notify(this._state))}cancel(){this._state===ve.Started&&this._itemBuffer.flushBuffer(),this._state=ve.Cancelled,this.notify(this._state)}end(){if(this._state===ve.Cancelled)return;const t=li(),n=t-this.startTime;this._state=ve.Ended,this._itemBuffer.flushBuffer(r=>{if(JF(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=ve.Ended,this.notify(this._state),this._pushEvent(VF,Object.assign({userActionName:this.name,userActionStartTime:this.startTime.toString(),userActionEndTime:t.toString(),userActionDuration:n.toString(),userActionTrigger:this.trigger,userActionImportance:this.importance},Ri(this.attributes)),void 0,{timestampOverwriteMs:this.startTime,customPayloadTransformer:r=>(r.action={id:this.id,name:this.name},r)})}getState(){return this._state}}function JF(e,t){return t?.(e)||e.type===Ue.MEASUREMENT&&e.payload.type==="web-vitals"}const mS=new qe;function XF({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,f)=>{if(c()===void 0){const h=new YF({name:d,transports:e,attributes:l,trigger:f?.triggerName||qF,importance:f?.importance||hS.Normal,trackUserActionsExcludeItem:s,pushEvent:r});return h.filter(m=>[ve.Ended,ve.Cancelled].includes(m)).first().subscribe(()=>{o=void 0}),mS.notify({type:GF,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 tc(e,t){return!e||e?.getState()!==ve.Started?!1:(e.addItem(t),!0)}function QF({internalLogger:e,config:t,metas:n,transports:r,tracesApi:i,userActionsApi:s}){let o=null;return{pushEvent:(c,u,d,{skipDedupe:l,spanContext:f,timestampOverwriteMs:p,customPayloadTransformer:h=m=>m}={})=>{try{const m=Ri(u),g={meta:n.value,payload:h({name:c,domain:d??t.eventDomain,attributes:En(m)?void 0:m,timestamp:p?ec(p):Os(),trace:f?{trace_id:f.traceId,span_id:f.spanId}:i.getTraceContext()}),type:Ue.EVENT},_={name:g.payload.name,attributes:g.payload.attributes,domain:g.payload.domain};if(!l&&t.dedupe&&!ki(o)&&gn(_,o)){e.debug(`Skipping event push because it is the same as the last one `,g.payload);return}o=_,e.debug(`Pushing event `,g),tc(s.getActiveUserAction(),g)||r.execute(g)}catch(m){e.error("Error pushing event",m)}}}}const Od="Error",Fh=e=>e.map(t=>wt(t)?Ms(t):String(t)).join(" ");function ZF(e,t){return e.some(n=>Ai(n)?t.includes(n):!!t.match(n))}let In;function e$({internalLogger:e,config:t,metas:n,transports:r,tracesApi:i,userActionsApi:s}){var o;e.debug("Initializing exceptions API");let a=null;In=(o=t.parseStacktrace)!==null&&o!==void 0?o:In;const c=p=>{e.debug("Changing stacktrace parser"),In=p??In},u=()=>In,{ignoreErrors:d=[],preserveOriginalError:l}=t,f=(p,{skipDedupe:h,stackFrames:m,type:g,context:_,spanContext:S,timestampOverwriteMs:T,originalError:v}={})=>{if(!n$(d,v??p))try{const w=Ri(Object.assign(Object.assign({},t$(v??p)),_??{})),E={meta:n.value,payload:Object.assign(Object.assign({type:g||p.name||Od,value:p.message,timestamp:T?ec(T):Os(),trace:S?{trace_id:S.traceId,span_id:S.spanId}:i.getTraceContext()},En(w)?{}:{context:w}),l?{originalError:v}:{}),type:Ue.EXCEPTION};m=m??(p.stack?In?.(p).frames:void 0),m?.length&&(E.payload.stacktrace={frames:m});const b={type:E.payload.type,value:E.payload.value,stackTrace:E.payload.stacktrace,context:E.payload.context};if(!h&&t.dedupe&&!ki(a)&&gn(b,a)){e.debug(`Skipping error push because it is the same as the last one `,E.payload);return}a=b,e.debug(`Pushing exception `,E),tc(s.getActiveUserAction(),E)||r.execute(E)}catch(w){e.error("Error pushing event",w)}};return c(t.parseStacktrace),{changeStacktraceParser:c,getStacktraceParser:u,pushError:f}}function t$(e){let t=e.cause;return Za(t)?t=e.cause.toString():t!==null&&(wt(e.cause)||ui(e.cause))?t=Ms(e.cause):t!=null&&(t=e.cause.toString()),t==null?{}:{cause:t}}function n$(e,t){const{message:n,name:r,stack:i}=t;return ZF(e,n+" "+r+" "+i)}const fa=e=>e.map(t=>{try{return String(t)}catch{return""}}).join(" ");function r$({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:fa;return{pushLog:(d,{context:l,level:f,skipDedupe:p,spanContext:h,timestampOverwriteMs:m}={})=>{try{const g=Ri(l),_={type:Ue.LOG,payload:{message:c(d),level:f??dS,context:En(g)?void 0:g,timestamp:m?ec(m):Os(),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(!p&&t.dedupe&&!ki(a)&&gn(S,a)){e.debug(`Skipping log push because it is the same as the last one `,_.payload);return}a=S,e.debug(`Pushing log `,_),tc(s.getActiveUserAction(),_)||r.execute(_)}catch(g){e.error(`Error pushing log `,g)}}}}function i$({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:f}={})=>{try{const p=Ri(d),h={type:Ue.MEASUREMENT,payload:Object.assign(Object.assign({},c),{trace:l?{trace_id:l.traceId,span_id:l.spanId}:i.getTraceContext(),timestamp:f?ec(f):Os(),context:En(p)?void 0:p}),meta:n.value},m={type:h.payload.type,values:h.payload.values,context:h.payload.context};if(!u&&t.dedupe&&!ki(o)&&gn(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),tc(s.getActiveUserAction(),h)||r.execute(h)}catch(p){e.error(`Error pushing measurement `,p)}}}}function s$({internalLogger:e,metas:t}){e.debug("Initializing meta API");let n,r,i,s;const o=p=>{r&&t.remove(r),r={user:p},t.add(r)},a=(p,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({},En(p)?void 0:p),_)},t.add(n)},c=()=>t.value.session,u=(p,h)=>{var m;if(h?.overrides&&a(c(),{overrides:h.overrides}),((m=i?.view)===null||m===void 0?void 0:m.name)===p?.name)return;const g=i;i={view:p},t.add(i),g&&t.remove(g)},d=()=>t.value.view,l=p=>{var h;const m=Ai(p)?Object.assign(Object.assign({},(h=s?.page)!==null&&h!==void 0?h:f()),{id:p}):p;s&&t.remove(s),s={page:m},t.add(s)},f=()=>t.value.page;return{setUser:o,resetUser:o,setSession:a,resetSession:a,getSession:c,setView:u,getView:d,setPage:l,getPage:f}}function o$(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,f)=>{t.debug("Initializing OpenTelemetry"),s={trace:l,context:f}},isOTELInitialized:()=>!!s,pushTraces:l=>{try{const f={type:Ue.TRACE,payload:l,meta:r.value};t.debug(`Pushing trace `,f),i.execute(f)}catch(f){t.error(`Error pushing trace `,f)}}}}function a$(e,t,n,r,i){t.debug("Initializing API");let s=null;const a=XF({transports:i,config:n,internalLogger:t,pushEvent:(l,f,p,h)=>{s?s(l,f,p,h):t.warn("pushEventImpl is not initialized. Event dropped:",{name:l,attributes:f,domain:p,options:h})}}),c=o$(e,t,n,r,i),u={internalLogger:t,userActionsApi:a,config:n,metas:r,transports:i,tracesApi:c},d=QF(u);return s=d.pushEvent,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c),e$(u)),s$(u)),r$(u)),i$(u)),d),a)}class Yt extends Rd{constructor(){super(...arguments),this.api={},this.transports={}}}function c$(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(f=>f.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,f;t.debug(`Removing "${d.name}" instrumentation`);const p=o.reduce((h,m,g)=>h===null&&m.name===d.name?g:null,null);if(p===null){t.warn(`Instrumentation "${d.name}" is not added`);return}(f=(l=o[p]).destroy)===null||f===void 0||f.call(l),o.splice(p,1)})}}}function u$(e){e.instrumentations.add(...e.config.instrumentations)}function l$(e,t,n){let r=[],i=[];const s=()=>r.reduce((l,f)=>Object.assign(l,Cr(f)?f():f),{}),o=()=>{if(i.length){const l=s();i.forEach(f=>f(l))}};return{add:(...l)=>{t.debug(`Adding metas `,l),r.push(...l),o()},remove:(...l)=>{t.debug(`Removing metas `,l),r=r.filter(f=>!l.includes(f)),o()},addListener:l=>{t.debug(`Adding metas listener `,l),i.push(l)},removeListener:l=>{t.debug(`Removing metas listener `,l),i=i.filter(f=>f!==l)},get value(){return s()}}}const lt="2.2.0";function d$(e){var t,n;const r={sdk:{version:lt},app:{bundleId:e.config.app.name&&$F(e.config.app.name)}},i=(t=e.config.sessionTracking)===null||t===void 0?void 0:t.session;i&&e.api.setSession(i),e.config.app&&(r.app=Object.assign(Object.assign({},e.config.app),r.app)),e.config.user&&(r.user=e.config.user),e.config.view&&(r.view=e.config.view),e.metas.add(r,...(n=e.config.metas)!==null&&n!==void 0?n:[])}const nc="_faroInternal";function f$(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 ln){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(ln,e.config.globalObjectKey,{configurable:!1,writable:!1,value:e})}}function p$(){return ln[nc]}function gS(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(ln,nc,{configurable:!1,enumerable:!1,writable:!1,value:e}))}function _S(){return nc in ln}let we={};function h$(e,t,n,r,i,s,o){return t.debug("Initializing Faro"),we={api:s,config:n,instrumentations:o,internalLogger:t,metas:r,pause:i.pause,transports:i,unpatchedConsole:e,unpause:i.unpause},gS(we),f$(we),we}function m$(e){const t=HF(e),n=jF(t,e);if(_S()&&!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=l$(t,n),i=RF(t,n,e,r),s=a$(t,n,e,r,i),o=c$(t,n,e,r,i,s),a=h$(t,n,e,r,i,s,o);return d$(a),WF(a),u$(a),a}const yS="faro",g$={enabled:!0,sendTimeout:250,itemLimit:50},_$="click",y$="navigation",bS="view_changed",Ui="session_start",Oo="session_resume",SS="session_extend",b$="service_name_override",S$="route_change",pt="unknown";var Bi={exports:{}},v$=Bi.exports,$h;function E$(){return $h||($h=1,(function(e,t){(function(n,r){var i="1.0.41",s="",o="?",a="function",c="undefined",u="object",d="string",l="major",f="model",p="name",h="type",m="vendor",g="version",_="architecture",S="console",T="mobile",v="tablet",w="smarttv",E="wearable",b="embedded",k=500,F="Amazon",I="Apple",L="ASUS",C="BlackBerry",P="Browser",D="Chrome",ee="Edge",V="Firefox",Q="Google",A="Honor",B="Huawei",R="Lenovo",W="LG",ie="Microsoft",te="Motorola",Te="Nvidia",je="OnePlus",tt="Opera",De="OPPO",ke="Samsung",nt="Sharp",Ve="Sony",Jt="Xiaomi",Tn="Zebra",Xn="Facebook",rt="Chromium OS",ce="Mac OS",_e=" Browser",it=function(oe,le){var X={};for(var ye in oe)le[ye]&&le[ye].length%2===0?X[ye]=le[ye].concat(oe[ye]):X[ye]=oe[ye];return X},Ae=function(oe){for(var le={},X=0;X0?de.length===2?typeof de[1]==a?this[de[0]]=de[1].call(this,Ft):this[de[0]]=de[1]:de.length===3?typeof de[1]===a&&!(de[1].exec&&de[1].test)?this[de[0]]=Ft?de[1].call(this,Ft,de[2]):r:this[de[0]]=Ft?Ft.replace(de[1],de[2]):r:de.length===4&&(this[de[0]]=Ft?de[3].call(this,Ft.replace(de[1],de[2])):r):this[de]=Ft||r;X+=2}},se=function(oe,le){for(var X in le)if(typeof le[X]===u&&le[X].length>0){for(var ye=0;ye2&&(q[f]="iPad",q[h]=v),q},this.getEngine=function(){var q={};return q[p]=r,q[g]=r,Re.call(q,ye,Dt.engine),q},this.getOS=function(){var q={};return q[p]=r,q[g]=r,Re.call(q,ye,Dt.os),de&&!q[p]&&Xt&&Xt.platform&&Xt.platform!="Unknown"&&(q[p]=Xt.platform.replace(/chrome os/i,rt).replace(/macos/i,ce)),q},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 ye},this.setUA=function(q){return ye=typeof q===d&&q.length>k?Z(q,k):q,this},this.setUA(ye),this};It.VERSION=i,It.BROWSER=Ae([p,g,l]),It.CPU=Ae([_]),It.DEVICE=Ae([f,m,h,S,T,w,v,E,b]),It.ENGINE=It.OS=Ae([p,g]),e.exports&&(t=e.exports=It),t.UAParser=It;var xr=typeof n!==c&&(n.jQuery||n.Zepto);if(xr&&!xr.ua){var Ls=new It;xr.ua=Ls.getResult(),xr.ua.get=function(){return Ls.getUA()},xr.ua.set=function(oe){Ls.setUA(oe);var le=Ls.getResult();for(var X in le)xr.ua[X]=le[X]}}})(typeof window=="object"?window:v$)})(Bi,Bi.exports)),Bi.exports}var T$=E$();const vS=()=>{const e=new T$.UAParser,{name:t,version:n}=e.getBrowser(),{name:r,version:i}=e.getOS(),s=e.getUA(),o=navigator.language,a=navigator.userAgent.includes("Mobi"),c=u();return{browser:{name:t??pt,version:n??pt,os:`${r??pt} ${i??pt}`,userAgent:s??pt,language:o??pt,mobile:a,brands:c??pt,viewportWidth:`${window.innerWidth}`,viewportHeight:`${window.innerHeight}`}};function u(){if(!(!t||!n)&&"userAgentData"in navigator&&navigator.userAgentData)return navigator.userAgentData.brands}};function ES(e){var t,n,r,i;return{id:(i=(r=(n=(t=we.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:Jn(),attributes:e}}const w$=()=>({sdk:{name:"@grafana/faro-core",version:lt,integrations:we.config.instrumentations.map(({name:e,version:t})=>({name:e,version:t}))}}),_n={session:"sessionStorage",local:"localStorage"};function TS(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=we.internalLogger)===null||t===void 0||t.info(`Web storage of type ${e} is not available. Reason: ${n}`),!1}}function rc(e,t){return Nd(t)?window[t].getItem(e):null}function Md(e,t,n){if(Nd(n))try{window[n].setItem(e,t)}catch{}}function wS(e,t){Nd(t)&&window[t].removeItem(e)}const IS=TS(_n.local),kS=TS(_n.session);function Nd(e){return e===_n.local?IS:e===_n.session?kS:!1}function AS(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 RS(){return we.transports.transports.flatMap(e=>e.getIgnoreUrls())}function ic(e=""){return RS().some(t=>e&&e.match(t)!=null)}function CS(e){if(Ai(e))return e;if(e instanceof URL)return e.href;if(!En(e)&&Cr(e?.toString))return e.toString()}const pr="com.grafana.faro.session",xS=14400*1e3,Pd=900*1e3,OS=1*1e3,MS=Pd,I$={enabled:!0,persistent:!1,maxSessionPersistenceTime:MS};function Ld(){var e,t,n;const i=we.config.sessionTracking;let s=(n=(t=(e=i?.sampler)===null||e===void 0?void 0:e.call(i,{metas:we.metas.value}))!==null&&t!==void 0?t:i?.samplingRate)!==null&&n!==void 0?n:1;return typeof s!="number"&&(s=0),Math.random()this.updateUserSession(),OS),this.updateUserSession=Dd({fetchUserSession:gt.fetchUserSession,storeUserSession:gt.storeUserSession}),this.init()}static removeUserSession(){wS(pr,gt.storageTypeLocal)}static storeUserSession(t){Md(pr,Ms(t),gt.storageTypeLocal)}static fetchUserSession(){const t=rc(pr,gt.storageTypeLocal);return t?JSON.parse(t):null}init(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.updateSession()}),we.metas.addListener(LS({fetchUserSession:gt.fetchUserSession,storeUserSession:gt.storeUserSession}))}}gt.storageTypeLocal=_n.local;class Rt{constructor(){this.updateSession=AS(()=>this.updateUserSession(),OS),this.updateUserSession=Dd({fetchUserSession:Rt.fetchUserSession,storeUserSession:Rt.storeUserSession}),this.init()}static removeUserSession(){wS(pr,Rt.storageTypeSession)}static storeUserSession(t){Md(pr,Ms(t),Rt.storageTypeSession)}static fetchUserSession(){const t=rc(pr,Rt.storageTypeSession);return t?JSON.parse(t):null}init(){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.updateSession()}),we.metas.addListener(LS({fetchUserSession:Rt.fetchUserSession,storeUserSession:Rt.storeUserSession}))}}Rt.storageTypeSession=_n.session;function DS(e){return e?.persistent?gt:Rt}class FS extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-session",this.version=lt}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(SS,{},void 0,{skipDedupe:!0}),this.notifiedSession=i;return}this.notifiedSession=i,this.api.pushEvent(Ui,{},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 f=li();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=DS(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===Ui&&this.api.pushEvent(Ui,{},void 0,{skipDedupe:!0}),i===Oo&&this.api.pushEvent(Oo,{},void 0,{skipDedupe:!0})}this.metas.addListener(this.sendSessionStartEvent.bind(this))}}const A$="resource-entry",Fd="http-request-start",$d="http-request-end",R$="dom-mutation",C$="console";let eo,Uh=!1;function x$(e){if(eo||(eo=new qe),!Uh){const t=e??Ns;fS.forEach(n=>{console[n]=(...r)=>{var i;eo.notify({type:C$,level:n,args:r}),(i=t[n])===null||i===void 0||i.apply(console,r)}}),Uh=!0}return eo}const O$="Non-Error promise rejection captured with value:",M$="UnhandledRejection",N$="DOMError",P$="DOMException",L$="Non-Error exception captured with keys:",D$="?",F$=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function $$(e){var t,n;const r=e.match(F$),i=(t=r?.[1])!==null&&t!==void 0?t:Od;return[(n=r?.[2])!==null&&n!==void 0?n:e,i]}const Bh=` `,U$="eval",B$="?",Hh="@",H$=/^\s*at (?:(?![a-z]+:\/\/)([^(]+?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,j$=/\((\S*)(?::(\d+))(?::(\d+))\)/,W$="eval",$S="address at ",z$=$S.length,q$=/^\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,G$=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,V$=" > eval",jh="safari-extension",Wh="safari-web-extension",K$=/Minified React error #\d+;/i;function Ud(e,t,n,r){const i={filename:e||document.location.href,function:t||B$};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}function Wu(e,t){const n=e?.includes(jh),r=!n&&e?.includes(Wh);return!n&&!r?[e,t]:[e?.includes(Hh)?e.split(Hh)[0]:e,n?`${jh}:${t}`:`${Wh}:${t}`]}function ha(e){let t=[];e.stacktrace?t=e.stacktrace.split(Bh).filter((r,i)=>i%2===0):e.stack&&(t=e.stack.split(Bh));const n=t.reduce((r,i,s)=>{let o,a,c,u,d;if(o=H$.exec(i)){if(a=o[1],c=o[2],u=o[3],d=o[4],c?.startsWith(W$)){const l=j$.exec(c);l&&(c=l[1],u=l[2],d=l[3])}c=c?.startsWith($S)?c.substring(z$):c,[a,c]=Wu(a,c)}else if(o=q$.exec(i)){if(a=o[1],c=o[3],u=o[4],d=o[5],c&&c.includes(V$)){const l=G$.exec(c);l&&(a=a||U$,c=l[1],u=l[2])}else s===0&&!d&&wd(e.columnNumber)&&(d=String(e.columnNumber+1));[a,c]=Wu(a,c)}return(c||a)&&r.push(Ud(c,a,u?Number(u):void 0,d?Number(d):void 0)),r},[]);return K$.test(e.message)?n.slice(1):n}function US(e){return{frames:ha(e)}}function BS(e){let t,n,r=[],i,s;if(oS(e)&&e.error)t=e.error.message,n=e.error.name,r=ha(e.error);else if((i=aS(e))||cS(e)){const{name:o,message:a}=e;n=o??(i?N$:P$),t=a?`${n}: ${a}`:n}else Za(e)?(t=e.message,r=ha(e)):(wt(e)||(s=iS(e)))&&(n=s?e.constructor.name:void 0,t=`${L$} ${Object.keys(e)}`);return[t,n,r]}function HS(e){const[t,n,r,i,s]=e;let o,a,c=[];const u=Ai(t),d=Ud(n,D$,r,i);return s||!u?([o,a,c]=BS(s??t),c.length===0&&(c=[d])):u&&([o,a]=$$(t),c=[d]),{value:o,type:a,stackFrames:c}}function zh(e,t){return Za(e[0])?HS(e):{value:t(e)}}class rn extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-console",this.version=lt,this.errorSerializer=fa}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:Fh:fa;const s=(n=r?.disabledLevels)!==null&&n!==void 0?n:rn.defaultDisabledLevels,o=x$(this.unpatchedConsole);this.subscription=o.subscribe(({level:a,args:c})=>{if(!s.includes(a))try{if(a===Xe.ERROR&&!r?.consoleErrorAsLog){const{value:u,type:d,stackFrames:l}=zh(c,this.errorSerializer);if(u&&!d&&!l){this.api.pushError(new Error(rn.consoleErrorPrefix+u));return}this.api.pushError(new Error(rn.consoleErrorPrefix+u),{type:d,stackFrames:l})}else if(a===Xe.ERROR&&r?.consoleErrorAsLog){const{value:u,type:d,stackFrames:l}=zh(c,this.errorSerializer);this.api.pushLog(u?[rn.consoleErrorPrefix+u]:c,{level:a,context:{value:u??"",type:d??"",stackFrames:l?.length?Fh(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}}rn.defaultDisabledLevels=[Xe.DEBUG,Xe.TRACE,Xe.LOG];rn.consoleErrorPrefix="console.error: ";function Y$(e){const t=window.onerror;window.onerror=(...n)=>{try{const{value:r,type:i,stackFrames:s}=HS(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 J$(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=[];nS(s)?(o=`${O$} ${String(s)}`,a=M$):[o,a,c]=BS(s),o&&e.pushError(new Error(o),{type:a,stackFrames:c})};window.addEventListener("unhandledrejection",t)}class jS extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-errors",this.version=lt}initialize(){this.logDebug("Initializing"),Y$(this.api),J$(this.api)}}class WS extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-view",this.version=lt}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(bS,{fromView:(i=(r=this.notifiedView)===null||r===void 0?void 0:r.name)!==null&&i!==void 0?i:pt,toView:(s=o.name)!==null&&s!==void 0?s:pt},void 0,{skipDedupe:!0}),this.notifiedView=o)}initialize(){this.metas.addListener(this.sendViewChangedEvent.bind(this))}}class qh{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 Ci=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart{if(document.readyState==="loading")return"loading";{const t=Ci();if(t){if(e{const t=e.nodeName;return e.nodeType===1?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Bd=e=>{let t="";try{for(;e?.nodeType!==9;){const n=e,r=n.id?"#"+n.id:[X$(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},Bc=new WeakMap;function di(e,t){return Bc.get(e)||Bc.set(e,new t),Bc.get(e)}let zS=-1;const qS=()=>zS,xi=e=>{addEventListener("pageshow",(t=>{t.persisted&&(zS=t.timeStamp,e(t))}),!0)},Gt=(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)))}},Hd=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Ps=()=>Ci()?.activationStart??0,Vt=(e,t=-1)=>{const n=Ci();let r="navigate";return qS()>=0?r="back-forward-cache":n&&(document.prerendering||Ps()>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}},fi=(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{}},jd=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let qr=-1;const GS=new Set,Gh=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,zu=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(const t of GS)t();isFinite(qr)||(qr=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",zu,!0))}},sc=()=>{if(qr<0){const e=Ps();qr=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((n=>n.name==="hidden"&&n.startTime>e))[0]?.startTime)??Gh(),addEventListener("visibilitychange",zu,!0),addEventListener("prerenderingchange",zu,!0),xi((()=>{setTimeout((()=>{qr=Gh()}))}))}return{get firstHiddenTime(){return qr},onHidden(e){GS.add(e)}}},oc=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},Vh=[1800,3e3],VS=(e,t={})=>{oc((()=>{const n=sc();let r,i=Vt("FCP");const s=fi("paint",(o=>{for(const a of o)a.name==="first-contentful-paint"&&(s.disconnect(),a.startTime{i=Vt("FCP"),r=Gt(e,i,Vh,t.reportAllChanges),Hd((()=>{i.value=performance.now()-o.timeStamp,r(!0)}))})))}))},Kh=[.1,.25],Yh=e=>e.find((t=>t.node?.nodeType===1))||e[0],Q$=(e,t={})=>{const n=di(t=Object.assign({},t),qh),r=new WeakMap;n.t=i=>{if(i?.sources?.length){const s=Yh(i.sources),o=s?.node;if(o){const a=t.generateTarget?.(o)??Bd(o);r.set(s,a)}}},((i,s={})=>{const o=sc();VS(jd((()=>{let a,c=Vt("CLS",0);const u=di(s,qh),d=f=>{for(const p of f)u.u(p);u.o>c.value&&(c.value=u.o,c.entries=u.i,a())},l=fi("layout-shift",d);l&&(a=Gt(i,c,Kh,s.reportAllChanges),o.onHidden((()=>{d(l.takeRecords()),a(!0)})),xi((()=>{u.o=0,c=Vt("CLS",0),a=Gt(i,c,Kh,s.reportAllChanges),Hd((()=>a()))})),setTimeout(a))})))})((i=>{const s=(o=>{let a={};if(o.entries.length){const c=o.entries.reduce(((u,d)=>u.value>d.value?u:d));if(c?.sources?.length){const u=Yh(c.sources);u&&(a={largestShiftTarget:r.get(u),largestShiftTime:c.startTime,largestShiftValue:c.value,largestShiftSource:u,largestShiftEntry:c,loadState:ma(c.startTime)})}}return Object.assign(o,{attribution:a})})(i);e(s)}),t)},Z$=(e,t={})=>{VS((n=>{const r=(i=>{let s={timeToFirstByte:0,firstByteToFCP:i.value,loadState:ma(qS())};if(i.entries.length){const o=Ci(),a=i.entries.at(-1);if(o){const c=o.activationStart||0,u=Math.max(0,o.responseStart-c);s={timeToFirstByte:u,firstByteToFCP:i.value-u,loadState:ma(i.entries[0].startTime),navigationEntry:o,fcpEntry:a}}}return Object.assign(i,{attribution:s})})(n);e(r)}),t)};let KS=0,Hc=1/0,to=0;const eU=e=>{for(const t of e)t.interactionId&&(Hc=Math.min(Hc,t.interactionId),to=Math.max(to,t.interactionId),KS=to?(to-Hc)/7+1:0)};let qu;const Jh=()=>qu?KS:performance.interactionCount??0,tU=()=>{"interactionCount"in performance||qu||(qu=fi("event",eU,{type:"event",buffered:!0,durationThreshold:0}))};let Xh=0;class Qh{l=[];h=new Map;m;p;v(){Xh=Jh(),this.l.length=0,this.h.clear()}M(){const t=Math.min(this.l.length-1,Math.floor((Jh()-Xh)/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 Gu=e=>{const t=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?e():(e=jd(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t((()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})})))},Zh=[200,500],nU=(e,t={})=>{const n=di(t=Object.assign({},t),Qh);let r=[],i=[],s=0;const o=new WeakMap,a=new WeakMap;let c=!1;const u=()=>{c||(Gu(d),c=!0)},d=()=>{const p=n.l.map((_=>o.get(_.entries[0]))),h=i.length-50;i=i.filter(((_,S)=>S>=h||p.includes(_)));const m=new Set;for(const _ of i){const S=l(_.startTime,_.processingEnd);for(const T of S)m.add(T)}const g=r.length-1-50;r=r.filter(((_,S)=>_.startTime>s&&S>g||m.has(_))),c=!1};n.m=p=>{const h=p.startTime+p.duration;let m;s=Math.max(s,p.processingEnd);for(let g=i.length-1;g>=0;g--){const _=i[g];if(Math.abs(h-_.renderTime)<=8){m=_,m.startTime=Math.min(p.startTime,m.startTime),m.processingStart=Math.min(p.processingStart,m.processingStart),m.processingEnd=Math.max(p.processingEnd,m.processingEnd),m.entries.push(p);break}}m||(m={startTime:p.startTime,processingStart:p.processingStart,processingEnd:p.processingEnd,renderTime:h,entries:[p]},i.push(m)),(p.interactionId||p.entryType==="first-input")&&o.set(p,m),u()},n.p=p=>{if(!a.get(p)){const h=p.entries[0].target;if(h){const m=t.generateTarget?.(h)??Bd(h);a.set(p,m)}}};const l=(p,h)=>{const m=[];for(const g of r)if(!(g.startTime+g.durationh)break;m.push(g)}return m},f=p=>{const h=p.entries[0],m=o.get(h),g=h.processingStart,_=Math.max(h.startTime+h.duration,g),S=Math.min(m.processingEnd,_),T=m.entries.sort(((b,k)=>b.processingStart-k.processingStart)),v=l(h.startTime,S),w=n.h.get(h.interactionId),E={interactionTarget:a.get(w),interactionType:h.name.startsWith("key")?"keyboard":"pointer",interactionTime:h.startTime,nextPaintTime:_,processedEventEntries:T,longAnimationFrameEntries:v,inputDelay:g-h.startTime,processingDuration:S-g,presentationDelay:_-S,loadState:ma(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 k=b.interactionTime,F=b.inputDelay,I=b.processingDuration;let L,C,P=0,D=0,ee=0,V=0;for(const B of b.longAnimationFrameEntries){D=D+B.startTime+B.duration-B.styleAndLayoutStart;for(const R of B.scripts){const W=R.startTime+R.duration;if(WV&&(C=R.startTime=k+F+I?"presentation-delay":"processing-duration",L=R,V=ie)}}const Q=b.longAnimationFrameEntries.at(-1),A=Q?Q.startTime+Q.duration:0;A>=k+F+I&&(ee=b.nextPaintTime-A),L&&C&&(b.longestScript={entry:L,subpart:C,intersectingDuration:V}),b.totalScriptDuration=P,b.totalStyleAndLayoutDuration=D,b.totalPaintDuration=ee,b.totalUnattributedDuration=b.nextPaintTime-k-P-D-ee})(E),Object.assign(p,{attribution:E})};fi("long-animation-frame",(p=>{r=r.concat(p),u()})),((p,h={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const m=sc();oc((()=>{tU();let g,_=Vt("INP");const S=di(h,Qh),T=w=>{Gu((()=>{for(const b of w)S.u(b);const E=S.M();E&&E.T!==_.value&&(_.value=E.T,_.entries=E.entries,g())}))},v=fi("event",T,{durationThreshold:h.durationThreshold??40});g=Gt(p,_,Zh,h.reportAllChanges),v&&(v.observe({type:"first-input",buffered:!0}),m.onHidden((()=>{T(v.takeRecords()),g(!0)})),xi((()=>{S.v(),_=Vt("INP"),g=Gt(p,_,Zh,h.reportAllChanges)})))}))})((p=>{const h=f(p);e(h)}),t)};class em{m;u(t){this.m?.(t)}}const tm=[2500,4e3],rU=(e,t={})=>{const n=di(t=Object.assign({},t),em),r=new WeakMap;n.m=i=>{const s=i.element;if(s){const o=t.generateTarget?.(s)??Bd(s);r.set(i,o)}},((i,s={})=>{oc((()=>{const o=sc();let a,c=Vt("LCP");const u=di(s,em),d=f=>{s.reportAllChanges||(f=f.slice(-1));for(const p of f)u.u(p),p.startTime{d(l.takeRecords()),l.disconnect(),a(!0)})),p=h=>{h.isTrusted&&(Gu(f),removeEventListener(h.type,p,{capture:!0}))};for(const h of["keydown","click","visibilitychange"])addEventListener(h,p,{capture:!0});xi((h=>{c=Vt("LCP"),a=Gt(i,c,tm,s.reportAllChanges),Hd((()=>{c.value=performance.now()-h.timeStamp,a(!0)}))}))}}))})((i=>{const s=(o=>{let a={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:o.value};if(o.entries.length){const c=Ci();if(c){const u=c.activationStart||0,d=o.entries.at(-1),l=d.url&&performance.getEntriesByType("resource").filter((m=>m.name===d.url))[0],f=Math.max(0,c.responseStart-u),p=Math.max(f,l?(l.requestStart||l.startTime)-u:0),h=Math.min(o.value,Math.max(p,l?l.responseEnd-u:0));a={target:r.get(d),timeToFirstByte:f,resourceLoadDelay:p-f,resourceLoadDuration:h-p,elementRenderDelay:o.value-h,navigationEntry:c,lcpEntry:d},d.url&&(a.url=d.url),l&&(a.lcpResourceEntry=l)}}return Object.assign(o,{attribution:a})})(i);e(s)}),t)},nm=[800,1800],Vu=e=>{document.prerendering?oc((()=>Vu(e))):document.readyState!=="complete"?addEventListener("load",(()=>Vu(e)),!0):setTimeout(e)},iU=(e,t={})=>{((n,r={})=>{let i=Vt("TTFB"),s=Gt(n,i,nm,r.reportAllChanges);Vu((()=>{const o=Ci();o&&(i.value=Math.max(o.responseStart-Ps(),0),i.entries=[o],s(!0),xi((()=>{i=Vt("TTFB",0),s=Gt(n,i,nm,r.reportAllChanges),s(!0)})))}))})((n=>{const r=(i=>{let s={waitingDuration:0,cacheDuration:0,dnsDuration:0,connectionDuration:0,requestDuration:0};if(i.entries.length){const o=i.entries[0],a=o.activationStart||0,c=Math.max((o.workerStart||o.fetchStart)-a,0),u=Math.max(o.domainLookupStart-a,0),d=Math.max(o.connectStart-a,0),l=Math.max(o.connectEnd-a,0);s={waitingDuration:c,cacheDuration:u-c,dnsDuration:d-u,connectionDuration:l-d,requestDuration:i.value-l,navigationEntry:o}}return Object.assign(i,{attribution:s})})(n);e(r)}),t)},Ku="com.grafana.faro.lastNavigationId",jc="load_state",rm="time_to_first_byte";class sU{constructor(t,n){this.corePushMeasurement=t,this.webVitalConfig=n}initialize(){this.measureCLS(),this.measureFCP(),this.measureINP(),this.measureLCP(),this.measureTTFB()}measureCLS(){var t;Q$(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,jc,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;Z$(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,rm,i);const a=this.buildInitialContext(n);this.addIfPresent(a,jc,s),this.pushMeasurement(o,a)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}measureINP(){var t;nU(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 f=this.buildInitialContext(n);this.addIfPresent(f,jc,c),this.addIfPresent(f,"interaction_target",u),this.addIfPresent(f,"interaction_type",d),this.pushMeasurement(l,f)},{reportAllChanges:(t=this.webVitalConfig)===null||t===void 0?void 0:t.reportAllChanges})}measureLCP(){var t;rU(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,rm,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;iU(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=rc(Ku,_n.session))!==null&&n!==void 0?n:pt;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 YS extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-web-vitals",this.version=lt}initialize(){this.logDebug("Initializing"),new sU(this.api.pushMeasurement,this.config.webVitalsInstrumentation).initialize()}}const oU="navigation",Yu="resource",aU=/^00-[a-f0-9]{32}-[a-f0-9]{16}-[0-9]{1,2}$/;function JS(e=[]){for(const t of e)if(t.name==="traceparent"){if(!aU.test(t.description))continue;const[,n,r]=t.description.split("-");if(n!=null&&r!=null)return{traceId:n,spanId:r};break}}function cU(){return"PerformanceObserver"in window}function uU(e){if(document.readyState==="complete")e();else{const t=()=>{document.readyState==="complete"&&(e(),document.removeEventListener("readystatechange",t))};document.addEventListener("readystatechange",t)}}function lU(e,t={}){for(const[n,r]of Object.entries(t)){const i=e[n];return i==null?!1:ui(r)?r.includes(i):i===r}return!0}function XS(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:f,redirectStart:p,renderBlockingStatus:h,requestStart:m,responseEnd:g,responseStart:_,responseStatus:S,secureConnectionStart:T,transferSize:v,workerStart:w}=e;return{name:d,duration:Fe(o),tcpHandshakeTime:Fe(t-n),dnsLookupTime:Fe(i-s),tlsNegotiationTime:Fe(t-T),responseStatus:Fe(S),redirectTime:Fe(f-p),requestTime:Fe(_-m),responseTime:Fe(g-_),fetchTime:Fe(g-c),serviceWorkerTime:Fe(c-w),decodedBodySize:Fe(r),encodedBodySize:Fe(a),cacheHitStatus:E(),renderBlockingStatus:Fe(h),protocol:l,initiatorType:u,visibilityState:document.visibilityState,ttfb:Fe(_-m),transferSize:Fe(v)};function E(){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 pU(e){let t;const n=new Promise(i=>{t=i});return new PerformanceObserver(i=>{var s;const[o]=i.getEntries();if(o==null||ic(o.name))return;const a=o.toJSON();let c=JS(a?.serverTiming);const u=(s=rc(Ku,_n.session))!==null&&s!==void 0?s:pt,d=Object.assign(Object.assign({},dU(a)),{faroNavigationId:Jn(),faroPreviousNavigationId:u});Md(Ku,d.faroNavigationId,_n.session),e("faro.performance.navigation",d,void 0,{spanContext:c,timestampOverwriteMs:performance.timeOrigin+a.startTime}),t(d)}).observe({type:oU,buffered:!0}),n}const hU={initiatorType:["xmlhttprequest","fetch"]};function mU(e,t,n){const r=we.config.trackResources;new PerformanceObserver(s=>{const o=s.getEntries();for(const a of o){if(ic(a.name))continue;n?.notify({type:Yu});const c=a.toJSON();let u=JS(c?.serverTiming);if(r==null&&lU(c,hU)||r){const d=Object.assign(Object.assign({},XS(c)),{faroNavigationId:e,faroResourceId:Jn()});t("faro.performance.resource",d,void 0,{spanContext:u,timestampOverwriteMs:performance.timeOrigin+c.startTime})}}}).observe({type:Yu,buffered:!0})}var gU=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 QS=new qe;class ZS extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-performance",this.version=lt}initialize(){if(!cU()){this.logDebug("performance observer not supported. Disable performance instrumentation.");return}uU(()=>gU(this,void 0,void 0,function*(){const t=this.api.pushEvent,{faroNavigationId:n}=yield pU(t);n!=null&&mU(n,t,QS)}))}}const _U="faroUserActionName",ev="data-faro-user-action-name";let no,Wc;function tv(){return no||(no=new qe),Wc||(Wc=new MutationObserver((e,t)=>{no.notify({type:R$})}),Wc.observe(document,{attributes:!0,childList:!0,subtree:!0,characterData:!0})),no}const zc="fetch",ro="xhr";let Dr,im=!1,qc,Gc;function nv(){if(Dr)return Dr;Dr=new qe;function e(n){Dr.notify({type:Fd,request:n})}function t(n){Dr.notify({type:$d,request:n})}return im||(bU({onRequestStart:e,onRequestEnd:t}),yU({onRequestStart:e,onRequestEnd:t}),im=!0),Dr}function yU({onRequestStart:e,onRequestEnd:t}){qc||(qc=XMLHttpRequest.prototype.open),XMLHttpRequest.prototype.open=function(){const n=arguments[1],r=ic(n),i=arguments[0],s=Jn();this.addEventListener("loadstart",function(){r||e({url:n,method:i,requestId:s,apiType:ro})}),this.addEventListener("load",function(){r||t({url:n,method:i,requestId:s,apiType:ro})}),this.addEventListener("error",function(){r||t({url:n,method:i,requestId:s,apiType:ro})}),this.addEventListener("abort",function(){r||t({url:n,method:i,requestId:s,apiType:ro})}),qc.apply(this,arguments)}}function bU({onRequestEnd:e,onRequestStart:t}){Gc||(Gc=window.fetch),window.fetch=function(){var n,r;const i=(n=CS(arguments[0]))!==null&&n!==void 0?n:"",s=ic(i),o=((r=arguments[1])!==null&&r!==void 0?r:{}).method,a=Jn();return s||t({url:i,method:o,requestId:a,apiType:zc}),Gc.apply(this,arguments).then(c=>(s||e({url:i,method:o,requestId:a,apiType:zc}),c)).catch(c=>{throw s||e({url:i,method:o,requestId:a,apiType:zc}),c})}}let io,sm=!1;function SU(){return io||(io=new qe),sm||(QS.subscribe(e=>{e.type===Yu&&io.notify({type:A$})}),sm=!0),io}function vU(e){const t=e.split("data-")[1],n=t?.replace(/-(.)/g,(r,i)=>i.toUpperCase());return n?.replace(/-/g,"")}function EU(e,t,n){return e&&clearTimeout(e),e=setTimeout(()=>{t()},n),e}function TU(e){return e.type===Fd}function Vc(e){return e.type===$d}const wU=100,IU=10*1e3;class kU{constructor(t){this.userAction=t,this.http=nv(),this.dom=tv(),this.perf=SU(),this.isValid=!1,this.runningRequests=new Map}attach(){this.allMonitorsSub=new qe().merge(this.http,this.dom,this.perf).takeWhile(()=>[ve.Started,ve.Halted].includes(this.userAction.getState())).filter(t=>!(this.userAction.getState()===ve.Halted&&!(Vc(t)&&this.runningRequests.has(t.request.requestId)))).subscribe(t=>{TU(t)&&this.runningRequests.set(t.request.requestId,t.request),Vc(t)&&this.runningRequests.delete(t.request.requestId),Vc(t)?this.userAction.getState()===ve.Halted&&this.runningRequests.size===0&&this.endAction():(this.isValid||(this.isValid=!0),this.scheduleFollowUp())}),this.stateSub=this.userAction.filter(t=>[ve.Ended,ve.Cancelled].includes(t)).first().subscribe(()=>this.cleanup()),this.scheduleFollowUp()}scheduleFollowUp(){this.clearTimer(this.followUpTid),this.followUpTid=setTimeout(()=>{if(this.userAction.getState()===ve.Started&&this.runningRequests.size>0){this.haltAction();return}if(this.isValid){this.endAction();return}this.cancelAction()},wU)}haltAction(){this.userAction.getState()===ve.Started&&(this.userAction.halt(),this.startHaltTimeout())}startHaltTimeout(){this.clearTimer(this.haltTid),this.haltTid=EU(this.haltTid,()=>{this.userAction.getState()===ve.Halted&&this.endAction()},IU)}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 AU(e){const{api:t,config:n}=e;function r(s){var o,a;const c=RU(s.target,(a=(o=n.userActionsInstrumentation)===null||o===void 0?void 0:o.dataAttributeName)!==null&&a!==void 0?a:_U);if(!c)return;const u=t.startUserAction(c,{},{triggerName:s.type});u&&i(u)}function i(s){const o=s;new kU(o).attach()}return{processUserEvent:r,processUserActionStarted:i}}function RU(e,t){const n=vU(t),r=e.dataset;for(const i in r)if(i===n)return r[i]}class rv extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-user-action",this.version=lt}initialize(){const{processUserEvent:t,processUserActionStarted:n}=AU(we);window.addEventListener("pointerdown",t),window.addEventListener("keydown",r=>{[" ","Enter"].includes(r.key)&&t(r)}),this._userActionSub=mS.subscribe(({type:r,userAction:i})=>{r==="user_action_start"&&n(i)})}destroy(){var t;(t=this._userActionSub)===null||t===void 0||t.unsubscribe()}}class iv extends Yt{constructor(){super(),this.name="@grafana/faro-web-sdk:instrumentation-csp",this.version=lt}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",Ri(n))}}function CU(e){return e.type===Fd}function xU(e){return e.type===$d}class OU extends qe{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=Date.now(),(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=Date.now(),this._lastEventTime=Date.now(),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=0;this.hasActiveOperations()?t=Date.now()-this._startTime:t=this._lastEventTime?this._lastEventTime-this._startTime:0,this.notify({message:"tracking-ended",events:this._currentEvents,duration:t})}_scheduleInactivityCheck(){this._inactivityTid=om(this._inactivityTid,()=>{this.hasActiveOperations()?this._startDrainTimeout():this.stopTracking()},this._options.inactivityMs)}_startDrainTimeout(){this._drainTid=om(this._drainTid,()=>{this.stopTracking()},this._options.drainTimeoutMs)}hasActiveOperations(){return!!this._activeOperations&&this._activeOperations.size>0}_clearTimer(t){t&&clearTimeout(t)}}function om(e,t,n){return e&&clearTimeout(e),e=setTimeout(()=>{t()},n),e}const MU="interaction";let so;const am=new Set,NU=new Map;function PU(e){return so||(so=new qe),e.forEach(t=>{if(!am.has(t)){const n=()=>{so.notify({type:MU,name:t})};window.addEventListener(t,n),am.add(t),NU.set(t,n)}}),so}const LU="url-change";let oo,Kc=!1,ao,Yc,Jc,cm,um,lm,Xc;function DU(){oo||(oo=new qe,ao=location.href);function e(t,n){const r=n??location.href;r!==ao&&(oo.notify({type:LU,from:ao,to:r,trigger:t}),ao=r)}if(!Kc)if("navigation"in window&&"NavigateEvent"in window){lm=r=>{try{const i=r?.destination;i?.sameDocument&&typeof i.url=="string"&&e("navigate",i.url)}catch{}},window.navigation.addEventListener("navigate",lm);const n=window.NavigateEvent;n&&n.prototype&&typeof n.prototype.intercept=="function"&&(Xc||(Xc=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 Xc.call(this,r)}),Kc=!0}else Yc||(Yc=window.history.pushState),window.history.pushState=function(...n){const r=Yc.apply(window.history,n);return e("pushState"),r},Jc||(Jc=window.history.replaceState),window.history.replaceState=function(...n){const r=Jc.apply(window.history,n);return e("replaceState"),r},cm=()=>e("popstate"),um=()=>e("hashchange"),window.addEventListener("popstate",cm),window.addEventListener("hashchange",um),Kc=!0;return oo}class sv extends Yt{constructor(){super(...arguments),this.name="@grafana/faro-web-sdk:instrumentation-navigation",this.version=lt}initialize(){const t=nv(),n=tv(),r=DU(),i=PU(["pointerdown","keydown"]),s=new OU(new qe().merge(t,n,r),{inactivityMs:100,drainTimeoutMs:10*1e3,isOperationStart:o=>CU(o)?o.request.requestId:void 0,isOperationEnd:o=>xU(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");we.api.pushEvent("faro.navigation",{fromUrl:d?.from,toUrl:d?.to,sameDocument:String(!0),duration:o.duration})}}),i.subscribe(()=>{s.startTracking()})}}function ov(e={}){const t=[new rv,new jS,new YS,new FS,new WS,new sv];return e.enablePerformanceInstrumentation!==!1&&t.unshift(new ZS),e.enableContentSecurityPolicyInstrumentation!==!1&&t.push(new iv),e.captureConsole!==!1&&t.push(new rn),t}const av="browser",FU=()=>{const e=window.k6;return{k6:Object.assign({isK6Browser:!0},e?.testRunId&&{testRunId:e?.testRunId})}};let dm,Qc;function $U({generatePageId:e,initialPageMeta:t}={}){return()=>{const r=location.href;return Cr(e)&&dm!==r&&(dm=r,Qc=e(location)),{page:Object.assign(Object.assign({url:r},Qc?{id:Qc}:{}),t)}}}class UU extends Cd{constructor(t={}){super(),this.options=t,this.name="@grafana/faro-web-sdk:transport-console",this.version=lt}send(t){var n;return this.unpatchedConsole[(n=this.options.level)!==null&&n!==void 0?n:Xe.DEBUG]("New event",xd([t]))}}var fm=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())})},BU=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=pS({size:(i=t.bufferSize)!==null&&i!==void 0?i:HU,concurrency:(s=t.concurrency)!==null&&s!==void 0?s:jU})}send(t){return fm(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(()=>{const n=JSON.stringify(xd(t)),{url:r,requestOptions:i,apiKey:s}=this.options,o=i??{},{headers:a={}}=o,c=BU(o,["headers"]);let u;const d=this.metas.value.session;d!=null&&(u=d.id);const l={};for(const[f,p]of Object.entries(a))l[f]=typeof p=="function"?p():p;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<=zU},c??{})).then(f=>fm(this,void 0,void 0,function*(){return f.status===GU&&f.headers.get("X-Faro-Session-Status")==="invalid"&&this.extendFaroSession(this.config,this.logDebug),f.status===qU&&(this.disabledUntil=this.getRetryAfterDate(f),this.logWarn(`Too many requests, backing off until ${this.disabledUntil}`)),f.text().catch(Bt),f})).catch(f=>{this.logError(`Failed sending payload to the receiver `,JSON.parse(n),f)})})}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}=DS(i);Dd({fetchUserSession:s,storeUserSession:o})({forceSessionExtend:!0}),n(`${r} created new session.`)}else n(`${r}.`)}}var VU=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 YU(e){var t,n;const{page:r,generatePageId:i}=(t=e?.pageTracking)!==null&&t!==void 0?t:{},s=[vS,$U({generatePageId:i,initialPageMeta:r}),...(n=e.metas)!==null&&n!==void 0?n:[]];return wt(window?.k6)?[...s,FU]:s}function JU({trackGeolocation:e,sessionTracking:t}){var n;const r={};return tS(e)&&(r.geoLocationTrackingEnabled=e),En(r)?{}:{session:Object.assign(Object.assign({},(n=t?.session)!==null&&n!==void 0?n:{}),{overrides:r})}}function XU(e){const t=uv(e);if(t)return m$(t)}const tB=Object.freeze(Object.defineProperty({__proto__:null,BaseExtension:Rd,BaseInstrumentation:Yt,BaseTransport:Cd,CSPInstrumentation:iv,ConsoleInstrumentation:rn,ConsoleTransport:UU,EVENT_CLICK:_$,EVENT_NAVIGATION:y$,EVENT_ROUTE_CHANGE:S$,EVENT_SESSION_EXTEND:SS,EVENT_SESSION_RESUME:Oo,EVENT_SESSION_START:Ui,EVENT_VIEW_CHANGED:bS,ErrorsInstrumentation:jS,FetchTransport:cv,get InternalLoggerLevel(){return en},get LogLevel(){return Xe},MAX_SESSION_PERSISTENCE_TIME:MS,NavigationInstrumentation:sv,Observable:qe,PerformanceInstrumentation:ZS,PersistentSessionsManager:gt,SESSION_EXPIRATION_TIME:xS,SESSION_INACTIVITY_TIME:Pd,STORAGE_KEY:pr,SessionInstrumentation:FS,get TransportItemType(){return Ue},UserActionInstrumentation:rv,get UserActionState(){return ve},VERSION:lt,ViewInstrumentation:WS,VolatileSessionsManager:Rt,WebVitalsInstrumentation:YS,allLogLevels:fS,browserMeta:vS,buildStackFrame:Ud,createInternalLogger:Ad,createPromiseBuffer:pS,createSession:ES,deepEqual:gn,defaultEventDomain:av,defaultExceptionType:Od,defaultGlobalObjectKey:yS,defaultInternalLoggerLevel:kd,defaultLogLevel:dS,get faro(){return we},genShortID:Jn,getCurrentTimestamp:Os,getDataFromSafariExtensions:Wu,getIgnoreUrls:RS,getInternalFaroFromGlobalObject:p$,getStackFramesFromError:ha,getTransportBody:xd,getUrlFromResource:CS,getWebInstrumentations:ov,globalObject:ln,initializeFaro:XU,internalGlobalObjectKey:nc,isArray:ui,isBoolean:tS,isDomError:aS,isDomException:cS,isElement:LF,isElementDefined:uS,isEmpty:En,isError:Za,isErrorDefined:sS,isErrorEvent:oS,isEvent:iS,isEventDefined:rS,isFunction:Cr,isInstanceOf:xs,isInt:OF,isInternalFaroOnGlobalObject:_S,isMap:DF,isMapDefined:lS,isNull:ki,isNumber:wd,isObject:wt,isPrimitive:nS,isRegExp:NF,isString:Ai,isSymbol:MF,isSyntheticEvent:FF,isThenable:PF,isToString:Ii,isTypeof:Tt,isUndefined:xF,makeCoreConfig:uv,noop:Bt,parseStacktrace:US,sdkMeta:w$,setInternalFaroOnGlobalObject:gS,transportItemTypeToBodyKey:eS,unknownString:pt,userActionDataAttribute:ev},Symbol.toStringTag,{value:"Module"}));export{eB as a,Ei as b,Ie as c,tB as d,pD as i,OP as r}; //# sourceMappingURL=vendor-observability-DZmngUBG.js.map