vendor: 1,817 bytes, line 1
1import{a as q,b as J,f as U}from"./chunk-EQDQRRRY.js";var en={},Qi=function(t,e,s,n,i){var r=new Worker(en[e]||(en[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return r.onmessage=function(o){var c=o.data,a=c.$e$;if(a){var l=new Error(a[0]);l.code=a[1],l.stack=a[2],i(l,null)}else i(null,c)},r.postMessage(s,n),r},X=Uint8Array,$=Uint16Array,mt=Int32Array,bt=new X([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]),yt=new X([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]),Ut=new X([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hn=function(t,e){for(var s=new $(31),n=0;n<31;++n)s[n]=e+=1<<t[n-1];for(var i=new mt(s[30]),n=1;n<30;++n)for(var r=s[n];r<s[n+1];++r)i[r]=r-s[n]<<5|n;return{b:s,r:i}},jn=Hn(bt,2),Zi=jn.b,Qe=jn.r;Zi[28]=258,Qe[258]=28;var er=Hn(yt,0),Ht=er.r,Ze=new $(32768);for(L=0;L<32768;++L)ne=(L&43690)>>1|(L&21845)<<1,ne=(ne&52428)>>2|(ne&13107)<<2,ne=(ne&61680)>>4|(ne&3855)<<4,Ze[L]=((ne&65280)>>8|(ne&255)<<8)>>1;var ne,L,Ee=function(t,e,s){for(var n=t.length,i=0,r=new $(e);i<n;++i)t[i]&&++r[t[i]-1];var o=new $(e);for(i=1;i<e;++i)o[i]=o[i-1]+r[i-1]<<1;var c;if(s){c=new $(1<<e);var a=15-e;for(i=0;i<n;++i)if(t[i])for(var l=i<<4|t[i],u=e-t[i],h=o[t[i]-1]++<<u,f=h|(1<<u)-1;h<=f;++h)c[Ze[h]>>a]=l}else for(c=new $(n),i=0;i<n;++i)t[i]&&(c[i]=Ze[o[t[i]-1]++]>>15-t[i]);return c},le=new X(288);for(L=0;L<144;++L)le[L]=8;var L;for(L=144;L<256;++L)le[L]=9;var L;for(L=256;L<280;++L)le[L]=7;var L;for(L=280;L<288;++L)le[L]=8;var L,Ae=new X(32);for(L=0;L<32;++L)Ae[L]=5;var L,zn=Ee(le,9,0),qn=Ee(Ae,5,0),Ls=function(t){return(t+7)/8|0},Wn=function(t,e,s){return(e==null||e<0)&&(e=0),(s==null||s>t.length)&&(s=t.length),new X(t.subarray(e,s))}
vendor: 5,945 bytes, line 1
1,tr=["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"],$n=function(t,e,s){var n=new Error(e||tr[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,$n),!s)throw n;return n},Y=function(t,e,s){s<<=e&7;var n=e/8|0;t[n]|=s,t[n+1]|=s>>8},we=function(t,e,s){s<<=e&7;var n=e/8|0;t[n]|=s,t[n+1]|=s>>8,t[n+2]|=s>>16},$e=function(t,e){for(var s=[],n=0;n<t.length;++n)t[n]&&s.push({s:n,f:t[n]});var i=s.length,r=s.slice();if(!i)return{t:Ps,l:0};if(i==1){var o=new X(s[0].s+1);return o[s[0].s]=1,{t:o,l:1}}s.sort(function(T,d){return T.f-d.f}),s.push({s:-1,f:25001});var c=s[0],a=s[1],l=0,u=1,h=2;for(s[0]={s:-1,f:c.f+a.f,l:c,r:a};u!=i-1;)c=s[s[l].f<s[h].f?l++:h++],a=s[l!=u&&s[l].f<s[h].f?l++:h++],s[u++]={s:-1,f:c.f+a.f,l:c,r:a};for(var f=r[0].s,n=1;n<i;++n)r[n].s>f&&(f=r[n].s);var g=new $(f+1),S=et(s[u-1],g,0);if(S>e){var n=0,m=0,k=S-e,I=1<<k;for(r.sort(function(d,w){return g[w.s]-g[d.s]||d.f-w.f});n<i;++n){var N=r[n].s;if(g[N]>e)m+=I-(1<<S-g[N]),g[N]=e;else break}for(m>>=k;m>0;){var y=r[n].s;g[y]<e?m-=1<<e-g[y]++-1:++n}for(;n>=0&&m;--n){var p=r[n].s;g[p]==e&&(--g[p],++m)}S=e}return{t:new X(g),l:S}},et=function(t,e,s){return t.s==-1?Math.max(et(t.l,e,s+1),et(t.r,e,s+1)):e[t.s]=s},jt=function(t){for(var e=t.length;e&&!t[--e];);for(var s=new $(++e),n=0,i=t[0],r=1,o=function(a){s[n++]=a},c=1;c<=e;++c)if(t[c]==i&&c!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(i),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(i);r=1,i=t[c]}return{c:s.subarray(0,n),n:e}},ke=function(t,e){for(var s=0,n=0;n<e.length;++n)s+=t[n]*e[n];return s},Bs=function(t,e,s){var n=s.length,i=Ls(e+2);t[i]=n&255,t[i+1]=n>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var r=0;r<n;++r)t[i+r+4]=s[r];return(i+4+n)*8},zt=function(t,e,s,n,i,r,o,c,a,l,u){Y(e,u++,s),++i[256];for(var h=$e(i,15),f=h.t,g=h.l,S=$e(r,15),m=S.t,k=S.l,I=jt(f),N=I.c,y=I.n,p=jt(m),T=p.c,d=p.n,w=new $(19),b=0;b<N.length;++b)++w[N[b]&31];for(var b=0;b<T.length;++b)++w[T[b]&31];for(var v=$e(w,7),O=v.t,A=v.l,_=19;_>4&&!O[Ut[_-1]];--_);var C=l+5<<3,E=ke(i,le)+ke(r,Ae)+o,x=ke(i,f)+ke(r,m)+o+14+3*_+ke(w,O)+2*w[16]+3*w[17]+7*w[18];if(a>=0&&C<=E&&C<=x)return Bs(e,u,t.subarray(a,a+l));var F,B,R,P;if(Y(e,u,1+(x<E)),u+=2,x<E){F=Ee(f,g,0),B=f,R=Ee(m,k,0),P=m;var ce=Ee(O,A,0);Y(e,u,y-257),Y(e,u+5,d-1),Y(e,u+10,_-4),u+=14;for(var b=0;b<_;++b)Y(e,u+3*b,O[Ut[b]]);u+=3*_;for(var V=[N,T],se=0;se<2;++se)for(var me=V[se],b=0;b<me.length;++b){var K=me[b]&31;Y(e,u,ce[K]),u+=O[K],K>15&&(Y(e,u,me[b]>>5&127),u+=me[b]>>12)}}else F=zn,B=le,R=qn,P=Ae;for(var b=0;b<c;++b){var W=n[b];if(W>255){var K=W>>18&31;we(e,u,F[K+257]),u+=B[K+257],K>7&&(Y(e,u,W>>23&31),u+=bt[K]);var be=W&31;we(e,u,R[be]),u+=P[be],be>3&&(we(e,u,W>>5&8191),u+=yt[be])}else we(e,u,F[W]),u+=B[W]}return we(e,u,F[256]),u+B[256]},Vn=new mt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ps=new X(0),Xn=function(t,e,s,n,i,r){var o=r.z||t.length,c=new X(n+o+5*(1+Math.ceil(o/7e3))+i),a=c.subarray(n,c.length-i),l=r.l,u=(r.r||0)&7;if(e){u&&(a[0]=r.r>>3);for(var h=Vn[e-1],f=h>>13,g=h&8191,S=(1<<s)-1,m=r.p||new $(32768),k=r.h||new $(S+1),I=Math.ceil(s/3),N=2*I,y=function(Et){return(t[Et]^t[Et+1]<<I^t[Et+2]<<N)&S},p=new mt(25e3),T=new $(288),d=new $(32),w=0,b=0,v=r.i||0,O=0,A=r.w||0,_=0;v+2<o;++v){var C=y(v),E=v&32767,x=k[C];if(m[E]=x,k[C]=E,A<=v){var F=o-v;if((w>7e3||O>24576)&&(F>423||!l)){u=zt(t,a,0,p,T,d,b,O,_,v-_,u),O=w=b=0,_=v;for(var B=0;B<286;++B)T[B]=0;for(var B=0;B<30;++B)d[B]=0}var R=2,P=0,ce=g,V=E-x&32767;if(F>2&&C==y(v-V))for(var se=Math.min(f,F)-1,me=Math.min(32767,v),K=Math.min(258,F);V<=me&&--ce&&E!=x;){if(t[v+R]==t[v+R-V]){for(var W=0;W<K&&t[v+W]==t[v+W-V];++W);if(W>R){if(R=W,P=V,W>se)break;for(var be=Math.min(V,W-2),Js=0,B=0;B<be;++B){var It=v-V+B&32767,Yi=m[It],Ys=It-Yi&32767;Ys>Js&&(Js=Ys,x=It)}}}E=x,x=m[E],V+=E-x&32767}if(P){p[O++]=268435456|Qe[R]<<18|Ht[P];var Qs=Qe[R]&31,Zs=Ht[P]&31;b+=bt[Qs]+yt[Zs],++T[257+Qs],++d[Zs],A=v+R,++w}else p[O++]=t[v],++T[t[v]]}}for(v=Math.max(v,A);v<o;++v)p[O++]=t[v],++T[t[v]];u=zt(t,a,l,p,T,d,b,O,_,v-_,u),l||(r.r=u&7|a[u/8|0]<<3,u-=7,r.h=k,r.p=m,r.i=v,r.w=A)}else{for(var v=r.w||0;v<o+l;v+=65535){var Ct=v+65535;Ct>=o&&(a[u/8|0]=l,Ct=o),u=Bs(a,u+1,t.subarray(v,Ct))}r.i=o}return Wn(c,0,n+Ls(u)+i)},Gn=(function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var s=e,n=9;--n;)s=(s&1&&-306674912)^s>>>1;t[e]=s}return t})(),Kn=function(){var t=-1;return{p:function(e){for(var s=t,n=0;n<e.length;++n)s=Gn[s&255^e[n]]^s>>>8;t=s},d:function(){return~t}}},Us=function(t,e,s,n,i){if(!i&&(i={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),o=new X(r.length+t.length);o.set(r),o.set(t,r.length),t=o,i.w=r.length}return Xn(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,s,n,i)},sr=function(t,e){var s={};for(var n in t)s[n]=t[n];for(var n in e)s[n]=e[n];return s},tn=function(t,e,s){for(var n=t(),i=t.toString(),r=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var c=n[o],a=r[o];if(typeof c=="function"){e+=";"+a+"=";var l=c.toString();if(c.prototype)if(l.indexOf("[native code]")!=-1){var u=l.indexOf(" ",8)+1;e+=l.slice(u,l.indexOf("(",u))}else{e+=l;for(var h in c.prototype)e+=";"+a+".prototype."+h+"="+c.prototype[h].toString()}else e+=l}else s[a]=c}return e},He=[],nr=function(t){var e=[];for(var s in t)t[s].buffer&&e.push((t[s]=new t[s].constructor(t[s])).buffer);return e},ir=function(t,e,s,n){if(!He[s]){for(var i="",r={},o=t.length-1,c=0;c<o;++c)i=tn(t[c],i,r);He[s]={c:tn(t[o],i,r),e:r}}var a=sr({},He[s].e);return Qi(He[s].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",s,a,nr(a),n)}
1,rr=function(){return[X,$,mt,bt,yt,Ut,Qe,Ht,zn,le,qn,Ae,Ze,Vn,Ps,Ee,Y,we,$e,et,jt,ke,Bs,zt,Ls,Wn,Xn,Us,cr,Jn]},or=function(){return[Yn,Qn,tt,Kn,Gn]},Jn=function(t){return postMessage(t,[t.buffer])},ar=function(t,e,s,n,i,r){var o=ir(s,n,i,function(c,a){o.terminate(),r(c,a)});return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},tt=function(t,e,s){for(;s;++e)t[e]=s,s>>>=8},Yn=function(t,e){var s=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&tt(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),s){t[3]=8;for(var n=0;n<=s.length;++n)t[n+10]=s.charCodeAt(n)}},Qn=function(t){return 10+(t.filename?t.filename.length+1:0)};function cr(t,e){return Us(t,e||{},0,0)}function ur(t,e,s){return s||(s=e,e={}),typeof s!="function"&&$n(7),ar(t,e,[rr,or,function(){return[sn]}],function(n){return Jn(sn(n.data[0],n.data[1]))},2,s)}function sn(t,e){e||(e={});var s=Kn(),n=t.length;s.p(t);var i=Us(t,e,Qn(e),8),r=i.length;return Yn(i,e),tt(i,r-8,s.d()),tt(i,r-4,n),i}var lr=typeof TextDecoder<"u"&&new TextDecoder,hr=0;try{lr.decode(Ps,{stream:!0}),hr=1}catch{}var st=class{constructor(){this.lastTs=0,this.lastSuffix=1,this.backDict={},this.getKey=e=>{let s=!1,n=`__${e}`;if(!this.backDict[n]){s=!0;let i=Date.now()%10**11,r=i;r===this.lastTs?(r=r*1e4+this.lastSuffix,this.lastSuffix+=1):this.lastSuffix=1,this.backDict[n]=r,this.lastTs=i}return[this.backDict[n],s]}}},qt=class{constructor(e){this.sendSetAttribute=(s,n,i)=>{if(this.isDictDisabled){let r=[12,s,n,i];return this.app.send(r)}else{let r=[35,s,this.applyDict(n),this.applyDict(i)];return this.app.send(r)}},this.app=e.app,this.isDictDisabled=e.isDictDisabled,this.dict=new st}applyDict(e){let[s,n]=this.dict.getKey(e);return n&&this.app.send([34,s,e]),s}clear(){this.dict=new st}},Wt=class{constructor(e,s){this.app=e,this.startParams=s,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=n=>{let i=fr(n);if(i.type)return i},this.durationInt=null}setConditions(e){this.conditions=e}fetchConditions(e,s){return U(this,null,function*(){try{let n=yield fetch(`${this.app.options.ingestPoint}/v1/web/conditions/${e}`,{method:"GET",headers:{Authorization:`Bearer ${s}`}}),{conditions:i}=yield n.json(),r=[];i.forEach(o=>{o.filters.forEach(a=>{let l;a.type==="fetch"?(l={type:"network_request",subConditions:[],name:o.name},a.filters.forEach(u=>{let h=this.createConditionFromFilter(u);h&&l.subConditions.push(h)})):l=this.createConditionFromFilter(a),l&&(l.type==="session_duration"&&this.processDuration(l.value[0],o.name),r.push(J(q({},l),{name:o.name})))})}),this.conditions=r}catch{this.app.debug.error("Critical: cannot fetch start conditions")}})}trigger(e){if(!this.hasStarted)try{this.hasStarted=!0,this.app.start(this.startParams,void 0,e)}catch(s){this.app.debug.error(s)}}processMessage(e){if(!this.hasStarted)switch(e[0]){case 78:this.jsExceptionEvent(e);break;case 27:this.customEvent(e);break;case 68:this.clickEvent(e);break;case 122:this.pageLocationEvent(e);break;case 83:this.networkRequest(e);break}}processFlags(e){let s=this.conditions.filter(n=>n.type==="feature_flag");s.length&&s.forEach(n=>{let i=ye[n.operator];i&&e.find(r=>i(r.key,n.value))&&this.trigger(n.name)})}processDuration(e,s){this.durationInt=setInterval(()=>{performance.now()>e&&this.trigger(s)},1e3),this.app.attachStopCallback(()=>{this.durationInt&&clearInterval(this.durationInt)})}networkRequest(e){let s=this.conditions.filter(n=>n.type==="network_request");s.length&&s.forEach(n=>{let i=n.subConditions.filter(r=>r.operator!=="isAny");i.length?i.every(o=>{let c;switch(o.key){case"url":c=e[3];break;case"status":c=e[6];break;case"method":c=e[2];break;case"duration":c=e[8];break}let a=ye[o.operator];if(a&&a(c,o.value))return!0})&&this.trigger(n.name):i.length===0&&n.subConditions.length&&this.trigger(n.name)})}customEvent(e){let s=this.conditions.filter(n=>n.type==="custom_event");s.length&&s.forEach(n=>{let i=ye[n.operator];i&&(i(e[1],n.value)||i(e[2],n.value))&&this.trigger(n.name)})}clickEvent(e){let s=this.conditions.filter(n=>n.type==="click");
1s.length&&s.forEach(n=>{let i=ye[n.operator];i&&(i(e[3],n.value)||i(e[4],n.value))&&this.trigger(n.name)})}pageLocationEvent(e){let s=this.conditions.filter(n=>n.type==="visited_url");s&&s.forEach(n=>{let i=ye[n.operator];i&&i(e[1],n.value)&&this.trigger(n.name)})}jsExceptionEvent(e){let s=[e[1],e[2],e[3]],n=this.conditions.filter(i=>i.type==="exception");n&&n.forEach(i=>{let r=ye[i.operator];r&&s.some(o=>r(o,i.value))&&this.trigger(i.name)})}},ye={is:(t,e)=>e.some(s=>t.includes(s)),isAny:()=>!0,isNot:(t,e)=>!e.some(s=>t.includes(s)),contains:(t,e)=>e.some(s=>t.includes(s)),notContains:(t,e)=>!e.some(s=>t.includes(s)),startsWith:(t,e)=>e.some(s=>t.startsWith(s)),endsWith:(t,e)=>e.some(s=>t.endsWith(s)),greaterThan:(t,e)=>t>e,greaterOrEqual:(t,e)=>t>=e,lessOrEqual:(t,e)=>t<=e,lessThan:(t,e)=>t<e},fr=t=>{let e={on:"is",notOn:"isNot",">":"greaterThan","<":"lessThan","=":"is","<=":"lessOrEqual",">=":"greaterOrEqual"},s=i=>{if(Object.keys(e).includes(i))return e[i]},n={type:"",operator:"",value:t.value,key:""};switch(t.type){case"click":n={type:"click",operator:s(t.operator),value:t.value,key:""};break;case"location":n={type:"visited_url",operator:t.operator,value:t.value,key:""};break;case"custom":n={type:"custom_event",operator:t.operator,value:t.value,key:""};break;case"metadata":n={type:t.source==="featureFlag"?"feature_flag":t.type,operator:t.operator,value:t.value,key:""};break;case"error":n={type:"exception",operator:t.operator,value:t.value,key:""};break;case"duration":n={type:"session_duration",value:t.value,key:"",operator:"is"};break;case"fetchUrl":n={type:"network_request",key:"url",operator:t.operator,value:t.value};break;case"fetchStatusCode":n={type:"network_request",key:"status",operator:s(t.operator),value:t.value};break;case"fetchMethod":n={type:"network_request",key:"method",operator:s(t.operator),value:t.value};break;case"fetchDuration":n={type:"network_request",key:"duration",operator:s(t.operator),value:t.value};break}return n},$t=class{constructor(e){this.app=e,this.flags=[],this.storageKey="__openreplay_flags";let s=this.app.sessionStorage.getItem(this.storageKey);if(s){let n=s.split(";").filter(Boolean);this.flags=n.map(i=>JSON.parse(i))}}getFeatureFlag(e){return this.flags.find(s=>s.key===e)}isFlagEnabled(e){return this.flags.findIndex(s=>s.key===e)!==-1}onFlagsLoad(e){this.onFlagsCb=e}reloadFlags(e){return U(this,null,function*(){let s=this.app.sessionStorage.getItem(this.storageKey),n={};s&&s.split(";").filter(Boolean).forEach(u=>{let h=JSON.parse(u);n[h.key]={key:h.key,value:h.value}});let i=this.app.session.getInfo(),r=this.app.session.userInfo,o={projectID:i.projectID,userID:i.userID,metadata:i.metadata,referrer:document.referrer,os:r.userOS,device:r.userDevice,country:r.userCountry,state:r.userState,city:r.userCity,browser:r.userBrowser,persistFlags:n},c=e??this.app.session.getSessionToken(),a=yield fetch(this.app.options.ingestPoint+"/v1/web/feature-flags",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(o)});if(a.status===200){let l=yield a.json();return this.handleFlags(l.flags)}})}handleFlags(e){let s=[];e.forEach(r=>{r.is_persist&&s.push(r)});let n="";return this.diffPersist(s).forEach(r=>{n+=`${JSON.stringify(r)};`}),this.app.sessionStorage.setItem(this.storageKey,n),this.flags=e,this.onFlagsCb?.(e)}clearPersistFlags(){this.app.sessionStorage.removeItem(this.storageKey)}diffPersist(e){let s=this.app.sessionStorage.getItem(this.storageKey);if(!s)return e;let i=s.split(";").filter(Boolean).map(r=>JSON.parse(r));return e.filter(r=>i.findIndex(o=>o.key===r.key)===-1)}},nn={htmlmasked:"hidden",masked:"obscured"},D=!(typeof window>"u"),dr=D&&navigator.userAgent.match(/firefox|fxios/i),pr=1e5,Hs=D?Date.now()-performance.now():0;function Nt(){Hs=Date.now()-performance.now()}function ge(){return Hs}var G=D&&performance.now?()=>Math.round(performance.now()+Hs):()=>Date.now(),xt="repeat"in String.prototype?t=>"*".repeat(t.length):t=>t.replace(/./g,"*");function Zn(t){return t.trim().replace(/\s+/g," ")}function ei(t){return t.startsWith("https://")||t.startsWith("http://")}var nt="https://docs.openreplay.com",rn={};function ue(t,e,s="/"){rn[t]||(console.warn(`OpenReplay: ${t} is deprecated. ${e?`Please, use ${e} instead.`:""} Visit ${nt}${s} for more information.`),rn[t]=!0)}function js(t){let e=t.getAttribute("data-openreplay-label");return e!==null||(e=t.getAttribute("data-asayer-label"),e!==null&&ue('"data-asayer-label" attribute','"data-openreplay-label" attribute',"/")),e}function ae(t,e){let s=`data-openreplay-${e}`;return t.hasAttribute(s)?(nn[e]&&ue(`"${s}" attribute`,`"${nn[e]}" attribute`,"/en/sdk/sanitize-data"),!0):!1}function gr(t){try{return!!t.contentDocument}catch{return!1}}function ti(t){try{return t instanceof HTMLIFrameElement?t.contentDocument:t instanceof Window?t.document:t instanceof Document?t.defaultView:"nodeType"in t?t.nodeType:"addEventListener"in t&&t.addEventListener,!0}catch(e){if(e instanceof DOMException&&e.name==="SecurityError")return!1}return!0}function on(t){return t.toString(16).padStart(2,"0")}function mr(t){let e=new Uint8Array(t/2),s=window.crypto||window.msCrypto;return s?(s.getRandomValues(e),Array.from(e,on).join("")):Array.from({length:t},()=>on(Math.floor(Math.random()*16))).join("")}function an(){try{return window.self&&window.top&&window.self!==window.top}catch{return!0}}function zs(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}function si(t,e){if(e)return new MutationObserver(t);{let s=zs("MutationObserver");return new window[s](t)}}function ni(t,e,s,n,i){if(!ti(t))return;let r="addEventListener";i||(r=zs("addEventListener"));try{t[r]?t[r](e,s,n):t.addEventListener(e,s,n)}catch(o){let c=o.message;console.error(`Openreplay: ${c}; if this error is caused by an IframeObserver, ignore it`,e,t)}}function ii(t,e,s,n,i){if(!ti(t))return;let r="removeEventListener";i||(r=zs("removeEventListener"));try{t[r]?t[r](e,s,n):t.removeEventListener(e,s,n)}catch(o){let c=o.message;console.error(`Openreplay: ${c}; if this error is caused by an IframeObserver, ignore it`,e,t)}}var Vt=class{constructor(){this.taskQueue=[],this.isRunning=!1}addTask(e){this.taskQueue.push(e),this.runTasks()}runTasks(){if(this.isRunning||this.taskQueue.length===0)return;this.isRunning=!0;let e=()=>{if(this.taskQueue.length===0){this.isRunning=!1;return}let s=this.taskQueue.shift();Promise.resolve(s()).then(()=>{requestAnimationFrame(()=>e())})};e()}},br=new Vt;function cn(t){br.addTask(t)}function ri(t,e){let s=q({},t);for(let n in e)if(e.hasOwnProperty(n)){let i=e[n],r=t[n];typeof i=="object"&&!Array.isArray(i)&&i!==null?s[n]=ri(r||{},i):s[n]=i}return s}function fe(t){return[0,t]}function yr(t,e,s){return[4,t,e,s]}function oi(t,e){return[5,t,e]}function ai(t,e){return[6,t,e]}function ci(){return[7]}function Xt(t,e,s,n,i){return[8,t,e,s,n,i]}function Gt(t,e,s){return[9,t,e,s]}function ui(t,e,s){return[10,t,e,s]}function li(t){return[11,t]}function hi(t,e,s){return[12,t,e,s]}function Kt(t,e){return[13,t,e]}function fi(t,e){return[14,t,e]}function di(t,e,s){return[16,t,e,s]}function Sr(t,e){return[17,t,e]}function pi(t,e,s){return[18,t,e,s]}function gi(t,e){return[19,t,e]}function mi(t,e){return[20,t,e]}function vr(t,e,s,n,i,r,o,c){return[21,t,e,s,n,i,r,o,c]}function bi(t,e){return[22,t,e]}function yi(t,e,s,n,i,r,o,c,a){return[23,t,e,s,n,i,r,o,c,a]}function Si(t,e,s){return[24,t,e,s]}function vi(t,e){return[27,t,e]}function wi(t){return[28,t]}function ki(t){return[29,t]}function Jt(t,e){return[30,t,e]}function wr(t,e){return[34,t,e]}function kr(t,e,s){return[35,t,e,s]}function Tr(t,e,s){return[37,t,e,s]}function Ir(t,e){return[38,t,e]}
1function Cr(t,e,s,n,i,r,o){return[39,t,e,s,n,i,r,o]}function Er(t,e,s,n){return[40,t,e,s,n]}function Nr(t,e){return[41,t,e]}function xr(t){return[42,t]}function _r(t,e,s){return[44,t,e,s]}function Rr(t,e){return[45,t,e]}function Dr(t,e){return[46,t,e]}function Or(t,e,s){return[47,t,e,s]}function Mr(t,e,s,n,i){return[48,t,e,s,n,i]}function Ti(t,e,s,n){return[49,t,e,s,n]}function Ar(t,e){return[50,t,e]}function Fr(t,e,s){return[51,t,e,s]}function Lr(t,e){return[43,t,e]}function Br(t,e,s){return[52,t,e,s]}function Pr(t,e,s,n,i,r,o,c){return[53,t,e,s,n,i,r,o,c]}function Ii(t,e){return[54,t,e]}function Ci(t){return[55,t]}function Yt(t,e,s,n){return[57,t,e,s,n]}function Qt(t){return[58,t]}function Ur(t,e,s,n,i,r,o){return[59,t,e,s,n,i,r,o]}function it(t,e,s,n){return[60,t,e,s,n]}function Zt(t,e,s){return[61,t,e,s]}function Ei(t,e){return[63,t,e]}function Ni(t,e){return[64,t,e]}function Hr(t,e,s,n){return[67,t,e,s,n]}function xi(t,e,s,n,i,r){return[68,t,e,s,n,i,r]}function jr(t,e,s,n){return[69,t,e,s,n]}function rt(t,e){return[70,t,e]}function es(t,e,s){return[71,t,e,s]}function pe(t,e,s,n){return[73,t,e,s,n]}function Ve(t,e){return[75,t,e]}function St(t,e){return[76,t,e]}function _i(t,e){return[77,t,e]}function ot(t,e,s,n){return[78,t,e,s,n]}function zr(t,e){return[79,t,e]}function qr(t,e,s,n,i){return[81,t,e,s,n,i]}function Wr(t,e){return[82,t,e]}function De(t,e,s,n,i,r,o,c,a){return[83,t,e,s,n,i,r,o,c,a]}function Ri(t,e,s,n,i,r){return[84,t,e,s,n,i,r]}function Di(t,e,s,n,i,r){return[112,t,e,s,n,i,r]}function ts(t,e,s){return[113,t,e,s]}function Oi(t){return[114,t]}function ss(t){return[115,t]}function at(t,e,s,n,i,r,o,c,a,l){return[116,t,e,s,n,i,r,o,c,a,l]}function Oe(t){return[117,t]}function de(t){return[118,t]}function Mi(t,e){return[119,t,e]}function Ai(t){return[120,t]}function $r(t,e,s,n){return[121,t,e,s,n]}function Fi(t,e,s,n){return[122,t,e,s,n]}function Vr(t,e,s,n,i){return[123,t,e,s,n,i]}function Li(t,e){return[124,t,e]}var Xr=Object.freeze({__proto__:null,AdoptedSSAddOwner:St,AdoptedSSDeleteRule:Ve,AdoptedSSInsertRuleURLBased:pe,AdoptedSSRemoveOwner:_i,AdoptedSSReplaceURLBased:es,BatchMetadata:qr,CSSDeleteRule:Ir,CSSInsertRule:Tr,CSSInsertRuleURLBased:Hr,CanvasNode:Mi,ConnectionInformation:Ii,ConsoleLog:bi,CreateDocument:ci,CreateElementNode:Xt,CreateIFrameDocument:rt,CreateTextNode:Gt,CustomEvent:vi,CustomIssue:Ni,Fetch:Cr,GraphQL:Vr,GraphQLDeprecated:Mr,InputChange:Di,JSException:ot,LoadFontFace:Yt,LongTask:Ur,Metadata:Jt,MobX:Dr,MouseClick:xi,MouseClickDeprecated:jr,MouseMove:mi,MouseThrashing:Oi,MoveNode:ui,NetworkRequest:De,NetworkRequestDeprecated:vr,NgRx:Or,OTable:Nr,PageLoadTiming:yi,PageRenderTiming:Si,PartitionedMessage:Wr,PerformanceTrack:Ti,Profiler:Er,Redux:$r,ReduxDeprecated:_r,RemoveNode:li,RemoveNodeAttribute:Kt,ResourceTiming:at,ResourceTimingDeprecated:Pr,SelectionChange:ts,SetCSSDataURLBased:Zt,SetInputChecked:gi,SetInputTarget:Sr,SetInputValue:pi,SetNodeAttribute:hi,SetNodeAttributeDict:Br,SetNodeAttributeDictDeprecated:Fr,SetNodeAttributeDictGlobal:kr,SetNodeAttributeURLBased:it,SetNodeData:fi,SetNodeFocus:Qt,SetNodeScroll:di,SetPageLocation:Fi,SetPageLocationDeprecated:yr,SetPageVisibility:Ci,SetViewportScroll:ai,SetViewportSize:oi,StateAction:xr,StringDict:Lr,StringDictDeprecated:Ar,StringDictGlobal:wr,TabChange:Oe,TabData:de,TagTrigger:Ai,TechnicalInfo:Ei,Timestamp:fe,UnbindNodes:ss,UserAnonymousID:ki,UserID:wi,Vuex:Rr,WSChannel:Ri,WebVitals:Li,Zustand:zr}),ns=D&&"performance"in window&&"memory"in performance?performance:{memory:{}},_t=D?(navigator.deviceMemory||0)*1024:0,Rt=ns.memory.jsHeapSizeLimit||0;function Gr(t,e){if(!Object.assign({capturePerformance:!0},e).capturePerformance)return;let n,i,r=()=>{n===void 0||n===-1||(n++,requestAnimationFrame(r))};t.ticker.attach(()=>{i===void 0||i===-1||i++},0,!1);let o=()=>{n===void 0||i===void 0||(t.send(Ti(n,i,ns.memory.totalJSHeapSize||0,ns.memory.usedJSHeapSize||0)),i=n=document.hidden?-1:0)};t.attachStartCallback(()=>{i=n=-1,o(),r()}),t.attachStopCallback(()=>{i=n=void 0}),t.ticker.attach(o,165,!1),document.hidden!==void 0&&t.attachEventListener(document,"visibilitychange",o,!1,!1)}var un="__or__watched_tags__",is=class{constructor(e){this.intervals={},this.tags=[],this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;let s=JSON.parse(e.sessionStorage.getItem(un)??"[]");this.setTags(s),this.observer=new IntersectionObserver(n=>
1{n.forEach(i=>{if(i.isIntersecting&&i.target){let r=i.target.__or_watcher_tagname;r&&this.onTagRendered(r),this.observer.unobserve(i.target)}})})}fetchTags(e,s){return U(this,null,function*(){return fetch(`${e}/v1/web/tags`,{method:"GET",headers:{Authorization:`Bearer ${s}`}}).then(n=>n.json()).then(({tags:n})=>{if(n&&n.length){this.setTags(n);let i=JSON.stringify(n);this.sessionStorage.setItem(un,i||"")}}).catch(n=>this.errLog(n))})}setTags(e){this.tags=e,this.intervals={},e.forEach(s=>{this.intervals[s.id]=setInterval(()=>{let n=document.querySelectorAll(s.selector);if(n.length>0){let i=n[0];i.__or_watcher_tagname=s.id,this.observer.observe(i)}},500)})}onTagRendered(e){this.intervals[e]&&clearInterval(this.intervals[e]),this.onTag(e)}clear(){this.tags.forEach(e=>{clearInterval(this.intervals[e.id])}),this.tags=[],this.intervals={},this.observer.disconnect()}},Kr={position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.40)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},Jr={display:"flex",flexDirection:"column",gap:"2rem",alignItems:"center",padding:"1.5rem",borderRadius:"2px",border:"1px solid rgb(255 255 255 / var(--tw-bg-opacity, 1))",background:"#FFF",width:"22rem"},je={display:"flex","flex-direction":"column",gap:"unset","align-items":"center",padding:"unset",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',"border-radius":"2px",border:"1px solid rgb(255 255 255 / var(--tw-bg-opacity, 1))",background:"rgba(255, 255, 255, 0.75)",width:"22rem"},Yr={fontFamily:"Verdana, sans-serif",fontSize:"1.25rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.75rem",color:"rgba(0, 0, 0, 0.85)"},Qr={borderTop:"1px solid rgba(0, 0, 0, 0.06)",borderBottom:"1px solid rgba(0, 0, 0, 0.06)",padding:"1.25rem 0rem",color:"rgba(0, 0, 0, 0.85)",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"400",lineHeight:"auto",whiteSpace:"pre-wrap"},Zr={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",cursor:"pointer"},ln={fontFamily:"Verdana, sans-serif",fontSize:"13px",fontWeight:"500",lineHeight:"auto",display:"flex",justifyContent:"space-between",width:"100%",cursor:"pointer"},Se={display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"0.625rem",fontSize:"13px",lineHeight:"auto"},eo={padding:"0.5rem",gap:"0.5rem",fontFamily:"Verdana, sans-serif",fontSize:"16px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto",color:"white",display:"flex",alignItems:"center",width:"100%",borderRadius:"2px",background:"rgba(0, 0, 0, 0.75)",boxSizing:"border-box"},Te={boxSizing:"border-box",display:"block",width:"100%",borderBottom:"1px solid rgb(255 255 255 / var(--tw-bg-opacity, 1))",background:"#FFF",padding:"0.65rem",alignSelf:"stretch",color:"#000",fontFamily:"Verdana, sans-serif",fontStyle:"normal",fontWeight:"400"},to=J(q({},Te),{display:"flex",flexDirection:"column",alignItems:"center",gap:"0.625rem"}),hn={fontSize:"1.25rem",fontWeight:"500",cursor:"pointer",color:"#394EFF"},fn={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",width:"100%",boxSizing:"border-box",cursor:"pointer"},dn={marginTop:"1rem",marginBottom:"1rem",cursor:"pointer",display:"block",fontWeight:"500",fontSize:"13px!important",lineHeight:"auto"}
1,so={display:"flex",justifyContent:"space-between",alignItems:"center",gap:"1rem",padding:"0.5rem",width:"100%",boxSizing:"border-box"},pn={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #394EFF",fontSize:"13px",height:"24px",width:"24px"},no={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #D2DFFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",background:"#D2DFFF",fontSize:"13px",height:"24px",width:"24px"},gn={borderRadius:"0.375rem",border:"1px solid rgba(0, 0, 0, 0.06)",background:"#F5F7FF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",padding:"0.625rem 0.9375rem",gap:"0.5rem",alignSelf:"stretch"},mn={fontWeight:"bold"},io={fontSize:"13px",lineHeight:"auto"},Bi={marginRight:"0.5rem",cursor:"pointer",color:"#394EFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto"},ro=J(q({},Bi),{display:"flex",padding:"0.25rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.5rem",borderRadius:"0.25rem",border:"1px solid #394EFF"}),oo={display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",boxSizing:"border-box"},ao={border:"4px solid rgba(255, 255, 255, 0.4)",width:"16px",height:"16px",borderRadius:"50%",borderLeftColor:"#fff",animation:"spin 0.5s linear infinite"},bn={Standard:{width:1280,height:720}},rs=class{constructor(e){this.app=e,this.mediaRecorder=null,this.recordedChunks=[],this.stream=null,this.recStartTs=null}startRecording(e,s,n,i){return U(this,null,function*(){this.recStartTs=this.app.timestamp();let r=s;try{this.stream=yield navigator.mediaDevices.getUserMedia({video:i?J(q({},r),{frameRate:{ideal:e}}):!1,audio:n}),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:"video/webm;codecs=vp9"}),this.recordedChunks=[],this.mediaRecorder.ondataavailable=o=>{o.data.size>0&&this.recordedChunks.push(o.data)},this.mediaRecorder.start()}catch(o){console.error(o)}})}stopRecording(){return U(this,null,function*(){return new Promise(e=>{this.mediaRecorder&&(this.mediaRecorder.onstop=()=>{let s=new Blob(this.recordedChunks,{type:"video/webm"});e(s)},this.mediaRecorder.stop())})})}sendToAPI(){return U(this,null,function*(){let e=yield this.stopRecording();return fetch(`${this.app.options.ingestPoint}/v1/web/uxt/upload-url`,{headers:{Authorization:`Bearer ${this.app.session.getSessionToken()}`}}).then(s=>{if(s.ok)return s.json();throw new Error("Failed to get upload url")}).then(({url:s})=>fetch(s,{method:"PUT",headers:{"Content-Type":"video/webm"},body:e})).catch(console.error).finally(()=>{this.discard()})})}saveToFile(e="recorded-video.webm"){return U(this,null,function*(){let s=yield this.stopRecording(),n=URL.createObjectURL(s),i=document.createElement("a");i.style.display="none",i.href=n,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i)})}discard(){this.mediaRecorder?.stop(),this.stream?.getTracks().forEach(e=>e.stop())}};function co(t,e){e.onmousedown=function(s){let n=t.getBoundingClientRect(),i=s.clientX-n.left,r=s.clientY-n.top;t.style.position="fixed",t.style.zIndex=99999999999999,o(s.pageX,s.pageY);function o(l,u){let h=l-i,f=u-r;h<=5&&(h=5),f<=5&&(f=5),h>=window.innerWidth-n.width&&(h=window.innerWidth-n.width),f>=window.innerHeight-n.height&&(f=window.innerHeight-n.height),t.style.left=`${h}px`,t.style.top=`${f}px`}function c(l){o(l.pageX,l.pageY)}document.addEventListener("mousemove",c);let a=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",a)};document.addEventListener("mouseup",a)},e.ondragstart=function(){return!1}}function uo(){let t=document.createElement("div");t.className="grid";for(let e=0;e<16;e++){let s=document.createElement("div");Object.assign(s.style,{width:"2px",height:"2px",borderRadius:"10px",background:"white"}),s.className="cell",t.appendChild(s)}return Object.assign(t.style,{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(4, 1fr)",gap:"2px",cursor:"grab"}),t}function lo(){let t=document.createElement("div");Object.assign(t.style,{width:"0",height:"0",borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:"7px solid white"});let e=document.createElement("div");return e.appendChild(t),Object.assign(e.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",cursor:"pointer",marginLeft:"auto",transform:"rotate(180deg)"}),e}function ho(){let t=document.createElement("style");t.type="text/css",t.innerText=`@keyframes spin { 2 0% { transform: rotate(0deg); } 3 100% { transform: rotate(360deg); } 4 }`,document.head.appendChild(t)}function fo(){ho();let t=document.createElement("div");return t.classList.add("spinner"),Object.assign(t.style,ao),t}function M(t,e,s,n,i){let r=document.createElement(t);return r.className=e,Object.assign(r.style,s),n&&(r.textContent=n),i&&(r.id=i),r}var Xe="or_uxt_test_start",os="or_uxt_task_index",as="or_uxt_session_id",po="or_uxt_test_id",cs=class{constructor(e,s,n,i,r,o,c,a,l){this.ingestPoint=e,this.getTimestamp=s,this.token=n,this.testId=i,this.storageKey=r,this.setStorageKey=o,this.removeStorageKey=c,this.get
4StorageKey=a,this.getSessionId=l,this.durations={testStart:0,tasks:[]},this.getDurations=()=>this.durations,this.setDurations=h=>{this.durations.testStart=h.testStart,this.durations.tasks=h.tasks},this.signalTask=(h,f,g)=>{if(!h)return console.error("User Testing: No Task ID Given");let S=this.durations.tasks.find(I=>I.taskId===h),m=this.getTimestamp(),k=S?m-S.started:0;return fetch(`${this.ingestPoint}/v1/web/uxt/signals/task`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:JSON.stringify({testId:this.testId,taskId:h,status:f,duration:k,timestamp:m,taskAnswer:g})})},this.signalTest=h=>{let f=this.getTimestamp();if(h==="begin"&&this.testId){let m=this.getSessionId();this.setStorageKey(as,m),this.setStorageKey(this.storageKey,this.testId.toString()),this.setStorageKey(Xe,f.toString())}else this.removeStorageKey(this.storageKey),this.removeStorageKey(os),this.removeStorageKey(Xe);let g=this.durations.testStart||f,S=f-g;return fetch(`${this.ingestPoint}/v1/web/uxt/signals/test`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:JSON.stringify({testId:this.testId,status:h,duration:S,timestamp:f})})};let u=this.getStorageKey(Xe);u&&(this.durations.testStart=parseInt(u,10))}},us=class{constructor(e,s){this.app=e,this.storageKey=s,this.bg=M("div","bg",Kr,void 0,"__or_ut_bg"),this.container=M("div","container",Jr,void 0,"__or_ut_ct"),this.widgetGuidelinesVisible=!0,this.widgetTasksVisible=!1,this.widgetVisible=!0,this.isActive=!1,this.descriptionSection=null,this.taskSection=null,this.endSection=null,this.stopButton=null,this.stopButtonContainer=null,this.test=null,this.testId=null,this.signalManager=null,this.getTest=(o,c,a)=>{this.testId=o;let l=this.app.options.ingestPoint;return fetch(`${l}/v1/web/uxt/test/${o}`,{headers:{Authorization:`Bearer ${c}`}}).then(u=>u.json()).then(({test:u})=>{this.isActive=!0,this.test=u,this.signalManager=new cs(this.app.options.ingestPoint,()=>this.app.timestamp(),c,o,this.storageKey,(h,f)=>this.app.localStorage.setItem(h,f),h=>this.app.localStorage.removeItem(h),h=>this.app.localStorage.getItem(h),()=>this.app.getSessionID()),this.createGreeting(u.title,u.reqMic,u.reqCamera),a&&((u.reqMic||u.reqCamera)&&this.userRecorder.startRecording(30,bn.Standard,u.reqMic,u.reqCamera),this.showWidget(u.description,u.tasks,!0),this.showTaskSection())}).then(()=>o).catch(u=>{console.log("OR: Error fetching test",u)})},this.hideTaskSection=()=>!1,this.showTaskSection=()=>!0,this.collapseWidget=()=>!1,this.removeGreeting=()=>!1,this.toggleDescriptionVisibility=()=>{},this.currentTaskIndex=0,this.userRecorder=new rs(e);let n=this.app.getSessionID(),i=this.app.localStorage.getItem(as);n!==i&&(this.app.localStorage.removeItem(this.storageKey),this.app.localStorage.removeItem(as),this.app.localStorage.removeItem(po),this.app.localStorage.removeItem(os),this.app.localStorage.removeItem(Xe));let r=this.app.localStorage.getItem(os);r&&(this.currentTaskIndex=parseInt(r,10))}getTestId(){return this.testId}createGreeting(e,s,n){let i=M("div","title",Yr,e),r=M("div","description",Qr,`Welcome, you're here to help us improve, not to be judged. Your insights matter! 5 6\u{1F4F9} We're recording this browser tab to learn from your experience. 7\u{1F3A4} Please enable mic and camera if asked, to give us a complete picture.`),o=M("div","button",Zr,"Read guidelines to begin");this.removeGreeting=()=>((s||n)&&this.userRecorder.startRecording(30,bn.Standard,s,n),this.container.removeChild(o),this.container.removeChild(r),this.container.removeChild(i),!1),o.onclick=()=>{this.removeGreeting();let c=this.signalManager?.getDurations();c&&this.signalManager&&(c.testStart=this.app.timestamp(),this.signalManager.setDurations(c)),this.signalManager?.signalTest("begin"),this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,je),this.showWidget(this.test?.guidelines||"",this.test?.tasks||[])},this.container.append(i,r,o),this.bg.appendChild(this.container),document.body.appendChild(this.bg)}showWidget(e,s,n){this.container.innerHTML="",Object.assign(this.bg.style,{position:"fixed",zIndex:99999999999999,right:"8px",left:"unset",width:"fit-content",top:"8px",height:"fit-content",background:"unset",display:"unset",alignItems:"unset",justifyContent:"unset"});let i=this.createTitleSection();this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,je);let r=this.createDescriptionSection(e),o=this.createTasksSection(s),c=M("div","stop_bn_or",dn,"Abort Session"),a=M("div","stop_ct_or",{fontSize:"13px!important"});a.style.fontSize="13px",a.append(c),this.container.append(i,r,o,a),this.taskSection=o,this.descriptionSection=r,this.stopButton=c,this.stopButtonContainer=a,c.onclick=()=>{this.userRecorder.discard(),this.signalManager?.signalTest("skipped"),document.body.removeChild(this.bg),window.close()},n?this.toggleDescriptionVisibility():this.hideTaskSection()}createTitleSection(){let e=M("div","title",eo),s=uo(),n=M("div","title_text",{maxWidth:"19rem",overflow:"hidden",textOverflow:"ellipsis",width:"100%",fontSize:16,lineHeight:"auto",cursor:"pointer"},this.test?.title),i=lo();e.append(s,n,i);let r=c=>(this.widgetVisible=c,this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,this.widgetVisible?je:{border:"none",background:"none",padding:0}),this.taskSection&&Object.assign(this.taskSection.style,this.widgetVisible?Te:{display:"none"}),this.descriptionSection&&Object.assign(this.descriptionSection.style,this.widgetVisible?Te:{display:"none"}),this.endSection&&Object.assign(this.endSection.style,this.widgetVisible?Te:{display:"none"}),this.stopButton&&Object.assign(this.stopButton.style,this.widgetVisible?dn:{display:"none"}),c),o=()=>{Object.assign(i.style,{transform:this.widgetVisible?"rotate(0deg)":"rotate(180deg)"}),r(!this.widgetVisible)};return n.onclick=o,i.onclick=o,co(this.bg,s),this.collapseWidget=()=>r(!1),e}createDescriptionSection(e){let s=M("div","description_section_or",Te),n=M("div","description_s_title_or",ln),i=M("div","title",{fontSize:13,fontWeight:500,lineHeight:"auto"},"Introduction & Guidelines"),r=M("div","icon",hn,"-"),o=M("div","content",Se),c=M("div","text_description",{maxHeight:"250px",overflowY:"auto",whiteSpace:"pre-wrap",fontSize:13,color:"#454545",lineHeight:"auto"});c.innerHTML=e;let a=M("div","button_begin_or",fn,"Begin Test");n.append(i,r),o.append(c,a),s.append(n,o);let l=()=>{this.widgetGuidelinesVisible=!this.widgetGuidelinesVisible,r.textContent=this.widgetGuidelinesVisible?"-":"+",Object.assign(o.style,this.widgetGuidelinesVisible?Se:{display:"none"})};return n.onclick=l,this.toggleDescriptionVisibility=()=>{this.widgetGuidelinesVisible=!1,r.textContent=this.widgetGuidelinesVisible?"-":"+",Object.assign(o.style,this.widgetGuidelinesVisible?Se:{display:"none"}),o.removeChild(a)},a.onclick=()=>
7{if(l(),this.test){let u=this.signalManager?.getDurations(),h=u?u.tasks.findIndex(f=>this.test&&f.taskId===this.test.tasks[0].task_id):null;u&&h===-1&&(u.tasks.push({taskId:this.test.tasks[0].task_id,started:this.app.timestamp()}),this.signalManager?.setDurations(u)),this.signalManager?.signalTask(this.test.tasks[0].task_id,"begin")}this.showTaskSection(),o.removeChild(a)},s}createTasksSection(e){this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,je);let s=M("div","task_section_or",Te),n=M("div","description_t_title_or",ln),i=M("div","title",{fontSize:"13px",fontWeight:"500",lineHeight:"auto"},"Tasks"),r=M("div","icon",hn,"-"),o=M("div","content",Se),c=M("div","pagination",so),a=M("div","taskCard",gn),l=M("div","taskText",mn),u=M("div","taskDescription",io),h=M("div","taskButtons",oo),f=M("div","taskText",mn);f.textContent="Your answer";let g=M("textarea","taskDescription",{resize:"vertical"}),S=M("div","inputArea",gn);S.append(f,g);let m=M("div","closePanelButton",Bi,"Collapse Panel"),k=M("div","nextButton",ro,"Done, Next");n.append(i,r),a.append(l,u),h.append(m,k),o.append(c,a,S,h),s.append(n,o);let I=()=>{let p=e[this.currentTaskIndex];l.textContent=p.title,u.textContent=p.description,p.allow_typing?S.style.display="flex":S.style.display="none"};e.forEach((p,T)=>{let d=M("span",`or_task_${T}`,{outline:"1px solid #efefef",fontSize:"13px",height:"24px",width:"24px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em"},(T+1).toString());d.id=`or_task_${T}`,c.append(d)});let N=()=>{this.widgetTasksVisible=!this.widgetTasksVisible,r.textContent=this.widgetTasksVisible?"-":"+",Object.assign(o.style,this.widgetTasksVisible?Se:{display:"none"})};this.hideTaskSection=()=>(r.textContent="+",Object.assign(o.style,{display:"none"}),this.widgetTasksVisible=!1,!1),this.showTaskSection=()=>(r.textContent="-",Object.assign(o.style,Se),this.widgetTasksVisible=!0,!0);let y=()=>{let p=document.getElementById(`or_task_${this.currentTaskIndex}`);p&&Object.assign(p.style,pn);for(let T=0;T<this.currentTaskIndex;T++){let d=document.getElementById(`or_task_${T}`);d&&Object.assign(d.style,no)}};return n.onclick=N,m.onclick=this.collapseWidget,k.onclick=()=>{let p=e[this.currentTaskIndex].allow_typing?g.value:void 0;if(g.value="",this.signalManager?.signalTask(e[this.currentTaskIndex].task_id,"done",p),this.currentTaskIndex<e.length-1){this.currentTaskIndex++,I();let T=this.signalManager?.getDurations();T&&T.tasks.findIndex(d=>d.taskId===e[this.currentTaskIndex].task_id)===-1&&(T.tasks.push({taskId:e[this.currentTaskIndex].task_id,started:this.app.timestamp()}),this.signalManager?.setDurations(T)),this.signalManager?.signalTask(e[this.currentTaskIndex].task_id,"begin"),y()}else this.showEndSection();this.app.localStorage.setItem("or_uxt_task_index",this.currentTaskIndex.toString())},setTimeout(()=>{let p=document.getElementById("or_task_0");p&&Object.assign(p.style,pn),I(),y()},1),s}showEndSection(){let e=!0;this.signalManager?.signalTest("done");let s=M("div","end_section_or",to),n=M("div","end_title_or",{fontSize:"1.25rem",fontWeight:"500"},"Thank you! \u{1F44D}"),i=M("div","end_description_or",{},this.test?.conclusion??`Thank you for participating in our usability test. Your feedback has been captured and will be used to enhance our website. 8 9We appreciate your time and valuable input.`),r=M("div","end_button_or",fn,"Submitting Feedback"),o=fo();r.appendChild(o),this.test?.reqMic||this.test?.reqCamera?this.userRecorder.sendToAPI().then(()=>{r.removeChild(o),r.textContent="End Session",e=!1}).catch(c=>{console.error(c),r.removeChild(o),r.textContent="End Session",e=!1}):(r.removeChild(o),r.textContent="End Session",e=!1),this.taskSection&&this.container.removeChild(this.taskSection),this.descriptionSection&&this.container.removeChild(this.descriptionSection),this.stopButton&&this.stopButtonContainer&&this.container.removeChild(this.stopButtonContainer),r.oncl
9ick=()=>{e||(window.close(),document.body.removeChild(this.bg))},s.append(n,i,r),this.endSection=s,this.container.append(s)}};function Pi(t){return!!t&&t.nodeType!=null}function ls(t){return t.namespaceURI==="http://www.w3.org/2000/svg"||t.localName==="svg"}function go(t){return t.localName==="use"}function Z(t){return t.nodeType===Node.ELEMENT_NODE}function mo(t){return t.nodeType===Node.COMMENT_NODE}function ct(t){return t.nodeType===Node.TEXT_NODE}function ut(t){return t.nodeType===Node.DOCUMENT_NODE}function vt(t){return t.nodeType===Node.DOCUMENT_NODE||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function z(t,e){return t.localName===e}var hs=class{constructor(e,s){this.app=e,this.options=s,this.snapshots={},this.intervals=[],this.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=n=>{let i=this.app.nodes.getID(n);if(!i||!z(n,"canvas")||this.app.sanitizer.isObscured(i)||this.app.sanitizer.isHidden(i)||!z(n,"canvas")||this.snapshots[i])return;new IntersectionObserver(c=>{c.forEach(a=>{a.isIntersecting&&(a.target?this.snapshots[i]&&this.snapshots[i].createdAt?this.snapshots[i].paused=!1:this.recordCanvas(a.target,i):this.snapshots[i]&&(this.snapshots[i].paused=!0))})}).observe(n)},this.recordCanvas=(n,i)=>{let r=this.app.timestamp();this.snapshots[i]={images:[],createdAt:r,paused:!1,dummy:document.createElement("canvas")};let o=Mi(i.toString(),r);this.app.send(o);let c=l=>{bo(l,this.options.quality,this.snapshots[i].dummy,this.options.fixedScaling,this.fileExt,u=>{if(u){if(!this.snapshots[i])return this.app.debug.warn("Canvas not present in snapshots after capture:",this.snapshots,i);this.snapshots[i].images.push({id:this.app.timestamp(),data:u}),this.snapshots[i].images.length>9&&(this.sendSnaps(this.snapshots[i].images,i,this.snapshots[i].createdAt),this.snapshots[i].images=[])}})},a=setInterval(()=>{let l=this.app.nodes.getID(n),u=l?this.app.nodes.getNode(l):void 0;if(!this.snapshots[i]){this.app.debug.log("Canvas is not present in {snapshots}"),clearInterval(a);return}if(!u||!z(u,"canvas")||u!==n){this.app.debug.log("Canvas element not in sync",u,n),clearInterval(a);return}else this.snapshots[i].paused||(this.options.useAnimationFrame?requestAnimationFrame(()=>{c(u)}):c(u))},this.interval);this.intervals.push(a)},this.fileExt=s.fileExt??"webp",this.interval=1e3/s.fps}startTracking(){setTimeout(()=>{this.app.nodes.scanTree(this.captureCanvas),this.app.nodes.attachNodeCallback(this.captureCanvas)},250)}sendSnaps(e,s,n){if(Object.keys(this.snapshots).length===0)return;let i=new FormData;e.forEach(o=>{let c=o.data;c&&(i.append("snapshot",c,`${n}_${s}_${o.id}.${this.fileExt}`),this.options.isDebug&&yo(c,`${n}_${s}_${o.id}.${this.fileExt}`))});let r=()=>{this.app.debug.log("Restarting tracker; token expired"),this.app.stop(!1),setTimeout(()=>{this.app.start({},!0)},250)};fetch(this.app.options.ingestPoint+"/v1/web/images",{method:"POST",headers:{Authorization:`Bearer ${this.app.session.getSessionToken()??""}`},body:i}).then(o=>o.status===401?r():!0).catch(o=>{this.app.debug.error("error saving canvas",o)})}clear(){this.intervals.forEach(e=>clearInterval(e)),this.snapshots={}}},yn={low:.35,medium:.55,high:.8};function bo(t,e="medium",s,n=!1,i,r){let o=`image/${i}`;if(n){let c=window.devicePixelRatio||1;s.width=t.width/c,s.height=t.height/c;let a=s.getContext("2d");if(!a)return"";a.clearRect(0,0,s.width,s.height),a.drawImage(t,0,0,s.width,s.height),s.toBlob(r,o,yn[e])}else t.toBlob(r,o,yn[e])}function yo(t,e){let s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=e,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}var Ie={Verbose:5,Log:4,Warnings:3,Errors:2,Silent:0},fs=class{constructor(e=Ie.Silent){this.shouldLog=s=>this.level>=s,this.info=(...s)=>{this.shouldLog(Ie.Verbose)&&console.info(...s)},this.log=(...s)=>{this.shouldLog(Ie.Log)&&console.log(...s)},this.warn=(...s)=>{this.shouldLog(Ie.Warnings)&&console.warn(...s)},this.error=(...s)=>{this.shouldLog(Ie.Errors)&&console.error(...s)},this.level=e}},So=1e3;function vo(t,e,s){let n=t.entries();function i(){let r=[],o=n.next();for(;!o.done&&r.length<e;)r.push(o.value),o=n.next();r.length>0&&(r.forEach(([c,a])=>{a&&s(a)}),setTimeout(i,50))}i()}function wo(t){try{if(!t.isConnected)return[!1,"not connected"];let e=t.nodeType===Node.DOCUMENT_NODE,s=e?t.defaultView:t.ownerDocument?.defaultView,n=e?t:t.ownerDocument;return s?s.closed?[!1,"window closed"]:n?.documentElement.isConnected?[!0,"ok"]:[!1,"documentElement not connected"]:[!1,"no window"]}catch(e){return[!1,e]}}var ko={interval:So*30,batchSize:2500,enabled:!0},ds=class{constructor(e,s,n){this.nodes=e,this.unregisterNode=s,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{vo(this.nodes,this.options.batchSize,i=>{wo(i)[0]||this.unregisterNode(i)})},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval)},this.options=q(q({},ko),n)}},ps=class{constructor(e){this.nodes=new Map,this.totalNodeAmount=0,this.nodeCallbacks=[],this.elementListeners=new Map,this.nextNodeId=0,this.attachNodeCallback=s=>this.nodeCallbacks.push(s),this.scanTree=s=>
9{this.nodes.forEach(n=>n?s(n):void 0)},this.attachNodeListener=(s,n,i,r=!0)=>{let o=this.getID(s);if(o===void 0)return;ni(s,n,i,r,this.forceNgOff);let c=this.elementListeners.get(o);c===void 0&&(c=[],this.elementListeners.set(o,c)),c.push([n,i,r])},this.unregisterNode=s=>{let n=s[this.node_id];if(n!==void 0){s[this.node_id]=void 0,delete s[this.node_id],this.nodes.delete(n);let i=this.elementListeners.get(n);i!==void 0&&(this.elementListeners.delete(n),i.forEach(r=>ii(s,r[0],r[1],r[2],this.forceNgOff))),this.totalNodeAmount--}return n},this.node_id=e.node_id,this.forceNgOff=e.forceNgOff,this.maintainer=new ds(this.nodes,this.unregisterNode,e.maintainer),this.maintainer.start()}syntheticMode(e){let s=Number.MAX_SAFE_INTEGER,i=99999999*e;if(i>s)throw new Error("Placeholder id overflow");this.nextNodeId=i}registerNode(e){let s=e[this.node_id],n=s===void 0;return n&&(s=this.nextNodeId,this.totalNodeAmount++,this.nextNodeId++,this.nodes.set(s,e),e[this.node_id]=s),[s,n]}cleanTree(){for(let[e,s]of this.nodes)s&&!document.contains(s)&&this.unregisterNode(s)}callNodeCallbacks(e,s){this.nodeCallbacks.forEach(n=>n(e,s))}getID(e){if(e)return e[this.node_id]}getNode(e){return this.nodes.get(e)}getNodeCount(){return this.totalNodeAmount}clear(){for(let[e,s]of this.nodes)s&&this.unregisterNode(s);this.nextNodeId=0,this.nodes.clear()}},To=1e6*99;function Io(t,e,s,n,i,r,o,c,a){let l=c?null:n();c||r(l,e);let u=t.sheet;if(u&&!o)try{let d=g(u);if(d){h(d);return}}catch{}t.href&&fetch(t.href).then(d=>{if(!d.ok)throw new Error(`response status ${d.status}`);return d.text()}).then(d=>{c&&a?a(d,To++):h(d)}).catch(d=>{console.error(`OpenReplay: Failed to fetch CSS from ${t.href}:`,d)});function h(d){d=d.replace(/\/\*[\s\S]*?\*\//g,"");let w=f(d);for(let b=0;b<w.length;b++)i(l,w[b],b,s)}function f(d){let w=[],b=!1,v=!1,O="",A=0,_="";for(let C=0;C<d.length;C++){let E=d[C],x=d[C+1]||"";if(!v&&E==="/"&&x==="*"){b=!0,C++;continue}if(b){E==="*"&&x==="/"&&(b=!1,C++);continue}if(!v&&(E==='"'||E==="'")){v=!0,O=E,_+=E;continue}if(v){_+=E,E===O&&d[C-1]!=="\\"&&(v=!1);continue}_+=E,E==="{"?A++:E==="}"&&(A--,A===0&&(w.push(_.trim()),_=""))}return _.trim()&&w.push(_.trim()),w}function g(d){try{let w=d.rules||d.cssRules;if(!w)return null;let b=d.href;!b&&d.ownerNode&&d.ownerNode.ownerDocument&&(b=d.ownerNode.ownerDocument.location.href);let v=Array.from(w,O=>S(O,b)).join("");return m(v)}catch{return null}}function S(d,w){if(N(d)){let b;try{b=g(d.styleSheet)||k(d)}catch{b=d.cssText}return d.styleSheet.href?p(b,d.styleSheet.href):b}else{let b=d.cssText;return y(d)&&d.selectorText.includes(":")&&(b=I(b)),w?p(b,w):b}}function m(d){return d.includes(" background-clip: text;")&&!d.includes(" -webkit-background-clip: text;")&&(d=d.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),d}function k(d){let{cssText:w}=d;if(w.split('"').length<3)return w;let b=["@import",`url(${JSON.stringify(d.href)})`];return d.layerName===""?b.push("layer"):d.layerName&&b.push(`layer(${d.layerName})`),d.supportsText&&b.push(`supports(${d.supportsText})`),d.media.length&&b.push(d.media.mediaText),b.join(" ")+";"}function I(d){let w=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return d.replace(w,"$1\\$2")}function N(d){return"styleSheet"in d}function y(d){return"selectorText"in d}function p(d,w){if(!d)return"";let b=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?:[a-z+]+:)?\/\//i,O=/^www\..*/i,A=/^(data:)([^,]*),(.*)/i;return d.replace(b,(_,C,E,x,F,B)=>{let R=E||F||B,P=C||x||"";if(!R)return _;if(v.test(R)||O.test(R))return`url(${P}${R}${P})`;if(A.test(R))return`url(${P}${R}${P})`;if(R[0]==="/")return`url(${P}${T(w)+R}${P})`;let ce=w.split("/"),V=R.split("/");ce.pop();for(let se of V)se!=="."&&(se===".."?ce.pop():ce.push(se));return`url(${P}${ce.join("/")}${P})`})}function T(d){let w="";return d.indexOf("//")>-1?w=d.split("/").slice(0,3).join("/"):w=d.split("/")[0],w=w.split("?")[0],w}}function Sn(t){return vt(t)&&!!t.adoptedStyleSheets}var Co=15;function qs(){return Co++}var ze=new Map;function Eo(t){if(t===null||!Sn(document))return;let e=new Map,s=new Map,n=o=>setTimeout(()=>{let c=t.nodes.getID(o);if(o===document&&(c=0),c===void 0)return;let a=s.get(c);a||(a=[]);let l=[],u=o.adoptedStyleSheets;if(u&&Symbol.iterator in u)for(let h of u){let f=e.get(h),g=!f;if(f||(f=qs(),e.set(h,f)),a.includes(f)||t.send(St(f,c)),g){let S=h.cssRules;for(let m=0;m<S.length;m++)t.send(pe(f,S[m].cssText,m,t.getBaseHref()))}l.push(f)}if(Symbol.iterator in a)for(let h of a)l.includes(h)||t.send(_i(h,c));s.set(c,l)},20);function i(o){let c=Object.getOwnPropertyDescriptor(o,"adoptedStyleSheets");c&&Object.defineProperty(o,"adoptedStyleSheets",J(q({},c),{set:function(a){let l=c.set.call(this,a);return n(this),l}}))}let r=o=>{if(o.__openreplay_adpss_patched__)return;o.__openreplay_adpss_patched__=!0,i(o.Document.prototype),i(o.ShadowRoot.prototype);let{replace:c,replaceSync:a}=o.CSSStyleSheet.prototype;o.CSSStyleSheet.prototype.replace=function(l){return c.call(this,l).then(u=>{let h=e.get(this);return h&&t.send(es(h,l,t.getBaseHref())),u})},o.CSSStyleSheet.prototype.replaceSync=function(l){let u=e.get(this);return u&&t.send(es(u,l,t.getBaseHref())),a.call(this,l)}};r(window),t.observer.attachContextCallback(t.safe(r)),t.attachStopCallback(()=>{e.clear(),s.clear()}),t.attachStartCallback(()=>{n(document)}),t.nodes.attachNodeCallback(o=>{Sn(o)&&n(o)})}var qe={},he={};function No(t,e,s){return U(this,null,function*(){try{let n=t.getAttribute("xlink:href")||t.getAttribute("href");if(!n){console.debug("Openreplay: xlink:href or href not found on <use>.");return}let[i,r]=n.split("#");if(!i&&r){let a=document.querySelector(n);if(a){let l=` 10 <svg xmlns="http://www.w3.org/2000/svg" viewBox="${a.getAttribute("viewBox")||"0 0 24 24"}"> 11 ${a.innerHTML} 12 </svg> 13 `;return qe[r]=l,l}else{console.warn("Openreplay: Sprite symbol not found in the document.");return}}if(!i&&!r){console.warn("Openreplay: Invalid xlink:href or href found on <use>.");return}if(qe[r])return qe[r];let o;if(he[i])he[i]===1?yield new Promise(a=>{let l=0,u=setInterval(()=>{l>100&&(clearInterval(u),a(!1)),he[i]!==1?(o=he[i],clearInterval(u),a(!0)):l++},100)}):o=he[i]??'<svg xmlns="http://www.w3.org/2000/svg"></svg>';else{he[i]=1;let l=yield(yield fetch(i)).text();
13o=s.parseFromString(l,"image/svg+xml"),he[i]=o}let c=o.getElementById(r);if(!c)return console.debug("Openreplay: Symbol not found in SVG."),"";if(e==="svgtext"){let a=` 14 <svg xmlns="http://www.w3.org/2000/svg" viewBox="${c.getAttribute("viewBox")||"0 0 24 24"}"> 15 ${c.innerHTML} 16 </svg> 17 `;return qe[r]=a,a}console.debug(`Openreplay: Unknown mode: ${e}. Use "inline" or "dataurl".`)}catch(n){console.error("Openreplay: Error processing <use> element:",n)}})}function Ge(t){if(mo(t))return!0;if(ct(t))return!1;if(!Z(t))return!0;let e=t.tagName.toUpperCase();if(e==="LINK"){let s=t.getAttribute("rel"),n=t.getAttribute("as");return!(s?.includes("stylesheet")||n==="style"||n==="font")}return e==="SCRIPT"||e==="NOSCRIPT"||e==="META"||e==="TITLE"||e==="BASE"}function Dt(t){return vt(t)?!0:!Ge(t)}var re=(function(t){return t[t.New=0]="New",t[t.Removed=1]="Removed",t[t.Changed=2]="Changed",t})(re||{}),Fe=class{constructor(e,s=!1,n={}){this.app=e,this.isTopContext=s,this.commited=[],this.recents=new Map,this.indexes=[],this.attributesMap=new Map,this.textSet=new Set,this.disableSprites=!1,this.inlineRemoteCss=!1,this.inlinerOptions=void 0,this.domParser=new DOMParser,this.disableSprites=!!n.disableSprites,this.inlineRemoteCss=!!n.inlineRemoteCss,this.inlinerOptions=n.inlinerOptions,this.observer=si(this.app.safe(i=>{for(let r of i){let o=r.target,c=r.type;if(!Dt(o))continue;if(c==="childList"){for(let l=0;l<r.removedNodes.length;l++)Dt(r.removedNodes[l])&&this.bindNode(r.removedNodes[l]);for(let l=0;l<r.addedNodes.length;l++)this.bindTree(r.addedNodes[l]);continue}let a=this.app.nodes.getID(o);if(a!==void 0){if(this.recents.has(a)||this.recents.set(a,re.Changed),c==="attributes"){let l=r.attributeName;if(l===null)continue;let u=this.attributesMap.get(a);u===void 0&&this.attributesMap.set(a,u=new Set),u.add(l);continue}if(c==="characterData"){this.textSet.add(a);continue}}}this.commitNodes()}),this.app.options.forceNgOff)}clear(){this.commited.length=0,this.recents.clear(),this.indexes.length=1,this.attributesMap.clear(),this.textSet.clear()}handleIframeSrcChange(e){let s=e.contentDocument;if(s&&this.app.nodes.getID(s)!==void 0){let i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:u=>Ge(u)||this.app.nodes.getID(u)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),r=0,o=this.app.nodes.getNodeCount(),c=e.contentDocument,a=this.app.nodes.unregisterNode.bind(this.app.nodes);for(;i.nextNode();)c.contains(i.currentNode)||(r+=1,a(i.currentNode));let l=Math.floor(r/o*100);l>30&&this.app.send(ss(l))}}sendNodeAttribute(e,s,n,i){if(ls(s)){if(n.startsWith("xlink:")&&(n=n.substring(6)),i===null&&this.app.send(Kt(e,n)),go(s)&&n==="href"&&!this.disableSprites){No(s,"svgtext",this.domParser).then(r=>{r&&this.app.send(hi(e,n,`_$OPENREPLAY_SPRITE$_${r}`))}).catch(r=>{console.error("Openreplay: Error parsing <use> element:",r)});return}n==="href"?(i.length>1e5&&(i=""),this.app.send(it(e,n,i,this.app.getBaseHref()))):this.app.attributeSender.sendSetAttribute(e,n,i);return}if(!(n==="src"||n==="srcset"||n==="integrity"||n==="crossorigin"||n==="autocomplete"||n.substring(0,2)==="on")&&!(n==="value"&&z(s,"input")&&s.type!=="button"&&s.type!=="reset"&&s.type!=="submit")){if(i===null){this.app.send(Kt(e,n));return}if(n==="style"||n==="href"&&z(s,"link")){if("rel"in s&&s.rel==="stylesheet"&&this.inlineRemoteCss){setTimeout(()=>{Io(s,e,this.app.getBaseHref(),qs,(r,o,c,a)=>{this.app.send(pe(r,o,c,a))},(r,o)=>{this.app.send(St(r,o))},this.inlinerOptions?.forceFetch,this.inlinerOptions?.forcePlain,(r,o)=>{this.app.send(Gt(o,e,0)),setTimeout(()=>{this.app.send(Zt(o,r,this.app.getBaseHref()))},10)})},0);return}this.app.send(it(e,n,i,this.app.getBaseHref()));return}(n==="href"||i.length>1e5)&&(i=""),["alt","placeholder"].includes(n)&&this.app.sanitizer.privateMode&&(i=i.replaceAll(/./g,"*")),this.app.attributeSender.sendSetAttribute(e,n,i)}}sendNodeData(e,s,n){if(z(s,"style")){this.app.send(Zt(e,n,this.app.getBaseHref()));return}n=this.app.sanitizer.sanitize(e,n),this.app.send(fi(e,n))}bindNode(e){let[s,n]=this.app.nodes.registerNode(e);n?this.recents.set(s,re.New):this.recents.get(s)!==re.New&&this.recents.set(s,re.Removed)}bindTree(e){if(!Dt(e))return;this.bindNode(e);let s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:n=>(this.app.nodes.getID(n)!==void 0&&this.app.debug.info("! Node is already bound",n),Ge(n)||this.app.nodes.getID(n)!==void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT)},!1);for(;s.nextNode();)this.bindNode(s.currentNode)}unbindTree(e){let s=this.app.nodes.unregisterNode(e);if(s!==void 0&&this.recents.get(s)===re.Removed){this.app.send(li(s));let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:c=>Ge(c)||this.app.nodes.getID(c)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),i=0,r=this.app.nodes.getNodeCount();for(;n.nextNode();)i+=1,this.app.nodes.unregisterNode(n.currentNode);let o=Math.floor(i/r*100);o>30&&this.app.send(ss(o))}}_commitNode(e,s){if(vt(s))return!0;let n=s.assignedSlot?s.assignedSlot:s.parentNode,i;if(!z(s,"html")||!this.isTopContext){if(n===null)return this.unbindTree(s),!1;if(i=this.app.nodes.getID(n),i===void 0)return this.unbindTree(s),!1;if(!this.commitNode(i))return this.unbindTree(s),!1;if(this.app.sanitizer.handleNode(e,i,s),this.app.sanitizer.isHidden(i))return!1}let r=s.previousSibling;for(;r!==null;){let u=this.app.nodes.getID(r);if(u!==void 0){this.commitNode(u),this.indexes[e]=this.indexes[u]+1;break}r=r.previousSibling}r===null&&(this.indexes[e]=0);let o=this.recents.get(e),c=o===re.New,a=this.indexes[e];if(a===void 0)throw"commitNode: missing node index";if(c){if(Z(s)){let u=s;if(i!==void 0){if(this.app.sanitizer.isHidden(e)){let h=u.clientWidth,f=u.clientHeight;u=s.cloneNode(),u.style.width=`${h}px`,u.style.height=`${f}px`}"rel"in u&&u.rel==="stylesheet"&&this.inlineRemoteCss?this.app.send(Xt(e,i,a,"STYLE",!1)):this.app.send(Xt(e,i,a,u.tagName,ls(s)))}for(let h=0;h<u.attributes.length;h++){let f=u.attributes[h];this.sendNodeAttribute(e,u,f.nodeName,f.value)}}else ct(s)&&(this.app.send(Gt(e,i,a)),this.sendNodeData(e,n,s.data));return!0}o===re.Removed&&i!==void 0&&this.app.send(ui(e,i,a));let l=this.attributesMap.get(e);if(l!==void 0){if(!Z(s))throw"commitNode: node is not an element";for(let u of l)this.sendNodeAttribute(e,s,u,s.getAttribute(u))}
17if(this.textSet.has(e)){if(!ct(s))throw"commitNode: node is not a text";this.sendNodeData(e,n,s.data)}return!0}commitNode(e){let s=this.app.nodes.getNode(e);if(!s)return!1;let n=this.commited[e];return n!==void 0?n:this.commited[e]=this._commitNode(e,s)}commitNodes(e=!1){let s;for(let[n,i]of this.recents.entries())this.commitNode(n),i===re.New&&(s=this.app.nodes.getNode(n))&&this.app.nodes.callNodeCallbacks(s,e);this.clear()}observeRoot(e,s,n=e){this.observer.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1}),this.bindTree(n),s(this.app.nodes.getID(e)),this.commitNodes(!0)}disconnect(){this.observer.disconnect(),this.clear()}},lt=class extends Fe{observe(e){let s=e.contentDocument,n=this.app.nodes.getID(e);!s||n===void 0||this.observeRoot(s,i=>{if(i===void 0){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.docId=i,this.app.send(rt(n,i))})}syntheticObserve(e,s){this.observeRoot(s,n=>{if(n===void 0){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.app.send(rt(e,n))})}},gs=class extends Fe{observe(e){let s=e.shadowRoot,n=this.app.nodes.getID(e);!s||n===void 0||this.observeRoot(s,i=>{if(i===void 0){this.app.debug.error("OpenReplay: Shadow Root was not bound");return}this.app.send(rt(n,i))})}},ms=class{constructor(){this.states=new WeakMap}calcOffset(e){let s=0,n=0;if(e.parent&&([s,n]=this.calcOffset(e.parent)),!e.offset){let{left:o,top:c}=e.iFrame.getBoundingClientRect();e.offset=[o,c]}let[i,r]=e.offset;return[s+i,n+r]}getDocumentOffset(e){let s=this.states.get(e);return s?this.calcOffset(s):[0,0]}observe(e){let s=e.contentDocument;if(!s)return;let n=e.ownerDocument,i=this.states.get(n),r={offset:null,iFrame:e,parent:i||null,clear:()=>{n.removeEventListener("scroll",o),n.defaultView?.removeEventListener("resize",o)}},o=()=>{r.offset=null};n.addEventListener("scroll",o),n.defaultView?.addEventListener("resize",o),this.states.set(s,r)}clear(){this.states=new WeakMap}},_e=(function(t){return t[t.Disabled=0]="Disabled",t[t.Inline=1]="Inline",t[t.InlineFetched=2]="InlineFetched",t[t.PlainFetched=3]="PlainFetched",t})(_e||{});function xo(t){switch(t){case _e.Inline:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!1,forcePlain:!1}};case _e.InlineFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!1}};case _e.PlainFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!0}};case _e.Disabled:default:return{inlineRemoteCss:!1,inlinerOptions:{forceFetch:!1,forcePlain:!1}}}}var Ot=D?Element.prototype.attachShadow:()=>new ShadowRoot,bs=class extends Fe{constructor(e){let s=Object.assign({captureIFrames:!0,disableSprites:!1,inlineCss:0},e.options),n=q({disableSprites:s.disableSprites},xo(s.inlineCss));super(e.app,!0,n),this.iframeOffsets=new ms,this.contextCallbacks=[],this.contextsSet=new WeakSet,this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.docObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.app=e.app,this.options=s,this.app.nodes.attachNodeCallback(i=>{z(i,"iframe")&&(this.options.captureIFrames&&!ae(i,"obscured")||ae(i,"capture"))&&this.handleIframe(i)}),this.app.nodes.attachNodeCallback(i=>{Z(i)&&i.shadowRoot!==null&&this.handleShadowRoot(i.shadowRoot)})}attachContextCallback(e){this.contextCallbacks.push(e)}getDocumentOffset(e){return this.iframeOffsets.getDocumentOffset(e)}handleIframe(e){let s=this.app.safe(()=>setTimeout(()=>{let n=this.app.nodes.getID(e);if(n===void 0||!gr(e))return;let i=e.contentWindow,r=e.contentDocument;if(!r){this.app.debug.warn("no doc for iframe found",e);return}if(r&&this.docObservers.has(r)){this.app.debug.info("doc already observed for",n);return}let o=new lt(this.app,!1,{});this.iframeObservers.set(e,o),this.docObservers.set(r,o),this.iframeObserversArr.push(o),o.observe(e),this.iframeOffsets.observe(e),i&&i===i.window&&!this.contextsSet.has(i)&&(this.contextsSet.add(i),this.contextCallbacks.forEach(c=>c(i)))},250));e.addEventListener("load",s),s()}handleShadowRoot(e){let s=new gs(this.app);this.shadowRootObservers.set(e,s),s.observe(e.host)}observe(){let e=this;Element.prototype.attachShadow=function(){let s=Ot.apply(this,arguments);return e.handleShadowRoot(s),s},this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send(ci()),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement)}crossdomainObserve(e,s){let n=this;Element.prototype.attachShadow=function(){let r=Ot.apply(this,arguments);return n.handleShadowRoot(r),r},this.app.nodes.clear(),this.app.nodes.syntheticMode(s);let i=new lt(this.app);this.iframeObservers.set(window.document,i),i.syntheticObserve(e,window.document)}disconnect(){this.iframeOffsets.clear(),Element.prototype.attachShadow=Ot,this.iframeObserversArr.forEach(e
17=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}},ys=(function(t){return t[t.Plain=0]="Plain",t[t.Obscured=1]="Obscured",t[t.Hidden=2]="Hidden",t})(ys||{}),Ke=t=>t.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*"),Ss=class{constructor(e){this.obscured=new Set,this.hidden=new Set,this.app=e.app;let s={obscureTextEmails:!0,obscureTextNumbers:!1,privateMode:!1,domSanitizer:void 0};this.privateMode=e.options?.privateMode??!1,this.options=Object.assign(s,e.options)}handleNode(e,s,n){if(this.options.privateMode){if(Z(n)&&!ae(n,"unmask"))return this.obscured.add(e);if(ct(n)&&!ae(n.parentNode,"unmask"))return this.obscured.add(e)}if((this.obscured.has(s)||Z(n)&&(ae(n,"masked")||ae(n,"obscured")))&&this.obscured.add(e),(this.hidden.has(s)||Z(n)&&(ae(n,"htmlmasked")||ae(n,"hidden")))&&this.hidden.add(e),this.options.domSanitizer!==void 0&&Z(n)){let i=this.options.domSanitizer(n);i===ys.Obscured&&this.obscured.add(e),i===ys.Hidden&&this.hidden.add(e)}}sanitize(e,s){return this.obscured.has(e)?Ke(s):(this.options.obscureTextNumbers&&(s=s.replace(/\d/g,"0")),this.options.obscureTextEmails&&(s=s.replace(/^\w+([+.-]\w+)*@\w+([.-]\w+)*\.\w{2,3}$/g,n=>{let[i,r]=n.split("@"),[o,c]=r.split(".");return`${xt(i)}@${xt(o)}.${xt(c)}`})),s)}isObscured(e){return this.obscured.has(e)}isHidden(e){return this.hidden.has(e)}getInnerTextSecure(e){let s=this.app.nodes.getID(e);return s?this.sanitize(s,e.innerText):""}clear(){this.obscured.clear(),this.hidden.clear()}},vs=class{constructor(e){this.metadata={},this.userID=null,this.callbacks=[],this.timestamp=0,this.getPageNumber=()=>{let s=this.app.sessionStorage.getItem(this.options.session_pageno_key);if(s!=null)return parseInt(s)},this.incPageNo=()=>{let s=this.getPageNumber();return s===void 0?s=0:s++,this.app.sessionStorage.setItem(this.options.session_pageno_key,s.toString()),s},this.app=e.app,this.options=e.options,this.createTabId()}attachUpdateCallback(e){this.callbacks.push(e)}handleUpdate(e){e.userID==null&&delete e.userID,e.sessionID==null&&delete e.sessionID,this.callbacks.forEach(s=>s(e))}assign(e){e.userID!==void 0&&(this.userID=e.userID),e.metadata!==void 0&&Object.entries(e.metadata).forEach(([s,n])=>this.metadata[s]=n),e.sessionID!==void 0&&(this.sessionID=e.sessionID),e.timestamp!==void 0&&(this.timestamp=e.timestamp),e.projectID!==void 0&&(this.projectID=e.projectID),this.handleUpdate(e)}setMetadata(e,s){this.metadata[e]=s,this.handleUpdate({metadata:{[e]:s}})}setUserID(e){this.userID=e,this.handleUpdate({userID:e})}setUserInfo(e){this.userInfo=e}getSessionToken(){return this.token||this.app.sessionStorage.getItem(this.options.session_token_key)||void 0}setSessionToken(e){this.token=e,this.app.sessionStorage.setItem(this.options.session_token_key,e)}applySessionHash(e){let s=decodeURI(e).split("&"),n=e,i="100500";s.length==2&&([i,n]=s),!(!i||!n)&&(this.app.sessionStorage.setItem(this.options.session_token_key,n),this.app.sessionStorage.setItem(this.options.session_pageno_key,i))}getSessionHash(){let e=this.getPageNumber(),s=this.getSessionToken();if(!(e===void 0||s===void 0))return encodeURI(String(e)+"&"+s)}getTabId(){return this.tabId||this.createTabId(),this.tabId}regenerateTabId(){let e=mr(12);this.app.sessionStorage.setItem(this.options.session_tabid_key,e),this.tabId=e}createTabId(){let e=this.app.sessionStorage.getItem(this.options.session_tabid_key);e?this.tabId=e:this.regenerateTabId()}getInfo(){return{sessionID:this.sessionID,metadata:this.metadata,userID:this.userID,timestamp:this.timestamp,projectID:this.projectID}}reset(){this.app.sessionStorage.removeItem(this.options.session_token_key),this.metadata={},this.userID=null,this.sessionID=void 0,this.timestamp=0}};function _o(t,e){let s=0;return()=>{s++>=e&&(s=0,t())}}var ws=class{constructor(e){this.app=e,this.timer=null,this.callbacks=[]}attach(e,s=0,n=!0,i){i&&(e=e.bind(i)),n&&(e=this.app.safe(e)),this.callbacks.unshift(s?_o(e,s):e)-1}start(){this.timer===null&&(this.timer=setInterval(()=>
17this.callbacks.forEach(e=>{e&&e()}),30))}stop(){this.timer!==null&&(clearInterval(this.timer),this.timer=null)}},Ro='!function(){"use strict";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+"/v1/web/i",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,"$1_$2_$3");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h["Content-Encoding"]="gzip"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:"noPageNum"}_${null!=n?n:"noBatchNum"}`,{body:t,method:"POST",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:"noBatchNum"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn("OpenReplay:",e),this.retry(t,s,`${null!=i?i:"noBatchNum"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:"noBatchNum"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s="function"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const i=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 38:case 70:case 75:case 76:case 77:case 82:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 37:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3]);case 39:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 59:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6])&&this.string(t[7]);case 67:case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[0,this.timestamp],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn("OpenReplay: max message size overflow."),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if("q_end"===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn("OpenReplay: beacon size overflow. Skipping large message.",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var h;
17!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active",t[t.Stopped=4]="Stopped"}(h||(h={}));let r=null,a=null,u=h.NotActive;function o(){a&&a.finaliseBatch()}function c(){return new Promise((t=>{u=h.Stopping,null!==p&&(clearInterval(p),p=null),a&&(a.clean(),a=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{u=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(u)||(postMessage("a_stop"),c().then((()=>{postMessage("a_start")})))}let l,p=null;self.onmessage=({data:s})=>{if(null!=s){if("stop"===s)return o(),void c().then((()=>{u=h.Stopped}));if("forceFlushBatch"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void g();s.batch&&r.sendCompressed(s.batch)}if("uncompressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void g();s.batch&&r.sendUncompressed(s.batch)}return"start"===s.type?(u=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:"compress",batch:t},[t.buffer])}),s.pageNo),a=new n(s.pageNo,s.timestamp,s.url,(t=>{r&&r.push(t)}),s.tabId,(()=>postMessage({type:"queue_empty"}))),null===p&&(p=setInterval(o,1e4)),u=h.Active):"auth"===s.type?r?a?(r.authorise(s.token),void(s.beaconSizeLimit&&a.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug("OR WebWorker: writer not initialised. Received auth."),void g()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void g()):void 0}if(a){const t=a;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage("not_init"),g()}else o()}else o()}}();\n',xe="canceled",vn="or_uxt_active",Mt="or_buffer_1",ie=t=>({reason:t,success:!1}),wn=t=>J(q({},t),{success:!0}),j=(function(t){return t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Active=2]="Active",t[t.ColdStart=3]="ColdStart",t})(j||{}),Do="https://api.openreplay.com/ingest";function At(){let t=new Date().getTimezoneOffset()*-1,e=t>=0?"+":"-",s=Math.floor(Math.abs(t)/60),n=Math.abs(t)%60;return`UTC${e}${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`}var Oo=t=>new Promise(e=>setTimeout(e,t)),H={ask:"never-gonna-give-you-up",resp:"never-gonna-let-you-down",reg:"never-gonna-run-around-and-desert-you",iframeSignal:"tracker inside a child iframe",iframeId:"getting node id for child iframe",iframeBatch:"batch of messages from an iframe window",parentAlive:"signal that parent is live",killIframe:"stop tracker inside frame",startIframe:"start tracker inside frame",polling:"hello-how-are-you-im-under-the-water-please-help-me"},ks=class{constructor(e,s,n,i,r){this.signalError=i,this.insideIframe=r,this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=j.NotActive,this.version="16.3.0",this.socketMode=!1,this.compressionThreshold=24*1e3,this.bc=null,this.canvasRecorder=null,this.conditionsManager=null,this.canStart=!1,this.rootId=null,this.pageFrames=[],this.frameOderNumber=0,this.features={"feature-flags":!0,"usability-test":!0},this.emptyBatchCounter=0,this.parentActive=!1,this.checkStatus=()=>this.parentActive,this.parentCrossDomainFrameListener=a=>{let{data:l}=a;
17if(!(!l||a.source===window)){if(l.line===H.startIframe){if(this.active())return;try{this.allowAppStart(),this.start()}catch(u){console.error("children frame restart failed:",u)}}l.line===H.parentAlive&&(this.parentActive=!0),l.line===H.iframeId&&(this.parentActive=!0,this.rootId=l.id,this.session.setSessionToken(l.token),this.frameOderNumber=l.frameOrderNumber,this.debug.log("starting iframe tracking",l),this.allowAppStart()),l.line===H.killIframe&&this.active()&&this.stop()}},this.trackedFrames=[],this.crossDomainIframeListener=a=>{if(!this.active()||a.source===window)return;let{data:l}=a;if(l){if(l.line===H.iframeSignal&&(a.source?.postMessage({ping:!0,line:H.parentAlive},"*"),U(this,null,function*(){if(a.source===null)return console.error("Couldnt connect to event.source for child iframe tracking");let h=yield this.checkNodeId(a.source);if(!h){this.debug.log("Couldnt get node id for iframe",a.source);return}try{this.trackedFrames.includes(l.context)?this.debug.log("Trying to observe already added iframe; ignore if its a restart"):this.trackedFrames.push(l.context),yield this.waitStarted();let f=this.session.getSessionToken(),g=this.trackedFrames.findIndex(m=>m===l.context)+1;g===0&&this.debug.error("Couldnt get order number for iframe",l.context,this.trackedFrames);let S={line:H.iframeId,id:h,token:f,frameOrderNumber:g};this.debug.log("Got child frame signal; nodeId",h,a.source,S),a.source?.postMessage(S,"*")}catch(f){console.error(f)}})),l.line===H.iframeBatch){let h=l.messages.map(f=>{if(f[0]===20){let g=f;return this.pageFrames.forEach(S=>{if(S.contentWindow===a.source){let[m,k,I]=f,{left:N,top:y}=S.getBoundingClientRect();g=[m,k+N,I+y]}}),g}if(f[0]===68){let g=f;return this.pageFrames.forEach(S=>{if(S.contentWindow===a.source){let[m,k,I,N,y,p,T]=f,{left:d,top:w,width:b,height:v}=S.getBoundingClientRect(),O=document.documentElement.scrollWidth,A=document.documentElement.scrollHeight,_=p/100*b+d,C=T/100*v+w,E=_/O,x=C/A;g=[m,k,I,N,y,Math.round(E*1e3)/10,Math.round(x*1e3)/10]}}),g}return f});this.messages.push(...h)}if(l.line===H.polling){if(!this.pollingQueue.order.length)return;let u=this.pollingQueue.order[0];if(u&&this.pollingQueue[u].length===0){this.pollingQueue.order=this.pollingQueue.order.filter(h=>h!==u);return}this.pollingQueue[u].includes(l.context)&&(this.pollingQueue[u]=this.pollingQueue[u].filter(h=>h!==l.context),a.source?.postMessage({line:u},"*"),this.pollingQueue[u].length===0&&this.pollingQueue.order.shift())}}},this.pollingQueue={order:[]},this.addCommand=a=>{this.pollingQueue.order.push(a),this.pollingQueue[a]=[...this.trackedFrames]},this.bootChildrenFrames=()=>U(this,null,function*(){yield this.waitStarted(),this.addCommand(H.startIframe)}),this.killChildrenFrames=()=>{this.addCommand(H.killIframe)},this.signalIframeTracker=()=>{let a=this.session.getTabId();window.parent.postMessage({line:H.iframeSignal,source:a,context:this.contextId},this.options.crossdomain?.parentDomain??"*");let l=10,u=0,h=250,f=0,g=!1,S=()=>
17{if(g||this.checkStatus()){g=!0;return}window.parent.postMessage({line:H.iframeSignal,source:a,context:this.contextId},this.options.crossdomain?.parentDomain??"*"),this.debug.info("Trying to signal to parent, attempt:",u+1),u++};for(let m=0;m<l;m++){if(this.checkStatus()){g=!0;break}f+=h,setTimeout(()=>{S()},f),h*=1.5}},this.startTimeout=null,this.send=(a,l=!1)=>{this.activityState!==j.NotActive&&(this.activityState===j.ColdStart?(this.bufferedMessages1.push(a),this.singleBuffer||this.bufferedMessages2.push(a),this.conditionsManager?.processMessage(a)):this.messages.push(a),this.activityState===j.Active&&l&&this.commit())},this.coldStartCommitN=0,this.delay=0,this.attachStartCallback=(a,l=!1)=>{l&&(a=this.safe(a)),this.startCallbacks.push(a)},this.attachStopCallback=(a,l=!1)=>{l&&(a=this.safe(a)),this.stopCallbacks.push(a)},this.attachEventListener=(a,l,u,h=!0,f=!0)=>{h&&(u=this.safe(u));let g=()=>a?ni(a,l,u,f,this.options.forceNgOff):null,S=()=>a?ii(a,l,u,f,this.options.forceNgOff):null;this.attachStartCallback(g,h),this.attachStopCallback(S,h)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{this.canvasRecorder?.restartTracking()},this.flushBuffer=a=>U(this,null,function*(){return new Promise((l,u)=>{if(a.length===0){l(null);return}let h=1;for(;h<a.length&&a[h][0]!==0;)h++;cn(()=>{try{let f=a.splice(0,h);this.postToWorker(f.map(g=>[...g])),l(null)}catch(f){this._debug("flushBuffer",f),u(new Error("flushBuffer failed"))}})})}),this.onUxtCb=[],this.contextId=Math.random().toString(36).slice(2),this.projectKey=e,this.networkOptions=n.network;let o={revID:"",node_id:"__openreplay_id",session_token_key:"__openreplay_token",session_pageno_key:"__openreplay_pageno",session_reset_key:"__openreplay_reset",session_tabid_key:"__openreplay_tabid",local_uuid_key:"__openreplay_uuid",ingestPoint:Do,resourceBaseHref:null,__is_snippet:!1,__debug_report_edp:null,__debug__:Ie.Silent,localStorage:null,sessionStorage:null,forceSingleTab:!1,assistSocketHost:"",captureIFrames:!0,obscureTextEmails:!1,obscureTextNumbers:!1,disableStringDict:!1,crossdomain:{parentDomain:"*"},canvas:{disableCanvas:!1,fixedCanvasScaling:!1,__save_canvas_locally:!1,useAnimationFrame:!1},forceNgOff:!1,inlineCss:0,disableSprites:!1};if(this.options=ri(o,n),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&"BroadcastChannel"in globalThis){let a=location.hostname.split(".").slice(-2).join("_");this.bc=new BroadcastChannel(`rick_${a}`)}else this.options.forceSingleTab&&this.allowAppStart();this.revID=this.options.revID,this.localStorage=this.options.localStorage??window.localStorage,this.sessionStorage=this.options.sessionStorage??window.sessionStorage,this.sanitizer=new Ss({app:this,options:n}),this.nodes=new ps({node_id:this.options.node_id,forceNgOff:!!n.forceNgOff,maintainer:this.options.nodes?.maintainer}),this.observer=new bs({app:this,options:n}),this.ticker=new ws(this),this.ticker.attach(()=>this.commit()),this.debug=new fs(this.options.__debug__),this.session=new vs({app:this,options:this.options}),this.attributeSender=new qt({app:this,isDictDisabled:!!(this.options.disableStringDict||this.options.crossdomain?.enabled)}),this.featureFlags=new $t(this),this.tagWatcher=new is({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:a=>this.send(Ai(a))}),this.session.attachUpdateCallback(({userID:a,metadata:l})=>{a!=null&&this.send(wi(a)),l!=null&&Object.entries(l).forEach(([u,h])=>this.send(Jt(u,h)))}),s!=null&&this.session.applySessionHash(s);let c=this.session.getTabId();this.insideIframe?(window.addEventListener("message",this.parentCrossDomainFrameListener),setInterval(()=>{document.hidden||window.parent.postMessage({line:H.polling,context:this.contextId},n.crossdomain?.parentDomain??"*")},250)):(this.initWorker(),window.addEventListener("message",this.crossDomainIframeListener)),this.bc!==null&&(this.bc.postMessage({line:H.ask,source:c,context:this.contextId}),this.startTimeout=setTimeout(()=>{this.allowAppStart()},250),this.bc.onmessage=a=>{if(a.data.context!==this.contextId){if(this.debug.log(a),a.data.line===H.resp){let l=a.data.token;this.session.setSessionToken(l),this.allowAppStart()}if(a.data.line===H.reg){let l=a.data.token;this.session.regenerateTabId(),this.session.setSessionToken(l),this.allowAppStart()}if(a.data.line===H.ask){let l=this.session.getSessionToken();l&&this.bc&&this.bc.postMessage({line:a.data.source===c?H.reg:H.resp,token:l,source:c,context:this.contextId})}}})}allowAppStart(){this.canStart=!0,this.startTimeout&&(clearTimeout(this.startTimeout),this.startTimeout=null)}checkNodeId(e){return U(this,null,function*(){let s;if(this.pageFrames.length>0&&(s=this.pageFrames.find(i=>i.contentWindow===e)),!s||!this.pageFrames.length){let i=Array.from(document.querySelectorAll("iframe"));this.pageFrames=i,s=i.find(r=>r.contentWindow===e)}if(!s)return null;let n=0;for(;n<100;){let i=s[this.options.node_id];if(i!==void 0)return n=100,i;n++,yield Oo(100)}return null})}initWorker(){try{this.worker=new Worker(URL.createObjectURL(new Blob([Ro],{type:"text/javascript"}))),this.worker.onerror=s=>{this._debug("webworker_error",s)},this.worker.onmessage=({data:s})=>{this.handleWorkerMsg(s)};let e=()=>{this.worker&&this.worker.postMessage(null)};this.attachEventListener(window,"beforeunload",e,!1),this.attachEventListener(document.body,"mouseleave",e,!1,!1),this.attachEventListener(document,"visibilitychange",e,!1)}catch(e){this._debug("worker_start",e)}}handleWorkerMsg(e){if(e==="a_stop")this.stop(!1);else if(e==="a_start")this.waitStatus(j.NotActive).then(()=>{this.allowAppStart(),this.start(this.prevOpts,!0).then(s=>{this.debug.info("Worker restart, session too long",s)}).catch(s=>{this.debug.error("Worker restart failed",s)})});else if(e==="not_init")this.debug.warn("OR WebWorker: writer not initialised. Restarting tracker");else if(e.type==="failure")this.stop(!1),this.debug.error("worker_failed",e.reason),this._debug("worker_failed",e.reason);else if(e.type==="compress"){let s=e.batch;s.byteLength>this.compressionThreshold?ur(e.batch,{mtime:0},(i,r)=>{i?(this.debug.error("Openreplay compression error:",i),this.worker?.postMessage({type:"uncompressed",batch:s})):this.worker?.postMessage({type:"compressed",batch:r})}):this.worker?.postMessage({type:"uncompressed",batch:s})}else e.type==="queue_empty"&&this.onSessionSent()}_debug(e,s){this.options.__debug_report_edp!==null&&fetch(this.options.__debug_report_edp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e,error:`${s}`})}),this.debug.error("OpenReplay error: ",e,s)}_nCommit(){if(this.socketMode){this.messages.unshift(fe(this.timestamp()),de(this.session.getTabId())),this.commitCallbacks.forEach(e
17=>e(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:H.iframeBatch,messages:this.messages},this.options.crossdomain?.parentDomain??"*"),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0;return}if(!(this.worker===void 0||!this.messages.length)){if(!this.messages.length&&this.emptyBatchCounter<1e3){this.emptyBatchCounter++;return}this.emptyBatchCounter=0;try{cn(()=>{this.messages.unshift(fe(this.timestamp()),de(this.session.getTabId())),this.worker?.postMessage(this.messages),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0})}catch(e){this._debug("worker_commit",e),this.stop(!0),setTimeout(()=>{this.start()},500)}}}_cStartCommit(){if(this.coldStartCommitN+=1,this.coldStartCommitN===2){let e=[fe(this.timestamp()),de(this.session.getTabId())];this.bufferedMessages1.push(...e),this.bufferedMessages2.push(...e),this.coldStartCommitN=0}}commit(){this.activityState===j.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){this.worker?.postMessage(e),this.commitCallbacks.forEach(s=>s(e))}timestamp(){return G()+this.delay}safe(e){let s=this;return function(...n){try{e.apply(this,n)}catch(i){s._debug("safe_fn_call",i)}}}attachCommitCallback(e){this.commitCallbacks.push(e)}checkRequiredVersion(e){let s=e.split(/[.-]/),n=this.version.split(/[.-]/);for(let i=0;i<3;i++){if(isNaN(Number(n[i]))||isNaN(Number(s[i])))return!1;if(Number(n[i])>Number(s[i]))return!0;if(Number(n[i])<Number(s[i]))return!1}return!0}getTrackerInfo(){return{userUUID:this.localStorage.getItem(this.options.local_uuid_key),projectKey:this.projectKey,revID:this.revID,trackerVersion:this.version,isSnippet:this.options.__is_snippet}}getSessionInfo(){return q(q({},this.session.getInfo()),this.getTrackerInfo())}getSessionToken(){return this.session.getSessionToken()}getSessionID(){return this.session.getInfo().sessionID||void 0}getSessionURL(e){let{projectID:s,sessionID:n,timestamp:i}=this.session.getInfo();if(!s||!n){this.debug.error("OpenReplay error: Unable to build session URL");return}let r=this.options.ingestPoint,a=(/api\.openreplay\.com/.test(r)?"https://app.openreplay.com/ingest":r).replace(/ingest$/,`${s}/session/${n}`);if(e?.withCurrentTime){let l=G()-i;return`${a}?jumpto=${l}`}return a}getHost(){return new URL(this.options.ingestPoint).host}getProjectKey(){return this.projectKey}getBaseHref(){return typeof this.options.resourceBaseHref=="string"?this.options.resourceBaseHref:(this.options.resourceBaseHref,document.baseURI?document.baseURI:document.head?.getElementsByTagName("base")[0]?.getAttribute("href")||location.origin+location.pathname)}resolveResourceURL(e){let s=new URL(this.getBaseHref());return s.pathname+="/"+new URL(e).pathname,s.pathname.replace(/\/+/g,"/"),s.toString()}isServiceURL(e){return e.startsWith(this.options.ingestPoint)}active(){return this.activityState===j.Active}resetNextPageSession(e){e?this.sessionStorage.setItem(this.options.session_reset_key,"t"):this.sessionStorage.removeItem(this.options.session_reset_key)}checkSessionToken(e){let s=this.sessionStorage.getItem(this.options.session_reset_key)!==null,n=e||s,i=this.session.getSessionToken();return n||!i}coldStart(){return U(this,arguments,function*(e={},s){this.singleBuffer=!1;let n=1e3,i=this.checkSessionToken(e.forceNew);s&&(yield this.setupConditionalStart(e));let r=()=>{this.orderNumber+=1,Nt(),this.coldStartTs=G(),this.orderNumber%2===0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push(fe(this.timestamp())),this.bufferedMessages1.push(de(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push(fe(this.timestamp())),this.bufferedMessages2.push(de(this.session.getTabId()))),this.stop(!1),this.activityState=j.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata}),i||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(Oe(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{r()},30*n),r()})}setupConditionalStart(e){return U(this,null,function*(){this.conditionsManager=new Wt(this,e);let s=yield fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J(q({},this.getTrackerInfo()),{timestamp:G(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:_t,jsHeapSizeLimit:Rt,timezone:At(),width:window.screen.width,height:window.screen.height}))}),{token:n,userBrowser:i,userCity:r,userCountry:o,userDevice:c,userOS:a,userState:l,projectID:u,features:h}=yield s.json();this.features=h||this.features,this.session.assign({projectID:u}),this.session.setUserInfo({userBrowser:i,userCity:r,userCountry:o,userDevice:c,userOS:a,userState:l});let f={sessionToken:n,userUUID:"",sessionID:""};this.startCallbacks.forEach(g=>g(f)),yield this.conditionsManager?.fetchConditions(u,n),this.features["feature-flags"]&&(yield this.featureFlags.reloadFlags(n),this.conditionsManager?.process
17Flags(this.featureFlags.flags)),yield this.tagWatcher.fetchTags(this.options.ingestPoint,n)})}offlineRecording(e={},s){this.onSessionSent=s,this.singleBuffer=!0;let n=this.checkSessionToken(e.forceNew);Nt(),this.coldStartTs=G();let i=this.localStorage.getItem(Mt);if(i){let o=JSON.parse(i);this.bufferedMessages1=Array.isArray(o)?o:this.bufferedMessages1,this.localStorage.removeItem(Mt)}this.bufferedMessages1.push(fe(this.timestamp())),this.bufferedMessages1.push(de(this.session.getTabId())),this.activityState=j.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});let r={sessionToken:"",userUUID:"",sessionID:""};return this.startCallbacks.forEach(o=>o(r)),n||this.send(Oe(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(Mt,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}uploadOfflineRecording(){return U(this,null,function*(){this.stop(!1);let e=G();this.worker?.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:this.coldStartTs,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});let s=yield fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J(q({},this.getTrackerInfo()),{timestamp:e,doNotRecord:!1,bufferDiff:e-this.coldStartTs,userID:this.session.getInfo().userID,token:void 0,deviceMemory:_t,jsHeapSizeLimit:Rt,timezone:At()}))}),{token:n,userBrowser:i,userCity:r,userCountry:o,userDevice:c,userOS:a,userState:l,beaconSizeLimit:u,projectID:h}=yield s.json();for(this.worker?.postMessage({type:"auth",token:n,beaconSizeLimit:u}),this.session.assign({projectID:h}),this.session.setUserInfo({userBrowser:i,userCity:r,userCountry:o,userDevice:c,userOS:a,userState:l});this.bufferedMessages1.length>0;)yield this.flushBuffer(this.bufferedMessages1);this.postToWorker([["q_end"]]),this.clearBuffers()})}_start(){return U(this,arguments,function*(e={},s=!1,n){Object.keys(e).length!==0&&(this.prevOpts=e);let i=this.activityState===j.ColdStart;if(i&&this.coldInterval&&clearInterval(this.coldInterval),!this.worker&&!this.insideIframe){let a="No worker found: perhaps, CSP is not set.";return this.signalError(a,[]),Promise.resolve(ie(a))}if(this.activityState===j.Active||this.activityState===j.Starting)return Promise.resolve(ie("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=j.Starting,i||Nt(),e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});let r=G();this.worker?.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:i?this.coldStartTs:r,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});let o=this.session.getSessionToken(),c=this.checkSessionToken(e.forceNew);this.sessionStorage.removeItem(this.options.session_reset_key),this.debug.log("OpenReplay: starting session; need new session id?",c,"session token: ",o);try{let a=yield window.fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J(q({},this.getTrackerInfo()),{timestamp:r,doNotRecord:!1,bufferDiff:r-this.coldStartTs,userID:this.session.getInfo().userID,token:c?void 0:o,deviceMemory:_t,jsHeapSizeLimit:Rt,timezone:At(),condition:n,assistOnly:e.assistOnly??this.socketMode,width:window.screen.width,height:window.screen.height}))});if(a.status!==200){let C=yield a.text(),E=C===xe?xe:`Server error: ${a.status}. ${C}`;return ie(E)}if(!this.worker&&!this.insideIframe){let C="no worker found after start request (this should not happen in real world)";return this.signalError(C,[]),ie(C)}let{token:l,userUUID:u,projectID:h,beaconSizeLimit:f,compressionThreshold:g,delay:S,sessionID:m,startTimestamp:k,userBrowser:I,userCity:N,userCountry:y,userDevice:p,userOS:T,userState:d,canvasEnabled:w,canvasQuality:b,canvasFPS:v,assistOnly:O,features:A}=yield a.json();if(this.features=A||this.features,typeof l!="string"||typeof u!="string"||typeof k!="number"&&typeof k<"u"||typeof m!="string"||typeof S!="number"||typeof f!="number"&&typeof f<"u"){let C=`Incorrect server response: ${JSON.stringify(a)}`;return this.signalError(C,[]),ie(C)}this.delay=S,this.session.setSessionToken(l),this.session.setUserInfo({userBrowser:I,userCity:N,userCountry:y,userDevice:p,userOS:T,userState:d}),this.session.assign({sessionID:m,timestamp:k||r,projectID:h}),O?(this.socketMode=!0,this.worker?.postMessage("stop")):this.worker?.postMessage({type:"auth",token:l,beaconSizeLimit:f}),!c&&l===o&&(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(Oe(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEac
17h(([C,E])=>this.send(Jt(C,E))),this.localStorage.setItem(this.options.local_uuid_key,u),this.compressionThreshold=g;let _={sessionToken:l,userUUID:u,sessionID:m};if(this.startCallbacks.forEach(C=>C(_)),e.startCallback&&e.startCallback(wn(_)),this.features["feature-flags"]&&this.featureFlags.reloadFlags(),yield this.tagWatcher.fetchTags(this.options.ingestPoint,l),this.activityState=j.Active,this.options.crossdomain?.enabled&&!this.insideIframe&&this.bootChildrenFrames(),w&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new hs(this,{fps:v,quality:b,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame})),i){let C=this.bufferedMessages1.length>this.bufferedMessages2.length?this.bufferedMessages1:this.bufferedMessages2;for(;C.length>0;)yield this.flushBuffer(C);this.clearBuffers(),this.commit()}else this.insideIframe&&this.rootId?this.observer.crossdomainObserve(this.rootId,this.frameOderNumber):this.observer.observe(),this.ticker.start();if(this.canvasRecorder?.startTracking(),this.features["usability-test"]&&!this.insideIframe){this.uxtManager=this.uxtManager?this.uxtManager:new us(this,vn);let C,E=this.localStorage.getItem(vn);if(E&&(C=parseInt(E,10)),location?.search){let x=new URLSearchParams(location.search);if(x.has("oruxt")){let F=x.get("oruxt");C=F?parseInt(F,10):void 0}}C&&(this.uxtManager.isActive?this.onUxtCb.forEach(x=>x(C)):this.uxtManager.getTest(C,l,!!E).then(x=>{x&&this.onUxtCb.forEach(F=>F(x))}))}return wn(_)}catch(a){if(this.stop(),this.session.reset(),!a)return console.error("Unknown error during start"),this.signalError("Unknown error",[]),ie("Unknown error");if(a===xe)return this.signalError(xe,[]),ie(xe);this._debug("session_start",a);let l=a instanceof Error?a.message:a.toString();return this.signalError(l,[]),ie(l)}})}addOnUxtCb(e){this.onUxtCb.push(e)}getUxtId(){return this.uxtManager?.getTestId()}waitStart(){return U(this,null,function*(){return new Promise(e=>{let s=setInterval(()=>{this.canStart&&(clearInterval(s),e(!0))},100)})})}waitStarted(){return U(this,null,function*(){return this.waitStatus(j.Active)})}waitStatus(e){return U(this,null,function*(){return new Promise(s=>{let n=()=>{this.activityState===e?s(!0):setTimeout(n,25)};n()})})}start(...e){return U(this,null,function*(){return this.activityState===j.Active||this.activityState===j.Starting?Promise.resolve(ie("OpenReplay: trying to call `start()` on the instance that has been started already.")):(this.insideIframe&&this.signalIframeTracker(),document.hidden?new Promise(s=>{let n=()=>U(this,null,function*(){document.hidden||(yield this.waitStart(),document.removeEventListener("visibilitychange",n),s(this._start(...e)))});document.addEventListener("visibilitychange",n)}):(yield this.waitStart(),this._start(...e)))})}forceFlushBatch(){this.worker?.postMessage("forceFlushBatch")}getTabId(){return this.session.getTabId()}clearBuffers(){this.bufferedMessages1.length=0,this.bufferedMessages2.length=0}trackWs(e){let s=e;return(n,i,r="down")=>{typeof n!="string"||typeof i!="string"||i.length>5*1024*1024||n.length>255||this.send(Ri("websocket",s,i,this.timestamp(),r,n))}}stop(e=!0){if(this.activityState!==j.NotActive)try{!this.insideIframe&&this.options.crossdomain?.enabled&&this.killChildrenFrames(),this.attributeSender.clear(),this.sanitizer.clear(),this.observer.disconnect(),this.nodes.clear(),this.ticker.stop(),this.stopCallbacks.forEach(s=>s()),this.tagWatcher.clear(),this.worker&&e&&this.worker.postMessage("stop"),this.canvasRecorder?.clear(),this.messages.length=0,this.parentActive=!1}finally{this.activityState=j.NotActive,this.debug.log("OpenReplay tracking stopped.")}}};function Mo(t){let e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e===void 0)return;let s=()=>t.send(Ii(Math.round(e.downlink*1e3),e.type||"unknown"));s(),e.addEventListener("change",s)}var Ui=D&&"InstallTrigger"in window?t=>t.message+` 18`+t.stack:t=>t.stack||t.message;function Ts(t){return t===void 0?"undefined":t===null?"null":t instanceof Error?Ui(t):Array.isArray(t)?`Array(${t.length})`:String(t)}function Ao(t){return typeof t!="number"?"NaN":t.toString()}function Fo(t){return typeof t!="number"?"NaN":Math.floor(t).toString()}function kn(t){if(t===void 0)return"undefined";if(t===null)return"null";if(t instanceof Error)return Ui(t);
18if(Array.isArray(t)){let e=t.length,s=t.slice(0,10).map(Ts).join(", ");return`Array(${e})[${s}]`}if(typeof t=="object"){let e=[],s=0;for(let n in t){if(++s===10)break;let i=t[n];e.push(n+": "+Ts(i))}return"{"+e.join(", ")+"}"}return t.toString()}function Lo(t){return typeof t[0]=="string"&&t.unshift(t.shift().replace(/%(o|s|f|d|i)/g,(e,s)=>{let n=t.shift();if(n===void 0)return e;switch(s){case"o":return kn(n);case"s":return Ts(n);case"f":return Ao(n);case"d":case"i":return Fo(n);default:return e}})),t.map(kn).join(" ")}var Tn=["log","info","warn","error","debug","assert"];function Bo(t,e){let s=Object.assign({consoleMethods:Tn,consoleThrottling:30},e);if(!Array.isArray(s.consoleMethods)||s.consoleMethods.length===0)return;let n=t.safe((a,l)=>{let u=Lo(l);t.sanitizer.privateMode&&(u=u.replaceAll(/./g,"*")),t.send(bi(a,u))}),i=0,r=()=>{i=0};t.attachStartCallback(r),t.ticker.attach(r,33,!1);let o=(a,l)=>{let u={apply:function(h,f,g){Reflect.apply(h,l,g),i=i+1,!(i>s.consoleThrottling)&&n(h.name,g)}};s.consoleMethods.forEach(h=>{if(Tn.indexOf(h)===-1){t.debug.error(`OpenReplay: unsupported console method "${h}"`);return}let f=l.console[h];a[h]=new Proxy(f,u)})},c=t.safe(a=>o(a.console,a));c(window),t.observer.attachContextCallback(c)}var Po=/(^|@)\S+:\d+/,Hi=/^\s*at .*(\S+:\d+|\(native\))/m,Uo=/^(eval@)?(\[native code\])?$/;function Ho(t,e){if(typeof t.stacktrace<"u"||typeof t["opera#sourceloc"]<"u")return $o(t);if(t.stack&&t.stack.match(Hi))return jo(t);if(t.stack)return qo(t);throw new Error("Cannot parse given Error object")}function Ws(t){if(!t.includes(":"))return[t,void 0,void 0];let s=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[s[1],s[2]||void 0,s[3]||void 0]}function Pe(t,e){return t}function jo(t,e){return zo(t.stack)}function zo(t,e){return Pe(t.split(` 19`).filter(n=>!!n.match(Hi))).map(n=>{n.includes("(eval ")&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let i=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),r=i.match(/ (\(.+\)$)/);i=r?i.replace(r[0],""):i;let o=Ws(r?r[1]:i),c=r&&i||void 0,a=["eval","<anonymous>"].includes(o[0])?void 0:o[0];return{function:c,file:a,line:o[1]?+o[1]:void 0,col:o[2]?+o[2]:void 0,raw:n}})}function qo(t,e){return Wo(t.stack)}function Wo(t,e){return Pe(t.split(` 20`).filter(n=>!n.match(Uo))).map(n=>{if(n.includes(" > eval")&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!n.includes("@")&&!n.includes(":"))return{function:n};{let i=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,r=n.match(i),o=r&&r[1]?r[1]:void 0,c=Ws(n.replace(i,""));return{function:o,file:c[0],line:c[1]?+c[1]:void 0,col:c[2]?+c[2]:void 0,raw:n}}})}function $o(t,e){return!t.stacktrace||t.message.includes(` 21`)&&t.message.split(` 22`).length>t.stacktrace.split(` 23`).length?Vo(t):t.stack?Go(t):Xo(t)}function Vo(t,e){let s=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split(` 24`),i=[];for(let r=2,o=n.length;r<o;r+=2){let c=s.exec(n[r]);c&&i.push({file:c[2],line:+c[1],raw:n[r]})}return Pe(i)}function Xo(t,e){let s=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split(` 25`),i=[];for(let r=0,o=n.length;r<o;r+=2){let c=s.exec(n[r]);c&&i.push({function:c[3]||void 0,file:c[2],line:c[1]?+c[1]:void 0,raw:n[r]})}return Pe(i)}function Go(t,e){return Pe(t.stack.split(` 26`).filter(n=>!!n.match(Po)&&!n.match(/^Error created at/))).map(n=>{let i=n.split("@"),r=Ws(i.pop()),o=i.shift()||"",c=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,a;o.match(/\(([^)]*)\)/)&&(a=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));let l=a===void 0||a==="[arguments not available]"?void 0:a.split(",");return{function:c,args:l,file:r[0],line:r[1]?+r[1]:void 0,col:r[2]?+r[2]:void 0,raw:n}})}function Ko(t){return t.map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}function Jo(t,e){return Ko(Ho(t))}function In(t){return[{columnNumber:t.colno,lineNumber:t.lineno,fileName:t.filename,functionName:"",source:""}]}function ht(t,e,s={}){let n=e;try{n=Jo(t)}catch{}return ot(t.name,t.message,JSON.stringify(n),JSON.stringify(s))}function ji(t,e=window,s={}){if(t instanceof ErrorEvent){if(t.error instanceof Error)return ht(t.error,In(t),s);{let[n,i]=t.message.split(":");
26return i||(n="Error",i=t.message),ot(n,i,JSON.stringify(In(t)),JSON.stringify(s))}}else if("PromiseRejectionEvent"in e&&t instanceof e.PromiseRejectionEvent){if(t.reason instanceof Error)return ht(t.reason,[],s);{let n;try{n=JSON.stringify(t.reason)}catch{n=String(t.reason)}return ot("Unhandled Promise Rejection",n,"[]",JSON.stringify(s))}}return null}function Yo(t,e){let s=Object.assign({captureExceptions:!0},e);function n(i){function r(o){let c=ji(o,i);c!=null&&t.send(c)}try{t.attachEventListener(i,"unhandledrejection",r),t.attachEventListener(i,"error",r)}catch(o){console.error("Error while attaching to error proto contexts",o)}}s.captureExceptions&&(t.observer.attachContextCallback(n),n(window))}function Cn(t,e=document.location){return t=t.trim(),t.startsWith("//")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")?t:t.startsWith("/")?e.origin+t:e.origin+e.pathname+t}function Qo(t){return dr&&(t.startsWith("data:image/svg+xml")||t.match(/.svg$|/i))}var Zo="https://static.openreplay.com/tracker/placeholder.jpeg";function ea(t){function e(c,a){t.attributeSender.sendSetAttribute(c,"src",Zo);let{width:l,height:u}=a.getBoundingClientRect();a.hasAttribute("width")||t.attributeSender.sendSetAttribute(c,"width",String(l)),a.hasAttribute("height")||t.attributeSender.sendSetAttribute(c,"height",String(u))}let s=function(c,a){let{srcset:l}=a;if(!l)return;let u=l.split(l.match(/,\s+/)?/,\s+/:",").map(h=>Cn(h)).join(", ");t.attributeSender.sendSetAttribute(c,"srcset",u)},n=function(c,a){a.src.length>pr&&e(c,a),t.send(it(c,"src",a.src,t.getBaseHref()))},i=t.safe(function(c){let a=Cn(c.src||"");ei(a)&&t.send(at(t.timestamp(),0,0,0,0,0,a,"img",0,!1))}),r=t.safe(function(c){let a=t.nodes.getID(c);a!==void 0&&c.complete&&(c.naturalHeight===0&&c.naturalWidth===0&&!Qo(c.src)?i(c):t.sanitizer.isHidden(a)||t.sanitizer.isObscured(a)?e(a,c):(n(a,c),s(a,c)))}),o=si(t.safe(c=>{for(let a of c)if(a.type==="attributes"){let l=a.target,u=t.nodes.getID(l);if(u===void 0)return;a.attributeName==="src"&&n(u,l),a.attributeName==="srcset"&&s(u,l)}}),t.options.forceNgOff);t.attachStopCallback(()=>{o.disconnect()}),t.nodes.attachNodeCallback(c=>{z(c,"img")&&(t.nodes.attachNodeListener(c,"error",()=>i(c)),t.nodes.attachNodeListener(c,"load",()=>r(c)),r(c),o.observe(c,{attributes:!0,attributeFilter:["src","srcset"]}))})}var ta=["text","password","email","search","number","range","date","tel","time"];function sa(t){return z(t,"textarea")?!0:z(t,"input")?ta.includes(t.type):!1}function na(t){if(!z(t,"input"))return!1;let e=t.type;return e==="checkbox"||e==="radio"}var ia=D&&"labels"in HTMLInputElement.prototype?t=>{let e=t;for(;(e=e.parentNode)!==null;)if(z(e,"label"))return e;let s=t.labels;if(s!==null&&s.length===1)return s[0]}:t=>{let e=t;for(;(e=e.parentNode)!==null;)if(z(e,"label"))return e;let s=t.id;if(s){let n=t.ownerDocument.querySelectorAll('label[for="'+s+'"]');if(n!==null&&n.length===1)return n[0]}};function zi(t){let e=js(t);if(e===null){let s=ia(t);e=s&&s.innerText||t.placeholder||t.name||t.id||t.className||t.type}return Zn(e).slice(0,100)}var ve={Plain:0,Obscured:1,Hidden:2};function ra(t,e){let s=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:ve.Obscured,obscureInputDates:!1},e);function n(u,h){let f=h.value,g=s.defaultInputMode;h.type==="password"||t.sanitizer.isHidden(u)?g=ve.Hidden:(t.sanitizer.isObscured(u)||g===ve.Plain&&(s.obscureInputNumbers&&h.type!=="date"&&/\d\d\d\d/.test(f)||s.obscureInputDates&&h.type==="date"||s.obscureInputEmails&&(h.type==="email"||~f.indexOf("@"))))&&(g=ve.Obscured);let S=0;switch(g){case ve.Hidden:S=-1,f="";break;case ve.Obscured:S=f.length,f="";break}return{value:f,mask:S}}function i(u,h){let{value:f,mask:g}=n(u,h);t.send(pi(u,f,g))}let r=new Map,o=new Map;t.attachStopCallback(()=>{r.clear(),o.clear()});function c(u,h){r.get(u)!==h.value&&(r.set(u,h.value),i(u,h))}function a(u,h){o.get(u)!==h&&(o.set(u,h),t.send(gi(u,h)))}t.ticker.attach(()=>{r.forEach((u,h)=>{let f=t.nodes.getNode(h);if(!f)return r.delete(h);c(h,f)}),o.forEach((u,h)=>{let f=t.nodes.getNode(h);if(!f)return o.delete(h);a(h,f.checked)})},3);function l(u,h,f,g){let{value:S,mask:m}=n(u,h),k=zi(h);t.sanitizer.privateMode&&(k=k.replaceAll(/./g,"*")),t.send(Di(u,S,m!==0,k,f,g))}t.nodes.attachNodeCallback(t.safe(u=>{let h=t.nodes.getID(u);if(h!==void 0){if(z(u,"select")&&(i(h,u),t.nodes.attachNodeListener(u,"change",()=>i(h,u))),sa(u)){c(h,u);let f=0,g=0,S=0,m=()=>{f=G()},k=()=>{g===0&&f!==0&&(g=G()-f)},I=()=>
26{f!==0&&(S=G()-f),l(h,u,g,S),g=0,S=0,f=0};t.nodes.attachNodeListener(u,"focus",m),t.nodes.attachNodeListener(u,"input",k),t.nodes.attachNodeListener(u,"change",I);return}if(na(u)){a(h,u.checked),t.nodes.attachNodeListener(u,"change",()=>a(h,u.checked));return}}}))}var Re=typeof CSS<"u"&&CSS.escape||(t=>t),En=new WeakMap;function oa(t){return ua(t)||""}function Is(t){let e=t.tagName.toUpperCase();return e==="BUTTON"||e==="A"||e==="LI"||e==="SELECT"||e==="TR"||e==="TH"||t.onclick!=null||t.getAttribute("role")==="button"}function Nn(t,e){return t instanceof Element?aa(t,e):null}function aa(t,e){let s=t;for(;s!==null&&s!==e.documentElement;){if(ae(s,"masked"))return null;s=s.parentElement}if(ls(t)){let n=t.ownerSVGElement;for(;n!==null;)t=n,n=n.ownerSVGElement}for(s=t;s!==null&&s!==e.documentElement;){let n=s.tagName.toUpperCase();if(n==="LABEL")return null;if(n==="INPUT"||Is(s)||js(s)!==null)return s;s=s.parentElement}return t===e.documentElement?null:t}function ca(t,e){let{disableClickmaps:s=!1}=e||{};function n(p){let T=js(p);if(T!==null)return T;if(z(p,"input"))return zi(p);if(Is(p)){let d="";return p instanceof HTMLElement&&(d=t.sanitizer.getInnerTextSecure(p)),d=d||p.id||p.className,Zn(d).slice(0,100)}return""}let i=-1,r=-1,o=!1,c=null,a=0,l={},u=0,h=0,f=0,g=0,S,m=.008,k=225;function I(){let p=g/k;if(!u){u=p;return}let T=(p-u)/k;f>4&&T>m&&t.send(Oi(G())),g=0,f=0,u=p}t.attachStartCallback(()=>{S=setInterval(()=>I(),k)}),t.attachStopCallback(()=>{i=-1,r=-1,o=!1,c=null,l={},S&&clearInterval(S)});let N=()=>{o&&(t.send(mi(i,r)),o=!1)},y=(p,T=!1)=>{function d(b,v){return l[b]=l[b]||oa(v)}let w=T?t.attachEventListener.bind(t):t.nodes.attachNodeListener.bind(t.nodes);w(p.documentElement,"mouseover",b=>{let v=Nn(b.target,p);v!==c&&(c=v,a=performance.now())}),w(p,"mousemove",b=>{let[v,O]=t.observer.getDocumentOffset(p);i=b.clientX+v,r=b.clientY+O,o=!0;let A=Math.sign(b.movementX);g+=Math.abs(b.movementX)+Math.abs(b.movementY),A!==h&&(h=A,f++)},!1),w(p,"click",b=>{let v=Nn(b.target,p);if(!b.clientX&&!b.clientY||v===null)return;let O=t.nodes.getID(v);if(O!==void 0){let A=b.pageX,_=b.pageY,C=p.documentElement.scrollWidth,E=p.documentElement.scrollHeight,x=xn(A/C),F=xn(_/E);N();let B=n(v);t.send(xi(O,c===v?Math.round(performance.now()-a):0,t.sanitizer.privateMode?B.replaceAll(/./g,"*"):B,Is(v)&&!s?d(O,v):"",x,F),!0)}c=null})};t.nodes.attachNodeCallback(p=>{ut(p)&&y(p)}),y(document,!0),t.ticker.attach(N,e?.trackingOffset||7)}function xn(t){return Math.round(t*1e4)}function qi(t,e){let s=En.get(e);if(s||(s=Object.create(null),En.set(e,s)),t in s)return s[t];let n=e.querySelectorAll(`.${Re(t)}`).length===1;return s[t]=n,n}function Wi(t){if(/^[a-z\-]{3,}$/i.test(t)){let e=t.split(/-|[A-Z]/);for(let s of e)if(s.length<=2||/[^aeiou]{4,}/i.test(s))return!1;return!0}return!1}function ua(t){if(!t||t.nodeType!==1)return!1;if(t.id)return`#${Re(t.id)}`;let e=[];for(;t&&t.nodeType===1&&t!==t.ownerDocument;){if(t.id){e.unshift(`#${Re(t.id)}`);break}let s=t.tagName.toLowerCase();if(t.classList?.length){for(let i of t.classList)if(Wi(i)&&qi(i,t.ownerDocument))return e.unshift(`${s}.${Re(i)}`),e.join(" > ")}let n=la(t);if(n)e.unshift(`${s}.${Re(n)}`);else if(t===t.ownerDocument.body||t===t.ownerDocument.documentElement)e.unshift(s);else{let i=1;for(let r=t.previousElementSibling;r;r=r.previousElementSibling)r.tagName.toLowerCase()===s&&i++;e.unshift(`${s}:nth-of-type(${i})`)}t=t.parentNode}return e.join(" > ")}function la(t){if(!t.classList?.length||!t.parentNode)return null;let e=t.parentNode.children;e:for(let s of t.classList)if(!(!Wi(s)||!qi(s,t.ownerDocument))){for(let n of e)if(n!==t&&n.classList?.contains(s))continue e;return s}return null}var Cs,$i=-1,Ne=function(t){addEventListener("pageshow",function(e){e.persisted&&($i=e.timeStamp,t(e))},!0)},$s=function(){var t=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},wt=function(){var t=$s();return t&&t.activationStart||0},ee=function(t,e){var s=$s(),n="navigate";return $i>=0?n="back-forward-cache":s&&(document.prerendering||wt()>0?n="prerender":document.wasDiscarded?n="restore":s.type&&(n=s.type.replace(/_/g,"-"))),{name:t,value:e===void 0?-1:e,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},Ue=function(t,e,s){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){e(i.getEntries())})});return n.observe(Object.assign({type:t,buffered:!0},s||{})),n}}catch{}},te=function(t,e,s,n){var i,r;return function(o){e.value>=0&&(o||n)&&((r=e.value-(i||0))||i===void 0)&&(i=e.value,e.delta=r,e.rating=(function(c,a){return c>a[1]?"poor":c>a[0]?"needs-improvement":"good"})(e.value,s),t(e))}},Vs=function(t){requestAnimationFrame(function(){return requestAnimationFrame(function(){return t()})})},kt=function(t){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&t()})},Xs=function(t){var e=!1;return function(){e||(t(),e=!0)}},Ce=-1,_n=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},ft=function(t){document.visibilityState==="hidden"&&Ce>-1&&(Ce=t.type==="visibilitychange"?t.timeStamp:0,ha())},Rn=function(){addEventListener("visibilitychange",ft,!0),addEventListener("prerenderingchange",ft,!0)},ha=function(){removeEventListener("visibilitychange",ft,!0),removeEventListener("prerenderingchange",ft,!0)},Vi=function(){return Ce<0&&(Ce=_n(),Rn(),Ne(function(){setTimeout(function(){Ce=_n(),Rn()},0)})),{get firstHiddenTime(){return Ce}}},Tt=function(t){document.prerendering?addEventListener("prerenderingchange",function(){return t()},!0):t()},Dn=[1800,3e3],fa=function(t,e){e=e||{},Tt(function(){var s,n=Vi(),i=ee("FCP"),r=Ue("paint",function(o){o.forEach(function(c){c.name==="first-contentful-paint"&&(r.disconnect(),c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-wt(),0),i.entries.push(c),s(!0)))})});r&&(s=te(t,i,Dn,e.reportAllChanges),Ne(function(o){i=ee("FCP"),s=te(t,i,Dn,e.reportAllChanges),Vs(function(){i.value=performance.now()-o.timeStamp,s(!0)})}))})}
26,On=[.1,.25],da=function(t,e){e=e||{},fa(Xs(function(){var s,n=ee("CLS",0),i=0,r=[],o=function(a){a.forEach(function(l){if(!l.hadRecentInput){var u=r[0],h=r[r.length-1];i&&l.startTime-h.startTime<1e3&&l.startTime-u.startTime<5e3?(i+=l.value,r.push(l)):(i=l.value,r=[l])}}),i>n.value&&(n.value=i,n.entries=r,s())},c=Ue("layout-shift",o);c&&(s=te(t,n,On,e.reportAllChanges),kt(function(){o(c.takeRecords()),s(!0)}),Ne(function(){i=0,n=ee("CLS",0),s=te(t,n,On,e.reportAllChanges),Vs(function(){return s()})}),setTimeout(s,0))}))},Xi=0,Ft=1/0,We=0,pa=function(t){t.forEach(function(e){e.interactionId&&(Ft=Math.min(Ft,e.interactionId),We=Math.max(We,e.interactionId),Xi=We?(We-Ft)/7+1:0)})},Gi=function(){return Cs?Xi:performance.interactionCount||0},ga=function(){"interactionCount"in performance||Cs||(Cs=Ue("event",pa,{type:"event",buffered:!0,durationThreshold:0}))},Q=[],Je=new Map,Ki=0,ma=function(){var t=Math.min(Q.length-1,Math.floor((Gi()-Ki)/50));return Q[t]},ba=[],ya=function(t){if(ba.forEach(function(i){return i(t)}),t.interactionId||t.entryType==="first-input"){var e=Q[Q.length-1],s=Je.get(t.interactionId);if(s||Q.length<10||t.duration>e.latency){if(s)t.duration>s.latency?(s.entries=[t],s.latency=t.duration):t.duration===s.latency&&t.startTime===s.entries[0].startTime&&s.entries.push(t);else{var n={id:t.interactionId,latency:t.duration,entries:[t]};Je.set(n.id,n),Q.push(n)}Q.sort(function(i,r){return r.latency-i.latency}),Q.length>10&&Q.splice(10).forEach(function(i){return Je.delete(i.id)})}}},Ji=function(t){var e=self.requestIdleCallback||self.setTimeout,s=-1;return t=Xs(t),document.visibilityState==="hidden"?t():(s=e(t),kt(t)),s},Mn=[200,500],Sa=function(t,e){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(e=e||{},Tt(function(){var s;ga();var n,i=ee("INP"),r=function(c){Ji(function(){c.forEach(ya);var a=ma();a&&a.latency!==i.value&&(i.value=a.latency,i.entries=a.entries,n())})},o=Ue("event",r,{durationThreshold:(s=e.durationThreshold)!==null&&s!==void 0?s:40});n=te(t,i,Mn,e.reportAllChanges),o&&(o.observe({type:"first-input",buffered:!0}),kt(function(){r(o.takeRecords()),n(!0)}),Ne(function(){Ki=Gi(),Q.length=0,Je.clear(),i=ee("INP"),n=te(t,i,Mn,e.reportAllChanges)}))}))},An=[2500,4e3],Lt={},va=function(t,e){e=e||{},Tt(function(){var s,n=Vi(),i=ee("LCP"),r=function(a){e.reportAllChanges||(a=a.slice(-1)),a.forEach(function(l){l.startTime<n.firstHiddenTime&&(i.value=Math.max(l.startTime-wt(),0),i.entries=[l],s())})},o=Ue("largest-contentful-paint",r);if(o){s=te(t,i,An,e.reportAllChanges);var c=Xs(function(){Lt[i.id]||(r(o.takeRecords()),o.disconnect(),Lt[i.id]=!0,s(!0))});["keydown","click"].forEach(function(a){addEventListener(a,function(){return Ji(c)},{once:!0,capture:!0})}),kt(c),Ne(function(a){i=ee("LCP"),s=te(t,i,An,e.reportAllChanges),Vs(function(){i.value=performance.now()-a.timeStamp,Lt[i.id]=!0,s(!0)})})}})},Fn=[800,1800],wa=function t(e){document.prerendering?Tt(function(){return t(e)}):document.readyState!=="complete"?addEventListener("load",function(){return t(e)},!0):setTimeout(e,0)},ka=function(t,e){e=e||{};var s=ee("TTFB"),n=te(t,s,Fn,e.reportAllChanges);wa(function(){var i=$s();i&&(s.value=Math.max(i.responseStart-wt(),0),s.entries=[i],n(!0),Ne(function(){s=ee("TTFB",0),(n=te(t,s,Fn,e.reportAllChanges))(!0)}))})};function Ta(t){let e=[],s=document.getElementsByTagName("*"),n=/url\(("[^"]*"|'[^']*'|[^)]*)\)/i;for(let i=0;i<s.length;i++){let r=s[i],o="";if(z(r,"img")&&(o=r.currentSrc||r.src),!o){let S=getComputedStyle(r).getPropertyValue("background-image");if(S){let m=n.exec(S);m!==null&&(o=m[1],(o.startsWith('"')||o.startsWith("'"))&&(o=o.substr(1,o.length-2)))}}if(!o)continue;let c=o.substr(0,10)==="data:image"?0:t[o];if(c===void 0)continue;let a=r.getBoundingClientRect(),l=Math.max(a.top,0),u=Math.max(a.left,0),h=Math.min(a.bottom,window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0),f=Math.min(a.right,window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0);if(h<=l||f<=u)continue;let g=(h-l)*(f-u);e.push({time:c,area:g})}return e}function Ia(t,e){let s=Math.max(document.documentElement&&document.documentElement.clientWidth||0,window.innerWidth||0)*Math.max(document.documentElement&&document.documentElement.clientHeight||0,window.innerHeight||0)/10,n=s*t;for(let i=0;i<e.length;i++){let{time:r,area:o}=e[i];s+=o,n+=o*(r>t?r:t)}return s===0?0:n/s}function Ca(t,e){let s=Object.assign({captureResourceTimings:!0,capturePageLoadTimings:!0,capturePageRenderTimings:!0,excludedResourceUrls:[]},e);
26if("PerformanceObserver"in window||(s.captureResourceTimings=!1),!s.captureResourceTimings)return;let n={};function i(u){if(u.duration<0||!ei(u.name)||t.isServiceURL(u.name))return;n!==null&&(n[u.name]=u.startTime+u.duration);let h=!1;if(s.excludedResourceUrls?.forEach(g=>{if(u.name.startsWith(g)){h=!0;return}}),h)return;(u.responseEnd===0||u.transferSize===0&&u.decodedBodySize===0)&&t.send(at(u.startTime+ge(),0,0,0,0,0,u.name,u.initiatorType,0,!0)),t.send(at(u.startTime+ge(),u.duration,u.responseStart&&u.startTime?u.responseStart-u.startTime:0,u.transferSize>u.encodedBodySize?u.transferSize-u.encodedBodySize:0,u.encodedBodySize||0,u.decodedBodySize||0,t.sanitizer.privateMode?u.name.replaceAll(/./g,"*"):u.name,u.initiatorType,u.transferSize,u.responseStatus&&u.responseStatus===304||u.transferSize===0))}let r=new PerformanceObserver(u=>u.getEntries().forEach(i));function o(u){if(t.active())return t.send(Li(u.name,String(u.value)))}let c;t.attachStartCallback(function({sessionID:u}){u!==c&&(performance.getEntriesByType("resource").forEach(i),c=u),r.observe({entryTypes:["resource"]}),da(o),Sa(o),va(o),ka(o)}),t.attachStopCallback(function(){r.disconnect()});let a=0,l=0;if(s.capturePageLoadTimings){let u=!1;t.ticker.attach(()=>{if(!u&&((a===0||l===0)&&performance.getEntriesByType("paint").forEach(h=>{let{name:f,startTime:g}=h;switch(f){case"first-paint":a=g;break;case"first-contentful-paint":l=g;break}}),performance.timing.loadEventEnd||performance.now()>3e4)){u=!0;let{navigationStart:h,requestStart:f,responseStart:g,responseEnd:S,domContentLoadedEventStart:m,domContentLoadedEventEnd:k,loadEventStart:I,loadEventEnd:N}=performance.timing;t.send(yi(f-h||0,g-h||0,S-h||0,m-h||0,k-h||0,I-h||0,N-h||0,a,l))}},30)}if(s.capturePageRenderTimings){let u=0,h=0,f=0,g=null,S=!1;t.ticker.attach(()=>{if(S)return;let m=performance.now();if(n!==null&&(u=Math.max.apply(null,Object.keys(n).map(k=>n[k])),m-u>1e3&&(g=Ta(n),n=null)),f!==null&&(m-f>50&&(h=m),f=m-h>5e3?null:m),g!==null&&f===null||m>3e4){S=!0,n=null;let k=g===null?0:Ia(l||a,g),{domContentLoadedEventEnd:I,navigationStart:N}=performance.timing,y=f===null?Math.max(h,l,I-N||0):0;t.send(Si(k,l>u?l:u,y))}})}}function Bt(t){let e=t.defaultView;return[e&&e.scrollX||t.documentElement&&t.documentElement.scrollLeft||t.body&&t.body.scrollLeft||0,e&&e.scrollY||t.documentElement&&t.documentElement.scrollTop||t.body&&t.body.scrollTop||0]}function Ea(t,e){let s=!1,n=new Map;function i(c){Pi(c)&&(Z(c)&&n.set(c,[c.scrollLeft,c.scrollTop]),ut(c)&&n.set(c,Bt(c)))}let r=t.safe(()=>{e||t.send(ai(...Bt(document)))}),o=t.safe((c,a)=>{let l=t.nodes.getID(a);l!==void 0&&t.send(di(l,c[0],c[1]))});t.attachStartCallback(r),t.attachStopCallback(()=>{s=!1,n.clear()}),t.nodes.attachNodeCallback((c,a)=>{a&&(Z(c)&&c.scrollLeft+c.scrollTop>0?n.set(c,[c.scrollLeft,c.scrollTop]):ut(c)&&n.set(c,Bt(c))),vt(c)&&t.nodes.attachNodeListener(c,"scroll",l=>{i(l.target)})}),t.attachEventListener(document,"scroll",c=>{let a=c.target;if(a===document){s=!0;return}i(a)}),t.ticker.attach(()=>{s&&(r(),s=!1),n.forEach(o),n.clear()},5,!1)}function Na(t){let e,s,n,i,r=document.referrer,o=t.safe(()=>{let{URL:l}=document;if(l!==e){e=l;let u=t.sanitizer.privateMode?Ke(document.title):document.title,h=t.sanitizer.privateMode?Ke(e):e,f=t.sanitizer.privateMode?Ke(r):r;t.send(Fi(h,f,i,u)),i=0,r=e}}),c=t.safe(()=>{let{innerWidth:l,innerHeight:u}=window;(l!==s||u!==n)&&(s=l,n=u,t.send(oi(s,n)))}),a=document.hidden===void 0?Function.prototype:t.safe(()=>t.send(Ci(document.hidden)));t.attachStartCallback(()=>{e=null,i=ge(),s=n=-1,o(),c(),a()}),document.hidden!==void 0&&t.attachEventListener(document,"visibilitychange",a,!1,!1),t.ticker.attach(o,1,!1),t.ticker.attach(c,5,!1)}var xa={checkCssInterval:200,scanInMemoryCSS:!1,checkLimit:void 0};function _a(t,e){if(t===null)return;if(!window.CSSStyleSheet){t.send(Ei("no_stylesheet_prototype_in_window",""));return}let s=q(q({},xa),e),n=new Map,i=null,r=new Set,o=s.checkCssInterval||200,c={};function a(){if(!s.scanInMemoryCSS)return;let m=r.values();for(let k of m)try{let I=ze.get(k);if(!I)continue;if(s.checkLimit&&(c[I]?c[I]++:c[I]=0,c[I]>s.checkLimit)){r.delete(k);return}for(let y=0;y<k.cssRules.length;y++)try{let p=k.cssRules[y],T=`${I}:${y}`,d=n.get(T),w=p.cssText;d!==w&&(d!==void 0&&t.send(Ve(I,y)),t.send(pe(I,w,y,t.getBaseHref())),n.set(T,w))}catch{}let N=Array.from(n.keys()).filter(y=>y.startsWith(`${I}:`));for(let y of N)parseInt(y.split(":")[1],10)>=k.cssRules.length&&n.delete(y)}catch{r.delete(k)}}let l=/{\s*}/;function u(m){return l.test(m)}let h=t.safe((m,k,I)=>{let N=ze.get(m);
26N&&(typeof I=="string"?(t.send(pe(N,I,k,t.getBaseHref())),u(I)&&(n.set(`${N}:${k}`,I),r.add(m))):(t.send(Ve(N,k)),n.has(`${N}:${k}`)&&n.delete(`${N}:${k}`)))}),f=t.safe(m=>{let k=m;for(;k.parentRule;)k=k.parentRule;let I=k.parentStyleSheet;if(!I)return;let N=ze.get(I);if(!N)return;let y=k.cssText,p=Array.from(I.cssRules).indexOf(k);p>=0&&(t.send(pe(N,y,p,t.getBaseHref())),t.send(Ve(N,p+1)),u(y)&&(n.set(`${N}:${p}`,y),r.add(I)))}),g=t.safe(m=>{if(m.__css_tracking_patched__)return;m.__css_tracking_patched__=!0;let{insertRule:k,deleteRule:I}=m.CSSStyleSheet.prototype,{insertRule:N,deleteRule:y}=m.CSSGroupingRule.prototype;m.CSSStyleSheet.prototype.insertRule=function(p,T=0){let d=k.call(this,p,T);return h(this,d,p),d},m.CSSStyleSheet.prototype.deleteRule=function(p){return h(this,p),I.call(this,p)},m.CSSGroupingRule.prototype.insertRule=function(p,T=0){let d=N.call(this,p,T);return f(this),d},m.CSSGroupingRule.prototype.deleteRule=function(p){let T=y.call(this,p);return f(this),T}});g(window),t.observer.attachContextCallback(g),t.nodes.attachNodeCallback(m=>{if(!z(m,"style")||!m.sheet||m.textContent!==null&&m.textContent.trim().length>0)return;let k=t.nodes.getID(m);if(!k)return;let I=m.sheet,N=qs();ze.set(I,N),t.send(St(N,k));for(let y=0;y<I.cssRules.length;y++)try{h(I,y,I.cssRules[y].cssText)}catch{}});function S(){i||!s.scanInMemoryCSS||(i=window.setInterval(a,o))}setTimeout(S,50),t.attachStopCallback(()=>{i&&(clearInterval(i),i=null),n.clear()})}function Ra(t){function e(n){let i=t.nodes.getID(n);i!==void 0&&t.send(Qt(i))}let s=!1;t.nodes.attachNodeCallback(n=>{z(n,"body")&&(t.nodes.attachNodeListener(n,"focus",i=>{Pi(i.target)&&(e(i.target),s=!1)}),t.nodes.attachNodeListener(n,"blur",i=>{i.relatedTarget===null&&(s=!0,setTimeout(()=>{s&&t.send(Qt(-1))},0))}))}),t.attachStartCallback(()=>{let n=document.activeElement;for(;n&&z(n,"iframe")&&n.contentDocument;)n=n.contentDocument.activeElement;n&&n!==n.ownerDocument.body&&e(n)},!0)}function Da(t){if(!window.FontFace)return;let e=new Map,s=n=>{class i extends n.FontFace{constructor(...o){if(typeof o[1]=="string"){let c="";o[2]&&t.safe(()=>{c=JSON.stringify(o[2])});let a=[o[0],o[1],c],l=e.get(n.document)||[];l.push(a),e.set(n.document,l);let u=n===window?0:t.nodes.getID(n.document);if(u===void 0)return;t.active()&&t.send(Yt(u,...a))}super(...o)}}n.FontFace=i};t.observer.attachContextCallback(s),s(window),t.nodes.attachNodeCallback(t.safe(n=>{if(!ut(n))return;let i=e.get(n);if(!i)return;let r=n.defaultView===window?0:t.nodes.getID(n);r!==void 0&&i.forEach(o=>{t.send(Yt(r,...o))})}))}function Oa(t,e,s,n,i){t.debug.log("Openreplay: attaching axios spy to instance",e);function r(f){t.debug.log("Openreplay: capturing axios response data",f);let{headers:g,data:S,method:m,url:k,baseURL:I}=f.config,{data:N,headers:y,status:p,response:T}=f,{data:d,headers:w,status:b}=T||{},v=s.ignoreHeaders,O=Array.isArray(v)?R=>v.includes(R):()=>v;function A(R,P){O(P[0])||(R[P[0]]=P[1])}let _={},C={};g.toJSON?_=g.toJSON():g instanceof Headers?g.forEach((R,P)=>A(_,[P,R])):Array.isArray(g)?g.forEach(R=>A(_,R)):typeof g=="object"&&Object.entries(g).forEach(R=>A(_,R));let E=w||y;E.toJSON?C=E.toJSON():E instanceof Headers?E.forEach((R,P)=>A(C,[P,R])):Array.isArray(E)?E.forEach(R=>A(C,R)):typeof E=="object"&&Object.entries(E).forEach(([R,P])=>{O(R)||(C[R]=P)});let x=n({url:k,method:m||"",status:p||b||0,request:{headers:_,body:S},response:{headers:C,body:d||N}});if(!x){t.debug.log("Openreplay: empty request/response info, skipping");return}let F=f.config.__openreplay_timing,B=performance.now()-F;t.debug.log("Openreplay: final req object",x),t.send(De("xhr",String(m),String(x.url),i(x.request),i(x.response),x.status,F+ge(),B,0))}function o(f){if(t.debug.log("Openreplay: capturing API request",f),f.__openreplay_timing=performance.now(),s.sessionTokenHeader){let g=typeof s.sessionTokenHeader=="string"?s.sessionTokenHeader:"X-OpenReplay-Session-Token",S=t.getSessionToken();S&&f.headers.set(g,S)}return f}function c(f){return s.failuresOnly||r(f),f}function a(f){return t.debug.log("Openreplay: capturing API request error",f),Ma(f)&&f.response?r(f.response):f instanceof Error&&t.send(
26ht(f,[])),Promise.reject(f)}function l(f){t.debug.log("Openreplay: failed API request, skipping",f)}let u=e.interceptors.request.use(o,l,{synchronous:!0}),h=e.interceptors.response.use(c,a,{synchronous:!0});t.attachStopCallback(()=>{e.interceptors.request.eject?.(u),e.interceptors.response.eject?.(h)})}function Ma(t){return Aa(t)&&t.isAxiosError===!0}function Aa(t){return t!==null&&typeof t=="object"}var Le=new Set(["password","pass","pwd","mdp","token","bearer","jwt","api_key","api-key","apiKey","secret","ssn","zip","zipcode","x-api-key","www-authenticate","x-csrf-token","x-requested-with","x-forwarded-for","x-real-ip","cookie","authorization","auth","proxy-authorization","set-cookie","account_key"]);function Fa(t){return(Math.log10((t^t>>31)-(t>>31))|0)+1}function dt(t){if(typeof t=="number"){let e=Fa(t);return"9".repeat(e)}return typeof t=="string"?t.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,"*"):t}function Ln(t){let e={};if(Array.isArray(t))t.forEach(({name:s,value:n})=>{Le.has(s.toLowerCase())?e[s]=dt(n):e[s]=n});else for(let[s,n]of Object.entries(t))Le.has(s.toLowerCase())?e[s]=dt(n):e[s]=n;return e}function Bn(t){if(!t)return t;let e,s=!1;try{e=JSON.parse(t),s=!0}catch{}if(s)return pt(e),JSON.stringify(e);if(typeof t=="string"&&t.includes("?")&&t.includes("="))try{let i=new URLSearchParams(t);for(let r of i.keys())if(Le.has(r.toLowerCase())){let o=dt(i.get(r));i.set(r,o)}return i.toString()}catch{return t}else return t}function La(t){return pt(t),t}function pt(t){if(Array.isArray(t))t.forEach(pt);else if(t&&typeof t=="object")for(let e in t)Object.hasOwn(t,e)&&(Le.has(e.toLowerCase())?t[e]=dt(t[e]):t[e]!==null&&typeof t[e]=="object"&&pt(t[e]))}function Ba(t){if(!t)return"";try{let e=new URL(t);if(e.searchParams)for(let s of e.searchParams.keys())Le.has(s.toLowerCase())&&e.searchParams.set(s,"******");return e.toString()}catch{return t}}var Be=class{constructor(e=[],s,n){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.id="",this.name="",this.method="",this.url="",this.status=0,this.statusText="",this.cancelState=0,this.readyState=0,this.header={},this.responseType="",this.requestType="xhr",this.requestHeader={},this.responseSize=0,this.responseSizeText="",this.startTime=0,this.endTime=0,this.duration=0,this.getData={},this.requestData=null}getMessage(){let{reqHs:e,resHs:s}=this.writeHeaders(),n=this.method==="GET"?JSON.stringify(La(this.getData)):Bn(this.requestData),i={headers:Ln(e),body:n},r={headers:Ln(s),body:Bn(this.response)},o=this.sanitize({url:Ba(this.url),method:this.method,status:this.status,request:i,response:r});if(!o)return null;if(o.url.includes("/graphql")&&o.response.body&&typeof o.response.body=="string"){let a=o.response.body.includes("errors");o.status=a?400:200,this.requestType="graphql"}return{requestType:this.requestType,method:o.method,url:o.url,request:JSON.stringify(o.request),response:JSON.stringify(o.response),status:o.status,startTime:this.startTime,duration:this.duration,responseSize:this.responseSize}}writeHeaders(){let e={};Object.entries(this.requestHeader).forEach(([n,i])=>{this.isHeaderIgnored(n)||(e[n]=i)}),this.setSessionTokenHeader((n,i)=>{e[n]=i});let s={};return Object.entries(this.header).forEach(([n,i])=>{this.isHeaderIgnored(n)||(s[n]=i)}),{reqHs:e,resHs:s}}isHeaderIgnored(e){return Array.isArray(this.ignoredHeaders)?this.ignoredHeaders.map(s=>s.toLowerCase()).includes(e.toLowerCase()):this.ignoredHeaders}},Me=(t,e)=>{let s="";switch(t){case"":case"text":case"json":typeof e=="string"?s=e:Ks(e)||Array.isArray(e)?s=JSON.stringify(e):typeof e<"u"&&(s=Object.prototype.toString.call(e));break;case"blob":case"document":case"arraybuffer":default:typeof e<"u"&&(s=Object.prototype.toString.call(e));break}return s},Gs=t=>{if(!t)return null;let e;if(typeof t=="string"){(t[0]==="{"||t[0]==="[")&&(e=t);let s=t.split("&");s.length===1?e=t:e=s.join(",")}else if(Ua(t)){let s=[];for(let[n,i]of t)s.push(`${n}=${typeof i=="string"?i:"[object Object]"}`);e=s.join(",")}else t instanceof Blob||t instanceof ReadableStream||t instanceof ArrayBuffer?e="byte data":Ks(t)?e=t:e=`can't parse body ${typeof t}`;return e},Pa=(t,e={})=>{Ks(e)||(e={});let s=t?t.split("?"):[];if(s.shift(),s.length>0){s=s.join("?").split("&");for(let n of s){let i=n.split("=");try{e[i[0]]=decodeURIComponent(i[1])}catch{e[i[0]]=i[1]}}}return e};function Ks(t){return t!==null&&typeof t=="object"}function Ua(t){return t==null||ArrayBuffer.isView(t)?!1:typeof Symbol<"u"&&typeof t[Symbol.iterator]=="function"}function gt(t){return t<=0?"":t>=1e3*1e3?(t/1e3/1e3).toFixed(1)+" MB":t>=1e3?(t/1e3).toFixed(1)+" KB":`${t}B`}var Es=t=>(t.startsWith("//")&&(t=`${new URL(window.location.href).protocol}${t}`),t.startsWith("http")?new URL(t):new URL(t,window.location.href)),Ha=t=>t instanceof Blob?t.type:t instanceof FormData?"multipart/form-data":t instanceof URLSearchParams?"a
26pplication/x-www-form-urlencoded;charset=UTF-8":"text/plain;charset=UTF-8",Ns=class{constructor(e,s,n,i,r){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.sendMessage=i,this.isServiceUrl=r}apply(e,s,n){let i=n[0],r=n[1],o=new Be(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(i))return e.apply(s,n);let c=Es(i);if(o.method="POST",o.url=i,o.name=(c.pathname.split("/").pop()||"")+c.search,o.requestType="beacon",o.requestHeader={"Content-Type":Ha(r)},o.status=0,o.statusText="Pending",c.search&&c.searchParams){o.getData={};for(let[u,h]of c.searchParams)o.getData[u]=h}o.requestData=Gs(r),o.startTime||(o.startTime=performance.now());let a=e.apply(s,n);a?(o.endTime=performance.now(),o.duration=o.endTime-(o.startTime||o.endTime),o.status=0,o.statusText="Sent",o.readyState=4):(o.status=500,o.statusText="Unknown");let l=o.getMessage();return l&&this.sendMessage(l),a}},xs=class{static create(e,s,n,i,r,o){if(e)return new Proxy(e,new Ns(s,n,i,r,o))}},oe=(function(t){return t[t.UNSENT=0]="UNSENT",t[t.OPENED=1]="OPENED",t[t.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",t[t.LOADING=3]="LOADING",t[t.DONE=4]="DONE",t})(oe||{}),_s=class{constructor(e,s){this.resp=e,this.item=s,this.mockReader()}set(e,s,n){return Reflect.set(e,s,n)}get(e,s){let n=Reflect.get(e,s);switch(s){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=s.toLowerCase(),n.apply(e).then(i=>(this.item.response=Me(this.item.responseType,i),i)))}return typeof n=="function"?n.bind(e):n}mockReader(){let e;if(!this.resp.body||typeof this.resp.body.getReader!="function")return;let s=this.resp.clone(),n=s.body.getReader;s.body.getReader=()=>{let i=n.apply(this.resp.body);if(this.item.readyState===oe.DONE)return i;let r=i.read,o=i.cancel;return this.item.responseType="arraybuffer",i.read=()=>r.apply(i).then(c=>{if(!e)e=new Uint8Array(c.value);else{let a=new Uint8Array(e.length+c.value.length);a.set(e),a.set(c.value,e.length),e=a}return this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=c.done?4:3,this.item.statusText=c.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=gt(this.item.responseSize),c.done&&(this.item.response=Me(this.item.responseType,e)),c}),i.cancel=(...c)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=Me(this.item.responseType,e),o.apply(i,c)),i}}},Rs=class{constructor(e,s,n,i,r,o){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.sendMessage=i,this.isServiceUrl=r,this.tokenUrlMatcher=o}apply(e,s,n){let i=n[0],r=n[1];if(!i||typeof i!="string"&&!i?.url||(i instanceof URL||typeof i=="string"?this.isServiceUrl(String(i)):this.isServiceUrl(String(i.url))))return e.apply(window,n);let c=new Be(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);return this.beforeFetch(c,i,r),this.setSessionTokenHeader((a,l)=>{if(!(this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(c.url))){if(n[1]===void 0&&n[0]instanceof Request)return n[0].headers.append(a,l);n[1]||(n[1]={}),n[1].headers===void 0&&(n[1]=Object.assign(Object.assign({},n[1]),{headers:{}})),n[1].headers instanceof Headers?n[1].headers.append(a,l):Array.isArray(n[1].headers)?n[1].headers.push([a,l]):n[1].headers[a]=l}}),e.apply(window,n).then(this.afterFetch(c)).catch(a=>{throw c.endTime=performance.now(),c.duration=c.endTime-(c.startTime||c.endTime),a})}beforeFetch(e,s,n){let i,r="GET",o={};if(typeof s=="string"?(r=n?.method||"GET",i=Es(s),o=n?.headers||{}):(r=s.method||"GET",i=Es(s.url),o=s.headers),e.method=r,e.requestType="fetch",e.requestHeader=o,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,e.startTime||(e.startTime=performance.now()),Object.prototype.toString.call(o)==="[object Headers]"){e.requestHeader={};for(let[c,a]of o)e.requestHeader[c]=a}else e.requestHeader=o;if(i.search&&i.searchParams){e.getData={};for(let[c,a]of i.searchParams)e.getData[c]=a}n?.body&&(e.requestData=Gs(n.body))}afterFetch(e){return s=>{e.endTime=performance.now(),e.duration=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let n=!1;e.header={};for(let[i,r]of s.headers)e.header[i]=r,n=r.toLowerCase().indexOf("chunked")>-1?!0:n;return n?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(i=>{e.responseSize=typeof i=="string"?i.length:i.byteLength,e.responseSizeText=gt(e.responseSize),e.response=Me(e.responseType,i);let r=e.getMessage();r&&this.sendMessage(r)}
26).catch(i=>{if(i.name!=="AbortError")throw i})),new Proxy(s,new _s(s,e))}}handleResponseBody(e,s){let n=e.headers.get("content-type");return n&&n.includes("application/json")?(s.responseType="json",e.text()):n&&(n.includes("text/html")||n.includes("text/plain"))?(s.responseType="text",e.text()):(s.responseType="arraybuffer",e.arrayBuffer())}},Ds=class{static create(e,s,n,i,r,o){return new Proxy(fetch,new Rs(e,s,n,i,r,o))}},Os=class{constructor(e,s,n,i,r,o,c){this.ignoredHeaders=s,this.setSessionTokenHeader=n,this.sanitize=i,this.sendMessage=r,this.isServiceUrl=o,this.tokenUrlMatcher=c,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new Be(s,n,i),this.item.requestType="xhr"}get(e,s){switch(s){case"open":return this.getOpen(e);case"send":return this.setSessionTokenHeader((i,r)=>{this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(this.item.url)||e.setRequestHeader(i,r)}),this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:let n=Reflect.get(e,s);return typeof n=="function"?n.bind(e):n}}set(e,s,n){switch(s){case"onreadystatechange":return this.setOnReadyStateChange(e,s,n);case"onabort":return this.setOnAbort(e,s,n);case"ontimeout":return this.setOnTimeout(e,s,n)}return Reflect.set(e,s,n)}onReadyStateChange(){if(!(this.item.url&&this.isServiceUrl(this.item.url))&&(this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=performance.now(),this.item.duration=this.item.endTime-this.item.startTime,this.updateItemByReadyState(),setTimeout(()=>{this.item.response=Me(this.item.responseType,this.item.response)},0),this.XMLReq.readyState===oe.DONE)){let e=this.item.getMessage();e&&this.sendMessage(e)}}onAbort(){this.item.cancelState=1,this.item.statusText="Abort";let e=this.item.getMessage();e&&this.sendMessage(e)}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout";let e=this.item.getMessage();e&&this.sendMessage(e)}getOpen(e){let s=Reflect.get(e,"open");return(...n)=>{var i,r,o;let c=n[0],a=n[1];return this.item.method=c?c.toUpperCase():"GET",this.item.url=((i=a.toString)===null||i===void 0?void 0:i.call(a))||"",this.item.name=(o=(r=this.item.url)===null||r===void 0?void 0:r.replace(new RegExp("/*$"),"").split("/").pop())!==null&&o!==void 0?o:"",this.item.getData=Pa(this.item.url,{}),s.apply(e,n)}}getSend(e){let s=Reflect.get(e,"send");return(...n)=>{let i=n[0];return this.item.requestData=Gs(i),s.apply(e,n)}}getSetRequestHeader(e){let s=Reflect.get(e,"setRequestHeader");return(...n)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[n[0]]=n[1],s.apply(e,n))}setOnReadyStateChange(e,s,n){return Reflect.set(e,s,(...i)=>{this.onReadyStateChange(),n?.apply(e,i)})}setOnAbort(e,s,n){return Reflect.set(e,s,(...i)=>{this.onAbort(),n.apply(e,i)})}setOnTimeout(e,s,n){return Reflect.set(e,s,(...i)=>{this.onTimeout(),n.apply(e,i)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case oe.UNSENT:case oe.OPENED:this.item.status=oe.UNSENT,this.item.statusText="Pending",this.item.startTime||(this.item.startTime=performance.now());break;case oe.HEADERS_RECEIVED:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};let e=this.XMLReq.getAllResponseHeaders()||"",s=e.split(` 27`);for(let n=0;n<s.length;n++){let i=s[n];if(!i)continue;let r=i.split(": "),o=r[0];this.item.header[o]=r.slice(1).join(": ")}break;case oe.LOADING:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=gt(this.item.responseSize));break;case oe.DONE:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=this.XMLReq.response,this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=gt(this.item.responseSize));break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown";break}}},Ms=class{static create(e,s,n,i,r,o){return new Proxy(XMLHttpRequest,{construct(c){let a=new c;return new Proxy(a,new Os(a,e,s,n,i,r,o))}})}},Pn=t=>{let e=`Openreplay: Can't find ${t} in global context.`;console.warn(e)};function ja(t,e,s,n,i,r,o={xhr:!0,fetch:!0,beacon:!0},c){var a;if(t&&(o.xhr&&(t.XMLHttpRequest?t.XMLHttpRequest=Ms.create(e,s,n,i,r,c):Pn("XMLHttpRequest")),o.fetch&&(t.fetch?t.fetch=Ds.create(e,s,n,i,r,c):Pn("fetch")),o.beacon&&!((a=t.navigator)===null||a===void 0)&&a.sendBeacon)){let l=t.navigator.sendBeacon;t.navigator.sendBeacon=xs.create(l,e,s,n,i,r)}}function Pt(t){return t.__or_req_data__||(t.__or_req_data__={body:void 0,headers:{}}),t.__or_req_data__}function Un(t){return typeof t=="string"?t.toUpperCase():"GET"}function za(t,e={}){if(e.disabled)return;let s=Object.assign({failuresOnly:!1,ignoreHeaders:["cookie","set-cookie","authorization"],capturePayload:!1,sessionTokenHeader:!1,captureInIframes:!0,axiosInstances:void 0,useProxy:!0}
27,e);s.useProxy===!1&&t.debug.warn("Network module is migrating to proxy api, to gradually migrate and test it set useProxy to true");let n=s.ignoreHeaders,i=Array.isArray(n)?u=>n.includes(u):()=>n,r=s.sessionTokenHeader===!0?"X-OpenReplay-SessionToken":s.sessionTokenHeader;function o(u){if(r){let h=t.getSessionToken();h&&t.safe(u)(r,h)}}function c(u){if((!s.capturePayload||t.sanitizer.privateMode)&&(delete u.request.body,delete u.response.body),s.sanitizer){let h=u.response.body;if(typeof h=="string")try{u.response.body=JSON.parse(h)}catch{}return s.sanitizer(u)}return u}function a(u){if(u&&typeof u.body!="string")try{u.body=JSON.stringify(u.body)}catch{u.body="<unable to stringify>",t.notify.warn("Openreplay fetch couldn't stringify body:",u.body)}return JSON.stringify(u)}let l=u=>{if(s.useProxy)return ja(u,t.sanitizer.privateMode?!0:s.ignoreHeaders,o,c,y=>{if(s.failuresOnly&&y.status<400)return;let p=t.sanitizer.privateMode?"************":y.url;t.send(De(y.requestType,y.method,p,y.request,y.response,y.status,y.startTime+ge(),y.duration,y.responseSize))},y=>t.isServiceURL(y),{xhr:!0,fetch:!0,beacon:!0},s.tokenUrlMatcher);let h=u.fetch.bind(u),f=(y,p={})=>{if(!(typeof y=="string"||y instanceof URL)||t.isServiceURL(String(y)))return h(y,p);o(function(d,w){p.headers===void 0&&(p.headers={}),p.headers instanceof Headers?p.headers.append(d,w):Array.isArray(p.headers)?p.headers.push([d,w]):p.headers[d]=w});let T=performance.now();return h(y,p).then(d=>{let w=performance.now()-T;if(s.failuresOnly&&d.status<400)return d;let b=d.clone();return b.text().then(v=>{let O={},A={};if(n!==!0){let E=([x,F])=>{i(x)||(O[x]=F)};p.headers instanceof Headers?p.headers.forEach((x,F)=>E([F,x])):Array.isArray(p.headers)?p.headers.forEach(E):typeof p.headers=="object"&&Object.entries(p.headers).forEach(E),b.headers.forEach((x,F)=>{i(F)||(A[F]=x)})}let _=Un(p.method),C=c({url:String(y),method:_,status:b.status,request:{headers:O,body:p.body||null},response:{headers:A,body:v}});C&&t.send(De("fetch",_,String(C.url),a(C.request),a(C.response),b.status,T+ge(),w,0))}).catch(v=>t.debug.error("Could not process Fetch response:",v)),d})};u.fetch=f;let g=u.XMLHttpRequest.prototype.open,S=u.XMLHttpRequest.prototype.setRequestHeader,m=u.XMLHttpRequest.prototype.send;function k(y,p){let T=this;o((w,b)=>T.setRequestHeader(w,b));let d=0;return T.addEventListener("loadstart",w=>{d=w.timeStamp}),T.addEventListener("load",t.safe(w=>{let{headers:b,body:v}=Pt(T),O=d>0?w.timeStamp-d:0,_=(T.getAllResponseHeaders()||"").trim().split(/[\r\n]+/),C={};_.forEach(function(F){let B=F.split(": "),R=B.shift();i(R)||(C[R]=B.join(": "))});let E=Un(y),x=c({url:String(p),method:E,status:T.status,request:{headers:b,body:v||null},response:{headers:C,body:T.response}});x&&t.send(De("xhr",E,String(x.url),a(x.request),a(x.response),T.status,d+ge(),O,0))})),g.apply(this,arguments)}function I(y){let p=Pt(this);return p.body=y,m.apply(this,arguments)}function N(y,p){if(!i(y)){let T=Pt(this);T.headers[y]=p}return S.apply(this,arguments)}s.axiosInstances||(u.XMLHttpRequest.prototype.open=k,u.XMLHttpRequest.prototype.send=I,u.XMLHttpRequest.prototype.setRequestHeader=N)};l(window),s.axiosInstances&&s.axiosInstances.forEach(u=>{Oa(t,u,s,c,a)}),s.captureInIframes&&t.observer.attachContextCallback(t.safe(l))}function qa(t){t.attachEventListener(document,"selectionchange",()=>{let e=document.getSelection();if(e!==null&&!e.isCollapsed){let s=t.nodes.getID(e.anchorNode),n=t.nodes.getID(e.focusNode),i=e.toString().replace(/\s+/g," ");s&&n&&t.send(ts(s,n,i))}else t.send(ts(-1,-1,""))})}function Wa(t){function e(){document.hidden||(t.debug.log("Openreplay: tab change to"+t.session.getTabId()),t.send(Oe(t.session.getTabId())))}t.attachEventListener(window,"focus",e,!1,!1)}var Xa=Xr,Ye="/en/sdk";function $a(t){if(t==null)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${nt}${Ye}`),!1;if(typeof t.projectKey!="string")if(typeof t.projectKey!="number"){if(typeof t.projectID!="number")return console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${nt}${Ye} for more information.`),!1;t.projectKey=t.projectID.toString(),ue("`projectID` option","`projectKey` option",Ye)}else console.warn("OpenReplay: projectKey is expected to have a string type."),t.projectKey=t.projectKey.toString();return t.sessionToken!=null&&ue("`sessionToken` option","`sessionHash` start() option","/"),!0}var Va=()=>{try{return!!window.top?.document}catch{return!1}},As=class{constructor(e){if(this.options=e,this.app=null,this.crossdomainMode=!1,this.checkDoNotTrack=()=>this.options.respectDoNotTrack&&(navigator.doNotTrack=="1"||window.doNotTrack=="1"),this.signalStartIssue=(a,l)=>{let u=this.checkDoNotTrack();console.log("Tracker couldn't start due to:",JSON.stringify({trackerVersion:"16.3.0",projectKey:this.options.projectKey,doNotTrack:u,reason:l.length?`missing api: ${l.join(",")}`:a}))},this.restartCanvasTracking=()=>{this.app!==null&&this.app.restartCanvasTracking()},this.handleError=(a,l={})=>
27{if(this.app!==null){if(a instanceof Error){let u=ht(a,[],l);this.app.send(u)}else if(a instanceof ErrorEvent||"PromiseRejectionEvent"in window&&a instanceof PromiseRejectionEvent){let u=ji(a,void 0,l);u!=null&&this.app.send(u)}}},this.crossdomainMode=!!(an()&&e.crossdomain?.enabled),!D||!$a(e))return;if(window.__OPENREPLAY__||!this.crossdomainMode&&an()&&Va()&&window.top.__OPENREPLAY__){console.error("OpenReplay: one tracker instance has been initialised already");return}if(!e.__DISABLE_SECURE_MODE&&location.protocol!=="https:"){console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");return}let s=this.checkDoNotTrack(),n=[],i=["Map","Set","MutationObserver","performance","timing","startsWith","Blob","Worker"];if(s)n.push("doNotTrack");else for(let a of i)if(a==="timing"){if("performance"in window&&!(a in performance)){n.push(a);break}}else if(a==="startsWith"){if(!(a in String.prototype)){n.push(a);break}}else if(!(a in window)){n.push(a);break}if(n.length>0){let a=n.join(",");console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${a}`),this.signalStartIssue("missing_api",n);return}let r=new ks(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);this.app=r,this.crossdomainMode||(Na(r),Mo(r),Gr(r,e),Wa(r)),ca(r,e.mouse),Ea(r,this.crossdomainMode),_a(r,e.css),Eo(r),Bo(r,e),Yo(r,e),ea(r),ra(r,e),Ca(r,e),Ra(r),Da(r),e.network?.disabled||za(r,e.network),qa(r),window.__OPENREPLAY__=this,e.flags&&e.flags.onFlagsLoad&&this.onFlagsLoad(e.flags.onFlagsLoad);let c=window.open;(e.autoResetOnWindowOpen||e.resetTabOnWindowOpen)&&(r.attachStartCallback(()=>{let a=r.getTabId(),l=r.sessionStorage??window.sessionStorage;window.open=function(...u){return e.autoResetOnWindowOpen&&r.resetNextPageSession(!0),e.resetTabOnWindowOpen&&l.removeItem(e.session_tabid_key||"__openreplay_tabid"),r.resetNextPageSession(!1),l.setItem(e.session_tabid_key||"__openreplay_tabid",a),c.call(window,...u)}}),r.attachStopCallback(()=>{window.open=c}))}isFlagEnabled(e){return this.featureFlags.isFlagEnabled(e)}onFlagsLoad(e){this.app?.featureFlags.onFlagsLoad(e)}clearPersistFlags(){this.app?.featureFlags.clearPersistFlags()}reloadFlags(){return this.app?.featureFlags.reloadFlags()}getFeatureFlag(e){return this.app?.featureFlags.getFeatureFlag(e)}getAllFeatureFlags(){return this.app?.featureFlags.flags}use(e){return e(this.app,this.options)}isActive(){return this.app===null?!1:this.app.active()}trackWs(e){if(this.app!==null)return this.app.trackWs(e)}start(e){return this.browserEnvCheck()?this.app===null?Promise.reject("Browser doesn't support required api, or doNotTrack is active."):this.app.start(e):Promise.reject("Trying to start not in browser.")}browserEnvCheck(){return D?!0:(console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${nt}${Ye}`),!1)}coldStart(e,s){if(this.browserEnvCheck()){if(this.app===null)return Promise.reject("Tracker not initialized");this.app.coldStart(e,s)}else return Promise.reject("Trying to start not in browser.")}startOfflineRecording(e,s){return this.browserEnvCheck()?this.app===null?Promise.reject("Tracker not initialized"):this.app.offlineRecording(e,s):Promise.reject("Trying to start not in browser.")}uploadOfflineRecording(){if(this.app!==null)return this.app.uploadOfflineRecording()}stop(){if(this.app!==null)return this.app.stop(),this.app.session.getSessionHash()}forceFlushBatch(){this.app!==null&&this.app.forceFlushBatch()}getSessionToken(){return this.app===null?null:this.app.getSessionToken()}getSessionInfo(){return this.app===null?null:this.app.session.getInfo()}getSessionID(){return this.app===null?null:this.app.getSessionID()}getTabId(){return this.app===null?null:this.app.getTabId()}getUxId(){return this.app===null?null:this.app.getUxtId()}sessionID(){return ue("'sessionID' method","'getSessionID' method","/"),this.get
27SessionID()}getSessionURL(e){if(this.app!==null)return this.app.getSessionURL(e)}setUserID(e){typeof e=="string"&&this.app!==null&&this.app.session.setUserID(e)}userID(e){ue("'userID' method","'setUserID' method","/"),this.setUserID(e)}setUserAnonymousID(e){typeof e=="string"&&this.app!==null&&this.app.send(ki(e))}userAnonymousID(e){ue("'userAnonymousID' method","'setUserAnonymousID' method","/"),this.setUserAnonymousID(e)}setMetadata(e,s){typeof e=="string"&&typeof s=="string"&&this.app!==null&&this.app.session.setMetadata(e,s)}metadata(e,s){ue("'metadata' method","'setMetadata' method","/"),this.setMetadata(e,s)}event(e,s=null,n=!1){if(typeof e=="string"&&this.app!==null){if(n)return this.issue(e,s);try{s=JSON.stringify(s)}catch{return}this.app.send(vi(e,s))}}issue(e,s=null){if(typeof e=="string"&&this.app!==null){try{s=JSON.stringify(s)}catch{return}this.app.send(Ni(e,s))}}},Fs=class{constructor(){this.instance=null,this.isConfigured=!1}configure(e){if(D){if(this.isConfigured){console.warn("OpenReplay: Tracker is already configured. You should only call configure once.");return}if(!e.projectKey){console.error("OpenReplay: Missing required projectKey option");return}this.instance=new As(e),this.isConfigured=!0}}get options(){return this.instance?.options||null}start(e){return D?this.ensureConfigured()?this.instance?.start(e)||Promise.resolve({success:!1,reason:"Tracker not initialized"}):Promise.resolve({success:!1,reason:"Tracker not configured"}):Promise.resolve({success:!1,reason:"Not in browser environment"})}stop(){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.stop()}setUserID(e){!D||!this.ensureConfigured()||!this.instance||this.instance.setUserID(e)}setMetadata(e,s){!D||!this.ensureConfigured()||!this.instance||this.instance.setMetadata(e,s)}getSessionURL(e){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.getSessionURL(e)}getSessionID(){return!D||!this.ensureConfigured()||!this.instance?null:this.instance.getSessionID()}getSessionToken(){return!D||!this.ensureConfigured()||!this.instance?null:this.instance.getSessionToken()}event(e,s=null,n=!1){!D||!this.ensureConfigured()||!this.instance||this.instance.event(e,s,n)}issue(e,s=null){!D||!this.ensureConfigured()||!this.instance||this.instance.issue(e,s)}handleError(e,s={}){!D||!this.ensureConfigured()||!this.instance||this.instance.handleError(e,s)}isFlagEnabled(e){return!D||!this.ensureConfigured()||!this.instance?!1:this.instance.isFlagEnabled(e)}onFlagsLoad(...e){!D||!this.ensureConfigured()||!this.instance||this.instance.onFlagsLoad(...e)}clearPersistFlags(){!D||!this.ensureConfigured()||!this.instance||this.instance.clearPersistFlags()}reloadFlags(){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.reloadFlags()}getFeatureFlag(e){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.getFeatureFlag(e)}getAllFeatureFlags(){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.getAllFeatureFlags()}restartCanvasTracking(){!D||!this.ensureConfigured()||!this.instance||this.instance.restartCanvasTracking()}setUserAnonymousID(e){!D||!this.ensureConfigured()||!this.instance||this.instance.setUserAnonymousID(e)}isActive(){return!D||!this.ensureConfigured()||!this.instance?!1:this.instance.isActive()}getInstance(){return!this.ensureConfigured()||!D?null:this.instance}coldStart(e,s){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.coldStart(e,s)}trackWs(e){return!D||!this.ensureConfigured()||!this.instance?()=>{}:this.instance.trackWs(e)}ensureConfigured(){return!this.isConfigured&&D?(console.warn('OpenReplay: Tracker must be configured before use. Call tracker.configure({projectKey: "your-project-key"}) first.'),!1):!0}use(e){return!D||!this.ensureConfigured()||!this.instance?e(null):this.instance.use(e)}startOfflineRecording(...e){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.startOfflineRecording(...e)}uploadOfflineRecording(){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.uploadOfflineRecording()}forceFlushBatch(){if(!(!D||!this.ensureConfigured()||!this.instance))return this.instance.forceFlushBatch()}getSessionInfo(){return!D||!this.ensureConfigured()||!this.instance?null:this.instance.getSessionInfo()}getTabId(){return!D||!this.ensureConfigured()||!this.instance?null:this.instance.getTabId()}getUxId(){return!D||!this.ensureConfigured()||!this.instance?null:this.instance.getUxId()}},Ga=new Fs;export{ks as App,Xa as Messages,ys as SanitizeLevel,As as default,Ga as tracker};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.