@spotlightjs/spotlight 2.10.2 → 2.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,14 +122,14 @@ ${JSON.stringify(i,void 0,2)}`)}}}const y6=/^\s+/u;function b6(e,t,n){return v6(
122
122
  `);let n=[];for(let r=0;r<t.length;r++){if(t[r].match(/^\s*SELECT/i)){let a=[];if(t[r].match(/.*,$/))a=[t[r]];else{if(n.push(t[r]),t[r].match(/^\s*SELECT\s+.+(?!,$)/i))continue;a.push(t[++r])}for(;t[r++].match(/.*,$/);)a.push(t[r]);const s=a.map(o=>({line:o,matches:o.match(/(^.*?\S) (AS )?(\S+,?$)/i)})).map(({line:o,matches:l})=>l?{precedingText:l[1],as:l[2],alias:l[3]}:{precedingText:o}),i=_g(s.map(({precedingText:o})=>o.replace(/\s*,\s*$/,"")));a=s.map(({precedingText:o,as:l,alias:u})=>o+(u?" ".repeat(i-o.length+1)+(l??"")+u:"")),n=[...n,...a]}n.push(t[r])}return n.join(`
123
123
  `)}let X;(function(e){e[e.SPACE=0]="SPACE",e[e.NO_SPACE=1]="NO_SPACE",e[e.NO_NEWLINE=2]="NO_NEWLINE",e[e.NEWLINE=3]="NEWLINE",e[e.MANDATORY_NEWLINE=4]="MANDATORY_NEWLINE",e[e.INDENT=5]="INDENT",e[e.SINGLE_INDENT=6]="SINGLE_INDENT"})(X||(X={}));class vg{constructor(t){dt(this,"items",[]),this.indentation=t}add(...t){for(const n of t)switch(n){case X.SPACE:this.items.push(X.SPACE);break;case X.NO_SPACE:this.trimHorizontalWhitespace();break;case X.NO_NEWLINE:this.trimWhitespace();break;case X.NEWLINE:this.trimHorizontalWhitespace(),this.addNewline(X.NEWLINE);break;case X.MANDATORY_NEWLINE:this.trimHorizontalWhitespace(),this.addNewline(X.MANDATORY_NEWLINE);break;case X.INDENT:this.addIndentation();break;case X.SINGLE_INDENT:this.items.push(X.SINGLE_INDENT);break;default:this.items.push(n)}}trimHorizontalWhitespace(){for(;G6(rl(this.items));)this.items.pop()}trimWhitespace(){for(;F6(rl(this.items));)this.items.pop()}addNewline(t){if(this.items.length>0)switch(rl(this.items)){case X.NEWLINE:this.items.pop(),this.items.push(t);break;case X.MANDATORY_NEWLINE:break;default:this.items.push(t);break}}addIndentation(){for(let t=0;t<this.indentation.getLevel();t++)this.items.push(X.SINGLE_INDENT)}toString(){return this.items.map(t=>this.itemToString(t)).join("")}getLayoutItems(){return this.items}itemToString(t){switch(t){case X.SPACE:return" ";case X.NEWLINE:case X.MANDATORY_NEWLINE:return`
124
124
  `;case X.SINGLE_INDENT:return this.indentation.getSingleIndent();default:return t}}}const G6=e=>e===X.SPACE||e===X.SINGLE_INDENT,F6=e=>e===X.SPACE||e===X.SINGLE_INDENT||e===X.NEWLINE;function B6(e,t){if(t==="standard")return e;let n=[];return e.length>=10&&e.includes(" ")&&([e,...n]=e.split(" ")),t==="tabularLeft"?e=e.padEnd(9," "):e=e.padStart(9," "),e+["",...n].join(" ")}function H6(e){return TM(e)||e===J.RESERVED_CLAUSE||e===J.RESERVED_SELECT||e===J.RESERVED_SET_OPERATION||e===J.RESERVED_JOIN||e===J.LIMIT}const pp="top-level",Y6="block-level";class Mg{constructor(t){dt(this,"indentTypes",[]),this.indent=t}getSingleIndent(){return this.indent}getLevel(){return this.indentTypes.length}increaseTopLevel(){this.indentTypes.push(pp)}increaseBlockLevel(){this.indentTypes.push(Y6)}decreaseTopLevel(){this.indentTypes.length>0&&rl(this.indentTypes)===pp&&this.indentTypes.pop()}decreaseBlockLevel(){for(;this.indentTypes.length>0&&this.indentTypes.pop()===pp;);}}class V6 extends vg{constructor(t){super(new Mg("")),dt(this,"length",0),dt(this,"trailingSpace",!1),this.expressionWidth=t}add(...t){if(t.forEach(n=>this.addToLength(n)),this.length>this.expressionWidth)throw new nT;super.add(...t)}addToLength(t){if(typeof t=="string")this.length+=t.length,this.trailingSpace=!1;else{if(t===X.MANDATORY_NEWLINE||t===X.NEWLINE)throw new nT;t===X.INDENT||t===X.SINGLE_INDENT||t===X.SPACE?this.trailingSpace||(this.length++,this.trailingSpace=!0):(t===X.NO_NEWLINE||t===X.NO_SPACE)&&this.trailingSpace&&(this.trailingSpace=!1,this.length--)}}}class nT extends Error{}class rE{constructor({cfg:t,dialectCfg:n,params:r,layout:a,inline:s=!1}){dt(this,"inline",!1),dt(this,"nodes",[]),dt(this,"index",-1),this.cfg=t,this.dialectCfg=n,this.inline=s,this.params=r,this.layout=a}format(t){for(this.nodes=t,this.index=0;this.index<this.nodes.length;this.index++)this.formatNode(this.nodes[this.index]);return this.layout}formatNode(t){this.formatComments(t.leadingComments),this.formatNodeWithoutComments(t),this.formatComments(t.trailingComments)}formatNodeWithoutComments(t){switch(t.type){case ce.function_call:return this.formatFunctionCall(t);case ce.array_subscript:return this.formatArraySubscript(t);case ce.property_access:return this.formatPropertyAccess(t);case ce.parenthesis:return this.formatParenthesis(t);case ce.between_predicate:return this.formatBetweenPredicate(t);case ce.case_expression:return this.formatCaseExpression(t);case ce.case_when:return this.formatCaseWhen(t);case ce.case_else:return this.formatCaseElse(t);case ce.clause:return this.formatClause(t);case ce.set_operation:return this.formatSetOperation(t);case ce.limit_clause:return this.formatLimitClause(t);case ce.all_columns_asterisk:return this.formatAllColumnsAsterisk(t);case ce.literal:return this.formatLiteral(t);case ce.identifier:return this.formatIdentifier(t);case ce.parameter:return this.formatParameter(t);case ce.operator:return this.formatOperator(t);case ce.comma:return this.formatComma(t);case ce.line_comment:return this.formatLineComment(t);case ce.block_comment:return this.formatBlockComment(t);case ce.keyword:return this.formatKeywordNode(t)}}formatFunctionCall(t){this.withComments(t.nameKw,()=>{this.layout.add(this.showKw(t.nameKw))}),this.formatNode(t.parenthesis)}formatArraySubscript(t){this.withComments(t.array,()=>{this.layout.add(t.array.type===ce.keyword?this.showKw(t.array):t.array.text)}),this.formatNode(t.parenthesis)}formatPropertyAccess(t){this.formatNode(t.object),this.layout.add(X.NO_SPACE,"."),this.formatNode(t.property)}formatParenthesis(t){const n=this.formatInlineExpression(t.children);n?(this.layout.add(t.openParen),this.layout.add(...n.getLayoutItems()),this.layout.add(X.NO_SPACE,t.closeParen,X.SPACE)):(this.layout.add(t.openParen,X.NEWLINE),Go(this.cfg)?(this.layout.add(X.INDENT),this.layout=this.formatSubExpression(t.children)):(this.layout.indentation.increaseBlockLevel(),this.layout.add(X.INDENT),this.layout=this.formatSubExpression(t.children),this.layout.indentation.decreaseBlockLevel()),this.layout.add(X.NEWLINE,X.INDENT,t.closeParen,X.SPACE))}formatBetweenPredicate(t){this.layout.add(this.showKw(t.betweenKw),X.SPACE),this.layout=this.formatSubExpression(t.expr1),this.layout.add(X.NO_SPACE,X.SPACE,this.showNonTabularKw(t.andKw),X.SPACE),this.layout=this.formatSubExpression(t.expr2),this.layout.add(X.SPACE)}formatCaseExpression(t){this.formatNode(t.caseKw),this.layout.indentation.increaseBlockLevel(),this.layout=this.formatSubExpression(t.expr),this.layout=this.formatSubExpression(t.clauses),this.layout.indentation.decreaseBlockLevel(),this.layout.add(X.NEWLINE,X.INDENT),this.formatNode(t.endKw)}formatCaseWhen(t){this.layout.add(X.NEWLINE,X.INDENT),this.formatNode(t.whenKw),this.layout=this.formatSubExpression(t.condition),this.formatNode(t.thenKw),this.layout=this.formatSubExpression(t.result)}formatCaseElse(t){this.layout.add(X.NEWLINE,X.INDENT),this.formatNode(t.elseKw),this.layout=this.formatSubExpression(t.result)}formatClause(t){this.isOnelineClause(t)?this.formatClauseInOnelineStyle(t):Go(this.cfg)?this.formatClauseInTabularStyle(t):this.formatClauseInIndentedStyle(t)}isOnelineClause(t){return this.dialectCfg.onelineClauses[t.nameKw.text]}formatClauseInIndentedStyle(t){this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t.nameKw),X.NEWLINE),this.layout.indentation.increaseTopLevel(),this.layout.add(X.INDENT),this.layout=this.formatSubExpression(t.children),this.layout.indentation.decreaseTopLevel()}formatClauseInOnelineStyle(t){this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t.nameKw),X.SPACE),this.layout=this.formatSubExpression(t.children)}formatClauseInTabularStyle(t){this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t.nameKw),X.SPACE),this.layout.indentation.increaseTopLevel(),this.layout=this.formatSubExpression(t.children),this.layout.indentation.decreaseTopLevel()}formatSetOperation(t){this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t.nameKw),X.NEWLINE),this.layout.add(X.INDENT),this.layout=this.formatSubExpression(t.children)}formatLimitClause(t){this.withComments(t.limitKw,()=>{this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t.limitKw))}),this.layout.indentation.increaseTopLevel(),Go(this.cfg)?this.layout.add(X.SPACE):this.layout.add(X.NEWLINE,X.INDENT),t.offset?(this.layout=this.formatSubExpression(t.offset),this.layout.add(X.NO_SPACE,",",X.SPACE),this.layout=this.formatSubExpression(t.count)):this.layout=this.formatSubExpression(t.count),this.layout.indentation.decreaseTopLevel()}formatAllColumnsAsterisk(t){this.layout.add("*",X.SPACE)}formatLiteral(t){this.layout.add(t.text,X.SPACE)}formatIdentifier(t){this.layout.add(t.text,X.SPACE)}formatParameter(t){this.layout.add(this.params.get(t),X.SPACE)}formatOperator({text:t}){this.cfg.denseOperators||this.dialectCfg.alwaysDenseOperators.includes(t)?this.layout.add(X.NO_SPACE,t):t===":"?this.layout.add(X.NO_SPACE,t,X.SPACE):this.layout.add(t,X.SPACE)}formatComma(t){this.inline?this.layout.add(X.NO_SPACE,",",X.SPACE):this.layout.add(X.NO_SPACE,",",X.NEWLINE,X.INDENT)}withComments(t,n){this.formatComments(t.leadingComments),n(),this.formatComments(t.trailingComments)}formatComments(t){t&&t.forEach(n=>{n.type===ce.line_comment?this.formatLineComment(n):this.formatBlockComment(n)})}formatLineComment(t){cp(t.precedingWhitespace||"")?this.layout.add(X.NEWLINE,X.INDENT,t.text,X.MANDATORY_NEWLINE,X.INDENT):this.layout.getLayoutItems().length>0?this.layout.add(X.NO_NEWLINE,X.SPACE,t.text,X.MANDATORY_NEWLINE,X.INDENT):this.layout.add(t.text,X.MANDATORY_NEWLINE,X.INDENT)}formatBlockComment(t){this.isMultilineBlockComment(t)?(this.splitBlockComment(t.text).forEach(n=>{this.layout.add(X.NEWLINE,X.INDENT,n)}),this.layout.add(X.NEWLINE,X.INDENT)):this.layout.add(t.text,X.SPACE)}isMultilineBlockComment(t){return cp(t.text)||cp(t.precedingWhitespace||"")}isDocComment(t){const n=t.split(/\n/);return/^\/\*\*?$/.test(n[0])&&n.slice(1,n.length-1).every(r=>/^\s*\*/.test(r))&&/^\s*\*\/$/.test(rl(n))}splitBlockComment(t){return this.isDocComment(t)?t.split(/\n/).map(n=>/^\s*\*/.test(n)?" "+n.replace(/^\s*/,""):n):t.split(/\n/).map(n=>n.replace(/^\s*/,""))}formatSubExpression(t){return new rE({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:this.layout,inline:this.inline}).format(t)}formatInlineExpression(t){const n=this.params.getPositionalParameterIndex();try{return new rE({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:new V6(this.cfg.expressionWidth),inline:!0}).format(t)}catch(r){if(r instanceof nT){this.params.setPositionalParameterIndex(n);return}else throw r}}formatKeywordNode(t){switch(t.tokenType){case J.RESERVED_JOIN:return this.formatJoin(t);case J.AND:case J.OR:case J.XOR:return this.formatLogicalOperator(t);default:return this.formatKeyword(t)}}formatJoin(t){Go(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t),X.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t),X.SPACE)}formatKeyword(t){this.layout.add(this.showKw(t),X.SPACE)}formatLogicalOperator(t){this.cfg.logicalOperatorNewline==="before"?Go(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t),X.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add(X.NEWLINE,X.INDENT,this.showKw(t),X.SPACE):this.layout.add(this.showKw(t),X.NEWLINE,X.INDENT)}showKw(t){return H6(t.tokenType)?B6(this.showNonTabularKw(t),this.cfg.indentStyle):this.showNonTabularKw(t)}showNonTabularKw(t){switch(this.cfg.keywordCase){case"preserve":return Ng(t.raw);case"upper":return t.text;case"lower":return t.text.toLowerCase()}}}class W6{constructor(t,n){this.dialect=t,this.cfg=n,this.params=new d6(this.cfg.params)}format(t){const n=this.parse(t),r=this.formatAst(n);return this.postFormat(r).trimEnd()}parse(t){return L6(this.dialect.tokenizer).parse(t,this.cfg.paramTypes||{})}formatAst(t){return t.map(n=>this.formatStatement(n)).join(`
125
- `.repeat(this.cfg.linesBetweenQueries+1))}formatStatement(t){const n=new rE({cfg:this.cfg,dialectCfg:this.dialect.formatOptions,params:this.params,layout:new vg(new Mg(Pm(this.cfg)))}).format(t.children);return t.hasSemicolon&&(this.cfg.newlineBeforeSemicolon?n.add(X.NEWLINE,";"):n.add(X.NO_NEWLINE,";")),n.toString()}postFormat(t){return this.cfg.tabulateAlias&&(t=k6(t)),(this.cfg.commaPosition==="before"||this.cfg.commaPosition==="tabular")&&(t=b6(t,this.cfg.commaPosition,Pm(this.cfg))),t}}class Ns extends Error{}function j6(e){if("multilineLists"in e)throw new Ns("multilineLists config is no more supported.");if("newlineBeforeOpenParen"in e)throw new Ns("newlineBeforeOpenParen config is no more supported.");if("newlineBeforeCloseParen"in e)throw new Ns("newlineBeforeCloseParen config is no more supported.");if("aliasAs"in e)throw new Ns("aliasAs config is no more supported.");if(e.expressionWidth<=0)throw new Ns(`expressionWidth config must be positive number. Received ${e.expressionWidth} instead.`);if(e.commaPosition==="before"&&e.useTabs)throw new Ns("commaPosition: before does not work when tabs are used for indentation.");return e.params&&!X6(e.params)&&console.warn('WARNING: All "params" option values should be strings.'),e}function X6(e){return(e instanceof Array?e:Object.values(e)).every(t=>typeof t=="string")}const Pg={bigquery:"bigquery",db2:"db2",hive:"hive",mariadb:"mariadb",mysql:"mysql",n1ql:"n1ql",plsql:"plsql",postgresql:"postgresql",redshift:"redshift",spark:"spark",sqlite:"sqlite",sql:"sql",trino:"trino",transactsql:"transactsql",tsql:"transactsql",singlestoredb:"singlestoredb",snowflake:"snowflake"},K6=Object.keys(Pg),z6={tabWidth:2,useTabs:!1,keywordCase:"preserve",indentStyle:"standard",logicalOperatorNewline:"before",tabulateAlias:!1,commaPosition:"after",expressionWidth:50,linesBetweenQueries:1,denseOperators:!1,newlineBeforeSemicolon:!1},q6=(e,t={})=>{if(typeof t.language=="string"&&!K6.includes(t.language))throw new Ns(`Unsupported SQL dialect: ${t.language}`);const n=Pg[t.language||"sql"];return J6(e,{...t,dialect:zD[n]})},J6=(e,{dialect:t,...n})=>{if(typeof e!="string")throw new Error("Invalid query argument. Expected string, instead got "+typeof e);const r=j6({...z6,...n});return new W6(u6(t),r).format(e)},Dg=/^db(\.[A-Za-z]+)?$/,wr={avgDuration:"AVG_DURATION",timeSpent:"TIME_SPENT",description:"DESC",avgEncodedSize:"AVG_ENCODED_SIZE"},Z6=[{id:"description",title:"Resource Description",sortKey:wr.description,primary:!0},{id:"avgDuration",title:"Avg Duration",sortKey:wr.avgDuration},{id:"timeSpent",title:"Time Spent",sortKey:wr.timeSpent},{id:"avgEncodedSize",title:"Avg Encoded Size",sortKey:wr.avgEncodedSize}],za={queryDesc:"QUERY_DESCRIPTION",timeSpent:"TIME_SPENT",avgDuration:"AVG_DURATION"},Q6=[{id:"queryDesc",title:"Query Description",sortKey:za.queryDesc,primary:!0},{id:"avgDuration",title:"Avg Duration",sortKey:za.avgDuration},{id:"timeSpent",title:"Time Spent",sortKey:za.timeSpent}],Ci={count:"count",lastSeen:"lastSeen"},$6=[{id:"transaction",title:"Transaction",primary:!0},{id:"lastSeen",title:"Last Seen",sortKey:Ci.lastSeen},{id:"count",title:"Count",sortKey:Ci.count}],gi={timestamp:"timestamp",duration:"duration"},e8=[{id:"eventId",title:"Event Id",primary:!0},{id:"toalDuration",title:"Total Duration",sortKey:gi.duration},{id:"timestamp",title:"Timestamp",sortKey:gi.timestamp},{id:"traceId",title:"Trace Id"}],qa={foundIn:"FOUND_IN",spanId:"SPAN_ID",timeSpent:"TIME_SPENT"},t8=[{id:"foundIn",title:"Found In",sortKey:qa.foundIn,primary:!0},{id:"spanId",title:"Span Id",sortKey:qa.spanId},{id:"timeSpent",title:"Time Spent",sortKey:qa.timeSpent}],an={pages:"Pages",lcp:"LCP",fcp:"FCP",fid:"FID",cls:"CLS",ttfb:"TTFB",score:"PERFORMANCE_TOTAL_SCORE"},n8=[{id:"pages",title:"Pages",sortKey:an.pages,primary:!0},{id:"lcp",title:"LCP",sortKey:an.lcp},{id:"fcp",title:"FCP",sortKey:an.fcp},{id:"fid",title:"FID",sortKey:an.fid},{id:"cls",title:"CLS",sortKey:an.cls},{id:"ttfb",title:"TTFB",sortKey:an.ttfb},{id:"score",title:"Perf Score",sortKey:an.score}],xg={profiles:[{name:"Chrome",scoreComponents:[{measurement:"fcp",weight:.15,p10:900,p50:1600,optional:!1},{measurement:"lcp",weight:.3,p10:1200,p50:2400,optional:!1},{measurement:"fid",weight:.3,p10:100,p50:300,optional:!0},{measurement:"cls",weight:.15,p10:.1,p50:.25,optional:!1},{measurement:"ttfb",weight:.1,p10:200,p50:400,optional:!1}],condition:{op:"eq",name:"event.contexts.browser.name",value:"Chrome"}}]};function wg(e,t=2){if(e==0)return"0 B";const n=1024,r=t,a=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,s)).toFixed(r))+" "+a[s]}const Ug=({title:e,titleId:t,...n})=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",className:"bi bi-chevron-down",viewBox:"0 0 16 16","aria-labelledby":t,...n},e?b.createElement("title",{id:t},e):null,b.createElement("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"}));function r8({handleResize:e,isResizing:t,setIsResizing:n,...r}){const[a,s]=b.useState(!1),i=u=>{u.target instanceof HTMLDivElement&&e(u)},o=u=>{u.preventDefault(),s(!0),n(!0),document.addEventListener("mousemove",i),document.addEventListener("mouseup",l)},l=()=>{n(!1),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l)};return A.jsx("div",{className:Se("resizer","absolute left-0 top-0 h-full w-1 cursor-col-resize rounded-sm p-0.5 transition-colors",a||t?"bg-primary-600 translate-x-[-2px] transform":""),onClick:u=>u.preventDefault(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onMouseOver:()=>s(!0),onMouseDown:o,...r})}const a8=({span:e,startTimestamp:t,totalDuration:n,depth:r=1,traceContext:a,totalTransactions:s=0,spanNodeWidth:i,setSpanNodeWidth:o=()=>{},query:l})=>{var u,c;const{spanId:E}=cs(),f=b.useRef(null),[S,_]=b.useState(e.transaction&&s>1&&r!==1||r>=15),[C,I]=b.useState(!1),d=vl(e.start_timestamp,e.timestamp),p=h=>{if(f.current){const O=f.current.getBoundingClientRect(),T=(h.clientX-O.left)/O.width*100;o(T)}},m=l?e.span_id.includes(l)||((u=e.op)==null?void 0:u.includes(l))||((c=e.description)==null?void 0:c.includes(l)):!1;return A.jsxs("li",{className:"pl-4",ref:f,children:[A.jsxs(Jt,{className:Se("hover:bg-primary-900 group flex text-sm",m?"bg-primary-200 bg-opacity-20":"",E===e.span_id?"bg-primary-900":""),style:{pointerEvents:C?"none":"auto"},to:`/explore/traces/${e.trace_id}/spans/${e.span_id}`,children:[A.jsxs("div",{className:Se("node group-hover:bg-primary-900",m?"bg-transparent":"",e.status&&e.status!=="ok"?"text-red-400":"",E===e.span_id?"bg-primary-900":"bg-primary-950"),style:{width:`${i}%`},children:[(e.children||[]).length>0&&A.jsxs("div",{className:"bg-primary-600 z-10 mr-1 flex items-center gap-1 rounded-lg px-1 text-xs font-bold text-white",onClick:h=>{h.preventDefault(),_(O=>!O)},children:[(e.children||[]).length,A.jsx(Ug,{width:12,height:12,className:Se("transition",S?"rotate-0":"rotate-180")})]}),e.transaction&&A.jsx(Ka,{size:16,platform:e.transaction.platform}),e.op&&A.jsxs(A.Fragment,{children:[A.jsx("span",{className:"font-bold",children:e.op}),A.jsx("span",{className:"text-primary-400",children:"–"})]}),A.jsx("span",{className:"block truncate",title:e.description||e.span_id,children:e.description||e.span_id})]}),A.jsxs("div",{className:Se("waterfall",m?"!bg-transparent":""),style:{left:`${i}%`},children:[A.jsx(r8,{setIsResizing:I,isResizing:C,handleResize:p}),A.jsx("div",{className:"bg-primary-900 absolute -m-0.5 w-full p-0.5",style:{left:`calc(min(${(e.start_timestamp-t)/n*100}%, 95% - 1px) + 4px)`,width:`max(1px, ${d/n*95}%)`},children:A.jsxs("span",{className:Se("whitespace-nowrap",fM(d)),children:[d.toLocaleString()," ms"]})})]})]}),!S&&A.jsx(jh,{traceContext:a,tree:e.children||[],startTimestamp:t,totalDuration:n,depth:r+1,totalTransactions:s,spanNodeWidth:i,setSpanNodeWidth:o,query:l})]},e.span_id)};function jh({traceContext:e,tree:t,startTimestamp:n,totalDuration:r,depth:a=1,totalTransactions:s,spanNodeWidth:i,setSpanNodeWidth:o,query:l}){return!t||!t.length?null:A.jsx("ul",{className:"tree",children:t.map(u=>A.jsx(a8,{traceContext:e,depth:a,span:u,totalTransactions:s,startTimestamp:n,totalDuration:r,spanNodeWidth:i,setSpanNodeWidth:o,query:l},u.span_id))})}function s8({desc:e,dbType:t}){if(e.startsWith("{")||t==="mongodb")try{return A.jsx(Gi,{data:JSON.parse(e)})}catch{}let n=e;if(e.match(/^(SELECT|INSERT|UPDATE|DELETE|TRUNCATE|ALTER) /i))try{n=q6(e.replace(/([\s,(])(%[a-z])([\s,)])/gim,"$1?$3"),{language:t||"sql"})}catch(r){console.error(r)}return A.jsx("pre",{className:"text-primary-300 whitespace-pre-wrap break-words font-mono text-sm",children:n})}function i8(e,t){return typeof t=="number"?e.indexOf("size")!==-1||e.indexOf("length")!==-1?wg(t):t.toLocaleString():`${t}`}function o8({span:e}){var t,n;let r=null,a=null;return e.op&&Dg.test(e.op)&&e.description?(a="Query",r=A.jsx(s8,{desc:e.description,dbType:(t=e.data)==null?void 0:t["db.system"]})):e.op==="resource.img"&&((n=e.description)==null?void 0:n.indexOf("/"))===0?(a="Preview",r=A.jsx("a",{href:e.description,className:"border-primary-950 hover:border-primary-700 -m-2 inline-block max-w-sm cursor-pointer rounded border p-1",children:A.jsx("img",{src:e.description,alt:"preview",style:{maxHeight:300}})})):e.description?(a="Description",r=A.jsx("pre",{className:"text-primary-300 whitespace-pre-wrap break-words font-mono text-sm",children:e.description})):r=A.jsx("div",{className:"text-primary-300",children:"No description recorded for this span."}),A.jsxs("div",{children:[a&&A.jsx("h2",{className:"mb-2 font-bold uppercase",children:a}),r]})}function l8({traceContext:e,span:t,startTimestamp:n,totalDuration:r,totalTransactions:a}){var s;const[i,o]=b.useState(50),l=vl(t.start_timestamp,t.timestamp),u=tt.getEventsByTrace(t.trace_id).filter(c=>c.type!=="transaction"&&"exception"in c);return A.jsxs(fg,{backto:`/explore/traces/${t.trace_id}`,children:[A.jsx(pg,{title:"Span Details",subtitle:A.jsxs(A.Fragment,{children:[t.op&&A.jsxs(A.Fragment,{children:[t.op," ",A.jsx("span",{className:"text-primary-500",children:"—"})," "]}),t.span_id]}),backto:`/explore/traces/${t.trace_id}`}),A.jsxs("div",{className:"space-y-6",children:[A.jsx("div",{children:A.jsxs("div",{className:"flex flex-col space-y-4",children:[A.jsxs("div",{className:"text-primary-300 flex flex-1 items-center gap-x-1",children:[A.jsx(JE,{date:t.start_timestamp}),A.jsx("span",{children:"—"}),A.jsxs("span",{children:[A.jsxs("strong",{children:[vl(n,t.start_timestamp)," ms"]})," into trace"]})]}),A.jsx("div",{className:"flex-1",children:A.jsx("div",{className:"border-primary-800 relative h-8 border py-1",children:A.jsx("div",{className:"bg-primary-800 absolute bottom-0 top-0 -m-0.5 flex w-full items-center p-0.5",style:{left:`min(${(t.start_timestamp-n)/r*100}%, 100% - 1px)`,width:`max(1px, ${l/r*100}%)`},children:A.jsxs("span",{className:"whitespace-nowrap",children:[l," ms"]})})})})]})}),u.length>0&&A.jsxs("div",{className:"flex flex-col items-start",children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Related Errors"}),u.map(c=>A.jsx(Jt,{className:"cursor-pointer underline",to:`/errors/${c.event_id}`,children:A.jsx(ag,{event:c})},c.event_id))]}),A.jsx(o8,{span:t}),A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Tags"}),t.tags&&Object.keys(t.tags).length?A.jsx("table",{className:"w-full text-sm",children:A.jsx("tbody",{children:Object.entries(t.tags).map(([c,E])=>A.jsxs("tr",{className:"text-primary-300",children:[A.jsx("th",{className:" w-1/12 py-0.5 pr-4 text-left font-mono font-normal",children:A.jsx("div",{className:"w-full truncate",children:c})}),A.jsx("td",{className:"py-0.5",children:A.jsx("pre",{className:"whitespace-nowrap font-mono",children:JSON.stringify(E,void 0,2)})})]},c))})}):A.jsx("div",{className:"text-primary-300",children:"No tags recorded for this span."})]}),A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Context"}),A.jsx("table",{className:"w-full text-sm",children:A.jsx("tbody",{children:[["status",t.status||""],["trace",t.trace_id],["span",t.span_id],["parent",t.parent_span_id?A.jsx(Jt,{className:"underline",to:`/explore/traces/${t.trace_id}/spans/${t.parent_span_id}`,children:t.parent_span_id},`link-to-${t.parent_span_id}`):""],["op",t.op]].map(([c,E])=>A.jsxs("tr",{className:"text-primary-300",children:[A.jsx("th",{className:" w-1/12 py-0.5 pr-4 text-left font-mono font-normal",children:A.jsx("div",{className:"w-full truncate",children:c})}),A.jsx("td",{className:"py-0.5",children:A.jsx("pre",{className:"whitespace-nowrap font-mono",children:E})})]},c))})})]}),t.data&&A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Data"}),A.jsx("table",{className:"w-full text-sm",children:A.jsx("tbody",{children:Object.entries(t.data).map(([c,E])=>A.jsxs("tr",{className:"text-primary-300",children:[A.jsx("th",{className:" w-1/12 py-0.5 pr-4 text-left font-mono font-normal",children:A.jsx("div",{className:"w-full truncate",children:c})}),A.jsx("td",{className:"py-0.5",children:A.jsx("pre",{className:"whitespace-nowrap font-mono",children:i8(c,E)})})]},c))})})]}),(((s=t.children)==null?void 0:s.length)??0)>0&&A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Sub-tree"}),A.jsx(jh,{traceContext:e,tree:[t],startTimestamp:n,totalDuration:r,totalTransactions:a,spanNodeWidth:i,setSpanNodeWidth:o})]})]})]})}const u8=50;function Dm({traceId:e}){const{spanId:t}=cs(),[n,r]=b.useState(u8),a=tt.getTraceById(e),s=t?tt.getSpanById(e,t):void 0,i=a.start_timestamp,o=a.timestamp-i;return A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"px-6 py-4",children:A.jsxs("div",{className:"text-primary-300 flex flex-1 items-center gap-x-1",children:[A.jsx("div",{className:"text-primary-200",children:A.jsx(JE,{date:a.start_timestamp})}),A.jsx("span",{children:"—"}),A.jsxs("span",{children:[A.jsxs("strong",{className:"text-primary-200 font-bold",children:[vl(a.start_timestamp,a.timestamp).toLocaleString()," ms"]})," ","recorded in"," ",A.jsxs("strong",{className:"text-primary-200 font-bold",children:[a.spans.length.toLocaleString()," spans"]})]})]})}),A.jsx("div",{className:"flex-1 px-2 pb-6",children:A.jsx(jh,{traceContext:a,tree:a.spanTree,startTimestamp:i,totalDuration:o,totalTransactions:(a.transactions||[]).length,spanNodeWidth:n,setSpanNodeWidth:r})}),s?A.jsx(l8,{traceContext:a,startTimestamp:i,totalDuration:o,span:s,totalTransactions:(a.transactions||[]).length}):null]})}function c8(){const{traceId:e}=cs(),t=ni(e),n=Ta();if(!e)return A.jsx("p",{className:"text-primary-300 p-6",children:"Unknown trace id"});const r=tt.getTraceById(e);if(!r)return A.jsxs("p",{className:"text-primary-300 p-6",children:["Trace not found. Check for more"," ",A.jsx(Jt,{to:"/traces",className:"underline",children:"traces"})]});const a=t.filter(i=>{var o,l,u,c;return i.type!=="transaction"&&((l=(o=i.contexts)==null?void 0:o.trace)!=null&&l.trace_id?n.isLocalToSession((c=(u=i.contexts)==null?void 0:u.trace)==null?void 0:c.trace_id):null)!==!1}).length,s=[ar("details","Details"),ar("context","Context"),ar("errors","Errors",{notificationCount:{count:a,severe:a>0}})];return A.jsxs(A.Fragment,{children:[A.jsx(pM,{trace:r}),A.jsx(Xl,{tabs:s,nested:!0}),A.jsxs(jn,{children:[A.jsx(we,{path:"details",element:A.jsx(Dm,{traceId:e})}),A.jsx(we,{path:"spans/:spanId",element:A.jsx(Dm,{traceId:e})}),A.jsx(we,{path:"context",element:A.jsx(cg,{event:r.rootTransaction||r.transactions[0]})}),A.jsx(we,{path:"errors",element:A.jsx(dg,{traceId:e})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:`/explore/traces/${e}/details`,replace:!0})})]})]})}const E8=()=>(b.useContext(ti),tt.getTraces());function d8(){const e=E8(),t=Ta(),n=To(),[r,a]=b.useState(!n.experiments["sentry:focus-local-events"]),s=r?e:e.filter(o=>t.isLocalToSession(o.trace_id)!==!1),i=e.length-s.length;return A.jsx(A.Fragment,{children:e.length!==0?A.jsxs(Wh,{children:[i>0&&A.jsx(Jl,{itemCount:i,onClick:()=>{a(!0)}}),s.map(o=>{const l=vl(o.start_timestamp,o.timestamp);return A.jsxs(Jt,{className:"hover:bg-primary-900 flex cursor-pointer items-center gap-x-4 px-6 py-2",to:o.trace_id,children:[A.jsx(Tg,{trace:o}),A.jsxs("div",{className:"text-primary-300 flex w-48 flex-col truncate font-mono text-sm",children:[A.jsxs("div",{className:"flex items-center gap-x-2",children:[A.jsx("div",{children:Vs(o.trace_id)}),t.isLocalToSession(o.trace_id)?A.jsx(Vh,{title:"This trace is part of your local session.",children:"Local"}):null]}),A.jsx(qE,{date:o.start_timestamp})]}),A.jsx(hg,{trace:o}),A.jsx("div",{className:"flex flex-col truncate font-mono",children:A.jsxs("div",{className:"text-primary-300 flex space-x-2 text-sm",children:[A.jsx("div",{className:Se(o.status==="ok"?"text-green-400":o.status?"text-red-400":""),children:o.status||""}),A.jsx("div",{children:"—"}),A.jsxs("div",{children:[l," ms"]}),A.jsx("div",{children:"—"}),A.jsxs("div",{children:[o.spans.length.toLocaleString()," spans, ",o.transactions.length.toLocaleString()," txns"]})]})})]},o.trace_id)})]}):A.jsx("div",{className:"text-primary-300 p-6",children:"Looks like there's no traces recorded matching this query. 🤔"})})}function p8(){return A.jsxs(jn,{children:[A.jsx(we,{path:"/:traceId/*",element:A.jsx(c8,{})}),A.jsx(we,{path:"/",element:A.jsx(d8,{})})]})}function f8(){const e=tt.getTraces().filter(n=>tt.isTraceLocal(n.trace_id)!==!1),t=[ar("traces","Traces",{notificationCount:{count:e.length}}),ar("sdks","SDKs"),ar("envelopes","Envelopes")];return A.jsxs(A.Fragment,{children:[A.jsx(Xl,{tabs:t,nested:!0}),A.jsxs("div",{className:"flex-1",children:[A.jsxs(jn,{children:[A.jsx(we,{path:"/envelopes/*",element:A.jsx(lM,{})}),A.jsx(we,{path:"/sdks/*",element:A.jsx(EM,{})}),A.jsx(we,{path:"/traces/*",element:A.jsx(p8,{})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:"/explore/traces",replace:!0})})]}),A.jsx(BE,{})]})]})}function T8(){return A.jsx(ho,{children:A.jsx(jn,{children:A.jsx(we,{path:"/*",element:A.jsx(f8,{})})})})}const QE=()=>{b.useContext(ti);const e=Ta(),t=tt.getTraces(),n=t.filter(s=>e.isLocalToSession(s.trace_id)!==!1),r=t.reduce((s,i)=>[...s,...i.spans],[]),a=n.reduce((s,i)=>[...s,...i.spans],[]);return{allSpans:r,localSpans:a}},Ao=({title:e,titleId:t,...n})=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":t,...n},e?b.createElement("title",{id:t},e):null,b.createElement("path",{d:"M17,14 C17.8092996,14 18.2680938,14.9010044 17.836059,15.5493995 L17.7682213,15.6401844 L12.7682213,21.6401844 C12.3950792,22.0879549 11.7283228,22.1178063 11.3160321,21.7297385 L11.2317787,21.6401844 L6.23177872,15.6401844 C5.71367776,15.0184632 6.11213562,14.0891988 6.88682851,14.0060047 L7,14 L17,14 Z M11.2317787,2.3598156 C11.6049208,1.91204508 12.2716772,1.88219371 12.6839679,2.2702615 L12.7682213,2.3598156 L17.7682213,8.3598156 C18.2863222,8.98153675 17.8878644,9.91080124 17.1131715,9.99399528 L17,10 L7,10 C6.19070043,10 5.73190618,9.09899556 6.16394105,8.45060047 L6.23177872,8.3598156 L11.2317787,2.3598156 Z"})),So=({title:e,titleId:t,...n})=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",width:24,height:24,viewBox:"-96 0 512 512","aria-labelledby":t,...n},e?b.createElement("title",{id:t},e):null,b.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"}));function Ro({defaultSortType:e="",defaultAsc:t=!1}){const[n,r]=b.useState({active:e,asc:t});return{toggleSortOrder:a=>r(s=>s.active===a?{active:a,asc:!s.asc}:{active:a,asc:!1}),sort:n,setSort:r}}const h8=({query:e,spanData:t})=>{const n=t.filter(a=>a.description===e).map(a=>a.timestamp-a.start_timestamp),r=n.reduce((a,s)=>a+s,0);return{avgDuration:r/n.length,timeSpent:r,description:e}},xm={[za.queryDesc]:(e,t)=>e.description<t.description?-1:e.description>t.description?1:0,[za.avgDuration]:(e,t)=>e.avgDuration-t.avgDuration,[za.timeSpent]:(e,t)=>e.timeSpent-t.timeSpent},A8=({showAll:e})=>{const{allSpans:t,localSpans:n}=QE(),{sort:r,toggleSortOrder:a}=Ro({defaultSortType:za.timeSpent}),s=b.useMemo(()=>{const i=xm[r.active]||xm[za.timeSpent],o=(e?t:n).filter(u=>Dg.test(u.op||"")),l=new Set(o.map(u=>String(u==null?void 0:u.description).trim()));return l.delete(""),[...l].map(u=>h8({query:u,spanData:o})).sort((u,c)=>r.asc?i(u,c):i(c,u))},[t,n,e,r]);return s!=null&&s.length?A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:Q6.map(i=>A.jsx("th",{scope:"col",className:Se("text-primary-100 select-none px-6 py-3.5 text-sm font-semibold",i.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer items-center gap-1",i.primary?"justify-start":"justify-end"),onClick:()=>a(i.sortKey),children:[i.title,r.active===i.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",r.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},i.id))})}),A.jsx("tbody",{children:s.map(i=>A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/insights/queries/${btoa(i.description)}`,children:i.description})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.avgDuration)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.timeSpent)})]},i.description))})]}):A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No Database queries found. Add integration in Sentry initialization to track Database queries."})};function Xh({crumbs:e}){return A.jsx("div",{className:"flex items-center gap-1 px-6 py-4",children:e.map((t,n)=>{const r=n===e.length-1;return A.jsxs("div",{className:"flex items-center gap-1",children:[n>0&&A.jsx(Ug,{width:12,height:12,className:"stroke-primary-300 -rotate-90"}),t.link&&t.to?A.jsx(Jt,{className:Se(r?"text-primary-200":"text-primary-300","hover:text-primary-100 truncate text-sm hover:underline"),to:t.to,children:t.label}):A.jsx("span",{className:Se(r?"text-primary-200":"text-primary-300","truncate text-sm"),children:t.label})]},t.id)})})}const wm={[qa.foundIn]:(e,t)=>e.trace_id<t.trace_id?-1:e.trace_id>t.trace_id?1:0,[qa.spanId]:(e,t)=>e.span_id<t.span_id?-1:e.span_id>t.span_id?1:0,[qa.timeSpent]:(e,t)=>e.timestamp-e.start_timestamp-(t.timestamp-t.start_timestamp)},S8=({showAll:e})=>{const{allSpans:t,localSpans:n}=QE(),{type:r}=cs(),{sort:a,toggleSortOrder:s}=Ro({defaultSortType:qa.timeSpent}),i=b.useMemo(()=>{if(!r)return[];const o=e?t:n,l=wm[a.active]||wm[qa.timeSpent],u=atob(r);return o.filter(c=>c.description===u).sort((c,E)=>a.asc?l(c,E):l(E,c))},[t,n,e,a,r]);return!i||!i.length?A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"Query not found."}):A.jsxs(A.Fragment,{children:[A.jsx(Xh,{crumbs:[{id:"queries",label:"Queries",link:!0,to:"/insights/queries"},{id:"querySummary",label:"Query Summary",link:!1}]}),A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:t8.map(o=>A.jsx("th",{scope:"col",className:Se("text-primary-100 px-6 py-3.5 text-sm font-semibold",o.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer select-none items-center gap-1",o.primary?"justify-start":"justify-end"),onClick:()=>s(o.sortKey),children:[o.title,a.active===o.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",a.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},o.id))})}),A.jsx("tbody",{children:i.map(o=>A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${o.trace_id}`,children:Vs(o.trace_id)})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${o.trace_id}/spans/${o.span_id}`,children:Vs(o.span_id)})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(o.timestamp-o.start_timestamp)})]},o.span_id))})]})]})},R8=e=>{switch(e){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"top-1/2 right-full transform -translate-y-1/2 mr-2";default:return"top-1/2 left-full transform -translate-y-1/2 ml-2"}},m8=({content:e,position:t="right",children:n})=>{const[r,a]=b.useState(!1),s=()=>{a(!0)},i=()=>{a(!1)};return A.jsxs("div",{className:"relative inline-block max-w-full",onMouseEnter:s,onMouseLeave:i,children:[n,r&&A.jsx("div",{className:Se("absolute z-10",R8(t)),children:e})]})},_8=({resource:e,spanData:t})=>{const n=t.filter(i=>i.description===e),r=n.reduce((i,o)=>i+(o.timestamp-o.start_timestamp),0),a=r/n.length,s=n.reduce((i,o)=>{const l=o.data&&o.data["http.response_content_length"];return typeof l=="number"?i+l:i},0)/n.length;return{avgDuration:a,timeSpent:r,description:e,avgEncodedSize:s,similarResources:n}},N8=(e,t)=>{if(t.type)return e.filter(n=>n.description===t.type);if(t.regex){const n=new RegExp(t.regex);return e.filter(r=>n.test(r.op||""))}return[]},Um={[wr.description]:(e,t)=>e.description<t.description?-1:e.description>t.description?1:0,[wr.avgEncodedSize]:(e,t)=>e.avgEncodedSize-t.avgEncodedSize,[wr.avgDuration]:(e,t)=>e.avgDuration-t.avgDuration,[wr.timeSpent]:(e,t)=>e.timeSpent-t.timeSpent},O8=({showAll:e})=>{const{allSpans:t,localSpans:n}=QE(),{sort:r,toggleSortOrder:a}=Ro({defaultSortType:wr.timeSpent}),s=b.useMemo(()=>{const i=N8(e?t:n,{regex:/resource\.[A-Za-z]+/}),o=new Set(i.map(c=>String(c==null?void 0:c.description).trim()));o.delete("");const l=[...o],u=Um[r.active]||Um[wr.timeSpent];return l.map(c=>_8({resource:c,spanData:i})).sort((c,E)=>r.asc?u(c,E):u(E,c))},[r,e,t,n]);return s!=null&&s.length?A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:Z6.map(i=>A.jsx("th",{scope:"col",className:Se("text-primary-100 px-6 py-3.5 text-sm font-semibold",i.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer select-none items-center gap-1",i.primary?"justify-start":"justify-end"),onClick:()=>a(i.sortKey),children:[i.title,r.active===i.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",r.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},i.id))})}),A.jsx("tbody",{children:s.map(i=>{var o;return A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 relative w-2/5 whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(m8,{position:"right",content:i.similarResources[0].op==="resource.img"&&((o=i.description)==null?void 0:o.indexOf("/"))===0&&A.jsxs("div",{className:"bg-primary-800 cursor-pointer rounded-lg p-4 shadow-md",children:[A.jsx("h2",{className:"mb-2 font-bold",children:"Preview"}),A.jsx("img",{src:i.description,className:"inline-block max-h-[150px] max-w-[150px] rounded p-1",alt:"preview"})]}),children:A.jsx("div",{className:"truncate",children:i.description})})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.avgDuration)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.timeSpent)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:wg(i.avgEncodedSize)})]},i.description)})})]}):A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No Resource found."})},kg=Math.sqrt(2);function I8(e){const t=.254829592,n=-.284496736,r=1.421413741,a=-1.453152027,s=1.061405429,i=.3275911,o=e<0?-1:1,l=Math.abs(e),u=1/(1+i*l),c=1-((((s*u+a)*u+r)*u+n)*u+t)*u*Math.exp(-l*l);return o*c}function C8(e,t){return Math.abs(Math.log(e)-Math.log(t))/(kg*.9061938024368232)}function g8(e,t,n){return .5*(1-I8((Math.log(e)-Math.log(n))/(kg*C8(n,t))))}function Gg(e,t){for(const n of t.profiles){const r=e.measurements;if(r){let a=!1,s=0,i=0;for(const o of n.scoreComponents)o.optional&&!Object.prototype.hasOwnProperty.call(r,o.measurement)||(i+=o.weight);if(Math.abs(i)<Number.EPSILON)break;for(const o of n.scoreComponents){let l=0;if(Object.prototype.hasOwnProperty.call(r,o.measurement)){l=o.weight/i;const u=r[o.measurement].value,c=g8(Math.max(0,u),o.p10,o.p50),E=c*l;s+=E,a=!0,r[`score.${o.measurement}`]={value:c,unit:"ratio"}}else r[`score.${o.measurement}`]={value:0,unit:"ratio"};r[`score.weight.${o.measurement}`]={value:l,unit:"ratio"}}a&&(r["score.total"]={value:s,unit:"ratio"});break}}}function L8(e,t,n,r,a,s,i,o){const l=e/2+r+o,u={x:t+e/2-s/2,y:n+e/2+i/2},c=Object.values(a).reduce((x,F)=>x+F,0),E=-90,f=x=>x/c*360,[S,_,C,I,d]=[a.lcp,a.fcp,a.fid,a.cls,a.ttfb].map(f),p=u.x+l*Math.cos((E+S/2)*Math.PI/180),m=u.y+l*Math.sin((E+S/2)*Math.PI/180),h=u.x+l*Math.cos((E+S+_/2)*Math.PI/180),O=u.y+l*Math.sin((E+S+_/2)*Math.PI/180),T=u.x+l*Math.cos((E+S+_+C/2)*Math.PI/180),N=u.y+l*Math.sin((E+S+_+C/2)*Math.PI/180),g=u.x+l*Math.cos((E+S+_+C+I/2)*Math.PI/180),D=u.y+l*Math.sin((E+S+_+C+I/2)*Math.PI/180),R=u.x-12+l*Math.cos((E+S+_+C+I+d/2)*Math.PI/180),v=u.y+l*Math.sin((E+S+_+C+I+d/2)*Math.PI/180);return{lcpX:p,lcpY:m,fcpX:h,fcpY:O,fidX:T,fidY:N,clsX:g,clsY:D,ttfbX:R,ttfbY:v}}const km={[an.pages]:(e,t)=>e.transaction&&t.transaction&&e.transaction<t.transaction?-1:e.transaction&&t.transaction&&e.transaction>t.transaction?1:0,[an.lcp]:(e,t)=>e.measurements["score.lcp"].value-t.measurements["score.lcp"].value,[an.fid]:(e,t)=>e.measurements["score.fid"].value-t.measurements["score.fid"].value,[an.fcp]:(e,t)=>e.measurements["score.fcp"].value-t.measurements["score.fcp"].value,[an.cls]:(e,t)=>e.measurements["score.cls"].value-t.measurements["score.cls"].value,[an.ttfb]:(e,t)=>e.measurements["score.ttfb"].value-t.measurements["score.ttfb"].value,[an.score]:(e,t)=>e.measurements["score.total"].value-t.measurements["score.total"].value},y8=()=>{const e=ni(),t=Js(),{sort:n,toggleSortOrder:r}=Ro({defaultSortType:an.score}),a=b.useMemo(()=>{const s=km[n.active]||km[an.score];return e.filter(i=>{var o,l;return i.measurements&&((l=(o=i==null?void 0:i.contexts)==null?void 0:o.trace)==null?void 0:l.op)==="pageload"}).map(i=>{const o={...i};return Gg(o,xg),o}).sort((i,o)=>n.asc?s(i,o):s(o,i))},[e,n]);return a!=null&&a.length?A.jsx(A.Fragment,{children:A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:n8.map(s=>A.jsx("th",{scope:"col",className:Se("text-primary-100 px-6 py-3.5 text-sm font-semibold",s.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer select-none items-center gap-1",s.primary?"justify-start":"justify-end"),onClick:()=>r(s.sortKey),children:[s.title,n.active===s.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",n.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},s.id))})}),A.jsx("tbody",{children:a.map(s=>{var i,o,l,u,c,E;return A.jsxs("tr",{className:"hover:bg-primary-900 cursor-pointer",onClick:()=>t(`/insights/webvitals/${s.event_id}`),children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:s.transaction}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(i=s.measurements)!=null&&i.lcp?En(s.measurements.lcp.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(o=s.measurements)!=null&&o.fcp?En(s.measurements.fcp.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(l=s.measurements)!=null&&l.fid?En(s.measurements.fid.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(u=s.measurements)!=null&&u.cls?s.measurements.cls.value:"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(c=s.measurements)!=null&&c.ttfb?En(s.measurements.ttfb.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(E=s.measurements["score.total"])!=null&&E.value?Math.trunc(s.measurements["score.total"].value*100):"-"})]},s.event_id)})})]})}):A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No Measurements found."})},b8=-90,v8=1;function M8({values:e,maxValues:t,size:n=20,barWidth:r=3,text:a,textCss:s,segmentColors:i,backgroundColors:o,progressEndcaps:l,onHoverActions:u,onBlur:c,...E}){const f=n/2,S=n/4,_=n/2-r/2,C=2*Math.PI*_,I=b.useMemo(()=>{const d=t.reduce((m,h)=>m+h,0);let p=b8;return t.flatMap((m,h)=>{const O=Math.min(Math.max(e[h],0),m),T=e.length>1?v8:0,N=(1-Math.max(m-T,0)/d)*C,g=(1-Math.max(O-T,0)/d)*C,D=p;p+=360*m/d;const R=_+r/2,v=`${R}-${o[h]}-${i[h]}`;return[A.jsx("circle",{strokeDashoffset:N,r:_,cx:R,cy:R,onMouseOver:()=>u==null?void 0:u[h](),onFocus:()=>u==null?void 0:u[h](),onMouseLeave:()=>c==null?void 0:c(),onBlur:()=>c==null?void 0:c(),className:Se(o[h]),style:{fill:"none",strokeWidth:r,strokeDasharray:`${C} ${C}`,transform:`rotate(${D}deg)`,transformOrigin:"50% 50%",transition:"stroke 300ms"}},`ring-bg-${v}`),A.jsx("circle",{strokeDashoffset:g,strokeLinecap:l,r:_,cx:R,cy:R,onMouseOver:()=>u==null?void 0:u[h](),onFocus:()=>u==null?void 0:u[h](),onMouseLeave:()=>c==null?void 0:c(),onBlur:()=>c==null?void 0:c(),className:Se(i[h]),style:{fill:"none",strokeWidth:r,strokeDasharray:`${C} ${C}`,transform:`rotate(${D}deg)`,transformOrigin:"50% 50%",transition:"stroke 300ms, stroke-dashoffset 300ms"}},`ring-bar-${v}`)]})},[o,r,C,t,u,c,l,_,i,e]);return A.jsxs("svg",{className:"relative",role:"img",height:_*2+r,width:_*2+r,...E,children:[A.jsx("title",{children:"Web Vitals Breakdown"}),I,A.jsx("foreignObject",{height:f,width:f,x:S,y:S,children:a!==void 0?A.jsx("div",{className:Se("text-primary-100 flex h-full w-full items-center justify-center text-xl font-bold",s),children:a}):null})]})}class rT extends Error{}function P8(e,{signal:t}){return new Promise((n,r)=>{t.aborted&&r(new rT);const a=()=>{r(new rT)},s=new IntersectionObserver(i=>{for(const o of i){const l=o.boundingClientRect;n(l),t.removeEventListener("abort",a)}s.disconnect()});t.addEventListener("abort",a),s.observe(e)})}function D8({elem:e,onPositionChange:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,...s}){const i=b.useRef(new AbortController),o=b.useCallback(async u=>{if(!e.current){t(void 0);return}try{const c=await P8(e.current,{signal:i.current.signal});t({height:c.height,left:Math.min(u.clientX-c.left,c.width),top:Math.min(u.clientY-c.top,c.height),width:c.width})}catch(c){if(c instanceof rT)return}},[t,i,e]),l=b.useCallback(()=>{i.current&&(i.current.abort(),i.current=new AbortController),t(void 0)},[t,i]);return{...s,onMouseEnter:u=>{o(u),n==null||n(u)},onMouseMove:u=>{var c;(c=e.current)!=null&&c.contains(u.target)&&(o(u),r==null||r(u))},onMouseLeave:u=>{l(),a==null||a(u)}}}function Fo({webVital:e,coordinates:t,labelCoordinates:n={}}){var r,a;const s=((r=n==null?void 0:n[e])==null?void 0:r.x)??0,i=((a=n==null?void 0:n[e])==null?void 0:a.y)??0;return A.jsx("text",{className:"fill-primary-200 stroke-primary-200 uppercase",x:t.x+s,y:t.y+i,children:e})}const x8=({metricScore:e,metricWeights:t,totalScore:n,size:r=200,barWidth:a=25,left:s=40,top:i=25,labelWidthPadding:o=28,labelHeightPadding:l=14,radiusPadding:u=4})=>{const[c,E]=b.useState(null),[f,S]=b.useState({x:0,y:0}),_=b.useRef(null),C=D8({elem:_,onPositionChange:R=>{if(R){const{left:v,top:x}=R;S({x:v,y:x})}}}),{lcpX:I,lcpY:d,fcpX:p,fcpY:m,fidX:h,fidY:O,clsX:T,clsY:N,ttfbX:g,ttfbY:D}=L8(r,s,i,a,t,o,l,u);return A.jsxs("div",{ref:_,...C,children:[c&&A.jsxs("div",{className:Se("bg-primary-900 border-primary-400 absolute flex w-40 items-center justify-between rounded-lg border p-3 shadow-lg"),style:{transform:`translate3d(${f.x-100}px, ${f.y-74}px, 0px)`},children:[A.jsx("span",{className:"text-primary-200",children:`${c.toUpperCase()} Score:`}),A.jsx("span",{className:"text-primary-200 font-semibold",children:e[`${c}Score`]})]}),A.jsxs("svg",{height:r+3*i,width:r+3*s,children:[A.jsxs(A.Fragment,{children:[t.lcp>0&&A.jsx(Fo,{webVital:"lcp",coordinates:{x:I,y:d}}),t.fcp>0&&A.jsx(Fo,{webVital:"fcp",coordinates:{x:p,y:m}}),t.fid>0&&A.jsx(Fo,{webVital:"fid",coordinates:{x:h,y:O}}),t.cls>0&&A.jsx(Fo,{webVital:"cls",coordinates:{x:T,y:N}}),t.ttfb>0&&A.jsx(Fo,{webVital:"ttfb",coordinates:{x:g,y:D}})]}),A.jsx(M8,{values:[(e.lcpScore??0)*t.lcp*.01,(e.fcpScore??0)*t.fcp*.01,(e.fidScore??0)*t.fid*.01,(e.clsScore??0)*t.cls*.01,(e.ttfbScore??0)*t.ttfb*.01],maxValues:[t.lcp,t.fcp,t.fid,t.cls,t.ttfb],text:n,size:r,barWidth:a,segmentColors:["stroke-primary-300","stroke-primary-400","stroke-primary-500","stroke-primary-600","stroke-primary-700"],backgroundColors:["stroke-gray-400","stroke-gray-400","stroke-gray-400","stroke-gray-400","stroke-gray-400"],x:s,y:i,onHoverActions:[()=>E("lcp"),()=>E("fcp"),()=>E("fid"),()=>E("cls"),()=>E("ttfb")],onBlur:()=>E(null)})]})]})},w8=()=>{var e,t,n,r,a;const s=ni(),{page:i}=cs(),o=[];if(s.filter(l=>l.event_id===i).map(l=>{const u={...l};Gg(u,xg),o.push(u)}),i&&o.length){const l={fcpScore:Math.trunc(o[0].measurements["score.fcp"].value*100),lcpScore:Math.trunc(o[0].measurements["score.lcp"].value*100),fidScore:Math.trunc(o[0].measurements["score.fid"].value*100),clsScore:Math.trunc(o[0].measurements["score.cls"].value*100),ttfbScore:Math.trunc(o[0].measurements["score.ttfb"].value*100)},u={fcp:Math.trunc(o[0].measurements["score.weight.fcp"].value*100),lcp:Math.trunc(o[0].measurements["score.weight.lcp"].value*100),fid:Math.trunc(o[0].measurements["score.weight.fid"].value*100),cls:Math.trunc(o[0].measurements["score.weight.cls"].value*100),ttfb:Math.trunc(o[0].measurements["score.weight.ttfb"].value*100)},c=Math.trunc(o[0].measurements["score.total"].value*100),E=[{id:"fcpScore",description:"First Contentful Paint",label:"FCP",score:(e=o[0].measurements)!=null&&e.fcp?En(o[0].measurements.fcp.value):"-"},{id:"lcpScore",description:"Largest Contentful Paint",label:"LCP",score:(t=o[0].measurements)!=null&&t.lcp?En(o[0].measurements.lcp.value):"-"},{id:"fidScore",description:"First Input Delay",label:"FID",score:(n=o[0].measurements)!=null&&n.fid?En(o[0].measurements.fid.value):"-"},{id:"clsScore",description:"Cumulative Layout Shift",label:"CLS",score:(r=o[0].measurements)!=null&&r.cls?En(o[0].measurements.cls.value):"-"},{id:"ttfbScore",description:"Time to First Byte",label:"TTFB",score:(a=o[0].measurements)!=null&&a.ttfb?En(o[0].measurements.ttfb.value):"-"}];return A.jsxs(A.Fragment,{children:[A.jsx(Xh,{crumbs:[{id:"webVitals",label:"Web Vitals",link:!0,to:"/insights/webvitals"},{id:"performanceSummary",label:"Performance Summary",link:!1}]}),A.jsxs("div",{className:"w-full px-6",children:[A.jsx("div",{className:"flex w-full items-center justify-center p-6",children:A.jsx(x8,{totalScore:c,metricWeights:u,metricScore:l})}),A.jsx("div",{className:"flex w-full flex-wrap justify-center gap-2",children:E.map(f=>A.jsxs("div",{className:"bg-primary-900 border-primary-400 flex w-80 flex-col items-center gap-4 rounded-lg border p-2 shadow-lg",children:[A.jsx("span",{className:"text-primary-300 text-base font-semibold",children:f.label}),A.jsx("span",{className:"text-primary-300 text-sm font-light",children:f.description}),A.jsx("h2",{className:"text-primary-300 text-lg font-bold",children:f.score??"-"})]},f.id))})]})]})}return A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No measurement found."})};function U8(){const e=To(),{allSpans:t,localSpans:n}=QE(),[r,a]=b.useState(!e.experiments["sentry:focus-local-events"]),s=t.length-n.length,i=[ar("queries","Queries"),ar("webvitals","Web Vitals"),ar("resources","Resources")];return A.jsxs(A.Fragment,{children:[!r&&s>0&&A.jsx(Jl,{itemCount:s,onClick:()=>{a(!0)}}),A.jsx(Xl,{tabs:i,nested:!0}),A.jsxs("div",{className:"flex-1",children:[A.jsxs(jn,{children:[A.jsx(we,{path:"queries/:type",element:A.jsx(S8,{showAll:r})}),A.jsx(we,{path:"resources",element:A.jsx(O8,{showAll:r})}),A.jsx(we,{path:"webvitals",element:A.jsx(y8,{})}),A.jsx(we,{path:"webvitals/:page",element:A.jsx(w8,{})}),A.jsx(we,{path:"queries",element:A.jsx(A8,{showAll:r})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:"/insights/queries",replace:!0})})]}),A.jsx(BE,{})]})]})}function k8(){return A.jsx(ho,{children:A.jsx(jn,{children:A.jsx(we,{path:"/*",element:A.jsx(U8,{})})})})}function G8({showAll:e}){const{name:t}=cs(),n=ni(),r=Ta(),{sort:a,toggleSortOrder:s}=Ro({defaultSortType:gi.timestamp}),i=b.useMemo(()=>{if(!t)return[];const o={[gi.timestamp]:(f,S)=>f.start_timestamp-S.start_timestamp,[gi.duration]:(f,S)=>f.timestamp+S.start_timestamp-f.start_timestamp-S.timestamp},l=atob(t),u=n.filter(f=>f.type==="transaction").filter(f=>f.transaction===l),c=e?u:u.filter(f=>{var S,_;const C=(_=(S=f.contexts)==null?void 0:S.trace)==null?void 0:_.trace_id;return!C||r.isLocalToSession(C)}),E=o[a.active]||o[gi.timestamp];return c.sort((f,S)=>a.asc?E(f,S):E(S,f))},[a,e,n,r,t]);return A.jsx(A.Fragment,{children:i.length!==0?A.jsxs("div",{children:[A.jsx(Xh,{crumbs:[{id:"transactions",label:"Transactions",link:!0,to:"/performance/transactions"},{id:"txnSummary",label:"Transaction Summary",link:!1}]}),A.jsx("div",{className:"w-11/12 px-6 py-4",children:A.jsx("h1",{className:"truncate text-2xl font-bold",children:atob(t)})}),A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:e8.map(o=>A.jsx("th",{scope:"col",className:Se("text-primary-100 select-none px-6 py-3.5 text-sm font-semibold",o.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer items-center gap-1",o.primary?"justify-start":"justify-end"),onClick:()=>o.sortKey&&s(o.sortKey),children:[o.title,o.sortKey&&(a.active===o.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",a.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"}))]})},o.id))})}),A.jsx("tbody",{children:i.map(o=>{var l,u,c,E,f,S,_,C;return A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${(u=(l=o.contexts)==null?void 0:l.trace)==null?void 0:u.trace_id}/spans/${(E=(c=o.contexts)==null?void 0:c.trace)==null?void 0:E.span_id}`,children:Vs(o.event_id)})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(o.timestamp-o.start_timestamp)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(JE,{date:o.start_timestamp})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${(S=(f=o.contexts)==null?void 0:f.trace)==null?void 0:S.trace_id}`,children:Vs((C=(_=o.contexts)==null?void 0:_.trace)==null?void 0:C.trace_id)})})]},o.event_id)})})]})]}):A.jsx("div",{className:"text-primary-300 p-6",children:"Looks like there's no transaction recorded matching this query. 🤔"})})}function F8({showAll:e}){const t=ni(),n=Ta(),r=Js(),{sort:a,toggleSortOrder:s}=Ro({defaultSortType:Ci.lastSeen}),i=b.useMemo(()=>{const o={[Ci.count]:(E,f)=>E[1].transactions.length-f[1].transactions.length,[Ci.lastSeen]:(E,f)=>E[1].lastSeen-f[1].lastSeen},l=o[a.active]||o[Ci.lastSeen],u=t.filter(E=>E.type==="transaction"),c=(e?u:u.filter(E=>{var f,S;const _=(S=(f=E.contexts)==null?void 0:f.trace)==null?void 0:S.trace_id;return!_||n.isLocalToSession(_)})).reduce((E,f)=>(f.transaction&&(f.transaction in E?(E[f.transaction].transactions.push(f),f.start_timestamp&&(E[f.transaction].lastSeen=f.start_timestamp)):E[f.transaction]={transactions:[f],lastSeen:f.start_timestamp}),E),{});return Object.entries(c).sort((E,f)=>a.asc?l(E,f):l(f,E))},[a,e,t,n]);return A.jsx(A.Fragment,{children:i.length!==0?A.jsx("div",{children:A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:$6.map(o=>A.jsx("th",{scope:"col",className:Se("text-primary-100 select-none px-6 py-3.5 text-sm font-semibold",o.primary?"w-3/5":"w-1/5"),children:A.jsxs("div",{className:Se("flex cursor-pointer items-center gap-1",o.primary?"justify-start":"justify-end"),onClick:()=>o.sortKey&&s(o.sortKey),children:[o.title,o.sortKey&&(a.active===o.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",a.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"}))]})},o.id))})}),A.jsx("tbody",{children:i.map(([o,l])=>A.jsxs("tr",{className:"hover:bg-primary-900 cursor-pointer",onClick:()=>{r(`/performance/transactions/${btoa(o)}`)},children:[A.jsx("td",{className:"text-primary-200 w-3/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:o}),A.jsx("td",{className:"text-primary-200 w-1/5 whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(JE,{date:l.lastSeen})}),A.jsx("td",{className:"text-primary-200 w-1/5 whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:l.transactions.length})]},o))})]})}):A.jsx("div",{className:"text-primary-300 p-6",children:"Looks like there's no transactions recorded matching this query. 🤔"})})}function B8(){const e=ni(),t=Ta(),n=To(),[r,a]=b.useState(!n.experiments["sentry:focus-local-events"]),s=e.filter(l=>l.type==="transaction"),i=r?s:s.filter(l=>{var u,c;const E=(c=(u=l.contexts)==null?void 0:u.trace)==null?void 0:c.trace_id;return!E||t.isLocalToSession(E)}),o=s.length-i.length;return A.jsxs("div",{className:"flex-1",children:[o>0&&A.jsx(Jl,{itemCount:o,onClick:()=>{a(!0)}}),A.jsxs(jn,{children:[A.jsx(we,{path:"transactions",element:A.jsx(F8,{showAll:r})}),A.jsx(we,{path:"transactions/:name",element:A.jsx(G8,{showAll:r})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:"/performance/transactions",replace:!0})})]}),A.jsx(BE,{})]})}function H8(){return A.jsx(ho,{children:A.jsx(jn,{children:A.jsx(we,{path:"/*",element:A.jsx(B8,{})})})})}const he=Le;let aT=0;function Fg(){return aT>0}function Y8(){aT++,setTimeout(()=>{aT--})}function $i(e,t={}){function n(a){return typeof a=="function"}if(!n(e))return e;try{const a=e.__sentry_wrapped__;if(a)return typeof a=="function"?a:e;if(Dh(e))return e}catch{return e}const r=function(...a){try{const s=a.map(i=>$i(i,t));return e.apply(this,s)}catch(s){throw Y8(),wh(i=>{i.addEventProcessor(o=>(t.mechanism&&(Vf(o,void 0),Ji(o,t.mechanism)),o.extra={...o.extra,arguments:a},o)),wC(s)}),s}};try{for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a])}catch{}oC(r,e),or(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}const _r=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Kh(e,t){const n=zh(e,t),r={type:K8(t),value:z8(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function V8(e,t,n,r){const a=Me(),s=a&&a.getOptions().normalizeDepth,i=$8(t),o={__serialized__:yC(t,s)};if(i)return{exception:{values:[Kh(e,i)]},extra:o};const l={exception:{values:[{type:WE(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Z8(t,{isUnhandledRejection:r})}]},extra:o};if(n){const u=zh(e,n);u.length&&(l.exception.values[0].stacktrace={frames:u})}return l}function fp(e,t){return{exception:{values:[Kh(e,t)]}}}function zh(e,t){const n=t.stacktrace||t.stack||"",r=j8(t),a=X8(t);try{return e(n,r,a)}catch{}return[]}const W8=/Minified React error #\d+;/i;function j8(e){return e&&W8.test(e.message)?1:0}function X8(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Bg(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function K8(e){const t=e&&e.name;return!t&&Bg(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function z8(e){const t=e&&e.message;return t?t.error&&typeof t.error.message=="string"?t.error.message:Bg(e)&&Array.isArray(e.message)&&e.message.length==2?e.message[1]:t:"No error message"}function q8(e,t,n,r){const a=n&&n.syntheticException||void 0,s=qh(e,t,a,r);return Ji(s),s.level="error",n&&n.event_id&&(s.event_id=n.event_id),Ea(s)}function J8(e,t,n="info",r,a){const s=r&&r.syntheticException||void 0,i=sT(e,t,s,a);return i.level=n,r&&r.event_id&&(i.event_id=r.event_id),Ea(i)}function qh(e,t,n,r,a){let s;if(rC(t)&&t.error)return fp(e,t.error);if(dR(t)||tv(t)){const i=t;if("stack"in t)s=fp(e,t);else{const o=i.name||(dR(i)?"DOMError":"DOMException"),l=i.message?`${o}: ${i.message}`:o;s=sT(e,l,n,r),Vf(s,l)}return"code"in i&&(s.tags={...s.tags,"DOMException.code":`${i.code}`}),s}return vh(t)?fp(e,t):qi(t)||WE(t)?(s=V8(e,t,n,a),Ji(s,{synthetic:!0}),s):(s=sT(e,t,n,r),Vf(s,`${t}`),Ji(s,{synthetic:!0}),s)}function sT(e,t,n,r){const a={};if(r&&n){const s=zh(e,n);s.length&&(a.exception={values:[{value:t,stacktrace:{frames:s}}]}),Ji(a,{synthetic:!0})}if(Mh(t)){const{__sentry_template_string__:s,__sentry_template_values__:i}=t;return a.logentry={message:s,params:i},a}return a.message=t,a}function Z8(e,{isUnhandledRejection:t}){const n=uv(e),r=t?"promise rejection":"exception";return rC(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:WE(e)?`Event \`${Q8(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Q8(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function $8(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}function ex(e,{metadata:t,tunnel:n,dsn:r}){const a={event_id:e.event_id,sent_at:new Date().toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:zl(r)}},s=tx(e);return ei(a,[s])}function tx(e){return[{type:"user_report"},e]}class nx extends J5{constructor(t){const n={parentSpanIsAlwaysRootSpan:!0,...t},r=he.SENTRY_SDK_SOURCE||Q3();XC(n,"browser",["browser"],r),super(n),n.sendClientReports&&he.document&&he.document.addEventListener("visibilitychange",()=>{he.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,n){return q8(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return J8(this._options.stackParser,t,n,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){_r&&ne.warn("SDK not enabled, will not capture user feedback.");return}const n=ex(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(t,n,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,r)}}const Jh=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rx=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",mo=(e,t,n,r)=>{let a,s;return i=>{t.value>=0&&(i||r)&&(s=t.value-(a||0),(s||a===void 0)&&(a=t.value,t.delta=s,t.rating=rx(t.value,n),e(t)))}},de=Le,ax=()=>`v4-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,Zl=(e=!0)=>{const t=de.performance&&de.performance.getEntriesByType&&de.performance.getEntriesByType("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ql=()=>{const e=Zl();return e&&e.activationStart||0},_o=(e,t)=>{const n=Zl();let r="navigate";return n&&(de.document&&de.document.prerendering||Ql()>0?r="prerender":de.document&&de.document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:typeof t>"u"?-1:t,rating:"good",delta:0,entries:[],id:ax(),navigationType:r}},ai=(e,t,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(a=>{Promise.resolve().then(()=>{t(a.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch{}},No=e=>{const t=n=>{(n.type==="pagehide"||de.document&&de.document.visibilityState==="hidden")&&e(n)};de.document&&(addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0))},$E=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let al=-1;const sx=()=>de.document.visibilityState==="hidden"&&!de.document.prerendering?0:1/0,aE=e=>{de.document.visibilityState==="hidden"&&al>-1&&(al=e.type==="visibilitychange"?e.timeStamp:0,ox())},ix=()=>{addEventListener("visibilitychange",aE,!0),addEventListener("prerenderingchange",aE,!0)},ox=()=>{removeEventListener("visibilitychange",aE,!0),removeEventListener("prerenderingchange",aE,!0)},ed=()=>(de.document&&al<0&&(al=sx(),ix()),{get firstHiddenTime(){return al}}),$l=e=>{de.document&&de.document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},lx=[1800,3e3],ux=(e,t={})=>{$l(()=>{const n=ed(),r=_o("FCP");let a;const s=ai("paint",i=>{i.forEach(o=>{o.name==="first-contentful-paint"&&(s.disconnect(),o.startTime<n.firstHiddenTime&&(r.value=Math.max(o.startTime-Ql(),0),r.entries.push(o),a(!0)))})});s&&(a=mo(e,r,lx,t.reportAllChanges))})},cx=[.1,.25],Ex=(e,t={})=>{ux($E(()=>{const n=_o("CLS",0);let r,a=0,s=[];const i=l=>{l.forEach(u=>{if(!u.hadRecentInput){const c=s[0],E=s[s.length-1];a&&c&&E&&u.startTime-E.startTime<1e3&&u.startTime-c.startTime<5e3?(a+=u.value,s.push(u)):(a=u.value,s=[u])}}),a>n.value&&(n.value=a,n.entries=s,r())},o=ai("layout-shift",i);o&&(r=mo(e,n,cx,t.reportAllChanges),No(()=>{i(o.takeRecords()),r(!0)}),setTimeout(r,0))}))},dx=[100,300],px=(e,t={})=>{$l(()=>{const n=ed(),r=_o("FID");let a;const s=l=>{l.startTime<n.firstHiddenTime&&(r.value=l.processingStart-l.startTime,r.entries.push(l),a(!0))},i=l=>{l.forEach(s)},o=ai("first-input",i);a=mo(e,r,dx,t.reportAllChanges),o&&No($E(()=>{i(o.takeRecords()),o.disconnect()}))})};let Hg=0,Tp=1/0,Gu=0;const fx=e=>{e.forEach(t=>{t.interactionId&&(Tp=Math.min(Tp,t.interactionId),Gu=Math.max(Gu,t.interactionId),Hg=Gu?(Gu-Tp)/7+1:0)})};let iT;const Tx=()=>iT?Hg:performance.interactionCount||0,hx=()=>{"interactionCount"in performance||iT||(iT=ai("event",fx,{type:"event",buffered:!0,durationThreshold:0}))},qr=[],hp=new Map,Ax=40;let Sx=0;const Rx=()=>Tx()-Sx,mx=()=>{const e=Math.min(qr.length-1,Math.floor(Rx()/50));return qr[e]},Ap=10,_x=[],Nx=e=>{if(_x.forEach(r=>r(e)),!(e.interactionId||e.entryType==="first-input"))return;const t=qr[qr.length-1],n=hp.get(e.interactionId);if(n||qr.length<Ap||t&&e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===(n.entries[0]&&n.entries[0].startTime)&&n.entries.push(e);else{const r={id:e.interactionId,latency:e.duration,entries:[e]};hp.set(r.id,r),qr.push(r)}qr.sort((r,a)=>a.latency-r.latency),qr.length>Ap&&qr.splice(Ap).forEach(r=>hp.delete(r.id))}},Yg=e=>{const t=de.requestIdleCallback||de.setTimeout;let n=-1;return e=$E(e),de.document&&de.document.visibilityState==="hidden"?e():(n=t(e),No(e)),n},Ox=[200,500],Ix=(e,t={})=>{"PerformanceEventTiming"in de&&"interactionId"in PerformanceEventTiming.prototype&&$l(()=>{hx();const n=_o("INP");let r;const a=i=>{Yg(()=>{i.forEach(Nx);const o=mx();o&&o.latency!==n.value&&(n.value=o.latency,n.entries=o.entries,r())})},s=ai("event",a,{durationThreshold:t.durationThreshold!=null?t.durationThreshold:Ax});r=mo(e,n,Ox,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),No(()=>{a(s.takeRecords()),r(!0)}))})},Cx=[2500,4e3],Gm={},gx=(e,t={})=>{$l(()=>{const n=ed(),r=_o("LCP");let a;const s=o=>{t.reportAllChanges||(o=o.slice(-1)),o.forEach(l=>{l.startTime<n.firstHiddenTime&&(r.value=Math.max(l.startTime-Ql(),0),r.entries=[l],a())})},i=ai("largest-contentful-paint",s);if(i){a=mo(e,r,Cx,t.reportAllChanges);const o=$E(()=>{Gm[r.id]||(s(i.takeRecords()),i.disconnect(),Gm[r.id]=!0,a(!0))});["keydown","click"].forEach(l=>{de.document&&addEventListener(l,()=>Yg(o),{once:!0,capture:!0})}),No(o)}})},Lx=[800,1800],oT=e=>{de.document&&de.document.prerendering?$l(()=>oT(e)):de.document&&de.document.readyState!=="complete"?addEventListener("load",()=>oT(e),!0):setTimeout(e,0)},yx=(e,t={})=>{const n=_o("TTFB"),r=mo(e,n,Lx,t.reportAllChanges);oT(()=>{const a=Zl();a&&(n.value=Math.max(a.responseStart-Ql(),0),n.entries=[a],r(!0))})},sl={},sE={};let Vg,Wg,jg,Xg,Kg;function Zh(e,t=!1){return eu("cls",e,vx,Vg,t)}function zg(e,t=!1){return eu("lcp",e,Px,jg,t)}function qg(e){return eu("fid",e,Mx,Wg)}function bx(e){return eu("ttfb",e,Dx,Xg)}function Jg(e){return eu("inp",e,xx,Kg)}function eo(e,t){return Zg(e,t),sE[e]||(wx(e),sE[e]=!0),Qg(e,t)}function Oo(e,t){const n=sl[e];if(!(!n||!n.length))for(const r of n)try{r(t)}catch(a){Jh&&ne.error(`Error while triggering instrumentation handler.
125
+ `.repeat(this.cfg.linesBetweenQueries+1))}formatStatement(t){const n=new rE({cfg:this.cfg,dialectCfg:this.dialect.formatOptions,params:this.params,layout:new vg(new Mg(Pm(this.cfg)))}).format(t.children);return t.hasSemicolon&&(this.cfg.newlineBeforeSemicolon?n.add(X.NEWLINE,";"):n.add(X.NO_NEWLINE,";")),n.toString()}postFormat(t){return this.cfg.tabulateAlias&&(t=k6(t)),(this.cfg.commaPosition==="before"||this.cfg.commaPosition==="tabular")&&(t=b6(t,this.cfg.commaPosition,Pm(this.cfg))),t}}class Ns extends Error{}function j6(e){if("multilineLists"in e)throw new Ns("multilineLists config is no more supported.");if("newlineBeforeOpenParen"in e)throw new Ns("newlineBeforeOpenParen config is no more supported.");if("newlineBeforeCloseParen"in e)throw new Ns("newlineBeforeCloseParen config is no more supported.");if("aliasAs"in e)throw new Ns("aliasAs config is no more supported.");if(e.expressionWidth<=0)throw new Ns(`expressionWidth config must be positive number. Received ${e.expressionWidth} instead.`);if(e.commaPosition==="before"&&e.useTabs)throw new Ns("commaPosition: before does not work when tabs are used for indentation.");return e.params&&!X6(e.params)&&console.warn('WARNING: All "params" option values should be strings.'),e}function X6(e){return(e instanceof Array?e:Object.values(e)).every(t=>typeof t=="string")}const Pg={bigquery:"bigquery",db2:"db2",hive:"hive",mariadb:"mariadb",mysql:"mysql",n1ql:"n1ql",plsql:"plsql",postgresql:"postgresql",redshift:"redshift",spark:"spark",sqlite:"sqlite",sql:"sql",trino:"trino",transactsql:"transactsql",tsql:"transactsql",singlestoredb:"singlestoredb",snowflake:"snowflake"},K6=Object.keys(Pg),z6={tabWidth:2,useTabs:!1,keywordCase:"preserve",indentStyle:"standard",logicalOperatorNewline:"before",tabulateAlias:!1,commaPosition:"after",expressionWidth:50,linesBetweenQueries:1,denseOperators:!1,newlineBeforeSemicolon:!1},q6=(e,t={})=>{if(typeof t.language=="string"&&!K6.includes(t.language))throw new Ns(`Unsupported SQL dialect: ${t.language}`);const n=Pg[t.language||"sql"];return J6(e,{...t,dialect:zD[n]})},J6=(e,{dialect:t,...n})=>{if(typeof e!="string")throw new Error("Invalid query argument. Expected string, instead got "+typeof e);const r=j6({...z6,...n});return new W6(u6(t),r).format(e)},Dg=/^db(?:\.[A-Za-z]+)*$/,wr={avgDuration:"AVG_DURATION",timeSpent:"TIME_SPENT",description:"DESC",avgEncodedSize:"AVG_ENCODED_SIZE"},Z6=[{id:"description",title:"Resource Description",sortKey:wr.description,primary:!0},{id:"avgDuration",title:"Avg Duration",sortKey:wr.avgDuration},{id:"timeSpent",title:"Time Spent",sortKey:wr.timeSpent},{id:"avgEncodedSize",title:"Avg Encoded Size",sortKey:wr.avgEncodedSize}],za={queryDesc:"QUERY_DESCRIPTION",timeSpent:"TIME_SPENT",avgDuration:"AVG_DURATION"},Q6=[{id:"queryDesc",title:"Query Description",sortKey:za.queryDesc,primary:!0},{id:"avgDuration",title:"Avg Duration",sortKey:za.avgDuration},{id:"timeSpent",title:"Time Spent",sortKey:za.timeSpent}],Ci={count:"count",lastSeen:"lastSeen"},$6=[{id:"transaction",title:"Transaction",primary:!0},{id:"lastSeen",title:"Last Seen",sortKey:Ci.lastSeen},{id:"count",title:"Count",sortKey:Ci.count}],gi={timestamp:"timestamp",duration:"duration"},e8=[{id:"eventId",title:"Event Id",primary:!0},{id:"toalDuration",title:"Total Duration",sortKey:gi.duration},{id:"timestamp",title:"Timestamp",sortKey:gi.timestamp},{id:"traceId",title:"Trace Id"}],qa={foundIn:"FOUND_IN",spanId:"SPAN_ID",timeSpent:"TIME_SPENT"},t8=[{id:"foundIn",title:"Found In",sortKey:qa.foundIn,primary:!0},{id:"spanId",title:"Span Id",sortKey:qa.spanId},{id:"timeSpent",title:"Time Spent",sortKey:qa.timeSpent}],an={pages:"Pages",lcp:"LCP",fcp:"FCP",fid:"FID",cls:"CLS",ttfb:"TTFB",score:"PERFORMANCE_TOTAL_SCORE"},n8=[{id:"pages",title:"Pages",sortKey:an.pages,primary:!0},{id:"lcp",title:"LCP",sortKey:an.lcp},{id:"fcp",title:"FCP",sortKey:an.fcp},{id:"fid",title:"FID",sortKey:an.fid},{id:"cls",title:"CLS",sortKey:an.cls},{id:"ttfb",title:"TTFB",sortKey:an.ttfb},{id:"score",title:"Perf Score",sortKey:an.score}],xg={profiles:[{name:"Chrome",scoreComponents:[{measurement:"fcp",weight:.15,p10:900,p50:1600,optional:!1},{measurement:"lcp",weight:.3,p10:1200,p50:2400,optional:!1},{measurement:"fid",weight:.3,p10:100,p50:300,optional:!0},{measurement:"cls",weight:.15,p10:.1,p50:.25,optional:!1},{measurement:"ttfb",weight:.1,p10:200,p50:400,optional:!1}],condition:{op:"eq",name:"event.contexts.browser.name",value:"Chrome"}}]};function wg(e,t=2){if(e==0)return"0 B";const n=1024,r=t,a=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,s)).toFixed(r))+" "+a[s]}const Ug=({title:e,titleId:t,...n})=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",className:"bi bi-chevron-down",viewBox:"0 0 16 16","aria-labelledby":t,...n},e?b.createElement("title",{id:t},e):null,b.createElement("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"}));function r8({handleResize:e,isResizing:t,setIsResizing:n,...r}){const[a,s]=b.useState(!1),i=u=>{u.target instanceof HTMLDivElement&&e(u)},o=u=>{u.preventDefault(),s(!0),n(!0),document.addEventListener("mousemove",i),document.addEventListener("mouseup",l)},l=()=>{n(!1),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l)};return A.jsx("div",{className:Se("resizer","absolute left-0 top-0 h-full w-1 cursor-col-resize rounded-sm p-0.5 transition-colors",a||t?"bg-primary-600 translate-x-[-2px] transform":""),onClick:u=>u.preventDefault(),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onMouseOver:()=>s(!0),onMouseDown:o,...r})}const a8=({span:e,startTimestamp:t,totalDuration:n,depth:r=1,traceContext:a,totalTransactions:s=0,spanNodeWidth:i,setSpanNodeWidth:o=()=>{},query:l})=>{var u,c;const{spanId:E}=cs(),f=b.useRef(null),[S,_]=b.useState(e.transaction&&s>1&&r!==1||r>=15),[C,I]=b.useState(!1),d=vl(e.start_timestamp,e.timestamp),p=h=>{if(f.current){const O=f.current.getBoundingClientRect(),T=(h.clientX-O.left)/O.width*100;o(T)}},m=l?e.span_id.includes(l)||((u=e.op)==null?void 0:u.includes(l))||((c=e.description)==null?void 0:c.includes(l)):!1;return A.jsxs("li",{className:"pl-4",ref:f,children:[A.jsxs(Jt,{className:Se("hover:bg-primary-900 group flex text-sm",m?"bg-primary-200 bg-opacity-20":"",E===e.span_id?"bg-primary-900":""),style:{pointerEvents:C?"none":"auto"},to:`/explore/traces/${e.trace_id}/spans/${e.span_id}`,children:[A.jsxs("div",{className:Se("node group-hover:bg-primary-900",m?"bg-transparent":"",e.status&&e.status!=="ok"?"text-red-400":"",E===e.span_id?"bg-primary-900":"bg-primary-950"),style:{width:`${i}%`},children:[(e.children||[]).length>0&&A.jsxs("div",{className:"bg-primary-600 z-10 mr-1 flex items-center gap-1 rounded-lg px-1 text-xs font-bold text-white",onClick:h=>{h.preventDefault(),_(O=>!O)},children:[(e.children||[]).length,A.jsx(Ug,{width:12,height:12,className:Se("transition",S?"rotate-0":"rotate-180")})]}),e.transaction&&A.jsx(Ka,{size:16,platform:e.transaction.platform}),e.op&&A.jsxs(A.Fragment,{children:[A.jsx("span",{className:"font-bold",children:e.op}),A.jsx("span",{className:"text-primary-400",children:"–"})]}),A.jsx("span",{className:"block truncate",title:e.description||e.span_id,children:e.description||e.span_id})]}),A.jsxs("div",{className:Se("waterfall",m?"!bg-transparent":""),style:{left:`${i}%`},children:[A.jsx(r8,{setIsResizing:I,isResizing:C,handleResize:p}),A.jsx("div",{className:"bg-primary-900 absolute -m-0.5 w-full p-0.5",style:{left:`calc(min(${(e.start_timestamp-t)/n*100}%, 95% - 1px) + 4px)`,width:`max(1px, ${d/n*95}%)`},children:A.jsxs("span",{className:Se("whitespace-nowrap",fM(d)),children:[d.toLocaleString()," ms"]})})]})]}),!S&&A.jsx(jh,{traceContext:a,tree:e.children||[],startTimestamp:t,totalDuration:n,depth:r+1,totalTransactions:s,spanNodeWidth:i,setSpanNodeWidth:o,query:l})]},e.span_id)};function jh({traceContext:e,tree:t,startTimestamp:n,totalDuration:r,depth:a=1,totalTransactions:s,spanNodeWidth:i,setSpanNodeWidth:o,query:l}){return!t||!t.length?null:A.jsx("ul",{className:"tree",children:t.map(u=>A.jsx(a8,{traceContext:e,depth:a,span:u,totalTransactions:s,startTimestamp:n,totalDuration:r,spanNodeWidth:i,setSpanNodeWidth:o,query:l},u.span_id))})}function s8({desc:e,dbType:t}){if(e.startsWith("{")||t==="mongodb")try{return A.jsx(Gi,{data:JSON.parse(e)})}catch{}let n=e;if(e.match(/^(SELECT|INSERT|UPDATE|DELETE|TRUNCATE|ALTER) /i))try{n=q6(e.replace(/([\s,(])(%[a-z])([\s,)])/gim,"$1?$3"),{language:t||"sql"})}catch(r){console.error(r)}return A.jsx("pre",{className:"text-primary-300 whitespace-pre-wrap break-words font-mono text-sm",children:n})}function i8(e,t){return typeof t=="number"?e.indexOf("size")!==-1||e.indexOf("length")!==-1?wg(t):t.toLocaleString():`${t}`}function o8({span:e}){var t,n;let r=null,a=null;return e.op&&Dg.test(e.op)&&e.description?(a="Query",r=A.jsx(s8,{desc:e.description,dbType:(t=e.data)==null?void 0:t["db.system"]})):e.op==="resource.img"&&((n=e.description)==null?void 0:n.indexOf("/"))===0?(a="Preview",r=A.jsx("a",{href:e.description,className:"border-primary-950 hover:border-primary-700 -m-2 inline-block max-w-sm cursor-pointer rounded border p-1",children:A.jsx("img",{src:e.description,alt:"preview",style:{maxHeight:300}})})):e.description?(a="Description",r=A.jsx("pre",{className:"text-primary-300 whitespace-pre-wrap break-words font-mono text-sm",children:e.description})):r=A.jsx("div",{className:"text-primary-300",children:"No description recorded for this span."}),A.jsxs("div",{children:[a&&A.jsx("h2",{className:"mb-2 font-bold uppercase",children:a}),r]})}function l8({traceContext:e,span:t,startTimestamp:n,totalDuration:r,totalTransactions:a}){var s;const[i,o]=b.useState(50),l=vl(t.start_timestamp,t.timestamp),u=tt.getEventsByTrace(t.trace_id).filter(c=>c.type!=="transaction"&&"exception"in c);return A.jsxs(fg,{backto:`/explore/traces/${t.trace_id}`,children:[A.jsx(pg,{title:"Span Details",subtitle:A.jsxs(A.Fragment,{children:[t.op&&A.jsxs(A.Fragment,{children:[t.op," ",A.jsx("span",{className:"text-primary-500",children:"—"})," "]}),t.span_id]}),backto:`/explore/traces/${t.trace_id}`}),A.jsxs("div",{className:"space-y-6",children:[A.jsx("div",{children:A.jsxs("div",{className:"flex flex-col space-y-4",children:[A.jsxs("div",{className:"text-primary-300 flex flex-1 items-center gap-x-1",children:[A.jsx(JE,{date:t.start_timestamp}),A.jsx("span",{children:"—"}),A.jsxs("span",{children:[A.jsxs("strong",{children:[vl(n,t.start_timestamp)," ms"]})," into trace"]})]}),A.jsx("div",{className:"flex-1",children:A.jsx("div",{className:"border-primary-800 relative h-8 border py-1",children:A.jsx("div",{className:"bg-primary-800 absolute bottom-0 top-0 -m-0.5 flex w-full items-center p-0.5",style:{left:`min(${(t.start_timestamp-n)/r*100}%, 100% - 1px)`,width:`max(1px, ${l/r*100}%)`},children:A.jsxs("span",{className:"whitespace-nowrap",children:[l," ms"]})})})})]})}),u.length>0&&A.jsxs("div",{className:"flex flex-col items-start",children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Related Errors"}),u.map(c=>A.jsx(Jt,{className:"cursor-pointer underline",to:`/errors/${c.event_id}`,children:A.jsx(ag,{event:c})},c.event_id))]}),A.jsx(o8,{span:t}),A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Tags"}),t.tags&&Object.keys(t.tags).length?A.jsx("table",{className:"w-full text-sm",children:A.jsx("tbody",{children:Object.entries(t.tags).map(([c,E])=>A.jsxs("tr",{className:"text-primary-300",children:[A.jsx("th",{className:" w-1/12 py-0.5 pr-4 text-left font-mono font-normal",children:A.jsx("div",{className:"w-full truncate",children:c})}),A.jsx("td",{className:"py-0.5",children:A.jsx("pre",{className:"whitespace-nowrap font-mono",children:JSON.stringify(E,void 0,2)})})]},c))})}):A.jsx("div",{className:"text-primary-300",children:"No tags recorded for this span."})]}),A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Context"}),A.jsx("table",{className:"w-full text-sm",children:A.jsx("tbody",{children:[["status",t.status||""],["trace",t.trace_id],["span",t.span_id],["parent",t.parent_span_id?A.jsx(Jt,{className:"underline",to:`/explore/traces/${t.trace_id}/spans/${t.parent_span_id}`,children:t.parent_span_id},`link-to-${t.parent_span_id}`):""],["op",t.op]].map(([c,E])=>A.jsxs("tr",{className:"text-primary-300",children:[A.jsx("th",{className:" w-1/12 py-0.5 pr-4 text-left font-mono font-normal",children:A.jsx("div",{className:"w-full truncate",children:c})}),A.jsx("td",{className:"py-0.5",children:A.jsx("pre",{className:"whitespace-nowrap font-mono",children:E})})]},c))})})]}),t.data&&A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Data"}),A.jsx("table",{className:"w-full text-sm",children:A.jsx("tbody",{children:Object.entries(t.data).map(([c,E])=>A.jsxs("tr",{className:"text-primary-300",children:[A.jsx("th",{className:" w-1/12 py-0.5 pr-4 text-left font-mono font-normal",children:A.jsx("div",{className:"w-full truncate",children:c})}),A.jsx("td",{className:"py-0.5",children:A.jsx("pre",{className:"whitespace-nowrap font-mono",children:i8(c,E)})})]},c))})})]}),(((s=t.children)==null?void 0:s.length)??0)>0&&A.jsxs("div",{children:[A.jsx("h2",{className:"mb-2 font-bold uppercase",children:"Sub-tree"}),A.jsx(jh,{traceContext:e,tree:[t],startTimestamp:n,totalDuration:r,totalTransactions:a,spanNodeWidth:i,setSpanNodeWidth:o})]})]})]})}const u8=50;function Dm({traceId:e}){const{spanId:t}=cs(),[n,r]=b.useState(u8),a=tt.getTraceById(e),s=t?tt.getSpanById(e,t):void 0,i=a.start_timestamp,o=a.timestamp-i;return A.jsxs(A.Fragment,{children:[A.jsx("div",{className:"px-6 py-4",children:A.jsxs("div",{className:"text-primary-300 flex flex-1 items-center gap-x-1",children:[A.jsx("div",{className:"text-primary-200",children:A.jsx(JE,{date:a.start_timestamp})}),A.jsx("span",{children:"—"}),A.jsxs("span",{children:[A.jsxs("strong",{className:"text-primary-200 font-bold",children:[vl(a.start_timestamp,a.timestamp).toLocaleString()," ms"]})," ","recorded in"," ",A.jsxs("strong",{className:"text-primary-200 font-bold",children:[a.spans.length.toLocaleString()," spans"]})]})]})}),A.jsx("div",{className:"flex-1 px-2 pb-6",children:A.jsx(jh,{traceContext:a,tree:a.spanTree,startTimestamp:i,totalDuration:o,totalTransactions:(a.transactions||[]).length,spanNodeWidth:n,setSpanNodeWidth:r})}),s?A.jsx(l8,{traceContext:a,startTimestamp:i,totalDuration:o,span:s,totalTransactions:(a.transactions||[]).length}):null]})}function c8(){const{traceId:e}=cs(),t=ni(e),n=Ta();if(!e)return A.jsx("p",{className:"text-primary-300 p-6",children:"Unknown trace id"});const r=tt.getTraceById(e);if(!r)return A.jsxs("p",{className:"text-primary-300 p-6",children:["Trace not found. Check for more"," ",A.jsx(Jt,{to:"/traces",className:"underline",children:"traces"})]});const a=t.filter(i=>{var o,l,u,c;return i.type!=="transaction"&&((l=(o=i.contexts)==null?void 0:o.trace)!=null&&l.trace_id?n.isLocalToSession((c=(u=i.contexts)==null?void 0:u.trace)==null?void 0:c.trace_id):null)!==!1}).length,s=[ar("details","Details"),ar("context","Context"),ar("errors","Errors",{notificationCount:{count:a,severe:a>0}})];return A.jsxs(A.Fragment,{children:[A.jsx(pM,{trace:r}),A.jsx(Xl,{tabs:s,nested:!0}),A.jsxs(jn,{children:[A.jsx(we,{path:"details",element:A.jsx(Dm,{traceId:e})}),A.jsx(we,{path:"spans/:spanId",element:A.jsx(Dm,{traceId:e})}),A.jsx(we,{path:"context",element:A.jsx(cg,{event:r.rootTransaction||r.transactions[0]})}),A.jsx(we,{path:"errors",element:A.jsx(dg,{traceId:e})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:`/explore/traces/${e}/details`,replace:!0})})]})]})}const E8=()=>(b.useContext(ti),tt.getTraces());function d8(){const e=E8(),t=Ta(),n=To(),[r,a]=b.useState(!n.experiments["sentry:focus-local-events"]),s=r?e:e.filter(o=>t.isLocalToSession(o.trace_id)!==!1),i=e.length-s.length;return A.jsx(A.Fragment,{children:e.length!==0?A.jsxs(Wh,{children:[i>0&&A.jsx(Jl,{itemCount:i,onClick:()=>{a(!0)}}),s.map(o=>{const l=vl(o.start_timestamp,o.timestamp);return A.jsxs(Jt,{className:"hover:bg-primary-900 flex cursor-pointer items-center gap-x-4 px-6 py-2",to:o.trace_id,children:[A.jsx(Tg,{trace:o}),A.jsxs("div",{className:"text-primary-300 flex w-48 flex-col truncate font-mono text-sm",children:[A.jsxs("div",{className:"flex items-center gap-x-2",children:[A.jsx("div",{children:Vs(o.trace_id)}),t.isLocalToSession(o.trace_id)?A.jsx(Vh,{title:"This trace is part of your local session.",children:"Local"}):null]}),A.jsx(qE,{date:o.start_timestamp})]}),A.jsx(hg,{trace:o}),A.jsx("div",{className:"flex flex-col truncate font-mono",children:A.jsxs("div",{className:"text-primary-300 flex space-x-2 text-sm",children:[A.jsx("div",{className:Se(o.status==="ok"?"text-green-400":o.status?"text-red-400":""),children:o.status||""}),A.jsx("div",{children:"—"}),A.jsxs("div",{children:[l," ms"]}),A.jsx("div",{children:"—"}),A.jsxs("div",{children:[o.spans.length.toLocaleString()," spans, ",o.transactions.length.toLocaleString()," txns"]})]})})]},o.trace_id)})]}):A.jsx("div",{className:"text-primary-300 p-6",children:"Looks like there's no traces recorded matching this query. 🤔"})})}function p8(){return A.jsxs(jn,{children:[A.jsx(we,{path:"/:traceId/*",element:A.jsx(c8,{})}),A.jsx(we,{path:"/",element:A.jsx(d8,{})})]})}function f8(){const e=tt.getTraces().filter(n=>tt.isTraceLocal(n.trace_id)!==!1),t=[ar("traces","Traces",{notificationCount:{count:e.length}}),ar("sdks","SDKs"),ar("envelopes","Envelopes")];return A.jsxs(A.Fragment,{children:[A.jsx(Xl,{tabs:t,nested:!0}),A.jsxs("div",{className:"flex-1",children:[A.jsxs(jn,{children:[A.jsx(we,{path:"/envelopes/*",element:A.jsx(lM,{})}),A.jsx(we,{path:"/sdks/*",element:A.jsx(EM,{})}),A.jsx(we,{path:"/traces/*",element:A.jsx(p8,{})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:"/explore/traces",replace:!0})})]}),A.jsx(BE,{})]})]})}function T8(){return A.jsx(ho,{children:A.jsx(jn,{children:A.jsx(we,{path:"/*",element:A.jsx(f8,{})})})})}const QE=()=>{b.useContext(ti);const e=Ta(),t=tt.getTraces(),n=t.filter(s=>e.isLocalToSession(s.trace_id)!==!1),r=t.reduce((s,i)=>[...s,...i.spans],[]),a=n.reduce((s,i)=>[...s,...i.spans],[]);return{allSpans:r,localSpans:a}},Ao=({title:e,titleId:t,...n})=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",width:24,height:24,viewBox:"0 0 24 24","aria-labelledby":t,...n},e?b.createElement("title",{id:t},e):null,b.createElement("path",{d:"M17,14 C17.8092996,14 18.2680938,14.9010044 17.836059,15.5493995 L17.7682213,15.6401844 L12.7682213,21.6401844 C12.3950792,22.0879549 11.7283228,22.1178063 11.3160321,21.7297385 L11.2317787,21.6401844 L6.23177872,15.6401844 C5.71367776,15.0184632 6.11213562,14.0891988 6.88682851,14.0060047 L7,14 L17,14 Z M11.2317787,2.3598156 C11.6049208,1.91204508 12.2716772,1.88219371 12.6839679,2.2702615 L12.7682213,2.3598156 L17.7682213,8.3598156 C18.2863222,8.98153675 17.8878644,9.91080124 17.1131715,9.99399528 L17,10 L7,10 C6.19070043,10 5.73190618,9.09899556 6.16394105,8.45060047 L6.23177872,8.3598156 L11.2317787,2.3598156 Z"})),So=({title:e,titleId:t,...n})=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",width:24,height:24,viewBox:"-96 0 512 512","aria-labelledby":t,...n},e?b.createElement("title",{id:t},e):null,b.createElement("path",{xmlns:"http://www.w3.org/2000/svg",d:"M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41z"}));function Ro({defaultSortType:e="",defaultAsc:t=!1}){const[n,r]=b.useState({active:e,asc:t});return{toggleSortOrder:a=>r(s=>s.active===a?{active:a,asc:!s.asc}:{active:a,asc:!1}),sort:n,setSort:r}}const h8=({query:e,spanData:t})=>{const n=t.filter(a=>a.description===e).map(a=>a.timestamp-a.start_timestamp),r=n.reduce((a,s)=>a+s,0);return{avgDuration:r/n.length,timeSpent:r,description:e}},xm={[za.queryDesc]:(e,t)=>e.description<t.description?-1:e.description>t.description?1:0,[za.avgDuration]:(e,t)=>e.avgDuration-t.avgDuration,[za.timeSpent]:(e,t)=>e.timeSpent-t.timeSpent},A8=({showAll:e})=>{const{allSpans:t,localSpans:n}=QE(),{sort:r,toggleSortOrder:a}=Ro({defaultSortType:za.timeSpent}),s=b.useMemo(()=>{const i=xm[r.active]||xm[za.timeSpent],o=(e?t:n).filter(u=>Dg.test(u.op||"")),l=new Set(o.map(u=>String(u==null?void 0:u.description).trim()));return l.delete(""),[...l].map(u=>h8({query:u,spanData:o})).sort((u,c)=>r.asc?i(u,c):i(c,u))},[t,n,e,r]);return s!=null&&s.length?A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:Q6.map(i=>A.jsx("th",{scope:"col",className:Se("text-primary-100 select-none px-6 py-3.5 text-sm font-semibold",i.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer items-center gap-1",i.primary?"justify-start":"justify-end"),onClick:()=>a(i.sortKey),children:[i.title,r.active===i.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",r.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},i.id))})}),A.jsx("tbody",{children:s.map(i=>A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/insights/queries/${btoa(i.description)}`,children:i.description})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.avgDuration)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.timeSpent)})]},i.description))})]}):A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No Database queries found. Add integration in Sentry initialization to track Database queries."})};function Xh({crumbs:e}){return A.jsx("div",{className:"flex items-center gap-1 px-6 py-4",children:e.map((t,n)=>{const r=n===e.length-1;return A.jsxs("div",{className:"flex items-center gap-1",children:[n>0&&A.jsx(Ug,{width:12,height:12,className:"stroke-primary-300 -rotate-90"}),t.link&&t.to?A.jsx(Jt,{className:Se(r?"text-primary-200":"text-primary-300","hover:text-primary-100 truncate text-sm hover:underline"),to:t.to,children:t.label}):A.jsx("span",{className:Se(r?"text-primary-200":"text-primary-300","truncate text-sm"),children:t.label})]},t.id)})})}const wm={[qa.foundIn]:(e,t)=>e.trace_id<t.trace_id?-1:e.trace_id>t.trace_id?1:0,[qa.spanId]:(e,t)=>e.span_id<t.span_id?-1:e.span_id>t.span_id?1:0,[qa.timeSpent]:(e,t)=>e.timestamp-e.start_timestamp-(t.timestamp-t.start_timestamp)},S8=({showAll:e})=>{const{allSpans:t,localSpans:n}=QE(),{type:r}=cs(),{sort:a,toggleSortOrder:s}=Ro({defaultSortType:qa.timeSpent}),i=b.useMemo(()=>{if(!r)return[];const o=e?t:n,l=wm[a.active]||wm[qa.timeSpent],u=atob(r);return o.filter(c=>c.description===u).sort((c,E)=>a.asc?l(c,E):l(E,c))},[t,n,e,a,r]);return!i||!i.length?A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"Query not found."}):A.jsxs(A.Fragment,{children:[A.jsx(Xh,{crumbs:[{id:"queries",label:"Queries",link:!0,to:"/insights/queries"},{id:"querySummary",label:"Query Summary",link:!1}]}),A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:t8.map(o=>A.jsx("th",{scope:"col",className:Se("text-primary-100 px-6 py-3.5 text-sm font-semibold",o.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer select-none items-center gap-1",o.primary?"justify-start":"justify-end"),onClick:()=>s(o.sortKey),children:[o.title,a.active===o.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",a.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},o.id))})}),A.jsx("tbody",{children:i.map(o=>A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${o.trace_id}`,children:Vs(o.trace_id)})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${o.trace_id}/spans/${o.span_id}`,children:Vs(o.span_id)})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(o.timestamp-o.start_timestamp)})]},o.span_id))})]})]})},R8=e=>{switch(e){case"top":return"bottom-full left-1/2 transform -translate-x-1/2 mb-2";case"bottom":return"top-full left-1/2 transform -translate-x-1/2 mt-2";case"left":return"top-1/2 right-full transform -translate-y-1/2 mr-2";default:return"top-1/2 left-full transform -translate-y-1/2 ml-2"}},m8=({content:e,position:t="right",children:n})=>{const[r,a]=b.useState(!1),s=()=>{a(!0)},i=()=>{a(!1)};return A.jsxs("div",{className:"relative inline-block max-w-full",onMouseEnter:s,onMouseLeave:i,children:[n,r&&A.jsx("div",{className:Se("absolute z-10",R8(t)),children:e})]})},_8=({resource:e,spanData:t})=>{const n=t.filter(i=>i.description===e),r=n.reduce((i,o)=>i+(o.timestamp-o.start_timestamp),0),a=r/n.length,s=n.reduce((i,o)=>{const l=o.data&&o.data["http.response_content_length"];return typeof l=="number"?i+l:i},0)/n.length;return{avgDuration:a,timeSpent:r,description:e,avgEncodedSize:s,similarResources:n}},N8=(e,t)=>{if(t.type)return e.filter(n=>n.description===t.type);if(t.regex){const n=new RegExp(t.regex);return e.filter(r=>n.test(r.op||""))}return[]},Um={[wr.description]:(e,t)=>e.description<t.description?-1:e.description>t.description?1:0,[wr.avgEncodedSize]:(e,t)=>e.avgEncodedSize-t.avgEncodedSize,[wr.avgDuration]:(e,t)=>e.avgDuration-t.avgDuration,[wr.timeSpent]:(e,t)=>e.timeSpent-t.timeSpent},O8=({showAll:e})=>{const{allSpans:t,localSpans:n}=QE(),{sort:r,toggleSortOrder:a}=Ro({defaultSortType:wr.timeSpent}),s=b.useMemo(()=>{const i=N8(e?t:n,{regex:/resource\.[A-Za-z]+/}),o=new Set(i.map(c=>String(c==null?void 0:c.description).trim()));o.delete("");const l=[...o],u=Um[r.active]||Um[wr.timeSpent];return l.map(c=>_8({resource:c,spanData:i})).sort((c,E)=>r.asc?u(c,E):u(E,c))},[r,e,t,n]);return s!=null&&s.length?A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:Z6.map(i=>A.jsx("th",{scope:"col",className:Se("text-primary-100 px-6 py-3.5 text-sm font-semibold",i.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer select-none items-center gap-1",i.primary?"justify-start":"justify-end"),onClick:()=>a(i.sortKey),children:[i.title,r.active===i.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",r.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},i.id))})}),A.jsx("tbody",{children:s.map(i=>{var o;return A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 relative w-2/5 whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(m8,{position:"right",content:i.similarResources[0].op==="resource.img"&&((o=i.description)==null?void 0:o.indexOf("/"))===0&&A.jsxs("div",{className:"bg-primary-800 cursor-pointer rounded-lg p-4 shadow-md",children:[A.jsx("h2",{className:"mb-2 font-bold",children:"Preview"}),A.jsx("img",{src:i.description,className:"inline-block max-h-[150px] max-w-[150px] rounded p-1",alt:"preview"})]}),children:A.jsx("div",{className:"truncate",children:i.description})})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.avgDuration)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(i.timeSpent)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:wg(i.avgEncodedSize)})]},i.description)})})]}):A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No Resource found."})},kg=Math.sqrt(2);function I8(e){const t=.254829592,n=-.284496736,r=1.421413741,a=-1.453152027,s=1.061405429,i=.3275911,o=e<0?-1:1,l=Math.abs(e),u=1/(1+i*l),c=1-((((s*u+a)*u+r)*u+n)*u+t)*u*Math.exp(-l*l);return o*c}function C8(e,t){return Math.abs(Math.log(e)-Math.log(t))/(kg*.9061938024368232)}function g8(e,t,n){return .5*(1-I8((Math.log(e)-Math.log(n))/(kg*C8(n,t))))}function Gg(e,t){for(const n of t.profiles){const r=e.measurements;if(r){let a=!1,s=0,i=0;for(const o of n.scoreComponents)o.optional&&!Object.prototype.hasOwnProperty.call(r,o.measurement)||(i+=o.weight);if(Math.abs(i)<Number.EPSILON)break;for(const o of n.scoreComponents){let l=0;if(Object.prototype.hasOwnProperty.call(r,o.measurement)){l=o.weight/i;const u=r[o.measurement].value,c=g8(Math.max(0,u),o.p10,o.p50),E=c*l;s+=E,a=!0,r[`score.${o.measurement}`]={value:c,unit:"ratio"}}else r[`score.${o.measurement}`]={value:0,unit:"ratio"};r[`score.weight.${o.measurement}`]={value:l,unit:"ratio"}}a&&(r["score.total"]={value:s,unit:"ratio"});break}}}function L8(e,t,n,r,a,s,i,o){const l=e/2+r+o,u={x:t+e/2-s/2,y:n+e/2+i/2},c=Object.values(a).reduce((x,F)=>x+F,0),E=-90,f=x=>x/c*360,[S,_,C,I,d]=[a.lcp,a.fcp,a.fid,a.cls,a.ttfb].map(f),p=u.x+l*Math.cos((E+S/2)*Math.PI/180),m=u.y+l*Math.sin((E+S/2)*Math.PI/180),h=u.x+l*Math.cos((E+S+_/2)*Math.PI/180),O=u.y+l*Math.sin((E+S+_/2)*Math.PI/180),T=u.x+l*Math.cos((E+S+_+C/2)*Math.PI/180),N=u.y+l*Math.sin((E+S+_+C/2)*Math.PI/180),g=u.x+l*Math.cos((E+S+_+C+I/2)*Math.PI/180),D=u.y+l*Math.sin((E+S+_+C+I/2)*Math.PI/180),R=u.x-12+l*Math.cos((E+S+_+C+I+d/2)*Math.PI/180),v=u.y+l*Math.sin((E+S+_+C+I+d/2)*Math.PI/180);return{lcpX:p,lcpY:m,fcpX:h,fcpY:O,fidX:T,fidY:N,clsX:g,clsY:D,ttfbX:R,ttfbY:v}}const km={[an.pages]:(e,t)=>e.transaction&&t.transaction&&e.transaction<t.transaction?-1:e.transaction&&t.transaction&&e.transaction>t.transaction?1:0,[an.lcp]:(e,t)=>e.measurements["score.lcp"].value-t.measurements["score.lcp"].value,[an.fid]:(e,t)=>e.measurements["score.fid"].value-t.measurements["score.fid"].value,[an.fcp]:(e,t)=>e.measurements["score.fcp"].value-t.measurements["score.fcp"].value,[an.cls]:(e,t)=>e.measurements["score.cls"].value-t.measurements["score.cls"].value,[an.ttfb]:(e,t)=>e.measurements["score.ttfb"].value-t.measurements["score.ttfb"].value,[an.score]:(e,t)=>e.measurements["score.total"].value-t.measurements["score.total"].value},y8=()=>{const e=ni(),t=Js(),{sort:n,toggleSortOrder:r}=Ro({defaultSortType:an.score}),a=b.useMemo(()=>{const s=km[n.active]||km[an.score];return e.filter(i=>{var o,l;return i.measurements&&((l=(o=i==null?void 0:i.contexts)==null?void 0:o.trace)==null?void 0:l.op)==="pageload"}).map(i=>{const o={...i};return Gg(o,xg),o}).sort((i,o)=>n.asc?s(i,o):s(o,i))},[e,n]);return a!=null&&a.length?A.jsx(A.Fragment,{children:A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:n8.map(s=>A.jsx("th",{scope:"col",className:Se("text-primary-100 px-6 py-3.5 text-sm font-semibold",s.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer select-none items-center gap-1",s.primary?"justify-start":"justify-end"),onClick:()=>r(s.sortKey),children:[s.title,n.active===s.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",n.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"})]})},s.id))})}),A.jsx("tbody",{children:a.map(s=>{var i,o,l,u,c,E;return A.jsxs("tr",{className:"hover:bg-primary-900 cursor-pointer",onClick:()=>t(`/insights/webvitals/${s.event_id}`),children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:s.transaction}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(i=s.measurements)!=null&&i.lcp?En(s.measurements.lcp.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(o=s.measurements)!=null&&o.fcp?En(s.measurements.fcp.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(l=s.measurements)!=null&&l.fid?En(s.measurements.fid.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(u=s.measurements)!=null&&u.cls?s.measurements.cls.value:"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(c=s.measurements)!=null&&c.ttfb?En(s.measurements.ttfb.value):"-"}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:(E=s.measurements["score.total"])!=null&&E.value?Math.trunc(s.measurements["score.total"].value*100):"-"})]},s.event_id)})})]})}):A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No Measurements found."})},b8=-90,v8=1;function M8({values:e,maxValues:t,size:n=20,barWidth:r=3,text:a,textCss:s,segmentColors:i,backgroundColors:o,progressEndcaps:l,onHoverActions:u,onBlur:c,...E}){const f=n/2,S=n/4,_=n/2-r/2,C=2*Math.PI*_,I=b.useMemo(()=>{const d=t.reduce((m,h)=>m+h,0);let p=b8;return t.flatMap((m,h)=>{const O=Math.min(Math.max(e[h],0),m),T=e.length>1?v8:0,N=(1-Math.max(m-T,0)/d)*C,g=(1-Math.max(O-T,0)/d)*C,D=p;p+=360*m/d;const R=_+r/2,v=`${R}-${o[h]}-${i[h]}`;return[A.jsx("circle",{strokeDashoffset:N,r:_,cx:R,cy:R,onMouseOver:()=>u==null?void 0:u[h](),onFocus:()=>u==null?void 0:u[h](),onMouseLeave:()=>c==null?void 0:c(),onBlur:()=>c==null?void 0:c(),className:Se(o[h]),style:{fill:"none",strokeWidth:r,strokeDasharray:`${C} ${C}`,transform:`rotate(${D}deg)`,transformOrigin:"50% 50%",transition:"stroke 300ms"}},`ring-bg-${v}`),A.jsx("circle",{strokeDashoffset:g,strokeLinecap:l,r:_,cx:R,cy:R,onMouseOver:()=>u==null?void 0:u[h](),onFocus:()=>u==null?void 0:u[h](),onMouseLeave:()=>c==null?void 0:c(),onBlur:()=>c==null?void 0:c(),className:Se(i[h]),style:{fill:"none",strokeWidth:r,strokeDasharray:`${C} ${C}`,transform:`rotate(${D}deg)`,transformOrigin:"50% 50%",transition:"stroke 300ms, stroke-dashoffset 300ms"}},`ring-bar-${v}`)]})},[o,r,C,t,u,c,l,_,i,e]);return A.jsxs("svg",{className:"relative",role:"img",height:_*2+r,width:_*2+r,...E,children:[A.jsx("title",{children:"Web Vitals Breakdown"}),I,A.jsx("foreignObject",{height:f,width:f,x:S,y:S,children:a!==void 0?A.jsx("div",{className:Se("text-primary-100 flex h-full w-full items-center justify-center text-xl font-bold",s),children:a}):null})]})}class rT extends Error{}function P8(e,{signal:t}){return new Promise((n,r)=>{t.aborted&&r(new rT);const a=()=>{r(new rT)},s=new IntersectionObserver(i=>{for(const o of i){const l=o.boundingClientRect;n(l),t.removeEventListener("abort",a)}s.disconnect()});t.addEventListener("abort",a),s.observe(e)})}function D8({elem:e,onPositionChange:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,...s}){const i=b.useRef(new AbortController),o=b.useCallback(async u=>{if(!e.current){t(void 0);return}try{const c=await P8(e.current,{signal:i.current.signal});t({height:c.height,left:Math.min(u.clientX-c.left,c.width),top:Math.min(u.clientY-c.top,c.height),width:c.width})}catch(c){if(c instanceof rT)return}},[t,i,e]),l=b.useCallback(()=>{i.current&&(i.current.abort(),i.current=new AbortController),t(void 0)},[t,i]);return{...s,onMouseEnter:u=>{o(u),n==null||n(u)},onMouseMove:u=>{var c;(c=e.current)!=null&&c.contains(u.target)&&(o(u),r==null||r(u))},onMouseLeave:u=>{l(),a==null||a(u)}}}function Fo({webVital:e,coordinates:t,labelCoordinates:n={}}){var r,a;const s=((r=n==null?void 0:n[e])==null?void 0:r.x)??0,i=((a=n==null?void 0:n[e])==null?void 0:a.y)??0;return A.jsx("text",{className:"fill-primary-200 stroke-primary-200 uppercase",x:t.x+s,y:t.y+i,children:e})}const x8=({metricScore:e,metricWeights:t,totalScore:n,size:r=200,barWidth:a=25,left:s=40,top:i=25,labelWidthPadding:o=28,labelHeightPadding:l=14,radiusPadding:u=4})=>{const[c,E]=b.useState(null),[f,S]=b.useState({x:0,y:0}),_=b.useRef(null),C=D8({elem:_,onPositionChange:R=>{if(R){const{left:v,top:x}=R;S({x:v,y:x})}}}),{lcpX:I,lcpY:d,fcpX:p,fcpY:m,fidX:h,fidY:O,clsX:T,clsY:N,ttfbX:g,ttfbY:D}=L8(r,s,i,a,t,o,l,u);return A.jsxs("div",{ref:_,...C,children:[c&&A.jsxs("div",{className:Se("bg-primary-900 border-primary-400 absolute flex w-40 items-center justify-between rounded-lg border p-3 shadow-lg"),style:{transform:`translate3d(${f.x-100}px, ${f.y-74}px, 0px)`},children:[A.jsx("span",{className:"text-primary-200",children:`${c.toUpperCase()} Score:`}),A.jsx("span",{className:"text-primary-200 font-semibold",children:e[`${c}Score`]})]}),A.jsxs("svg",{height:r+3*i,width:r+3*s,children:[A.jsxs(A.Fragment,{children:[t.lcp>0&&A.jsx(Fo,{webVital:"lcp",coordinates:{x:I,y:d}}),t.fcp>0&&A.jsx(Fo,{webVital:"fcp",coordinates:{x:p,y:m}}),t.fid>0&&A.jsx(Fo,{webVital:"fid",coordinates:{x:h,y:O}}),t.cls>0&&A.jsx(Fo,{webVital:"cls",coordinates:{x:T,y:N}}),t.ttfb>0&&A.jsx(Fo,{webVital:"ttfb",coordinates:{x:g,y:D}})]}),A.jsx(M8,{values:[(e.lcpScore??0)*t.lcp*.01,(e.fcpScore??0)*t.fcp*.01,(e.fidScore??0)*t.fid*.01,(e.clsScore??0)*t.cls*.01,(e.ttfbScore??0)*t.ttfb*.01],maxValues:[t.lcp,t.fcp,t.fid,t.cls,t.ttfb],text:n,size:r,barWidth:a,segmentColors:["stroke-primary-300","stroke-primary-400","stroke-primary-500","stroke-primary-600","stroke-primary-700"],backgroundColors:["stroke-gray-400","stroke-gray-400","stroke-gray-400","stroke-gray-400","stroke-gray-400"],x:s,y:i,onHoverActions:[()=>E("lcp"),()=>E("fcp"),()=>E("fid"),()=>E("cls"),()=>E("ttfb")],onBlur:()=>E(null)})]})]})},w8=()=>{var e,t,n,r,a;const s=ni(),{page:i}=cs(),o=[];if(s.filter(l=>l.event_id===i).map(l=>{const u={...l};Gg(u,xg),o.push(u)}),i&&o.length){const l={fcpScore:Math.trunc(o[0].measurements["score.fcp"].value*100),lcpScore:Math.trunc(o[0].measurements["score.lcp"].value*100),fidScore:Math.trunc(o[0].measurements["score.fid"].value*100),clsScore:Math.trunc(o[0].measurements["score.cls"].value*100),ttfbScore:Math.trunc(o[0].measurements["score.ttfb"].value*100)},u={fcp:Math.trunc(o[0].measurements["score.weight.fcp"].value*100),lcp:Math.trunc(o[0].measurements["score.weight.lcp"].value*100),fid:Math.trunc(o[0].measurements["score.weight.fid"].value*100),cls:Math.trunc(o[0].measurements["score.weight.cls"].value*100),ttfb:Math.trunc(o[0].measurements["score.weight.ttfb"].value*100)},c=Math.trunc(o[0].measurements["score.total"].value*100),E=[{id:"fcpScore",description:"First Contentful Paint",label:"FCP",score:(e=o[0].measurements)!=null&&e.fcp?En(o[0].measurements.fcp.value):"-"},{id:"lcpScore",description:"Largest Contentful Paint",label:"LCP",score:(t=o[0].measurements)!=null&&t.lcp?En(o[0].measurements.lcp.value):"-"},{id:"fidScore",description:"First Input Delay",label:"FID",score:(n=o[0].measurements)!=null&&n.fid?En(o[0].measurements.fid.value):"-"},{id:"clsScore",description:"Cumulative Layout Shift",label:"CLS",score:(r=o[0].measurements)!=null&&r.cls?En(o[0].measurements.cls.value):"-"},{id:"ttfbScore",description:"Time to First Byte",label:"TTFB",score:(a=o[0].measurements)!=null&&a.ttfb?En(o[0].measurements.ttfb.value):"-"}];return A.jsxs(A.Fragment,{children:[A.jsx(Xh,{crumbs:[{id:"webVitals",label:"Web Vitals",link:!0,to:"/insights/webvitals"},{id:"performanceSummary",label:"Performance Summary",link:!1}]}),A.jsxs("div",{className:"w-full px-6",children:[A.jsx("div",{className:"flex w-full items-center justify-center p-6",children:A.jsx(x8,{totalScore:c,metricWeights:u,metricScore:l})}),A.jsx("div",{className:"flex w-full flex-wrap justify-center gap-2",children:E.map(f=>A.jsxs("div",{className:"bg-primary-900 border-primary-400 flex w-80 flex-col items-center gap-4 rounded-lg border p-2 shadow-lg",children:[A.jsx("span",{className:"text-primary-300 text-base font-semibold",children:f.label}),A.jsx("span",{className:"text-primary-300 text-sm font-light",children:f.description}),A.jsx("h2",{className:"text-primary-300 text-lg font-bold",children:f.score??"-"})]},f.id))})]})]})}return A.jsx("p",{className:"text-primary-300 px-6 py-4",children:"No measurement found."})};function U8(){const e=To(),{allSpans:t,localSpans:n}=QE(),[r,a]=b.useState(!e.experiments["sentry:focus-local-events"]),s=t.length-n.length,i=[ar("queries","Queries"),ar("webvitals","Web Vitals"),ar("resources","Resources")];return A.jsxs(A.Fragment,{children:[!r&&s>0&&A.jsx(Jl,{itemCount:s,onClick:()=>{a(!0)}}),A.jsx(Xl,{tabs:i,nested:!0}),A.jsxs("div",{className:"flex-1",children:[A.jsxs(jn,{children:[A.jsx(we,{path:"queries/:type",element:A.jsx(S8,{showAll:r})}),A.jsx(we,{path:"resources",element:A.jsx(O8,{showAll:r})}),A.jsx(we,{path:"webvitals",element:A.jsx(y8,{})}),A.jsx(we,{path:"webvitals/:page",element:A.jsx(w8,{})}),A.jsx(we,{path:"queries",element:A.jsx(A8,{showAll:r})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:"/insights/queries",replace:!0})})]}),A.jsx(BE,{})]})]})}function k8(){return A.jsx(ho,{children:A.jsx(jn,{children:A.jsx(we,{path:"/*",element:A.jsx(U8,{})})})})}function G8({showAll:e}){const{name:t}=cs(),n=ni(),r=Ta(),{sort:a,toggleSortOrder:s}=Ro({defaultSortType:gi.timestamp}),i=b.useMemo(()=>{if(!t)return[];const o={[gi.timestamp]:(f,S)=>f.start_timestamp-S.start_timestamp,[gi.duration]:(f,S)=>f.timestamp+S.start_timestamp-f.start_timestamp-S.timestamp},l=atob(t),u=n.filter(f=>f.type==="transaction").filter(f=>f.transaction===l),c=e?u:u.filter(f=>{var S,_;const C=(_=(S=f.contexts)==null?void 0:S.trace)==null?void 0:_.trace_id;return!C||r.isLocalToSession(C)}),E=o[a.active]||o[gi.timestamp];return c.sort((f,S)=>a.asc?E(f,S):E(S,f))},[a,e,n,r,t]);return A.jsx(A.Fragment,{children:i.length!==0?A.jsxs("div",{children:[A.jsx(Xh,{crumbs:[{id:"transactions",label:"Transactions",link:!0,to:"/performance/transactions"},{id:"txnSummary",label:"Transaction Summary",link:!1}]}),A.jsx("div",{className:"w-11/12 px-6 py-4",children:A.jsx("h1",{className:"truncate text-2xl font-bold",children:atob(t)})}),A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:e8.map(o=>A.jsx("th",{scope:"col",className:Se("text-primary-100 select-none px-6 py-3.5 text-sm font-semibold",o.primary?"w-2/5":"w-[15%]"),children:A.jsxs("div",{className:Se("flex cursor-pointer items-center gap-1",o.primary?"justify-start":"justify-end"),onClick:()=>o.sortKey&&s(o.sortKey),children:[o.title,o.sortKey&&(a.active===o.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",a.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"}))]})},o.id))})}),A.jsx("tbody",{children:i.map(o=>{var l,u,c,E,f,S,_,C;return A.jsxs("tr",{className:"hover:bg-primary-900",children:[A.jsx("td",{className:"text-primary-200 w-2/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${(u=(l=o.contexts)==null?void 0:l.trace)==null?void 0:u.trace_id}/spans/${(E=(c=o.contexts)==null?void 0:c.trace)==null?void 0:E.span_id}`,children:Vs(o.event_id)})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:En(o.timestamp-o.start_timestamp)}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(JE,{date:o.start_timestamp})}),A.jsx("td",{className:"text-primary-200 w-[15%] whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(Jt,{className:"truncate hover:underline",to:`/explore/traces/${(S=(f=o.contexts)==null?void 0:f.trace)==null?void 0:S.trace_id}`,children:Vs((C=(_=o.contexts)==null?void 0:_.trace)==null?void 0:C.trace_id)})})]},o.event_id)})})]})]}):A.jsx("div",{className:"text-primary-300 p-6",children:"Looks like there's no transaction recorded matching this query. 🤔"})})}function F8({showAll:e}){const t=ni(),n=Ta(),r=Js(),{sort:a,toggleSortOrder:s}=Ro({defaultSortType:Ci.lastSeen}),i=b.useMemo(()=>{const o={[Ci.count]:(E,f)=>E[1].transactions.length-f[1].transactions.length,[Ci.lastSeen]:(E,f)=>E[1].lastSeen-f[1].lastSeen},l=o[a.active]||o[Ci.lastSeen],u=t.filter(E=>E.type==="transaction"),c=(e?u:u.filter(E=>{var f,S;const _=(S=(f=E.contexts)==null?void 0:f.trace)==null?void 0:S.trace_id;return!_||n.isLocalToSession(_)})).reduce((E,f)=>(f.transaction&&(f.transaction in E?(E[f.transaction].transactions.push(f),f.start_timestamp&&(E[f.transaction].lastSeen=f.start_timestamp)):E[f.transaction]={transactions:[f],lastSeen:f.start_timestamp}),E),{});return Object.entries(c).sort((E,f)=>a.asc?l(E,f):l(f,E))},[a,e,t,n]);return A.jsx(A.Fragment,{children:i.length!==0?A.jsx("div",{children:A.jsxs("table",{className:"divide-primary-700 w-full table-fixed divide-y",children:[A.jsx("thead",{children:A.jsx("tr",{children:$6.map(o=>A.jsx("th",{scope:"col",className:Se("text-primary-100 select-none px-6 py-3.5 text-sm font-semibold",o.primary?"w-3/5":"w-1/5"),children:A.jsxs("div",{className:Se("flex cursor-pointer items-center gap-1",o.primary?"justify-start":"justify-end"),onClick:()=>o.sortKey&&s(o.sortKey),children:[o.title,o.sortKey&&(a.active===o.sortKey?A.jsx(So,{width:12,height:12,className:Se("fill-primary-300",a.asc?"-translate-y-0.5 rotate-0":"translate-y-0.5 rotate-180")}):A.jsx(Ao,{width:12,height:12,className:"stroke-primary-300"}))]})},o.id))})}),A.jsx("tbody",{children:i.map(([o,l])=>A.jsxs("tr",{className:"hover:bg-primary-900 cursor-pointer",onClick:()=>{r(`/performance/transactions/${btoa(o)}`)},children:[A.jsx("td",{className:"text-primary-200 w-3/5 truncate whitespace-nowrap px-6 py-4 text-left text-sm font-medium",children:o}),A.jsx("td",{className:"text-primary-200 w-1/5 whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:A.jsx(JE,{date:l.lastSeen})}),A.jsx("td",{className:"text-primary-200 w-1/5 whitespace-nowrap px-6 py-4 text-right text-sm font-medium",children:l.transactions.length})]},o))})]})}):A.jsx("div",{className:"text-primary-300 p-6",children:"Looks like there's no transactions recorded matching this query. 🤔"})})}function B8(){const e=ni(),t=Ta(),n=To(),[r,a]=b.useState(!n.experiments["sentry:focus-local-events"]),s=e.filter(l=>l.type==="transaction"),i=r?s:s.filter(l=>{var u,c;const E=(c=(u=l.contexts)==null?void 0:u.trace)==null?void 0:c.trace_id;return!E||t.isLocalToSession(E)}),o=s.length-i.length;return A.jsxs("div",{className:"flex-1",children:[o>0&&A.jsx(Jl,{itemCount:o,onClick:()=>{a(!0)}}),A.jsxs(jn,{children:[A.jsx(we,{path:"transactions",element:A.jsx(F8,{showAll:r})}),A.jsx(we,{path:"transactions/:name",element:A.jsx(G8,{showAll:r})}),A.jsx(we,{path:"*",element:A.jsx(FE,{to:"/performance/transactions",replace:!0})})]}),A.jsx(BE,{})]})}function H8(){return A.jsx(ho,{children:A.jsx(jn,{children:A.jsx(we,{path:"/*",element:A.jsx(B8,{})})})})}const he=Le;let aT=0;function Fg(){return aT>0}function Y8(){aT++,setTimeout(()=>{aT--})}function $i(e,t={}){function n(a){return typeof a=="function"}if(!n(e))return e;try{const a=e.__sentry_wrapped__;if(a)return typeof a=="function"?a:e;if(Dh(e))return e}catch{return e}const r=function(...a){try{const s=a.map(i=>$i(i,t));return e.apply(this,s)}catch(s){throw Y8(),wh(i=>{i.addEventProcessor(o=>(t.mechanism&&(Vf(o,void 0),Ji(o,t.mechanism)),o.extra={...o.extra,arguments:a},o)),wC(s)}),s}};try{for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a])}catch{}oC(r,e),or(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return e.name}})}catch{}return r}const _r=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Kh(e,t){const n=zh(e,t),r={type:K8(t),value:z8(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function V8(e,t,n,r){const a=Me(),s=a&&a.getOptions().normalizeDepth,i=$8(t),o={__serialized__:yC(t,s)};if(i)return{exception:{values:[Kh(e,i)]},extra:o};const l={exception:{values:[{type:WE(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:Z8(t,{isUnhandledRejection:r})}]},extra:o};if(n){const u=zh(e,n);u.length&&(l.exception.values[0].stacktrace={frames:u})}return l}function fp(e,t){return{exception:{values:[Kh(e,t)]}}}function zh(e,t){const n=t.stacktrace||t.stack||"",r=j8(t),a=X8(t);try{return e(n,r,a)}catch{}return[]}const W8=/Minified React error #\d+;/i;function j8(e){return e&&W8.test(e.message)?1:0}function X8(e){return typeof e.framesToPop=="number"?e.framesToPop:0}function Bg(e){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?e instanceof WebAssembly.Exception:!1}function K8(e){const t=e&&e.name;return!t&&Bg(e)?e.message&&Array.isArray(e.message)&&e.message.length==2?e.message[0]:"WebAssembly.Exception":t}function z8(e){const t=e&&e.message;return t?t.error&&typeof t.error.message=="string"?t.error.message:Bg(e)&&Array.isArray(e.message)&&e.message.length==2?e.message[1]:t:"No error message"}function q8(e,t,n,r){const a=n&&n.syntheticException||void 0,s=qh(e,t,a,r);return Ji(s),s.level="error",n&&n.event_id&&(s.event_id=n.event_id),Ea(s)}function J8(e,t,n="info",r,a){const s=r&&r.syntheticException||void 0,i=sT(e,t,s,a);return i.level=n,r&&r.event_id&&(i.event_id=r.event_id),Ea(i)}function qh(e,t,n,r,a){let s;if(rC(t)&&t.error)return fp(e,t.error);if(dR(t)||tv(t)){const i=t;if("stack"in t)s=fp(e,t);else{const o=i.name||(dR(i)?"DOMError":"DOMException"),l=i.message?`${o}: ${i.message}`:o;s=sT(e,l,n,r),Vf(s,l)}return"code"in i&&(s.tags={...s.tags,"DOMException.code":`${i.code}`}),s}return vh(t)?fp(e,t):qi(t)||WE(t)?(s=V8(e,t,n,a),Ji(s,{synthetic:!0}),s):(s=sT(e,t,n,r),Vf(s,`${t}`),Ji(s,{synthetic:!0}),s)}function sT(e,t,n,r){const a={};if(r&&n){const s=zh(e,n);s.length&&(a.exception={values:[{value:t,stacktrace:{frames:s}}]}),Ji(a,{synthetic:!0})}if(Mh(t)){const{__sentry_template_string__:s,__sentry_template_values__:i}=t;return a.logentry={message:s,params:i},a}return a.message=t,a}function Z8(e,{isUnhandledRejection:t}){const n=uv(e),r=t?"promise rejection":"exception";return rC(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:WE(e)?`Event \`${Q8(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Q8(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function $8(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];if(n instanceof Error)return n}}function ex(e,{metadata:t,tunnel:n,dsn:r}){const a={event_id:e.event_id,sent_at:new Date().toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:zl(r)}},s=tx(e);return ei(a,[s])}function tx(e){return[{type:"user_report"},e]}class nx extends J5{constructor(t){const n={parentSpanIsAlwaysRootSpan:!0,...t},r=he.SENTRY_SDK_SOURCE||Q3();XC(n,"browser",["browser"],r),super(n),n.sendClientReports&&he.document&&he.document.addEventListener("visibilitychange",()=>{he.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(t,n){return q8(this._options.stackParser,t,n,this._options.attachStacktrace)}eventFromMessage(t,n="info",r){return J8(this._options.stackParser,t,n,r,this._options.attachStacktrace)}captureUserFeedback(t){if(!this._isEnabled()){_r&&ne.warn("SDK not enabled, will not capture user feedback.");return}const n=ex(t,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(t,n,r){return t.platform=t.platform||"javascript",super._prepareEvent(t,n,r)}}const Jh=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,rx=(e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good",mo=(e,t,n,r)=>{let a,s;return i=>{t.value>=0&&(i||r)&&(s=t.value-(a||0),(s||a===void 0)&&(a=t.value,t.delta=s,t.rating=rx(t.value,n),e(t)))}},de=Le,ax=()=>`v4-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,Zl=(e=!0)=>{const t=de.performance&&de.performance.getEntriesByType&&de.performance.getEntriesByType("navigation")[0];if(!e||t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ql=()=>{const e=Zl();return e&&e.activationStart||0},_o=(e,t)=>{const n=Zl();let r="navigate";return n&&(de.document&&de.document.prerendering||Ql()>0?r="prerender":de.document&&de.document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:typeof t>"u"?-1:t,rating:"good",delta:0,entries:[],id:ax(),navigationType:r}},ai=(e,t,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(a=>{Promise.resolve().then(()=>{t(a.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch{}},No=e=>{const t=n=>{(n.type==="pagehide"||de.document&&de.document.visibilityState==="hidden")&&e(n)};de.document&&(addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0))},$E=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let al=-1;const sx=()=>de.document.visibilityState==="hidden"&&!de.document.prerendering?0:1/0,aE=e=>{de.document.visibilityState==="hidden"&&al>-1&&(al=e.type==="visibilitychange"?e.timeStamp:0,ox())},ix=()=>{addEventListener("visibilitychange",aE,!0),addEventListener("prerenderingchange",aE,!0)},ox=()=>{removeEventListener("visibilitychange",aE,!0),removeEventListener("prerenderingchange",aE,!0)},ed=()=>(de.document&&al<0&&(al=sx(),ix()),{get firstHiddenTime(){return al}}),$l=e=>{de.document&&de.document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},lx=[1800,3e3],ux=(e,t={})=>{$l(()=>{const n=ed(),r=_o("FCP");let a;const s=ai("paint",i=>{i.forEach(o=>{o.name==="first-contentful-paint"&&(s.disconnect(),o.startTime<n.firstHiddenTime&&(r.value=Math.max(o.startTime-Ql(),0),r.entries.push(o),a(!0)))})});s&&(a=mo(e,r,lx,t.reportAllChanges))})},cx=[.1,.25],Ex=(e,t={})=>{ux($E(()=>{const n=_o("CLS",0);let r,a=0,s=[];const i=l=>{l.forEach(u=>{if(!u.hadRecentInput){const c=s[0],E=s[s.length-1];a&&c&&E&&u.startTime-E.startTime<1e3&&u.startTime-c.startTime<5e3?(a+=u.value,s.push(u)):(a=u.value,s=[u])}}),a>n.value&&(n.value=a,n.entries=s,r())},o=ai("layout-shift",i);o&&(r=mo(e,n,cx,t.reportAllChanges),No(()=>{i(o.takeRecords()),r(!0)}),setTimeout(r,0))}))},dx=[100,300],px=(e,t={})=>{$l(()=>{const n=ed(),r=_o("FID");let a;const s=l=>{l.startTime<n.firstHiddenTime&&(r.value=l.processingStart-l.startTime,r.entries.push(l),a(!0))},i=l=>{l.forEach(s)},o=ai("first-input",i);a=mo(e,r,dx,t.reportAllChanges),o&&No($E(()=>{i(o.takeRecords()),o.disconnect()}))})};let Hg=0,Tp=1/0,Gu=0;const fx=e=>{e.forEach(t=>{t.interactionId&&(Tp=Math.min(Tp,t.interactionId),Gu=Math.max(Gu,t.interactionId),Hg=Gu?(Gu-Tp)/7+1:0)})};let iT;const Tx=()=>iT?Hg:performance.interactionCount||0,hx=()=>{"interactionCount"in performance||iT||(iT=ai("event",fx,{type:"event",buffered:!0,durationThreshold:0}))},qr=[],hp=new Map,Ax=40;let Sx=0;const Rx=()=>Tx()-Sx,mx=()=>{const e=Math.min(qr.length-1,Math.floor(Rx()/50));return qr[e]},Ap=10,_x=[],Nx=e=>{if(_x.forEach(r=>r(e)),!(e.interactionId||e.entryType==="first-input"))return;const t=qr[qr.length-1],n=hp.get(e.interactionId);if(n||qr.length<Ap||t&&e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===(n.entries[0]&&n.entries[0].startTime)&&n.entries.push(e);else{const r={id:e.interactionId,latency:e.duration,entries:[e]};hp.set(r.id,r),qr.push(r)}qr.sort((r,a)=>a.latency-r.latency),qr.length>Ap&&qr.splice(Ap).forEach(r=>hp.delete(r.id))}},Yg=e=>{const t=de.requestIdleCallback||de.setTimeout;let n=-1;return e=$E(e),de.document&&de.document.visibilityState==="hidden"?e():(n=t(e),No(e)),n},Ox=[200,500],Ix=(e,t={})=>{"PerformanceEventTiming"in de&&"interactionId"in PerformanceEventTiming.prototype&&$l(()=>{hx();const n=_o("INP");let r;const a=i=>{Yg(()=>{i.forEach(Nx);const o=mx();o&&o.latency!==n.value&&(n.value=o.latency,n.entries=o.entries,r())})},s=ai("event",a,{durationThreshold:t.durationThreshold!=null?t.durationThreshold:Ax});r=mo(e,n,Ox,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),No(()=>{a(s.takeRecords()),r(!0)}))})},Cx=[2500,4e3],Gm={},gx=(e,t={})=>{$l(()=>{const n=ed(),r=_o("LCP");let a;const s=o=>{t.reportAllChanges||(o=o.slice(-1)),o.forEach(l=>{l.startTime<n.firstHiddenTime&&(r.value=Math.max(l.startTime-Ql(),0),r.entries=[l],a())})},i=ai("largest-contentful-paint",s);if(i){a=mo(e,r,Cx,t.reportAllChanges);const o=$E(()=>{Gm[r.id]||(s(i.takeRecords()),i.disconnect(),Gm[r.id]=!0,a(!0))});["keydown","click"].forEach(l=>{de.document&&addEventListener(l,()=>Yg(o),{once:!0,capture:!0})}),No(o)}})},Lx=[800,1800],oT=e=>{de.document&&de.document.prerendering?$l(()=>oT(e)):de.document&&de.document.readyState!=="complete"?addEventListener("load",()=>oT(e),!0):setTimeout(e,0)},yx=(e,t={})=>{const n=_o("TTFB"),r=mo(e,n,Lx,t.reportAllChanges);oT(()=>{const a=Zl();a&&(n.value=Math.max(a.responseStart-Ql(),0),n.entries=[a],r(!0))})},sl={},sE={};let Vg,Wg,jg,Xg,Kg;function Zh(e,t=!1){return eu("cls",e,vx,Vg,t)}function zg(e,t=!1){return eu("lcp",e,Px,jg,t)}function qg(e){return eu("fid",e,Mx,Wg)}function bx(e){return eu("ttfb",e,Dx,Xg)}function Jg(e){return eu("inp",e,xx,Kg)}function eo(e,t){return Zg(e,t),sE[e]||(wx(e),sE[e]=!0),Qg(e,t)}function Oo(e,t){const n=sl[e];if(!(!n||!n.length))for(const r of n)try{r(t)}catch(a){Jh&&ne.error(`Error while triggering instrumentation handler.
126
126
  Type: ${e}
127
127
  Name: ${la(r)}
128
128
  Error:`,a)}}function vx(){return Ex(e=>{Oo("cls",{metric:e}),Vg=e},{reportAllChanges:!0})}function Mx(){return px(e=>{Oo("fid",{metric:e}),Wg=e})}function Px(){return gx(e=>{Oo("lcp",{metric:e}),jg=e},{reportAllChanges:!0})}function Dx(){return yx(e=>{Oo("ttfb",{metric:e}),Xg=e})}function xx(){return Ix(e=>{Oo("inp",{metric:e}),Kg=e})}function eu(e,t,n,r,a=!1){Zg(e,t);let s;return sE[e]||(s=n(),sE[e]=!0),r&&t({metric:r}),Qg(e,t,a?s:void 0)}function wx(e){const t={};e==="event"&&(t.durationThreshold=0),ai(e,n=>{Oo(e,{entries:n})},t)}function Zg(e,t){sl[e]=sl[e]||[],sl[e].push(t)}function Qg(e,t,n){return()=>{n&&n();const r=sl[e];if(!r)return;const a=r.indexOf(t);a!==-1&&r.splice(a,1)}}function Ux(e){return"duration"in e}function Sp(e){return typeof e=="number"&&isFinite(e)}function da(e,t,n,{...r}){const a=Ge(e).start_timestamp;return a&&a>t&&typeof e.updateStartTime=="function"&&e.updateStartTime(t),MC(e,()=>{const s=ql({startTime:t,...r});return s&&s.end(n),s})}function $g(e){const t=Me();if(!t)return;const{name:n,transaction:r,attributes:a,startTime:s}=e,{release:i,environment:o}=t.getOptions(),l=t.getIntegrationByName("Replay"),u=l&&l.getReplayId(),c=Ze(),E=c.getUser(),f=E!==void 0?E.email||E.id||E.ip_address:void 0;let S;try{S=c.getScopeData().contexts.profile.profile_id}catch{}const _={release:i,environment:o,user:f||void 0,profile_id:S||void 0,replay_id:u||void 0,transaction:r,"user_agent.original":de.navigator&&de.navigator.userAgent,...a};return ql({name:n,attributes:_,startTime:s,experimental:{standalone:!0}})}function Qh(){return de&&de.addEventListener&&de.performance}function Rt(e){return e/1e3}function kx(){let e=0,t,n;if(!Fx())return;let r=!1;function a(){r||(r=!0,n&&Gx(e,t,n),s())}const s=Zh(({metric:i})=>{const o=i.entries[i.entries.length-1];o&&(e=i.value,t=o)},!0);No(()=>{a()}),setTimeout(()=>{const i=Me();if(!i)return;const o=i.on("startNavigationSpan",()=>{a(),o&&o()}),l=Ut(),u=l&&zt(l),c=u&&Ge(u);c&&c.op==="pageload"&&(n=u.spanContext().spanId)},0)}function Gx(e,t,n){Jh&&ne.log(`Sending CLS span (${e})`);const r=Rt((Tn||0)+(t&&t.startTime||0)),a=Ze().getScopeData().transactionName,s=t?ca(t.sources[0]&&t.sources[0].node):"Layout shift",i=bt({[vt]:"auto.http.browser.cls",[ns]:"ui.webvital.cls",[Uh]:t&&t.duration||0,"sentry.pageload.span_id":n}),o=$g({name:s,transaction:a,attributes:i,startTime:r});o&&(o.addEvent("cls",{[KE]:"",[zE]:e}),o.end(r))}function Fx(){try{return PerformanceObserver.supportedEntryTypes.includes("layout-shift")}catch{return!1}}const Bx=2147483647;let Fm=0,jt={},Nn,il;function Hx({recordClsStandaloneSpans:e}){const t=Qh();if(t&&Tn){t.mark&&de.performance.mark("sentry-tracing-init");const n=Kx(),r=Xx(),a=zx(),s=e?kx():jx();return()=>{n(),r(),a(),s&&s()}}return()=>{}}function Yx(){eo("longtask",({entries:e})=>{const t=Ut();if(!t)return;const{op:n,start_timestamp:r}=Ge(t);for(const a of e){const s=Rt(Tn+a.startTime),i=Rt(a.duration);n==="navigation"&&r&&s<r||da(t,s,s+i,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[vt]:"auto.ui.browser.metrics"}})}})}function Vx(){new PerformanceObserver(e=>{const t=Ut();if(t)for(const n of e.getEntries()){if(!n.scripts[0])continue;const r=Rt(Tn+n.startTime),{start_timestamp:a,op:s}=Ge(t);if(s==="navigation"&&a&&r<a)continue;const i=Rt(n.duration),o={[vt]:"auto.ui.browser.metrics"},l=n.scripts[0],{invoker:u,invokerType:c,sourceURL:E,sourceFunctionName:f,sourceCharPosition:S}=l;o["browser.script.invoker"]=u,o["browser.script.invoker_type"]=c,E&&(o["code.filepath"]=E),f&&(o["code.function"]=f),S!==-1&&(o["browser.script.source_char_position"]=S),da(t,r,r+i,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:o})}}).observe({type:"long-animation-frame",buffered:!0})}function Wx(){eo("event",({entries:e})=>{const t=Ut();if(t){for(const n of e)if(n.name==="click"){const r=Rt(Tn+n.startTime),a=Rt(n.duration),s={name:ca(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[vt]:"auto.ui.browser.metrics"}},i=iC(n.target);i&&(s.attributes["ui.component_name"]=i),da(t,r,r+a,s)}}})}function jx(){return Zh(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(jt.cls={value:e.value,unit:""},il=t)},!0)}function Xx(){return zg(({metric:e})=>{const t=e.entries[e.entries.length-1];t&&(jt.lcp={value:e.value,unit:"millisecond"},Nn=t)},!0)}function Kx(){return qg(({metric:e})=>{const t=e.entries[e.entries.length-1];if(!t)return;const n=Rt(Tn),r=Rt(t.startTime);jt.fid={value:e.value,unit:"millisecond"},jt["mark.fid"]={value:n+r,unit:"second"}})}function zx(){return bx(({metric:e})=>{e.entries[e.entries.length-1]&&(jt.ttfb={value:e.value,unit:"millisecond"})})}function qx(e,t){const n=Qh();if(!n||!n.getEntries||!Tn)return;const r=Rt(Tn),a=n.getEntries(),{op:s,start_timestamp:i}=Ge(e);if(a.slice(Fm).forEach(o=>{const l=Rt(o.startTime),u=Rt(Math.max(0,o.duration));if(!(s==="navigation"&&i&&r+l<i))switch(o.entryType){case"navigation":{Zx(e,o,r);break}case"mark":case"paint":case"measure":{Jx(e,o,l,u,r);const c=ed(),E=o.startTime<c.firstHiddenTime;o.name==="first-paint"&&E&&(jt.fp={value:o.startTime,unit:"millisecond"}),o.name==="first-contentful-paint"&&E&&(jt.fcp={value:o.startTime,unit:"millisecond"});break}case"resource":{ew(e,o,o.name,l,u,r);break}}}),Fm=Math.max(a.length-1,0),tw(e),s==="pageload"){rw(jt);const o=jt["mark.fid"];o&&jt.fid&&(da(e,o.value,o.value+Rt(jt.fid.value),{name:"first input delay",op:"ui.action",attributes:{[vt]:"auto.ui.browser.metrics"}}),delete jt["mark.fid"]),(!("fcp"in jt)||!t.recordClsOnPageloadSpan)&&delete jt.cls,Object.entries(jt).forEach(([l,u])=>{f5(l,u.value,u.unit)}),e.setAttribute("performance.timeOrigin",r),e.setAttribute("performance.activationStart",Ql()),nw(e)}Nn=void 0,il=void 0,jt={}}function Jx(e,t,n,r,a){const s=Zl(!1),i=Rt(s?s.requestStart:0),o=a+Math.max(n,i),l=a+n,u=l+r,c={[vt]:"auto.resource.browser.metrics"};return o!==l&&(c["sentry.browser.measure_happened_before_request"]=!0,c["sentry.browser.measure_start_time"]=o),da(e,o,u,{name:t.name,op:t.entryType,attributes:c}),o}function Zx(e,t,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Fu(e,t,r,n)}),Fu(e,t,"secureConnection",n,"TLS/SSL"),Fu(e,t,"fetch",n,"cache"),Fu(e,t,"domainLookup",n,"DNS"),$x(e,t,n)}function Fu(e,t,n,r,a=n){const s=Qx(n),i=t[s],o=t[`${n}Start`];!o||!i||da(e,r+Rt(o),r+Rt(i),{op:`browser.${a}`,name:t.name,attributes:{[vt]:"auto.ui.browser.metrics"}})}function Qx(e){return e==="secureConnection"?"connectEnd":e==="fetch"?"domainLookupStart":`${e}End`}function $x(e,t,n){const r=n+Rt(t.requestStart),a=n+Rt(t.responseEnd),s=n+Rt(t.responseStart);t.responseEnd&&(da(e,r,a,{op:"browser.request",name:t.name,attributes:{[vt]:"auto.ui.browser.metrics"}}),da(e,s,a,{op:"browser.response",name:t.name,attributes:{[vt]:"auto.ui.browser.metrics"}}))}function ew(e,t,n,r,a,s){if(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")return;const i=xs(n),o={[vt]:"auto.resource.browser.metrics"};Rp(o,t,"transferSize","http.response_transfer_size"),Rp(o,t,"encodedBodySize","http.response_content_length"),Rp(o,t,"decodedBodySize","http.decoded_response_content_length");const l=t.deliveryType;l!=null&&(o["http.response_delivery_type"]=l);const u=t.renderBlockingStatus;u&&(o["resource.render_blocking_status"]=u),i.protocol&&(o["url.scheme"]=i.protocol.split(":").pop()),i.host&&(o["server.address"]=i.host),o["url.same_origin"]=n.includes(de.location.origin);const c=s+r,E=c+a;da(e,c,E,{name:n.replace(de.location.origin,""),op:t.initiatorType?`resource.${t.initiatorType}`:"resource.other",attributes:o})}function tw(e){const t=de.navigator;if(!t)return;const n=t.connection;n&&(n.effectiveType&&e.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&e.setAttribute("connectionType",n.type),Sp(n.rtt)&&(jt["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Sp(t.deviceMemory)&&e.setAttribute("deviceMemory",`${t.deviceMemory} GB`),Sp(t.hardwareConcurrency)&&e.setAttribute("hardwareConcurrency",String(t.hardwareConcurrency))}function nw(e){Nn&&(Nn.element&&e.setAttribute("lcp.element",ca(Nn.element)),Nn.id&&e.setAttribute("lcp.id",Nn.id),Nn.url&&e.setAttribute("lcp.url",Nn.url.trim().slice(0,200)),Nn.loadTime!=null&&e.setAttribute("lcp.loadTime",Nn.loadTime),Nn.renderTime!=null&&e.setAttribute("lcp.renderTime",Nn.renderTime),e.setAttribute("lcp.size",Nn.size)),il&&il.sources&&il.sources.forEach((t,n)=>e.setAttribute(`cls.source.${n+1}`,ca(t.node)))}function Rp(e,t,n,r){const a=t[n];a!=null&&a<Bx&&(e[r]=a)}function rw(e){const t=Zl(!1);if(!t)return;const{responseStart:n,requestStart:r}=t;r<=n&&(e["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}const aw=1e3;let Bm,lT,uT;function e0(e){const t="dom";ps(t,e),fs(t,sw)}function sw(){if(!de.document)return;const e=rr.bind(null,"dom"),t=Hm(e,!0);de.document.addEventListener("click",t,!1),de.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(n=>{const r=de[n],a=r&&r.prototype;!a||!a.hasOwnProperty||!a.hasOwnProperty("addEventListener")||(Cn(a,"addEventListener",function(s){return function(i,o,l){if(i==="click"||i=="keypress")try{const u=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},c=u[i]=u[i]||{refCount:0};if(!c.handler){const E=Hm(e);c.handler=E,s.call(this,i,E,l)}c.refCount++}catch{}return s.call(this,i,o,l)}}),Cn(a,"removeEventListener",function(s){return function(i,o,l){if(i==="click"||i=="keypress")try{const u=this.__sentry_instrumentation_handlers__||{},c=u[i];c&&(c.refCount--,c.refCount<=0&&(s.call(this,i,c.handler,l),c.handler=void 0,delete u[i]),Object.keys(u).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return s.call(this,i,o,l)}}))})}function iw(e){if(e.type!==lT)return!1;try{if(!e.target||e.target._sentryId!==uT)return!1}catch{}return!0}function ow(e,t){return e!=="keypress"?!1:!t||!t.tagName?!0:!(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)}function Hm(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=lw(n);if(ow(n.type,r))return;or(n,"_sentryCaptured",!0),r&&!r._sentryId&&or(r,"_sentryId",Bn());const a=n.type==="keypress"?"input":n.type;iw(n)||(e({event:n,name:a,global:t}),lT=n.type,uT=r?r._sentryId:void 0),clearTimeout(Bm),Bm=de.setTimeout(()=>{uT=void 0,lT=void 0},aw)}}function lw(e){try{return e.target}catch{return null}}let Bu;function td(e){const t="history";ps(t,e),fs(t,uw)}function uw(){if(!t4())return;const e=de.onpopstate;de.onpopstate=function(...n){const r=de.location.href,a=Bu;if(Bu=r,rr("history",{from:a,to:r}),e)try{return e.apply(this,n)}catch{}};function t(n){return function(...r){const a=r.length>2?r[2]:void 0;if(a){const s=Bu,i=String(a);Bu=i,rr("history",{from:s,to:i})}return n.apply(this,r)}}Cn(de.history,"pushState",t),Cn(de.history,"replaceState",t)}const hc={};function $h(e){const t=hc[e];if(t)return t;let n=de[e];if(eT(n))return hc[e]=n.bind(de);const r=de.document;if(r&&typeof r.createElement=="function")try{const a=r.createElement("iframe");a.hidden=!0,r.head.appendChild(a);const s=a.contentWindow;s&&s[e]&&(n=s[e]),r.head.removeChild(a)}catch(a){Jh&&ne.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,a)}return n&&(hc[e]=n.bind(de))}function Ym(e){hc[e]=void 0}function to(...e){return $h("setTimeout")(...e)}const gs="__sentry_xhr_v3__";function t0(e){const t="xhr";ps(t,e),fs(t,cw)}function cw(){if(!de.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(t,n,r){const a=new Error,s=fn()*1e3,i=ta(r[0])?r[0].toUpperCase():void 0,o=Ew(r[1]);if(!i||!o)return t.apply(n,r);n[gs]={method:i,url:o,request_headers:{}},i==="POST"&&o.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const u=n[gs];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const c={endTimestamp:fn()*1e3,startTimestamp:s,xhr:n,virtualError:a};rr("xhr",c)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,c,E){return l(),u.apply(c,E)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,c,E){const[f,S]=E,_=c[gs];return _&&ta(f)&&ta(S)&&(_.request_headers[f.toLowerCase()]=S),u.apply(c,E)}}),t.apply(n,r)}}),e.send=new Proxy(e.send,{apply(t,n,r){const a=n[gs];if(!a)return t.apply(n,r);r[0]!==void 0&&(a.body=r[0]);const s={startTimestamp:fn()*1e3,xhr:n};return rr("xhr",s),t.apply(n,r)}})}function Ew(e){if(ta(e))return e;try{return e.toString()}catch{}}const mp=[],Ac=new Map;function dw(){if(Qh()&&Tn){const e=pw();return()=>{e()}}return()=>{}}const Vm={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 pw(){return Jg(({metric:e})=>{if(e.value==null)return;const t=e.entries.find(S=>S.duration===e.value&&Vm[S.name]);if(!t)return;const{interactionId:n}=t,r=Vm[t.name],a=Rt(Tn+t.startTime),s=Rt(e.value),i=Ut(),o=i?zt(i):void 0,l=(n!=null?Ac.get(n):void 0)||o,u=l?Ge(l).description:Ze().getScopeData().transactionName,c=ca(t.target),E=bt({[vt]:"auto.http.browser.inp",[ns]:`ui.interaction.${r}`,[Uh]:t.duration}),f=$g({name:c,transaction:u,attributes:E,startTime:a});f&&(f.addEvent("inp",{[KE]:"millisecond",[zE]:e.value}),f.end(a+s))})}function fw(e){const t=({entries:n})=>{const r=Ut(),a=r&&zt(r);n.forEach(s=>{if(!Ux(s)||!a)return;const i=s.interactionId;if(i!=null&&!Ac.has(i)){if(mp.length>10){const o=mp.shift();Ac.delete(o)}mp.push(i),Ac.set(i,a)}})};eo("event",t),eo("first-input",t)}function eA(e,t=$h("fetch")){let n=0,r=0;function a(s){const i=s.body.length;n+=i,r++;const o={body:s.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};if(!t)return Ym("fetch"),Qc("No fetch implementation available");try{return t(e.url,o).then(l=>(n-=i,r--,{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}))}catch(l){return Ym("fetch"),n-=i,r--,Qc(l)}}return s3(e,a)}const Tw=30,hw=50;function cT(e,t,n,r){const a={filename:e,function:t==="<anonymous>"?Bs:t,in_app:!0};return n!==void 0&&(a.lineno=n),r!==void 0&&(a.colno=r),a}const Aw=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Sw=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Rw=/\((\S*)(?::(\d+))(?::(\d+))\)/,mw=e=>{const t=Aw.exec(e);if(t){const[,r,a,s]=t;return cT(r,Bs,+a,+s)}const n=Sw.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){const s=Rw.exec(n[2]);s&&(n[2]=s[1],n[3]=s[2],n[4]=s[3])}const[r,a]=n0(n[1]||Bs,n[2]);return cT(a,r,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},_w=[Tw,mw],Nw=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ow=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Iw=e=>{const t=Nw.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const a=Ow.exec(t[3]);a&&(t[1]=t[1]||"eval",t[3]=a[1],t[4]=a[2],t[5]="")}let n=t[3],r=t[1]||Bs;return[r,n]=n0(r,n),cT(n,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Cw=[hw,Iw],gw=[_w,Cw],Lw=$I(...gw),n0=(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]:Bs,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Hu=1024,yw="Breadcrumbs",bw=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:yw,setup(n){t.console&&P3(Dw(n)),t.dom&&e0(Pw(n,t.dom)),t.xhr&&t0(xw(n)),t.fetch&&$C(ww(n)),t.history&&td(Uw(n)),t.sentry&&n.on("beforeSendEvent",Mw(n))}}},vw=bw;function Mw(e){return function(t){Me()===e&&as({category:`sentry.${t.type==="transaction"?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:ga(t)},{event:t})}}function Pw(e,t){return function(n){if(Me()!==e)return;let r,a,s=typeof t=="object"?t.serializeAttribute:void 0,i=typeof t=="object"&&typeof t.maxStringLength=="number"?t.maxStringLength:void 0;i&&i>Hu&&(_r&&ne.warn(`\`dom.maxStringLength\` cannot exceed ${Hu}, but a value of ${i} was configured. Sentry will use ${Hu} instead.`),i=Hu),typeof s=="string"&&(s=[s]);try{const l=n.event,u=kw(l)?l.target:l;r=ca(u,{keyAttrs:s,maxStringLength:i}),a=iC(u)}catch{r="<unknown>"}if(r.length===0)return;const o={category:`ui.${n.name}`,message:r};a&&(o.data={"ui.component_name":a}),as(o,{event:n.event,name:n.name,global:n.global})}}function Dw(e){return function(t){if(Me()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:zC(t.level),message:pR(t.args," ")};if(t.level==="assert")if(t.args[0]===!1)n.message=`Assertion failed: ${pR(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1);else return;as(n,{input:t.args,level:t.level})}}function xw(e){return function(t){if(Me()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,a=t.xhr[gs];if(!n||!r||!a)return;const{method:s,url:i,status_code:o,body:l}=a,u={method:s,url:i,status_code:o},c={xhr:t.xhr,input:l,startTimestamp:n,endTimestamp:r},E=ZC(o);as({category:"xhr",data:u,type:"http",level:E},c)}}function ww(e){return function(t){if(Me()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method==="POST"))if(t.error){const a=t.fetchData,s={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r};as({category:"fetch",data:a,level:"error",type:"http"},s)}else{const a=t.response,s={...t.fetchData,status_code:a&&a.status},i={input:t.args,response:a,startTimestamp:n,endTimestamp:r},o=ZC(s.status_code);as({category:"fetch",data:s,type:"http",level:o},i)}}}function Uw(e){return function(t){if(Me()!==e)return;let n=t.from,r=t.to;const a=xs(he.location.href);let s=n?xs(n):void 0;const i=xs(r);(!s||!s.path)&&(s=a),a.protocol===i.protocol&&a.host===i.host&&(r=i.relative),a.protocol===s.protocol&&a.host===s.host&&(n=s.relative),as({category:"navigation",data:{from:n,to:r}})}}function kw(e){return!!e&&!!e.target}const Gw=["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"],Fw="BrowserApiErrors",Bw=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:Fw,setupOnce(){t.setTimeout&&Cn(he,"setTimeout",Wm),t.setInterval&&Cn(he,"setInterval",Wm),t.requestAnimationFrame&&Cn(he,"requestAnimationFrame",Yw),t.XMLHttpRequest&&"XMLHttpRequest"in he&&Cn(XMLHttpRequest.prototype,"send",Vw);const n=t.eventTarget;n&&(Array.isArray(n)?n:Gw).forEach(Ww)}}},Hw=Bw;function Wm(e){return function(...t){const n=t[0];return t[0]=$i(n,{mechanism:{data:{function:la(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function Yw(e){return function(t){return e.apply(this,[$i(t,{mechanism:{data:{function:"requestAnimationFrame",handler:la(e)},handled:!1,type:"instrument"}})])}}function Vw(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(r=>{r in n&&typeof n[r]=="function"&&Cn(n,r,function(a){const s={mechanism:{data:{function:r,handler:la(a)},handled:!1,type:"instrument"}},i=Dh(a);return i&&(s.mechanism.data.handler=la(i)),$i(a,s)})}),e.apply(this,t)}}function Ww(e){const t=he[e],n=t&&t.prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(Cn(n,"addEventListener",function(r){return function(a,s,i){try{jw(s)&&(s.handleEvent=$i(s.handleEvent,{mechanism:{data:{function:"handleEvent",handler:la(s),target:e},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[a,$i(s,{mechanism:{data:{function:"addEventListener",handler:la(s),target:e},handled:!1,type:"instrument"}}),i])}}),Cn(n,"removeEventListener",function(r){return function(a,s,i){try{const o=s.__sentry_wrapped__;o&&r.call(this,a,o,i)}catch{}return r.call(this,a,s,i)}}))}function jw(e){return typeof e.handleEvent=="function"}const Xw=()=>({name:"BrowserSession",setupOnce(){if(typeof he.document>"u"){_r&&ne.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}wR({ignoreDuration:!0}),UR(),td(({from:e,to:t})=>{e!==void 0&&e!==t&&(wR({ignoreDuration:!0}),UR())})}}),Kw="GlobalHandlers",zw=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:Kw,setupOnce(){Error.stackTraceLimit=50},setup(n){t.onerror&&(Jw(n),jm("onerror")),t.onunhandledrejection&&(Zw(n),jm("onunhandledrejection"))}}},qw=zw;function Jw(e){eC(t=>{const{stackParser:n,attachStacktrace:r}=r0();if(Me()!==e||Fg())return;const{msg:a,url:s,line:i,column:o,error:l}=t,u=e7(qh(n,l||a,void 0,r,!1),s,i,o);u.level="error",UC(u,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}function Zw(e){tC(t=>{const{stackParser:n,attachStacktrace:r}=r0();if(Me()!==e||Fg())return;const a=Qw(t),s=Ph(a)?$w(a):qh(n,a,void 0,r,!0);s.level="error",UC(s,{originalException:a,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function Qw(e){if(Ph(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 $w(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function e7(e,t,n,r){const a=e.exception=e.exception||{},s=a.values=a.values||[],i=s[0]=s[0]||{},o=i.stacktrace=i.stacktrace||{},l=o.frames=o.frames||[],u=r,c=n,E=ta(t)&&t.length>0?t:sC();return l.length===0&&l.push({colno:u,filename:E,function:Bs,in_app:!0,lineno:c}),e}function jm(e){_r&&ne.log(`Global Handler attached: ${e}`)}function r0(){const e=Me();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const t7=()=>({name:"HttpContext",preprocessEvent(e){if(!he.navigator&&!he.location&&!he.document)return;const t=e.request&&e.request.url||he.location&&he.location.href,{referrer:n}=he.document||{},{userAgent:r}=he.navigator||{},a={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},s={...e.request,...t&&{url:t},headers:a};e.request=s}}),n7="cause",r7=5,a7="LinkedErrors",s7=(e={})=>{const t=e.limit||r7,n=e.key||n7;return{name:a7,preprocessEvent(r,a,s){const i=s.getOptions();v3(Kh,i.stackParser,i.maxValueLength,n,t,r,a)}}},i7=s7;function o7(e){const t=[R3(),T3(),Hw(),vw(),qw(),i7(),U3(),t7()];return e.autoSessionTracking!==!1&&t.push(Xw()),t}function l7(e={}){const t={defaultIntegrations:o7(e),release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:he.SENTRY_RELEASE&&he.SENTRY_RELEASE.id?he.SENTRY_RELEASE.id:void 0,autoSessionTracking:!0,sendClientReports:!0};return e.defaultIntegrations==null&&delete e.defaultIntegrations,{...t,...e}}function u7(){const e=typeof he.window<"u"&&he;if(!e)return!1;const t=e.chrome?"chrome":"browser",n=e[t],r=n&&n.runtime&&n.runtime.id,a=he.location&&he.location.href||"",s=["chrome-extension:","moz-extension:","ms-browser-extension:","safari-web-extension:"],i=!!r&&he===he.top&&s.some(l=>a.startsWith(`${l}//`)),o=typeof e.nw<"u";return!!r&&!i&&!o}function c7(e={}){const t=l7(e);if(!t.skipBrowserExtensionCheck&&u7()){ds(()=>{console.error("[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")});return}_r&&(QC()||ne.warn("No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill."));const n={...t,stackParser:Z1(t.stackParser||Lw),integrations:K5(t),transport:t.transport||eA};return $5(nx,n)}const qe=Le,tA="sentryReplaySession",E7="replay_event",nA="Unable to send Replay",d7=3e5,p7=9e5,f7=5e3,T7=5500,h7=6e4,A7=5e3,S7=3,Xm=15e4,Yu=5e3,R7=3e3,m7=300,rA=2e7,_7=4999,N7=15e3,Km=36e5;function ET(e,t){return e??t()}function Ml(e){let t,n=e[0],r=1;for(;r<e.length;){const a=e[r],s=e[r+1];if(r+=2,(a==="optionalAccess"||a==="optionalCall")&&n==null)return;a==="access"||a==="optionalAccess"?(t=n,n=s(n)):(a==="call"||a==="optionalCall")&&(n=s((...i)=>n.call(t,...i)),t=void 0)}return n}var Lt;(function(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"})(Lt||(Lt={}));function O7(e){return e.nodeType===e.ELEMENT_NODE}function ol(e){const t=Ml([e,"optionalAccess",n=>n.host]);return Ml([t,"optionalAccess",n=>n.shadowRoot])===e}function ll(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function I7(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 C7(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 iE(e){try{const t=e.rules||e.cssRules;return t?I7(Array.from(t,a0).join("")):null}catch{return null}}function g7(e){let t="";for(let n=0;n<e.style.length;n++){const r=e.style,a=r[n],s=r.getPropertyPriority(a);t+=`${a}:${r.getPropertyValue(a)}${s?" !important":""};`}return`${e.selectorText} { ${t} }`}function a0(e){let t;if(y7(e))try{t=iE(e.styleSheet)||C7(e)}catch{}else if(b7(e)){let n=e.cssText;const r=e.selectorText.includes(":"),a=typeof e.style.all=="string"&&e.style.all;if(a&&(n=g7(e)),r&&(n=L7(n)),r||a)return n}return t||e.cssText}function L7(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function y7(e){return"styleSheet"in e}function b7(e){return"selectorText"in e}class s0{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){if(!t)return-1;const n=Ml([this,"access",r=>r.getMeta,"call",r=>r(t),"optionalAccess",r=>r.id]);return ET(n,()=>-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 a=this.nodeMetaMap.get(r);a&&this.nodeMetaMap.set(n,a)}this.idNodeMap.set(t,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function v7(){return new s0}function nd({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 Pl({isMasked:e,element:t,value:n,maskInputFn:r}){let a=n||"";return e?(r&&(a=r(a,t)),"*".repeat(a.length)):a}function no(e){return e.toLowerCase()}function dT(e){return e.toUpperCase()}const zm="__rrweb_original__";function M7(e){const t=e.getContext("2d");if(!t)return!0;const n=50;for(let r=0;r<e.width;r+=n)for(let a=0;a<e.height;a+=n){const s=t.getImageData,i=zm in s?s[zm]:s;if(new Uint32Array(i.call(t,r,a,Math.min(n,e.width-r),Math.min(n,e.height-a)).data.buffer).some(o=>o!==0))return!1}return!0}function aA(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?no(t):null}function oE(e,t,n){return t==="INPUT"&&(n==="radio"||n==="checkbox")?e.getAttribute("value")||"":e.value}function i0(e,t){let n;try{n=new URL(e,ET(t,()=>window.location.href))}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i,a=n.pathname.match(r);return ET(Ml([a,"optionalAccess",s=>s[1]]),()=>null)}const qm={};function o0(e){const t=qm[e];if(t)return t;const n=window.document;let r=window[e];if(n&&typeof n.createElement=="function")try{const a=n.createElement("iframe");a.hidden=!0,n.head.appendChild(a);const s=a.contentWindow;s&&s[e]&&(r=s[e]),n.head.removeChild(a)}catch{}return qm[e]=r.bind(window)}function pT(...e){return o0("setTimeout")(...e)}function l0(...e){return o0("clearTimeout")(...e)}function u0(e){try{return e.contentDocument}catch{}}let P7=1;const D7=new RegExp("[^a-z0-9-_:]"),Dl=-2;function sA(){return P7++}function x7(e){if(e instanceof HTMLFormElement)return"form";const t=no(e.tagName);return D7.test(t)?"div":t}function w7(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let ci,Jm;const U7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,k7=/^(?:[a-z+]+:)?\/\//i,G7=/^www\..*/i,F7=/^(data:)([^,]*),(.*)/i;function lE(e,t){return(e||"").replace(U7,(n,r,a,s,i,o)=>{const l=a||i||o,u=r||s||"";if(!l)return n;if(k7.test(l)||G7.test(l))return`url(${u}${l}${u})`;if(F7.test(l))return`url(${u}${l}${u})`;if(l[0]==="/")return`url(${u}${w7(t)+l}${u})`;const c=t.split("/"),E=l.split("/");c.pop();for(const f of E)f!=="."&&(f===".."?c.pop():c.push(f));return`url(${u}${c.join("/")}${u})`})}const B7=/^[^ \t\n\r\u000c]+/,H7=/^[, \t\n\r\u000c]+/;function Y7(e,t){if(t.trim()==="")return t;let n=0;function r(s){let i;const o=s.exec(t.substring(n));return o?(i=o[0],n+=i.length,i):""}const a=[];for(;r(H7),!(n>=t.length);){let s=r(B7);if(s.slice(-1)===",")s=uE(e,s.substring(0,s.length-1)),a.push(s);else{let i="";s=uE(e,s);let o=!1;for(;;){const l=t.charAt(n);if(l===""){a.push((s+i).trim());break}else if(o)l===")"&&(o=!1);else if(l===","){n+=1,a.push((s+i).trim());break}else l==="("&&(o=!0);i+=l,n+=1}}}return a.join(", ")}const Zm=new WeakMap;function uE(e,t){return!t||t.trim()===""?t:rd(e,t)}function V7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function rd(e,t){let n=Zm.get(e);if(n||(n=e.createElement("a"),Zm.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function c0(e,t,n,r,a,s){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?uE(e,r):n==="srcset"?Y7(e,r):n==="style"?lE(r,rd(e)):t==="object"&&n==="data"?uE(e,r):typeof s=="function"?s(n,r,a):r)}function E0(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function W7(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 a=e.classList.length;a--;){const s=e.classList[a];if(t.test(s))return!0}if(n)return e.matches(n)}catch{}return!1}function j7(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function Ls(e,t,n=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:Ls(e.parentNode,t,n,r+1)}function Li(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(j7(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}function ro(e,t,n,r,a,s){try{const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(i===null)return!1;if(i.tagName==="INPUT"){const u=i.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let o=-1,l=-1;if(s){if(l=Ls(i,Li(r,a)),l<0)return!0;o=Ls(i,Li(t,n),l>=0?l:1/0)}else{if(o=Ls(i,Li(t,n)),o<0)return!1;l=Ls(i,Li(r,a),o>=0?o:1/0)}return o>=0?l>=0?o<=l:!0:l>=0?!1:!!s}catch{}return!!s}function X7(e,t,n){const r=e.contentWindow;if(!r)return;let a=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const o=pT(()=>{a||(t(),a=!0)},n);e.addEventListener("load",()=>{l0(o),a=!0,t()});return}const i="about:blank";if(r.location.href!==i||e.src===i||e.src==="")return pT(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function K7(e,t,n){let r=!1,a;try{a=e.sheet}catch{return}if(a)return;const s=pT(()=>{r||(t(),r=!0)},n);e.addEventListener("load",()=>{l0(s),r=!0,t()})}function z7(e,t){const{doc:n,mirror:r,blockClass:a,blockSelector:s,unblockSelector:i,maskAllText:o,maskAttributeFn:l,maskTextClass:u,unmaskTextClass:c,maskTextSelector:E,unmaskTextSelector:f,inlineStylesheet:S,maskInputOptions:_={},maskTextFn:C,maskInputFn:I,dataURLOptions:d={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:h,newlyAddedElement:O=!1}=t,T=q7(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Lt.Document,childNodes:[],compatMode:e.compatMode}:{type:Lt.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Lt.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:T};case e.ELEMENT_NODE:return Z7(e,{doc:n,blockClass:a,blockSelector:s,unblockSelector:i,inlineStylesheet:S,maskAttributeFn:l,maskInputOptions:_,maskInputFn:I,dataURLOptions:d,inlineImages:p,recordCanvas:m,keepIframeSrcFn:h,newlyAddedElement:O,rootId:T,maskAllText:o,maskTextClass:u,unmaskTextClass:c,maskTextSelector:E,unmaskTextSelector:f});case e.TEXT_NODE:return J7(e,{doc:n,maskAllText:o,maskTextClass:u,unmaskTextClass:c,maskTextSelector:E,unmaskTextSelector:f,maskTextFn:C,maskInputOptions:_,maskInputFn:I,rootId:T});case e.CDATA_SECTION_NODE:return{type:Lt.CDATA,textContent:"",rootId:T};case e.COMMENT_NODE:return{type:Lt.Comment,textContent:e.textContent||"",rootId:T};default:return!1}}function q7(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return n===1?void 0:n}function J7(e,t){const{maskAllText:n,maskTextClass:r,unmaskTextClass:a,maskTextSelector:s,unmaskTextSelector:i,maskTextFn:o,maskInputOptions:l,maskInputFn:u,rootId:c}=t,E=e.parentNode&&e.parentNode.tagName;let f=e.textContent;const S=E==="STYLE"?!0:void 0,_=E==="SCRIPT"?!0:void 0,C=E==="TEXTAREA"?!0:void 0;if(S&&f){try{e.nextSibling||e.previousSibling||Ml([e,"access",d=>d.parentNode,"access",d=>d.sheet,"optionalAccess",d=>d.cssRules])&&(f=iE(e.parentNode.sheet))}catch(d){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${d}`,e)}f=lE(f,rd(t.doc))}_&&(f="SCRIPT_PLACEHOLDER");const I=ro(e,r,s,a,i,n);if(!S&&!_&&!C&&f&&I&&(f=o?o(f,e.parentElement):f.replace(/[\S]/g,"*")),C&&f&&(l.textarea||I)&&(f=u?u(f,e.parentNode):f.replace(/[\S]/g,"*")),E==="OPTION"&&f){const d=nd({type:null,tagName:E,maskInputOptions:l});f=Pl({isMasked:ro(e,r,s,a,i,d),element:e,value:f,maskInputFn:u})}return{type:Lt.Text,textContent:f||"",isStyle:S,rootId:c}}function Z7(e,t){const{doc:n,blockClass:r,blockSelector:a,unblockSelector:s,inlineStylesheet:i,maskInputOptions:o={},maskAttributeFn:l,maskInputFn:u,dataURLOptions:c={},inlineImages:E,recordCanvas:f,keepIframeSrcFn:S,newlyAddedElement:_=!1,rootId:C,maskAllText:I,maskTextClass:d,unmaskTextClass:p,maskTextSelector:m,unmaskTextSelector:h}=t,O=W7(e,r,a,s),T=x7(e);let N={};const g=e.attributes.length;for(let R=0;R<g;R++){const v=e.attributes[R];v.name&&!E0(T,v.name)&&(N[v.name]=c0(n,T,no(v.name),v.value,e,l))}if(T==="link"&&i){const R=Array.from(n.styleSheets).find(x=>x.href===e.href);let v=null;R&&(v=iE(R)),v&&(N.rel=null,N.href=null,N.crossorigin=null,N._cssText=lE(v,R.href))}if(T==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const R=iE(e.sheet);R&&(N._cssText=lE(R,rd(n)))}if(T==="input"||T==="textarea"||T==="select"||T==="option"){const R=e,v=aA(R),x=oE(R,dT(T),v),F=R.checked;if(v!=="submit"&&v!=="button"&&x){const B=ro(R,d,m,p,h,nd({type:v,tagName:dT(T),maskInputOptions:o}));N.value=Pl({isMasked:B,element:R,value:x,maskInputFn:u})}F&&(N.checked=F)}if(T==="option"&&(e.selected&&!o.select?N.selected=!0:delete N.selected),T==="canvas"&&f){if(e.__context==="2d")M7(e)||(N.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){const R=e.toDataURL(c.type,c.quality),v=n.createElement("canvas");v.width=e.width,v.height=e.height;const x=v.toDataURL(c.type,c.quality);R!==x&&(N.rr_dataURL=R)}}if(T==="img"&&E){ci||(ci=n.createElement("canvas"),Jm=ci.getContext("2d"));const R=e,v=R.currentSrc||R.getAttribute("src")||"<unknown-src>",x=R.crossOrigin,F=()=>{R.removeEventListener("load",F);try{ci.width=R.naturalWidth,ci.height=R.naturalHeight,Jm.drawImage(R,0,0),N.rr_dataURL=ci.toDataURL(c.type,c.quality)}catch(B){if(R.crossOrigin!=="anonymous"){R.crossOrigin="anonymous",R.complete&&R.naturalWidth!==0?F():R.addEventListener("load",F);return}else console.warn(`Cannot inline img src=${v}! Error: ${B}`)}R.crossOrigin==="anonymous"&&(x?N.crossOrigin=x:R.removeAttribute("crossorigin"))};R.complete&&R.naturalWidth!==0?F():R.addEventListener("load",F)}if((T==="audio"||T==="video")&&(N.rr_mediaState=e.paused?"paused":"played",N.rr_mediaCurrentTime=e.currentTime),_||(e.scrollLeft&&(N.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(N.rr_scrollTop=e.scrollTop)),O){const{width:R,height:v}=e.getBoundingClientRect();N={class:N.class,rr_width:`${R}px`,rr_height:`${v}px`}}T==="iframe"&&!S(N.src)&&(!O&&!u0(e)&&(N.rr_src=N.src),delete N.src);let D;try{customElements.get(T)&&(D=!0)}catch{}return{type:Lt.Element,tagName:T,attributes:N,childNodes:[],isSVG:V7(e)||void 0,needBlock:O,rootId:C,isCustom:D}}function ze(e){return e==null?"":e.toLowerCase()}function Q7(e,t){return!!(t.comment&&e.type===Lt.Comment||e.type===Lt.Element&&(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"&&i0(e.attributes.href)==="js")||t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ze(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ze(e.attributes.name)==="application-name"||ze(e.attributes.rel)==="icon"||ze(e.attributes.rel)==="apple-touch-icon"||ze(e.attributes.rel)==="shortcut icon"))||e.tagName==="meta"&&(t.headMetaDescKeywords&&ze(e.attributes.name).match(/^description|keywords$/)||t.headMetaSocial&&(ze(e.attributes.property).match(/^(og|twitter|fb):/)||ze(e.attributes.name).match(/^(og|twitter):/)||ze(e.attributes.name)==="pinterest")||t.headMetaRobots&&(ze(e.attributes.name)==="robots"||ze(e.attributes.name)==="googlebot"||ze(e.attributes.name)==="bingbot")||t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0||t.headMetaAuthorship&&(ze(e.attributes.name)==="author"||ze(e.attributes.name)==="generator"||ze(e.attributes.name)==="framework"||ze(e.attributes.name)==="publisher"||ze(e.attributes.name)==="progid"||ze(e.attributes.property).match(/^article:/)||ze(e.attributes.property).match(/^product:/))||t.headMetaVerification&&(ze(e.attributes.name)==="google-site-verification"||ze(e.attributes.name)==="yandex-verification"||ze(e.attributes.name)==="csrf-token"||ze(e.attributes.name)==="p:domain_verify"||ze(e.attributes.name)==="verify-v1"||ze(e.attributes.name)==="verification"||ze(e.attributes.name)==="shopify-checkout-api-token"))))}function yi(e,t){const{doc:n,mirror:r,blockClass:a,blockSelector:s,unblockSelector:i,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:E,skipChild:f=!1,inlineStylesheet:S=!0,maskInputOptions:_={},maskAttributeFn:C,maskTextFn:I,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m={},inlineImages:h=!1,recordCanvas:O=!1,onSerialize:T,onIframeLoad:N,iframeLoadTimeout:g=5e3,onStylesheetLoad:D,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:v=()=>!1,newlyAddedElement:x=!1}=t;let{preserveWhiteSpace:F=!0}=t;const B=z7(e,{doc:n,mirror:r,blockClass:a,blockSelector:s,maskAllText:o,unblockSelector:i,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:E,inlineStylesheet:S,maskInputOptions:_,maskAttributeFn:C,maskTextFn:I,maskInputFn:d,dataURLOptions:m,inlineImages:h,recordCanvas:O,keepIframeSrcFn:v,newlyAddedElement:x});if(!B)return console.warn(e,"not serialized"),null;let W;r.hasNode(e)?W=r.getId(e):Q7(B,p)||!F&&B.type===Lt.Text&&!B.isStyle&&!B.textContent.replace(/^\s+|\s+$/gm,"").length?W=Dl:W=sA();const H=Object.assign(B,{id:W});if(r.add(e,H),W===Dl)return null;T&&T(e);let k=!f;if(H.type===Lt.Element){k=k&&!H.needBlock,delete H.needBlock;const U=e.shadowRoot;U&&ll(U)&&(H.isShadowHost=!0)}if((H.type===Lt.Document||H.type===Lt.Element)&&k){p.headWhitespace&&H.type===Lt.Element&&H.tagName==="head"&&(F=!1);const U={doc:n,mirror:r,blockClass:a,blockSelector:s,maskAllText:o,unblockSelector:i,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:E,skipChild:f,inlineStylesheet:S,maskInputOptions:_,maskAttributeFn:C,maskTextFn:I,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:O,preserveWhiteSpace:F,onSerialize:T,onIframeLoad:N,iframeLoadTimeout:g,onStylesheetLoad:D,stylesheetLoadTimeout:R,keepIframeSrcFn:v};for(const z of Array.from(e.childNodes)){const q=yi(z,U);q&&H.childNodes.push(q)}if(O7(e)&&e.shadowRoot)for(const z of Array.from(e.shadowRoot.childNodes)){const q=yi(z,U);q&&(ll(e.shadowRoot)&&(q.isShadow=!0),H.childNodes.push(q))}}return e.parentNode&&ol(e.parentNode)&&ll(e.parentNode)&&(H.isShadow=!0),H.type===Lt.Element&&H.tagName==="iframe"&&X7(e,()=>{const U=u0(e);if(U&&N){const z=yi(U,{doc:U,mirror:r,blockClass:a,blockSelector:s,unblockSelector:i,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:E,skipChild:!1,inlineStylesheet:S,maskInputOptions:_,maskAttributeFn:C,maskTextFn:I,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:O,preserveWhiteSpace:F,onSerialize:T,onIframeLoad:N,iframeLoadTimeout:g,onStylesheetLoad:D,stylesheetLoadTimeout:R,keepIframeSrcFn:v});z&&N(e,z)}},g),H.type===Lt.Element&&H.tagName==="link"&&typeof H.attributes.rel=="string"&&(H.attributes.rel==="stylesheet"||H.attributes.rel==="preload"&&typeof H.attributes.href=="string"&&i0(H.attributes.href)==="css")&&K7(e,()=>{if(D){const U=yi(e,{doc:n,mirror:r,blockClass:a,blockSelector:s,unblockSelector:i,maskAllText:o,maskTextClass:l,unmaskTextClass:u,maskTextSelector:c,unmaskTextSelector:E,skipChild:!1,inlineStylesheet:S,maskInputOptions:_,maskAttributeFn:C,maskTextFn:I,maskInputFn:d,slimDOMOptions:p,dataURLOptions:m,inlineImages:h,recordCanvas:O,preserveWhiteSpace:F,onSerialize:T,onIframeLoad:N,iframeLoadTimeout:g,onStylesheetLoad:D,stylesheetLoadTimeout:R,keepIframeSrcFn:v});U&&D(e,U)}},R),H}function $7(e,t){const{mirror:n=new s0,blockClass:r="rr-block",blockSelector:a=null,unblockSelector:s=null,maskAllText:i=!1,maskTextClass:o="rr-mask",unmaskTextClass:l=null,maskTextSelector:u=null,unmaskTextSelector:c=null,inlineStylesheet:E=!0,inlineImages:f=!1,recordCanvas:S=!1,maskAllInputs:_=!1,maskAttributeFn:C,maskTextFn:I,maskInputFn:d,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:h,onSerialize:O,onIframeLoad:T,iframeLoadTimeout:N,onStylesheetLoad:g,stylesheetLoadTimeout:D,keepIframeSrcFn:R=()=>!1}=t;return yi(e,{doc:e,mirror:n,blockClass:r,blockSelector:a,unblockSelector:s,maskAllText:i,maskTextClass:o,unmaskTextClass:l,maskTextSelector:u,unmaskTextSelector:c,skipChild:!1,inlineStylesheet:E,maskInputOptions:_===!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}:_===!1?{}:_,maskAttributeFn:C,maskTextFn:I,maskInputFn:d,slimDOMOptions:p===!0||p==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:p==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:p===!1?{}:p,dataURLOptions:m,inlineImages:f,recordCanvas:S,preserveWhiteSpace:h,onSerialize:O,onIframeLoad:T,iframeLoadTimeout:N,onStylesheetLoad:g,stylesheetLoadTimeout:D,keepIframeSrcFn:R,newlyAddedElement:!1})}function La(e){let t,n=e[0],r=1;for(;r<e.length;){const a=e[r],s=e[r+1];if(r+=2,(a==="optionalAccess"||a==="optionalCall")&&n==null)return;a==="access"||a==="optionalAccess"?(t=n,n=s(n)):(a==="call"||a==="optionalCall")&&(n=s((...i)=>n.call(t,...i)),t=void 0)}return n}function dn(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const di=`Please stop import mirror directly. Instead of that,\r
129
129
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
130
130
  or you can use record.mirror to access the mirror instance during recording.`;let Qm={map:{},getId(){return console.error(di),-1},getNode(){return console.error(di),null},removeNodeFromMap(){console.error(di)},has(){return console.error(di),!1},reset(){console.error(di)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Qm=new Proxy(Qm,{get(e,t,n){return t==="map"&&console.error(di),Reflect.get(e,t,n)}}));function xl(e,t,n={}){let r=null,a=0;return function(...s){const i=Date.now();!a&&n.leading===!1&&(a=i);const o=t-(i-a),l=this;o<=0||o>t?(r&&(iU(r),r=null),a=i,e.apply(l,s)):!r&&n.trailing!==!1&&(r=ad(()=>{a=n.leading===!1?0:Date.now(),r=null,e.apply(l,s)},o))}}function d0(e,t,n,r,a=window){const s=a.Object.getOwnPropertyDescriptor(e,t);return a.Object.defineProperty(e,t,r?n:{set(i){ad(()=>{n.set.call(this,i)},0),s&&s.set&&s.set.call(this,i)}}),()=>d0(e,t,s||{},!0)}function iA(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],a=n(r);return typeof a=="function"&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=a,()=>{e[t]=r}}catch{return()=>{}}}let cE=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(cE=()=>new Date().getTime());function p0(e){const t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:La([t,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollLeft])||La([t,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollLeft])||La([t,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollLeft])||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:La([t,"optionalAccess",n=>n.documentElement,"access",n=>n.scrollTop])||La([t,"optionalAccess",n=>n.body,"optionalAccess",n=>n.parentElement,"optionalAccess",n=>n.scrollTop])||La([t,"optionalAccess",n=>n.body,"optionalAccess",n=>n.scrollTop])||0}}function f0(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function T0(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function h0(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function kn(e,t,n,r,a){if(!e)return!1;const s=h0(e);if(!s)return!1;const i=Li(t,n);if(!a){const u=r&&s.matches(r);return i(s)&&!u}const o=Ls(s,i);let l=-1;return o<0?!1:(r&&(l=Ls(s,Li(null,r))),o>-1&&l<0?!0:o<l)}function eU(e,t){return t.getId(e)!==-1}function _p(e,t){return t.getId(e)===Dl}function A0(e,t){if(ol(e))return!1;const n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?A0(e.parentNode,t):!0:!0}function fT(e){return!!e.changedTouches}function tU(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{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 S0(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function R0(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function TT(e){return!!La([e,"optionalAccess",t=>t.shadowRoot])}class nU{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return n4(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 m0(e){let t=null;return La([e,"access",n=>n.getRootNode,"optionalCall",n=>n(),"optionalAccess",n=>n.nodeType])===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function rU(e){let t=e,n;for(;n=m0(t);)t=n;return t}function aU(e){const t=e.ownerDocument;if(!t)return!1;const n=rU(e);return t.contains(n)}function _0(e){const t=e.ownerDocument;return t?t.contains(e)||aU(e):!1}const $m={};function oA(e){const t=$m[e];if(t)return t;const n=window.document;let r=window[e];if(n&&typeof n.createElement=="function")try{const a=n.createElement("iframe");a.hidden=!0,n.head.appendChild(a);const s=a.contentWindow;s&&s[e]&&(r=s[e]),n.head.removeChild(a)}catch{}return $m[e]=r.bind(window)}function sU(...e){return oA("requestAnimationFrame")(...e)}function ad(...e){return oA("setTimeout")(...e)}function iU(...e){return oA("clearTimeout")(...e)}var Ce=(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))(Ce||{}),Re=(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))(Re||{}),un=(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))(un||{}),Oa=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Oa||{}),e_;(function(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_={}));var t_;(function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(t_||(t_={}));function lA(e){try{return e.contentDocument}catch{}}function oU(e){try{return e.contentWindow}catch{}}function lU(e){let t,n=e[0],r=1;for(;r<e.length;){const a=e[r],s=e[r+1];if(r+=2,(a==="optionalAccess"||a==="optionalCall")&&n==null)return;a==="access"||a==="optionalAccess"?(t=n,n=s(n)):(a==="call"||a==="optionalCall")&&(n=s((...i)=>n.call(t,...i)),t=void 0)}return n}function n_(e){return"__ln"in e}class uU{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<t;r++)n=lU([n,"optionalAccess",a=>a.next])||null;return n}addNode(t){const n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&n_(t.previousSibling)){const r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&n_(t.nextSibling)&&t.nextSibling.__ln.previous){const r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(t){const n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const r_=(e,t)=>`${e}@${t}`;class cU{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 uU,a=l=>{let u=l,c=Dl;for(;c===Dl;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},s=l=>{if(!l.parentNode||!_0(l))return;const u=ol(l.parentNode)?this.mirror.getId(m0(l)):this.mirror.getId(l.parentNode),c=a(l);if(u===-1||c===-1)return r.addNode(l);const E=yi(l,{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=>{S0(f,this.mirror)&&!kn(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(f),R0(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),TT(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(f,S)=>{kn(f,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(f,S),f.contentWindow&&this.canvasManager.addWindow(f.contentWindow),this.shadowDomManager.observeAttachShadow(f))},onStylesheetLoad:(f,S)=>{this.stylesheetManager.attachLinkElement(f,S)}});E&&(t.push({parentId:u,nextId:c,node:E}),n.add(E.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)a_(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||s(l);for(const l of this.addedSet)!s_(this.droppedSet,l)&&!a_(this.removes,l,this.mirror)||s_(this.movedSet,l)?s(l):this.droppedSet.add(l);let i=null;for(;r.length;){let l=null;if(i){const u=this.mirror.getId(i.value.parentNode),c=a(i.value);u!==-1&&c!==-1&&(l=i)}if(!l){let u=r.tail;for(;u;){const c=u;if(u=u.previous,c){const E=this.mirror.getId(c.value.parentNode);if(a(c.value)===-1)continue;if(E!==-1){l=c;break}else{const f=c.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const S=f.parentNode.host;if(this.mirror.getId(S)!==-1){l=c;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}i=l.previous,r.removeNode(l.value),s(l.value)}const o={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:u}=l;if(typeof u.style=="string"){const c=JSON.stringify(l.styleDiff),E=JSON.stringify(l._unchangedStyles);c.length<u.style.length&&(c+E).split("var(").length===u.style.split("var(").length&&(u.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:u}}).filter(l=>!n.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!o.texts.length&&!o.attributes.length&&!o.removes.length&&!o.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(o))},this.processMutation=t=>{if(!_p(t.target,this.mirror))switch(t.type){case"characterData":{const n=t.target.textContent;!kn(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:ro(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,h0(t.target)):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{const n=t.target;let r=t.attributeName,a=t.target.getAttribute(r);if(r==="value"){const i=aA(n),o=n.tagName;a=oE(n,o,i);const l=nd({maskInputOptions:this.maskInputOptions,tagName:o,type:i}),u=ro(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);a=Pl({isMasked:u,element:n,value:a,maskInputFn:this.maskInputFn})}if(kn(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||a===t.oldValue)return;let s=this.attributeMap.get(t.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(a))if(!lA(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"),!E0(n.tagName,r)&&(s.attributes[r]=c0(this.doc,no(n.tagName),no(r),a,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");t.oldValue&&i.setAttribute("style",t.oldValue);for(const o of Array.from(n.style)){const l=n.style.getPropertyValue(o),u=n.style.getPropertyPriority(o);l!==i.style.getPropertyValue(o)||u!==i.style.getPropertyPriority(o)?u===""?s.styleDiff[o]=l:s.styleDiff[o]=[l,u]:s._unchangedStyles[o]=[l,u]}for(const o of Array.from(i.style))n.style.getPropertyValue(o)===""&&(s.styleDiff[o]=!1)}break}case"childList":{if(kn(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),a=ol(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);kn(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||_p(n,this.mirror)||!eU(n,this.mirror)||(this.addedSet.has(n)?(hT(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||A0(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[r_(r,a)]?hT(this.movedSet,n):this.removes.push({parentId:a,id:r,isShadow:ol(t.target)&&ll(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(_p(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[r_(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);kn(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes.forEach(r=>this.genAdds(r)),TT(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"].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 hT(e,t){e.delete(t),t.childNodes.forEach(n=>hT(e,n))}function a_(e,t,n){return e.length===0?!1:EU(e,t,n)}function EU(e,t,n){let r=t.parentNode;for(;r;){const a=n.getId(r);if(e.some(s=>s.id===a))return!0;r=r.parentNode}return!1}function s_(e,t){return e.size===0?!1:N0(e,t)}function N0(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:N0(e,n):!1}let ul;function dU(e){ul=e}function pU(){ul=void 0}const xe=e=>ul?(...t)=>{try{return e(...t)}catch(n){if(ul&&ul(n)===!0)return()=>{};throw n}}:e;function Tr(e){let t,n=e[0],r=1;for(;r<e.length;){const a=e[r],s=e[r+1];if(r+=2,(a==="optionalAccess"||a==="optionalCall")&&n==null)return;a==="access"||a==="optionalAccess"?(t=n,n=s(n)):(a==="call"||a==="optionalCall")&&(n=s((...i)=>n.call(t,...i)),t=void 0)}return n}const bi=[];function tu(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 O0(e,t){const n=new cU;bi.push(n),n.init(e);let r=window.MutationObserver||window.__rrMutationObserver;const a=Tr([window,"optionalAccess",i=>i.Zone,"optionalAccess",i=>i.__symbol__,"optionalCall",i=>i("MutationObserver")]);a&&window[a]&&(r=window[a]);const s=new r(xe(i=>{e.onMutation&&e.onMutation(i)===!1||n.processMutations.bind(n)(i)}));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function fU({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};const a=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let i=[],o;const l=xl(xe(E=>{const f=Date.now()-o;e(i.map(S=>(S.timeOffset-=f,S)),E),i=[],o=null}),s),u=xe(xl(xe(E=>{const f=tu(E),{clientX:S,clientY:_}=fT(E)?E.changedTouches[0]:E;o||(o=cE()),i.push({x:S,y:_,id:r.getId(f),timeOffset:cE()-o}),l(typeof DragEvent<"u"&&E instanceof DragEvent?Re.Drag:E instanceof MouseEvent?Re.MouseMove:Re.TouchMove)}),a,{trailing:!1})),c=[dn("mousemove",u,n),dn("touchmove",u,n),dn("drag",u,n)];return xe(()=>{c.forEach(E=>E())})}function TU({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:a,unblockSelector:s,sampling:i}){if(i.mouseInteraction===!1)return()=>{};const o=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,l=[];let u=null;const c=E=>f=>{const S=tu(f);if(kn(S,r,a,s,!0))return;let _=null,C=E;if("pointerType"in f){switch(f.pointerType){case"mouse":_=Oa.Mouse;break;case"touch":_=Oa.Touch;break;case"pen":_=Oa.Pen;break}_===Oa.Touch&&(un[E]===un.MouseDown?C="TouchStart":un[E]===un.MouseUp&&(C="TouchEnd"))}else fT(f)&&(_=Oa.Touch);_!==null?(u=_,(C.startsWith("Touch")&&_===Oa.Touch||C.startsWith("Mouse")&&_===Oa.Mouse)&&(_=null)):un[E]===un.Click&&(_=u,u=null);const I=fT(f)?f.changedTouches[0]:f;if(!I)return;const d=n.getId(S),{clientX:p,clientY:m}=I;xe(e)({type:un[C],id:d,x:p,y:m,..._!==null&&{pointerType:_}})};return Object.keys(un).filter(E=>Number.isNaN(Number(E))&&!E.endsWith("_Departed")&&o[E]!==!1).forEach(E=>{let f=no(E);const S=c(E);if(window.PointerEvent)switch(un[E]){case un.MouseDown:case un.MouseUp:f=f.replace("mouse","pointer");break;case un.TouchStart:case un.TouchEnd:return}l.push(dn(f,S,t))}),xe(()=>{l.forEach(E=>E())})}function I0({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:a,unblockSelector:s,sampling:i}){const o=xe(xl(xe(l=>{const u=tu(l);if(!u||kn(u,r,a,s,!0))return;const c=n.getId(u);if(u===t&&t.defaultView){const E=p0(t.defaultView);e({id:c,x:E.left,y:E.top})}else e({id:c,x:u.scrollLeft,y:u.scrollTop})}),i.scroll||100));return dn("scroll",o,t)}function hU({viewportResizeCb:e},{win:t}){let n=-1,r=-1;const a=xe(xl(xe(()=>{const s=f0(),i=T0();(n!==s||r!==i)&&(e({width:Number(i),height:Number(s)}),n=s,r=i)}),200));return dn("resize",a,t)}const AU=["INPUT","TEXTAREA","SELECT"],i_=new WeakMap;function SU({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:a,unblockSelector:s,ignoreClass:i,ignoreSelector:o,maskInputOptions:l,maskInputFn:u,sampling:c,userTriggeredOnInput:E,maskTextClass:f,unmaskTextClass:S,maskTextSelector:_,unmaskTextSelector:C}){function I(T){let N=tu(T);const g=T.isTrusted,D=N&&dT(N.tagName);if(D==="OPTION"&&(N=N.parentElement),!N||!D||AU.indexOf(D)<0||kn(N,r,a,s,!0))return;const R=N;if(R.classList.contains(i)||o&&R.matches(o))return;const v=aA(N);let x=oE(R,D,v),F=!1;const B=nd({maskInputOptions:l,tagName:D,type:v}),W=ro(N,f,_,S,C,B);(v==="radio"||v==="checkbox")&&(F=N.checked),x=Pl({isMasked:W,element:N,value:x,maskInputFn:u}),d(N,E?{text:x,isChecked:F,userTriggered:g}:{text:x,isChecked:F});const H=N.name;v==="radio"&&H&&F&&t.querySelectorAll(`input[type="radio"][name="${H}"]`).forEach(k=>{if(k!==N){const U=Pl({isMasked:W,element:k,value:oE(k,D,v),maskInputFn:u});d(k,E?{text:U,isChecked:!F,userTriggered:!1}:{text:U,isChecked:!F})}})}function d(T,N){const g=i_.get(T);if(!g||g.text!==N.text||g.isChecked!==N.isChecked){i_.set(T,N);const D=n.getId(T);xe(e)({...N,id:D})}}const p=(c.input==="last"?["change"]:["input","change"]).map(T=>dn(T,xe(I),t)),m=t.defaultView;if(!m)return()=>{p.forEach(T=>T())};const h=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),O=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return h&&h.set&&p.push(...O.map(T=>d0(T[0],T[1],{set(){xe(I)({target:this,isTrusted:!1})}},!1,m))),xe(()=>{p.forEach(T=>T())})}function EE(e){const t=[];function n(r,a){if(Vu("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Vu("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Vu("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Vu("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const s=Array.from(r.parentRule.cssRules).indexOf(r);a.unshift(s)}else if(r.parentStyleSheet){const s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);a.unshift(s)}return a}return n(e,t)}function ya(e,t,n){let r,a;return e?(e.ownerNode?r=t.getId(e.ownerNode):a=n.getId(e),{styleId:a,id:r}):{}}function RU({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const a=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:xe((c,E,f)=>{const[S,_]=f,{id:C,styleId:I}=ya(E,t,n.styleMirror);return(C&&C!==-1||I&&I!==-1)&&e({id:C,styleId:I,adds:[{rule:S,index:_}]}),c.apply(E,f)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:xe((c,E,f)=>{const[S]=f,{id:_,styleId:C}=ya(E,t,n.styleMirror);return(_&&_!==-1||C&&C!==-1)&&e({id:_,styleId:C,removes:[{index:S}]}),c.apply(E,f)})});let i;r.CSSStyleSheet.prototype.replace&&(i=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:xe((c,E,f)=>{const[S]=f,{id:_,styleId:C}=ya(E,t,n.styleMirror);return(_&&_!==-1||C&&C!==-1)&&e({id:_,styleId:C,replace:S}),c.apply(E,f)})}));let o;r.CSSStyleSheet.prototype.replaceSync&&(o=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(o,{apply:xe((c,E,f)=>{const[S]=f,{id:_,styleId:C}=ya(E,t,n.styleMirror);return(_&&_!==-1||C&&C!==-1)&&e({id:_,styleId:C,replaceSync:S}),c.apply(E,f)})}));const l={};Wu("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Wu("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Wu("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Wu("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,E])=>{u[c]={insertRule:E.prototype.insertRule,deleteRule:E.prototype.deleteRule},E.prototype.insertRule=new Proxy(u[c].insertRule,{apply:xe((f,S,_)=>{const[C,I]=_,{id:d,styleId:p}=ya(S.parentStyleSheet,t,n.styleMirror);return(d&&d!==-1||p&&p!==-1)&&e({id:d,styleId:p,adds:[{rule:C,index:[...EE(S),I||0]}]}),f.apply(S,_)})}),E.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:xe((f,S,_)=>{const[C]=_,{id:I,styleId:d}=ya(S.parentStyleSheet,t,n.styleMirror);return(I&&I!==-1||d&&d!==-1)&&e({id:I,styleId:d,removes:[{index:[...EE(S),C]}]}),f.apply(S,_)})})}),xe(()=>{r.CSSStyleSheet.prototype.insertRule=a,r.CSSStyleSheet.prototype.deleteRule=s,i&&(r.CSSStyleSheet.prototype.replace=i),o&&(r.CSSStyleSheet.prototype.replaceSync=o),Object.entries(l).forEach(([c,E])=>{E.prototype.insertRule=u[c].insertRule,E.prototype.deleteRule=u[c].deleteRule})})}function C0({mirror:e,stylesheetManager:t},n){let r=null;n.nodeName==="#document"?r=e.getId(n):r=e.getId(n.host);const a=n.nodeName==="#document"?Tr([n,"access",i=>i.defaultView,"optionalAccess",i=>i.Document]):Tr([n,"access",i=>i.ownerDocument,"optionalAccess",i=>i.defaultView,"optionalAccess",i=>i.ShadowRoot]),s=Tr([a,"optionalAccess",i=>i.prototype])?Object.getOwnPropertyDescriptor(Tr([a,"optionalAccess",i=>i.prototype]),"adoptedStyleSheets"):void 0;return r===null||r===-1||!a||!s?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){return Tr([s,"access",i=>i.get,"optionalAccess",i=>i.call,"call",i=>i(this)])},set(i){const o=Tr([s,"access",l=>l.set,"optionalAccess",l=>l.call,"call",l=>l(this,i)]);if(r!==null&&r!==-1)try{t.adoptStyleSheets(i,r)}catch{}return o}}),xe(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function mU({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:a}){const s=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:xe((o,l,u)=>{const[c,E,f]=u;if(n.has(c))return s.apply(l,[c,E,f]);const{id:S,styleId:_}=ya(Tr([l,"access",C=>C.parentRule,"optionalAccess",C=>C.parentStyleSheet]),t,r.styleMirror);return(S&&S!==-1||_&&_!==-1)&&e({id:S,styleId:_,set:{property:c,value:E,priority:f},index:EE(l.parentRule)}),o.apply(l,u)})});const i=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:xe((o,l,u)=>{const[c]=u;if(n.has(c))return i.apply(l,[c]);const{id:E,styleId:f}=ya(Tr([l,"access",S=>S.parentRule,"optionalAccess",S=>S.parentStyleSheet]),t,r.styleMirror);return(E&&E!==-1||f&&f!==-1)&&e({id:E,styleId:f,remove:{property:c},index:EE(l.parentRule)}),o.apply(l,u)})}),xe(()=>{a.CSSStyleDeclaration.prototype.setProperty=s,a.CSSStyleDeclaration.prototype.removeProperty=i})}function _U({mediaInteractionCb:e,blockClass:t,blockSelector:n,unblockSelector:r,mirror:a,sampling:s,doc:i}){const o=xe(u=>xl(xe(c=>{const E=tu(c);if(!E||kn(E,t,n,r,!0))return;const{currentTime:f,volume:S,muted:_,playbackRate:C}=E;e({type:u,id:a.getId(E),currentTime:f,volume:S,muted:_,playbackRate:C})}),s.media||500)),l=[dn("play",o(0),i),dn("pause",o(1),i),dn("seeked",o(2),i),dn("volumechange",o(3),i),dn("ratechange",o(4),i)];return xe(()=>{l.forEach(u=>u())})}function NU({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],a=new WeakMap,s=n.FontFace;n.FontFace=function(o,l,u){const c=new s(o,l,u);return a.set(c,{family:o,buffer:typeof l!="string",descriptors:u,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),c};const i=iA(t.fonts,"add",function(o){return function(l){return ad(xe(()=>{const u=a.get(l);u&&(e(u),a.delete(l))}),0),o.apply(this,[l])}});return r.push(()=>{n.FontFace=s}),r.push(i),xe(()=>{r.forEach(o=>o())})}function OU(e){const{doc:t,mirror:n,blockClass:r,blockSelector:a,unblockSelector:s,selectionCb:i}=e;let o=!0;const l=xe(()=>{const u=t.getSelection();if(!u||o&&Tr([u,"optionalAccess",f=>f.isCollapsed]))return;o=u.isCollapsed||!1;const c=[],E=u.rangeCount||0;for(let f=0;f<E;f++){const S=u.getRangeAt(f),{startContainer:_,startOffset:C,endContainer:I,endOffset:d}=S;kn(_,r,a,s,!0)||kn(I,r,a,s,!0)||c.push({start:n.getId(_),startOffset:C,end:n.getId(I),endOffset:d})}i({ranges:c})});return l(),dn("selectionchange",l)}function IU({doc:e,customElementCb:t}){const n=e.defaultView;return!n||!n.customElements?()=>{}:iA(n.customElements,"define",function(r){return function(a,s,i){try{t({define:{name:a}})}catch{}return r.apply(this,[a,s,i])}})}function CU(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;e.recordDOM&&(r=O0(e,e.doc));const a=fU(e),s=TU(e),i=I0(e),o=hU(e,{win:n}),l=SU(e),u=_U(e);let c=()=>{},E=()=>{},f=()=>{},S=()=>{};e.recordDOM&&(c=RU(e,{win:n}),E=C0(e,e.doc),f=mU(e,{win:n}),e.collectFonts&&(S=NU(e)));const _=OU(e),C=IU(e),I=[];for(const d of e.plugins)I.push(d.observer(d.callback,n,d.options));return xe(()=>{bi.forEach(d=>d.reset()),Tr([r,"optionalAccess",d=>d.disconnect,"call",d=>d()]),a(),s(),i(),o(),l(),u(),c(),E(),f(),S(),_(),C(),I.forEach(d=>d())})}function Vu(e){return typeof window[e]<"u"}function Wu(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class AT{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,a){const s=r||this.getIdToRemoteIdMap(t),i=a||this.getRemoteIdToIdMap(t);let o=s.get(n);return o||(o=this.generateIdFn(),s.set(n,o),i.set(o,n)),o}getIds(t,n){const r=this.getIdToRemoteIdMap(t),a=this.getRemoteIdToIdMap(t);return n.map(s=>this.getId(t,s,r,a))}getRemoteId(t,n,r){const a=r||this.getRemoteIdToIdMap(t);return typeof n!="number"?n:a.get(n)||-1}getRemoteIds(t,n){const r=this.getRemoteIdToIdMap(t);return n.map(a=>this.getRemoteId(t,a,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}}function o_(e){let t,n=e[0],r=1;for(;r<e.length;){const a=e[r],s=e[r+1];if(r+=2,(a==="optionalAccess"||a==="optionalCall")&&n==null)return;a==="access"||a==="optionalAccess"?(t=n,n=s(n)):(a==="call"||a==="optionalCall")&&(n=s((...i)=>n.call(t,...i)),t=void 0)}return n}class gU{constructor(){this.crossOriginIframeMirror=new AT(sA),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class LU{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new AT(sA),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new AT(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}),o_([this,"access",a=>a.loadListener,"optionalCall",a=>a(t)]);const r=lA(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 r=this.crossOriginIframeMap.get(t.source);if(!r)return;const a=this.transformCrossOriginEvent(r,n.data.event);a&&this.wrappedEmit(a,n.data.isCheckout)}transformCrossOriginEvent(t,n){switch(n.type){case Ce.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:Ce.IncrementalSnapshot,data:{source:Re.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ce.Meta:case Ce.Load:case Ce.DomContentLoaded:return!1;case Ce.Plugin:return n;case Ce.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case Ce.IncrementalSnapshot:switch(n.data.source){case Re.Mutation:return n.data.adds.forEach(r=>{this.replaceIds(r,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,t);const a=this.crossOriginIframeRootIdMap.get(t);a&&this.patchRootIdOnNode(r.node,a)}),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 Re.Drag:case Re.TouchMove:case Re.MouseMove:return n.data.positions.forEach(r=>{this.replaceIds(r,t,["id"])}),n;case Re.ViewportResize:return!1;case Re.MediaInteraction:case Re.MouseInteraction:case Re.Scroll:case Re.CanvasMutation:case Re.Input:return this.replaceIds(n.data,t,["id"]),n;case Re.StyleSheetRule:case Re.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case Re.Font:return n;case Re.Selection:return n.data.ranges.forEach(r=>{this.replaceIds(r,t,["start","end"])}),n;case Re.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),o_([n,"access",r=>r.data,"access",r=>r.styles,"optionalAccess",r=>r.forEach,"call",r=>r(a=>{this.replaceStyleIds(a,t,["styleId"])})]),n}}return!1}replace(t,n,r,a){for(const s of a)!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!==Lt.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class yU{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class bU{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(!ll(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);const r=O0({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(I0({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),ad(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(C0({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){const n=lA(t),r=oU(t);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(t,n){const r=this;this.restoreHandlers.push(iA(t.prototype,"attachShadow",function(a){return function(s){const i=a.call(this,s);return this.shadowRoot&&_0(this)&&r.addShadowRoot(this.shadowRoot,n),i}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}class l_{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class vU{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new nU,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;const r={id:n,styleIds:[]},a=[];for(const s of t){let i;this.styleMirror.has(s)?i=this.styleMirror.getId(s):(i=this.styleMirror.add(s),a.push({styleId:i,rules:Array.from(s.rules||CSSRule,(o,l)=>({rule:a0(o),index:l}))})),r.styleIds.push(i)}a.length>0&&(r.styles=a),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class MU{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,n){const r=this.nodeMap.get(t);return r&&Array.from(r).some(a=>a!==n)}add(t,n){this.active||(this.active=!0,sU(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}destroy(){}}let Et,dE;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=Tc([e,"access",t=>t.contentWindow,"optionalAccess",t=>t.Array,"access",t=>t.from])||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const cr=v7();function na(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:a="rr-block",blockSelector:s=null,unblockSelector:i=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskAllText:u=!1,maskTextClass:c="rr-mask",unmaskTextClass:E=null,maskTextSelector:f=null,unmaskTextSelector:S=null,inlineStylesheet:_=!0,maskAllInputs:C,maskInputOptions:I,slimDOMOptions:d,maskAttributeFn:p,maskInputFn:m,maskTextFn:h,maxCanvasSize:O=null,packFn:T,sampling:N={},dataURLOptions:g={},mousemoveWait:D,recordDOM:R=!0,recordCanvas:v=!1,recordCrossOriginIframes:x=!1,recordAfter:F=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:B=!1,collectFonts:W=!1,inlineImages:H=!1,plugins:k,keepIframeSrcFn:U=()=>!1,ignoreCSSAttributes:z=new Set([]),errorHandler:q,onMutation:le,getCanvasManager:pe}=e;dU(q);const ye=x?window.parent===window:!0;let be=!1;if(!ye)try{window.parent.document&&(be=!1)}catch{be=!0}if(ye&&!t)throw new Error("emit function is required");if(!ye&&!be)return()=>{};D!==void 0&&N.mousemove===void 0&&(N.mousemove=D),cr.reset();const Xe=C===!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}:I!==void 0?I:{},Qe=d===!0||d==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:d==="all",headMetaDescKeywords:d==="all"}:d||{};tU();let ke,Zt=0;const kt=Ne=>{for(const Qt of k||[])Qt.eventProcessor&&(Ne=Qt.eventProcessor(Ne));return T&&!be&&(Ne=T(Ne)),Ne};Et=(Ne,Qt)=>{const Ie=Ne;if(Ie.timestamp=cE(),Tc([bi,"access",Ve=>Ve[0],"optionalAccess",Ve=>Ve.isFrozen,"call",Ve=>Ve()])&&Ie.type!==Ce.FullSnapshot&&!(Ie.type===Ce.IncrementalSnapshot&&Ie.data.source===Re.Mutation)&&bi.forEach(Ve=>Ve.unfreeze()),ye)Tc([t,"optionalCall",Ve=>Ve(kt(Ie),Qt)]);else if(be){const Ve={type:"rrweb",event:kt(Ie),origin:window.location.origin,isCheckout:Qt};window.parent.postMessage(Ve,"*")}if(Ie.type===Ce.FullSnapshot)ke=Ie,Zt=0;else if(Ie.type===Ce.IncrementalSnapshot){if(Ie.data.source===Re.Mutation&&Ie.data.isAttachIframe)return;Zt++;const Ve=r&&Zt>=r,Oe=n&&ke&&Ie.timestamp-ke.timestamp>n;(Ve||Oe)&&te(!0)}};const Ke=Ne=>{Et({type:Ce.IncrementalSnapshot,data:{source:Re.Mutation,...Ne}})},ut=Ne=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.Scroll,...Ne}}),Gt=Ne=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.CanvasMutation,...Ne}}),Or=Ne=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.AdoptedStyleSheet,...Ne}}),ln=new vU({mutationCb:Ke,adoptedStyleSheetCb:Or}),vn=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new gU:new LU({mirror:cr,mutationCb:Ke,stylesheetManager:ln,recordCrossOriginIframes:x,wrappedEmit:Et});for(const Ne of k||[])Ne.getMirror&&Ne.getMirror({nodeMirror:cr,crossOriginIframeMirror:vn.crossOriginIframeMirror,crossOriginIframeStyleMirror:vn.crossOriginIframeStyleMirror});const Aa=new MU,hs=DU(pe,{mirror:cr,win:window,mutationCb:Ne=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.CanvasMutation,...Ne}}),recordCanvas:v,blockClass:a,blockSelector:s,unblockSelector:i,maxCanvasSize:O,sampling:N.canvas,dataURLOptions:g,errorHandler:q}),Hr=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new yU:new bU({mutationCb:Ke,scrollCb:ut,bypassOptions:{onMutation:le,blockClass:a,blockSelector:s,unblockSelector:i,maskAllText:u,maskTextClass:c,unmaskTextClass:E,maskTextSelector:f,unmaskTextSelector:S,inlineStylesheet:_,maskInputOptions:Xe,dataURLOptions:g,maskAttributeFn:p,maskTextFn:h,maskInputFn:m,recordCanvas:v,inlineImages:H,sampling:N,slimDOMOptions:Qe,iframeManager:vn,stylesheetManager:ln,canvasManager:hs,keepIframeSrcFn:U,processedNodeManager:Aa},mirror:cr}),te=(Ne=!1)=>{if(!R)return;Et({type:Ce.Meta,data:{href:window.location.href,width:T0(),height:f0()}},Ne),ln.reset(),Hr.init(),bi.forEach(Ie=>Ie.lock());const Qt=$7(document,{mirror:cr,blockClass:a,blockSelector:s,unblockSelector:i,maskAllText:u,maskTextClass:c,unmaskTextClass:E,maskTextSelector:f,unmaskTextSelector:S,inlineStylesheet:_,maskAllInputs:Xe,maskAttributeFn:p,maskInputFn:m,maskTextFn:h,slimDOM:Qe,dataURLOptions:g,recordCanvas:v,inlineImages:H,onSerialize:Ie=>{S0(Ie,cr)&&vn.addIframe(Ie),R0(Ie,cr)&&ln.trackLinkElement(Ie),TT(Ie)&&Hr.addShadowRoot(Ie.shadowRoot,document)},onIframeLoad:(Ie,Ve)=>{vn.attachIframe(Ie,Ve),Ie.contentWindow&&hs.addWindow(Ie.contentWindow),Hr.observeAttachShadow(Ie)},onStylesheetLoad:(Ie,Ve)=>{ln.attachLinkElement(Ie,Ve)},keepIframeSrcFn:U});if(!Qt)return console.warn("Failed to snapshot the document");Et({type:Ce.FullSnapshot,data:{node:Qt,initialOffset:p0(window)}}),bi.forEach(Ie=>Ie.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ln.adoptStyleSheets(document.adoptedStyleSheets,cr.getId(document))};dE=te;try{const Ne=[],Qt=Ve=>xe(CU)({onMutation:le,mutationCb:Ke,mousemoveCb:(Oe,Mn)=>Et({type:Ce.IncrementalSnapshot,data:{source:Mn,positions:Oe}}),mouseInteractionCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.MouseInteraction,...Oe}}),scrollCb:ut,viewportResizeCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.ViewportResize,...Oe}}),inputCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.Input,...Oe}}),mediaInteractionCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.MediaInteraction,...Oe}}),styleSheetRuleCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.StyleSheetRule,...Oe}}),styleDeclarationCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.StyleDeclaration,...Oe}}),canvasMutationCb:Gt,fontCb:Oe=>Et({type:Ce.IncrementalSnapshot,data:{source:Re.Font,...Oe}}),selectionCb:Oe=>{Et({type:Ce.IncrementalSnapshot,data:{source:Re.Selection,...Oe}})},customElementCb:Oe=>{Et({type:Ce.IncrementalSnapshot,data:{source:Re.CustomElement,...Oe}})},blockClass:a,ignoreClass:o,ignoreSelector:l,maskAllText:u,maskTextClass:c,unmaskTextClass:E,maskTextSelector:f,unmaskTextSelector:S,maskInputOptions:Xe,inlineStylesheet:_,sampling:N,recordDOM:R,recordCanvas:v,inlineImages:H,userTriggeredOnInput:B,collectFonts:W,doc:Ve,maskAttributeFn:p,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:U,blockSelector:s,unblockSelector:i,slimDOMOptions:Qe,dataURLOptions:g,mirror:cr,iframeManager:vn,stylesheetManager:ln,shadowDomManager:Hr,processedNodeManager:Aa,canvasManager:hs,ignoreCSSAttributes:z,plugins:Tc([k,"optionalAccess",Oe=>Oe.filter,"call",Oe=>Oe(Mn=>Mn.observer),"optionalAccess",Oe=>Oe.map,"call",Oe=>Oe(Mn=>({observer:Mn.observer,options:Mn.options,callback:It=>Et({type:Ce.Plugin,data:{plugin:Mn.name,payload:It}})}))])||[]},{});vn.addLoadListener(Ve=>{try{Ne.push(Qt(Ve.contentDocument))}catch(Oe){console.warn(Oe)}});const Ie=()=>{te(),Ne.push(Qt(document))};return document.readyState==="interactive"||document.readyState==="complete"?Ie():(Ne.push(dn("DOMContentLoaded",()=>{Et({type:Ce.DomContentLoaded,data:{}}),F==="DOMContentLoaded"&&Ie()})),Ne.push(dn("load",()=>{Et({type:Ce.Load,data:{}}),F==="load"&&Ie()},window))),()=>{Ne.forEach(Ve=>Ve()),Aa.destroy(),dE=void 0,pU()}}catch(Ne){console.warn(Ne)}}function PU(e){if(!dE)throw new Error("please take full snapshot after start recording");dE(e)}na.mirror=cr;na.takeFullSnapshot=PU;function DU(e,t){try{return e?e(t):new l_}catch{return console.warn("Unable to initialize CanvasManager"),new l_}}const xU=3,wU=5;function uA(e){return e>9999999999?e:e*1e3}function Np(e){return e>9999999999?e/1e3:e}function nu(e,t){t.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>(e.throttledAddEvent({type:Ce.Custom,timestamp:(t.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:pr(t,10,1e3)}}),t.category==="console")))}const UU="button,a";function g0(e){return e.closest(UU)||e}function L0(e){const t=y0(e);return!t||!(t instanceof Element)?t:g0(t)}function y0(e){return kU(e)?e.target:e}function kU(e){return typeof e=="object"&&!!e&&"target"in e}let ba;function GU(e){return ba||(ba=[],FU()),ba.push(e),()=>{const t=ba?ba.indexOf(e):-1;t>-1&&ba.splice(t,1)}}function FU(){Cn(qe,"open",function(e){return function(...t){if(ba)try{ba.forEach(n=>n())}catch{}return e.apply(qe,t)}})}const BU=new Set([Re.Mutation,Re.StyleSheetRule,Re.StyleDeclaration,Re.AdoptedStyleSheet,Re.CanvasMutation,Re.Selection,Re.MediaInteraction]);function HU(e,t,n){e.handleClick(t,n)}class YU{constructor(t,n,r=nu){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=GU(()=>{this._lastMutation=u_()});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(WU(n,this._ignoreSelector)||!jU(t))return;const r={timestamp:Np(t.timestamp),clickBreadcrumb:t,clickCount:0,node:n};this._clicks.some(a=>a.node===r.node&&Math.abs(a.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(t=Date.now()){this._lastMutation=Np(t)}registerScroll(t=Date.now()){this._lastScroll=Np(t)}registerClick(t){const n=g0(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=u_();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 a=this._clicks.indexOf(r);a>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(a,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(t){const n=this._replay,r=t.scrollAfter&&t.scrollAfter<=this._scrollTimeout,a=t.mutationAfter&&t.mutationAfter<=this._threshold,s=!r&&!a,{clickCount:i,clickBreadcrumb:o}=t;if(s){const l=Math.min(t.mutationAfter||this._timeout,this._timeout)*1e3,u=l<this._timeout*1e3?"mutation":"timeout",c={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.slowClickDetected",data:{...o.data,url:qe.location.href,route:n.getCurrentRoute(),timeAfterClickMs:l,endReason:u,clickCount:i||1}};this._addBreadcrumbEvent(n,c);return}if(i>1){const l={type:"default",message:o.message,timestamp:o.timestamp,category:"ui.multiClick",data:{...o.data,url:qe.location.href,route:n.getCurrentRoute(),clickCount:i,metric:!0}};this._addBreadcrumbEvent(n,l)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=to(()=>this._checkClicks(),1e3)}}const VU=["A","BUTTON","INPUT"];function WU(e,t){return!!(!VU.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 jU(e){return!!(e.data&&typeof e.data.nodeId=="number"&&e.timestamp)}function u_(){return Date.now()/1e3}function XU(e,t){try{if(!KU(t))return;const{source:n}=t.data;if(BU.has(n)&&e.registerMutation(t.timestamp),n===Re.Scroll&&e.registerScroll(t.timestamp),zU(t)){const{type:r,id:a}=t.data,s=na.mirror.getNode(a);s instanceof HTMLElement&&r===un.Click&&e.registerClick(s)}}catch{}}function KU(e){return e.type===xU}function zU(e){return e.data.source===Re.MouseInteraction}function Ur(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var pE;(function(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"})(pE||(pE={}));const qU=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function JU(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(qU.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),t[r]=e[n]}return t}const ZU=e=>t=>{if(!e.isEnabled())return;const n=QU(t);if(!n)return;const r=t.name==="click",a=r?t.event:void 0;r&&e.clickDetector&&a&&a.target&&!a.altKey&&!a.metaKey&&!a.ctrlKey&&!a.shiftKey&&HU(e.clickDetector,n,L0(t.event)),nu(e,n)};function b0(e,t){const n=na.mirror.getId(e),r=n&&na.mirror.getNode(n),a=r&&na.mirror.getMeta(r),s=a&&e9(a)?a:null;return{message:t,data:s?{nodeId:n,node:{id:n,tagName:s.tagName,textContent:Array.from(s.childNodes).map(i=>i.type===pE.Text&&i.textContent).filter(Boolean).map(i=>i.trim()).join(""),attributes:JU(s.attributes)}}:{}}}function QU(e){const{target:t,message:n}=$U(e);return Ur({category:`ui.${e.name}`,...b0(t,n)})}function $U(e){const t=e.name==="click";let n,r=null;try{r=t?L0(e.event):y0(e.event),n=ca(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function e9(e){return e.type===pE.Element}function t9(e,t){if(!e.isEnabled())return;e.updateUserActivity();const n=n9(t);n&&nu(e,n)}function n9(e){const{metaKey:t,shiftKey:n,ctrlKey:r,altKey:a,key:s,target:i}=e;if(!i||r9(i)||!s)return null;const o=t||r||a,l=s.length===1;if(!o&&l)return null;const u=ca(i,{maxStringLength:200})||"<unknown>",c=b0(i,u);return Ur({category:"ui.keyDown",message:u,data:{...c.data,metaKey:t,shiftKey:n,ctrlKey:r,altKey:a,key:s}})}function r9(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable}const a9={resource:u9,paint:o9,navigation:l9};function ju(e,t){return({metric:n})=>void t.replayPerformanceEntries.push(e(n))}function s9(e){return e.map(i9).filter(Boolean)}function i9(e){const t=a9[e.entryType];return t?t(e):null}function ao(e){return((Tn||qe.performance.timeOrigin)+e)/1e3}function o9(e){const{duration:t,entryType:n,name:r,startTime:a}=e,s=ao(a);return{type:n,name:r,start:s,end:s+t,data:void 0}}function l9(e){const{entryType:t,name:n,decodedBodySize:r,duration:a,domComplete:s,encodedBodySize:i,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,domInteractive:u,loadEventStart:c,loadEventEnd:E,redirectCount:f,startTime:S,transferSize:_,type:C}=e;return a===0?null:{type:`${t}.${C}`,start:ao(S),end:ao(s),name:n,data:{size:_,decodedBodySize:r,encodedBodySize:i,duration:a,domInteractive:u,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,loadEventStart:c,loadEventEnd:E,domComplete:s,redirectCount:f}}}function u9(e){const{entryType:t,initiatorType:n,name:r,responseEnd:a,startTime:s,decodedBodySize:i,encodedBodySize:o,responseStatus:l,transferSize:u}=e;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${t}.${n}`,start:ao(s),end:ao(a),name:r,data:{size:u,statusCode:l,decodedBodySize:i,encodedBodySize:o}}}function c9(e){const t=e.entries[e.entries.length-1],n=t&&t.element?[t.element]:void 0;return sd(e,"largest-contentful-paint",n)}function E9(e){return e.sources!==void 0}function d9(e){const t=[],n=[];for(const r of e.entries)if(E9(r)){const a=[];for(const s of r.sources)if(s.node){n.push(s.node);const i=na.mirror.getId(s.node);i&&a.push(i)}t.push({value:r.value,nodeIds:a.length?a:void 0})}return sd(e,"cumulative-layout-shift",n,t)}function p9(e){const t=e.entries[e.entries.length-1],n=t&&t.target?[t.target]:void 0;return sd(e,"first-input-delay",n)}function f9(e){const t=e.entries[e.entries.length-1],n=t&&t.target?[t.target]:void 0;return sd(e,"interaction-to-next-paint",n)}function sd(e,t,n,r){const a=e.value,s=e.rating,i=ao(a);return{type:"web-vital",name:t,start:i,end:i,data:{value:a,size:a,rating:s,nodeIds:n?n.map(o=>na.mirror.getId(o)):void 0,attributions:r}}}function T9(e){function t(a){e.performanceEntries.includes(a)||e.performanceEntries.push(a)}function n({entries:a}){a.forEach(t)}const r=[];return["navigation","paint","resource"].forEach(a=>{r.push(eo(a,n))}),r.push(zg(ju(c9,e)),Zh(ju(d9,e)),qg(ju(p9,e)),Jg(ju(f9,e))),()=>{r.forEach(a=>a())}}const fe=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,h9='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]),a=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=function(t,e){for(var i=new n(31),a=0;a<31;++a)i[a]=e+=1<<t[a-1];var s=new r(i[30]);for(a=1;a<30;++a)for(var o=i[a];o<i[a+1];++o)s[o]=o-i[a]<<5|a;return{b:i,r:s}},o=s(e,2),f=o.b,h=o.r;f[28]=258,h[258]=28;for(var l=s(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>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,a=0,s=new n(r);a<i;++a)t[a]&&++s[t[a]-1];var o,f=new n(r);for(a=1;a<r;++a)f[a]=f[a-1]+s[a-1]<<1;if(e){o=new n(1<<r);var h=15-r;for(a=0;a<i;++a)if(t[a])for(var l=a<<4|t[a],c=r-t[a],v=f[t[a]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>h]=l}else for(o=new n(i),a=0;a<i;++a)t[a]&&(o[a]=u[f[t[a]-1]++]>>15-t[a]);return o},g=new t(288);for(c=0;c<144;++c)g[c]=8;for(c=144;c<256;++c)g[c]=9;for(c=256;c<280;++c)g[c]=7;for(c=280;c<288;++c)g[c]=8;var w=new t(32);for(c=0;c<32;++c)w[c]=5;var p=d(g,9,0),y=d(w,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=[],a=0;a<r.length;++a)r[a]&&i.push({s:a,f:r[a]});var s=i.length,o=i.slice();if(!s)return{t:F,l:0};if(1==s){var f=new t(i[0].s+1);return f[i[0].s]=1,{t:f,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var h=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:h.f+l.f,l:h,r:l};c!=s-1;)h=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:h.f+l.f,l:h,r:l};var d=o[0].s;for(a=1;a<s;++a)o[a].s>d&&(d=o[a].s);var g=new n(d+1),w=A(i[c-1],g,0);if(w>e){a=0;var p=0,y=w-e,m=1<<y;for(o.sort((function(t,n){return g[n.s]-g[t.s]||t.f-n.f}));a<s;++a){var b=o[a].s;if(!(g[b]>e))break;p+=m-(1<<w-g[b]),g[b]=e}for(p>>=y;p>0;){var M=o[a].s;g[M]<e?p-=1<<e-g[M]++-1:++a}for(;a>=0&&p;--a){var E=o[a].s;g[E]==e&&(--g[E],++p)}w=e}return{t:new t(g),l:w}},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,a=t[0],s=1,o=function(t){e[i++]=t},f=1;f<=r;++f)if(t[f]==a&&f!=r)++s;else{if(!a&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(a),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(a);s=1,a=t[f]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var a=0;a<e;++a)t[i+a+4]=r[a];return 8*(i+4+e)},U=function(t,r,s,o,f,h,l,u,c,v,m){z(r,m++,s),++f[256];for(var b=x(f,15),M=b.t,E=b.l,A=x(h,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[a[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(f,g)+T(h,w)+l,X=T(f,M)+T(h,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+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[a[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=p,P=g,Q=y,R=w;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(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;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,a=0|r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=e+=r[s];e=(65535&e)+15*(e>>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}}},O=function(a,s,o,f,u){if(!u&&(u={l:1},s.dictionary)){var c=s.dictionary.subarray(-32768),v=new t(c.length+a.length);v.set(c),v.set(a,c.length),a=v,u.w=c.length}return function(a,s,o,f,u,c){var v=c.z||a.length,d=new t(f+v+5*(1+Math.ceil(v/7e3))+u),g=d.subarray(f,d.length-u),w=c.l,p=7&(c.r||0);if(s){p&&(g[0]=c.r>>3);for(var y=C[s-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(a[t]^a[t+1]<<A^a[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!w)){p=U(a,g,0,F,I,S,O,q,G,j-G,p),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(a[j+Q]==a[j+Q-W]){for(var $=0;$<Z&&a[j+$]==a[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|h[Q]<<18|l[R];var it=31&h[Q],at=31&l[R];O+=e[it]+i[at],++I[257+it],++S[at],B=j+Q,++L}else F[q++]=a[j],++I[a[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=a[j],++I[a[j]];p=U(a,g,w,F,I,S,O,q,G,j-G,p),w||(c.r=7&p|g[p/8|0]<<3,p-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+w;j+=65535){var st=j+65535;st>=v&&(g[p/8|0]=w,st=v),p=k(g,p+1,a.subarray(j,st))}c.i=v}return b(d,0,f+m(p)+u)}(a,null==s.level?6:s.level,null==s.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(a.length)))):12+s.mem,o,f,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=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&&j(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)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=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(O(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 a=this.b.length-this.s.z;a&&(this.b.set(n.subarray(0,a),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(a),32768),this.s.z=n.length-a+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}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(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=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),a=0,s=function(t){i[a++]=t},o=0;o<e;++o){if(a+5>i.length){var f=new t(a+8+(e-o<<1));f.set(i),i=f}var h=n.charCodeAt(o);h<128||r?s(h):h<2048?(s(192|h>>6),s(128|63&h)):h>55295&&h<57344?(s(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++o))>>18),s(128|h>>12&63),s(128|h>>6&63),s(128|63&h)):(s(224|h>>12),s(128|h>>6&63),s(128|63&h))}return b(i,0,a)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),a=i.length;return q(i,n),j(i,a-8,r.d()),j(i,a-4,e),i}(P(t))}const R=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<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[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 A9(){const e=new Blob([h9]);return URL.createObjectURL(e)}const c_=["info","warn","error","log"],Sc="[Replay] ";function Op(e,t="info"){as({category:"console",data:{logger:"replay"},level:t,message:`${Sc}${e}`},{level:t})}function S9(){let e=!1,t=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{e=r.captureExceptions,t=r.traceInternals}};return fe?(c_.forEach(r=>{n[r]=(...a)=>{ne[r](Sc,...a),t&&Op(a.join(""),zC(r))}}),n.exception=(r,...a)=>{a.length&&n.error&&n.error(...a),ne.error(Sc,r),e?wC(r):t&&Op(r,"error")},n.infoTick=(...r)=>{ne.info(Sc,...r),t&&setTimeout(()=>Op(r[0]),0)}):c_.forEach(r=>{n[r]=()=>{}}),n}const Te=S9();class cA extends Error{constructor(){super(`Event buffer exceeded maximum size of ${rA}.`)}}class v0{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>rA)throw new cA;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?uA(t):null}}class R9{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():n()},{once:!0}),this._worker.addEventListener("error",r=>{n(r)},{once:!0})}),this._ensureReadyPromise)}destroy(){fe&&Te.info("Destroying compression worker"),this._worker.terminate()}postMessage(t,n){const r=this._getAndIncrementId();return new Promise((a,s)=>{const i=({data:o})=>{const l=o;if(l.method===t&&l.id===r){if(this._worker.removeEventListener("message",i),!l.success){fe&&Te.error("Error in compression worker: ",l.response),s(new Error("Error in compression worker"));return}a(l.response)}};this._worker.addEventListener("message",i),this._worker.postMessage({id:r,method:t,arg:n})})}_getAndIncrementId(){return this._id++}}class m9{constructor(t){this._worker=new R9(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=uA(t.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const r=JSON.stringify(t);return this._totalSize+=r.length,this._totalSize>rA?Promise.reject(new cA):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,t=>{fe&&Te.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 _9{constructor(t){this._fallback=new v0,this._compression=new m9(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){fe&&Te.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,a=[];for(const s of t)a.push(this._compression.addEvent(s));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(a),this._fallback.clear()}catch(s){fe&&Te.exception(s,"Failed to add events when switching buffers.")}}}function N9({useCompression:e,workerUrl:t}){if(e&&window.Worker){const n=O9(t);if(n)return n}return fe&&Te.info("Using simple buffer"),new v0}function O9(e){try{const t=e||I9();if(!t)return;fe&&Te.info(`Using compression worker${e?` from ${e}`:""}`);const n=new Worker(t);return new _9(n)}catch(t){fe&&Te.exception(t,"Failed to create compression worker")}}function I9(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?A9():""}function EA(){try{return"sessionStorage"in qe&&!!qe.sessionStorage}catch{return!1}}function C9(e){g9(),e.session=void 0}function g9(){if(EA())try{qe.sessionStorage.removeItem(tA)}catch{}}function M0(e){return e===void 0?!1:Math.random()<e}function P0(e){const t=Date.now(),n=e.id||Bn(),r=e.started||t,a=e.lastActivity||t,s=e.segmentId||0,i=e.sampled,o=e.previousSessionId;return{id:n,started:r,lastActivity:a,segmentId:s,sampled:i,previousSessionId:o}}function dA(e){if(EA())try{qe.sessionStorage.setItem(tA,JSON.stringify(e))}catch{}}function L9(e,t){return M0(e)?"session":t?"buffer":!1}function E_({sessionSampleRate:e,allowBuffering:t,stickySession:n=!1},{previousSessionId:r}={}){const a=L9(e,t),s=P0({sampled:a,previousSessionId:r});return n&&dA(s),s}function y9(){if(!EA())return null;try{const e=qe.sessionStorage.getItem(tA);if(!e)return null;const t=JSON.parse(e);return fe&&Te.infoTick("Loading existing session"),P0(t)}catch{return null}}function ST(e,t,n=+new Date){return e===null||t===void 0||t<0?!0:t===0?!1:e+t<=n}function D0(e,{maxReplayDuration:t,sessionIdleExpire:n,targetTime:r=Date.now()}){return ST(e.started,t,r)||ST(e.lastActivity,n,r)}function x0(e,{sessionIdleExpire:t,maxReplayDuration:n}){return!(!D0(e,{sessionIdleExpire:t,maxReplayDuration:n})||e.sampled==="buffer"&&e.segmentId===0)}function Ip({sessionIdleExpire:e,maxReplayDuration:t,previousSessionId:n},r){const a=r.stickySession&&y9();return a?x0(a,{sessionIdleExpire:e,maxReplayDuration:t})?(fe&&Te.infoTick("Session in sessionStorage is expired, creating new one..."),E_(r,{previousSessionId:a.id})):a:(fe&&Te.infoTick("Creating new session"),E_(r,{previousSessionId:n}))}function b9(e){return e.type===Ce.Custom}function pA(e,t,n){return U0(e,t)?(w0(e,t,n),!0):!1}function v9(e,t,n){return U0(e,t)?w0(e,t,n):Promise.resolve(null)}async function w0(e,t,n){const{eventBuffer:r}=e;if(!r||r.waitForCheckout&&!n)return null;const a=e.recordingMode==="buffer";try{n&&a&&r.clear(),n&&(r.hasCheckout=!0,r.waitForCheckout=!1);const s=e.getOptions(),i=M9(t,s.beforeAddRecordingEvent);return i?await r.addEvent(i):void 0}catch(s){const i=s&&s instanceof cA,o=i?"addEventSizeExceeded":"addEvent";if(i&&a)return r.clear(),r.waitForCheckout=!0,null;e.handleException(s),await e.stop({reason:o});const l=Me();l&&l.recordDroppedEvent("internal_sdk_error","replay")}}function U0(e,t){if(!e.eventBuffer||e.isPaused()||!e.isEnabled())return!1;const n=uA(t.timestamp);return n+e.timeouts.sessionIdlePause<Date.now()?!1:n>e.getContext().initialTimestamp+e.getOptions().maxReplayDuration?(fe&&Te.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function M9(e,t){try{if(typeof t=="function"&&b9(e))return t(e)}catch(n){return fe&&Te.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return e}function fA(e){return!e.type}function RT(e){return e.type==="transaction"}function P9(e){return e.type==="replay_event"}function d_(e){return e.type==="feedback"}function D9(e){return(t,n)=>{if(!e.isEnabled()||!fA(t)&&!RT(t))return;const r=n&&n.statusCode;if(!(!r||r<200||r>=300)){if(RT(t)){x9(e,t);return}w9(e,t)}}}function x9(e,t){const n=e.getContext();t.contexts&&t.contexts.trace&&t.contexts.trace.trace_id&&n.traceIds.size<100&&n.traceIds.add(t.contexts.trace.trace_id)}function w9(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)||to(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(a){e.handleException(a)}})}function U9(e){return t=>{!e.isEnabled()||!fA(t)||k9(e,t)}}function k9(e,t){const n=t.exception&&t.exception.values&&t.exception.values[0]&&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=Ur({category:"replay.hydrate-error",data:{url:sC()}});nu(e,r)}}function G9(e){const t=Me();t&&t.on("beforeAddBreadcrumb",n=>F9(e,n))}function F9(e,t){if(!e.isEnabled()||!k0(t))return;const n=B9(t);n&&nu(e,n)}function B9(e){return!k0(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:e.category==="console"?H9(e):Ur(e)}function H9(e){const t=e.data&&e.data.arguments;if(!Array.isArray(t)||t.length===0)return Ur(e);let n=!1;const r=t.map(a=>{if(!a)return a;if(typeof a=="string")return a.length>Yu?(n=!0,`${a.slice(0,Yu)}…`):a;if(typeof a=="object")try{const s=pr(a,7);return JSON.stringify(s).length>Yu?(n=!0,`${JSON.stringify(s,null,2).slice(0,Yu)}…`):s}catch{}return a});return Ur({...e,data:{...e.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function k0(e){return!!e.category}function Y9(e,t){return e.type||!e.exception||!e.exception.values||!e.exception.values.length?!1:!!(t.originalException&&t.originalException.__rrweb__)}function G0(){const e=Ze().getPropagationContext().dsc;e&&delete e.replay_id;const t=Ut();if(t){const n=$s(t);delete n.replay_id}}function V9(e,t){e.triggerUserActivity(),e.addUpdate(()=>t.timestamp?(e.throttledAddEvent({type:Ce.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 W9(e,t){return e.recordingMode!=="buffer"||t.message===nA||!t.exception||t.type?!1:M0(e.getOptions().errorSampleRate)}function j9(e){return Object.assign((t,n)=>!e.isEnabled()||e.isPaused()?t:P9(t)?(delete t.breadcrumbs,t):!fA(t)&&!RT(t)&&!d_(t)?t:e.checkAndHandleExpiredSession()?d_(t)?(e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),V9(e,t),t):Y9(t,n)&&!e.getOptions()._experiments.captureExceptions?(fe&&Te.log("Ignoring error from rrweb internals",t),null):((W9(e,t)||e.recordingMode==="session")&&(t.tags={...t.tags,replayId:e.getSessionId()}),t):(G0(),t),{id:"Replay"})}function id(e,t){return t.map(({type:n,start:r,end:a,name:s,data:i})=>{const o=e.throttledAddEvent({type:Ce.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:s,startTimestamp:r,endTimestamp:a,data:i}}});return typeof o=="string"?Promise.resolve(null):o})}function X9(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 K9(e){return t=>{if(!e.isEnabled())return;const n=X9(t);n!==null&&(e.getContext().urls.push(n.name),e.triggerUserActivity(),e.addUpdate(()=>(id(e,[n]),!1)))}}function z9(e,t){return fe&&e.getOptions()._experiments.traceInternals?!1:l3(t,Me())}function F0(e,t){e.isEnabled()&&t!==null&&(z9(e,t.name)||e.addUpdate(()=>(id(e,[t]),!0)))}function od(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=V0(e);return t.encode(n).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function B0(e){if(!e)return;const t=parseInt(e,10);return isNaN(t)?void 0:t}function H0(e){try{if(typeof e=="string")return[e];if(e instanceof URLSearchParams)return[e.toString()];if(e instanceof FormData)return[V0(e)];if(!e)return[void 0]}catch(t){return fe&&Te.exception(t,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return fe&&Te.info("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function fE(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 Y0(e,t){if(!t)return null;const{startTimestamp:n,endTimestamp:r,url:a,method:s,statusCode:i,request:o,response:l}=t;return{type:e,start:n/1e3,end:r/1e3,name:a,data:bt({method:s,statusCode:i,request:o,response:l})}}function wl(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function Ja(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:a,warnings:s}=q9(n);return r.body=a,s&&s.length>0&&(r._meta={warnings:s}),r}function mT(e,t){return Object.entries(e).reduce((n,[r,a])=>{const s=r.toLowerCase();return t.includes(s)&&e[r]&&(n[s]=a),n},{})}function V0(e){return new URLSearchParams(e).toString()}function q9(e){if(!e||typeof e!="string")return{body:e};const t=e.length>Xm,n=J9(e);if(t){const r=e.slice(0,Xm);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 J9(e){const t=e[0],n=e[e.length-1];return t==="["&&n==="]"||t==="{"&&n==="}"}function TE(e,t){const n=Z9(e);return Xa(n,t)}function Z9(e,t=qe.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(qe.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 Q9(e,t,n){try{const r=await ek(e,t,n),a=Y0("resource.fetch",r);F0(n.replay,a)}catch(r){fe&&Te.exception(r,"Failed to capture fetch breadcrumb")}}function $9(e,t){const{input:n,response:r}=t,a=n?W0(n):void 0,s=od(a),i=r?B0(r.headers.get("content-length")):void 0;s!==void 0&&(e.data.request_body_size=s),i!==void 0&&(e.data.response_body_size=i)}async function ek(e,t,n){const r=Date.now(),{startTimestamp:a=r,endTimestamp:s=r}=t,{url:i,method:o,status_code:l=0,request_body_size:u,response_body_size:c}=e.data,E=TE(i,n.networkDetailAllowUrls)&&!TE(i,n.networkDetailDenyUrls),f=E?tk(n,t.input,u):wl(u),S=await nk(E,n,t.response,c);return{startTimestamp:a,endTimestamp:s,url:i,method:o,statusCode:l,request:f,response:S}}function tk({networkCaptureBodies:e,networkRequestHeaders:t},n,r){const a=n?sk(n,t):{};if(!e)return Ja(a,r,void 0);const s=W0(n),[i,o]=H0(s),l=Ja(a,r,i);return o?fE(l,o):l}async function nk(e,{networkCaptureBodies:t,networkResponseHeaders:n},r,a){if(!e&&a!==void 0)return wl(a);const s=r?j0(r.headers,n):{};if(!r||!t&&a!==void 0)return Ja(s,a,void 0);const[i,o]=await ak(r),l=rk(i,{networkCaptureBodies:t,responseBodySize:a,captureDetails:e,headers:s});return o?fE(l,o):l}function rk(e,{networkCaptureBodies:t,responseBodySize:n,captureDetails:r,headers:a}){try{const s=e&&e.length&&n===void 0?od(e):n;return r?t?Ja(a,s,e):Ja(a,s,void 0):wl(s)}catch(s){return fe&&Te.exception(s,"Failed to serialize response body"),Ja(a,n,void 0)}}async function ak(e){const t=ik(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{return[await ok(t)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(fe&&Te.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(fe&&Te.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function W0(e=[]){if(!(e.length!==2||typeof e[1]!="object"))return e[1].body}function j0(e,t){const n={};return t.forEach(r=>{e.get(r)&&(n[r]=e.get(r))}),n}function sk(e,t){return e.length===1&&typeof e[0]!="string"?p_(e[0],t):e.length===2?p_(e[1],t):{}}function p_(e,t){if(!e)return{};const n=e.headers;return n?n instanceof Headers?j0(n,t):Array.isArray(n)?{}:mT(n,t):{}}function ik(e){try{return e.clone()}catch(t){fe&&Te.exception(t,"Failed to clone response body")}}function ok(e){return new Promise((t,n)=>{const r=to(()=>n(new Error("Timeout while trying to read response body")),500);lk(e).then(a=>t(a),a=>n(a)).finally(()=>clearTimeout(r))})}async function lk(e){return await e.text()}async function uk(e,t,n){try{const r=Ek(e,t,n),a=Y0("resource.xhr",r);F0(n.replay,a)}catch(r){fe&&Te.exception(r,"Failed to capture xhr breadcrumb")}}function ck(e,t){const{xhr:n,input:r}=t;if(!n)return;const a=od(r),s=n.getResponseHeader("content-length")?B0(n.getResponseHeader("content-length")):Tk(n.response,n.responseType);a!==void 0&&(e.data.request_body_size=a),s!==void 0&&(e.data.response_body_size=s)}function Ek(e,t,n){const r=Date.now(),{startTimestamp:a=r,endTimestamp:s=r,input:i,xhr:o}=t,{url:l,method:u,status_code:c=0,request_body_size:E,response_body_size:f}=e.data;if(!l)return null;if(!o||!TE(l,n.networkDetailAllowUrls)||TE(l,n.networkDetailDenyUrls)){const T=wl(E),N=wl(f);return{startTimestamp:a,endTimestamp:s,url:l,method:u,statusCode:c,request:T,response:N}}const S=o[gs],_=S?mT(S.request_headers,n.networkRequestHeaders):{},C=mT(dk(o),n.networkResponseHeaders),[I,d]=n.networkCaptureBodies?H0(i):[void 0],[p,m]=n.networkCaptureBodies?pk(o):[void 0],h=Ja(_,E,I),O=Ja(C,f,p);return{startTimestamp:a,endTimestamp:s,url:l,method:u,statusCode:c,request:d?fE(h,d):h,response:m?fE(O,m):O}}function dk(e){const t=e.getAllResponseHeaders();return t?t.split(`\r
131
131
  `).reduce((n,r)=>{const[a,s]=r.split(": ");return s&&(n[a.toLowerCase()]=s),n},{}):{}}function pk(e){const t=[];try{return[e.responseText]}catch(n){t.push(n)}try{return fk(e.response,e.responseType)}catch(n){t.push(n)}return fe&&Te.warn("Failed to get xhr response body",...t),[void 0]}function fk(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 fe&&Te.exception(n,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return fe&&Te.info("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Tk(e,t){try{const n=t==="json"&&e&&typeof e=="object"?JSON.stringify(e):e;return od(n)}catch{return}}function hk(e){const t=Me();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:a,networkRequestHeaders:s,networkResponseHeaders:i}=e.getOptions(),o={replay:e,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:a,networkRequestHeaders:s,networkResponseHeaders:i};t&&t.on("beforeAddBreadcrumb",(l,u)=>Ak(o,l,u))}catch{}}function Ak(e,t,n){if(t.data)try{Sk(t)&&mk(n)&&(ck(t,n),uk(t,n,e)),Rk(t)&&_k(n)&&($9(t,n),Q9(t,n,e))}catch(r){fe&&Te.exception(r,"Error when enriching network breadcrumb")}}function Sk(e){return e.category==="xhr"}function Rk(e){return e.category==="fetch"}function mk(e){return e&&e.xhr}function _k(e){return e&&e.response}function Nk(e){const t=Me();e0(ZU(e)),td(K9(e)),G9(e),hk(e);const n=j9(e);B5(n),t&&(t.on("beforeSendEvent",U9(e)),t.on("afterSendEvent",D9(e)),t.on("createDsc",r=>{const a=e.getSessionId();a&&e.isEnabled()&&e.recordingMode==="session"&&e.checkAndHandleExpiredSession()&&(r.replay_id=a)}),t.on("spanStart",r=>{e.lastActiveSpan=r}),t.on("spanEnd",r=>{e.lastActiveSpan=r}),t.on("beforeSendFeedback",(r,a)=>{const s=e.getSessionId();a&&a.includeReplay&&e.isEnabled()&&s&&r.contexts&&r.contexts.feedback&&(r.contexts.feedback.replay_id=s)}))}async function Ok(e){try{return Promise.all(id(e,[Ik(qe.performance.memory)]))}catch{return[]}}function Ik(e){const{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}=e,a=Date.now()/1e3;return{type:"memory",name:"memory",start:a,end:a,data:{memory:{jsHeapSizeLimit:t,totalJSHeapSize:n,usedJSHeapSize:r}}}}function Ck(e,t,n){let r,a,s;const i=n.maxWait?Math.max(n.maxWait,t):0;function o(){return l(),r=e(),r}function l(){a!==void 0&&clearTimeout(a),s!==void 0&&clearTimeout(s),a=s=void 0}function u(){return a!==void 0||s!==void 0?o():r}function c(){return a&&clearTimeout(a),a=to(o,t),i&&s===void 0&&(s=to(o,i)),r}return c.cancel=l,c.flush=u,c}const Rs=Le.navigator;function gk(){return/iPhone|iPad|iPod/i.test(Rs&&Rs.userAgent||"")||/Macintosh/i.test(Rs&&Rs.userAgent||"")&&Rs&&Rs.maxTouchPoints&&Rs.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function Lk(e){let t=!1;return(n,r)=>{if(!e.checkAndHandleExpiredSession()){fe&&Te.warn("Received replay event after session expired.");return}const a=r||!t;t=!0,e.clickDetector&&XU(e.clickDetector,n),e.addUpdate(()=>{if(e.recordingMode==="buffer"&&a&&e.setInitialState(),!pA(e,n,a))return!0;if(!a)return!1;const s=e.session;if(bk(e,a),e.recordingMode==="buffer"&&s&&e.eventBuffer){const i=e.eventBuffer.getEarliestTimestamp();i&&(fe&&Te.info(`Updating session start time to earliest event in buffer to ${new Date(i)}`),s.started=i,e.getOptions().stickySession&&dA(s))}return s&&s.previousSessionId||e.recordingMode==="session"&&e.flush(),!0})}}function yk(e){const t=e.getOptions();return{type:Ce.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 bk(e,t){!t||!e.session||e.session.segmentId!==0||pA(e,yk(e),!1)}function vk(e,t,n,r){return ei(bC(e,Fh(e),r,n),[[{type:"replay_event"},e],[{type:"replay_recording",length:typeof t=="string"?new TextEncoder().encode(t).length:t.length},t]])}function Mk({recordingData:e,headers:t}){let n;const r=`${JSON.stringify(t)}
132
- `;if(typeof e=="string")n=`${r}${e}`;else{const a=new TextEncoder().encode(r);n=new Uint8Array(a.length+e.length),n.set(a),n.set(e,a.length)}return n}async function Pk({client:e,scope:t,replayId:n,event:r}){const a=typeof e._integrations=="object"&&e._integrations!==null&&!Array.isArray(e._integrations)?Object.keys(e._integrations):void 0,s={event_id:n,integrations:a};e.emit("preprocessEvent",r,s);const i=await xC(e.getOptions(),r,s,t,e,Nr());if(!i)return null;i.platform=i.platform||"javascript";const o=e.getSdkMetadata(),{name:l,version:u}=o&&o.sdk||{};return i.sdk={...i.sdk,name:l||"sentry.javascript.unknown",version:u||"0.0.0"},i}async function Dk({recordingData:e,replayId:t,segmentId:n,eventContext:r,timestamp:a,session:s}){const i=Mk({recordingData:e,headers:{segment_id:n}}),{urls:o,errorIds:l,traceIds:u,initialTimestamp:c}=r,E=Me(),f=Ze(),S=E&&E.getTransport(),_=E&&E.getDsn();if(!E||!S||!_||!s.sampled)return Ea({});const C={type:E7,replay_start_timestamp:c/1e3,timestamp:a/1e3,error_ids:l,trace_ids:u,urls:o,replay_id:t,segment_id:n,replay_type:s.sampled},I=await Pk({scope:f,client:E,replayId:t,event:C});if(!I)return E.recordDroppedEvent("event_processor","replay",C),fe&&Te.info("An event processor returned `null`, will not send event."),Ea({});delete I.sdkProcessingMetadata;const d=vk(I,i,_,E.getOptions().tunnel);let p;try{p=await S.send(d)}catch(h){const O=new Error(nA);try{O.cause=h}catch{}throw O}if(typeof p.statusCode=="number"&&(p.statusCode<200||p.statusCode>=300))throw new X0(p.statusCode);const m=jC({},p);if(WC(m,"replay"))throw new TA(m);return p}class X0 extends Error{constructor(t){super(`Transport returned status code ${t}`)}}class TA extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}}async function K0(e,t={count:0,interval:A7}){const{recordingData:n,onError:r}=e;if(n.length)try{return await Dk(e),!0}catch(a){if(a instanceof X0||a instanceof TA)throw a;if(kC("Replays",{_retryCount:t.count}),r&&r(a),t.count>=S7){const s=new Error(`${nA} - max retries exceeded`);try{s.cause=a}catch{}throw s}return t.interval*=++t.count,new Promise((s,i)=>{to(async()=>{try{await K0(e,t),s(!0)}catch(o){i(o)}},t.interval)})}}const z0="__THROTTLED",xk="__SKIPPED";function wk(e,t,n){const r=new Map,a=o=>{const l=o-n;r.forEach((u,c)=>{c<l&&r.delete(c)})},s=()=>[...r.values()].reduce((o,l)=>o+l,0);let i=!1;return(...o)=>{const l=Math.floor(Date.now()/1e3);if(a(l),s()>=t){const c=i;return i=!0,c?xk:z0}i=!1;const u=r.get(l)||0;return r.set(l,u+1),e(...o)}}class va{constructor({options:t,recordingOptions:n}){va.prototype.__init.call(this),va.prototype.__init2.call(this),va.prototype.__init3.call(this),va.prototype.__init4.call(this),va.prototype.__init5.call(this),va.prototype.__init6.call(this),this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:d7,sessionIdleExpire:p7},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=Ck(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=wk((i,o)=>v9(this,i,o),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:a}=this.getOptions(),s=r?{threshold:Math.min(R7,r),timeout:r,scrollTimeout:m7,ignoreSelector:a?a.join(","):""}:void 0;if(s&&(this.clickDetector=new YU(this,s)),fe){const i=t._experiments;Te.setConfig({captureExceptions:!!i.captureExceptions,traceInternals:!!i.traceInternals})}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){fe&&Te.exception(t),this._options.onError&&this._options.onError(t)}initializeSampling(t){const{errorSampleRate:n,sessionSampleRate:r}=this._options,a=n<=0&&r<=0;if(this._requiresManualStart=a,!a){if(this._initializeSessionForSampling(t),!this.session){fe&&Te.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",fe&&Te.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){fe&&Te.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){fe&&Te.info("Buffering is in progress, call `flush()` to save the replay");return}fe&&Te.infoTick("Starting replay in session mode"),this._updateUserActivity();const t=Ip({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=t,this._initializeRecording()}startBuffering(){if(this._isEnabled){fe&&Te.info("Buffering is in progress, call `flush()` to save the replay");return}fe&&Te.infoTick("Starting replay in buffer mode");const t=Ip({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=na({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:h7}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:Lk(this),...gk(),onMutation:this._onMutationHandler,...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;try{fe&&Te.info(`Stopping Replay${n?` triggered by ${n}`:""}`),G0(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),this.eventBuffer&&this.eventBuffer.destroy(),this.eventBuffer=null,C9(this)}catch(r){this.handleException(r)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),fe&&Te.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),fe&&Te.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();fe&&Te.info("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!t||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(t){const n=t();this.recordingMode!=="buffer"&&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(){return this.session&&this.session.id}checkAndHandleExpiredSession(){if(this._lastActivity&&ST(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const t=`${qe.location.pathname}${qe.location.hash}${qe.location.search}`,n=`${qe.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===z0){const a=Ur({category:"replay.throttled"});this.addUpdate(()=>!pA(this,{type:wU,timestamp:a.timestamp||0,data:{tag:"breadcrumb",payload:a,metric:!0}}))}return r}getCurrentRoute(){const t=this.lastActiveSpan||Ut(),n=t&&zt(t),r=(n&&Ge(n).data||{})[hr];if(!(!n||!r||!["route","custom"].includes(r)))return Ge(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=N9({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=Ip({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 x0(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{qe.document.addEventListener("visibilitychange",this._handleVisibilityChange),qe.addEventListener("blur",this._handleWindowBlur),qe.addEventListener("focus",this._handleWindowFocus),qe.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(Nk(this),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=T9(this)}_removeListeners(){try{qe.document.removeEventListener("visibilitychange",this._handleVisibilityChange),qe.removeEventListener("blur",this._handleWindowBlur),qe.removeEventListener("focus",this._handleWindowFocus),qe.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}__init(){this._handleVisibilityChange=()=>{qe.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()}}__init2(){this._handleWindowBlur=()=>{const t=Ur({category:"ui.blur"});this._doChangeToBackgroundTasks(t)}}__init3(){this._handleWindowFocus=()=>{const t=Ur({category:"ui.focus"});this._doChangeToForegroundTasks(t)}}__init4(){this._handleKeyboardEvent=t=>{t9(this,t)}}_doChangeToBackgroundTasks(t){!this.session||D0(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(t&&this._createCustomBreadcrumb(t),this.conditionalFlush())}_doChangeToForegroundTasks(t){if(this.session){if(!this.checkAndHandleExpiredSession()){fe&&Te.info("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:Ce.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=s9(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(id(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&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const t={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),t}async _runFlush(){const t=this.getSessionId();if(!this.session||!this.eventBuffer||!t){fe&&Te.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!(!this.eventBuffer||!this.eventBuffer.hasEvents)&&(await Ok(this),!!this.eventBuffer&&t===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const r=this._popEventContext(),a=this.session.segmentId++;this._maybeSaveSession();const s=await this.eventBuffer.finish();await K0({replayId:t,recordingData:s,segmentId:a,eventContext:r,session:this.session,timestamp:n,onError:i=>this.handleException(i)})}catch(n){this.handleException(n),this.stop({reason:"sendReplay"});const r=Me();if(r){const a=n instanceof TA?"ratelimit_backoff":"send_error";r.recordDroppedEvent(a,"replay")}}}__init5(){this._flush=async({force:t=!1}={})=>{if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){fe&&Te.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,r=Date.now()-n;this._debouncedFlush.cancel();const a=r<this._options.minReplayDuration,s=r>this._options.maxReplayDuration+5e3;if(a||s){fe&&Te.info(`Session duration (${Math.floor(r/1e3)}s) is too ${a?"short":"long"}, not sending replay.`),a&&this._debouncedFlush();return}const i=this.eventBuffer;i&&this.session.segmentId===0&&!i.hasCheckout&&fe&&Te.info("Flushing initial segment without checkout.");const o=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(l){this.handleException(l)}finally{this._flushLock=void 0,o&&this._debouncedFlush()}}}_maybeSaveSession(){this.session&&this._options.stickySession&&dA(this.session)}__init6(){this._onMutationHandler=t=>{const n=t.length,r=this._options.mutationLimit,a=this._options.mutationBreadcrumbLimit,s=r&&n>r;if(n>a||s){const i=Ur({category:"replay.mutations",data:{count:n,limit:s}});this._createCustomBreadcrumb(i)}return s?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}}function Bo(e,t){return[...e,...t].join(",")}function Uk({mask:e,unmask:t,block:n,unblock:r,ignore:a}){const s=["base","iframe[srcdoc]:not([src])"],i=Bo(e,[".sentry-mask","[data-sentry-mask]"]),o=Bo(t,[]);return{maskTextSelector:i,unmaskTextSelector:o,blockSelector:Bo(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:Bo(r,[]),ignoreSelector:Bo(a,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function kk({el:e,key:t,maskAttributes:n,maskAllText:r,privacyOptions:a,value:s}){return!r||a.unmaskTextSelector&&e.matches(a.unmaskTextSelector)?s:n.includes(t)||t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"")?s.replace(/[\S]/g,"*"):s}const f_='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',Gk=["content-length","content-type","accept"];let T_=!1;const Fk=e=>new ld(e);class ld{static __initStatic(){this.id="Replay"}constructor({flushMinDelay:t=f7,flushMaxDelay:n=T7,minReplayDuration:r=_7,maxReplayDuration:a=Km,stickySession:s=!0,useCompression:i=!0,workerUrl:o,_experiments:l={},maskAllText:u=!0,maskAllInputs:c=!0,blockAllMedia:E=!0,mutationBreadcrumbLimit:f=750,mutationLimit:S=1e4,slowClickTimeout:_=7e3,slowClickIgnoreSelectors:C=[],networkDetailAllowUrls:I=[],networkDetailDenyUrls:d=[],networkCaptureBodies:p=!0,networkRequestHeaders:m=[],networkResponseHeaders:h=[],mask:O=[],maskAttributes:T=["title","placeholder"],unmask:N=[],block:g=[],unblock:D=[],ignore:R=[],maskFn:v,beforeAddRecordingEvent:x,beforeErrorSampling:F,onError:B}={}){this.name=ld.id;const W=Uk({mask:O,unmask:N,block:g,unblock:D,ignore:R});if(this._recordingOptions={maskAllInputs:c,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:v,maskInputFn:v,maskAttributeFn:(H,k,U)=>kk({maskAttributes:T,maskAllText:u,privacyOptions:W,key:H,value:k,el:U}),...W,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:H=>{try{H.__rrweb__=!0}catch{}}},this._initialOptions={flushMinDelay:t,flushMaxDelay:n,minReplayDuration:Math.min(r,N7),maxReplayDuration:Math.min(a,Km),stickySession:s,useCompression:i,workerUrl:o,blockAllMedia:E,maskAllInputs:c,maskAllText:u,mutationBreadcrumbLimit:f,mutationLimit:S,slowClickTimeout:_,slowClickIgnoreSelectors:C,networkDetailAllowUrls:I,networkDetailDenyUrls:d,networkCaptureBodies:p,networkRequestHeaders:h_(m),networkResponseHeaders:h_(h),beforeAddRecordingEvent:x,beforeErrorSampling:F,onError:B,_experiments:l},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${f_}`:f_),this._isInitialized&&zR())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return T_}set _isInitialized(t){T_=t}afterAllSetup(t){!zR()||this._replay||(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(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.getSessionId()}getRecordingMode(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.recordingMode}_initialize(t){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(t),this._replay.initializeSampling())}_setup(t){const n=Bk(this._initialOptions,t);this._replay=new va({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{const n=t.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}ld.__initStatic();function Bk(e,t){const n=t.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...bt(e)},a=eE(n.replaysSessionSampleRate),s=eE(n.replaysOnErrorSampleRate);return a==null&&s==null&&ds(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),a!=null&&(r.sessionSampleRate=a),s!=null&&(r.errorSampleRate=s),r}function h_(e){return[...Gk,...e.map(t=>t.toLowerCase())]}const A_=new WeakMap,Cp=new Map,Rc={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function Hk(e,t){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:a,shouldCreateSpanForRequest:s,enableHTTPTimings:i,tracePropagationTargets:o}={traceFetch:Rc.traceFetch,traceXHR:Rc.traceXHR,trackFetchStreamPerformance:Rc.trackFetchStreamPerformance,...t},l=typeof s=="function"?s:E=>!0,u=E=>jk(E,o),c={};n&&(e.addEventProcessor(E=>(E.type==="transaction"&&E.spans&&E.spans.forEach(f=>{if(f.op==="http.client"){const S=Cp.get(f.span_id);S&&(f.timestamp=S/1e3,Cp.delete(f.span_id))}}),E)),a&&K3(E=>{if(E.response){const f=A_.get(E.response);f&&E.endTimestamp&&Cp.set(f,E.endTimestamp)}}),$C(E=>{const f=B3(E,l,u,c);if(E.response&&E.fetchData.__span&&A_.set(E.response,E.fetchData.__span),f){const S=q0(E.fetchData.url),_=S?xs(S).host:void 0;f.setAttributes({"http.url":S,"server.address":_})}i&&f&&S_(f)})),r&&t0(E=>{const f=Xk(E,l,u,c);i&&f&&S_(f)})}function Yk(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function S_(e){const{url:t}=Ge(e).data||{};if(!t||typeof t!="string")return;const n=eo("resource",({entries:r})=>{r.forEach(a=>{Yk(a)&&a.name.endsWith(t)&&(Wk(a).forEach(s=>e.setAttribute(...s)),setTimeout(n))})})}function Vk(e){let t="unknown",n="unknown",r="";for(const a of e){if(a==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(a))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=a}return r===e&&(t=r),{name:t,version:n}}function br(e=0){return((Tn||performance.timeOrigin)+e)/1e3}function Wk(e){const{name:t,version:n}=Vk(e.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",t]),Tn?[...r,["http.request.redirect_start",br(e.redirectStart)],["http.request.fetch_start",br(e.fetchStart)],["http.request.domain_lookup_start",br(e.domainLookupStart)],["http.request.domain_lookup_end",br(e.domainLookupEnd)],["http.request.connect_start",br(e.connectStart)],["http.request.secure_connection_start",br(e.secureConnectionStart)],["http.request.connection_end",br(e.connectEnd)],["http.request.request_start",br(e.requestStart)],["http.request.response_start",br(e.responseStart)],["http.request.response_end",br(e.responseEnd)]]:r}function jk(e,t){const n=he.location&&he.location.href;if(n){let r,a;try{r=new URL(e,n),a=new URL(n).origin}catch{return!1}const s=r.origin===a;return t?Xa(r.toString(),t)||s&&Xa(r.pathname,t):s}else{const r=!!e.match(/^\/(?!\/)/);return t?Xa(e,t):r}}function Xk(e,t,n,r){const a=e.xhr,s=a&&a[gs];if(!a||a.__sentry_own_request__||!s)return;const i=rs()&&t(s.url);if(e.endTimestamp&&i){const E=a.__sentry_xhr_span_id__;if(!E)return;const f=r[E];f&&s.status_code!==void 0&&(pC(f,s.status_code),f.end(),delete r[E]);return}const o=q0(s.url),l=o?xs(o).host:void 0,u=!!Ut(),c=i&&u?ql({name:`${s.method} ${s.url}`,attributes:{type:"xhr","http.method":s.method,"http.url":o,url:s.url,"server.address":l,[vt]:"auto.http.browser",[ns]:"http.client"}}):new fo;return a.__sentry_xhr_span_id__=c.spanContext().spanId,r[a.__sentry_xhr_span_id__]=c,n(s.url)&&Kk(a,rs()&&u?c:void 0),c}function Kk(e,t){const{"sentry-trace":n,baggage:r}=KC({span:t});n&&zk(e,n,r)}function zk(e,t,n){try{e.setRequestHeader("sentry-trace",t),n&&e.setRequestHeader("baggage",n)}catch{}}function q0(e){try{return new URL(e,he.location.origin).href}catch{return}}function qk(){he&&he.document?he.document.addEventListener("visibilitychange",()=>{const e=Ut();if(!e)return;const t=zt(e);if(he.document.hidden&&t){const n="cancelled",{op:r,status:a}=Ge(t);_r&&ne.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),a||t.setStatus({code:Dt,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):_r&&ne.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const Jk="BrowserTracing",Zk={...fc,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...Rc},Qk=(e={})=>{Yv();const{enableInp:t,enableLongTask:n,enableLongAnimationFrame:r,_experiments:{enableInteractions:a,enableStandaloneClsSpans:s},beforeStartSpan:i,idleTimeout:o,finalTimeout:l,childSpanTimeout:u,markBackgroundSpan:c,traceFetch:E,traceXHR:f,trackFetchStreamPerformance:S,shouldCreateSpanForRequest:_,enableHTTPTimings:C,instrumentPageLoad:I,instrumentNavigation:d}={...Zk,...e},p=Hx({recordClsStandaloneSpans:s||!1});t&&dw(),r&&Le.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?Vx():n&&Yx(),a&&Wx();const m={name:void 0,source:void 0};function h(O,T){const N=T.op==="pageload",g=i?i(T):T,D=g.attributes||{};T.name!==g.name&&(D[hr]="custom",g.attributes=D),m.name=g.name,m.source=D[hr];const R=DC(g,{idleTimeout:o,finalTimeout:l,childSpanTimeout:u,disableAutoFinish:N,beforeSpanEnd:x=>{p(),qx(x,{recordClsOnPageloadSpan:!s})}});function v(){["interactive","complete"].includes(he.document.readyState)&&O.emit("idleSpanEnableAutoFinish",R)}return N&&he.document&&(he.document.addEventListener("readystatechange",()=>{v()}),v()),R}return{name:Jk,afterAllSetup(O){let T,N=he.location&&he.location.href;function g(){T&&!Ge(T).timestamp&&(_r&&ne.log(`[Tracing] Finishing current active span with op: ${Ge(T).op}`),T.end())}O.on("startNavigationSpan",D=>{Me()===O&&(g(),T=h(O,{op:"navigation",...D}))}),O.on("startPageLoadSpan",(D,R={})=>{if(Me()!==O)return;g();const v=R.sentryTrace||R_("sentry-trace"),x=R.baggage||R_("baggage"),F=wv(v,x);Ze().setPropagationContext(F),T=h(O,{op:"pageload",...D})}),O.on("spanEnd",D=>{const R=Ge(D).op;if(D!==zt(D)||R!=="navigation"&&R!=="pageload")return;const v=Ze(),x=v.getPropagationContext();v.setPropagationContext({...x,sampled:x.sampled!==void 0?x.sampled:Qs(D),dsc:x.dsc||$s(D)})}),he.location&&(I&&hA(O,{name:he.location.pathname,startTime:Tn?Tn/1e3:void 0,attributes:{[hr]:"url",[vt]:"auto.pageload.browser"}}),d&&td(({to:D,from:R})=>{if(R===void 0&&N&&N.indexOf(D)!==-1){N=void 0;return}R!==D&&(N=void 0,$k(O,{name:he.location.pathname,attributes:{[hr]:"url",[vt]:"auto.navigation.browser"}}))})),c&&qk(),a&&eG(o,l,u,m),t&&fw(),Hk(O,{traceFetch:E,traceXHR:f,trackFetchStreamPerformance:S,tracePropagationTargets:O.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:_,enableHTTPTimings:C})}}};function hA(e,t,n){e.emit("startPageLoadSpan",t,n),Ze().setTransactionName(t.name);const r=Ut();return(r&&Ge(r).op)==="pageload"?r:void 0}function $k(e,t){Nr().setPropagationContext({traceId:es()}),Ze().setPropagationContext({traceId:es()}),e.emit("startNavigationSpan",t),Ze().setTransactionName(t.name);const n=Ut();return(n&&Ge(n).op)==="navigation"?n:void 0}function R_(e){const t=ov(`meta[name=${e}]`);return t?t.getAttribute("content"):void 0}function eG(e,t,n,r){let a;const s=()=>{const i="ui.action.click",o=Ut(),l=o&&zt(o);if(l){const u=Ge(l).op;if(["navigation","pageload"].includes(u)){_r&&ne.warn(`[Tracing] Did not create ${i} span because a pageload or navigation span is in progress.`);return}}if(a&&(a.setAttribute(Xf,"interactionInterrupted"),a.end(),a=void 0),!r.name){_r&&ne.warn(`[Tracing] Did not create ${i} transaction because _latestRouteName is missing.`);return}a=DC({name:r.name,op:i,attributes:{[hr]:r.source||"url"}},{idleTimeout:e,finalTimeout:t,childSpanTimeout:n})};he.document&&addEventListener("click",s,{once:!1,capture:!0})}function so(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function tG(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=so(n);return a=>r.then(s=>a(s.transaction(t,"readwrite").objectStore(t)))}function AA(e){return so(e.getAllKeys())}function nG(e,t,n){return e(r=>AA(r).then(a=>{if(!(a.length>=n))return r.put(t,Math.max(...a,0)+1),so(r.transaction)}))}function rG(e,t,n){return e(r=>AA(r).then(a=>{if(!(a.length>=n))return r.put(t,Math.min(...a,0)-1),so(r.transaction)}))}function aG(e){return e(t=>AA(t).then(n=>{const r=n[0];if(r!=null)return so(t.get(r)).then(a=>(t.delete(r),so(t.transaction).then(()=>a)))}))}function sG(e){let t;function n(){return t==null&&(t=tG(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{push:async r=>{try{const a=await bl(r);await nG(n(),a,e.maxQueueSize||30)}catch{}},unshift:async r=>{try{const a=await bl(r);await rG(n(),a,e.maxQueueSize||30)}catch{}},shift:async()=>{try{const r=await aG(n());if(r)return i5(r)}catch{}}}}function iG(e){return t=>{const n=e({...t,createStore:sG});return he.addEventListener("online",async r=>{await n.flush()}),n}}function oG(e=eA){return iG(o3(e))}const lG="SpotlightBrowser",uG=(e={})=>{const t=e.sidecarUrl||"http://localhost:8969/stream";return{name:lG,setup:()=>{_r&&ne.log("Using Sidecar URL",t)},processEvent:n=>EG(n)?null:n,afterAllSetup:n=>{cG(n,t)}}};function cG(e,t){const n=$h("fetch");let r=0;e.on("beforeEnvelope",a=>{if(r>3){ne.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",r);return}n(t,{method:"POST",body:bl(a),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(s=>{s.status>=200&&s.status<400&&(r=0)},s=>{r++,ne.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",s)})})}const J0=uG;function EG(e){return!!(e.type==="transaction"&&e.spans&&e.contexts&&e.contexts.trace&&e.contexts.trace.op==="ui.action.click"&&e.spans.some(({description:t})=>t&&t.includes("#sentry-spotlight")))}const dG="application/x-sentry-envelope";function pG(e={}){return{name:"sentry",forwardedContentType:[dG],setup:({open:t,sidecarUrl:n})=>{e.retries==null&&(e.retries=10);let r;n&&(r=ZI(n,"/stream"),tt.setSidecarUrl(r)),Ye("Setting up Sentry integration for Spotlight"),Z0(e,r&&new URL("/stream",r).href),e.openLastError&&tt.subscribe("event",s=>{s.exception&&setTimeout(()=>t(`/errors/${s.event_id}`),0)});const a=s=>{Ye("Sentry Event",s.detail.event_id),s.detail.event&&tt.pushEvent(s.detail.event).then(()=>t(`/errors/${s.detail.event.event_id}`))};return N1("sentry:showError",a),()=>{O1("sentry:showError",a)}},processEvent:t=>TG(t),tabs:()=>{const t=tt.getEvents().filter(n=>{var r,a,s,i;return n.type!=="transaction"&&((a=(r=n.contexts)==null?void 0:r.trace)!=null&&a.trace_id?tt.isTraceLocal((i=(s=n.contexts)==null?void 0:s.trace)==null?void 0:i.trace_id):null)!==!1}).length;return[{id:"errors",title:"Errors",notificationCount:{count:t,severe:t>0},content:sM},{id:"explore",title:"Explore",content:T8},{id:"insights",title:"Insights",content:k8},{id:"performance",title:"Performance",content:H8}]},reset:()=>{tt.resetData()}}}function fG(e){let t=e.indexOf(10);return t===-1&&(t=e.length),t}function gp(e){return JSON.parse(new TextDecoder().decode(e))}function TG(e){let t=typeof e.data=="string"?Uint8Array.from(e.data,i=>i.charCodeAt(0)):e.data;function n(i){const o=i??fG(t),l=t.subarray(0,o);return t=t.subarray(o+1),l}const r=gp(n()),a=[];for(;t.length;){const i=gp(n()),o=i.length,l=n(o);let u;try{u=gp(l),i.type&&(u.type=i.type)}catch(c){u=l,Ye(c)}a.push([i,u])}const s=[r,a];return tt.pushEnvelope({envelope:s,rawEnvelope:e}),{event:s,rawEvent:e}}function Z0(e,t){if(e.injectIntoSDK===!1)return;const n=window.__SENTRY__,r=n&&hG(n);if(!r){Ye("Couldn't find a Sentry SDK client. Make sure you're using a Sentry SDK with version >=7.99.0 or 8.x"),e.retries&&(Ye(`Will retry ${e.retries} more time(s) at 100ms intervals...`),e.retries--,setTimeout(()=>{Z0(e,t)},500));return}if(!r.getDsn()){Ye("Sentry SDK doesn't have a valid DSN. Enabling SDK integrations for just Spotlight.");try{const a=r.getOptions().integrations;for(const s of a)r.addIntegration(s)}catch(a){sR("Failed to enable all SDK integrations for Spotlight",a),Ye("Please open an issue with the error at: https://github.com/getsentry/spotlight/issues/new/choose")}}r._dsn=void 0,r._options.tracesSampler=()=>1,r._options.sampleRate=1;try{const a=Object.keys(r._integrations).find(s=>/spotlight/i.test(s));if(a){Ye(`Skipping adding integration as there's already a Spotlight integration enabled in Sentry SDK: ${a}`);return}r.addIntegration(r4()),r.addIntegration(J0({sidecarUrl:t}))}catch(a){sR("Failed to add Spotlight integration to Sentry",a),Ye("Please open an issue with the error at: https://github.com/getsentry/spotlight/issues/new/choose")}Ye("Added Spotlight integration to Sentry SDK")}function hG(e){var t,n,r;if(e.version){const a=e[e.version],s=typeof((t=a==null?void 0:a.stack)==null?void 0:t.getScope)=="function"?(r=(n=a==null?void 0:a.stack)==null?void 0:n.getScope)==null?void 0:r.call(n):void 0;if(typeof(s==null?void 0:s.getClient)=="function")return s.getClient()}if(e.hub){const a=e.hub;if(typeof a.getClient=="function")return a.getClient()}}var _T={},m_=fb;_T.createRoot=m_.createRoot,_T.hydrateRoot=m_.hydrateRoot;function AG(e){const t={...e};return XC(t,"react"),kC("react",{version:b.version}),c7(t)}const SG=new WeakSet;function RG(e,t){const n=Qk({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:a,useNavigationType:s,createRoutesFromChildren:i,matchRoutes:o,stripBasename:l,instrumentPageLoad:u=!0,instrumentNavigation:c=!0}=e;return{...n,setup(){},afterAllSetup(E){n.afterAllSetup(E);const f=he&&he.location&&he.location.pathname;u&&f&&hA(E,{name:f,attributes:{[hr]:"url",[ns]:"pageload",[vt]:`auto.pageload.react.reactrouter_v${t}`}}),c&&SG.add(E)}}}function mG(e){return RG(e,"6")}function _G(e,t={}){const n={},r=performance.getEntriesByType("navigation");if(r.length>0){const l=r[0].serverTiming;if(l&&l.length>0)for(const{name:u,description:c}of l)(u==="sentryTrace"||u==="baggage")&&(n[u]=c)}const a=Object.keys(n).length===2,s=[mG({instrumentPageLoad:!a,useEffect:b.useEffect,useLocation:us,useNavigationType:Bb,createRoutesFromChildren:qc,matchRoutes:PI}),Fk()],i=document.location.hash.slice(1);if(i.startsWith("spotlight")){const l=i.indexOf("="),u=l>-1?decodeURIComponent(i.slice(l+1)):void 0;s.push(J0({sidecarUrl:u}))}const o=AG({transport:oG(eA),dsn:"https://51bcd92dba1128934afd1c5726c84442@o1.ingest.us.sentry.io/4508404727283713",environment:"production",release:"spotlight@2.11.0",integrations:s,tracesSampleRate:1,tracePropagationTargets:[/^\//,document.location.origin],replaysSessionSampleRate:.01,replaysOnErrorSampleRate:1,...t});a&&o&&hA(o,{name:e},n)}var Q0={exports:{}},Ho={},Xu={exports:{}},Lp={},yp={},__;function SA(){if(__)return yp;__=1;function e(r){this.__parent=r,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}e.prototype.clone_empty=function(){var r=new e(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},e.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},e.prototype.has_match=function(r){for(var a=this.__items.length-1;a>=0;a--)if(this.__items[a].match(r))return!0;return!1},e.prototype.set_indent=function(r,a){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=a||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},e.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return this.__items.length===0},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(r){this.__items.push(r);var a=r.lastIndexOf(`
132
+ `;if(typeof e=="string")n=`${r}${e}`;else{const a=new TextEncoder().encode(r);n=new Uint8Array(a.length+e.length),n.set(a),n.set(e,a.length)}return n}async function Pk({client:e,scope:t,replayId:n,event:r}){const a=typeof e._integrations=="object"&&e._integrations!==null&&!Array.isArray(e._integrations)?Object.keys(e._integrations):void 0,s={event_id:n,integrations:a};e.emit("preprocessEvent",r,s);const i=await xC(e.getOptions(),r,s,t,e,Nr());if(!i)return null;i.platform=i.platform||"javascript";const o=e.getSdkMetadata(),{name:l,version:u}=o&&o.sdk||{};return i.sdk={...i.sdk,name:l||"sentry.javascript.unknown",version:u||"0.0.0"},i}async function Dk({recordingData:e,replayId:t,segmentId:n,eventContext:r,timestamp:a,session:s}){const i=Mk({recordingData:e,headers:{segment_id:n}}),{urls:o,errorIds:l,traceIds:u,initialTimestamp:c}=r,E=Me(),f=Ze(),S=E&&E.getTransport(),_=E&&E.getDsn();if(!E||!S||!_||!s.sampled)return Ea({});const C={type:E7,replay_start_timestamp:c/1e3,timestamp:a/1e3,error_ids:l,trace_ids:u,urls:o,replay_id:t,segment_id:n,replay_type:s.sampled},I=await Pk({scope:f,client:E,replayId:t,event:C});if(!I)return E.recordDroppedEvent("event_processor","replay",C),fe&&Te.info("An event processor returned `null`, will not send event."),Ea({});delete I.sdkProcessingMetadata;const d=vk(I,i,_,E.getOptions().tunnel);let p;try{p=await S.send(d)}catch(h){const O=new Error(nA);try{O.cause=h}catch{}throw O}if(typeof p.statusCode=="number"&&(p.statusCode<200||p.statusCode>=300))throw new X0(p.statusCode);const m=jC({},p);if(WC(m,"replay"))throw new TA(m);return p}class X0 extends Error{constructor(t){super(`Transport returned status code ${t}`)}}class TA extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}}async function K0(e,t={count:0,interval:A7}){const{recordingData:n,onError:r}=e;if(n.length)try{return await Dk(e),!0}catch(a){if(a instanceof X0||a instanceof TA)throw a;if(kC("Replays",{_retryCount:t.count}),r&&r(a),t.count>=S7){const s=new Error(`${nA} - max retries exceeded`);try{s.cause=a}catch{}throw s}return t.interval*=++t.count,new Promise((s,i)=>{to(async()=>{try{await K0(e,t),s(!0)}catch(o){i(o)}},t.interval)})}}const z0="__THROTTLED",xk="__SKIPPED";function wk(e,t,n){const r=new Map,a=o=>{const l=o-n;r.forEach((u,c)=>{c<l&&r.delete(c)})},s=()=>[...r.values()].reduce((o,l)=>o+l,0);let i=!1;return(...o)=>{const l=Math.floor(Date.now()/1e3);if(a(l),s()>=t){const c=i;return i=!0,c?xk:z0}i=!1;const u=r.get(l)||0;return r.set(l,u+1),e(...o)}}class va{constructor({options:t,recordingOptions:n}){va.prototype.__init.call(this),va.prototype.__init2.call(this),va.prototype.__init3.call(this),va.prototype.__init4.call(this),va.prototype.__init5.call(this),va.prototype.__init6.call(this),this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:d7,sessionIdleExpire:p7},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=Ck(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=wk((i,o)=>v9(this,i,o),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:a}=this.getOptions(),s=r?{threshold:Math.min(R7,r),timeout:r,scrollTimeout:m7,ignoreSelector:a?a.join(","):""}:void 0;if(s&&(this.clickDetector=new YU(this,s)),fe){const i=t._experiments;Te.setConfig({captureExceptions:!!i.captureExceptions,traceInternals:!!i.traceInternals})}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){fe&&Te.exception(t),this._options.onError&&this._options.onError(t)}initializeSampling(t){const{errorSampleRate:n,sessionSampleRate:r}=this._options,a=n<=0&&r<=0;if(this._requiresManualStart=a,!a){if(this._initializeSessionForSampling(t),!this.session){fe&&Te.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",fe&&Te.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){fe&&Te.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){fe&&Te.info("Buffering is in progress, call `flush()` to save the replay");return}fe&&Te.infoTick("Starting replay in session mode"),this._updateUserActivity();const t=Ip({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=t,this._initializeRecording()}startBuffering(){if(this._isEnabled){fe&&Te.info("Buffering is in progress, call `flush()` to save the replay");return}fe&&Te.infoTick("Starting replay in buffer mode");const t=Ip({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=na({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:h7}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:Lk(this),...gk(),onMutation:this._onMutationHandler,...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;try{fe&&Te.info(`Stopping Replay${n?` triggered by ${n}`:""}`),G0(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),this.eventBuffer&&this.eventBuffer.destroy(),this.eventBuffer=null,C9(this)}catch(r){this.handleException(r)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),fe&&Te.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),fe&&Te.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();fe&&Te.info("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!t||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(t){const n=t();this.recordingMode!=="buffer"&&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(){return this.session&&this.session.id}checkAndHandleExpiredSession(){if(this._lastActivity&&ST(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const t=`${qe.location.pathname}${qe.location.hash}${qe.location.search}`,n=`${qe.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===z0){const a=Ur({category:"replay.throttled"});this.addUpdate(()=>!pA(this,{type:wU,timestamp:a.timestamp||0,data:{tag:"breadcrumb",payload:a,metric:!0}}))}return r}getCurrentRoute(){const t=this.lastActiveSpan||Ut(),n=t&&zt(t),r=(n&&Ge(n).data||{})[hr];if(!(!n||!r||!["route","custom"].includes(r)))return Ge(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=N9({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=Ip({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 x0(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{qe.document.addEventListener("visibilitychange",this._handleVisibilityChange),qe.addEventListener("blur",this._handleWindowBlur),qe.addEventListener("focus",this._handleWindowFocus),qe.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(Nk(this),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=T9(this)}_removeListeners(){try{qe.document.removeEventListener("visibilitychange",this._handleVisibilityChange),qe.removeEventListener("blur",this._handleWindowBlur),qe.removeEventListener("focus",this._handleWindowFocus),qe.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}__init(){this._handleVisibilityChange=()=>{qe.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()}}__init2(){this._handleWindowBlur=()=>{const t=Ur({category:"ui.blur"});this._doChangeToBackgroundTasks(t)}}__init3(){this._handleWindowFocus=()=>{const t=Ur({category:"ui.focus"});this._doChangeToForegroundTasks(t)}}__init4(){this._handleKeyboardEvent=t=>{t9(this,t)}}_doChangeToBackgroundTasks(t){!this.session||D0(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(t&&this._createCustomBreadcrumb(t),this.conditionalFlush())}_doChangeToForegroundTasks(t){if(this.session){if(!this.checkAndHandleExpiredSession()){fe&&Te.info("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:Ce.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=s9(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(id(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&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const t={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),t}async _runFlush(){const t=this.getSessionId();if(!this.session||!this.eventBuffer||!t){fe&&Te.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!(!this.eventBuffer||!this.eventBuffer.hasEvents)&&(await Ok(this),!!this.eventBuffer&&t===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const n=Date.now();if(n-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const r=this._popEventContext(),a=this.session.segmentId++;this._maybeSaveSession();const s=await this.eventBuffer.finish();await K0({replayId:t,recordingData:s,segmentId:a,eventContext:r,session:this.session,timestamp:n,onError:i=>this.handleException(i)})}catch(n){this.handleException(n),this.stop({reason:"sendReplay"});const r=Me();if(r){const a=n instanceof TA?"ratelimit_backoff":"send_error";r.recordDroppedEvent(a,"replay")}}}__init5(){this._flush=async({force:t=!1}={})=>{if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){fe&&Te.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,r=Date.now()-n;this._debouncedFlush.cancel();const a=r<this._options.minReplayDuration,s=r>this._options.maxReplayDuration+5e3;if(a||s){fe&&Te.info(`Session duration (${Math.floor(r/1e3)}s) is too ${a?"short":"long"}, not sending replay.`),a&&this._debouncedFlush();return}const i=this.eventBuffer;i&&this.session.segmentId===0&&!i.hasCheckout&&fe&&Te.info("Flushing initial segment without checkout.");const o=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(l){this.handleException(l)}finally{this._flushLock=void 0,o&&this._debouncedFlush()}}}_maybeSaveSession(){this.session&&this._options.stickySession&&dA(this.session)}__init6(){this._onMutationHandler=t=>{const n=t.length,r=this._options.mutationLimit,a=this._options.mutationBreadcrumbLimit,s=r&&n>r;if(n>a||s){const i=Ur({category:"replay.mutations",data:{count:n,limit:s}});this._createCustomBreadcrumb(i)}return s?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}}function Bo(e,t){return[...e,...t].join(",")}function Uk({mask:e,unmask:t,block:n,unblock:r,ignore:a}){const s=["base","iframe[srcdoc]:not([src])"],i=Bo(e,[".sentry-mask","[data-sentry-mask]"]),o=Bo(t,[]);return{maskTextSelector:i,unmaskTextSelector:o,blockSelector:Bo(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:Bo(r,[]),ignoreSelector:Bo(a,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function kk({el:e,key:t,maskAttributes:n,maskAllText:r,privacyOptions:a,value:s}){return!r||a.unmaskTextSelector&&e.matches(a.unmaskTextSelector)?s:n.includes(t)||t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"")?s.replace(/[\S]/g,"*"):s}const f_='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',Gk=["content-length","content-type","accept"];let T_=!1;const Fk=e=>new ld(e);class ld{static __initStatic(){this.id="Replay"}constructor({flushMinDelay:t=f7,flushMaxDelay:n=T7,minReplayDuration:r=_7,maxReplayDuration:a=Km,stickySession:s=!0,useCompression:i=!0,workerUrl:o,_experiments:l={},maskAllText:u=!0,maskAllInputs:c=!0,blockAllMedia:E=!0,mutationBreadcrumbLimit:f=750,mutationLimit:S=1e4,slowClickTimeout:_=7e3,slowClickIgnoreSelectors:C=[],networkDetailAllowUrls:I=[],networkDetailDenyUrls:d=[],networkCaptureBodies:p=!0,networkRequestHeaders:m=[],networkResponseHeaders:h=[],mask:O=[],maskAttributes:T=["title","placeholder"],unmask:N=[],block:g=[],unblock:D=[],ignore:R=[],maskFn:v,beforeAddRecordingEvent:x,beforeErrorSampling:F,onError:B}={}){this.name=ld.id;const W=Uk({mask:O,unmask:N,block:g,unblock:D,ignore:R});if(this._recordingOptions={maskAllInputs:c,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:v,maskInputFn:v,maskAttributeFn:(H,k,U)=>kk({maskAttributes:T,maskAllText:u,privacyOptions:W,key:H,value:k,el:U}),...W,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:H=>{try{H.__rrweb__=!0}catch{}}},this._initialOptions={flushMinDelay:t,flushMaxDelay:n,minReplayDuration:Math.min(r,N7),maxReplayDuration:Math.min(a,Km),stickySession:s,useCompression:i,workerUrl:o,blockAllMedia:E,maskAllInputs:c,maskAllText:u,mutationBreadcrumbLimit:f,mutationLimit:S,slowClickTimeout:_,slowClickIgnoreSelectors:C,networkDetailAllowUrls:I,networkDetailDenyUrls:d,networkCaptureBodies:p,networkRequestHeaders:h_(m),networkResponseHeaders:h_(h),beforeAddRecordingEvent:x,beforeErrorSampling:F,onError:B,_experiments:l},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${f_}`:f_),this._isInitialized&&zR())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return T_}set _isInitialized(t){T_=t}afterAllSetup(t){!zR()||this._replay||(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(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.getSessionId()}getRecordingMode(){if(!(!this._replay||!this._replay.isEnabled()))return this._replay.recordingMode}_initialize(t){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(t),this._replay.initializeSampling())}_setup(t){const n=Bk(this._initialOptions,t);this._replay=new va({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{const n=t.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}ld.__initStatic();function Bk(e,t){const n=t.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...bt(e)},a=eE(n.replaysSessionSampleRate),s=eE(n.replaysOnErrorSampleRate);return a==null&&s==null&&ds(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),a!=null&&(r.sessionSampleRate=a),s!=null&&(r.errorSampleRate=s),r}function h_(e){return[...Gk,...e.map(t=>t.toLowerCase())]}const A_=new WeakMap,Cp=new Map,Rc={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function Hk(e,t){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:a,shouldCreateSpanForRequest:s,enableHTTPTimings:i,tracePropagationTargets:o}={traceFetch:Rc.traceFetch,traceXHR:Rc.traceXHR,trackFetchStreamPerformance:Rc.trackFetchStreamPerformance,...t},l=typeof s=="function"?s:E=>!0,u=E=>jk(E,o),c={};n&&(e.addEventProcessor(E=>(E.type==="transaction"&&E.spans&&E.spans.forEach(f=>{if(f.op==="http.client"){const S=Cp.get(f.span_id);S&&(f.timestamp=S/1e3,Cp.delete(f.span_id))}}),E)),a&&K3(E=>{if(E.response){const f=A_.get(E.response);f&&E.endTimestamp&&Cp.set(f,E.endTimestamp)}}),$C(E=>{const f=B3(E,l,u,c);if(E.response&&E.fetchData.__span&&A_.set(E.response,E.fetchData.__span),f){const S=q0(E.fetchData.url),_=S?xs(S).host:void 0;f.setAttributes({"http.url":S,"server.address":_})}i&&f&&S_(f)})),r&&t0(E=>{const f=Xk(E,l,u,c);i&&f&&S_(f)})}function Yk(e){return e.entryType==="resource"&&"initiatorType"in e&&typeof e.nextHopProtocol=="string"&&(e.initiatorType==="fetch"||e.initiatorType==="xmlhttprequest")}function S_(e){const{url:t}=Ge(e).data||{};if(!t||typeof t!="string")return;const n=eo("resource",({entries:r})=>{r.forEach(a=>{Yk(a)&&a.name.endsWith(t)&&(Wk(a).forEach(s=>e.setAttribute(...s)),setTimeout(n))})})}function Vk(e){let t="unknown",n="unknown",r="";for(const a of e){if(a==="/"){[t,n]=e.split("/");break}if(!isNaN(Number(a))){t=r==="h"?"http":r,n=e.split(r)[1];break}r+=a}return r===e&&(t=r),{name:t,version:n}}function br(e=0){return((Tn||performance.timeOrigin)+e)/1e3}function Wk(e){const{name:t,version:n}=Vk(e.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",t]),Tn?[...r,["http.request.redirect_start",br(e.redirectStart)],["http.request.fetch_start",br(e.fetchStart)],["http.request.domain_lookup_start",br(e.domainLookupStart)],["http.request.domain_lookup_end",br(e.domainLookupEnd)],["http.request.connect_start",br(e.connectStart)],["http.request.secure_connection_start",br(e.secureConnectionStart)],["http.request.connection_end",br(e.connectEnd)],["http.request.request_start",br(e.requestStart)],["http.request.response_start",br(e.responseStart)],["http.request.response_end",br(e.responseEnd)]]:r}function jk(e,t){const n=he.location&&he.location.href;if(n){let r,a;try{r=new URL(e,n),a=new URL(n).origin}catch{return!1}const s=r.origin===a;return t?Xa(r.toString(),t)||s&&Xa(r.pathname,t):s}else{const r=!!e.match(/^\/(?!\/)/);return t?Xa(e,t):r}}function Xk(e,t,n,r){const a=e.xhr,s=a&&a[gs];if(!a||a.__sentry_own_request__||!s)return;const i=rs()&&t(s.url);if(e.endTimestamp&&i){const E=a.__sentry_xhr_span_id__;if(!E)return;const f=r[E];f&&s.status_code!==void 0&&(pC(f,s.status_code),f.end(),delete r[E]);return}const o=q0(s.url),l=o?xs(o).host:void 0,u=!!Ut(),c=i&&u?ql({name:`${s.method} ${s.url}`,attributes:{type:"xhr","http.method":s.method,"http.url":o,url:s.url,"server.address":l,[vt]:"auto.http.browser",[ns]:"http.client"}}):new fo;return a.__sentry_xhr_span_id__=c.spanContext().spanId,r[a.__sentry_xhr_span_id__]=c,n(s.url)&&Kk(a,rs()&&u?c:void 0),c}function Kk(e,t){const{"sentry-trace":n,baggage:r}=KC({span:t});n&&zk(e,n,r)}function zk(e,t,n){try{e.setRequestHeader("sentry-trace",t),n&&e.setRequestHeader("baggage",n)}catch{}}function q0(e){try{return new URL(e,he.location.origin).href}catch{return}}function qk(){he&&he.document?he.document.addEventListener("visibilitychange",()=>{const e=Ut();if(!e)return;const t=zt(e);if(he.document.hidden&&t){const n="cancelled",{op:r,status:a}=Ge(t);_r&&ne.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),a||t.setStatus({code:Dt,message:n}),t.setAttribute("sentry.cancellation_reason","document.hidden"),t.end()}}):_r&&ne.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const Jk="BrowserTracing",Zk={...fc,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...Rc},Qk=(e={})=>{Yv();const{enableInp:t,enableLongTask:n,enableLongAnimationFrame:r,_experiments:{enableInteractions:a,enableStandaloneClsSpans:s},beforeStartSpan:i,idleTimeout:o,finalTimeout:l,childSpanTimeout:u,markBackgroundSpan:c,traceFetch:E,traceXHR:f,trackFetchStreamPerformance:S,shouldCreateSpanForRequest:_,enableHTTPTimings:C,instrumentPageLoad:I,instrumentNavigation:d}={...Zk,...e},p=Hx({recordClsStandaloneSpans:s||!1});t&&dw(),r&&Le.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?Vx():n&&Yx(),a&&Wx();const m={name:void 0,source:void 0};function h(O,T){const N=T.op==="pageload",g=i?i(T):T,D=g.attributes||{};T.name!==g.name&&(D[hr]="custom",g.attributes=D),m.name=g.name,m.source=D[hr];const R=DC(g,{idleTimeout:o,finalTimeout:l,childSpanTimeout:u,disableAutoFinish:N,beforeSpanEnd:x=>{p(),qx(x,{recordClsOnPageloadSpan:!s})}});function v(){["interactive","complete"].includes(he.document.readyState)&&O.emit("idleSpanEnableAutoFinish",R)}return N&&he.document&&(he.document.addEventListener("readystatechange",()=>{v()}),v()),R}return{name:Jk,afterAllSetup(O){let T,N=he.location&&he.location.href;function g(){T&&!Ge(T).timestamp&&(_r&&ne.log(`[Tracing] Finishing current active span with op: ${Ge(T).op}`),T.end())}O.on("startNavigationSpan",D=>{Me()===O&&(g(),T=h(O,{op:"navigation",...D}))}),O.on("startPageLoadSpan",(D,R={})=>{if(Me()!==O)return;g();const v=R.sentryTrace||R_("sentry-trace"),x=R.baggage||R_("baggage"),F=wv(v,x);Ze().setPropagationContext(F),T=h(O,{op:"pageload",...D})}),O.on("spanEnd",D=>{const R=Ge(D).op;if(D!==zt(D)||R!=="navigation"&&R!=="pageload")return;const v=Ze(),x=v.getPropagationContext();v.setPropagationContext({...x,sampled:x.sampled!==void 0?x.sampled:Qs(D),dsc:x.dsc||$s(D)})}),he.location&&(I&&hA(O,{name:he.location.pathname,startTime:Tn?Tn/1e3:void 0,attributes:{[hr]:"url",[vt]:"auto.pageload.browser"}}),d&&td(({to:D,from:R})=>{if(R===void 0&&N&&N.indexOf(D)!==-1){N=void 0;return}R!==D&&(N=void 0,$k(O,{name:he.location.pathname,attributes:{[hr]:"url",[vt]:"auto.navigation.browser"}}))})),c&&qk(),a&&eG(o,l,u,m),t&&fw(),Hk(O,{traceFetch:E,traceXHR:f,trackFetchStreamPerformance:S,tracePropagationTargets:O.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:_,enableHTTPTimings:C})}}};function hA(e,t,n){e.emit("startPageLoadSpan",t,n),Ze().setTransactionName(t.name);const r=Ut();return(r&&Ge(r).op)==="pageload"?r:void 0}function $k(e,t){Nr().setPropagationContext({traceId:es()}),Ze().setPropagationContext({traceId:es()}),e.emit("startNavigationSpan",t),Ze().setTransactionName(t.name);const n=Ut();return(n&&Ge(n).op)==="navigation"?n:void 0}function R_(e){const t=ov(`meta[name=${e}]`);return t?t.getAttribute("content"):void 0}function eG(e,t,n,r){let a;const s=()=>{const i="ui.action.click",o=Ut(),l=o&&zt(o);if(l){const u=Ge(l).op;if(["navigation","pageload"].includes(u)){_r&&ne.warn(`[Tracing] Did not create ${i} span because a pageload or navigation span is in progress.`);return}}if(a&&(a.setAttribute(Xf,"interactionInterrupted"),a.end(),a=void 0),!r.name){_r&&ne.warn(`[Tracing] Did not create ${i} transaction because _latestRouteName is missing.`);return}a=DC({name:r.name,op:i,attributes:{[hr]:r.source||"url"}},{idleTimeout:e,finalTimeout:t,childSpanTimeout:n})};he.document&&addEventListener("click",s,{once:!1,capture:!0})}function so(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function tG(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=so(n);return a=>r.then(s=>a(s.transaction(t,"readwrite").objectStore(t)))}function AA(e){return so(e.getAllKeys())}function nG(e,t,n){return e(r=>AA(r).then(a=>{if(!(a.length>=n))return r.put(t,Math.max(...a,0)+1),so(r.transaction)}))}function rG(e,t,n){return e(r=>AA(r).then(a=>{if(!(a.length>=n))return r.put(t,Math.min(...a,0)-1),so(r.transaction)}))}function aG(e){return e(t=>AA(t).then(n=>{const r=n[0];if(r!=null)return so(t.get(r)).then(a=>(t.delete(r),so(t.transaction).then(()=>a)))}))}function sG(e){let t;function n(){return t==null&&(t=tG(e.dbName||"sentry-offline",e.storeName||"queue")),t}return{push:async r=>{try{const a=await bl(r);await nG(n(),a,e.maxQueueSize||30)}catch{}},unshift:async r=>{try{const a=await bl(r);await rG(n(),a,e.maxQueueSize||30)}catch{}},shift:async()=>{try{const r=await aG(n());if(r)return i5(r)}catch{}}}}function iG(e){return t=>{const n=e({...t,createStore:sG});return he.addEventListener("online",async r=>{await n.flush()}),n}}function oG(e=eA){return iG(o3(e))}const lG="SpotlightBrowser",uG=(e={})=>{const t=e.sidecarUrl||"http://localhost:8969/stream";return{name:lG,setup:()=>{_r&&ne.log("Using Sidecar URL",t)},processEvent:n=>EG(n)?null:n,afterAllSetup:n=>{cG(n,t)}}};function cG(e,t){const n=$h("fetch");let r=0;e.on("beforeEnvelope",a=>{if(r>3){ne.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",r);return}n(t,{method:"POST",body:bl(a),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(s=>{s.status>=200&&s.status<400&&(r=0)},s=>{r++,ne.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",s)})})}const J0=uG;function EG(e){return!!(e.type==="transaction"&&e.spans&&e.contexts&&e.contexts.trace&&e.contexts.trace.op==="ui.action.click"&&e.spans.some(({description:t})=>t&&t.includes("#sentry-spotlight")))}const dG="application/x-sentry-envelope";function pG(e={}){return{name:"sentry",forwardedContentType:[dG],setup:({open:t,sidecarUrl:n})=>{e.retries==null&&(e.retries=10);let r;n&&(r=ZI(n,"/stream"),tt.setSidecarUrl(r)),Ye("Setting up Sentry integration for Spotlight"),Z0(e,r&&new URL("/stream",r).href),e.openLastError&&tt.subscribe("event",s=>{s.exception&&setTimeout(()=>t(`/errors/${s.event_id}`),0)});const a=s=>{Ye("Sentry Event",s.detail.event_id),s.detail.event&&tt.pushEvent(s.detail.event).then(()=>t(`/errors/${s.detail.event.event_id}`))};return N1("sentry:showError",a),()=>{O1("sentry:showError",a)}},processEvent:t=>TG(t),tabs:()=>{const t=tt.getEvents().filter(n=>{var r,a,s,i;return n.type!=="transaction"&&((a=(r=n.contexts)==null?void 0:r.trace)!=null&&a.trace_id?tt.isTraceLocal((i=(s=n.contexts)==null?void 0:s.trace)==null?void 0:i.trace_id):null)!==!1}).length;return[{id:"errors",title:"Errors",notificationCount:{count:t,severe:t>0},content:sM},{id:"explore",title:"Explore",content:T8},{id:"insights",title:"Insights",content:k8},{id:"performance",title:"Performance",content:H8}]},reset:()=>{tt.resetData()}}}function fG(e){let t=e.indexOf(10);return t===-1&&(t=e.length),t}function gp(e){return JSON.parse(new TextDecoder().decode(e))}function TG(e){let t=typeof e.data=="string"?Uint8Array.from(e.data,i=>i.charCodeAt(0)):e.data;function n(i){const o=i??fG(t),l=t.subarray(0,o);return t=t.subarray(o+1),l}const r=gp(n()),a=[];for(;t.length;){const i=gp(n()),o=i.length,l=n(o);let u;try{u=gp(l),i.type&&(u.type=i.type)}catch(c){u=l,Ye(c)}a.push([i,u])}const s=[r,a];return tt.pushEnvelope({envelope:s,rawEnvelope:e}),{event:s,rawEvent:e}}function Z0(e,t){if(e.injectIntoSDK===!1)return;const n=window.__SENTRY__,r=n&&hG(n);if(!r){Ye("Couldn't find a Sentry SDK client. Make sure you're using a Sentry SDK with version >=7.99.0 or 8.x"),e.retries&&(Ye(`Will retry ${e.retries} more time(s) at 100ms intervals...`),e.retries--,setTimeout(()=>{Z0(e,t)},500));return}if(!r.getDsn()){Ye("Sentry SDK doesn't have a valid DSN. Enabling SDK integrations for just Spotlight.");try{const a=r.getOptions().integrations;for(const s of a)r.addIntegration(s)}catch(a){sR("Failed to enable all SDK integrations for Spotlight",a),Ye("Please open an issue with the error at: https://github.com/getsentry/spotlight/issues/new/choose")}}r._dsn=void 0,r._options.tracesSampler=()=>1,r._options.sampleRate=1;try{const a=Object.keys(r._integrations).find(s=>/spotlight/i.test(s));if(a){Ye(`Skipping adding integration as there's already a Spotlight integration enabled in Sentry SDK: ${a}`);return}r.addIntegration(r4()),r.addIntegration(J0({sidecarUrl:t}))}catch(a){sR("Failed to add Spotlight integration to Sentry",a),Ye("Please open an issue with the error at: https://github.com/getsentry/spotlight/issues/new/choose")}Ye("Added Spotlight integration to Sentry SDK")}function hG(e){var t,n,r;if(e.version){const a=e[e.version],s=typeof((t=a==null?void 0:a.stack)==null?void 0:t.getScope)=="function"?(r=(n=a==null?void 0:a.stack)==null?void 0:n.getScope)==null?void 0:r.call(n):void 0;if(typeof(s==null?void 0:s.getClient)=="function")return s.getClient()}if(e.hub){const a=e.hub;if(typeof a.getClient=="function")return a.getClient()}}var _T={},m_=fb;_T.createRoot=m_.createRoot,_T.hydrateRoot=m_.hydrateRoot;function AG(e){const t={...e};return XC(t,"react"),kC("react",{version:b.version}),c7(t)}const SG=new WeakSet;function RG(e,t){const n=Qk({...e,instrumentPageLoad:!1,instrumentNavigation:!1}),{useEffect:r,useLocation:a,useNavigationType:s,createRoutesFromChildren:i,matchRoutes:o,stripBasename:l,instrumentPageLoad:u=!0,instrumentNavigation:c=!0}=e;return{...n,setup(){},afterAllSetup(E){n.afterAllSetup(E);const f=he&&he.location&&he.location.pathname;u&&f&&hA(E,{name:f,attributes:{[hr]:"url",[ns]:"pageload",[vt]:`auto.pageload.react.reactrouter_v${t}`}}),c&&SG.add(E)}}}function mG(e){return RG(e,"6")}function _G(e,t={}){const n={},r=performance.getEntriesByType("navigation");if(r.length>0){const l=r[0].serverTiming;if(l&&l.length>0)for(const{name:u,description:c}of l)(u==="sentryTrace"||u==="baggage")&&(n[u]=c)}const a=Object.keys(n).length===2,s=[mG({instrumentPageLoad:!a,useEffect:b.useEffect,useLocation:us,useNavigationType:Bb,createRoutesFromChildren:qc,matchRoutes:PI}),Fk()],i=document.location.hash.slice(1);if(i.startsWith("spotlight")){const l=i.indexOf("="),u=l>-1?decodeURIComponent(i.slice(l+1)):void 0;s.push(J0({sidecarUrl:u}))}const o=AG({transport:oG(eA),dsn:"https://51bcd92dba1128934afd1c5726c84442@o1.ingest.us.sentry.io/4508404727283713",environment:"production",release:"spotlight@2.11.1",integrations:s,tracesSampleRate:1,tracePropagationTargets:[/^\//,document.location.origin],replaysSessionSampleRate:.01,replaysOnErrorSampleRate:1,...t});a&&o&&hA(o,{name:e},n)}var Q0={exports:{}},Ho={},Xu={exports:{}},Lp={},yp={},__;function SA(){if(__)return yp;__=1;function e(r){this.__parent=r,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}e.prototype.clone_empty=function(){var r=new e(this.__parent);return r.set_indent(this.__indent_count,this.__alignment_count),r},e.prototype.item=function(r){return r<0?this.__items[this.__items.length+r]:this.__items[r]},e.prototype.has_match=function(r){for(var a=this.__items.length-1;a>=0;a--)if(this.__items[a].match(r))return!0;return!1},e.prototype.set_indent=function(r,a){this.is_empty()&&(this.__indent_count=r||0,this.__alignment_count=a||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},e.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},e.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},e.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var r=this.__parent.current_line;return r.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),r.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),r.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,r.__items[0]===" "&&(r.__items.splice(0,1),r.__character_count-=1),!0}return!1},e.prototype.is_empty=function(){return this.__items.length===0},e.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},e.prototype.push=function(r){this.__items.push(r);var a=r.lastIndexOf(`
133
133
  `);a!==-1?this.__character_count=r.length-a:this.__character_count+=r.length},e.prototype.pop=function(){var r=null;return this.is_empty()||(r=this.__items.pop(),this.__character_count-=r.length),r},e.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},e.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},e.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},e.prototype.toString=function(){var r="";return this.is_empty()?this.__parent.indent_empty_lines&&(r=this.__parent.get_indent_string(this.__indent_count)):(r=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),r+=this.__items.join("")),r};function t(r,a){this.__cache=[""],this.__indent_size=r.indent_size,this.__indent_string=r.indent_char,r.indent_with_tabs||(this.__indent_string=new Array(r.indent_size+1).join(r.indent_char)),a=a||"",r.indent_level>0&&(a=new Array(r.indent_level+1).join(this.__indent_string)),this.__base_string=a,this.__base_string_length=a.length}t.prototype.get_indent_size=function(r,a){var s=this.__base_string_length;return a=a||0,r<0&&(s=0),s+=r*this.__indent_size,s+=a,s},t.prototype.get_indent_string=function(r,a){var s=this.__base_string;return a=a||0,r<0&&(r=0,s=""),a+=r*this.__indent_size,this.__ensure_cache(a),s+=this.__cache[a],s},t.prototype.__ensure_cache=function(r){for(;r>=this.__cache.length;)this.__add_column()},t.prototype.__add_column=function(){var r=this.__cache.length,a=0,s="";this.__indent_size&&r>=this.__indent_size&&(a=Math.floor(r/this.__indent_size),r-=a*this.__indent_size,s=new Array(a+1).join(this.__indent_string)),r&&(s+=new Array(r+1).join(" ")),this.__cache.push(s)};function n(r,a){this.__indent_cache=new t(r,a),this.raw=!1,this._end_with_newline=r.end_with_newline,this.indent_size=r.indent_size,this.wrap_line_length=r.wrap_line_length,this.indent_empty_lines=r.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new e(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}return n.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},n.prototype.get_line_number=function(){return this.__lines.length},n.prototype.get_indent_string=function(r,a){return this.__indent_cache.get_indent_string(r,a)},n.prototype.get_indent_size=function(r,a){return this.__indent_cache.get_indent_size(r,a)},n.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},n.prototype.add_new_line=function(r){return this.is_empty()||!r&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},n.prototype.get_code=function(r){this.trim(!0);var a=this.current_line.pop();a&&(a[a.length-1]===`
134
134
  `&&(a=a.replace(/\n+$/g,"")),this.current_line.push(a)),this._end_with_newline&&this.__add_outputline();var s=this.__lines.join(`
135
135
  `);return r!==`
@@ -42,5 +42,5 @@ Url: ${al(t)}`),!0)}function OY(t,e){return t.type||!e||!e.length?!1:CY(t).some(
42
42
  `))n.write(`data:${_}
43
43
  `)},l=t.subscribe(([p,_])=>{Ft.debug("\u{1F54A}\uFE0F sending to Spotlight"),n.write(`event:${p}${a}
44
44
  `),u(_),n.write(`
45
- `)});r.on("close",()=>{t.unsubscribe(l),n.end()})}else if(r.method==="POST"){Ft.debug("\u{1F4E9} Received event");let s=r,a=r.headers["content-encoding"];a==="gzip"?s=r.pipe((0,Df.createGunzip)()):a==="deflate"&&(s=r.pipe((0,Df.createInflate)()));let u=[];s.on("readable",()=>{let l;for(;(l=s.read())!==null;)u.push(l)}),s.on("end",()=>{var l,p;let _=Buffer.concat(u),f=(l=r.headers["content-type"])==null?void 0:l.split(";")[0].toLocaleLowerCase();if((p=i?.get("sentry_client"))!=null&&p.startsWith("sentry.javascript.browser")&&r.headers.origin&&(f="application/x-sentry-envelope"),f?t.put([f,_]):Ft.warn("No content type, skipping payload..."),process.env.SPOTLIGHT_CAPTURE||e){let E=new Date().getTime(),S=`${f?.replace(/[^a-z0-9]/gi,"_")||"no_content_type"}-${E}.txt`;e?e(_.toString("binary")):((0,ha.createWriteStream)(S).write(_),Ft.info(`\u{1F5C3}\uFE0F Saved data to ${S}`))}n.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive"}),n.end()})}else{kq(r,n);return}},vde=t=>function(e,r,n){let o=`${n||e.url}`;o==="/"&&(o="/src/index.html"),o=o.slice(1);let i=(0,mi.extname)(o),s="text/html";switch(i){case".js":s="text/javascript";break;case".css":s="text/css";break;case".json":s="application/json";break}Object.hasOwn(t,o)?(r.writeHead(200,{"Content-Type":s}),r.end(t[o])):Lf(e,r)};function Ide(t,e){e.writeHead(200,{"Content-Type":"text/plain",...Fq,...jq}),e.end("OK")}function Pde(t,e){t.method==="DELETE"?(e.writeHead(200,{"Content-Type":"text/plain"}),Mde(),e.end("Cleared")):kq(t,e)}function Cde(t=process.cwd()){return(e,r)=>{if(e.method!=="POST"){r.writeHead(405),r.end();return}let n="";e.on("data",o=>{n+=o}),e.on("end",()=>{let o=(0,mi.resolve)(t,n);Ft.debug(`Launching editor for ${o}`),(0,Gq.default)(o,(i,s)=>{Ft.error(`Failed to launch editor for ${i}: ${s}`)}),r.writeHead(204),r.end()})}}function qq(t){return Uf((e,r)=>{r.writeHead(t),r.end()},{name:`HTTP ${t}`,op:`sidecar.http.error.${t}`,attributes:{"http.response.status_code":t}})}var Lf=qq(404),kq=qq(405);function Nde(t,e,r,n,o){r&&!n&&(n={"/src/index.html":(0,ha.readFileSync)((0,mi.join)(r,"src/index.html")),"/assets/main.js":(0,ha.readFileSync)((0,mi.join)(r,"assets/main.js"))});let i=[[/^\/health$/,Ide],[/^\/clear$/,Su(Pde)],[/^\/stream$|^\/api\/\d+\/envelope\/?$/,Su(Ode(t,o))],[/^\/open$/,Su(Cde(r))],[RegExp(`^${pq}$`),Su(Tde)],[/^.+$/,n!=null?Su(vde(n)):Lf]],s=(0,xf.createServer)((l,p)=>{var _;let f=l.url;if(!f)return Lf(l,p);let E=l.headers.host||"localhost",{pathname:S,searchParams:T}=new URL(f,`http://${E}`),h=i.find(O=>O[0].test(S));return h?We({name:`HTTP ${l.method} ${S}`,op:`sidecar.http.${(_=l.method)==null?void 0:_.toLowerCase()}`,forceTransaction:!0,attributes:{"http.request.method":l.method,"http.request.url":f,"http.request.query":T.toString(),"server.address":E,"server.port":l.socket.localPort}},O=>{let I=Li();p.appendHeader("server-timing",[`sentryTrace;desc="${I["sentry-trace"]}"`,`baggage;desc="${I.baggage}"`,`sentrySpotlightPort;desc=${e}`].join(", "));let C=h[1](l,p,S,T);return O.setAttribute("http.response.status_code",p.statusCode),C}):Lf(l,p)});return s.on("error",a),s.listen(e,()=>{u(e,r)}),s;function a(l){"code"in l&&l.code==="EADDRINUSE"?(Ft.info(`Port ${e} in use, retrying...`),s.close(),xA=setTimeout(()=>{s.listen(e)},5e3)):$t(l)}function u(l,p){Ft.info(`Sidecar listening on ${l}`),p&&Ft.info(`You can open: http://localhost:${l} to see the Spotlight overlay directly`)}}var Ei,xA=null,Yq=new LA,yde=Uf(t=>{if(typeof t=="string"){let e=Number(t);return/^\d+$/.test(t)&&e>0&&e<=65535}return t>0&&t<=65535},{name:"isValidPort",op:"sidecar.server.portCheck"}),bde=Uf(t=>new Promise(e=>{Ft.info(`Checking if we are already running on port ${t}`);let r={hostname:"localhost",port:t,path:"/health",method:"GET",timeout:1e3,headers:{Connection:"close"}},n,o=(0,xf.get)(r,a=>{let u=a.headers["x-powered-by"];s(u==="spotlight-by-sentry")}),i=()=>!o.destroyed&&o.destroy(new Error("Request timed out."));function s(a){process.off("SIGINT",i),clearTimeout(n),e(a)}process.on("SIGINT",i),n=setTimeout(i,2e3),o.on("error",()=>{s(!1)}),o.end()}),{name:"isSidecarRunning",op:"sidecar.server.collideCheck"});function $q({port:t,logger:e,basePath:r,filesToServe:n,debug:o,incomingPayload:i}={}){let s=8969;e&&gde(e),(o||process.env.SPOTLIGHT_DEBUG)&&Ade(!0),t&&!yde(t)?(Ft.info("Please provide a valid port."),process.exit(1)):t&&(s=typeof t=="string"?Number(t):t),bde(s).then(a=>{a?Ft.info(`Sidecar is already running on port ${s}`):Ei||(Ei=Nde(Yq,s,r,n,i))})}function Mde(){Yq.clear()}var wq=!1,Wq=()=>{xA&&clearTimeout(xA),(wq||!Ei)&&(Ft.info("Bye."),process.exit(0)),Ei&&(wq=!0,Ft.info("Shutting down server gracefully..."),Ei.close(),Ei.closeAllConnections(),Ei.unref())};process.on("SIGINT",Wq);process.on("SIGTERM",Wq);var Kq=require("node:fs"),Xq=G(require("node:module"),1),UA=require("node:path"),zq=require("node:url"),Zq=require("node:zlib");c();cA({dsn:"https://51bcd92dba1128934afd1c5726c84442@o1.ingest.us.sentry.io/4508404727283713",environment:"development",release:"spotlight@2.10.2",debug:!!process.env.SENTRY_DEBUG,tracesSampleRate:1,beforeSendTransaction:t=>(t.server_name=void 0,t),beforeSend:t=>{let e=t.exception?.values;if(!e)return t;for(let r of e)if(r.stacktrace)for(let n of r.stacktrace.frames){if(!n.filename)continue;let o=process.env.HOME||process.env.USERPROFILE;n.filename=n.filename?.replace(o,"~")}return t.server_name=void 0,t}});var Lde=Xq.default.createRequire(d),Tu=null;try{Tu=Lde("node:sea")}catch{Tu={isSea:()=>!1}}var xde=process.env.HOME||process.env.USERPROFILE;rl("CLI",{sea:Tu.isSea(),argv:process.argv.map(t=>t.replace(xde,"~"))});var Dde=(t,e={})=>(...r)=>We({name:t.name,attributes:{args:r},...e},()=>t(...r)),DA=Dde(Tu.isSea()?t=>Buffer.from(Tu.getRawAsset(t)):(()=>{let t=(0,UA.join)((0,zq.fileURLToPath)(d),"../../dist/overlay/");return e=>(0,Kq.readFileSync)((0,UA.join)(t,e))})(),{name:"readAsset",op:"cli.asset.read"});We({name:"Spotlight CLI",op:"cli"},()=>{We({name:"ASCII Art",op:"cli.art.ascii"},()=>{let t=process.stdout.columns;if(!process.stdout.isTTY||t<35)return;let e="",r=We({name:"Inflate ASCII Art Data",op:"cli.art.ascii.inflate"},()=>Uint8Array.from((0,Zq.inflateRawSync)(Buffer.from("bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==","base64")))),n="\x1B[",o=`${n}38;5;`,i=`${o}96m`,s=`${o}61m`,a=`${n}1m`,u=`${n}0m`,l=`${u}
45
+ `)});r.on("close",()=>{t.unsubscribe(l),n.end()})}else if(r.method==="POST"){Ft.debug("\u{1F4E9} Received event");let s=r,a=r.headers["content-encoding"];a==="gzip"?s=r.pipe((0,Df.createGunzip)()):a==="deflate"&&(s=r.pipe((0,Df.createInflate)()));let u=[];s.on("readable",()=>{let l;for(;(l=s.read())!==null;)u.push(l)}),s.on("end",()=>{var l,p;let _=Buffer.concat(u),f=(l=r.headers["content-type"])==null?void 0:l.split(";")[0].toLocaleLowerCase();if((p=i?.get("sentry_client"))!=null&&p.startsWith("sentry.javascript.browser")&&r.headers.origin&&(f="application/x-sentry-envelope"),f?t.put([f,_]):Ft.warn("No content type, skipping payload..."),process.env.SPOTLIGHT_CAPTURE||e){let E=new Date().getTime(),S=`${f?.replace(/[^a-z0-9]/gi,"_")||"no_content_type"}-${E}.txt`;e?e(_.toString("binary")):((0,ha.createWriteStream)(S).write(_),Ft.info(`\u{1F5C3}\uFE0F Saved data to ${S}`))}n.writeHead(200,{"Cache-Control":"no-cache",Connection:"keep-alive"}),n.end()})}else{kq(r,n);return}},vde=t=>function(e,r,n){let o=`${n||e.url}`;o==="/"&&(o="/src/index.html"),o=o.slice(1);let i=(0,mi.extname)(o),s="text/html";switch(i){case".js":s="text/javascript";break;case".css":s="text/css";break;case".json":s="application/json";break}Object.hasOwn(t,o)?(r.writeHead(200,{"Content-Type":s}),r.end(t[o])):Lf(e,r)};function Ide(t,e){e.writeHead(200,{"Content-Type":"text/plain",...Fq,...jq}),e.end("OK")}function Pde(t,e){t.method==="DELETE"?(e.writeHead(200,{"Content-Type":"text/plain"}),Mde(),e.end("Cleared")):kq(t,e)}function Cde(t=process.cwd()){return(e,r)=>{if(e.method!=="POST"){r.writeHead(405),r.end();return}let n="";e.on("data",o=>{n+=o}),e.on("end",()=>{let o=(0,mi.resolve)(t,n);Ft.debug(`Launching editor for ${o}`),(0,Gq.default)(o,(i,s)=>{Ft.error(`Failed to launch editor for ${i}: ${s}`)}),r.writeHead(204),r.end()})}}function qq(t){return Uf((e,r)=>{r.writeHead(t),r.end()},{name:`HTTP ${t}`,op:`sidecar.http.error.${t}`,attributes:{"http.response.status_code":t}})}var Lf=qq(404),kq=qq(405);function Nde(t,e,r,n,o){r&&!n&&(n={"/src/index.html":(0,ha.readFileSync)((0,mi.join)(r,"src/index.html")),"/assets/main.js":(0,ha.readFileSync)((0,mi.join)(r,"assets/main.js"))});let i=[[/^\/health$/,Ide],[/^\/clear$/,Su(Pde)],[/^\/stream$|^\/api\/\d+\/envelope\/?$/,Su(Ode(t,o))],[/^\/open$/,Su(Cde(r))],[RegExp(`^${pq}$`),Su(Tde)],[/^.+$/,n!=null?Su(vde(n)):Lf]],s=(0,xf.createServer)((l,p)=>{var _;let f=l.url;if(!f)return Lf(l,p);let E=l.headers.host||"localhost",{pathname:S,searchParams:T}=new URL(f,`http://${E}`),h=i.find(O=>O[0].test(S));return h?We({name:`HTTP ${l.method} ${S}`,op:`sidecar.http.${(_=l.method)==null?void 0:_.toLowerCase()}`,forceTransaction:!0,attributes:{"http.request.method":l.method,"http.request.url":f,"http.request.query":T.toString(),"server.address":E,"server.port":l.socket.localPort}},O=>{let I=Li();p.appendHeader("server-timing",[`sentryTrace;desc="${I["sentry-trace"]}"`,`baggage;desc="${I.baggage}"`,`sentrySpotlightPort;desc=${e}`].join(", "));let C=h[1](l,p,S,T);return O.setAttribute("http.response.status_code",p.statusCode),C}):Lf(l,p)});return s.on("error",a),s.listen(e,()=>{u(e,r)}),s;function a(l){"code"in l&&l.code==="EADDRINUSE"?(Ft.info(`Port ${e} in use, retrying...`),s.close(),xA=setTimeout(()=>{s.listen(e)},5e3)):$t(l)}function u(l,p){Ft.info(`Sidecar listening on ${l}`),p&&Ft.info(`You can open: http://localhost:${l} to see the Spotlight overlay directly`)}}var Ei,xA=null,Yq=new LA,yde=Uf(t=>{if(typeof t=="string"){let e=Number(t);return/^\d+$/.test(t)&&e>0&&e<=65535}return t>0&&t<=65535},{name:"isValidPort",op:"sidecar.server.portCheck"}),bde=Uf(t=>new Promise(e=>{Ft.info(`Checking if we are already running on port ${t}`);let r={hostname:"localhost",port:t,path:"/health",method:"GET",timeout:1e3,headers:{Connection:"close"}},n,o=(0,xf.get)(r,a=>{let u=a.headers["x-powered-by"];s(u==="spotlight-by-sentry")}),i=()=>!o.destroyed&&o.destroy(new Error("Request timed out."));function s(a){process.off("SIGINT",i),clearTimeout(n),e(a)}process.on("SIGINT",i),n=setTimeout(i,2e3),o.on("error",()=>{s(!1)}),o.end()}),{name:"isSidecarRunning",op:"sidecar.server.collideCheck"});function $q({port:t,logger:e,basePath:r,filesToServe:n,debug:o,incomingPayload:i}={}){let s=8969;e&&gde(e),(o||process.env.SPOTLIGHT_DEBUG)&&Ade(!0),t&&!yde(t)?(Ft.info("Please provide a valid port."),process.exit(1)):t&&(s=typeof t=="string"?Number(t):t),bde(s).then(a=>{a?Ft.info(`Sidecar is already running on port ${s}`):Ei||(Ei=Nde(Yq,s,r,n,i))})}function Mde(){Yq.clear()}var wq=!1,Wq=()=>{xA&&clearTimeout(xA),(wq||!Ei)&&(Ft.info("Bye."),process.exit(0)),Ei&&(wq=!0,Ft.info("Shutting down server gracefully..."),Ei.close(),Ei.closeAllConnections(),Ei.unref())};process.on("SIGINT",Wq);process.on("SIGTERM",Wq);var Kq=require("node:fs"),Xq=G(require("node:module"),1),UA=require("node:path"),zq=require("node:url"),Zq=require("node:zlib");c();cA({dsn:"https://51bcd92dba1128934afd1c5726c84442@o1.ingest.us.sentry.io/4508404727283713",environment:"development",release:"spotlight@2.10.3",debug:!!process.env.SENTRY_DEBUG,tracesSampleRate:1,beforeSendTransaction:t=>(t.server_name=void 0,t),beforeSend:t=>{let e=t.exception?.values;if(!e)return t;for(let r of e)if(r.stacktrace)for(let n of r.stacktrace.frames){if(!n.filename)continue;let o=process.env.HOME||process.env.USERPROFILE;n.filename=n.filename?.replace(o,"~")}return t.server_name=void 0,t}});var Lde=Xq.default.createRequire(d),Tu=null;try{Tu=Lde("node:sea")}catch{Tu={isSea:()=>!1}}var xde=process.env.HOME||process.env.USERPROFILE;rl("CLI",{sea:Tu.isSea(),argv:process.argv.map(t=>t.replace(xde,"~"))});var Dde=(t,e={})=>(...r)=>We({name:t.name,attributes:{args:r},...e},()=>t(...r)),DA=Dde(Tu.isSea()?t=>Buffer.from(Tu.getRawAsset(t)):(()=>{let t=(0,UA.join)((0,zq.fileURLToPath)(d),"../../dist/overlay/");return e=>(0,Kq.readFileSync)((0,UA.join)(t,e))})(),{name:"readAsset",op:"cli.asset.read"});We({name:"Spotlight CLI",op:"cli"},()=>{We({name:"ASCII Art",op:"cli.art.ascii"},()=>{let t=process.stdout.columns;if(!process.stdout.isTTY||t<35)return;let e="",r=We({name:"Inflate ASCII Art Data",op:"cli.art.ascii.inflate"},()=>Uint8Array.from((0,Zq.inflateRawSync)(Buffer.from("bY7LCgMxFEK9L5MwDDSL9P//1DJMKGXowoUcUaFZOk8dU2Op9+qZVkYQoFsaEqA6PZxxma1AoMG+TiONTgcfAd741YxxVf8gCzCgWcYB7OSj9sjW7t2/eKxKAxkIYv8NqL3FpVY25CmjrBSuDw==","base64")))),n="\x1B[",o=`${n}38;5;`,i=`${o}96m`,s=`${o}61m`,a=`${n}1m`,u=`${n}0m`,l=`${u}
46
46
  `,p=.22,_=0,f=0,E=0,S=26,T=0;for(let h of r)if(h===255)e+=l,_=f=0,E++===5&&(p=p/-3),S=Math.round(S*(1+p)),T=Math.round(Math.random()*18);else{for(;h-->=0&&f<t;)f<S-1?e+=i:f===S-1?e+=s:f===S+T&&(e+=`${u}${a}`),e+=_?f>=35?"#":"s":" ",f++;_=!_}e+=l,process.stdout.write(e)}),We({name:"Setup Sidecar",op:"cli.setup.sidecar"},()=>{let t=process.argv.length>=3?Number(process.argv[2]):void 0,e="manifest.json",r="src/index.html",n=process.cwd(),o=Object.create(null);We({name:"Setup Server Assets",op:"cli.setup.sidecar.assets"},()=>{let i=JSON.parse(DA(e));o[r]=DA(r);let s=Object.values(i);for(let a of s)o[a.file]=DA(a.file)}),$q({port:t,basePath:n,filesToServe:o})})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotlightjs/spotlight",
3
3
  "description": "Spotlight - Sentry for development. Containing the overlay and the sidecar.",
4
- "version": "2.10.2",
4
+ "version": "2.10.3",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "files": [
@@ -37,7 +37,7 @@
37
37
  "macho-unsign": "^2.0.6",
38
38
  "portable-executable-signature": "^2.0.6",
39
39
  "postject": "1.0.0-alpha.6",
40
- "@spotlightjs/overlay": "2.11.0",
40
+ "@spotlightjs/overlay": "2.11.1",
41
41
  "@spotlightjs/sidecar": "1.11.1"
42
42
  },
43
43
  "devDependencies": {