mixpanel-browser 2.57.1 → 2.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ **2.58.0** (16 Dec 2024)
2
+ - Added canvas recording option
3
+ - Session Replay checkpoint events now include a starting URL
4
+
1
5
  **2.57.1** (12 Dec 2024)
2
6
  - Asynchronous abstractions (primarily Promise support) introduced in internal refactor of batch/queue/retry system.
3
7
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  var Config = {
4
4
  DEBUG: false,
5
- LIB_VERSION: '2.57.1'
5
+ LIB_VERSION: '2.58.0'
6
6
  };
7
7
 
8
8
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -4745,6 +4745,7 @@ var DEFAULT_CONFIG = {
4745
4745
  'hooks': {},
4746
4746
  'record_block_class': new RegExp('^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$'),
4747
4747
  'record_block_selector': 'img, video',
4748
+ 'record_canvas': false,
4748
4749
  'record_collect_fonts': false,
4749
4750
  'record_idle_timeout_ms': 30 * 60 * 1000, // 30 minutes
4750
4751
  'record_mask_text_class': new RegExp('^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$'),
@@ -4510,7 +4510,7 @@
4510
4510
 
4511
4511
  var Config = {
4512
4512
  DEBUG: false,
4513
- LIB_VERSION: '2.57.1'
4513
+ LIB_VERSION: '2.58.0'
4514
4514
  };
4515
4515
 
4516
4516
  // since es6 imports are static and we run unit tests from the console, window won't be defined when importing this file
@@ -7680,6 +7680,7 @@
7680
7680
 
7681
7681
  this.seqNo = 0;
7682
7682
  this.replayStartTime = null;
7683
+ this.replayStartUrl = null;
7683
7684
  this.batchStartUrl = null;
7684
7685
 
7685
7686
  this.idleTimeoutId = null;
@@ -7731,6 +7732,7 @@
7731
7732
 
7732
7733
  this.replayStartTime = new Date().getTime();
7733
7734
  this.batchStartUrl = _.info.currentUrl();
7735
+ this.replayStartUrl = _.info.currentUrl();
7734
7736
 
7735
7737
  if (shouldStopBatcher || this.recordMinMs > 0) {
7736
7738
  // the primary case for shouldStopBatcher is when we're starting recording after a reset
@@ -7767,9 +7769,17 @@
7767
7769
  'blockClass': this.getConfig('record_block_class'),
7768
7770
  'blockSelector': blockSelector,
7769
7771
  'collectFonts': this.getConfig('record_collect_fonts'),
7772
+ 'dataURLOptions': { // canvas image options (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
7773
+ 'type': 'image/webp',
7774
+ 'quality': 0.6
7775
+ },
7770
7776
  'maskAllInputs': true,
7771
7777
  'maskTextClass': this.getConfig('record_mask_text_class'),
7772
- 'maskTextSelector': this.getConfig('record_mask_text_selector')
7778
+ 'maskTextSelector': this.getConfig('record_mask_text_selector'),
7779
+ 'recordCanvas': this.getConfig('record_canvas'),
7780
+ 'sampling': {
7781
+ 'canvas': 15
7782
+ }
7773
7783
  });
7774
7784
 
7775
7785
  if (typeof this._stopRecording !== 'function') {
@@ -7887,6 +7897,7 @@
7887
7897
  'replay_id': replayId,
7888
7898
  'replay_length_ms': replayLengthMs,
7889
7899
  'replay_start_time': this.replayStartTime / 1000,
7900
+ 'replay_start_url': this.replayStartUrl,
7890
7901
  'seq': this.seqNo
7891
7902
  };
7892
7903
  var eventsJson = _.JSONEncode(data);
@@ -29,11 +29,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
29
29
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
30
30
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
31
31
  PERFORMANCE OF THIS SOFTWARE.
32
- ***************************************************************************** */function e(d,c,f,p){function h(g){return g instanceof f?g:new f(function(m){m(g)})}return new(f||(f=Promise))(function(g,m){function v(y){try{b(p.next(y))}catch(S){m(S)}}function w(y){try{b(p.throw(y))}catch(S){m(S)}}function b(y){y.done?g(y.value):h(y.value).then(v,w)}b((p=p.apply(d,c||[])).next())})}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=typeof Uint8Array>"u"?[]:new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;var i=function(d){var c=new Uint8Array(d),f,p=c.length,h="";for(f=0;f<p;f+=3)h+=t[c[f]>>2],h+=t[(c[f]&3)<<4|c[f+1]>>4],h+=t[(c[f+1]&15)<<2|c[f+2]>>6],h+=t[c[f+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,a=new Map;function u(d,c,f){return e(this,void 0,void 0,function*(){const p=`${d}-${c}`;if("OffscreenCanvas"in globalThis){if(a.has(p))return a.get(p);const h=new OffscreenCanvas(d,c);h.getContext("2d");const m=yield(yield h.convertToBlob(f)).arrayBuffer(),v=i(m);return a.set(p,v),v}else return""})}const s=self;s.onmessage=function(d){return e(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:c,bitmap:f,width:p,height:h,dataURLOptions:g}=d.data,m=u(p,h,g),v=new OffscreenCanvas(p,h);v.getContext("2d").drawImage(f,0,0),f.close();const b=yield v.convertToBlob(g),y=b.type,S=yield b.arrayBuffer(),I=i(S);if(!o.has(c)&&(yield m)===I)return o.set(c,I),s.postMessage({id:c});if(o.get(c)===I)return s.postMessage({id:c});s.postMessage({id:c,type:y,base64:I,width:p,height:h}),o.set(c,I)}else return s.postMessage({id:d.data.id})})}})()},null);class Kn{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(s,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(d)};const{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:u}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,i,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:u})}initCanvasFPSObserver(t,r,n,i,o){const a=fr(r,n,i,!0),u=new Map,s=new Xn;s.onmessage=g=>{const{id:m}=g.data;if(u.set(m,!1),!("base64"in g.data))return;const{base64:v,type:w,width:b,height:y}=g.data;this.mutationCb({id:m,type:be["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:w}]},0,0]}]})};const d=1e3/t;let c=0,f;const p=()=>{const g=[];return r.document.querySelectorAll("canvas").forEach(m=>{z(m,n,i,!0)||g.push(m)}),g},h=g=>{if(c&&g-c<d){f=requestAnimationFrame(h);return}c=g,p().forEach(m=>Un(this,void 0,void 0,function*(){var v;const w=this.mirror.getId(m);if(u.get(w)||m.width===0||m.height===0)return;if(u.set(w,!0),["webgl","webgl2"].includes(m.__context)){const y=m.getContext(m.__context);((v=y?.getContextAttributes())===null||v===void 0?void 0:v.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(m);s.postMessage({id:w,bitmap:b,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[b])})),f=requestAnimationFrame(h)};f=requestAnimationFrame(h),this.resetObservers=()=>{a(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=fr(t,r,n,!1),o=$n(this.processMutation.bind(this),t,r,n),a=jn(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const i=n.map(a=>Bn(a,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class Yn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new gn,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},i=[];for(const o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),i.push({styleId:a,rules:Array.from(o.rules||CSSRule,(u,s)=>({rule:Nt(u),index:s}))})),n.styleIds.push(a)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Qn{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function F(e){return Object.assign(Object.assign({},e),{timestamp:qe()})}let A,Je,mt,Xe=!1;const J=Hr();function ke(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:u=null,maskTextClass:s="rr-mask",maskTextSelector:d=null,inlineStylesheet:c=!0,maskAllInputs:f,maskInputOptions:p,slimDOMOptions:h,maskInputFn:g,maskTextFn:m,hooks:v,packFn:w,sampling:b={},dataURLOptions:y={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:U=!1,recordCrossOriginIframes:B=!1,recordAfter:k=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:T=!1,collectFonts:G=!1,inlineImages:V=!1,plugins:E,keepIframeSrcFn:de=()=>!1,ignoreCSSAttributes:q=new Set([]),errorHandler:se}=e;wn(se);const ee=B?window.parent===window:!0;let ot=!1;if(!ee)try{window.parent.document&&(ot=!1)}catch{ot=!0}if(ee&&!t)throw new Error("emit function is required");S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),J.reset();const Et=f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},Rt=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};mn();let Ar,xt=0;const Lr=M=>{for(const Q of E||[])Q.eventProcessor&&(M=Q.eventProcessor(M));return w&&!ot&&(M=w(M)),M};A=(M,Q)=>{var D;if(!((D=ue[0])===null||D===void 0)&&D.isFrozen()&&M.type!==O.FullSnapshot&&!(M.type===O.IncrementalSnapshot&&M.data.source===C.Mutation)&&ue.forEach($=>$.unfreeze()),ee)t?.(Lr(M),Q);else if(ot){const $={type:"rrweb",event:Lr(M),origin:window.location.origin,isCheckout:Q};window.parent.postMessage($,"*")}if(M.type===O.FullSnapshot)Ar=M,xt=0;else if(M.type===O.IncrementalSnapshot){if(M.data.source===C.Mutation&&M.data.isAttachIframe)return;xt++;const $=n&&xt>=n,pe=r&&M.timestamp-Ar.timestamp>r;($||pe)&&Je(!0)}};const st=M=>{A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Mutation},M)}))},Pr=M=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Scroll},M)})),Fr=M=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.CanvasMutation},M)})),Mi=M=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.AdoptedStyleSheet},M)})),fe=new Yn({mutationCb:st,adoptedStyleSheetCb:Mi}),he=new Pn({mirror:J,mutationCb:st,stylesheetManager:fe,recordCrossOriginIframes:B,wrappedEmit:A});for(const M of E||[])M.getMirror&&M.getMirror({nodeMirror:J,crossOriginIframeMirror:he.crossOriginIframeMirror,crossOriginIframeStyleMirror:he.crossOriginIframeStyleMirror});const kt=new Qn;mt=new Kn({recordCanvas:U,mutationCb:Fr,win:window,blockClass:i,blockSelector:o,mirror:J,sampling:b.canvas,dataURLOptions:y});const at=new Fn({mutationCb:st,scrollCb:Pr,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:d,inlineStylesheet:c,maskInputOptions:Et,dataURLOptions:y,maskTextFn:m,maskInputFn:g,recordCanvas:U,inlineImages:V,sampling:b,slimDOMOptions:Rt,iframeManager:he,stylesheetManager:fe,canvasManager:mt,keepIframeSrcFn:de,processedNodeManager:kt},mirror:J});Je=(M=!1)=>{if(!I)return;A(F({type:O.Meta,data:{href:window.location.href,width:Ht(),height:$t()}}),M),fe.reset(),at.init(),ue.forEach(D=>D.lock());const Q=hn(document,{mirror:J,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:d,inlineStylesheet:c,maskAllInputs:Et,maskTextFn:m,slimDOM:Rt,dataURLOptions:y,recordCanvas:U,inlineImages:V,onSerialize:D=>{Vt(D,J)&&he.addIframe(D),Jt(D,J)&&fe.trackLinkElement(D),ht(D)&&at.addShadowRoot(D.shadowRoot,document)},onIframeLoad:(D,$)=>{he.attachIframe(D,$),at.observeAttachShadow(D)},onStylesheetLoad:(D,$)=>{fe.attachLinkElement(D,$)},keepIframeSrcFn:de});if(!Q)return console.warn("Failed to snapshot the document");A(F({type:O.FullSnapshot,data:{node:Q,initialOffset:qt(window)}}),M),ue.forEach(D=>D.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&fe.adoptStyleSheets(document.adoptedStyleSheets,J.getId(document))};try{const M=[],Q=$=>{var pe;return _(Ln)({mutationCb:st,mousemoveCb:(N,Tt)=>A(F({type:O.IncrementalSnapshot,data:{source:Tt,positions:N}})),mouseInteractionCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.MouseInteraction},N)})),scrollCb:Pr,viewportResizeCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.ViewportResize},N)})),inputCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Input},N)})),mediaInteractionCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.MediaInteraction},N)})),styleSheetRuleCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.StyleSheetRule},N)})),styleDeclarationCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.StyleDeclaration},N)})),canvasMutationCb:Fr,fontCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Font},N)})),selectionCb:N=>{A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Selection},N)}))},customElementCb:N=>{A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.CustomElement},N)}))},blockClass:i,ignoreClass:a,ignoreSelector:u,maskTextClass:s,maskTextSelector:d,maskInputOptions:Et,inlineStylesheet:c,sampling:b,recordDOM:I,recordCanvas:U,inlineImages:V,userTriggeredOnInput:T,collectFonts:G,doc:$,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:de,blockSelector:o,slimDOMOptions:Rt,dataURLOptions:y,mirror:J,iframeManager:he,stylesheetManager:fe,shadowDomManager:at,processedNodeManager:kt,canvasManager:mt,ignoreCSSAttributes:q,plugins:((pe=E?.filter(N=>N.observer))===null||pe===void 0?void 0:pe.map(N=>({observer:N.observer,options:N.options,callback:Tt=>A(F({type:O.Plugin,data:{plugin:N.name,payload:Tt}}))})))||[]},v)};he.addLoadListener($=>{try{M.push(Q($.contentDocument))}catch(pe){console.warn(pe)}});const D=()=>{Je(),M.push(Q(document)),Xe=!0};return document.readyState==="interactive"||document.readyState==="complete"?D():(M.push(W("DOMContentLoaded",()=>{A(F({type:O.DomContentLoaded,data:{}})),k==="DOMContentLoaded"&&D()})),M.push(W("load",()=>{A(F({type:O.Load,data:{}})),k==="load"&&D()},window))),()=>{M.forEach($=>$()),kt.destroy(),Xe=!1,In()}}catch(M){console.warn(M)}}ke.addCustomEvent=(e,t)=>{if(!Xe)throw new Error("please add custom event after start recording");A(F({type:O.Custom,data:{tag:e,payload:t}}))},ke.freezePage=()=>{ue.forEach(e=>e.freeze())},ke.takeFullSnapshot=e=>{if(!Xe)throw new Error("please take full snapshot after start recording");Je(e)},ke.mirror=J;var pr=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(pr||{}),Z=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Z||{}),gt={DEBUG:!1,LIB_VERSION:"2.57.1"},x;if(typeof window>"u"){var mr={hostname:""};x={navigator:{userAgent:"",onLine:!0},document:{location:mr,referrer:""},screen:{width:0,height:0},location:mr}}else x=window;var gr=x.setImmediate,ie,yt,vt,yr=Object.prototype.toString,Zn=typeof gr<"u"?function(t){return gr(t)}:setTimeout;try{Object.defineProperty({},"x",{}),ie=function(t,r,n,i){return Object.defineProperty(t,r,{value:n,writable:!0,configurable:i!==!1})}}catch{ie=function(r,n,i){return r[n]=i,r}}vt=function(){var t,r,n;function i(o,a){this.fn=o,this.self=a,this.next=void 0}return{add:function(a,u){n=new i(a,u),r?r.next=n:t=n,r=n,n=void 0},drain:function(){var a=t;for(t=r=yt=void 0;a;)a.fn.call(a.self),a=a.next}}}();function Ke(e,t){vt.add(e,t),yt||(yt=Zn(vt.drain))}function vr(e){var t,r=typeof e;return e!==null&&(r==="object"||r==="function")&&(t=e.then),typeof t=="function"?t:!1}function St(){for(var e=0;e<this.chain.length;e++)ei(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function ei(e,t,r){var n,i;try{t===!1?r.reject(e.msg):(t===!0?n=e.msg:n=t.call(void 0,e.msg),n===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=vr(n))?i.call(n,r.resolve,r.reject):r.resolve(n))}catch(o){r.reject(o)}}function Sr(e){var t,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(t=vr(e))?Ke(function(){var n=new wr(r);try{t.call(e,function(){Sr.apply(n,arguments)},function(){Te.apply(n,arguments)})}catch(i){Te.call(n,i)}}):(r.msg=e,r.state=1,r.chain.length>0&&Ke(St,r))}catch(n){Te.call(new wr(r),n)}}}function Te(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&Ke(St,t))}function br(e,t,r,n){for(var i=0;i<t.length;i++)(function(a){e.resolve(t[a]).then(function(s){r(a,s)},n)})(i)}function wr(e){this.def=e,this.triggered=!1}function ti(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function oe(e){if(typeof e!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var t=new ti(this);this.then=function(n,i){var o={success:typeof n=="function"?n:!0,failure:typeof i=="function"?i:!1};return o.promise=new this.constructor(function(u,s){if(typeof u!="function"||typeof s!="function")throw TypeError("Not a function");o.resolve=u,o.reject=s}),t.chain.push(o),t.state!==0&&Ke(St,t),o.promise},this.catch=function(n){return this.then(void 0,n)};try{e.call(void 0,function(n){Sr.call(t,n)},function(n){Te.call(t,n)})}catch(r){Te.call(t,r)}}var Ir=ie({},"constructor",oe,!1);oe.prototype=Ir,ie(Ir,"__NPO__",0,!1),ie(oe,"resolve",function(t){var r=this;return t&&typeof t=="object"&&t.__NPO__===1?t:new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");i(t)})}),ie(oe,"reject",function(t){return new this(function(n,i){if(typeof n!="function"||typeof i!="function")throw TypeError("Not a function");i(t)})}),ie(oe,"all",function(t){var r=this;return yr.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):t.length===0?r.resolve([]):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");var a=t.length,u=Array(a),s=0;br(r,t,function(c,f){u[c]=f,++s===a&&i(u)},o)})}),ie(oe,"race",function(t){var r=this;return yr.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");br(r,t,function(u,s){i(s)},o)})});var L;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?L=Promise:L=oe;var Ye=24*60*60*1e3,bt=8*1e3,Qe=Array.prototype,ri=Function.prototype,Mr=Object.prototype,le=Qe.slice,Ne=Mr.toString,Ze=Mr.hasOwnProperty,De=x.console,Ae=x.navigator,j=x.document,et=x.opera,tt=x.screen,ce=Ae.userAgent,wt=ri.bind,Cr=Qe.forEach,_r=Qe.indexOf,Or=Qe.map,ni=Array.isArray,It={},l={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},X={log:function(){},warn:function(){},error:function(){},critical:function(){if(!l.isUndefined(De)&&De){var e=["Mixpanel error:"].concat(l.toArray(arguments));try{De.error.apply(De,e)}catch{l.each(e,function(r){De.error(r)})}}}},Mt=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(X,arguments)}},Le=function(e){return{log:Mt(X.log,e),error:Mt(X.error,e),critical:Mt(X.critical,e)}};l.bind=function(e,t){var r,n;if(wt&&e.bind===wt)return wt.apply(e,le.call(arguments,1));if(!l.isFunction(e))throw new TypeError;return r=le.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,r.concat(le.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var a=e.apply(o,r.concat(le.call(arguments)));return Object(a)===a?a:o},n},l.each=function(e,t,r){if(e!=null){if(Cr&&e.forEach===Cr)e.forEach(t,r);else if(e.length===+e.length){for(var n=0,i=e.length;n<i;n++)if(n in e&&t.call(r,e[n],n,e)===It)return}else for(var o in e)if(Ze.call(e,o)&&t.call(r,e[o],o,e)===It)return}},l.extend=function(e){return l.each(le.call(arguments,1),function(t){for(var r in t)t[r]!==void 0&&(e[r]=t[r])}),e},l.isArray=ni||function(e){return Ne.call(e)==="[object Array]"},l.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch{return!1}},l.isArguments=function(e){return!!(e&&Ze.call(e,"callee"))},l.toArray=function(e){return e?e.toArray?e.toArray():l.isArray(e)||l.isArguments(e)?le.call(e):l.values(e):[]},l.map=function(e,t,r){if(Or&&e.map===Or)return e.map(t,r);var n=[];return l.each(e,function(i){n.push(t.call(r,i))}),n},l.keys=function(e){var t=[];return e===null||l.each(e,function(r,n){t[t.length]=n}),t},l.values=function(e){var t=[];return e===null||l.each(e,function(r){t[t.length]=r}),t},l.include=function(e,t){var r=!1;return e===null?r:_r&&e.indexOf===_r?e.indexOf(t)!=-1:(l.each(e,function(n){if(r||(r=n===t))return It}),r)},l.includes=function(e,t){return e.indexOf(t)!==-1},l.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},l.isObject=function(e){return e===Object(e)&&!l.isArray(e)},l.isEmptyObject=function(e){if(l.isObject(e)){for(var t in e)if(Ze.call(e,t))return!1;return!0}return!1},l.isUndefined=function(e){return e===void 0},l.isString=function(e){return Ne.call(e)=="[object String]"},l.isDate=function(e){return Ne.call(e)=="[object Date]"},l.isNumber=function(e){return Ne.call(e)=="[object Number]"},l.isElement=function(e){return!!(e&&e.nodeType===1)},l.encodeDates=function(e){return l.each(e,function(t,r){l.isDate(t)?e[r]=l.formatDate(t):l.isObject(t)&&(e[r]=l.encodeDates(t))}),e},l.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},l.formatDate=function(e){function t(r){return r<10?"0"+r:r}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},l.strip_empty_properties=function(e){var t={};return l.each(e,function(r,n){l.isString(r)&&r.length>0&&(t[n]=r)}),t},l.truncate=function(e,t){var r;return typeof e=="string"?r=e.slice(0,t):l.isArray(e)?(r=[],l.each(e,function(n){r.push(l.truncate(n,t))})):l.isObject(e)?(r={},l.each(e,function(n,i){r[i]=l.truncate(n,t)})):r=e,r},l.JSONEncode=function(){return function(e){var t=e,r=function(i){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(i)?'"'+i.replace(o,function(u){var s=a[u];return typeof s=="string"?s:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},n=function(i,o){var a="",u=" ",s=0,d="",c="",f=0,p=a,h=[],g=o[i];switch(g&&typeof g=="object"&&typeof g.toJSON=="function"&&(g=g.toJSON(i)),typeof g){case"string":return r(g);case"number":return isFinite(g)?String(g):"null";case"boolean":case"null":return String(g);case"object":if(!g)return"null";if(a+=u,h=[],Ne.apply(g)==="[object Array]"){for(f=g.length,s=0;s<f;s+=1)h[s]=n(s,g)||"null";return c=h.length===0?"[]":a?`[
32
+ ***************************************************************************** */function e(d,c,f,p){function h(g){return g instanceof f?g:new f(function(m){m(g)})}return new(f||(f=Promise))(function(g,m){function v(y){try{b(p.next(y))}catch(S){m(S)}}function w(y){try{b(p.throw(y))}catch(S){m(S)}}function b(y){y.done?g(y.value):h(y.value).then(v,w)}b((p=p.apply(d,c||[])).next())})}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=typeof Uint8Array>"u"?[]:new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;var i=function(d){var c=new Uint8Array(d),f,p=c.length,h="";for(f=0;f<p;f+=3)h+=t[c[f]>>2],h+=t[(c[f]&3)<<4|c[f+1]>>4],h+=t[(c[f+1]&15)<<2|c[f+2]>>6],h+=t[c[f+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,a=new Map;function u(d,c,f){return e(this,void 0,void 0,function*(){const p=`${d}-${c}`;if("OffscreenCanvas"in globalThis){if(a.has(p))return a.get(p);const h=new OffscreenCanvas(d,c);h.getContext("2d");const m=yield(yield h.convertToBlob(f)).arrayBuffer(),v=i(m);return a.set(p,v),v}else return""})}const s=self;s.onmessage=function(d){return e(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:c,bitmap:f,width:p,height:h,dataURLOptions:g}=d.data,m=u(p,h,g),v=new OffscreenCanvas(p,h);v.getContext("2d").drawImage(f,0,0),f.close();const b=yield v.convertToBlob(g),y=b.type,S=yield b.arrayBuffer(),I=i(S);if(!o.has(c)&&(yield m)===I)return o.set(c,I),s.postMessage({id:c});if(o.get(c)===I)return s.postMessage({id:c});s.postMessage({id:c,type:y,base64:I,width:p,height:h}),o.set(c,I)}else return s.postMessage({id:d.data.id})})}})()},null);class Kn{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(s,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(d)};const{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:u}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,i,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:u})}initCanvasFPSObserver(t,r,n,i,o){const a=fr(r,n,i,!0),u=new Map,s=new Xn;s.onmessage=g=>{const{id:m}=g.data;if(u.set(m,!1),!("base64"in g.data))return;const{base64:v,type:w,width:b,height:y}=g.data;this.mutationCb({id:m,type:be["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:w}]},0,0]}]})};const d=1e3/t;let c=0,f;const p=()=>{const g=[];return r.document.querySelectorAll("canvas").forEach(m=>{z(m,n,i,!0)||g.push(m)}),g},h=g=>{if(c&&g-c<d){f=requestAnimationFrame(h);return}c=g,p().forEach(m=>Un(this,void 0,void 0,function*(){var v;const w=this.mirror.getId(m);if(u.get(w)||m.width===0||m.height===0)return;if(u.set(w,!0),["webgl","webgl2"].includes(m.__context)){const y=m.getContext(m.__context);((v=y?.getContextAttributes())===null||v===void 0?void 0:v.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(m);s.postMessage({id:w,bitmap:b,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[b])})),f=requestAnimationFrame(h)};f=requestAnimationFrame(h),this.resetObservers=()=>{a(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=fr(t,r,n,!1),o=$n(this.processMutation.bind(this),t,r,n),a=jn(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const i=n.map(a=>Bn(a,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class Yn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new gn,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},i=[];for(const o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),i.push({styleId:a,rules:Array.from(o.rules||CSSRule,(u,s)=>({rule:Nt(u),index:s}))})),n.styleIds.push(a)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class Qn{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function F(e){return Object.assign(Object.assign({},e),{timestamp:qe()})}let A,Je,mt,Xe=!1;const J=Hr();function ke(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:u=null,maskTextClass:s="rr-mask",maskTextSelector:d=null,inlineStylesheet:c=!0,maskAllInputs:f,maskInputOptions:p,slimDOMOptions:h,maskInputFn:g,maskTextFn:m,hooks:v,packFn:w,sampling:b={},dataURLOptions:y={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:U=!1,recordCrossOriginIframes:B=!1,recordAfter:k=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:T=!1,collectFonts:G=!1,inlineImages:V=!1,plugins:E,keepIframeSrcFn:de=()=>!1,ignoreCSSAttributes:q=new Set([]),errorHandler:se}=e;wn(se);const ee=B?window.parent===window:!0;let ot=!1;if(!ee)try{window.parent.document&&(ot=!1)}catch{ot=!0}if(ee&&!t)throw new Error("emit function is required");S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),J.reset();const Et=f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},Rt=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};mn();let Ar,xt=0;const Lr=M=>{for(const Q of E||[])Q.eventProcessor&&(M=Q.eventProcessor(M));return w&&!ot&&(M=w(M)),M};A=(M,Q)=>{var D;if(!((D=ue[0])===null||D===void 0)&&D.isFrozen()&&M.type!==O.FullSnapshot&&!(M.type===O.IncrementalSnapshot&&M.data.source===C.Mutation)&&ue.forEach($=>$.unfreeze()),ee)t?.(Lr(M),Q);else if(ot){const $={type:"rrweb",event:Lr(M),origin:window.location.origin,isCheckout:Q};window.parent.postMessage($,"*")}if(M.type===O.FullSnapshot)Ar=M,xt=0;else if(M.type===O.IncrementalSnapshot){if(M.data.source===C.Mutation&&M.data.isAttachIframe)return;xt++;const $=n&&xt>=n,pe=r&&M.timestamp-Ar.timestamp>r;($||pe)&&Je(!0)}};const st=M=>{A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Mutation},M)}))},Pr=M=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Scroll},M)})),Fr=M=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.CanvasMutation},M)})),Mi=M=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.AdoptedStyleSheet},M)})),fe=new Yn({mutationCb:st,adoptedStyleSheetCb:Mi}),he=new Pn({mirror:J,mutationCb:st,stylesheetManager:fe,recordCrossOriginIframes:B,wrappedEmit:A});for(const M of E||[])M.getMirror&&M.getMirror({nodeMirror:J,crossOriginIframeMirror:he.crossOriginIframeMirror,crossOriginIframeStyleMirror:he.crossOriginIframeStyleMirror});const kt=new Qn;mt=new Kn({recordCanvas:U,mutationCb:Fr,win:window,blockClass:i,blockSelector:o,mirror:J,sampling:b.canvas,dataURLOptions:y});const at=new Fn({mutationCb:st,scrollCb:Pr,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:d,inlineStylesheet:c,maskInputOptions:Et,dataURLOptions:y,maskTextFn:m,maskInputFn:g,recordCanvas:U,inlineImages:V,sampling:b,slimDOMOptions:Rt,iframeManager:he,stylesheetManager:fe,canvasManager:mt,keepIframeSrcFn:de,processedNodeManager:kt},mirror:J});Je=(M=!1)=>{if(!I)return;A(F({type:O.Meta,data:{href:window.location.href,width:Ht(),height:$t()}}),M),fe.reset(),at.init(),ue.forEach(D=>D.lock());const Q=hn(document,{mirror:J,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:d,inlineStylesheet:c,maskAllInputs:Et,maskTextFn:m,slimDOM:Rt,dataURLOptions:y,recordCanvas:U,inlineImages:V,onSerialize:D=>{Vt(D,J)&&he.addIframe(D),Jt(D,J)&&fe.trackLinkElement(D),ht(D)&&at.addShadowRoot(D.shadowRoot,document)},onIframeLoad:(D,$)=>{he.attachIframe(D,$),at.observeAttachShadow(D)},onStylesheetLoad:(D,$)=>{fe.attachLinkElement(D,$)},keepIframeSrcFn:de});if(!Q)return console.warn("Failed to snapshot the document");A(F({type:O.FullSnapshot,data:{node:Q,initialOffset:qt(window)}}),M),ue.forEach(D=>D.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&fe.adoptStyleSheets(document.adoptedStyleSheets,J.getId(document))};try{const M=[],Q=$=>{var pe;return _(Ln)({mutationCb:st,mousemoveCb:(N,Tt)=>A(F({type:O.IncrementalSnapshot,data:{source:Tt,positions:N}})),mouseInteractionCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.MouseInteraction},N)})),scrollCb:Pr,viewportResizeCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.ViewportResize},N)})),inputCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Input},N)})),mediaInteractionCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.MediaInteraction},N)})),styleSheetRuleCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.StyleSheetRule},N)})),styleDeclarationCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.StyleDeclaration},N)})),canvasMutationCb:Fr,fontCb:N=>A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Font},N)})),selectionCb:N=>{A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.Selection},N)}))},customElementCb:N=>{A(F({type:O.IncrementalSnapshot,data:Object.assign({source:C.CustomElement},N)}))},blockClass:i,ignoreClass:a,ignoreSelector:u,maskTextClass:s,maskTextSelector:d,maskInputOptions:Et,inlineStylesheet:c,sampling:b,recordDOM:I,recordCanvas:U,inlineImages:V,userTriggeredOnInput:T,collectFonts:G,doc:$,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:de,blockSelector:o,slimDOMOptions:Rt,dataURLOptions:y,mirror:J,iframeManager:he,stylesheetManager:fe,shadowDomManager:at,processedNodeManager:kt,canvasManager:mt,ignoreCSSAttributes:q,plugins:((pe=E?.filter(N=>N.observer))===null||pe===void 0?void 0:pe.map(N=>({observer:N.observer,options:N.options,callback:Tt=>A(F({type:O.Plugin,data:{plugin:N.name,payload:Tt}}))})))||[]},v)};he.addLoadListener($=>{try{M.push(Q($.contentDocument))}catch(pe){console.warn(pe)}});const D=()=>{Je(),M.push(Q(document)),Xe=!0};return document.readyState==="interactive"||document.readyState==="complete"?D():(M.push(W("DOMContentLoaded",()=>{A(F({type:O.DomContentLoaded,data:{}})),k==="DOMContentLoaded"&&D()})),M.push(W("load",()=>{A(F({type:O.Load,data:{}})),k==="load"&&D()},window))),()=>{M.forEach($=>$()),kt.destroy(),Xe=!1,In()}}catch(M){console.warn(M)}}ke.addCustomEvent=(e,t)=>{if(!Xe)throw new Error("please add custom event after start recording");A(F({type:O.Custom,data:{tag:e,payload:t}}))},ke.freezePage=()=>{ue.forEach(e=>e.freeze())},ke.takeFullSnapshot=e=>{if(!Xe)throw new Error("please take full snapshot after start recording");Je(e)},ke.mirror=J;var pr=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(pr||{}),Z=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Z||{}),gt={DEBUG:!1,LIB_VERSION:"2.58.0"},x;if(typeof window>"u"){var mr={hostname:""};x={navigator:{userAgent:"",onLine:!0},document:{location:mr,referrer:""},screen:{width:0,height:0},location:mr}}else x=window;var gr=x.setImmediate,ie,yt,vt,yr=Object.prototype.toString,Zn=typeof gr<"u"?function(t){return gr(t)}:setTimeout;try{Object.defineProperty({},"x",{}),ie=function(t,r,n,i){return Object.defineProperty(t,r,{value:n,writable:!0,configurable:i!==!1})}}catch{ie=function(r,n,i){return r[n]=i,r}}vt=function(){var t,r,n;function i(o,a){this.fn=o,this.self=a,this.next=void 0}return{add:function(a,u){n=new i(a,u),r?r.next=n:t=n,r=n,n=void 0},drain:function(){var a=t;for(t=r=yt=void 0;a;)a.fn.call(a.self),a=a.next}}}();function Ke(e,t){vt.add(e,t),yt||(yt=Zn(vt.drain))}function vr(e){var t,r=typeof e;return e!==null&&(r==="object"||r==="function")&&(t=e.then),typeof t=="function"?t:!1}function St(){for(var e=0;e<this.chain.length;e++)ei(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function ei(e,t,r){var n,i;try{t===!1?r.reject(e.msg):(t===!0?n=e.msg:n=t.call(void 0,e.msg),n===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=vr(n))?i.call(n,r.resolve,r.reject):r.resolve(n))}catch(o){r.reject(o)}}function Sr(e){var t,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(t=vr(e))?Ke(function(){var n=new wr(r);try{t.call(e,function(){Sr.apply(n,arguments)},function(){Te.apply(n,arguments)})}catch(i){Te.call(n,i)}}):(r.msg=e,r.state=1,r.chain.length>0&&Ke(St,r))}catch(n){Te.call(new wr(r),n)}}}function Te(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&Ke(St,t))}function br(e,t,r,n){for(var i=0;i<t.length;i++)(function(a){e.resolve(t[a]).then(function(s){r(a,s)},n)})(i)}function wr(e){this.def=e,this.triggered=!1}function ti(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function oe(e){if(typeof e!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var t=new ti(this);this.then=function(n,i){var o={success:typeof n=="function"?n:!0,failure:typeof i=="function"?i:!1};return o.promise=new this.constructor(function(u,s){if(typeof u!="function"||typeof s!="function")throw TypeError("Not a function");o.resolve=u,o.reject=s}),t.chain.push(o),t.state!==0&&Ke(St,t),o.promise},this.catch=function(n){return this.then(void 0,n)};try{e.call(void 0,function(n){Sr.call(t,n)},function(n){Te.call(t,n)})}catch(r){Te.call(t,r)}}var Ir=ie({},"constructor",oe,!1);oe.prototype=Ir,ie(Ir,"__NPO__",0,!1),ie(oe,"resolve",function(t){var r=this;return t&&typeof t=="object"&&t.__NPO__===1?t:new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");i(t)})}),ie(oe,"reject",function(t){return new this(function(n,i){if(typeof n!="function"||typeof i!="function")throw TypeError("Not a function");i(t)})}),ie(oe,"all",function(t){var r=this;return yr.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):t.length===0?r.resolve([]):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");var a=t.length,u=Array(a),s=0;br(r,t,function(c,f){u[c]=f,++s===a&&i(u)},o)})}),ie(oe,"race",function(t){var r=this;return yr.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");br(r,t,function(u,s){i(s)},o)})});var L;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?L=Promise:L=oe;var Ye=24*60*60*1e3,bt=8*1e3,Qe=Array.prototype,ri=Function.prototype,Mr=Object.prototype,le=Qe.slice,Ne=Mr.toString,Ze=Mr.hasOwnProperty,De=x.console,Ae=x.navigator,j=x.document,et=x.opera,tt=x.screen,ce=Ae.userAgent,wt=ri.bind,Cr=Qe.forEach,_r=Qe.indexOf,Or=Qe.map,ni=Array.isArray,It={},l={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},X={log:function(){},warn:function(){},error:function(){},critical:function(){if(!l.isUndefined(De)&&De){var e=["Mixpanel error:"].concat(l.toArray(arguments));try{De.error.apply(De,e)}catch{l.each(e,function(r){De.error(r)})}}}},Mt=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(X,arguments)}},Le=function(e){return{log:Mt(X.log,e),error:Mt(X.error,e),critical:Mt(X.critical,e)}};l.bind=function(e,t){var r,n;if(wt&&e.bind===wt)return wt.apply(e,le.call(arguments,1));if(!l.isFunction(e))throw new TypeError;return r=le.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,r.concat(le.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var a=e.apply(o,r.concat(le.call(arguments)));return Object(a)===a?a:o},n},l.each=function(e,t,r){if(e!=null){if(Cr&&e.forEach===Cr)e.forEach(t,r);else if(e.length===+e.length){for(var n=0,i=e.length;n<i;n++)if(n in e&&t.call(r,e[n],n,e)===It)return}else for(var o in e)if(Ze.call(e,o)&&t.call(r,e[o],o,e)===It)return}},l.extend=function(e){return l.each(le.call(arguments,1),function(t){for(var r in t)t[r]!==void 0&&(e[r]=t[r])}),e},l.isArray=ni||function(e){return Ne.call(e)==="[object Array]"},l.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch{return!1}},l.isArguments=function(e){return!!(e&&Ze.call(e,"callee"))},l.toArray=function(e){return e?e.toArray?e.toArray():l.isArray(e)||l.isArguments(e)?le.call(e):l.values(e):[]},l.map=function(e,t,r){if(Or&&e.map===Or)return e.map(t,r);var n=[];return l.each(e,function(i){n.push(t.call(r,i))}),n},l.keys=function(e){var t=[];return e===null||l.each(e,function(r,n){t[t.length]=n}),t},l.values=function(e){var t=[];return e===null||l.each(e,function(r){t[t.length]=r}),t},l.include=function(e,t){var r=!1;return e===null?r:_r&&e.indexOf===_r?e.indexOf(t)!=-1:(l.each(e,function(n){if(r||(r=n===t))return It}),r)},l.includes=function(e,t){return e.indexOf(t)!==-1},l.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},l.isObject=function(e){return e===Object(e)&&!l.isArray(e)},l.isEmptyObject=function(e){if(l.isObject(e)){for(var t in e)if(Ze.call(e,t))return!1;return!0}return!1},l.isUndefined=function(e){return e===void 0},l.isString=function(e){return Ne.call(e)=="[object String]"},l.isDate=function(e){return Ne.call(e)=="[object Date]"},l.isNumber=function(e){return Ne.call(e)=="[object Number]"},l.isElement=function(e){return!!(e&&e.nodeType===1)},l.encodeDates=function(e){return l.each(e,function(t,r){l.isDate(t)?e[r]=l.formatDate(t):l.isObject(t)&&(e[r]=l.encodeDates(t))}),e},l.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},l.formatDate=function(e){function t(r){return r<10?"0"+r:r}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},l.strip_empty_properties=function(e){var t={};return l.each(e,function(r,n){l.isString(r)&&r.length>0&&(t[n]=r)}),t},l.truncate=function(e,t){var r;return typeof e=="string"?r=e.slice(0,t):l.isArray(e)?(r=[],l.each(e,function(n){r.push(l.truncate(n,t))})):l.isObject(e)?(r={},l.each(e,function(n,i){r[i]=l.truncate(n,t)})):r=e,r},l.JSONEncode=function(){return function(e){var t=e,r=function(i){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,a={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(i)?'"'+i.replace(o,function(u){var s=a[u];return typeof s=="string"?s:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},n=function(i,o){var a="",u=" ",s=0,d="",c="",f=0,p=a,h=[],g=o[i];switch(g&&typeof g=="object"&&typeof g.toJSON=="function"&&(g=g.toJSON(i)),typeof g){case"string":return r(g);case"number":return isFinite(g)?String(g):"null";case"boolean":case"null":return String(g);case"object":if(!g)return"null";if(a+=u,h=[],Ne.apply(g)==="[object Array]"){for(f=g.length,s=0;s<f;s+=1)h[s]=n(s,g)||"null";return c=h.length===0?"[]":a?`[
33
33
  `+a+h.join(`,
34
34
  `+a)+`
35
35
  `+p+"]":"["+h.join(",")+"]",a=p,c}for(d in g)Ze.call(g,d)&&(c=n(d,g),c&&h.push(r(d)+(a?": ":":")+c));return c=h.length===0?"{}":a?"{"+h.join(",")+p+"}":"{"+h.join(",")+"}",a=p,c}};return n("",{"":t})}}(),l.JSONDecode=function(){var e,t,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
36
36
  `,r:"\r",t:" "},n,i=function(h){var g=new SyntaxError(h);throw g.at=e,g.text=n,g},o=function(h){return h&&h!==t&&i("Expected '"+h+"' instead of '"+t+"'"),t=n.charAt(e),e+=1,t},a=function(){var h,g="";for(t==="-"&&(g="-",o("-"));t>="0"&&t<="9";)g+=t,o();if(t===".")for(g+=".";o()&&t>="0"&&t<="9";)g+=t;if(t==="e"||t==="E")for(g+=t,o(),(t==="-"||t==="+")&&(g+=t,o());t>="0"&&t<="9";)g+=t,o();if(h=+g,!isFinite(h))i("Bad number");else return h},u=function(){var h,g,m="",v;if(t==='"')for(;o();){if(t==='"')return o(),m;if(t==="\\")if(o(),t==="u"){for(v=0,g=0;g<4&&(h=parseInt(o(),16),!!isFinite(h));g+=1)v=v*16+h;m+=String.fromCharCode(v)}else if(typeof r[t]=="string")m+=r[t];else break;else m+=t}i("Bad string")},s=function(){for(;t&&t<=" ";)o()},d=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}i('Unexpected "'+t+'"')},c,f=function(){var h=[];if(t==="["){if(o("["),s(),t==="]")return o("]"),h;for(;t;){if(h.push(c()),s(),t==="]")return o("]"),h;o(","),s()}}i("Bad array")},p=function(){var h,g={};if(t==="{"){if(o("{"),s(),t==="}")return o("}"),g;for(;t;){if(h=u(),s(),o(":"),Object.hasOwnProperty.call(g,h)&&i('Duplicate key "'+h+'"'),g[h]=c(),s(),t==="}")return o("}"),g;o(","),s()}}i("Bad object")};return c=function(){switch(s(),t){case"{":return p();case"[":return f();case'"':return u();case"-":return a();default:return t>="0"&&t<="9"?a():d()}},function(h){var g;return n=h,e=0,t=" ",g=c(),s(),t&&i("Syntax error"),g}}(),l.base64Encode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,n,i,o,a,u,s,d,c=0,f=0,p="",h=[];if(!e)return e;e=l.utf8Encode(e);do r=e.charCodeAt(c++),n=e.charCodeAt(c++),i=e.charCodeAt(c++),d=r<<16|n<<8|i,o=d>>18&63,a=d>>12&63,u=d>>6&63,s=d&63,h[f++]=t.charAt(o)+t.charAt(a)+t.charAt(u)+t.charAt(s);while(c<e.length);switch(p=h.join(""),e.length%3){case 1:p=p.slice(0,-2)+"==";break;case 2:p=p.slice(0,-1)+"=";break}return p},l.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,`
37
37
  `).replace(/\r/g,`
38
- `);var t="",r,n,i=0,o;for(r=n=0,i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o),u=null;a<128?n++:a>127&&a<2048?u=String.fromCharCode(a>>6|192,a&63|128):u=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),u!==null&&(n>r&&(t+=e.substring(r,n)),t+=u,r=n=o+1)}return n>r&&(t+=e.substring(r,e.length)),t},l.UUID=function(){var e=function(){var n=1*new Date,i;if(x.performance&&x.performance.now)i=x.performance.now();else for(i=0;n==1*new Date;)i++;return n.toString(16)+Math.floor(i).toString(16)},t=function(){return Math.random().toString(16).replace(".","")},r=function(){var n=ce,i,o,a=[],u=0;function s(d,c){var f,p=0;for(f=0;f<c.length;f++)p|=a[f]<<f*8;return d^p}for(i=0;i<n.length;i++)o=n.charCodeAt(i),a.unshift(o&255),a.length>=4&&(u=s(u,a),a=[]);return a.length>0&&(u=s(u,a)),u.toString(16)};return function(){var n=(tt.height*tt.width).toString(16);return e()+"-"+t()+"-"+r()+"-"+n+"-"+e()}}();var Er=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];l.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Er.length;t++)if(e.indexOf(Er[t])!==-1)return!0;return!1},l.HTTPBuildQuery=function(e,t){var r,n,i=[];return l.isUndefined(t)&&(t="&"),l.each(e,function(o,a){r=encodeURIComponent(o.toString()),n=encodeURIComponent(a),i[i.length]=n+"="+r}),i.join(t)},l.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r="[\\?&]"+t+"=([^&#]*)",n=new RegExp(r),i=n.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{X.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},l.cookie={get:function(e){for(var t=e+"=",r=j.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=l.JSONDecode(l.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,r,n,i,o,a){var u="",s="",d="";if(a)u="; domain="+a;else if(n){var c=Rr(j.location.hostname);u=c?"; domain=."+c:""}if(r){var f=new Date;f.setTime(f.getTime()+r*1e3),s="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),j.cookie=e+"="+encodeURIComponent(t)+s+"; path=/"+u+d},set:function(e,t,r,n,i,o,a){var u="",s="",d="";if(a)u="; domain="+a;else if(n){var c=Rr(j.location.hostname);u=c?"; domain=."+c:""}if(r){var f=new Date;f.setTime(f.getTime()+r*24*60*60*1e3),s="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var p=e+"="+encodeURIComponent(t)+s+"; path=/"+u+d;return j.cookie=p,p},remove:function(e,t,r){l.cookie.set(e,"",-1,t,!1,!1,r)}};var Ct=null,rt=function(e,t){if(Ct!==null&&!t)return Ct;var r=!0;try{e=e||x.localStorage;var n="__mplss_"+_t(8),i="xyz";e.setItem(n,i),e.getItem(n)!==i&&(r=!1),e.removeItem(n)}catch{r=!1}return Ct=r,r};l.localStorage={is_supported:function(e){var t=rt(null,e);return t||X.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){X.error("localStorage error: "+e)},get:function(e){try{return x.localStorage.getItem(e)}catch(t){l.localStorage.error(t)}return null},parse:function(e){try{return l.JSONDecode(l.localStorage.get(e))||{}}catch{}return null},set:function(e,t){try{x.localStorage.setItem(e,t)}catch(r){l.localStorage.error(r)}},remove:function(e){try{x.localStorage.removeItem(e)}catch(t){l.localStorage.error(t)}}},l.register_event=function(){var e=function(n,i,o,a,u){if(!n){X.error("No valid element provided to register_event");return}if(n.addEventListener&&!a)n.addEventListener(i,o,!!u);else{var s="on"+i,d=n[s];n[s]=t(n,o,d)}};function t(n,i,o){var a=function(u){if(u=u||r(x.event),!!u){var s=!0,d,c;return l.isFunction(o)&&(d=o(u)),c=i.call(n,u),(d===!1||c===!1)&&(s=!1),s}};return a}function r(n){return n&&(n.preventDefault=r.preventDefault,n.stopPropagation=r.stopPropagation),n}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},e}();var ii=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');l.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(i,o){var a=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(a)>=0}function n(i){if(!j.getElementsByTagName)return[];var o=i.split(" "),a,u,s,d,c,f,p,h,g,m,v=[j];for(f=0;f<o.length;f++){if(a=o[f].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){u=a.split("#"),s=u[0];var w=u[1],b=j.getElementById(w);if(!b||s&&b.nodeName.toLowerCase()!=s)return[];v=[b];continue}if(a.indexOf(".")>-1){u=a.split("."),s=u[0];var y=u[1];for(s||(s="*"),d=[],c=0,p=0;p<v.length;p++)for(s=="*"?g=e(v[p]):g=v[p].getElementsByTagName(s),h=0;h<g.length;h++)d[c++]=g[h];for(v=[],m=0,p=0;p<d.length;p++)d[p].className&&l.isString(d[p].className)&&r(d[p],y)&&(v[m++]=d[p]);continue}var S=a.match(ii);if(S){s=S[1];var I=S[2],U=S[3],B=S[4];for(s||(s="*"),d=[],c=0,p=0;p<v.length;p++)for(s=="*"?g=e(v[p]):g=v[p].getElementsByTagName(s),h=0;h<g.length;h++)d[c++]=g[h];v=[],m=0;var k;switch(U){case"=":k=function(T){return T.getAttribute(I)==B};break;case"~":k=function(T){return T.getAttribute(I).match(new RegExp("\\b"+B+"\\b"))};break;case"|":k=function(T){return T.getAttribute(I).match(new RegExp("^"+B+"-?"))};break;case"^":k=function(T){return T.getAttribute(I).indexOf(B)===0};break;case"$":k=function(T){return T.getAttribute(I).lastIndexOf(B)==T.getAttribute(I).length-B.length};break;case"*":k=function(T){return T.getAttribute(I).indexOf(B)>-1};break;default:k=function(T){return T.getAttribute(I)}}for(v=[],m=0,p=0;p<d.length;p++)k(d[p])&&(v[m++]=d[p]);continue}for(s=a,d=[],c=0,p=0;p<v.length;p++)for(g=v[p].getElementsByTagName(s),h=0;h<g.length;h++)d[c++]=g[h];v=d}return v}return function(i){return l.isElement(i)?[i]:l.isObject(i)&&!l.isUndefined(i.length)?i:n.call(this,i)}}();var oi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],si=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];l.info={campaignParams:function(e){var t="",r={};return l.each(oi,function(n){t=l.getQueryParam(j.URL,n),t.length?r[n]=t:e!==void 0&&(r[n]=e)}),r},clickParams:function(){var e="",t={};return l.each(si,function(r){e=l.getQueryParam(j.URL,r),e.length&&(t[r]=e)}),t},marketingParams:function(){return l.extend(l.info.campaignParams(),l.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=l.info.searchEngine(e),r=t!="yahoo"?"q":"p",n={};if(t!==null){n.$search_engine=t;var i=l.getQueryParam(e,r);i.length&&(n.mp_keyword=i)}return n},browser:function(e,t,r){return t=t||"",r||l.includes(e," OPR/")?l.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":l.includes(e,"IEMobile")||l.includes(e,"WPDesktop")?"Internet Explorer Mobile":l.includes(e,"SamsungBrowser/")?"Samsung Internet":l.includes(e,"Edge")||l.includes(e,"Edg/")?"Microsoft Edge":l.includes(e,"FBIOS")?"Facebook Mobile":l.includes(e,"Chrome")?"Chrome":l.includes(e,"CriOS")?"Chrome iOS":l.includes(e,"UCWEB")||l.includes(e,"UCBrowser")?"UC Browser":l.includes(e,"FxiOS")?"Firefox iOS":l.includes(t,"Apple")?l.includes(e,"Mobile")?"Mobile Safari":"Safari":l.includes(e,"Android")?"Android Mobile":l.includes(e,"Konqueror")?"Konqueror":l.includes(e,"Firefox")?"Firefox":l.includes(e,"MSIE")||l.includes(e,"Trident/")?"Internet Explorer":l.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var n=l.info.browser(e,t,r),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=i[n];if(o===void 0)return null;var a=e.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var e=ce;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return x.location.href},properties:function(e){return typeof e!="object"&&(e={}),l.extend(l.strip_empty_properties({$os:l.info.os(),$browser:l.info.browser(ce,Ae.vendor,et),$referrer:j.referrer,$referring_domain:l.info.referringDomain(j.referrer),$device:l.info.device(ce)}),{$current_url:l.info.currentUrl(),$browser_version:l.info.browserVersion(ce,Ae.vendor,et),$screen_height:tt.height,$screen_width:tt.width,mp_lib:"web",$lib_version:gt.LIB_VERSION,$insert_id:_t(),time:l.timestamp()/1e3},l.strip_empty_properties(e))},people_properties:function(){return l.extend(l.strip_empty_properties({$os:l.info.os(),$browser:l.info.browser(ce,Ae.vendor,et)}),{$browser_version:l.info.browserVersion(ce,Ae.vendor,et)})},mpPageViewProperties:function(){return l.strip_empty_properties({current_page_title:j.title,current_domain:x.location.hostname,current_url_path:x.location.pathname,current_url_protocol:x.location.protocol,current_url_search:x.location.search})}};var _t=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},ai=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,ui=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Rr=function(e){var t=ui,r=e.split("."),n=r[r.length-1];(n.length>4||n==="com"||n==="org")&&(t=ai);var i=e.match(t);return i?i[0]:""},li=function(){var e=x.navigator.onLine;return l.isUndefined(e)||e},nt=null,it=null;typeof JSON<"u"&&(nt=JSON.stringify,it=JSON.parse),nt=nt||l.JSONEncode,it=it||l.JSONDecode,l.toArray=l.toArray,l.isObject=l.isObject,l.JSONEncode=l.JSONEncode,l.JSONDecode=l.JSONDecode,l.isBlockedUA=l.isBlockedUA,l.isEmptyObject=l.isEmptyObject,l.info=l.info,l.info.device=l.info.device,l.info.browser=l.info.browser,l.info.browserVersion=l.info.browserVersion,l.info.properties=l.info.properties,l.NPO=oe;var ci="__mp_opt_in_out_";function di(e,t){if(gi(t))return X.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var r=mi(e,t)==="0";return r&&X.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function fi(e){return yi(e,function(t){return this.get_config(t)})}function hi(e){return e=e||{},e.persistenceType==="localStorage"?l.localStorage:l.cookie}function pi(e,t){return t=t||{},(t.persistencePrefix||ci)+e}function mi(e,t){return hi(t).get(pi(e,t))}function gi(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||x,r=t.navigator||{},n=!1;return l.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(i){l.includes([!0,1,"1","yes"],i)&&(n=!0)}),n}function yi(e,t){return function(){var r=!1;try{var n=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),a=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");n&&(r=di(n,{ignoreDnt:i,persistenceType:o,persistencePrefix:a,window:u}))}catch(d){X.error("Unexpected error when checking tracking opt-out status: "+d)}if(!r)return e.apply(this,arguments);var s=arguments[arguments.length-1];typeof s=="function"&&s(0)}}var vi=Le("lock"),xr=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||L};xr.prototype.withLock=function(e,t){var r=this.promiseImpl;return new r(l.bind(function(n,i){var o=t||new Date().getTime()+"|"+Math.random(),a=new Date().getTime(),u=this.storageKey,s=this.pollIntervalMS,d=this.timeoutMS,c=this.storage,f=u+":X",p=u+":Y",h=u+":Z",g=function(y){if(new Date().getTime()-a>d){vi.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),c.removeItem(h),c.removeItem(p),w();return}setTimeout(function(){try{y()}catch(S){i(S)}},s*(Math.random()+.1))},m=function(y,S){y()?S():g(function(){m(y,S)})},v=function(){var y=c.getItem(p);return y&&y!==o?!1:(c.setItem(p,o),c.getItem(p)===o?!0:(rt(c,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},w=function(){c.setItem(f,o),m(v,function(){if(c.getItem(f)===o){b();return}g(function(){if(c.getItem(p)!==o){w();return}m(function(){return!c.getItem(h)},b)})})},b=function(){c.setItem(h,"1");var y=function(){c.removeItem(h),c.getItem(p)===o&&c.removeItem(p),c.getItem(f)===o&&c.removeItem(f)};e().then(function(S){y(),n(S)}).catch(function(S){y(),i(S)})};try{if(rt(c,!0))w();else throw new Error("localStorage support check failed")}catch(y){i(y)}},this))};var Pe=function(e){this.storage=e||localStorage};Pe.prototype.init=function(){return L.resolve()},Pe.prototype.setItem=function(e,t){return new L(l.bind(function(r,n){try{this.storage.setItem(e,t)}catch(i){n(i)}r()},this))},Pe.prototype.getItem=function(e){return new L(l.bind(function(t,r){var n;try{n=this.storage.getItem(e)}catch(i){r(i)}t(n)},this))},Pe.prototype.removeItem=function(e){return new L(l.bind(function(t,r){try{this.storage.removeItem(e)}catch(n){r(n)}t()},this))};var kr=Le("batch"),re=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new Pe,this.lock=new xr(e,{storage:t.sharedLockStorage||window.localStorage}),this.queueStorage.init()),this.reportError=t.errorReporter||l.bind(kr.error,kr),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1};re.prototype.ensureInit=function(){return this.initialized?L.resolve():this.queueStorage.init().then(l.bind(function(){this.initialized=!0},this)).catch(l.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},re.prototype.enqueue=function(e,t){var r={id:_t(),flushAfter:new Date().getTime()+t*2,payload:e};if(this.usePersistence){var n=l.bind(function(){return this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(i){return i.push(r),this.saveToStorage(i)},this)).then(l.bind(function(i){return i&&this.memQueue.push(r),i},this)).catch(l.bind(function(i){return this.reportError("Error enqueueing item",i,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(l.bind(function(i){return this.reportError("Error acquiring storage lock",i),!1},this))}else return this.memQueue.push(r),L.resolve(!0)},re.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(r){if(r.length){var n={};l.each(t,function(a){n[a.id]=!0});for(var i=0;i<r.length;i++){var o=r[i];if(new Date().getTime()>o.flushAfter&&!n[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):L.resolve(t)};var Tr=function(e,t){var r=[];return l.each(e,function(n){n.id&&!t[n.id]&&r.push(n)}),r};re.prototype.removeItemsByID=function(e){var t={};if(l.each(e,function(n){t[n]=!0}),this.memQueue=Tr(this.memQueue,t),this.usePersistence){var r=l.bind(function(){return this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(n){return n=Tr(n,t),this.saveToStorage(n)},this)).then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(n){for(var i=0;i<n.length;i++){var o=n[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(l.bind(function(n){return this.reportError("Error removing items",n,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(l.bind(function(n){return this.reportError("Error acquiring storage lock",n),rt(this.queueStorage.storage,!0)?!1:r().then(l.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(l.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return L.resolve(!0)};var Nr=function(e,t){var r=[];return l.each(e,function(n){var i=n.id;if(i in t){var o=t[i];o!==null&&(n.payload=o,r.push(n))}else r.push(n)}),r};re.prototype.updatePayloads=function(e){return this.memQueue=Nr(this.memQueue,e),this.usePersistence?this.lock.withLock(l.bind(function(){return this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(r){return r=Nr(r,e),this.saveToStorage(r)},this)).catch(l.bind(function(r){return this.reportError("Error updating items",e,r),!1},this))},this),this.pid).catch(l.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):L.resolve(!0)},re.prototype.readFromStorage=function(){return this.ensureInit().then(l.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(l.bind(function(e){return e&&(e=it(e),l.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(l.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},re.prototype.saveToStorage=function(e){try{var t=nt(e)}catch(r){return this.reportError("Error serializing queue",r),L.resolve(!1)}return this.ensureInit().then(l.bind(function(){return this.queueStorage.setItem(this.storageKey,t)},this)).then(function(){return!0}).catch(l.bind(function(r){return this.reportError("Error saving queue",r),!1},this))},re.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(l.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):L.resolve()};var Si=10*60*1e3,Fe=Le("batch"),K=function(e,t){this.errorReporter=t.errorReporter,this.queue=new re(e,{errorReporter:l.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1};K.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},K.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},K.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},K.prototype.clear=function(){return this.queue.clear()},K.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},K.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},K.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(l.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},K.prototype.sendRequestPromise=function(e,t){return new L(l.bind(function(r){this.sendRequest(e,t,r)},this))},K.prototype.flush=function(e){if(this.requestInProgress)return Fe.log("Flush: Request already in progress"),L.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=new Date().getTime(),n=this.batchSize;return this.queue.fillBatch(n).then(l.bind(function(i){var o=i.length===n,a=[],u={};if(l.each(i,function(f){var p=f.payload;if(this.beforeSendHook&&!f.orphaned&&(p=this.beforeSendHook(p)),p){p.event&&p.properties&&(p.properties=l.extend({},p.properties,{mp_sent_by_lib_version:gt.LIB_VERSION}));var h=!0,g=f.id;g?(this.itemIdsSentSuccessfully[g]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:f,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[g]}),h=!1):this.reportError("[dupe] found item with no ID",{item:f}),h&&a.push(p)}u[f.id]=p},this),a.length<1)return this.requestInProgress=!1,this.resetFlush(),L.resolve();var s=l.bind(function(){return this.queue.removeItemsByID(l.map(i,function(f){return f.id})).then(l.bind(function(f){return l.each(i,l.bind(function(p){var h=p.id;h?(this.itemIdsSentSuccessfully[h]=this.itemIdsSentSuccessfully[h]||0,this.itemIdsSentSuccessfully[h]++,this.itemIdsSentSuccessfully[h]>5&&this.reportError("[dupe] item ID sent too many times",{item:p,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[h]})):this.reportError("[dupe] found item with no ID while removing",{item:p})},this)),f?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),L.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),L.resolve())},this))},this),d=l.bind(function(f){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(l.isObject(f)&&f.error==="timeout"&&new Date().getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(l.isObject(f)&&(f.httpStatusCode>=500||f.httpStatusCode===429||f.httpStatusCode<=0&&!li()||f.error==="timeout")){var p=this.flushInterval*2;return f.retryAfter&&(p=parseInt(f.retryAfter,10)*1e3||p),p=Math.min(Si,p),this.reportError("Error; retry in "+p+" ms"),this.scheduleFlush(p),L.resolve()}else if(l.isObject(f)&&f.httpStatusCode===413)if(i.length>1){var h=Math.max(1,Math.floor(n/2));return this.batchSize=Math.min(this.batchSize,h,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),L.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),s();else return s()}catch(g){this.reportError("Error handling API response",g),this.resetFlush()}},this),c={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(c.transport="sendBeacon"),Fe.log("MIXPANEL REQUEST:",a),this.sendRequestPromise(a,c).then(d)},this)).catch(l.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},K.prototype.reportError=function(e,t){if(Fe.error.apply(Fe.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){Fe.error(r)}};var Ie=Le("recorder"),Dr=x.CompressionStream,bi={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},wi=new Set([Z.MouseMove,Z.MouseInteraction,Z.Scroll,Z.ViewportResize,Z.Input,Z.TouchMove,Z.MediaInteraction,Z.Drag,Z.Selection]);function Ii(e){return e.type===pr.IncrementalSnapshot&&wi.has(e.data.source)}var Y=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout,this._onMaxLengthReached=e.onMaxLengthReached,this._rrwebRecord=e.rrwebRecord,this.replayId=e.replayId,this._stopRecording=null,this.seqNo=0,this.replayStartTime=null,this.batchStartUrl=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=Ye,this.recordMinMs=0;var t="__mprec_"+this.getConfig("token")+"_"+this.replayId;this.batcher=new K(t,{errorReporter:l.bind(this.reportError,this),flushOnlyOnInterval:!0,libConfig:bi,sendRequestFunc:l.bind(this.flushEventsWithOptOut,this),usePersistence:!1})};Y.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},Y.prototype.get_config=function(e){return this.getConfig(e)},Y.prototype.startRecording=function(e){if(this._stopRecording!==null){Ie.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>Ye&&(this.recordMaxMs=Ye,Ie.critical("record_max_ms cannot be greater than "+Ye+"ms. Capping value.")),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>bt&&(this.recordMinMs=bt,Ie.critical("record_min_ms cannot be greater than "+bt+"ms. Capping value.")),this.replayStartTime=new Date().getTime(),this.batchStartUrl=l.info.currentUrl(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=l.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(this._onIdleTimeout,this.getConfig("record_idle_timeout_ms"))},this),r=this.getConfig("record_block_selector");if((r===""||r===null)&&(r=void 0),this._stopRecording=this._rrwebRecord({emit:l.bind(function(n){this.batcher.enqueue(n),Ii(n)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())},this),blockClass:this.getConfig("record_block_class"),blockSelector:r,collectFonts:this.getConfig("record_collect_fonts"),maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector")}),typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}t(),this.maxTimeoutId=setTimeout(l.bind(this._onMaxLengthReached,this),this.recordMaxMs)},Y.prototype.stopRecording=function(){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(e){this.reportError("Error with rrweb stopRecording",e)}this._stopRecording=null}this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},Y.prototype.isRrwebStopped=function(){return this._stopRecording===null},Y.prototype.flushEventsWithOptOut=function(e,t,r){this._flushEvents(e,t,r,l.bind(this._onOptOut,this))},Y.prototype._onOptOut=function(e){e===0&&this.stopRecording()},Y.prototype._sendRequest=function(e,t,r,n){var i=l.bind(function(o,a){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=l.info.currentUrl()),n({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})},this);x.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(o){o.json().then(function(a){i(o,a)}).catch(function(a){n({error:a})})}).catch(function(o){n({error:o,httpStatusCode:0})})},Y.prototype._flushEvents=fi(function(e,t,r){const n=e.length;if(n>0){var i=this.replayId,o=e[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var a=e[n-1].timestamp-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:gt.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:a,replay_start_time:this.replayStartTime/1e3,seq:this.seqNo},s=l.JSONEncode(e),d=this._mixpanel.get_property("$device_id");d&&(u.$device_id=d);var c=this._mixpanel.get_property("$user_id");if(c&&(u.$user_id=c),Dr){var f=new Blob([s],{type:"application/json"}).stream(),p=f.pipeThrough(new Dr("gzip"));new Response(p).blob().then(l.bind(function(h){u.format="gzip",this._sendRequest(i,u,h,r)},this))}else u.format="body",this._sendRequest(i,u,s,r)}}),Y.prototype.reportError=function(e,t){Ie.error.apply(Ie.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){Ie.error(r)}};var Ot=Le("recorder"),Me=function(e){this._mixpanel=e,this.activeRecording=null};Me.prototype.startRecording=function(e){if(this.activeRecording&&!this.activeRecording.isRrwebStopped()){Ot.log("Recording already in progress, skipping startRecording.");return}var t=l.bind(function(){Ot.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),r=l.bind(function(){Ot.log("Max recording length reached, stopping recording."),this.resetRecording()},this);this.activeRecording=new Y({mixpanelInstance:this._mixpanel,onIdleTimeout:t,onMaxLengthReached:r,replayId:l.UUID(),rrwebRecord:ke}),this.activeRecording.startRecording(e)},Me.prototype.stopRecording=function(){this.activeRecording&&(this.activeRecording.stopRecording(),this.activeRecording=null)},Me.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Me.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Me.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),x.__mp_recorder=Me})();
38
+ `);var t="",r,n,i=0,o;for(r=n=0,i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o),u=null;a<128?n++:a>127&&a<2048?u=String.fromCharCode(a>>6|192,a&63|128):u=String.fromCharCode(a>>12|224,a>>6&63|128,a&63|128),u!==null&&(n>r&&(t+=e.substring(r,n)),t+=u,r=n=o+1)}return n>r&&(t+=e.substring(r,e.length)),t},l.UUID=function(){var e=function(){var n=1*new Date,i;if(x.performance&&x.performance.now)i=x.performance.now();else for(i=0;n==1*new Date;)i++;return n.toString(16)+Math.floor(i).toString(16)},t=function(){return Math.random().toString(16).replace(".","")},r=function(){var n=ce,i,o,a=[],u=0;function s(d,c){var f,p=0;for(f=0;f<c.length;f++)p|=a[f]<<f*8;return d^p}for(i=0;i<n.length;i++)o=n.charCodeAt(i),a.unshift(o&255),a.length>=4&&(u=s(u,a),a=[]);return a.length>0&&(u=s(u,a)),u.toString(16)};return function(){var n=(tt.height*tt.width).toString(16);return e()+"-"+t()+"-"+r()+"-"+n+"-"+e()}}();var Er=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];l.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Er.length;t++)if(e.indexOf(Er[t])!==-1)return!0;return!1},l.HTTPBuildQuery=function(e,t){var r,n,i=[];return l.isUndefined(t)&&(t="&"),l.each(e,function(o,a){r=encodeURIComponent(o.toString()),n=encodeURIComponent(a),i[i.length]=n+"="+r}),i.join(t)},l.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r="[\\?&]"+t+"=([^&#]*)",n=new RegExp(r),i=n.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{X.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},l.cookie={get:function(e){for(var t=e+"=",r=j.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=l.JSONDecode(l.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,r,n,i,o,a){var u="",s="",d="";if(a)u="; domain="+a;else if(n){var c=Rr(j.location.hostname);u=c?"; domain=."+c:""}if(r){var f=new Date;f.setTime(f.getTime()+r*1e3),s="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),j.cookie=e+"="+encodeURIComponent(t)+s+"; path=/"+u+d},set:function(e,t,r,n,i,o,a){var u="",s="",d="";if(a)u="; domain="+a;else if(n){var c=Rr(j.location.hostname);u=c?"; domain=."+c:""}if(r){var f=new Date;f.setTime(f.getTime()+r*24*60*60*1e3),s="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var p=e+"="+encodeURIComponent(t)+s+"; path=/"+u+d;return j.cookie=p,p},remove:function(e,t,r){l.cookie.set(e,"",-1,t,!1,!1,r)}};var Ct=null,rt=function(e,t){if(Ct!==null&&!t)return Ct;var r=!0;try{e=e||x.localStorage;var n="__mplss_"+_t(8),i="xyz";e.setItem(n,i),e.getItem(n)!==i&&(r=!1),e.removeItem(n)}catch{r=!1}return Ct=r,r};l.localStorage={is_supported:function(e){var t=rt(null,e);return t||X.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){X.error("localStorage error: "+e)},get:function(e){try{return x.localStorage.getItem(e)}catch(t){l.localStorage.error(t)}return null},parse:function(e){try{return l.JSONDecode(l.localStorage.get(e))||{}}catch{}return null},set:function(e,t){try{x.localStorage.setItem(e,t)}catch(r){l.localStorage.error(r)}},remove:function(e){try{x.localStorage.removeItem(e)}catch(t){l.localStorage.error(t)}}},l.register_event=function(){var e=function(n,i,o,a,u){if(!n){X.error("No valid element provided to register_event");return}if(n.addEventListener&&!a)n.addEventListener(i,o,!!u);else{var s="on"+i,d=n[s];n[s]=t(n,o,d)}};function t(n,i,o){var a=function(u){if(u=u||r(x.event),!!u){var s=!0,d,c;return l.isFunction(o)&&(d=o(u)),c=i.call(n,u),(d===!1||c===!1)&&(s=!1),s}};return a}function r(n){return n&&(n.preventDefault=r.preventDefault,n.stopPropagation=r.stopPropagation),n}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},e}();var ii=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');l.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(i,o){var a=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(a)>=0}function n(i){if(!j.getElementsByTagName)return[];var o=i.split(" "),a,u,s,d,c,f,p,h,g,m,v=[j];for(f=0;f<o.length;f++){if(a=o[f].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){u=a.split("#"),s=u[0];var w=u[1],b=j.getElementById(w);if(!b||s&&b.nodeName.toLowerCase()!=s)return[];v=[b];continue}if(a.indexOf(".")>-1){u=a.split("."),s=u[0];var y=u[1];for(s||(s="*"),d=[],c=0,p=0;p<v.length;p++)for(s=="*"?g=e(v[p]):g=v[p].getElementsByTagName(s),h=0;h<g.length;h++)d[c++]=g[h];for(v=[],m=0,p=0;p<d.length;p++)d[p].className&&l.isString(d[p].className)&&r(d[p],y)&&(v[m++]=d[p]);continue}var S=a.match(ii);if(S){s=S[1];var I=S[2],U=S[3],B=S[4];for(s||(s="*"),d=[],c=0,p=0;p<v.length;p++)for(s=="*"?g=e(v[p]):g=v[p].getElementsByTagName(s),h=0;h<g.length;h++)d[c++]=g[h];v=[],m=0;var k;switch(U){case"=":k=function(T){return T.getAttribute(I)==B};break;case"~":k=function(T){return T.getAttribute(I).match(new RegExp("\\b"+B+"\\b"))};break;case"|":k=function(T){return T.getAttribute(I).match(new RegExp("^"+B+"-?"))};break;case"^":k=function(T){return T.getAttribute(I).indexOf(B)===0};break;case"$":k=function(T){return T.getAttribute(I).lastIndexOf(B)==T.getAttribute(I).length-B.length};break;case"*":k=function(T){return T.getAttribute(I).indexOf(B)>-1};break;default:k=function(T){return T.getAttribute(I)}}for(v=[],m=0,p=0;p<d.length;p++)k(d[p])&&(v[m++]=d[p]);continue}for(s=a,d=[],c=0,p=0;p<v.length;p++)for(g=v[p].getElementsByTagName(s),h=0;h<g.length;h++)d[c++]=g[h];v=d}return v}return function(i){return l.isElement(i)?[i]:l.isObject(i)&&!l.isUndefined(i.length)?i:n.call(this,i)}}();var oi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],si=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];l.info={campaignParams:function(e){var t="",r={};return l.each(oi,function(n){t=l.getQueryParam(j.URL,n),t.length?r[n]=t:e!==void 0&&(r[n]=e)}),r},clickParams:function(){var e="",t={};return l.each(si,function(r){e=l.getQueryParam(j.URL,r),e.length&&(t[r]=e)}),t},marketingParams:function(){return l.extend(l.info.campaignParams(),l.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=l.info.searchEngine(e),r=t!="yahoo"?"q":"p",n={};if(t!==null){n.$search_engine=t;var i=l.getQueryParam(e,r);i.length&&(n.mp_keyword=i)}return n},browser:function(e,t,r){return t=t||"",r||l.includes(e," OPR/")?l.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":l.includes(e,"IEMobile")||l.includes(e,"WPDesktop")?"Internet Explorer Mobile":l.includes(e,"SamsungBrowser/")?"Samsung Internet":l.includes(e,"Edge")||l.includes(e,"Edg/")?"Microsoft Edge":l.includes(e,"FBIOS")?"Facebook Mobile":l.includes(e,"Chrome")?"Chrome":l.includes(e,"CriOS")?"Chrome iOS":l.includes(e,"UCWEB")||l.includes(e,"UCBrowser")?"UC Browser":l.includes(e,"FxiOS")?"Firefox iOS":l.includes(t,"Apple")?l.includes(e,"Mobile")?"Mobile Safari":"Safari":l.includes(e,"Android")?"Android Mobile":l.includes(e,"Konqueror")?"Konqueror":l.includes(e,"Firefox")?"Firefox":l.includes(e,"MSIE")||l.includes(e,"Trident/")?"Internet Explorer":l.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var n=l.info.browser(e,t,r),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=i[n];if(o===void 0)return null;var a=e.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var e=ce;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return x.location.href},properties:function(e){return typeof e!="object"&&(e={}),l.extend(l.strip_empty_properties({$os:l.info.os(),$browser:l.info.browser(ce,Ae.vendor,et),$referrer:j.referrer,$referring_domain:l.info.referringDomain(j.referrer),$device:l.info.device(ce)}),{$current_url:l.info.currentUrl(),$browser_version:l.info.browserVersion(ce,Ae.vendor,et),$screen_height:tt.height,$screen_width:tt.width,mp_lib:"web",$lib_version:gt.LIB_VERSION,$insert_id:_t(),time:l.timestamp()/1e3},l.strip_empty_properties(e))},people_properties:function(){return l.extend(l.strip_empty_properties({$os:l.info.os(),$browser:l.info.browser(ce,Ae.vendor,et)}),{$browser_version:l.info.browserVersion(ce,Ae.vendor,et)})},mpPageViewProperties:function(){return l.strip_empty_properties({current_page_title:j.title,current_domain:x.location.hostname,current_url_path:x.location.pathname,current_url_protocol:x.location.protocol,current_url_search:x.location.search})}};var _t=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},ai=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,ui=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Rr=function(e){var t=ui,r=e.split("."),n=r[r.length-1];(n.length>4||n==="com"||n==="org")&&(t=ai);var i=e.match(t);return i?i[0]:""},li=function(){var e=x.navigator.onLine;return l.isUndefined(e)||e},nt=null,it=null;typeof JSON<"u"&&(nt=JSON.stringify,it=JSON.parse),nt=nt||l.JSONEncode,it=it||l.JSONDecode,l.toArray=l.toArray,l.isObject=l.isObject,l.JSONEncode=l.JSONEncode,l.JSONDecode=l.JSONDecode,l.isBlockedUA=l.isBlockedUA,l.isEmptyObject=l.isEmptyObject,l.info=l.info,l.info.device=l.info.device,l.info.browser=l.info.browser,l.info.browserVersion=l.info.browserVersion,l.info.properties=l.info.properties,l.NPO=oe;var ci="__mp_opt_in_out_";function di(e,t){if(gi(t))return X.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var r=mi(e,t)==="0";return r&&X.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function fi(e){return yi(e,function(t){return this.get_config(t)})}function hi(e){return e=e||{},e.persistenceType==="localStorage"?l.localStorage:l.cookie}function pi(e,t){return t=t||{},(t.persistencePrefix||ci)+e}function mi(e,t){return hi(t).get(pi(e,t))}function gi(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||x,r=t.navigator||{},n=!1;return l.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(i){l.includes([!0,1,"1","yes"],i)&&(n=!0)}),n}function yi(e,t){return function(){var r=!1;try{var n=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),a=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");n&&(r=di(n,{ignoreDnt:i,persistenceType:o,persistencePrefix:a,window:u}))}catch(d){X.error("Unexpected error when checking tracking opt-out status: "+d)}if(!r)return e.apply(this,arguments);var s=arguments[arguments.length-1];typeof s=="function"&&s(0)}}var vi=Le("lock"),xr=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||L};xr.prototype.withLock=function(e,t){var r=this.promiseImpl;return new r(l.bind(function(n,i){var o=t||new Date().getTime()+"|"+Math.random(),a=new Date().getTime(),u=this.storageKey,s=this.pollIntervalMS,d=this.timeoutMS,c=this.storage,f=u+":X",p=u+":Y",h=u+":Z",g=function(y){if(new Date().getTime()-a>d){vi.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),c.removeItem(h),c.removeItem(p),w();return}setTimeout(function(){try{y()}catch(S){i(S)}},s*(Math.random()+.1))},m=function(y,S){y()?S():g(function(){m(y,S)})},v=function(){var y=c.getItem(p);return y&&y!==o?!1:(c.setItem(p,o),c.getItem(p)===o?!0:(rt(c,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},w=function(){c.setItem(f,o),m(v,function(){if(c.getItem(f)===o){b();return}g(function(){if(c.getItem(p)!==o){w();return}m(function(){return!c.getItem(h)},b)})})},b=function(){c.setItem(h,"1");var y=function(){c.removeItem(h),c.getItem(p)===o&&c.removeItem(p),c.getItem(f)===o&&c.removeItem(f)};e().then(function(S){y(),n(S)}).catch(function(S){y(),i(S)})};try{if(rt(c,!0))w();else throw new Error("localStorage support check failed")}catch(y){i(y)}},this))};var Pe=function(e){this.storage=e||localStorage};Pe.prototype.init=function(){return L.resolve()},Pe.prototype.setItem=function(e,t){return new L(l.bind(function(r,n){try{this.storage.setItem(e,t)}catch(i){n(i)}r()},this))},Pe.prototype.getItem=function(e){return new L(l.bind(function(t,r){var n;try{n=this.storage.getItem(e)}catch(i){r(i)}t(n)},this))},Pe.prototype.removeItem=function(e){return new L(l.bind(function(t,r){try{this.storage.removeItem(e)}catch(n){r(n)}t()},this))};var kr=Le("batch"),re=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new Pe,this.lock=new xr(e,{storage:t.sharedLockStorage||window.localStorage}),this.queueStorage.init()),this.reportError=t.errorReporter||l.bind(kr.error,kr),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1};re.prototype.ensureInit=function(){return this.initialized?L.resolve():this.queueStorage.init().then(l.bind(function(){this.initialized=!0},this)).catch(l.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},re.prototype.enqueue=function(e,t){var r={id:_t(),flushAfter:new Date().getTime()+t*2,payload:e};if(this.usePersistence){var n=l.bind(function(){return this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(i){return i.push(r),this.saveToStorage(i)},this)).then(l.bind(function(i){return i&&this.memQueue.push(r),i},this)).catch(l.bind(function(i){return this.reportError("Error enqueueing item",i,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(l.bind(function(i){return this.reportError("Error acquiring storage lock",i),!1},this))}else return this.memQueue.push(r),L.resolve(!0)},re.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(r){if(r.length){var n={};l.each(t,function(a){n[a.id]=!0});for(var i=0;i<r.length;i++){var o=r[i];if(new Date().getTime()>o.flushAfter&&!n[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):L.resolve(t)};var Tr=function(e,t){var r=[];return l.each(e,function(n){n.id&&!t[n.id]&&r.push(n)}),r};re.prototype.removeItemsByID=function(e){var t={};if(l.each(e,function(n){t[n]=!0}),this.memQueue=Tr(this.memQueue,t),this.usePersistence){var r=l.bind(function(){return this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(n){return n=Tr(n,t),this.saveToStorage(n)},this)).then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(n){for(var i=0;i<n.length;i++){var o=n[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(l.bind(function(n){return this.reportError("Error removing items",n,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(l.bind(function(n){return this.reportError("Error acquiring storage lock",n),rt(this.queueStorage.storage,!0)?!1:r().then(l.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(l.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return L.resolve(!0)};var Nr=function(e,t){var r=[];return l.each(e,function(n){var i=n.id;if(i in t){var o=t[i];o!==null&&(n.payload=o,r.push(n))}else r.push(n)}),r};re.prototype.updatePayloads=function(e){return this.memQueue=Nr(this.memQueue,e),this.usePersistence?this.lock.withLock(l.bind(function(){return this.ensureInit().then(l.bind(function(){return this.readFromStorage()},this)).then(l.bind(function(r){return r=Nr(r,e),this.saveToStorage(r)},this)).catch(l.bind(function(r){return this.reportError("Error updating items",e,r),!1},this))},this),this.pid).catch(l.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):L.resolve(!0)},re.prototype.readFromStorage=function(){return this.ensureInit().then(l.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(l.bind(function(e){return e&&(e=it(e),l.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(l.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},re.prototype.saveToStorage=function(e){try{var t=nt(e)}catch(r){return this.reportError("Error serializing queue",r),L.resolve(!1)}return this.ensureInit().then(l.bind(function(){return this.queueStorage.setItem(this.storageKey,t)},this)).then(function(){return!0}).catch(l.bind(function(r){return this.reportError("Error saving queue",r),!1},this))},re.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(l.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):L.resolve()};var Si=10*60*1e3,Fe=Le("batch"),K=function(e,t){this.errorReporter=t.errorReporter,this.queue=new re(e,{errorReporter:l.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1};K.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},K.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},K.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},K.prototype.clear=function(){return this.queue.clear()},K.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},K.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},K.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(l.bind(function(){this.stopped||this.flush()},this),this.flushInterval))},K.prototype.sendRequestPromise=function(e,t){return new L(l.bind(function(r){this.sendRequest(e,t,r)},this))},K.prototype.flush=function(e){if(this.requestInProgress)return Fe.log("Flush: Request already in progress"),L.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=new Date().getTime(),n=this.batchSize;return this.queue.fillBatch(n).then(l.bind(function(i){var o=i.length===n,a=[],u={};if(l.each(i,function(f){var p=f.payload;if(this.beforeSendHook&&!f.orphaned&&(p=this.beforeSendHook(p)),p){p.event&&p.properties&&(p.properties=l.extend({},p.properties,{mp_sent_by_lib_version:gt.LIB_VERSION}));var h=!0,g=f.id;g?(this.itemIdsSentSuccessfully[g]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:f,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[g]}),h=!1):this.reportError("[dupe] found item with no ID",{item:f}),h&&a.push(p)}u[f.id]=p},this),a.length<1)return this.requestInProgress=!1,this.resetFlush(),L.resolve();var s=l.bind(function(){return this.queue.removeItemsByID(l.map(i,function(f){return f.id})).then(l.bind(function(f){return l.each(i,l.bind(function(p){var h=p.id;h?(this.itemIdsSentSuccessfully[h]=this.itemIdsSentSuccessfully[h]||0,this.itemIdsSentSuccessfully[h]++,this.itemIdsSentSuccessfully[h]>5&&this.reportError("[dupe] item ID sent too many times",{item:p,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[h]})):this.reportError("[dupe] found item with no ID while removing",{item:p})},this)),f?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),L.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),L.resolve())},this))},this),d=l.bind(function(f){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(l.isObject(f)&&f.error==="timeout"&&new Date().getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(l.isObject(f)&&(f.httpStatusCode>=500||f.httpStatusCode===429||f.httpStatusCode<=0&&!li()||f.error==="timeout")){var p=this.flushInterval*2;return f.retryAfter&&(p=parseInt(f.retryAfter,10)*1e3||p),p=Math.min(Si,p),this.reportError("Error; retry in "+p+" ms"),this.scheduleFlush(p),L.resolve()}else if(l.isObject(f)&&f.httpStatusCode===413)if(i.length>1){var h=Math.max(1,Math.floor(n/2));return this.batchSize=Math.min(this.batchSize,h,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),L.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),s();else return s()}catch(g){this.reportError("Error handling API response",g),this.resetFlush()}},this),c={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(c.transport="sendBeacon"),Fe.log("MIXPANEL REQUEST:",a),this.sendRequestPromise(a,c).then(d)},this)).catch(l.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},K.prototype.reportError=function(e,t){if(Fe.error.apply(Fe.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){Fe.error(r)}};var Ie=Le("recorder"),Dr=x.CompressionStream,bi={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},wi=new Set([Z.MouseMove,Z.MouseInteraction,Z.Scroll,Z.ViewportResize,Z.Input,Z.TouchMove,Z.MediaInteraction,Z.Drag,Z.Selection]);function Ii(e){return e.type===pr.IncrementalSnapshot&&wi.has(e.data.source)}var Y=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout,this._onMaxLengthReached=e.onMaxLengthReached,this._rrwebRecord=e.rrwebRecord,this.replayId=e.replayId,this._stopRecording=null,this.seqNo=0,this.replayStartTime=null,this.replayStartUrl=null,this.batchStartUrl=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=Ye,this.recordMinMs=0;var t="__mprec_"+this.getConfig("token")+"_"+this.replayId;this.batcher=new K(t,{errorReporter:l.bind(this.reportError,this),flushOnlyOnInterval:!0,libConfig:bi,sendRequestFunc:l.bind(this.flushEventsWithOptOut,this),usePersistence:!1})};Y.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},Y.prototype.get_config=function(e){return this.getConfig(e)},Y.prototype.startRecording=function(e){if(this._stopRecording!==null){Ie.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>Ye&&(this.recordMaxMs=Ye,Ie.critical("record_max_ms cannot be greater than "+Ye+"ms. Capping value.")),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>bt&&(this.recordMinMs=bt,Ie.critical("record_min_ms cannot be greater than "+bt+"ms. Capping value.")),this.replayStartTime=new Date().getTime(),this.batchStartUrl=l.info.currentUrl(),this.replayStartUrl=l.info.currentUrl(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=l.bind(function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(this._onIdleTimeout,this.getConfig("record_idle_timeout_ms"))},this),r=this.getConfig("record_block_selector");if((r===""||r===null)&&(r=void 0),this._stopRecording=this._rrwebRecord({emit:l.bind(function(n){this.batcher.enqueue(n),Ii(n)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())},this),blockClass:this.getConfig("record_block_class"),blockSelector:r,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}}),typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}t(),this.maxTimeoutId=setTimeout(l.bind(this._onMaxLengthReached,this),this.recordMaxMs)},Y.prototype.stopRecording=function(){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(e){this.reportError("Error with rrweb stopRecording",e)}this._stopRecording=null}this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},Y.prototype.isRrwebStopped=function(){return this._stopRecording===null},Y.prototype.flushEventsWithOptOut=function(e,t,r){this._flushEvents(e,t,r,l.bind(this._onOptOut,this))},Y.prototype._onOptOut=function(e){e===0&&this.stopRecording()},Y.prototype._sendRequest=function(e,t,r,n){var i=l.bind(function(o,a){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=l.info.currentUrl()),n({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})},this);x.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(o){o.json().then(function(a){i(o,a)}).catch(function(a){n({error:a})})}).catch(function(o){n({error:o,httpStatusCode:0})})},Y.prototype._flushEvents=fi(function(e,t,r){const n=e.length;if(n>0){var i=this.replayId,o=e[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var a=e[n-1].timestamp-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:gt.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:a,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},s=l.JSONEncode(e),d=this._mixpanel.get_property("$device_id");d&&(u.$device_id=d);var c=this._mixpanel.get_property("$user_id");if(c&&(u.$user_id=c),Dr){var f=new Blob([s],{type:"application/json"}).stream(),p=f.pipeThrough(new Dr("gzip"));new Response(p).blob().then(l.bind(function(h){u.format="gzip",this._sendRequest(i,u,h,r)},this))}else u.format="body",this._sendRequest(i,u,s,r)}}),Y.prototype.reportError=function(e,t){Ie.error.apply(Ie.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){Ie.error(r)}};var Ot=Le("recorder"),Me=function(e){this._mixpanel=e,this.activeRecording=null};Me.prototype.startRecording=function(e){if(this.activeRecording&&!this.activeRecording.isRrwebStopped()){Ot.log("Recording already in progress, skipping startRecording.");return}var t=l.bind(function(){Ot.log("Idle timeout reached, restarting recording."),this.resetRecording()},this),r=l.bind(function(){Ot.log("Max recording length reached, stopping recording."),this.resetRecording()},this);this.activeRecording=new Y({mixpanelInstance:this._mixpanel,onIdleTimeout:t,onMaxLengthReached:r,replayId:l.UUID(),rrwebRecord:ke}),this.activeRecording.startRecording(e)},Me.prototype.stopRecording=function(){this.activeRecording&&(this.activeRecording.stopRecording(),this.activeRecording=null)},Me.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},Me.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(Me.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),x.__mp_recorder=Me})();
39
39
  //# sourceMappingURL=mixpanel-recorder.min.js.map