/* esm.sh - @sentry-internal/replay@9.17.0 */
import{GLOBAL_OBJ as Fr,normalize as Br,fill as Nn,htmlTreeAsString as Ur,browserPerformanceTimeOrigin as Ln,logger as St,severityLevelFromString as Pn,captureException as Fn,addBreadcrumb as Bn,uuid4 as Un,getClient as ae,getLocationHref as zn,getCurrentScope as zr,getActiveSpan as Wr,getDynamicSamplingContextFromSpan as Wn,isSentryRequestUrl as Hn,stringMatchesSomePattern as $n,addEventProcessor as jn,createEnvelope as qn,createEventEnvelopeHeaders as Vn,getSdkMetadataForEnvelopeHeader as Kn,prepareEvent as Yn,getIsolationScope as Gn,resolvedSyncPromise as ur,updateRateLimits as Xn,isRateLimited as Jn,setContext as Qn,getRootSpan as Zn,spanToJSON as lr,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE as es,isBrowser as dr,parseSampleRate as hr,consoleSandbox as ts}from"/@sentry/core@9.17.0/es2022/core.mjs";import{setTimeout as Se,addPerformanceInstrumentationHandler as rs,addLcpInstrumentationHandler as ns,addClsInstrumentationHandler as ss,addFidInstrumentationHandler as is,addInpInstrumentationHandler as os,serializeFormData as as,getFetchRequestArgBody as Hr,getBodyString as $r,SENTRY_XHR_DATA_KEY as cs,addClickKeypressInstrumentationHandler as us,addHistoryInstrumentationHandler as ls}from"/@sentry-internal/browser-utils@9.17.0/es2022/browser-utils.mjs";var B=Fr,Vt="sentryReplaySession",ds="replay_event",Kt="Unable to send Replay",hs=3e5,fs=9e5,ps=5e3,ms=5500,gs=6e4,ys=5e3,Ss=3,fr=15e4,ze=5e3,_s=3e3,ws=300,Yt=2e7,vs=4999,ks=15e3,pr=36e5,bs=Object.defineProperty,Es=(e,t,r)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mr=(e,t,r)=>Es(e,typeof t!="symbol"?t+"":t,r),$=(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))($||{});function Is(e){return e.nodeType===e.ELEMENT_NODE}function Ie(e){return e?.host?.shadowRoot===e}function Ce(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Cs(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 Ms(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Ve(e){try{let t=e.rules||e.cssRules;return t?Cs(Array.from(t,jr).join("")):null}catch{return null}}function Rs(e){let t="";for(let r=0;r<e.style.length;r++){let n=e.style,s=n[r],i=n.getPropertyPriority(s);t+=`${s}:${n.getPropertyValue(s)}${i?" !important":""};`}return`${e.selectorText} { ${t} }`}function jr(e){let t;if(xs(e))try{t=Ve(e.styleSheet)||Ms(e)}catch{}else if(Os(e)){let r=e.cssText,n=e.selectorText.includes(":"),s=typeof e.style.all=="string"&&e.style.all;if(s&&(r=Rs(e)),n&&(r=Ts(r)),n||s)return r}return t||e.cssText}function Ts(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function xs(e){return"styleSheet"in e}function Os(e){return"selectorText"in e}var Ke=class{constructor(){mr(this,"idNodeMap",new Map),mr(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function As(){return new Ke}function st({maskInputOptions:e,tagName:t,type:r}){return t==="OPTION"&&(t="SELECT"),!!(e[t.toLowerCase()]||r&&e[r]||r==="password"||t==="INPUT"&&!r&&e.text)}function Re({isMasked:e,element:t,value:r,maskInputFn:n}){let s=r||"";return e?(n&&(s=n(s,t)),"*".repeat(s.length)):s}function _e(e){return e.toLowerCase()}function bt(e){return e.toUpperCase()}var gr="__rrweb_original__";function Ds(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let i=t.getImageData,o=gr in i?i[gr]:i;if(new Uint32Array(o.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(a=>a!==0))return!1}return!0}function Gt(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?_e(t):null}function Ye(e,t,r){return t==="INPUT"&&(r==="radio"||r==="checkbox")?e.getAttribute("value")||"":e.value}function qr(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i;return r.pathname.match(n)?.[1]??null}var yr={};function Vr(e){let t=yr[e];if(t)return t;let r=window.document,n=window[e];if(r&&typeof r.createElement=="function")try{let s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);let i=s.contentWindow;i&&i[e]&&(n=i[e]),r.head.removeChild(s)}catch{}return yr[e]=n.bind(window)}function Et(...e){return Vr("setTimeout")(...e)}function Kr(...e){return Vr("clearTimeout")(...e)}function Yr(e){try{return e.contentDocument}catch{}}var Ns=1,Ls=new RegExp("[^a-z0-9-_:]"),Te=-2;function Xt(){return Ns++}function Ps(e){if(e instanceof HTMLFormElement)return"form";let t=_e(e.tagName);return Ls.test(t)?"div":t}function Fs(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var de,Sr,Bs=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Us=/^(?:[a-z+]+:)?\/\//i,zs=/^www\..*/i,Ws=/^(data:)([^,]*),(.*)/i;function Ge(e,t){return(e||"").replace(Bs,(r,n,s,i,o,c)=>{let a=s||o||c,u=n||i||"";if(!a)return r;if(Us.test(a)||zs.test(a))return`url(${u}${a}${u})`;if(Ws.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${Fs(t)+a}${u})`;let d=t.split("/"),l=a.split("/");d.pop();for(let h of l)h!=="."&&(h===".."?d.pop():d.push(h));return`url(${u}${d.join("/")}${u})`})}var Hs=/^[^ \t\n\r\u000c]+/,$s=/^[, \t\n\r\u000c]+/;function js(e,t){if(t.trim()==="")return t;let r=0;function n(i){let o,c=i.exec(t.substring(r));return c?(o=c[0],r+=o.length,o):""}let s=[];for(;n($s),!(r>=t.length);){let i=n(Hs);if(i.slice(-1)===",")i=pe(e,i.substring(0,i.length-1)),s.push(i);else{let o="";i=pe(e,i);let c=!1;for(;;){let a=t.charAt(r);if(a===""){s.push((i+o).trim());break}else if(c)a===")"&&(c=!1);else if(a===","){r+=1,s.push((i+o).trim());break}else a==="("&&(c=!0);o+=a,r+=1}}}return s.join(", ")}var _r=new WeakMap;function pe(e,t){return!t||t.trim()===""?t:it(e,t)}function qs(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function it(e,t){let r=_r.get(e);if(r||(r=e.createElement("a"),_r.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Gr(e,t,r,n,s,i){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?pe(e,n):r==="srcset"?js(e,n):r==="style"?Ge(n,it(e)):t==="object"&&r==="data"?pe(e,n):typeof i=="function"?i(r,n,s):n)}function Xr(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function Jr(e,t,r,n){try{if(n&&e.matches(n))return!1;if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let s=e.classList.length;s--;){let i=e.classList[s];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function Vs(e,t){for(let r=e.classList.length;r--;){let n=e.classList[r];if(t.test(n))return!0}return!1}function le(e,t,r=1/0,n=0){return!e||e.nodeType!==e.ELEMENT_NODE||n>r?-1:t(e)?n:le(e.parentNode,t,r,n+1)}function me(e,t){return r=>{let n=r;if(n===null)return!1;try{if(e){if(typeof e=="string"){if(n.matches(`.${e}`))return!0}else if(Vs(n,e))return!0}return!!(t&&n.matches(t))}catch{return!1}}}function we(e,t,r,n,s,i){try{let o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(o===null)return!1;if(o.tagName==="INPUT"){let u=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let c=-1,a=-1;if(i){if(a=le(o,me(n,s)),a<0)return!0;c=le(o,me(t,r),a>=0?a:1/0)}else{if(c=le(o,me(t,r)),c<0)return!1;a=le(o,me(n,s),c>=0?c:1/0)}return c>=0?a>=0?c<=a:!0:a>=0?!1:!!i}catch{}return!!i}function Ks(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let c=Et(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{Kr(c),s=!0,t()});return}let o="about:blank";if(n.location.href!==o||e.src===o||e.src==="")return Et(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Ys(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let i=Et(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{Kr(i),n=!0,t()})}function Gs(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,unblockSelector:o,maskAllText:c,maskAttributeFn:a,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:h,inlineStylesheet:p,maskInputOptions:f={},maskTextFn:g,maskInputFn:_,dataURLOptions:y={},inlineImages:I,recordCanvas:L,keepIframeSrcFn:T,newlyAddedElement:E=!1}=t,S=Xs(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:$.Document,childNodes:[],compatMode:e.compatMode}:{type:$.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:$.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return Qs(e,{doc:r,blockClass:s,blockSelector:i,unblockSelector:o,inlineStylesheet:p,maskAttributeFn:a,maskInputOptions:f,maskInputFn:_,dataURLOptions:y,inlineImages:I,recordCanvas:L,keepIframeSrcFn:T,newlyAddedElement:E,rootId:S,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:h});case e.TEXT_NODE:return Js(e,{doc:r,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:h,maskTextFn:g,maskInputOptions:f,maskInputFn:_,rootId:S});case e.CDATA_SECTION_NODE:return{type:$.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:$.Comment,textContent:e.textContent||"",rootId:S};default:return!1}}function Xs(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Js(e,t){let{maskAllText:r,maskTextClass:n,unmaskTextClass:s,maskTextSelector:i,unmaskTextSelector:o,maskTextFn:c,maskInputOptions:a,maskInputFn:u,rootId:d}=t,l=e.parentNode&&e.parentNode.tagName,h=e.textContent,p=l==="STYLE"?!0:void 0,f=l==="SCRIPT"?!0:void 0,g=l==="TEXTAREA"?!0:void 0;if(p&&h){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(h=Ve(e.parentNode.sheet))}catch(y){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${y}`,e)}h=Ge(h,it(t.doc))}f&&(h="SCRIPT_PLACEHOLDER");let _=we(e,n,i,s,o,r);if(!p&&!f&&!g&&h&&_&&(h=c?c(h,e.parentElement):h.replace(/[\S]/g,"*")),g&&h&&(a.textarea||_)&&(h=u?u(h,e.parentNode):h.replace(/[\S]/g,"*")),l==="OPTION"&&h){let y=st({type:null,tagName:l,maskInputOptions:a});h=Re({isMasked:we(e,n,i,s,o,y),element:e,value:h,maskInputFn:u})}return{type:$.Text,textContent:h||"",isStyle:p,rootId:d}}function Qs(e,t){let{doc:r,blockClass:n,blockSelector:s,unblockSelector:i,inlineStylesheet:o,maskInputOptions:c={},maskAttributeFn:a,maskInputFn:u,dataURLOptions:d={},inlineImages:l,recordCanvas:h,keepIframeSrcFn:p,newlyAddedElement:f=!1,rootId:g,maskTextClass:_,unmaskTextClass:y,maskTextSelector:I,unmaskTextSelector:L}=t,T=Jr(e,n,s,i),E=Ps(e),S={},R=e.attributes.length;for(let m=0;m<R;m++){let b=e.attributes[m];b.name&&!Xr(E,b.name,b.value)&&(S[b.name]=Gr(r,E,_e(b.name),b.value,e,a))}if(E==="link"&&o){let m=Array.from(r.styleSheets).find(P=>P.href===e.href),b=null;m&&(b=Ve(m)),b&&(S.rel=null,S.href=null,S.crossorigin=null,S._cssText=Ge(b,m.href))}if(E==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){let m=Ve(e.sheet);m&&(S._cssText=Ge(m,it(r)))}if(E==="input"||E==="textarea"||E==="select"||E==="option"){let m=e,b=Gt(m),P=Ye(m,bt(E),b),U=m.checked;if(b!=="submit"&&b!=="button"&&P){let H=we(m,_,I,y,L,st({type:b,tagName:bt(E),maskInputOptions:c}));S.value=Re({isMasked:H,element:m,value:P,maskInputFn:u})}U&&(S.checked=U)}if(E==="option"&&(e.selected&&!c.select?S.selected=!0:delete S.selected),E==="canvas"&&h){if(e.__context==="2d")Ds(e)||(S.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){let m=e.toDataURL(d.type,d.quality),b=r.createElement("canvas");b.width=e.width,b.height=e.height;let P=b.toDataURL(d.type,d.quality);m!==P&&(S.rr_dataURL=m)}}if(E==="img"&&l){de||(de=r.createElement("canvas"),Sr=de.getContext("2d"));let m=e,b=m.currentSrc||m.getAttribute("src")||"<unknown-src>",P=m.crossOrigin,U=()=>{m.removeEventListener("load",U);try{de.width=m.naturalWidth,de.height=m.naturalHeight,Sr.drawImage(m,0,0),S.rr_dataURL=de.toDataURL(d.type,d.quality)}catch(H){if(m.crossOrigin!=="anonymous"){m.crossOrigin="anonymous",m.complete&&m.naturalWidth!==0?U():m.addEventListener("load",U);return}else console.warn(`Cannot inline img src=${b}! Error: ${H}`)}m.crossOrigin==="anonymous"&&(P?S.crossOrigin=P:m.removeAttribute("crossorigin"))};m.complete&&m.naturalWidth!==0?U():m.addEventListener("load",U)}if((E==="audio"||E==="video")&&(S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime),f||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),T){let{width:m,height:b}=e.getBoundingClientRect();S={class:S.class,rr_width:`${m}px`,rr_height:`${b}px`}}E==="iframe"&&!p(S.src)&&(!T&&!Yr(e)&&(S.rr_src=S.src),delete S.src);let M;try{customElements.get(E)&&(M=!0)}catch{}return{type:$.Element,tagName:E,attributes:S,childNodes:[],isSVG:qs(e)||void 0,needBlock:T,rootId:g,isCustom:M}}function F(e){return e==null?"":e.toLowerCase()}function Zs(e,t){if(t.comment&&e.type===$.Comment)return!0;if(e.type===$.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&qr(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(F(e.attributes.name).match(/^msapplication-tile(image|color)$/)||F(e.attributes.name)==="application-name"||F(e.attributes.rel)==="icon"||F(e.attributes.rel)==="apple-touch-icon"||F(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&F(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(F(e.attributes.property).match(/^(og|twitter|fb):/)||F(e.attributes.name).match(/^(og|twitter):/)||F(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(F(e.attributes.name)==="robots"||F(e.attributes.name)==="googlebot"||F(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(F(e.attributes.name)==="author"||F(e.attributes.name)==="generator"||F(e.attributes.name)==="framework"||F(e.attributes.name)==="publisher"||F(e.attributes.name)==="progid"||F(e.attributes.property).match(/^article:/)||F(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(F(e.attributes.name)==="google-site-verification"||F(e.attributes.name)==="yandex-verification"||F(e.attributes.name)==="csrf-token"||F(e.attributes.name)==="p:domain_verify"||F(e.attributes.name)==="verify-v1"||F(e.attributes.name)==="verification"||F(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function ge(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:h=!1,inlineStylesheet:p=!0,maskInputOptions:f={},maskAttributeFn:g,maskTextFn:_,maskInputFn:y,slimDOMOptions:I,dataURLOptions:L={},inlineImages:T=!1,recordCanvas:E=!1,onSerialize:S,onIframeLoad:R,iframeLoadTimeout:M=5e3,onStylesheetLoad:m,stylesheetLoadTimeout:b=5e3,keepIframeSrcFn:P=()=>!1,newlyAddedElement:U=!1}=t,{preserveWhiteSpace:H=!0}=t,j=Gs(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,maskAllText:c,unblockSelector:o,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:g,maskTextFn:_,maskInputFn:y,dataURLOptions:L,inlineImages:T,recordCanvas:E,keepIframeSrcFn:P,newlyAddedElement:U});if(!j)return console.warn(e,"not serialized"),null;let X;n.hasNode(e)?X=n.getId(e):Zs(j,I)||!H&&j.type===$.Text&&!j.isStyle&&!j.textContent.replace(/^\s+|\s+$/gm,"").length?X=Te:X=Xt();let A=Object.assign(j,{id:X});if(n.add(e,A),X===Te)return null;S&&S(e);let Y=!h;if(A.type===$.Element){Y=Y&&!A.needBlock,delete A.needBlock;let z=e.shadowRoot;z&&Ce(z)&&(A.isShadowHost=!0)}if((A.type===$.Document||A.type===$.Element)&&Y){I.headWhitespace&&A.type===$.Element&&A.tagName==="head"&&(H=!1);let z={doc:r,mirror:n,blockClass:s,blockSelector:i,maskAllText:c,unblockSelector:o,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:h,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:g,maskTextFn:_,maskInputFn:y,slimDOMOptions:I,dataURLOptions:L,inlineImages:T,recordCanvas:E,preserveWhiteSpace:H,onSerialize:S,onIframeLoad:R,iframeLoadTimeout:M,onStylesheetLoad:m,stylesheetLoadTimeout:b,keepIframeSrcFn:P};for(let J of Array.from(e.childNodes)){let te=ge(J,z);te&&A.childNodes.push(te)}if(Is(e)&&e.shadowRoot)for(let J of Array.from(e.shadowRoot.childNodes)){let te=ge(J,z);te&&(Ce(e.shadowRoot)&&(te.isShadow=!0),A.childNodes.push(te))}}return e.parentNode&&Ie(e.parentNode)&&Ce(e.parentNode)&&(A.isShadow=!0),A.type===$.Element&&A.tagName==="iframe"&&!Jr(e,s,i,o)&&Ks(e,()=>{let z=Yr(e);if(z&&R){let J=ge(z,{doc:z,mirror:n,blockClass:s,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:g,maskTextFn:_,maskInputFn:y,slimDOMOptions:I,dataURLOptions:L,inlineImages:T,recordCanvas:E,preserveWhiteSpace:H,onSerialize:S,onIframeLoad:R,iframeLoadTimeout:M,onStylesheetLoad:m,stylesheetLoadTimeout:b,keepIframeSrcFn:P});J&&R(e,J)}},M),A.type===$.Element&&A.tagName==="link"&&typeof A.attributes.rel=="string"&&(A.attributes.rel==="stylesheet"||A.attributes.rel==="preload"&&typeof A.attributes.href=="string"&&qr(A.attributes.href)==="css")&&Ys(e,()=>{if(m){let z=ge(e,{doc:r,mirror:n,blockClass:s,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:g,maskTextFn:_,maskInputFn:y,slimDOMOptions:I,dataURLOptions:L,inlineImages:T,recordCanvas:E,preserveWhiteSpace:H,onSerialize:S,onIframeLoad:R,iframeLoadTimeout:M,onStylesheetLoad:m,stylesheetLoadTimeout:b,keepIframeSrcFn:P});z&&m(e,z)}},b),A}function ei(e,t){let{mirror:r=new Ke,blockClass:n="rr-block",blockSelector:s=null,unblockSelector:i=null,maskAllText:o=!1,maskTextClass:c="rr-mask",unmaskTextClass:a=null,maskTextSelector:u=null,unmaskTextSelector:d=null,inlineStylesheet:l=!0,inlineImages:h=!1,recordCanvas:p=!1,maskAllInputs:f=!1,maskAttributeFn:g,maskTextFn:_,maskInputFn:y,slimDOM:I=!1,dataURLOptions:L,preserveWhiteSpace:T,onSerialize:E,onIframeLoad:S,iframeLoadTimeout:R,onStylesheetLoad:M,stylesheetLoadTimeout:m,keepIframeSrcFn:b=()=>!1}=t||{};return ge(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,unblockSelector:i,maskAllText:o,maskTextClass:c,unmaskTextClass:a,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:f===!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}:f===!1?{}:f,maskAttributeFn:g,maskTextFn:_,maskInputFn:y,slimDOMOptions:I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:I==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:I===!1?{}:I,dataURLOptions:L,inlineImages:h,recordCanvas:p,preserveWhiteSpace:T,onSerialize:E,onIframeLoad:S,iframeLoadTimeout:R,onStylesheetLoad:M,stylesheetLoadTimeout:m,keepIframeSrcFn:b,newlyAddedElement:!1})}function K(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var he=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`,wr={map:{},getId(){return console.error(he),-1},getNode(){return console.error(he),null},removeNodeFromMap(){console.error(he)},has(){return console.error(he),!1},reset(){console.error(he)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(wr=new Proxy(wr,{get(e,t,r){return t==="map"&&console.error(he),Reflect.get(e,t,r)}}));function xe(e,t,r={}){let n=null,s=0;return function(...i){let o=Date.now();!s&&r.leading===!1&&(s=o);let c=t-(o-s),a=this;c<=0||c>t?(n&&(oi(n),n=null),s=o,e.apply(a,i)):!n&&r.trailing!==!1&&(n=ot(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(a,i)},c))}}function Qr(e,t,r,n,s=window){let i=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(o){ot(()=>{r.set.call(this,o)},0),i&&i.set&&i.set.call(this,o)}}),()=>Qr(e,t,i||{},!0)}function Jt(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}var Xe=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Xe=()=>new Date().getTime());function Zr(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function en(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function tn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function rn(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function G(e,t,r,n,s){if(!e)return!1;let i=rn(e);if(!i)return!1;let o=me(t,r);if(!s){let u=n&&i.matches(n);return o(i)&&!u}let c=le(i,o),a=-1;return c<0?!1:(n&&(a=le(i,me(null,n))),c>-1&&a<0?!0:c<a)}function ti(e,t){return t.getId(e)!==-1}function _t(e,t){return t.getId(e)===Te}function nn(e,t){if(Ie(e))return!1;let r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?nn(e.parentNode,t):!0:!0}function It(e){return!!e.changedTouches}function ri(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 r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function sn(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function on(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ct(e){return!!e?.shadowRoot}var Mt=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}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 an(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function ni(e){let t=e,r;for(;r=an(t);)t=r;return t}function si(e){let t=e.ownerDocument;if(!t)return!1;let r=ni(e);return t.contains(r)}function cn(e){let t=e.ownerDocument;return t?t.contains(e)||si(e):!1}var vr={};function Qt(e){let t=vr[e];if(t)return t;let r=window.document,n=window[e];if(r&&typeof r.createElement=="function")try{let s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);let i=s.contentWindow;i&&i[e]&&(n=i[e]),r.head.removeChild(s)}catch{}return vr[e]=n.bind(window)}function ii(...e){return Qt("requestAnimationFrame")(...e)}function ot(...e){return Qt("setTimeout")(...e)}function oi(...e){return Qt("clearTimeout")(...e)}var C=(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))(C||{}),k=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(k||{}),V=(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))(V||{}),re=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(re||{}),fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(fe||{});function Zt(e){try{return e.contentDocument}catch{}}function ai(e){try{return e.contentWindow}catch{}}function kr(e){return"__ln"in e}var Rt=class{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 r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&kr(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&kr(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},br=(e,t)=>`${e}@${t}`,Tt=class{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;let t=[],r=new Set,n=new Rt,s=a=>{let u=a,d=Te;for(;d===Te;)u=u&&u.nextSibling,d=u&&this.mirror.getId(u);return d},i=a=>{if(!a.parentNode||!cn(a))return;let u=Ie(a.parentNode)?this.mirror.getId(an(a)):this.mirror.getId(a.parentNode),d=s(a);if(u===-1||d===-1)return n.addNode(a);let l=ge(a,{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:h=>{sn(h,this.mirror)&&!G(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(h),on(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Ct(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(h,p)=>{G(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(h,p),h.contentWindow&&this.canvasManager.addWindow(h.contentWindow),this.shadowDomManager.observeAttachShadow(h))},onStylesheetLoad:(h,p)=>{this.stylesheetManager.attachLinkElement(h,p)}});l&&(t.push({parentId:u,nextId:d,node:l}),r.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let a of this.movedSet)Er(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||i(a);for(let a of this.addedSet)!Ir(this.droppedSet,a)&&!Er(this.removes,a,this.mirror)||Ir(this.movedSet,a)?i(a):this.droppedSet.add(a);let o=null;for(;n.length;){let a=null;if(o){let u=this.mirror.getId(o.value.parentNode),d=s(o.value);u!==-1&&d!==-1&&(a=o)}if(!a){let u=n.tail;for(;u;){let d=u;if(u=u.previous,d){let l=this.mirror.getId(d.value.parentNode);if(s(d.value)===-1)continue;if(l!==-1){a=d;break}else{let p=d.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=p.parentNode.host;if(this.mirror.getId(f)!==-1){a=d;break}}}}}}if(!a){for(;n.head;)n.removeNode(n.head.value);break}o=a.previous,n.removeNode(a.value),i(a.value)}let c={texts:this.texts.map(a=>({id:this.mirror.getId(a.node),value:a.value})).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{let{attributes:u}=a;if(typeof u.style=="string"){let d=JSON.stringify(a.styleDiff),l=JSON.stringify(a._unchangedStyles);d.length<u.style.length&&(d+l).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:t};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.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(c))},this.processMutation=t=>{if(!_t(t.target,this.mirror))switch(t.type){case"characterData":{let r=t.target.textContent;!G(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:we(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&r?this.maskTextFn?this.maskTextFn(r,rn(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,s=t.target.getAttribute(n);if(n==="value"){let o=Gt(r),c=r.tagName;s=Ye(r,c,o);let a=st({maskInputOptions:this.maskInputOptions,tagName:c,type:o}),u=we(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,a);s=Re({isMasked:u,element:r,value:s,maskInputFn:this.maskInputFn})}if(G(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||s===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(s))if(!Zt(r))n="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Xr(r.tagName,n)&&(i.attributes[n]=Gr(this.doc,_e(r.tagName),_e(n),s,r,this.maskAttributeFn),n==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let o=this.unattachedDoc.createElement("span");t.oldValue&&o.setAttribute("style",t.oldValue);for(let c of Array.from(r.style)){let a=r.style.getPropertyValue(c),u=r.style.getPropertyPriority(c);a!==o.style.getPropertyValue(c)||u!==o.style.getPropertyPriority(c)?u===""?i.styleDiff[c]=a:i.styleDiff[c]=[a,u]:i._unchangedStyles[c]=[a,u]}for(let c of Array.from(o.style))r.style.getPropertyValue(c)===""&&(i.styleDiff[c]=!1)}break}case"childList":{if(G(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),s=Ie(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);G(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||_t(r,this.mirror)||!ti(r,this.mirror)||(this.addedSet.has(r)?(xt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||nn(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[br(n,s)]?xt(this.movedSet,r):this.removes.push({parentId:s,id:n,isShadow:Ie(t.target)&&Ce(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(_t(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[br(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);G(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes.forEach(n=>this.genAdds(n)),Ct(t)&&t.shadowRoot.childNodes.forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,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(r=>{this[r]=t[r]})}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 xt(e,t){e.delete(t),t.childNodes.forEach(r=>xt(e,r))}function Er(e,t,r){return e.length===0?!1:ci(e,t,r)}function ci(e,t,r){let n=t.parentNode;for(;n;){let s=r.getId(n);if(e.some(i=>i.id===s))return!0;n=n.parentNode}return!1}function Ir(e,t){return e.size===0?!1:un(e,t)}function un(e,t){let{parentNode:r}=t;return r?e.has(r)?!0:un(e,r):!1}var Me;function ui(e){Me=e}function li(){Me=void 0}var O=e=>Me?(...r)=>{try{return e(...r)}catch(n){if(Me&&Me(n)===!0)return()=>{};throw n}}:e,ye=[];function Le(e){try{if("composedPath"in e){let 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 ln(e,t){let r=new Tt;ye.push(r),r.init(e);let n=window.MutationObserver||window.__rrMutationObserver,s=window?.Zone?.__symbol__?.("MutationObserver");s&&window[s]&&(n=window[s]);let i=new n(O(o=>{e.onMutation&&e.onMutation(o)===!1||r.processMutations.bind(r)(o)}));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function di({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,o=[],c,a=xe(O(l=>{let h=Date.now()-c;e(o.map(p=>(p.timeOffset-=h,p)),l),o=[],c=null}),i),u=O(xe(O(l=>{let h=Le(l),{clientX:p,clientY:f}=It(l)?l.changedTouches[0]:l;c||(c=Xe()),o.push({x:p,y:f,id:n.getId(h),timeOffset:Xe()-c}),a(typeof DragEvent<"u"&&l instanceof DragEvent?k.Drag:l instanceof MouseEvent?k.MouseMove:k.TouchMove)}),s,{trailing:!1})),d=[K("mousemove",u,r),K("touchmove",u,r),K("drag",u,r)];return O(()=>{d.forEach(l=>l())})}function hi({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,unblockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let c=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],u=null,d=l=>h=>{let p=Le(h);if(G(p,n,s,i,!0))return;let f=null,g=l;if("pointerType"in h){switch(h.pointerType){case"mouse":f=re.Mouse;break;case"touch":f=re.Touch;break;case"pen":f=re.Pen;break}f===re.Touch?V[l]===V.MouseDown?g="TouchStart":V[l]===V.MouseUp&&(g="TouchEnd"):re.Pen}else It(h)&&(f=re.Touch);f!==null?(u=f,(g.startsWith("Touch")&&f===re.Touch||g.startsWith("Mouse")&&f===re.Mouse)&&(f=null)):V[l]===V.Click&&(f=u,u=null);let _=It(h)?h.changedTouches[0]:h;if(!_)return;let y=r.getId(p),{clientX:I,clientY:L}=_;O(e)({type:V[g],id:y,x:I,y:L,...f!==null&&{pointerType:f}})};return Object.keys(V).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&c[l]!==!1).forEach(l=>{let h=_e(l),p=d(l);if(window.PointerEvent)switch(V[l]){case V.MouseDown:case V.MouseUp:h=h.replace("mouse","pointer");break;case V.TouchStart:case V.TouchEnd:return}a.push(K(h,p,t))}),O(()=>{a.forEach(l=>l())})}function dn({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,unblockSelector:i,sampling:o}){let c=O(xe(O(a=>{let u=Le(a);if(!u||G(u,n,s,i,!0))return;let d=r.getId(u);if(u===t&&t.defaultView){let l=Zr(t.defaultView);e({id:d,x:l.left,y:l.top})}else e({id:d,x:u.scrollLeft,y:u.scrollTop})}),o.scroll||100));return K("scroll",c,t)}function fi({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=O(xe(O(()=>{let i=en(),o=tn();(r!==i||n!==o)&&(e({width:Number(o),height:Number(i)}),r=i,n=o)}),200));return K("resize",s,t)}var pi=["INPUT","TEXTAREA","SELECT"],Cr=new WeakMap;function mi({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,unblockSelector:i,ignoreClass:o,ignoreSelector:c,maskInputOptions:a,maskInputFn:u,sampling:d,userTriggeredOnInput:l,maskTextClass:h,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:g}){function _(R){let M=Le(R),m=R.isTrusted,b=M&&bt(M.tagName);if(b==="OPTION"&&(M=M.parentElement),!M||!b||pi.indexOf(b)<0||G(M,n,s,i,!0))return;let P=M;if(P.classList.contains(o)||c&&P.matches(c))return;let U=Gt(M),H=Ye(P,b,U),j=!1,X=st({maskInputOptions:a,tagName:b,type:U}),A=we(M,h,f,p,g,X);(U==="radio"||U==="checkbox")&&(j=M.checked),H=Re({isMasked:A,element:M,value:H,maskInputFn:u}),y(M,l?{text:H,isChecked:j,userTriggered:m}:{text:H,isChecked:j});let Y=M.name;U==="radio"&&Y&&j&&t.querySelectorAll(`input[type="radio"][name="${Y}"]`).forEach(z=>{if(z!==M){let J=Re({isMasked:A,element:z,value:Ye(z,b,U),maskInputFn:u});y(z,l?{text:J,isChecked:!j,userTriggered:!1}:{text:J,isChecked:!j})}})}function y(R,M){let m=Cr.get(R);if(!m||m.text!==M.text||m.isChecked!==M.isChecked){Cr.set(R,M);let b=r.getId(R);O(e)({...M,id:b})}}let L=(d.input==="last"?["change"]:["input","change"]).map(R=>K(R,O(_),t)),T=t.defaultView;if(!T)return()=>{L.forEach(R=>R())};let E=T.Object.getOwnPropertyDescriptor(T.HTMLInputElement.prototype,"value"),S=[[T.HTMLInputElement.prototype,"value"],[T.HTMLInputElement.prototype,"checked"],[T.HTMLSelectElement.prototype,"value"],[T.HTMLTextAreaElement.prototype,"value"],[T.HTMLSelectElement.prototype,"selectedIndex"],[T.HTMLOptionElement.prototype,"selected"]];return E&&E.set&&L.push(...S.map(R=>Qr(R[0],R[1],{set(){O(_)({target:this,isTrusted:!1})}},!1,T))),O(()=>{L.forEach(R=>R())})}function Je(e){let t=[];function r(n,s){if(We("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||We("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||We("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||We("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let o=Array.from(n.parentRule.cssRules).indexOf(n);s.unshift(o)}else if(n.parentStyleSheet){let o=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(o)}return s}return r(e,t)}function se(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function gi({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:O((d,l,h)=>{let[p,f]=h,{id:g,styleId:_}=se(l,t,r.styleMirror);return(g&&g!==-1||_&&_!==-1)&&e({id:g,styleId:_,adds:[{rule:p,index:f}]}),d.apply(l,h)})});let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:O((d,l,h)=>{let[p]=h,{id:f,styleId:g}=se(l,t,r.styleMirror);return(f&&f!==-1||g&&g!==-1)&&e({id:f,styleId:g,removes:[{index:p}]}),d.apply(l,h)})});let o;n.CSSStyleSheet.prototype.replace&&(o=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:O((d,l,h)=>{let[p]=h,{id:f,styleId:g}=se(l,t,r.styleMirror);return(f&&f!==-1||g&&g!==-1)&&e({id:f,styleId:g,replace:p}),d.apply(l,h)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:O((d,l,h)=>{let[p]=h,{id:f,styleId:g}=se(l,t,r.styleMirror);return(f&&f!==-1||g&&g!==-1)&&e({id:f,styleId:g,replaceSync:p}),d.apply(l,h)})}));let a={};He("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(He("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),He("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),He("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));let u={};return Object.entries(a).forEach(([d,l])=>{u[d]={insertRule:l.prototype.insertRule,deleteRule:l.prototype.deleteRule},l.prototype.insertRule=new Proxy(u[d].insertRule,{apply:O((h,p,f)=>{let[g,_]=f,{id:y,styleId:I}=se(p.parentStyleSheet,t,r.styleMirror);return(y&&y!==-1||I&&I!==-1)&&e({id:y,styleId:I,adds:[{rule:g,index:[...Je(p),_||0]}]}),h.apply(p,f)})}),l.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:O((h,p,f)=>{let[g]=f,{id:_,styleId:y}=se(p.parentStyleSheet,t,r.styleMirror);return(_&&_!==-1||y&&y!==-1)&&e({id:_,styleId:y,removes:[{index:[...Je(p),g]}]}),h.apply(p,f)})})}),O(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=i,o&&(n.CSSStyleSheet.prototype.replace=o),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(a).forEach(([d,l])=>{l.prototype.insertRule=u[d].insertRule,l.prototype.deleteRule=u[d].deleteRule})})}function hn({mirror:e,stylesheetManager:t},r){let n=null;r.nodeName==="#document"?n=e.getId(r):n=e.getId(r.host);let s=r.nodeName==="#document"?r.defaultView?.Document:r.ownerDocument?.defaultView?.ShadowRoot,i=s?.prototype?Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets"):void 0;return n===null||n===-1||!s||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return i.get?.call(this)},set(o){let c=i.set?.call(this,o);if(n!==null&&n!==-1)try{t.adoptStyleSheets(o,n)}catch{}return c}}),O(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function yi({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let i=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:O((c,a,u)=>{let[d,l,h]=u;if(r.has(d))return i.apply(a,[d,l,h]);let{id:p,styleId:f}=se(a.parentRule?.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,set:{property:d,value:l,priority:h},index:Je(a.parentRule)}),c.apply(a,u)})});let o=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:O((c,a,u)=>{let[d]=u;if(r.has(d))return o.apply(a,[d]);let{id:l,styleId:h}=se(a.parentRule?.parentStyleSheet,t,n.styleMirror);return(l&&l!==-1||h&&h!==-1)&&e({id:l,styleId:h,remove:{property:d},index:Je(a.parentRule)}),c.apply(a,u)})}),O(()=>{s.CSSStyleDeclaration.prototype.setProperty=i,s.CSSStyleDeclaration.prototype.removeProperty=o})}function Si({mediaInteractionCb:e,blockClass:t,blockSelector:r,unblockSelector:n,mirror:s,sampling:i,doc:o}){let c=O(u=>xe(O(d=>{let l=Le(d);if(!l||G(l,t,r,n,!0))return;let{currentTime:h,volume:p,muted:f,playbackRate:g}=l;e({type:u,id:s.getId(l),currentTime:h,volume:p,muted:f,playbackRate:g})}),i.media||500)),a=[K("play",c(fe.Play),o),K("pause",c(fe.Pause),o),K("seeked",c(fe.Seeked),o),K("volumechange",c(fe.VolumeChange),o),K("ratechange",c(fe.RateChange),o)];return O(()=>{a.forEach(u=>u())})}function _i({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,i=r.FontFace;r.FontFace=function(a,u,d){let l=new i(a,u,d);return s.set(l,{family:a,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),l};let o=Jt(t.fonts,"add",function(c){return function(a){return ot(O(()=>{let u=s.get(a);u&&(e(u),s.delete(a))}),0),c.apply(this,[a])}});return n.push(()=>{r.FontFace=i}),n.push(o),O(()=>{n.forEach(c=>c())})}function wi(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,unblockSelector:i,selectionCb:o}=e,c=!0,a=O(()=>{let u=t.getSelection();if(!u||c&&u?.isCollapsed)return;c=u.isCollapsed||!1;let d=[],l=u.rangeCount||0;for(let h=0;h<l;h++){let p=u.getRangeAt(h),{startContainer:f,startOffset:g,endContainer:_,endOffset:y}=p;G(f,n,s,i,!0)||G(_,n,s,i,!0)||d.push({start:r.getId(f),startOffset:g,end:r.getId(_),endOffset:y})}o({ranges:d})});return a(),K("selectionchange",a)}function vi({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Jt(r.customElements,"define",function(s){return function(i,o,c){try{t({define:{name:i}})}catch{}return s.apply(this,[i,o,c])}})}function ki(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};let n;e.recordDOM&&(n=ln(e,e.doc));let s=di(e),i=hi(e),o=dn(e),c=fi(e,{win:r}),a=mi(e),u=Si(e),d=()=>{},l=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(d=gi(e,{win:r}),l=hn(e,e.doc),h=yi(e,{win:r}),e.collectFonts&&(p=_i(e)));let f=wi(e),g=vi(e),_=[];for(let y of e.plugins)_.push(y.observer(y.callback,r,y.options));return O(()=>{ye.forEach(y=>y.reset()),n?.disconnect(),s(),i(),o(),c(),a(),u(),d(),l(),h(),p(),f(),g(),_.forEach(y=>y())})}function We(e){return typeof window[e]<"u"}function He(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Oe=class{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,r,n,s){let i=n||this.getIdToRemoteIdMap(t),o=s||this.getRemoteIdToIdMap(t),c=i.get(r);return c||(c=this.generateIdFn(),i.set(r,c),o.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(i=>this.getId(t,i,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let i=s.get(r);return i||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Ot=class{constructor(){this.crossOriginIframeMirror=new Oe(Xt),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}},At=class{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Oe(Xt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Oe(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,r){this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&t.contentWindow?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(t);let n=Zt(t);n&&n.adoptedStyleSheets&&n.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(n.adoptedStyleSheets,this.mirror.getId(n))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let i=this.transformCrossOriginEvent(s,r.data.event);i&&this.wrappedEmit(i,r.data.isCheckout)}transformCrossOriginEvent(t,r){switch(r.type){case C.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let n=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,n),this.patchRootIdOnNode(r.data.node,n),{timestamp:r.timestamp,type:C.IncrementalSnapshot,data:{source:k.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case C.Meta:case C.Load:case C.DomContentLoaded:return!1;case C.Plugin:return r;case C.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case C.IncrementalSnapshot:switch(r.data.source){case k.Mutation:return r.data.adds.forEach(n=>{this.replaceIds(n,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(n.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(n.node,s)}),r.data.removes.forEach(n=>{this.replaceIds(n,t,["parentId","id"])}),r.data.attributes.forEach(n=>{this.replaceIds(n,t,["id"])}),r.data.texts.forEach(n=>{this.replaceIds(n,t,["id"])}),r;case k.Drag:case k.TouchMove:case k.MouseMove:return r.data.positions.forEach(n=>{this.replaceIds(n,t,["id"])}),r;case k.ViewportResize:return!1;case k.MediaInteraction:case k.MouseInteraction:case k.Scroll:case k.CanvasMutation:case k.Input:return this.replaceIds(r.data,t,["id"]),r;case k.StyleSheetRule:case k.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case k.Font:return r;case k.Selection:return r.data.ranges.forEach(n=>{this.replaceIds(n,t,["start","end"])}),r;case k.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),r.data.styles?.forEach(n=>{this.replaceStyleIds(n,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(let i of s)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=t.getIds(n,r[i]):r[i]=t.getId(n,r[i]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==$.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Dt=class{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}},Nt=class{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,r){if(!Ce(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);let n=ln({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(dn({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),ot(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(hn({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){let r=Zt(t),n=ai(t);!r||!n||this.patchAttachShadow(n.Element,r)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Jt(t.prototype,"attachShadow",function(s){return function(i){let o=s.call(this,i);return this.shadowRoot&&cn(this)&&n.addShadowRoot(this.shadowRoot,r),o}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}},Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(be=0;be<Mr.length;be++)bi[Mr.charCodeAt(be)]=be;var be,Qe=class{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}},Lt=class{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Mt,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let i of t){let o;this.styleMirror.has(i)?o=this.styleMirror.getId(i):(o=this.styleMirror.add(i),s.push({styleId:o,rules:Array.from(i.rules||CSSRule,(c,a)=>({rule:jr(c),index:a}))})),n.styleIds.push(o)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Pt=class{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,ii(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},W,Ze;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Z=As();function ne(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:i=null,unblockSelector:o=null,ignoreClass:c="rr-ignore",ignoreSelector:a=null,maskAllText:u=!1,maskTextClass:d="rr-mask",unmaskTextClass:l=null,maskTextSelector:h=null,unmaskTextSelector:p=null,inlineStylesheet:f=!0,maskAllInputs:g,maskInputOptions:_,slimDOMOptions:y,maskAttributeFn:I,maskInputFn:L,maskTextFn:T,maxCanvasSize:E=null,packFn:S,sampling:R={},dataURLOptions:M={},mousemoveWait:m,recordDOM:b=!0,recordCanvas:P=!1,recordCrossOriginIframes:U=!1,recordAfter:H=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:j=!1,collectFonts:X=!1,inlineImages:A=!1,plugins:Y,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:J=new Set([]),errorHandler:te,onMutation:or,getCanvasManager:On}=e;ui(te);let Fe=U?window.parent===window:!0,ke=!1;if(!Fe)try{window.parent.document&&(ke=!1)}catch{ke=!0}if(Fe&&!t)throw new Error("emit function is required");if(!Fe&&!ke)return()=>{};m!==void 0&&R.mousemove===void 0&&(R.mousemove=m),Z.reset();let lt=g===!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}:_!==void 0?_:{},dt=y===!0||y==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:y==="all",headMetaDescKeywords:y==="all"}:y||{};ri();let ht,ft=0,ar=D=>{for(let Q of Y||[])Q.eventProcessor&&(D=Q.eventProcessor(D));return S&&!ke&&(D=S(D)),D};W=(D,Q)=>{let x=D;if(x.timestamp=Xe(),ye[0]?.isFrozen()&&x.type!==C.FullSnapshot&&!(x.type===C.IncrementalSnapshot&&x.data.source===k.Mutation)&&ye.forEach(q=>q.unfreeze()),Fe)t?.(ar(x),Q);else if(ke){let q={type:"rrweb",event:ar(x),origin:window.location.origin,isCheckout:Q};window.parent.postMessage(q,"*")}if(x.type===C.FullSnapshot)ht=x,ft=0;else if(x.type===C.IncrementalSnapshot){if(x.data.source===k.Mutation&&x.data.isAttachIframe)return;ft++;let q=n&&ft>=n,N=r&&ht&&x.timestamp-ht.timestamp>r;(q||N)&&gt(!0)}};let Be=D=>{W({type:C.IncrementalSnapshot,data:{source:k.Mutation,...D}})},cr=D=>W({type:C.IncrementalSnapshot,data:{source:k.Scroll,...D}}),An=D=>W({type:C.IncrementalSnapshot,data:{source:k.CanvasMutation,...D}}),Dn=D=>W({type:C.IncrementalSnapshot,data:{source:k.AdoptedStyleSheet,...D}}),ce=new Lt({mutationCb:Be,adoptedStyleSheetCb:Dn}),ue=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new Ot:new At({mirror:Z,mutationCb:Be,stylesheetManager:ce,recordCrossOriginIframes:U,wrappedEmit:W});for(let D of Y||[])D.getMirror&&D.getMirror({nodeMirror:Z,crossOriginIframeMirror:ue.crossOriginIframeMirror,crossOriginIframeStyleMirror:ue.crossOriginIframeStyleMirror});let pt=new Pt,mt=Ii(On,{mirror:Z,win:window,mutationCb:D=>W({type:C.IncrementalSnapshot,data:{source:k.CanvasMutation,...D}}),recordCanvas:P,blockClass:s,blockSelector:i,unblockSelector:o,maxCanvasSize:E,sampling:R.canvas,dataURLOptions:M,errorHandler:te}),Ue=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new Dt:new Nt({mutationCb:Be,scrollCb:cr,bypassOptions:{onMutation:or,blockClass:s,blockSelector:i,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:f,maskInputOptions:lt,dataURLOptions:M,maskAttributeFn:I,maskTextFn:T,maskInputFn:L,recordCanvas:P,inlineImages:A,sampling:R,slimDOMOptions:dt,iframeManager:ue,stylesheetManager:ce,canvasManager:mt,keepIframeSrcFn:z,processedNodeManager:pt},mirror:Z}),gt=(D=!1)=>{if(!b)return;W({type:C.Meta,data:{href:window.location.href,width:tn(),height:en()}},D),ce.reset(),Ue.init(),ye.forEach(x=>x.lock());let Q=ei(document,{mirror:Z,blockClass:s,blockSelector:i,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:f,maskAllInputs:lt,maskAttributeFn:I,maskInputFn:L,maskTextFn:T,slimDOM:dt,dataURLOptions:M,recordCanvas:P,inlineImages:A,onSerialize:x=>{sn(x,Z)&&ue.addIframe(x),on(x,Z)&&ce.trackLinkElement(x),Ct(x)&&Ue.addShadowRoot(x.shadowRoot,document)},onIframeLoad:(x,q)=>{ue.attachIframe(x,q),x.contentWindow&&mt.addWindow(x.contentWindow),Ue.observeAttachShadow(x)},onStylesheetLoad:(x,q)=>{ce.attachLinkElement(x,q)},keepIframeSrcFn:z});if(!Q)return console.warn("Failed to snapshot the document");W({type:C.FullSnapshot,data:{node:Q,initialOffset:Zr(window)}}),ye.forEach(x=>x.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ce.adoptStyleSheets(document.adoptedStyleSheets,Z.getId(document))};Ze=gt;try{let D=[],Q=q=>O(ki)({onMutation:or,mutationCb:Be,mousemoveCb:(N,yt)=>W({type:C.IncrementalSnapshot,data:{source:yt,positions:N}}),mouseInteractionCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.MouseInteraction,...N}}),scrollCb:cr,viewportResizeCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.ViewportResize,...N}}),inputCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.Input,...N}}),mediaInteractionCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.MediaInteraction,...N}}),styleSheetRuleCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.StyleSheetRule,...N}}),styleDeclarationCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.StyleDeclaration,...N}}),canvasMutationCb:An,fontCb:N=>W({type:C.IncrementalSnapshot,data:{source:k.Font,...N}}),selectionCb:N=>{W({type:C.IncrementalSnapshot,data:{source:k.Selection,...N}})},customElementCb:N=>{W({type:C.IncrementalSnapshot,data:{source:k.CustomElement,...N}})},blockClass:s,ignoreClass:c,ignoreSelector:a,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:h,unmaskTextSelector:p,maskInputOptions:lt,inlineStylesheet:f,sampling:R,recordDOM:b,recordCanvas:P,inlineImages:A,userTriggeredOnInput:j,collectFonts:X,doc:q,maskAttributeFn:I,maskInputFn:L,maskTextFn:T,keepIframeSrcFn:z,blockSelector:i,unblockSelector:o,slimDOMOptions:dt,dataURLOptions:M,mirror:Z,iframeManager:ue,stylesheetManager:ce,shadowDomManager:Ue,processedNodeManager:pt,canvasManager:mt,ignoreCSSAttributes:J,plugins:Y?.filter(N=>N.observer)?.map(N=>({observer:N.observer,options:N.options,callback:yt=>W({type:C.Plugin,data:{plugin:N.name,payload:yt}})}))||[]},{});ue.addLoadListener(q=>{try{D.push(Q(q.contentDocument))}catch(N){console.warn(N)}});let x=()=>{gt(),D.push(Q(document))};return document.readyState==="interactive"||document.readyState==="complete"?x():(D.push(K("DOMContentLoaded",()=>{W({type:C.DomContentLoaded,data:{}}),H==="DOMContentLoaded"&&x()})),D.push(K("load",()=>{W({type:C.Load,data:{}}),H==="load"&&x()},window))),()=>{D.forEach(q=>q()),pt.destroy(),Ze=void 0,li()}}catch(D){console.warn(D)}}function Ei(e){if(!Ze)throw new Error("please take full snapshot after start recording");Ze(e)}ne.mirror=Z;ne.takeFullSnapshot=Ei;function Ii(e,t){try{return e?e(t):new Qe}catch{return console.warn("Unable to initialize CanvasManager"),new Qe}}var Rr;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Rr||(Rr={}));var Ci=3,Mi=5;function er(e){return e>9999999999?e:e*1e3}function wt(e){return e>9999999999?e/1e3:e}function Pe(e,t){t.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(t.category)?e.triggerUserActivity():e.checkAndHandleExpiredSession(),e.addUpdate(()=>(e.throttledAddEvent({type:C.Custom,timestamp:(t.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:Br(t,10,1e3)}}),t.category==="console")))}var Ri="button,a";function fn(e){return e.closest(Ri)||e}function pn(e){let t=mn(e);return!t||!(t instanceof Element)?t:fn(t)}function mn(e){return Ti(e)?e.target:e}function Ti(e){return typeof e=="object"&&!!e&&"target"in e}var ie;function xi(e){return ie||(ie=[],Oi()),ie.push(e),()=>{let t=ie?ie.indexOf(e):-1;t>-1&&ie.splice(t,1)}}function Oi(){Nn(B,"open",function(e){return function(...t){if(ie)try{ie.forEach(r=>r())}catch{}return e.apply(B,t)}})}var Ai=new Set([k.Mutation,k.StyleSheetRule,k.StyleDeclaration,k.AdoptedStyleSheet,k.CanvasMutation,k.Selection,k.MediaInteraction]);function Di(e,t,r){e.handleClick(t,r)}var Ft=class{constructor(t,r,n=Pe){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=r.timeout/1e3,this._threshold=r.threshold/1e3,this._scrollTimeout=r.scrollTimeout/1e3,this._replay=t,this._ignoreSelector=r.ignoreSelector,this._addBreadcrumbEvent=n}addListeners(){let t=xi(()=>{this._lastMutation=Tr()});this._teardown=()=>{t(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(t,r){if(Li(r,this._ignoreSelector)||!Pi(t))return;let n={timestamp:wt(t.timestamp),clickBreadcrumb:t,clickCount:0,node:r};this._clicks.some(s=>s.node===n.node&&Math.abs(s.timestamp-n.timestamp)<1)||(this._clicks.push(n),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(t=Date.now()){this._lastMutation=wt(t)}registerScroll(t=Date.now()){this._lastScroll=wt(t)}registerClick(t){let r=fn(t);this._handleMultiClick(r)}_handleMultiClick(t){this._getClicks(t).forEach(r=>{r.clickCount++})}_getClicks(t){return this._clicks.filter(r=>r.node===t)}_checkClicks(){let t=[],r=Tr();this._clicks.forEach(n=>{!n.mutationAfter&&this._lastMutation&&(n.mutationAfter=n.timestamp<=this._lastMutation?this._lastMutation-n.timestamp:void 0),!n.scrollAfter&&this._lastScroll&&(n.scrollAfter=n.timestamp<=this._lastScroll?this._lastScroll-n.timestamp:void 0),n.timestamp+this._timeout<=r&&t.push(n)});for(let n of t){let s=this._clicks.indexOf(n);s>-1&&(this._generateBreadcrumbs(n),this._clicks.splice(s,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(t){let r=this._replay,n=t.scrollAfter&&t.scrollAfter<=this._scrollTimeout,s=t.mutationAfter&&t.mutationAfter<=this._threshold,i=!n&&!s,{clickCount:o,clickBreadcrumb:c}=t;if(i){let a=Math.min(t.mutationAfter||this._timeout,this._timeout)*1e3,u=a<this._timeout*1e3?"mutation":"timeout",d={type:"default",message:c.message,timestamp:c.timestamp,category:"ui.slowClickDetected",data:{...c.data,url:B.location.href,route:r.getCurrentRoute(),timeAfterClickMs:a,endReason:u,clickCount:o||1}};this._addBreadcrumbEvent(r,d);return}if(o>1){let a={type:"default",message:c.message,timestamp:c.timestamp,category:"ui.multiClick",data:{...c.data,url:B.location.href,route:r.getCurrentRoute(),clickCount:o,metric:!0}};this._addBreadcrumbEvent(r,a)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=Se(()=>this._checkClicks(),1e3)}},Ni=["A","BUTTON","INPUT"];function Li(e,t){return!!(!Ni.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 Pi(e){return!!(e.data&&typeof e.data.nodeId=="number"&&e.timestamp)}function Tr(){return Date.now()/1e3}function Fi(e,t){try{if(!Bi(t))return;let{source:r}=t.data;if(Ai.has(r)&&e.registerMutation(t.timestamp),r===k.Scroll&&e.registerScroll(t.timestamp),Ui(t)){let{type:n,id:s}=t.data,i=ne.mirror.getNode(s);i instanceof HTMLElement&&n===V.Click&&e.registerClick(i)}}catch{}}function Bi(e){return e.type===Ci}function Ui(e){return e.data.source===k.MouseInteraction}function ee(e){return{timestamp:Date.now()/1e3,type:"default",...e}}var tr=(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))(tr||{}),zi=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function Wi(e){let t={};!e["data-sentry-component"]&&e["data-sentry-element"]&&(e["data-sentry-component"]=e["data-sentry-element"]);for(let r in e)if(zi.has(r)){let n=r;(r==="data-testid"||r==="data-test-id")&&(n="testId"),t[n]=e[r]}return t}var Hi=e=>t=>{if(!e.isEnabled())return;let r=$i(t);if(!r)return;let n=t.name==="click",s=n?t.event:void 0;n&&e.clickDetector&&s&&s.target&&!s.altKey&&!s.metaKey&&!s.ctrlKey&&!s.shiftKey&&Di(e.clickDetector,r,pn(t.event)),Pe(e,r)};function gn(e,t){let r=ne.mirror.getId(e),n=r&&ne.mirror.getNode(r),s=n&&ne.mirror.getMeta(n),i=s&&qi(s)?s:null;return{message:t,data:i?{nodeId:r,node:{id:r,tagName:i.tagName,textContent:Array.from(i.childNodes).map(o=>o.type===tr.Text&&o.textContent).filter(Boolean).map(o=>o.trim()).join(""),attributes:Wi(i.attributes)}}:{}}}function $i(e){let{target:t,message:r}=ji(e);return ee({category:`ui.${e.name}`,...gn(t,r)})}function ji(e){let t=e.name==="click",r,n=null;try{n=t?pn(e.event):mn(e.event),r=Ur(n,{maxStringLength:200})||"<unknown>"}catch{r="<unknown>"}return{target:n,message:r}}function qi(e){return e.type===tr.Element}function Vi(e,t){if(!e.isEnabled())return;e.updateUserActivity();let r=Ki(t);r&&Pe(e,r)}function Ki(e){let{metaKey:t,shiftKey:r,ctrlKey:n,altKey:s,key:i,target:o}=e;if(!o||Yi(o)||!i)return null;let c=t||n||s,a=i.length===1;if(!c&&a)return null;let u=Ur(o,{maxStringLength:200})||"<unknown>",d=gn(o,u);return ee({category:"ui.keyDown",message:u,data:{...d.data,metaKey:t,shiftKey:r,ctrlKey:n,altKey:s,key:i}})}function Yi(e){return e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable}var Gi={resource:eo,paint:Qi,navigation:Zi};function $e(e,t){return({metric:r})=>void t.replayPerformanceEntries.push(e(r))}function Xi(e){return e.map(Ji).filter(Boolean)}function Ji(e){let t=Gi[e.entryType];return t?t(e):null}function ve(e){return((Ln()||B.performance.timeOrigin)+e)/1e3}function Qi(e){let{duration:t,entryType:r,name:n,startTime:s}=e,i=ve(s);return{type:r,name:n,start:i,end:i+t,data:void 0}}function Zi(e){let{entryType:t,name:r,decodedBodySize:n,duration:s,domComplete:i,encodedBodySize:o,domContentLoadedEventStart:c,domContentLoadedEventEnd:a,domInteractive:u,loadEventStart:d,loadEventEnd:l,redirectCount:h,startTime:p,transferSize:f,type:g}=e;return s===0?null:{type:`${t}.${g}`,start:ve(p),end:ve(i),name:r,data:{size:f,decodedBodySize:n,encodedBodySize:o,duration:s,domInteractive:u,domContentLoadedEventStart:c,domContentLoadedEventEnd:a,loadEventStart:d,loadEventEnd:l,domComplete:i,redirectCount:h}}}function eo(e){let{entryType:t,initiatorType:r,name:n,responseEnd:s,startTime:i,decodedBodySize:o,encodedBodySize:c,responseStatus:a,transferSize:u}=e;return["fetch","xmlhttprequest"].includes(r)?null:{type:`${t}.${r}`,start:ve(i),end:ve(s),name:n,data:{size:u,statusCode:a,decodedBodySize:o,encodedBodySize:c}}}function to(e){let t=e.entries[e.entries.length-1],r=t?.element?[t.element]:void 0;return at(e,"largest-contentful-paint",r)}function ro(e){return e.sources!==void 0}function no(e){let t=[],r=[];for(let n of e.entries)if(ro(n)){let s=[];for(let i of n.sources)if(i.node){r.push(i.node);let o=ne.mirror.getId(i.node);o&&s.push(o)}t.push({value:n.value,nodeIds:s.length?s:void 0})}return at(e,"cumulative-layout-shift",r,t)}function so(e){let t=e.entries[e.entries.length-1],r=t?.target?[t.target]:void 0;return at(e,"first-input-delay",r)}function io(e){let t=e.entries[e.entries.length-1],r=t?.target?[t.target]:void 0;return at(e,"interaction-to-next-paint",r)}function at(e,t,r,n){let s=e.value,i=e.rating,o=ve(s);return{type:"web-vital",name:t,start:o,end:o,data:{value:s,size:s,rating:i,nodeIds:r?r.map(c=>ne.mirror.getId(c)):void 0,attributions:n}}}function oo(e){function t(s){e.performanceEntries.includes(s)||e.performanceEntries.push(s)}function r({entries:s}){s.forEach(t)}let n=[];return["navigation","paint","resource"].forEach(s=>{n.push(rs(s,r))}),n.push(ns($e(to,e)),ss($e(no,e)),is($e(so,e)),os($e(io,e))),()=>{n.forEach(s=>s())}}var w=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ao='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var a=new r(i[30]);for(s=1;s<30;++s)for(var o=i[s];o<i[s+1];++o)a[o]=o-i[s]<<5|s;return{b:i,r:a}},o=a(e,2),h=o.b,f=o.r;h[28]=258,f[258]=28;for(var l=a(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,s=0,a=new n(r);s<i;++s)t[s]&&++a[t[s]-1];var o,h=new n(r);for(s=1;s<r;++s)h[s]=h[s-1]+a[s-1]<<1;if(e){o=new n(1<<r);var f=15-r;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],c=r-t[s],v=h[t[s]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>f]=l}else for(o=new n(i),s=0;s<i;++s)t[s]&&(o[s]=u[h[t[s]-1]++]>>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;s<r.length;++s)r[s]&&i.push({s:s,f:r[s]});var a=i.length,o=i.slice();if(!a)return{t:F,l:0};if(1==a){var h=new t(i[0].s+1);return h[i[0].s]=1,{t:h,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var f=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:f.f+l.f,l:f,r:l};c!=a-1;)f=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:f.f+l.f,l:f,r:l};var d=o[0].s;for(s=1;s<a;++s)o[s].s>d&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<<y;for(o.sort((function(t,n){return p[n.s]-p[t.s]||t.f-n.f}));s<a;++s){var b=o[s].s;if(!(p[b]>e))break;w+=m-(1<<g-p[b]),p[b]=e}for(w>>=y;w>0;){var M=o[s].s;p[M]<e?w-=1<<e-p[M]++-1:++s}for(;s>=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<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 s=0;s<e;++s)t[i+s+4]=r[s];return 8*(i+4+e)},U=function(t,r,a,o,h,f,l,u,c,v,m){z(r,m++,a),++h[256];for(var b=x(h,15),M=b.t,E=b.l,A=x(f,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[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(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[s[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=w,P=p,Q=y,R=g;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,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=e+=r[a];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(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<<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(s[t]^s[t+1]<<A^s[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||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$<Z&&s[j+$]==s[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|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=s[j],++I[s[j]];w=U(s,p,g,F,I,S,O,q,G,j-G,w),g||(c.r=7&w|p[w/8|0]<<3,w-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+g;j+=65535){var at=j+65535;at>=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},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 s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();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.prototype.flush=function(){G.prototype.flush.call(this)},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)),s=0,a=function(t){i[s++]=t},o=0;o<e;++o){if(s+5>i.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}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),s=i.length;return q(i,n),j(i,s-8,r.d()),j(i,s-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 co(){let e=new Blob([ao]);return URL.createObjectURL(e)}var xr=["info","warn","error","log"],qe="[Replay] ";function vt(e,t="info"){Bn({category:"console",data:{logger:"replay"},level:t,message:`${qe}${e}`},{level:t})}function uo(){let e=!1,t=!1,r={exception:()=>{},infoTick:()=>{},setConfig:n=>{e=!!n.captureExceptions,t=!!n.traceInternals}};return w?(xr.forEach(n=>{r[n]=(...s)=>{St[n](qe,...s),t&&vt(s.join(""),Pn(n))}}),r.exception=(n,...s)=>{s.length&&r.error&&r.error(...s),St.error(qe,n),e?Fn(n):t&&vt(n,"error")},r.infoTick=(...n)=>{St.info(qe,...n),t&&setTimeout(()=>vt(n[0]),0)}):xr.forEach(n=>{r[n]=()=>{}}),r}var v=uo(),Ae=class extends Error{constructor(){super(`Event buffer exceeded maximum size of ${Yt}.`)}},et=class{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){let r=JSON.stringify(t).length;if(this._totalSize+=r,this._totalSize>Yt)throw new Ae;this.events.push(t)}finish(){return new Promise(t=>{let r=this.events;this.clear(),t(JSON.stringify(r))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){let t=this.events.map(r=>r.timestamp).sort()[0];return t?er(t):null}},Bt=class{constructor(t){this._worker=t,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((t,r)=>{this._worker.addEventListener("message",({data:n})=>{n.success?t():r()},{once:!0}),this._worker.addEventListener("error",n=>{r(n)},{once:!0})}),this._ensureReadyPromise)}destroy(){w&&v.info("Destroying compression worker"),this._worker.terminate()}postMessage(t,r){let n=this._getAndIncrementId();return new Promise((s,i)=>{let o=({data:c})=>{let a=c;if(a.method===t&&a.id===n){if(this._worker.removeEventListener("message",o),!a.success){w&&v.error("Error in compression worker: ",a.response),i(new Error("Error in compression worker"));return}s(a.response)}};this._worker.addEventListener("message",o),this._worker.postMessage({id:n,method:t,arg:r})})}_getAndIncrementId(){return this._id++}},Ut=class{constructor(t){this._worker=new Bt(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){let r=er(t.timestamp);(!this._earliestTimestamp||r<this._earliestTimestamp)&&(this._earliestTimestamp=r);let n=JSON.stringify(t);return this._totalSize+=n.length,this._totalSize>Yt?Promise.reject(new Ae):this._sendEventToWorker(n)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,t=>{w&&v.exception(t,'Sending "clear" message to worker failed',t)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(t){return this._worker.postMessage("addEvent",t)}async _finishRequest(){let t=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,t}},zt=class{constructor(t){this._fallback=new et,this._compression=new Ut(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){w&&v.exception(t,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){let{events:t,hasCheckout:r,waitForCheckout:n}=this._fallback,s=[];for(let i of t)s.push(this._compression.addEvent(i));this._compression.hasCheckout=r,this._compression.waitForCheckout=n,this._used=this._compression;try{await Promise.all(s),this._fallback.clear()}catch(i){w&&v.exception(i,"Failed to add events when switching buffers.")}}};function lo({useCompression:e,workerUrl:t}){if(e&&window.Worker){let r=ho(t);if(r)return r}return w&&v.info("Using simple buffer"),new et}function ho(e){try{let t=e||fo();if(!t)return;w&&v.info(`Using compression worker${e?` from ${e}`:""}`);let r=new Worker(t);return new zt(r)}catch(t){w&&v.exception(t,"Failed to create compression worker")}}function fo(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?co():""}function rr(){try{return"sessionStorage"in B&&!!B.sessionStorage}catch{return!1}}function po(e){mo(),e.session=void 0}function mo(){if(rr())try{B.sessionStorage.removeItem(Vt)}catch{}}function yn(e){return e===void 0?!1:Math.random()<e}function nr(e){if(rr())try{B.sessionStorage.setItem(Vt,JSON.stringify(e))}catch{}}function Sn(e){let t=Date.now(),r=e.id||Un(),n=e.started||t,s=e.lastActivity||t,i=e.segmentId||0,o=e.sampled,c=e.previousSessionId;return{id:r,started:n,lastActivity:s,segmentId:i,sampled:o,previousSessionId:c}}function go(e,t){return yn(e)?"session":t?"buffer":!1}function Or({sessionSampleRate:e,allowBuffering:t,stickySession:r=!1},{previousSessionId:n}={}){let s=go(e,t),i=Sn({sampled:s,previousSessionId:n});return r&&nr(i),i}function yo(){if(!rr())return null;try{let e=B.sessionStorage.getItem(Vt);if(!e)return null;let t=JSON.parse(e);return w&&v.infoTick("Loading existing session"),Sn(t)}catch{return null}}function Wt(e,t,r=+new Date){return e===null||t===void 0||t<0?!0:t===0?!1:e+t<=r}function _n(e,{maxReplayDuration:t,sessionIdleExpire:r,targetTime:n=Date.now()}){return Wt(e.started,t,n)||Wt(e.lastActivity,r,n)}function wn(e,{sessionIdleExpire:t,maxReplayDuration:r}){return!(!_n(e,{sessionIdleExpire:t,maxReplayDuration:r})||e.sampled==="buffer"&&e.segmentId===0)}function kt({sessionIdleExpire:e,maxReplayDuration:t,previousSessionId:r},n){let s=n.stickySession&&yo();return s?wn(s,{sessionIdleExpire:e,maxReplayDuration:t})?(w&&v.infoTick("Session in sessionStorage is expired, creating new one..."),Or(n,{previousSessionId:s.id})):s:(w&&v.infoTick("Creating new session"),Or(n,{previousSessionId:r}))}function So(e){return e.type===C.Custom}function sr(e,t,r){return kn(e,t)?(vn(e,t,r),!0):!1}function _o(e,t,r){return kn(e,t)?vn(e,t,r):Promise.resolve(null)}async function vn(e,t,r){let{eventBuffer:n}=e;if(!n||n.waitForCheckout&&!r)return null;let s=e.recordingMode==="buffer";try{r&&s&&n.clear(),r&&(n.hasCheckout=!0,n.waitForCheckout=!1);let i=e.getOptions(),o=wo(t,i.beforeAddRecordingEvent);return o?await n.addEvent(o):void 0}catch(i){let o=i&&i instanceof Ae,c=o?"addEventSizeExceeded":"addEvent";if(o&&s)return n.clear(),n.waitForCheckout=!0,null;e.handleException(i),await e.stop({reason:c});let a=ae();a&&a.recordDroppedEvent("internal_sdk_error","replay")}}function kn(e,t){if(!e.eventBuffer||e.isPaused()||!e.isEnabled())return!1;let r=er(t.timestamp);return r+e.timeouts.sessionIdlePause<Date.now()?!1:r>e.getContext().initialTimestamp+e.getOptions().maxReplayDuration?(w&&v.infoTick(`Skipping event with timestamp ${r} because it is after maxReplayDuration`),!1):!0}function wo(e,t){try{if(typeof t=="function"&&So(e))return t(e)}catch(r){return w&&v.exception(r,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return e}function ir(e){return!e.type}function Ht(e){return e.type==="transaction"}function vo(e){return e.type==="replay_event"}function Ar(e){return e.type==="feedback"}function ko(e){return(t,r)=>{if(!e.isEnabled()||!ir(t)&&!Ht(t))return;let n=r?.statusCode;if(!(!n||n<200||n>=300)){if(Ht(t)){bo(e,t);return}Eo(e,t)}}}function bo(e,t){let r=e.getContext();t.contexts?.trace?.trace_id&&r.traceIds.size<100&&r.traceIds.add(t.contexts.trace.trace_id)}function Eo(e,t){let r=e.getContext();if(t.event_id&&r.errorIds.size<100&&r.errorIds.add(t.event_id),e.recordingMode!=="buffer"||!t.tags||!t.tags.replayId)return;let{beforeErrorSampling:n}=e.getOptions();typeof n=="function"&&!n(t)||Se(async()=>{try{await e.sendBufferedReplayOrFlush()}catch(s){e.handleException(s)}})}function Io(e){return t=>{!e.isEnabled()||!ir(t)||Co(e,t)}}function Co(e,t){let r=t.exception?.values?.[0]?.value;if(typeof r=="string"&&(r.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||r.match(/(does not match server-rendered HTML|Hydration failed because)/i))){let n=ee({category:"replay.hydrate-error",data:{url:zn()}});Pe(e,n)}}function Mo(e){let t=ae();t&&t.on("beforeAddBreadcrumb",r=>Ro(e,r))}function Ro(e,t){if(!e.isEnabled()||!bn(t))return;let r=To(t);r&&Pe(e,r)}function To(e){return!bn(e)||["fetch","xhr","sentry.event","sentry.transaction"].includes(e.category)||e.category.startsWith("ui.")?null:e.category==="console"?xo(e):ee(e)}function xo(e){let t=e.data?.arguments;if(!Array.isArray(t)||t.length===0)return ee(e);let r=!1,n=t.map(s=>{if(!s)return s;if(typeof s=="string")return s.length>ze?(r=!0,`${s.slice(0,ze)}\u2026`):s;if(typeof s=="object")try{let i=Br(s,7);return JSON.stringify(i).length>ze?(r=!0,`${JSON.stringify(i,null,2).slice(0,ze)}\u2026`):i}catch{}return s});return ee({...e,data:{...e.data,arguments:n,...r?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function bn(e){return!!e.category}function Oo(e,t){return e.type||!e.exception||!e.exception.values||!e.exception.values.length?!1:!!t.originalException?.__rrweb__}function En(){let e=zr().getPropagationContext().dsc;e&&delete e.replay_id;let t=Wr();if(t){let r=Wn(t);delete r.replay_id}}function Ao(e,t){e.triggerUserActivity(),e.addUpdate(()=>t.timestamp?(e.throttledAddEvent({type:C.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 Do(e,t){return e.recordingMode!=="buffer"||t.message===Kt||!t.exception||t.type?!1:yn(e.getOptions().errorSampleRate)}function No(e){return Object.assign((t,r)=>!e.isEnabled()||e.isPaused()?t:vo(t)?(delete t.breadcrumbs,t):!ir(t)&&!Ht(t)&&!Ar(t)?t:e.checkAndHandleExpiredSession()?Ar(t)?(e.flush(),t.contexts.feedback.replay_id=e.getSessionId(),Ao(e,t),t):Oo(t,r)&&!e.getOptions()._experiments.captureExceptions?(w&&v.log("Ignoring error from rrweb internals",t),null):((Do(e,t)||e.recordingMode==="session")&&(t.tags={...t.tags,replayId:e.getSessionId()}),t):(En(),t),{id:"Replay"})}function ct(e,t){return t.map(({type:r,start:n,end:s,name:i,data:o})=>{let c=e.throttledAddEvent({type:C.Custom,timestamp:n,data:{tag:"performanceSpan",payload:{op:r,description:i,startTimestamp:n,endTimestamp:s,data:o}}});return typeof c=="string"?Promise.resolve(null):c})}function Lo(e){let{from:t,to:r}=e,n=Date.now()/1e3;return{type:"navigation.push",start:n,end:n,name:r,data:{previous:t}}}function Po(e){return t=>{if(!e.isEnabled())return;let r=Lo(t);r!==null&&(e.getContext().urls.push(r.name),e.triggerUserActivity(),e.addUpdate(()=>(ct(e,[r]),!1)))}}function Fo(e,t){return w&&e.getOptions()._experiments.traceInternals?!1:Hn(t,ae())}function In(e,t){e.isEnabled()&&t!==null&&(Fo(e,t.name)||e.addUpdate(()=>(ct(e,[t]),!0)))}function ut(e){if(!e)return;let 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){let r=as(e);return t.encode(r).length}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength}catch{}}function Cn(e){if(!e)return;let t=parseInt(e,10);return isNaN(t)?void 0:t}function tt(e,t){if(!e)return{headers:{},size:void 0,_meta:{warnings:[t]}};let r={...e._meta},n=r.warnings||[];return r.warnings=[...n,t],e._meta=r,e}function Mn(e,t){if(!t)return null;let{startTimestamp:r,endTimestamp:n,url:s,method:i,statusCode:o,request:c,response:a}=t;return{type:e,start:r/1e3,end:n/1e3,name:s,data:{method:i,statusCode:o,request:c,response:a}}}function De(e){return{headers:{},size:e,_meta:{warnings:["URL_SKIPPED"]}}}function oe(e,t,r){if(!t&&Object.keys(e).length===0)return;if(!t)return{headers:e};if(!r)return{headers:e,size:t};let n={headers:e,size:t},{body:s,warnings:i}=Bo(r);return n.body=s,i?.length&&(n._meta={warnings:i}),n}function $t(e,t){return Object.entries(e).reduce((r,[n,s])=>{let i=n.toLowerCase();return t.includes(i)&&e[n]&&(r[i]=s),r},{})}function Bo(e){if(!e||typeof e!="string")return{body:e};let t=e.length>fr,r=Uo(e);if(t){let n=e.slice(0,fr);return r?{body:n,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${n}\u2026`,warnings:["TEXT_TRUNCATED"]}}if(r)try{return{body:JSON.parse(e)}}catch{}return{body:e}}function Uo(e){let t=e[0],r=e[e.length-1];return t==="["&&r==="]"||t==="{"&&r==="}"}function rt(e,t){let r=zo(e);return $n(r,t)}function zo(e,t=B.document.baseURI){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith(B.location.origin))return e;let r=new URL(e,t);if(r.origin!==new URL(t).origin)return e;let n=r.href;return!e.endsWith("/")&&n.endsWith("/")?n.slice(0,-1):n}async function Wo(e,t,r){try{let n=await $o(e,t,r),s=Mn("resource.fetch",n);In(r.replay,s)}catch(n){w&&v.exception(n,"Failed to capture fetch breadcrumb")}}function Ho(e,t){let{input:r,response:n}=t,s=r?Hr(r):void 0,i=ut(s),o=n?Cn(n.headers.get("content-length")):void 0;i!==void 0&&(e.data.request_body_size=i),o!==void 0&&(e.data.response_body_size=o)}async function $o(e,t,r){let n=Date.now(),{startTimestamp:s=n,endTimestamp:i=n}=t,{url:o,method:c,status_code:a=0,request_body_size:u,response_body_size:d}=e.data,l=rt(o,r.networkDetailAllowUrls)&&!rt(o,r.networkDetailDenyUrls),h=l?jo(r,t.input,u):De(u),p=await qo(l,r,t.response,d);return{startTimestamp:s,endTimestamp:i,url:o,method:c,statusCode:a,request:h,response:p}}function jo({networkCaptureBodies:e,networkRequestHeaders:t},r,n){let s=r?Yo(r,t):{};if(!e)return oe(s,n,void 0);let i=Hr(r),[o,c]=$r(i,v),a=oe(s,n,o);return c?tt(a,c):a}async function qo(e,{networkCaptureBodies:t,networkResponseHeaders:r},n,s){if(!e&&s!==void 0)return De(s);let i=n?Rn(n.headers,r):{};if(!n||!t&&s!==void 0)return oe(i,s,void 0);let[o,c]=await Ko(n),a=Vo(o,{networkCaptureBodies:t,responseBodySize:s,captureDetails:e,headers:i});return c?tt(a,c):a}function Vo(e,{networkCaptureBodies:t,responseBodySize:r,captureDetails:n,headers:s}){try{let i=e?.length&&r===void 0?ut(e):r;return n?t?oe(s,i,e):oe(s,i,void 0):De(i)}catch(i){return w&&v.exception(i,"Failed to serialize response body"),oe(s,r,void 0)}}async function Ko(e){let t=Go(e);if(!t)return[void 0,"BODY_PARSE_ERROR"];try{return[await Xo(t)]}catch(r){return r instanceof Error&&r.message.indexOf("Timeout")>-1?(w&&v.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(w&&v.exception(r,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function Rn(e,t){let r={};return t.forEach(n=>{e.get(n)&&(r[n]=e.get(n))}),r}function Yo(e,t){return e.length===1&&typeof e[0]!="string"?Dr(e[0],t):e.length===2?Dr(e[1],t):{}}function Dr(e,t){if(!e)return{};let r=e.headers;return r?r instanceof Headers?Rn(r,t):Array.isArray(r)?{}:$t(r,t):{}}function Go(e){try{return e.clone()}catch(t){w&&v.exception(t,"Failed to clone response body")}}function Xo(e){return new Promise((t,r)=>{let n=Se(()=>r(new Error("Timeout while trying to read response body")),500);Jo(e).then(s=>t(s),s=>r(s)).finally(()=>clearTimeout(n))})}async function Jo(e){return await e.text()}async function Qo(e,t,r){try{let n=ea(e,t,r),s=Mn("resource.xhr",n);In(r.replay,s)}catch(n){w&&v.exception(n,"Failed to capture xhr breadcrumb")}}function Zo(e,t){let{xhr:r,input:n}=t;if(!r)return;let s=ut(n),i=r.getResponseHeader("content-length")?Cn(r.getResponseHeader("content-length")):sa(r.response,r.responseType);s!==void 0&&(e.data.request_body_size=s),i!==void 0&&(e.data.response_body_size=i)}function ea(e,t,r){let n=Date.now(),{startTimestamp:s=n,endTimestamp:i=n,input:o,xhr:c}=t,{url:a,method:u,status_code:d=0,request_body_size:l,response_body_size:h}=e.data;if(!a)return null;if(!c||!rt(a,r.networkDetailAllowUrls)||rt(a,r.networkDetailDenyUrls)){let S=De(l),R=De(h);return{startTimestamp:s,endTimestamp:i,url:a,method:u,statusCode:d,request:S,response:R}}let p=c[cs],f=p?$t(p.request_headers,r.networkRequestHeaders):{},g=$t(ta(c),r.networkResponseHeaders),[_,y]=r.networkCaptureBodies?$r(o,v):[void 0],[I,L]=r.networkCaptureBodies?ra(c):[void 0],T=oe(f,l,_),E=oe(g,h,I);return{startTimestamp:s,endTimestamp:i,url:a,method:u,statusCode:d,request:y?tt(T,y):T,response:L?tt(E,L):E}}function ta(e){let t=e.getAllResponseHeaders();return t?t.split(`\r
`).reduce((r,n)=>{let[s,i]=n.split(": ");return i&&(r[s.toLowerCase()]=i),r},{}):{}}function ra(e){let t=[];try{return[e.responseText]}catch(r){t.push(r)}try{return na(e.response,e.responseType)}catch(r){t.push(r)}return w&&v.warn("Failed to get xhr response body",...t),[void 0]}function na(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(r){return w&&v.exception(r,"Failed to serialize body",e),[void 0,"BODY_PARSE_ERROR"]}return w&&v.info("Skipping network body because of body type",e),[void 0,"UNPARSEABLE_BODY_TYPE"]}function sa(e,t){try{let r=t==="json"&&e&&typeof e=="object"?JSON.stringify(e):e;return ut(r)}catch{return}}function ia(e){let t=ae();try{let{networkDetailAllowUrls:r,networkDetailDenyUrls:n,networkCaptureBodies:s,networkRequestHeaders:i,networkResponseHeaders:o}=e.getOptions(),c={replay:e,networkDetailAllowUrls:r,networkDetailDenyUrls:n,networkCaptureBodies:s,networkRequestHeaders:i,networkResponseHeaders:o};t&&t.on("beforeAddBreadcrumb",(a,u)=>oa(c,a,u))}catch{}}function oa(e,t,r){if(t.data)try{aa(t)&&ua(r)&&(Zo(t,r),Qo(t,r,e)),ca(t)&&la(r)&&(Ho(t,r),Wo(t,r,e))}catch(n){w&&v.exception(n,"Error when enriching network breadcrumb")}}function aa(e){return e.category==="xhr"}function ca(e){return e.category==="fetch"}function ua(e){return e?.xhr}function la(e){return e?.response}function da(e,{autoFlushOnFeedback:t}){let r=ae();us(Hi(e)),ls(Po(e)),Mo(e),ia(e);let n=No(e);jn(n),r&&(r.on("beforeSendEvent",Io(e)),r.on("afterSendEvent",ko(e)),r.on("createDsc",s=>{let i=e.getSessionId();i&&e.isEnabled()&&e.recordingMode==="session"&&e.checkAndHandleExpiredSession()&&(s.replay_id=i)}),r.on("spanStart",s=>{e.lastActiveSpan=s}),r.on("spanEnd",s=>{e.lastActiveSpan=s}),r.on("beforeSendFeedback",async(s,i)=>{let o=e.getSessionId();i?.includeReplay&&e.isEnabled()&&o&&s.contexts?.feedback&&(s.contexts.feedback.source==="api"&&t&&await e.flush(),s.contexts.feedback.replay_id=o)}),t&&r.on("openFeedbackWidget",async()=>{await e.flush()}))}async function ha(e){try{return Promise.all(ct(e,[fa(B.performance.memory)]))}catch{return[]}}function fa(e){let{jsHeapSizeLimit:t,totalJSHeapSize:r,usedJSHeapSize:n}=e,s=Date.now()/1e3;return{type:"memory",name:"memory",start:s,end:s,data:{memory:{jsHeapSizeLimit:t,totalJSHeapSize:r,usedJSHeapSize:n}}}}function pa(e,t,r){let n,s,i,o=r?.maxWait?Math.max(r.maxWait,t):0;function c(){return a(),n=e(),n}function a(){s!==void 0&&clearTimeout(s),i!==void 0&&clearTimeout(i),s=i=void 0}function u(){return s!==void 0||i!==void 0?c():n}function d(){return s&&clearTimeout(s),s=Se(c,t),o&&i===void 0&&(i=Se(c,o)),n}return d.cancel=a,d.flush=u,d}var je=Fr.navigator;function ma(){return/iPhone|iPad|iPod/i.test(je?.userAgent??"")||/Macintosh/i.test(je?.userAgent??"")&&je?.maxTouchPoints&&je?.maxTouchPoints>1?{sampling:{mousemove:!1}}:{}}function ga(e){let t=!1;return(r,n)=>{if(!e.checkAndHandleExpiredSession()){w&&v.warn("Received replay event after session expired.");return}let s=n||!t;t=!0,e.clickDetector&&Fi(e.clickDetector,r),e.addUpdate(()=>{if(e.recordingMode==="buffer"&&s&&e.setInitialState(),!sr(e,r,s))return!0;if(!s)return!1;let i=e.session;if(Sa(e,s),e.recordingMode==="buffer"&&i&&e.eventBuffer){let o=e.eventBuffer.getEarliestTimestamp();o&&(w&&v.info(`Updating session start time to earliest event in buffer to ${new Date(o)}`),i.started=o,e.getOptions().stickySession&&nr(i))}return i?.previousSessionId||e.recordingMode==="session"&&e.flush(),!0})}}function ya(e){let t=e.getOptions();return{type:C.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 Sa(e,t){!t||!e.session||e.session.segmentId!==0||sr(e,ya(e),!1)}function _a(e,t,r,n){return qn(Vn(e,Kn(e),n,r),[[{type:"replay_event"},e],[{type:"replay_recording",length:typeof t=="string"?new TextEncoder().encode(t).length:t.length},t]])}function wa({recordingData:e,headers:t}){let r,n=`${JSON.stringify(t)}
`;if(typeof e=="string")r=`${n}${e}`;else{let i=new TextEncoder().encode(n);r=new Uint8Array(i.length+e.length),r.set(i),r.set(e,i.length)}return r}async function va({client:e,scope:t,replayId:r,event:n}){let s=typeof e._integrations=="object"&&e._integrations!==null&&!Array.isArray(e._integrations)?Object.keys(e._integrations):void 0,i={event_id:r,integrations:s};e.emit("preprocessEvent",n,i);let o=await Yn(e.getOptions(),n,i,t,e,Gn());if(!o)return null;e.emit("postprocessEvent",o,i),o.platform=o.platform||"javascript";let c=e.getSdkMetadata(),{name:a,version:u}=c?.sdk||{};return o.sdk={...o.sdk,name:a||"sentry.javascript.unknown",version:u||"0.0.0"},o}async function ka({recordingData:e,replayId:t,segmentId:r,eventContext:n,timestamp:s,session:i}){let o=wa({recordingData:e,headers:{segment_id:r}}),{urls:c,errorIds:a,traceIds:u,initialTimestamp:d}=n,l=ae(),h=zr(),p=l?.getTransport(),f=l?.getDsn();if(!l||!p||!f||!i.sampled)return ur({});let g={type:ds,replay_start_timestamp:d/1e3,timestamp:s/1e3,error_ids:a,trace_ids:u,urls:c,replay_id:t,segment_id:r,replay_type:i.sampled},_=await va({scope:h,client:l,replayId:t,event:g});if(!_)return l.recordDroppedEvent("event_processor","replay"),w&&v.info("An event processor returned `null`, will not send event."),ur({});delete _.sdkProcessingMetadata;let y=_a(_,o,f,l.getOptions().tunnel),I;try{I=await p.send(y)}catch(T){let E=new Error(Kt);try{E.cause=T}catch{}throw E}if(typeof I.statusCode=="number"&&(I.statusCode<200||I.statusCode>=300))throw new nt(I.statusCode);let L=Xn({},I);if(Jn(L,"replay"))throw new Ne(L);return I}var nt=class extends Error{constructor(t){super(`Transport returned status code ${t}`)}},Ne=class extends Error{constructor(t){super("Rate limit hit"),this.rateLimits=t}};async function Tn(e,t={count:0,interval:ys}){let{recordingData:r,onError:n}=e;if(r.length)try{return await ka(e),!0}catch(s){if(s instanceof nt||s instanceof Ne)throw s;if(Qn("Replays",{_retryCount:t.count}),n&&n(s),t.count>=Ss){let i=new Error(`${Kt} - max retries exceeded`);try{i.cause=s}catch{}throw i}return t.interval*=++t.count,new Promise((i,o)=>{Se(async()=>{try{await Tn(e,t),i(!0)}catch(c){o(c)}},t.interval)})}}var xn="__THROTTLED",ba="__SKIPPED";function Ea(e,t,r){let n=new Map,s=c=>{let a=c-r;n.forEach((u,d)=>{d<a&&n.delete(d)})},i=()=>[...n.values()].reduce((c,a)=>c+a,0),o=!1;return(...c)=>{let a=Math.floor(Date.now()/1e3);if(s(a),i()>=t){let d=o;return o=!0,d?ba:xn}o=!1;let u=n.get(a)||0;return n.set(a,u+1),e(...c)}}var jt=class{constructor({options:t,recordingOptions:r}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:hs,sessionIdleExpire:fs},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=r,this._options=t,this._debouncedFlush=pa(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=Ea((o,c)=>_o(this,o,c),300,5);let{slowClickTimeout:n,slowClickIgnoreSelectors:s}=this.getOptions(),i=n?{threshold:Math.min(_s,n),timeout:n,scrollTimeout:ws,ignoreSelector:s?s.join(","):""}:void 0;if(i&&(this.clickDetector=new Ft(this,i)),w){let o=t._experiments;v.setConfig({captureExceptions:!!o.captureExceptions,traceInternals:!!o.traceInternals})}this._handleVisibilityChange=()=>{B.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{let o=ee({category:"ui.blur"});this._doChangeToBackgroundTasks(o)},this._handleWindowFocus=()=>{let o=ee({category:"ui.focus"});this._doChangeToForegroundTasks(o)},this._handleKeyboardEvent=o=>{Vi(this,o)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(t){w&&v.exception(t),this._options.onError&&this._options.onError(t)}initializeSampling(t){let{errorSampleRate:r,sessionSampleRate:n}=this._options,s=r<=0&&n<=0;if(this._requiresManualStart=s,!s){if(this._initializeSessionForSampling(t),!this.session){w&&v.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",w&&v.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){w&&v.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){w&&v.info("Buffering is in progress, call `flush()` to save the replay");return}w&&v.infoTick("Starting replay in session mode"),this._updateUserActivity();let t=kt({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){w&&v.info("Buffering is in progress, call `flush()` to save the replay");return}w&&v.infoTick("Starting replay in buffer mode");let t=kt({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{let t=this._canvas;this._stopRecording=ne({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:gs}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:ga(this),...ma(),onMutation:this._onMutationHandler.bind(this),...t?{recordCanvas:t.recordCanvas,getCanvasManager:t.getCanvasManager,sampling:t.sampling,dataURLOptions:t.dataURLOptions}:{}})}catch(t){this.handleException(t)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(t){return this.handleException(t),!1}}async stop({forceFlush:t=!1,reason:r}={}){if(this._isEnabled){this._isEnabled=!1;try{w&&v.info(`Stopping Replay${r?` triggered by ${r}`:""}`),En(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),t&&await this._flush({force:!0}),this.eventBuffer?.destroy(),this.eventBuffer=null,po(this)}catch(n){this.handleException(n)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),w&&v.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),w&&v.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:t=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();let r=Date.now();w&&v.info("Converting buffer to session"),await this.flushImmediate();let n=this.stopRecording();!t||!n||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(r),this._updateSessionActivity(r),this._maybeSaveSession()),this.startRecording())}addUpdate(t){let r=t();this.recordingMode!=="buffer"&&r!==!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?.id}checkAndHandleExpiredSession(){if(this._lastActivity&&Wt(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){let t=`${B.location.pathname}${B.location.hash}${B.location.search}`,r=`${B.location.origin}${t}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=r,this._context.initialTimestamp=Date.now(),this._context.urls.push(r)}throttledAddEvent(t,r){let n=this._throttledAddEvent(t,r);if(n===xn){let s=ee({category:"replay.throttled"});this.addUpdate(()=>!sr(this,{type:Mi,timestamp:s.timestamp||0,data:{tag:"breadcrumb",payload:s,metric:!0}}))}return n}getCurrentRoute(){let t=this.lastActiveSpan||Wr(),r=t&&Zn(t),s=(r&&lr(r).data||{})[es];if(!(!r||!s||!["route","custom"].includes(s)))return lr(r).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=lo({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(t){let r=this._options.errorSampleRate>0,n=kt({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:t},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:r});this.session=n}_checkSession(){if(!this.session)return!1;let t=this.session;return wn(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{B.document.addEventListener("visibilitychange",this._handleVisibilityChange),B.addEventListener("blur",this._handleWindowBlur),B.addEventListener("focus",this._handleWindowFocus),B.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(da(this,{autoFlushOnFeedback:this._options._experiments.autoFlushOnFeedback}),this._hasInitializedCoreListeners=!0)}catch(t){this.handleException(t)}this._performanceCleanupCallback=oo(this)}_removeListeners(){try{B.document.removeEventListener("visibilitychange",this._handleVisibilityChange),B.removeEventListener("blur",this._handleWindowBlur),B.removeEventListener("focus",this._handleWindowFocus),B.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(t){this.handleException(t)}}_doChangeToBackgroundTasks(t){!this.session||_n(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(t&&this._createCustomBreadcrumb(t),this.conditionalFlush())}_doChangeToForegroundTasks(t){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){w&&v.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:C.Custom,timestamp:t.timestamp||0,data:{tag:"breadcrumb",payload:t}})})}_addPerformanceEntries(){let t=Xi(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){let r=this._context.initialTimestamp/1e3;t=t.filter(n=>n.start>=r)}return Promise.all(ct(this,t))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){let{session:t,eventBuffer:r}=this;if(!t||!r||this._requiresManualStart||t.segmentId)return;let n=r.getEarliestTimestamp();n&&n<this._context.initialTimestamp&&(this._context.initialTimestamp=n)}_popEventContext(){let 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(){let t=this.getSessionId();if(!this.session||!this.eventBuffer||!t){w&&v.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!!this.eventBuffer?.hasEvents&&(await ha(this),!!this.eventBuffer&&t===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();let r=Date.now();if(r-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");let n=this._popEventContext(),s=this.session.segmentId++;this._maybeSaveSession();let i=await this.eventBuffer.finish();await Tn({replayId:t,recordingData:i,segmentId:s,eventContext:n,session:this.session,timestamp:r,onError:o=>this.handleException(o)})}catch(r){this.handleException(r),this.stop({reason:"sendReplay"});let n=ae();if(n){let s=r instanceof Ne?"ratelimit_backoff":"send_error";n.recordDroppedEvent(s,"replay")}}}async _flush({force:t=!1}={}){if(!this._isEnabled&&!t)return;if(!this.checkAndHandleExpiredSession()){w&&v.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;let r=this.session.started,s=Date.now()-r;this._debouncedFlush.cancel();let i=s<this._options.minReplayDuration,o=s>this._options.maxReplayDuration+5e3;if(i||o){w&&v.info(`Session duration (${Math.floor(s/1e3)}s) is too ${i?"short":"long"}, not sending replay.`),i&&this._debouncedFlush();return}let c=this.eventBuffer;c&&this.session.segmentId===0&&!c.hasCheckout&&w&&v.info("Flushing initial segment without checkout.");let a=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,a&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&nr(this.session)}_onMutationHandler(t){let r=t.length,n=this._options.mutationLimit,s=this._options.mutationBreadcrumbLimit,i=n&&r>n;if(r>s||i){let o=ee({category:"replay.mutations",data:{count:r,limit:i}});this._createCustomBreadcrumb(o)}return i?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}};function Ee(e,t){return[...e,...t].join(",")}function Ia({mask:e,unmask:t,block:r,unblock:n,ignore:s}){let i=["base","iframe[srcdoc]:not([src])"],o=Ee(e,[".sentry-mask","[data-sentry-mask]"]),c=Ee(t,[]);return{maskTextSelector:o,unmaskTextSelector:c,blockSelector:Ee(r,[".sentry-block","[data-sentry-block]",...i]),unblockSelector:Ee(n,[]),ignoreSelector:Ee(s,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function Ca({el:e,key:t,maskAttributes:r,maskAllText:n,privacyOptions:s,value:i}){return!n||s.unmaskTextSelector&&e.matches(s.unmaskTextSelector)?i:r.includes(t)||t==="value"&&e.tagName==="INPUT"&&["submit","button"].includes(e.getAttribute("type")||"")?i.replace(/[\S]/g,"*"):i}var Nr='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',Ma=["content-length","content-type","accept"],Lr=!1,Oa=(e=>new qt(e)),qt=class{constructor({flushMinDelay:t=ps,flushMaxDelay:r=ms,minReplayDuration:n=vs,maxReplayDuration:s=pr,stickySession:i=!0,useCompression:o=!0,workerUrl:c,_experiments:a={},maskAllText:u=!0,maskAllInputs:d=!0,blockAllMedia:l=!0,mutationBreadcrumbLimit:h=750,mutationLimit:p=1e4,slowClickTimeout:f=7e3,slowClickIgnoreSelectors:g=[],networkDetailAllowUrls:_=[],networkDetailDenyUrls:y=[],networkCaptureBodies:I=!0,networkRequestHeaders:L=[],networkResponseHeaders:T=[],mask:E=[],maskAttributes:S=["title","placeholder"],unmask:R=[],block:M=[],unblock:m=[],ignore:b=[],maskFn:P,beforeAddRecordingEvent:U,beforeErrorSampling:H,onError:j}={}){this.name="Replay";let X=Ia({mask:E,unmask:R,block:M,unblock:m,ignore:b});if(this._recordingOptions={maskAllInputs:d,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:P,maskInputFn:P,maskAttributeFn:(A,Y,z)=>Ca({maskAttributes:S,maskAllText:u,privacyOptions:X,key:A,value:Y,el:z}),...X,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:A=>{try{A.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!a.recordCrossOriginIframes},this._initialOptions={flushMinDelay:t,flushMaxDelay:r,minReplayDuration:Math.min(n,ks),maxReplayDuration:Math.min(s,pr),stickySession:i,useCompression:o,workerUrl:c,blockAllMedia:l,maskAllInputs:d,maskAllText:u,mutationBreadcrumbLimit:h,mutationLimit:p,slowClickTimeout:f,slowClickIgnoreSelectors:g,networkDetailAllowUrls:_,networkDetailDenyUrls:y,networkCaptureBodies:I,networkRequestHeaders:Pr(L),networkResponseHeaders:Pr(T),beforeAddRecordingEvent:U,beforeErrorSampling:H,onError:j,_experiments:a},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${Nr}`:Nr),this._isInitialized&&dr())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return Lr}set _isInitialized(t){Lr=t}afterAllSetup(t){!dr()||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?.isEnabled())return this._replay.getSessionId()}getRecordingMode(){if(this._replay?.isEnabled())return this._replay.recordingMode}_initialize(t){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(t),this._replay.initializeSampling())}_setup(t){let r=Ra(this._initialOptions,t);this._replay=new jt({options:r,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(t){try{let r=t.getIntegrationByName("ReplayCanvas");if(!r)return;this._replay._canvas=r.getOptions()}catch{}}};function Ra(e,t){let r=t.getOptions(),n={sessionSampleRate:0,errorSampleRate:0,...e},s=hr(r.replaysSessionSampleRate),i=hr(r.replaysOnErrorSampleRate);return s==null&&i==null&&ts(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),s!=null&&(n.sessionSampleRate=s),i!=null&&(n.errorSampleRate=i),n}function Pr(e){return[...Ma,...e.map(t=>t.toLowerCase())]}function Aa(){return ae()?.getIntegrationByName("Replay")}export{Aa as getReplay,Oa as replayIntegration};
//# sourceMappingURL=replay.mjs.map