@reservamos/browser-analytics 1.0.4 → 1.0.5

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.
@@ -27,5 +27,5 @@ PERFORMANCE OF THIS SOFTWARE.
27
27
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
28
  PERFORMANCE OF THIS SOFTWARE.
29
29
  ***************************************************************************** */
30
- function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:u,dataURLOptions:d}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),u=yield c.arrayBuffer(),d=encode2(u);return s.set(i,d),d}return""}))}(c,u,d),p=new OffscreenCanvas(c,u);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(d),f=h.type,m=yield h.arrayBuffer(),g=encode2(m);if(!i.has(t)&&(yield l)===g)return i.set(t,g),a.postMessage({id:t});if(i.get(t)===g)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:g,width:c,height:u}),i.set(t,g)}}))}}()}));class CanvasManager{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(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,u=new jt;u.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:Tt["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const d=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<d||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);u.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[u])continue;const a=patch(t.CanvasRenderingContext2D.prototype,u,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:Tt["2D"],property:u,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,u,{set(t){e(this.canvas,{type:Tt["2D"],property:u,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,Tt.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,Tt.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]);return t})),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:St()})}let Lt,qt,Ut,Ft=!1;const Bt=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:u=null,maskTextClass:d="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:g,maskTextFn:_,hooks:y,packFn:v,sampling:b={},dataURLOptions:w={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:x=!1,recordCrossOriginIframes:O=!1,recordAfter:T=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:R=!1,inlineImages:P=!1,plugins:N,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:Z}=e;!function registerErrorHandler(e){Ct=e}(Z);const j=!O||window.parent===window;let L=!1;if(!j)try{window.parent.document&&(L=!1)}catch(G){L=!0}if(j&&!t)throw new Error("emit function is required");void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),Bt.reset();const q=!0===h?{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}:void 0!==f?f:{password:!0},U=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let B;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let $=0;const eventProcessor=e=>{for(const t of N||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!L&&(e=v(e)),e};Lt=(e,s)=>{var a;if(!(null===(a=Rt[0])||void 0===a?void 0:a.isFrozen())||e.type===It.FullSnapshot||e.type===It.IncrementalSnapshot&&e.data.source===xt.Mutation||Rt.forEach((e=>e.unfreeze())),j)null==t||t(eventProcessor(e),s);else if(L){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===It.FullSnapshot)B=e,$=0;else if(e.type===It.IncrementalSnapshot){if(e.data.source===xt.Mutation&&e.data.isAttachIframe)return;$++;const t=i&&$>=i,s=n&&e.timestamp-B.timestamp>n;(t||s)&&qt(!0)}};const wrappedMutationEmit=e=>{Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Mutation},e)}))},wrappedScrollEmit=e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Scroll},e)})),wrappedCanvasMutationEmit=e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.CanvasMutation},e)})),z=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.AdoptedStyleSheet},e)}))}),W=new IframeManager({mirror:Bt,mutationCb:wrappedMutationEmit,stylesheetManager:z,recordCrossOriginIframes:O,wrappedEmit:Lt});for(const J of N||[])J.getMirror&&J.getMirror({nodeMirror:Bt,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const H=new ProcessedNodeManager;Ut=new CanvasManager({recordCanvas:x,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:Bt,sampling:b.canvas,dataURLOptions:w});const K=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:q,dataURLOptions:w,maskTextFn:_,maskInputFn:g,recordCanvas:x,inlineImages:P,sampling:b,slimDOMOptions:U,iframeManager:W,stylesheetManager:z,canvasManager:Ut,keepIframeSrcFn:D,processedNodeManager:H},mirror:Bt});qt=(e=!1)=>{if(!I)return;Lt(wrapEvent({type:It.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),z.reset(),K.init(),Rt.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,inlineImages:d=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:!0===p?{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}:!1===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:g,inlineImages:d,recordCanvas:l,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:Bt,blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:q,maskTextFn:_,slimDOM:U,dataURLOptions:w,recordCanvas:x,inlineImages:P,onSerialize:e=>{isSerializedIframe(e,Bt)&&W.addIframe(e),isSerializedStylesheet(e,Bt)&&z.trackLinkElement(e),hasShadowRoot(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:D});if(!t)return console.warn("Failed to snapshot the document");Lt(wrapEvent({type:It.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),Rt.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,Bt.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.ViewportResize},e)})),inputCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Input},e)})),mediaInteractionCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.MediaInteraction},e)})),styleSheetRuleCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.StyleSheetRule},e)})),styleDeclarationCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Font},e)})),selectionCb:e=>{Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Selection},e)}))},customElementCb:e=>{Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:u,maskTextClass:d,maskTextSelector:l,maskInputOptions:q,inlineStylesheet:p,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:P,userTriggeredOnInput:C,collectFonts:R,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:D,blockSelector:a,slimDOMOptions:U,dataURLOptions:w,mirror:Bt,iframeManager:W,stylesheetManager:z,shadowDomManager:K,processedNodeManager:H,canvasManager:Ut,ignoreCSSAttributes:A,plugins:(null===(t=null==N?void 0:N.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Lt(wrapEvent({type:It.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};W.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(Qt){console.warn(Qt)}}));const init2=()=>{qt(),e.push(observe(document)),Ft=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{Lt(wrapEvent({type:It.DomContentLoaded,data:{}})),"DOMContentLoaded"===T&&init2()}))),e.push(on("load",(()=>{Lt(wrapEvent({type:It.Load,data:{}})),"load"===T&&init2()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Ft=!1,function unregisterErrorHandler(){Ct=void 0}()}}catch(Qt){console.warn(Qt)}}record.addCustomEvent=(e,t)=>{if(!Ft)throw new Error("please add custom event after start recording");Lt(wrapEvent({type:It.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{Rt.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!Ft)throw new Error("please take full snapshot after start recording");qt(e)},record.mirror=Bt;var $t,zt=(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))(zt||{}),Wt=(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))(Wt||{}),Vt={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Ht={hostname:""};$t={navigator:{userAgent:"",onLine:!0},document:{location:Ht,referrer:""},screen:{width:0,height:0},location:Ht}}else $t=window;var Kt,Gt,Jt,Yt,Xt,Qt,er,tr,rr,nr,or=864e5,ir=8e3,sr=Array.prototype,ar=Function.prototype,cr=Object.prototype,ur=sr.slice,dr=cr.toString,lr=cr.hasOwnProperty,pr=$t.console,hr=$t.navigator,fr=$t.document,mr=$t.opera,gr=$t.screen,_r=hr.userAgent,yr=ar.bind,vr=sr.forEach,br=sr.indexOf,wr=sr.map,kr=Array.isArray,Sr={},Ir={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},xr={log:function(){if(Vt.DEBUG&&!Ir.isUndefined(pr)&&pr)try{pr.log.apply(pr,arguments)}catch(e){Ir.each(arguments,(function(e){pr.log(e)}))}},warn:function(){if(Vt.DEBUG&&!Ir.isUndefined(pr)&&pr){var e=["Mixpanel warning:"].concat(Ir.toArray(arguments));try{pr.warn.apply(pr,e)}catch(t){Ir.each(e,(function(e){pr.warn(e)}))}}},error:function(){if(Vt.DEBUG&&!Ir.isUndefined(pr)&&pr){var e=["Mixpanel error:"].concat(Ir.toArray(arguments));try{pr.error.apply(pr,e)}catch(t){Ir.each(e,(function(e){pr.error(e)}))}}},critical:function(){if(!Ir.isUndefined(pr)&&pr){var e=["Mixpanel error:"].concat(Ir.toArray(arguments));try{pr.error.apply(pr,e)}catch(t){Ir.each(e,(function(e){pr.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(xr,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(xr.log,e),error:log_func_with_prefix(xr.error,e),critical:log_func_with_prefix(xr.critical,e)}};Ir.bind=function(e,t){var n,i;if(yr&&e.bind===yr)return yr.apply(e,ur.call(arguments,1));if(!Ir.isFunction(e))throw new TypeError;return n=ur.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(ur.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(ur.call(arguments)));return Object(c)===c?c:a},i},Ir.each=function(e,t,n){if(null!=e)if(vr&&e.forEach===vr)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===Sr)return}else for(var a in e)if(lr.call(e,a)&&t.call(n,e[a],a,e)===Sr)return},Ir.extend=function(e){return Ir.each(ur.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},Ir.isArray=kr||function(e){return"[object Array]"===dr.call(e)},Ir.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Ir.isArguments=function(e){return!(!e||!lr.call(e,"callee"))},Ir.toArray=function(e){return e?e.toArray?e.toArray():Ir.isArray(e)||Ir.isArguments(e)?ur.call(e):Ir.values(e):[]},Ir.map=function(e,t,n){if(wr&&e.map===wr)return e.map(t,n);var i=[];return Ir.each(e,(function(e){i.push(t.call(n,e))})),i},Ir.keys=function(e){var t=[];return null===e||Ir.each(e,(function(e,n){t[t.length]=n})),t},Ir.values=function(e){var t=[];return null===e||Ir.each(e,(function(e){t[t.length]=e})),t},Ir.include=function(e,t){var n=!1;return null===e?n:br&&e.indexOf===br?-1!=e.indexOf(t):(Ir.each(e,(function(e){if(n||(n=e===t))return Sr})),n)},Ir.includes=function(e,t){return-1!==e.indexOf(t)},Ir.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Ir.isObject=function(e){return e===Object(e)&&!Ir.isArray(e)},Ir.isEmptyObject=function(e){if(Ir.isObject(e)){for(var t in e)if(lr.call(e,t))return!1;return!0}return!1},Ir.isUndefined=function(e){return void 0===e},Ir.isString=function(e){return"[object String]"==dr.call(e)},Ir.isDate=function(e){return"[object Date]"==dr.call(e)},Ir.isNumber=function(e){return"[object Number]"==dr.call(e)},Ir.isElement=function(e){return!(!e||1!==e.nodeType)},Ir.encodeDates=function(e){return Ir.each(e,(function(t,n){Ir.isDate(t)?e[n]=Ir.formatDate(t):Ir.isObject(t)&&(e[n]=Ir.encodeDates(t))})),e},Ir.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Ir.formatDate=function(e){function pad(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+pad(e.getUTCMonth()+1)+"-"+pad(e.getUTCDate())+"T"+pad(e.getUTCHours())+":"+pad(e.getUTCMinutes())+":"+pad(e.getUTCSeconds())},Ir.strip_empty_properties=function(e){var t={};return Ir.each(e,(function(e,n){Ir.isString(e)&&e.length>0&&(t[n]=e)})),t},Ir.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):Ir.isArray(e)?(n=[],Ir.each(e,(function(e){n.push(Ir.truncate(e,t))}))):Ir.isObject(e)?(n={},Ir.each(e,(function(e,i){n[i]=Ir.truncate(e,t)}))):n=e,n},Ir.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,u=n,d=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",d=[],"[object Array]"===dr.apply(l)){for(c=l.length,i=0;i<c;i+=1)d[i]=str(i,l)||"null";return a=0===d.length?"[]":n?"[\n"+n+d.join(",\n"+n)+"\n"+u+"]":"["+d.join(",")+"]",n=u,a}for(s in l)lr.call(l,s)&&(a=str(s,l))&&d.push(quote(s)+(n?": ":":")+a);return a=0===d.length?"{}":n?"{"+d.join(",")+u+"}":"{"+d.join(",")+"}",n=u,a}};return str("",{"":e})}}(),Ir.JSONDecode=(Xt={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Qt=function(e){var t=new SyntaxError(e);throw t.at=Kt,t.text=Jt,t},er=function(e){return e&&e!==Gt&&Qt("Expected '"+e+"' instead of '"+Gt+"'"),Gt=Jt.charAt(Kt),Kt+=1,Gt},tr=function(){var e,t="";for("-"===Gt&&(t="-",er("-"));Gt>="0"&&Gt<="9";)t+=Gt,er();if("."===Gt)for(t+=".";er()&&Gt>="0"&&Gt<="9";)t+=Gt;if("e"===Gt||"E"===Gt)for(t+=Gt,er(),"-"!==Gt&&"+"!==Gt||(t+=Gt,er());Gt>="0"&&Gt<="9";)t+=Gt,er();if(e=+t,isFinite(e))return e;Qt("Bad number")},rr=function(){var e,t,n,i="";if('"'===Gt)for(;er();){if('"'===Gt)return er(),i;if("\\"===Gt)if(er(),"u"===Gt){for(n=0,t=0;t<4&&(e=parseInt(er(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Xt[Gt])break;i+=Xt[Gt]}else i+=Gt}Qt("Bad string")},nr=function(){for(;Gt&&Gt<=" ";)er()},Yt=function(){switch(nr(),Gt){case"{":return function(){var e,t={};if("{"===Gt){if(er("{"),nr(),"}"===Gt)return er("}"),t;for(;Gt;){if(e=rr(),nr(),er(":"),Object.hasOwnProperty.call(t,e)&&Qt('Duplicate key "'+e+'"'),t[e]=Yt(),nr(),"}"===Gt)return er("}"),t;er(","),nr()}}Qt("Bad object")}();case"[":return function(){var e=[];if("["===Gt){if(er("["),nr(),"]"===Gt)return er("]"),e;for(;Gt;){if(e.push(Yt()),nr(),"]"===Gt)return er("]"),e;er(","),nr()}}Qt("Bad array")}();case'"':return rr();case"-":return tr();default:return Gt>="0"&&Gt<="9"?tr():function(){switch(Gt){case"t":return er("t"),er("r"),er("u"),er("e"),!0;case"f":return er("f"),er("a"),er("l"),er("s"),er("e"),!1;case"n":return er("n"),er("u"),er("l"),er("l"),null}Qt('Unexpected "'+Gt+'"')}()}},function(e){var t;return Jt=e,Kt=0,Gt=" ",t=Yt(),nr(),Gt&&Qt("Syntax error"),t}),Ir.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,d=0,l="",p=[];if(!e)return e;e=Ir.utf8Encode(e);do{t=(a=e.charCodeAt(u++)<<16|e.charCodeAt(u++)<<8|e.charCodeAt(u++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[d++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(u<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},Ir.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),u=null;c<128?n++:u=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==u&&(n>t&&(a+=e.substring(t,n)),a+=u,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Ir.UUID=function(){var T2=function(){var e,t=1*new Date;if($t.performance&&$t.performance.now)e=$t.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(gr.height*gr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=_r,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var Or=["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"];Ir.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Or.length;t++)if(-1!==e.indexOf(Or[t]))return!0;return!1},Ir.HTTPBuildQuery=function(e,t){var n,i,s=[];return Ir.isUndefined(t)&&(t="&"),Ir.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},Ir.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){xr.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},Ir.cookie={get:function(e){for(var t=e+"=",n=fr.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=Ir.JSONDecode(Ir.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(fr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),fr.cookie=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l},set:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(fr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l;return fr.cookie=f,f},remove:function(e,t,n){Ir.cookie.set(e,"",-1,t,!1,!1,n)}};var Er=null,localStorageSupported=function(e,t){if(null!==Er&&!t)return Er;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Er=n,n};Ir.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||xr.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){xr.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){Ir.localStorage.error(t)}return null},parse:function(e){try{return Ir.JSONDecode(Ir.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){Ir.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){Ir.localStorage.error(t)}}},Ir.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return Ir.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else xr.error("No valid element provided to register_event")}}();var Tr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Ir.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!fr.getElementsByTagName)return[];var t,n,i,s,a,c,u,d,l,p,h=e.split(" "),f=[fr];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],g=fr.getElementById(m);if(!g||i&&g.nodeName.toLowerCase()!=i)return[];f=[g]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var _=n[1];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];for(f=[],p=0,u=0;u<s.length;u++)s[u].className&&Ir.isString(s[u].className)&&hasClass(s[u],_)&&(f[p++]=s[u])}else{var y=t.match(Tr);if(y){i=y[1];var v,b=y[2],w=y[3],S=y[4];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];switch(f=[],p=0,w){case"=":v=function(e){return e.getAttribute(b)==S};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+S+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+S+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(S)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(S)==e.getAttribute(b).length-S.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(S)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,u=0;u<s.length;u++)v(s[u])&&(f[p++]=s[u])}else{for(i=t,s=[],a=0,u=0;u<f.length;u++)for(l=f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];f=s}}return f}return function(e){return Ir.isElement(e)?[e]:Ir.isObject(e)&&!Ir.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Cr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Rr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Ir.info={campaignParams:function(e){var t="",n={};return Ir.each(Cr,(function(i){(t=Ir.getQueryParam(fr.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return Ir.each(Rr,(function(n){(e=Ir.getQueryParam(fr.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return Ir.extend(Ir.info.campaignParams(),Ir.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var t=Ir.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=Ir.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||Ir.includes(e," OPR/")?Ir.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Ir.includes(e,"IEMobile")||Ir.includes(e,"WPDesktop")?"Internet Explorer Mobile":Ir.includes(e,"SamsungBrowser/")?"Samsung Internet":Ir.includes(e,"Edge")||Ir.includes(e,"Edg/")?"Microsoft Edge":Ir.includes(e,"FBIOS")?"Facebook Mobile":Ir.includes(e,"Chrome")?"Chrome":Ir.includes(e,"CriOS")?"Chrome iOS":Ir.includes(e,"UCWEB")||Ir.includes(e,"UCBrowser")?"UC Browser":Ir.includes(e,"FxiOS")?"Firefox iOS":Ir.includes(t,"Apple")?Ir.includes(e,"Mobile")?"Mobile Safari":"Safari":Ir.includes(e,"Android")?"Android Mobile":Ir.includes(e,"Konqueror")?"Konqueror":Ir.includes(e,"Firefox")?"Firefox":Ir.includes(e,"MSIE")||Ir.includes(e,"Trident/")?"Internet Explorer":Ir.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var 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+)?)/}[Ir.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=_r;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 $t.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Ir.extend(Ir.strip_empty_properties({$os:Ir.info.os(),$browser:Ir.info.browser(_r,hr.vendor,mr),$referrer:fr.referrer,$referring_domain:Ir.info.referringDomain(fr.referrer),$device:Ir.info.device(_r)}),{$current_url:Ir.info.currentUrl(),$browser_version:Ir.info.browserVersion(_r,hr.vendor,mr),$screen_height:gr.height,$screen_width:gr.width,mp_lib:"web",$lib_version:Vt.LIB_VERSION,$insert_id:cheap_guid(),time:Ir.timestamp()/1e3},Ir.strip_empty_properties(e))},people_properties:function(){return Ir.extend(Ir.strip_empty_properties({$os:Ir.info.os(),$browser:Ir.info.browser(_r,hr.vendor,mr)}),{$browser_version:Ir.info.browserVersion(_r,hr.vendor,mr)})},mpPageViewProperties:function(){return Ir.strip_empty_properties({current_page_title:fr.title,current_domain:$t.location.hostname,current_url_path:$t.location.pathname,current_url_protocol:$t.location.protocol,current_url_search:$t.location.search})}};var cheap_guid=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},Pr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Mr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=Mr,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Pr);var s=e.match(t);return s?s[0]:""},Nr=null,Dr=null;"undefined"!=typeof JSON&&(Nr=JSON.stringify,Dr=JSON.parse),Nr=Nr||Ir.JSONEncode,Dr=Dr||Ir.JSONDecode,Ir.toArray=Ir.toArray,Ir.isObject=Ir.isObject,Ir.JSONEncode=Ir.JSONEncode,Ir.JSONDecode=Ir.JSONDecode,Ir.isBlockedUA=Ir.isBlockedUA,Ir.isEmptyObject=Ir.isEmptyObject,Ir.info=Ir.info,Ir.info.device=Ir.info.device,Ir.info.browser=Ir.info.browser,Ir.info.browserVersion=Ir.info.browserVersion,Ir.info.properties=Ir.info.properties;var Ar="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||$t,n=t.navigator||{},i=!1;return Ir.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Ir.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return xr.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 n="0"===_getStorageValue(e,t);return n&&xr.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?Ir.localStorage:Ir.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Ar)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){Ir.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,Ir.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):xr.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:u}))}catch(l){xr.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var d=arguments[arguments.length-1];"function"==typeof d&&d(0)}}var Zr=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,u=this.timeoutMS,d=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>u)return Zr.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),d.removeItem(h),d.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=d.getItem(p);if(e&&e!==i)return!1;if(d.setItem(p,i),d.getItem(p)===i)return!0;if(!localStorageSupported(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){d.setItem(l,i),waitFor(getSetY,(function(){d.getItem(l)!==i?delay((function(){d.getItem(p)===i?waitFor((function(){return!d.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){d.setItem(h,"1");try{e()}finally{d.removeItem(h),d.getItem(p)===i&&d.removeItem(p),d.getItem(l)===i&&d.removeItem(l)}};try{if(!localStorageSupported(d,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var jr=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||Ir.bind(jr.error,jr),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(Ir.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),Ir.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};Ir.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return Ir.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(Ir.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=Ir.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),Ir.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return Ir.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(Ir.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),Ir.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=Dr(e),Ir.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Nr(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Ir.bind(this.reportError,this),storage:t.storage,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};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(Ir.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void Lr.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],u={};if(Ir.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Ir.extend({},t.properties,{mp_sent_by_lib_version:Vt.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}u[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var d=Ir.bind((function(c){this.requestInProgress=!1;try{var d=!1;if(e.unloading)this.queue.updatePayloads(u);else if(Ir.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(Ir.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=$t.navigator.onLine,!Ir.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(Ir.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),d=!0;else d=!0;d&&(this.queue.removeItemsByID(Ir.map(s,(function(e){return e.id})),Ir.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!a?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),Ir.each(s,Ir.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),Lr.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(Lr.error.apply(Lr.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Lr.error(n)}};var qr=console_with_prefix("recorder"),Ur=$t.CompressionStream,Fr={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},Br=new Set([Wt.MouseMove,Wt.MouseInteraction,Wt.Scroll,Wt.ViewportResize,Wt.Input,Wt.TouchMove,Wt.MediaInteraction,Wt.Drag,Wt.Selection]);var MixpanelRecorder=function(e){this._mixpanel=e,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=or,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Fr,sendRequestFunc:Ir.bind(this.flushEventsWithOptOut,this),errorReporter:Ir.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(e){return this._mixpanel.get_config(e)},MixpanelRecorder.prototype.startRecording=function(e){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>or&&(this.recordMaxMs=or,qr.critical("record_max_ms cannot be greater than "+or+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>ir&&(this.recordMinMs=ir,qr.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Ir.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=Ir.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Ir.bind((function(){qr.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:Ir.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===zt.IncrementalSnapshot&&Br.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),t(),this.maxTimeoutId=setTimeout(Ir.bind(this.resetRecording,this),this.recordMaxMs)}else qr.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,t,n){this._flushEvents(e,t,n,Ir.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=Ir.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);$t.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,u={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},d=Ir.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(u.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(u.$user_id=p),Ur){var h=new Blob([d],{type:"application/json"}).stream().pipeThrough(new Ur("gzip"));new Response(h).blob().then(Ir.bind((function(e){u.format="gzip",this._sendRequest(s,u,e,n)}),this))}else u.format="body",this._sendRequest(s,u,d,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){qr.error.apply(qr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){qr.error(n)}},$t.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,t,n,i){var s=this,a=Ir.dom_query(e);if(0!==a.length)return Ir.each(a,(function(e){Ir.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),u=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),u),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;xr.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):Ir.extend({},e)};var LinkTracker=function(){this.override_event="click"};Ir.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};Ir.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var $r="$set",zr="$set_once",Wr="$unset",Vr="$add",Hr="$append",Kr="$union",Gr="$remove",Jr={set_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[$r]=i,n},unset_action:function(e){var t={},n=[];return Ir.isArray(e)||(e=[e]),Ir.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[Wr]=n,t},set_once_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[zr]=i,n},union_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=Ir.isArray(e)?e:[e])}),this):i[e]=Ir.isArray(t)?t:[t],n[Kr]=i,n},append_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Hr]=i,n},remove_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Gr]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Ir.extend(MixpanelGroup.prototype,Jr),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return Ir.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return Ir.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=Ir.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};Ir.extend(MixpanelPeople.prototype,Jr),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return Ir.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[$r]=Ir.extend({},Ir.info.people_properties(),i[$r]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return Ir.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return Ir.isObject(e)?(Ir.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void xr.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(Ir.isUndefined(t)&&(t=1),s[e]=t),i[Vr]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(Ir.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Ir.extend({$amount:e},t),n);xr.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}xr.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=Ir.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:a,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),Ir.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Ir.truncate(a,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){$r in e?this._mixpanel.persistence._add_to_people_queue($r,e):zr in e?this._mixpanel.persistence._add_to_people_queue(zr,e):Wr in e?this._mixpanel.persistence._add_to_people_queue(Wr,e):Vr in e?this._mixpanel.persistence._add_to_people_queue(Vr,e):Hr in e?this._mixpanel.persistence._add_to_people_queue(Hr,e):Gr in e?this._mixpanel.persistence._add_to_people_queue(Gr,e):Kr in e?this._mixpanel.persistence._add_to_people_queue(Kr,e):xr.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=Ir.extend({},this._mixpanel.persistence.load_queue(e)),c=a;Ir.isUndefined(a)||!Ir.isObject(a)||Ir.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),Ir.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var u=this;this._flush_one_queue($r,this.set,e),this._flush_one_queue(zr,this.set_once,i),this._flush_one_queue(Wr,this.unset,a,(function(e){return Ir.keys(e)})),this._flush_one_queue(Vr,this.increment,t),this._flush_one_queue(Kr,this.union,s);var d=this._mixpanel.persistence.load_queue(Hr);if(!Ir.isUndefined(d)&&Ir.isArray(d)&&d.length)for(var l,append_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(Hr,l),Ir.isUndefined(n)||n(e,t)},p=d.length-1;p>=0;p--)d=this._mixpanel.persistence.load_queue(Hr),l=d.pop(),u._mixpanel.persistence.save(),Ir.isEmptyObject(l)||u.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(Gr);if(!Ir.isUndefined(h)&&Ir.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(Gr,f),Ir.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(Gr),f=h.pop(),u._mixpanel.persistence.save(),Ir.isEmptyObject(f)||u.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var Yr,Xr="__mps",Qr="__mpso",en="__mpus",tn="__mpa",rn="__mpap",nn="__mpr",sn="__mpu",an="$people_distinct_id",cn="__alias",un="__timers",dn=[Xr,Qr,en,tn,rn,nn,sn,an,cn,un],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(xr.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Ir.localStorage.is_supported()?this.storage=Ir.localStorage:this.storage=Ir.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Ir.each(this.props,(function(t,n){Ir.include(dn,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Ir.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===Ir.localStorage?(e=Ir.cookie.parse(this.name),Ir.cookie.remove(this.name),Ir.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Ir.cookie&&(t=Ir.localStorage.parse(this.name),Ir.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Ir.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,t,n){return!!Ir.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),Ir.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!Ir.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Ir.extend(this.props,e),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(e){this.register(Ir.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Ir.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Ir.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue($r),a=this._get_or_create_queue(zr),c=this._get_or_create_queue(Wr),u=this._get_or_create_queue(Vr),d=this._get_or_create_queue(Kr),l=this._get_or_create_queue(Gr,[]),p=this._get_or_create_queue(Hr,[]);n===Xr?(Ir.extend(s,i),this._pop_from_people_queue(Vr,i),this._pop_from_people_queue(Kr,i),this._pop_from_people_queue(Wr,i)):n===Qr?(Ir.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(Wr,i)):n===en?Ir.each(i,(function(e){Ir.each([s,a,u,d],(function(t){e in t&&delete t[e]})),Ir.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===tn?(Ir.each(i,(function(e,t){t in s?s[t]+=e:(t in u||(u[t]=0),u[t]+=e)}),this),this._pop_from_people_queue(Wr,i)):n===sn?(Ir.each(i,(function(e,t){Ir.isArray(e)&&(t in d||(d[t]=[]),d[t]=d[t].concat(e))})),this._pop_from_people_queue(Wr,i)):n===nn?(l.push(i),this._pop_from_people_queue(Hr,i)):n===rn&&(p.push(i),this._pop_from_people_queue(Wr,i)),xr.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),xr.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];Ir.isUndefined(n)||Ir.each(t,(function(t,i){e===Hr||e===Gr?Ir.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===$r?Xr:e===zr?Qr:e===Wr?en:e===Vr?tn:e===Hr?rn:e===Gr?nn:e===Kr?sn:void xr.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=Ir.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(un)||{};n[e]=t,this.props[un]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(un)||{})[e];return Ir.isUndefined(t)||(delete this.props[un][e],this.save()),t};var ln,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},pn="mixpanel",hn="base64",fn="$device:",mn=$t.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,gn=!mn&&-1===_r.indexOf("MSIE")&&-1===_r.indexOf("Mozilla"),_n=null;hr.sendBeacon&&(_n=function(){return hr.sendBeacon.apply(hr,arguments)});var yn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},vn={api_host:"https://api-js.mixpanel.com",api_routes:yn,api_method:"POST",api_transport:"XHR",api_payload_format:hn,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:NOOP_FUNC,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:NOOP_FUNC,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:18e5,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:or,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},bn=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===pn?ln:ln[n];if(s&&0===Yr)i=s;else{if(s&&!Ir.isArray(s))return void xr.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=Ir.info.campaignParams(null),c={},u=!1;Ir.each(a,(function(e,t){c["initial_"+t]=e,e&&(u=!0)})),u&&i.people.set_once(c)}return Vt.DEBUG=Vt.DEBUG||i.get_config("debug"),!Ir.isUndefined(s)&&Ir.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(Ir.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==pn){var i=create_mplib(e,t,n);return ln[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||vn.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Ir.extend({},vn,i,t,{name:n,token:e,callback_fn:(n===pn?n:pn+"."+n)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(Ir.localStorage.is_supported(!0)&&mn){if(this.init_batchers(),_n&&$t.addEventListener){var s=Ir.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);$t.addEventListener("pagehide",(function(e){e.persisted&&s()})),$t.addEventListener("visibilitychange",(function(){"hidden"===fr.visibilityState&&s()}))}}else this._batch_requests=!1,xr.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Ir.each(this.get_batcher_configs(),(function(e){xr.log("Clearing batch queue "+e.queue_key),Ir.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Ir.UUID();this.get_distinct_id()||this.register_once({distinct_id:fn+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if($t.MutationObserver){var e=Ir.bind((function(){this._recorder=this._recorder||new $t.__mp_recorder(this),this._recorder.startRecording()}),this);Ir.isUndefined($t.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else xr.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():xr.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=Ir.info.campaignParams(null);Ir.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(fr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Ir.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(fr.referrer)},MixpanelLib.prototype._dom_loaded=function(){Ir.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Ir.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!bn)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=Ir.info.currentUrl()),Ir.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){$t.addEventListener("popstate",(function(){$t.dispatchEvent(new Event("mp_locationchange"))})),$t.addEventListener("hashchange",(function(){$t.dispatchEvent(new Event("mp_locationchange"))}));var n=$t.history.pushState;"function"==typeof n&&($t.history.pushState=function(e,t,i){n.call($t.history,e,t,i),$t.dispatchEvent(new Event("mp_locationchange"))});var i=$t.history.replaceState;"function"==typeof i&&($t.history.replaceState=function(e,t,n){i.call($t.history,e,t,n),$t.dispatchEvent(new Event("mp_locationchange"))}),$t.addEventListener("mp_locationchange",function(){var n=Ir.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(Ir.isUndefined(e))return null;if(mn){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(gn)return this.__request_queue.push(arguments),s;var a={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},c=null;i||!Ir.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=Ir.extend(a,n||{}),mn||(n.method="GET");var u="POST"===n.method,d=_n&&u&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),mn||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),u&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Ir.HTTPBuildQuery(t);var p=this;if("img"in t){var h=fr.createElement("img");h.src=e,fr.body.appendChild(h)}else if(d){try{s=_n(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(mn)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(u&&(m["Content-Type"]="application/x-www-form-urlencoded"),Ir.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var g=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=Ir.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-g>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var _=fr.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var y=fr.getElementsByTagName("script")[0];y.parentNode.insertBefore(_,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];Ir.each(e,(function(e){e&&(t=e[0],Ir.isArray(t)?s.push(e):"function"==typeof e?e.call(this):Ir.isArray(e)&&"alias"===t?n.push(e):Ir.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){Ir.each(e,(function(e){if(Ir.isArray(e[0])){var n=t;Ir.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,this),execute(s,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=Ir.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Ir.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:Ir.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:Ir.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,Ir.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Ir.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var t=Ir.JSONEncode(e);return this.get_config("api_payload_format")===hn&&(t=Ir.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=Ir.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var u=!0,d=Ir.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(xr.log("MIXPANEL REQUEST:"),xr.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):d()})):u=d(),u&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),Ir.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Ir.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!Ir.isUndefined(c)){var u=(new Date).getTime()-c;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?Ir.info.marketingParams():{};t=Ir.extend({},Ir.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");Ir.isArray(l)?Ir.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){Ir.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=Ir.extend({},t||{});return Ir.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=Ir.extend(Ir.info.mpPageViewProperties(),Ir.info.campaignParams(),Ir.info.clickParams()),s=Ir.extend({},i,e);return this.track(n,s)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){Ir.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var wn={persistent:!0},options_for_register=function(e){var t;return t=Ir.isObject(e)?e:Ir.isUndefined(e)?{}:{days:e},Ir.extend({},wn,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):Ir.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),Ir.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,u){var d=this.get_distinct_id();if(e&&d!==e){if("string"==typeof e&&0===e.indexOf(fn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==d&&e!==this.get_property(cn)&&(this.unregister(cn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,u),e!==d&&this.track("$identify",{distinct_id:e,$anon_distinct_id:d},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Ir.UUID();this.register_once({distinct_id:fn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(an))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return Ir.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(cn,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){Ir.isObject(e)&&(Ir.extend(this.config,e),e.batch_size&&Ir.each(this.request_batchers,(function(e){e.resetBatchSize()})),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Vt.DEBUG=Vt.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,ur.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==pn&&(e=pn+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Ir.isBlockedUA(_r)||this._flags.disable_all_events||Ir.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Ir.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!Ir.cookie.get("mp_optout")||(Ir.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=Ir.extend({track:Ir.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),Ir.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=Ir.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Ir.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(hasOptedIn,e)},MixpanelLib.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hasOptedOut,e)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(e){e=Ir.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){xr.error.apply(xr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){xr.error(n)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=yn,MixpanelPersistence.prototype.properties=MixpanelPersistence.prototype.properties,MixpanelPersistence.prototype.update_search_keyword=MixpanelPersistence.prototype.update_search_keyword,MixpanelPersistence.prototype.update_referrer_info=MixpanelPersistence.prototype.update_referrer_info,MixpanelPersistence.prototype.get_cross_subdomain=MixpanelPersistence.prototype.get_cross_subdomain,MixpanelPersistence.prototype.clear=MixpanelPersistence.prototype.clear;var kn={},override_mp_init_func=function(){ln.init=function(e,t,n){if(n)return ln[n]||(ln[n]=kn[n]=create_mplib(e,t,n),ln[n]._loaded()),ln[n];var i=ln;kn[pn]?i=kn[pn]:e&&((i=create_mplib(e,t,pn))._loaded(),kn[pn]=i),ln=i,1===Yr&&($t[pn]=ln),Ir.each(kn,(function(e,t){t!==pn&&(ln[t]=e)})),ln._=Ir}};var Sn=function init_as_module(e){return load_extra_bundle=e,Yr=0,ln=new MixpanelLib,override_mp_init_func(),ln.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,bn=!0,gn=!1,Ir.each(kn,(function(e){e._dom_loaded()})))}if(fr.addEventListener)"complete"===fr.readyState?dom_loaded_handler():fr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(fr.attachEvent){fr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===$t.frameElement}catch(t){}fr.documentElement.doScroll&&e&&function do_scroll_check(){try{fr.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Ir.register_event($t,"load",dom_loaded_handler,!0)}(),ln}((function loadNoop(e,t){t()}));function isReady(){return void 0!==window.mixpanel}const In={init:function init$1(e,t=!1,n){return new Promise((i=>{Sn.init(e,{debug:t,loaded:()=>{window.mixpanel=Sn,i()},...n&&{api_host:n}})}))},isReady:isReady,track:function track(e,t){isReady()&&Sn.track(e,t)},identify:function identify$1(e,t){isReady()&&(Sn.identify(e),Sn.people.set(t))},attachProperty:function attachProperty(e,t){isReady()&&Sn.people.union(e,[t])},getMixpanelDistinctId:()=>Sn&&Sn.get_distinct_id?Sn.get_distinct_id():null},xn=_e.object({firstName:_e.string().optional(),lastName:_e.string().optional(),email:_e.string().email().optional(),phone:_e.string().regex(/^(\+?[1-9]\d{1,14})?$/).optional()}),On=["web","web-mobile","ios","android","app"],En=_e.enum(On).refine((e=>On.includes(e)),{message:`Product must be one of: ${On.join(", ")}`}),Tn=_e.object({product:En});const dateValidation=e=>!(!/^\d{4}-\d{2}-\d{2}$/.test(e)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))||!(!/^\d{4}-\d{2}-\d{2}/.test(e)||isNaN(Date.parse(e))),stringField=e=>_e.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>_e.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>_e.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>_e.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,t,n)=>_e.array(e).min(n,`${t} must have at least ${n} items`),Cn=_e.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:En});const Rn=_e.object({"Passenger Birthdate":dateField("Passenger Birthdate"),"Passenger Seat":stringField("Passenger Seat"),"Passenger Name":stringField("Passenger Name"),"Passenger Document Type":stringField("Document Type"),"Passenger Document Id":stringField("Document ID")}).strict(),Pn=_e.object({"Departure Arrival":dateField("Departure Arrival"),"Departure Destination":stringField("Departure Destination"),"Departure Destination Terminal":stringField("Departure Destination Terminal"),"Departure Line":stringField("Departure Line"),"Departure Origin":stringField("Departure Origin"),"Departure Origin Terminal":stringField("Departure Origin Terminal"),"Departure Price":numberField("Departure Price"),"Departure Route":stringField("Departure Route"),"Departure Stops":intField("Departure Stops"),"Departure Time":dateField("Departure Time"),"Departure Transport Type":stringField("Departure Transport Type"),"Departure Transporter":stringField("Departure Transporter"),"Return Arrival":dateField("Return Arrival").optional(),"Return Destination":stringField("Return Destination").optional(),"Return Destination Terminal":stringField("Return Destination Terminal").optional(),"Return Line":stringField("Return Line").optional(),"Return Origin":stringField("Return Origin").optional(),"Return Origin Terminal":stringField("Return Origin Terminal").optional(),"Return Price":numberField("Return Price").optional(),"Return Route":stringField("Return Route").optional(),"Return Stops":intField("Return Stops").optional(),"Return Time":dateField("Return Time").optional(),"Return Transport Type":stringField("Return Transport Type").optional(),"Return Transporter":stringField("Return Transporter").optional(),"Recommended Trip":_e.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),Mn=_e.object({Trips:arrayField(Pn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:En,Passengers:arrayField(Rn,"Passengers",1).optional()}).strict();const Nn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(Pn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":_e.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:En,Passengers:arrayField(Rn,"Passengers",1).optional(),Insurance:(Dn="Insurance",_e.boolean({required_error:`${Dn} is required`,invalid_type_error:`${Dn} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var Dn;const An=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Price:_e.number().positive("Price must be a positive number"),"Result Position":_e.number().int("Result Position must be an integer"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":_e.string().min(1,"Transport Type is required"),Transporter:_e.string().min(1,"Transporter is required"),product:En,"Recommended Trip":_e.boolean(),"Recommended Trip Type":_e.string().optional(),"Trip Type":_e.string().min(1,"Trip Type is required"),"Bus Type":_e.string().min(1,"Bus Type is required")});const Zn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(Pn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:En,Passengers:arrayField(Rn,"Passengers",1).optional()}).strict();const jn=_e.object({Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":_e.number().int("Departure Delta must be an integer"),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Passengers:_e.number().int("Passenger count must be an integer"),Return:_e.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:_e.string().min(1,"Route is required"),"Trip Length":_e.number().positive().optional(),Categories:_e.array(_e.string()).optional(),product:En});const Ln=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination Terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin Terminal is required"),Price:_e.number().positive("Price must be a positive number"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative().optional(),Tickets:_e.number().int("Tickets must be an integer").positive(),Transporter:_e.string().min(1,"Transporter is required"),Way:_e.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:En});const qn=_e.object({"Bus count":_e.number().int("Bus count must be an integer"),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":_e.number().int("Departure Delta must be an integer").optional(),Destination:_e.string().min(1,"Destination is required").optional(),"Destination Terminal":_e.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":_e.boolean().default(!1).optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Route:_e.string().min(1,"Route is required"),product:En}),Un=_e.object({mixpanelToken:_e.string().min(1,"Mixpanel token is required"),debug:_e.boolean().optional(),identificationKey:_e.string().min(1,"Identification key is required"),isSandbox:_e.boolean().optional(),mixpanelProxyUrl:_e.string().optional(),identifyProxyUrl:_e.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Fn={Search:jn,"Seat Change":Ln,"Interest In Home":Tn,"Passengers Created":Mn,"Payment Attempt":Nn,"Interest In Search":Cn,"View Results":qn,"Purchase Attempt":Zn,"Picked Departure":An};function validateProps(e,t){try{t.parse(e)}catch(Qt){if(Qt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Qt)}}throw{message:"Unknown validation error"}}}const Bn={parseEventProps:function parseEventProps(e,t){const n=Fn[e]||ve;try{n.parse(t)}catch(Qt){if(Qt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Qt)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,Un)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,xn)},validateProps:validateProps},$n=["Search","View Results"],zn={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};async function trackEvent(e,t,n={}){if(!In.isReady())throw new Error("Mixpanel is not initialized.");try{Bn.parseEventProps(e,t);const i=!$n.includes(e),s={"User Fingerprint":await st.getFingerprint(i)},a=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),t={};return Object.entries(zn).forEach((([n,i])=>{const s=e.get(n);s&&(t[i]=s)})),t}catch(Qt){return console.error("Error extracting tracking parameters:",Qt),{}}}(),c=function flattenEventData(e){return Object.entries(e).reduce(((e,[t,n])=>Array.isArray(n)?Array.isArray(n)&&n.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[t]=n,e):(n.forEach((t=>{"object"==typeof t&&null!==t&&Object.entries(t).forEach((([t,n])=>{e[t]?e[t].push(n):e[t]=[n]}))})),e):(e[t]=n,e)),{})}(t),u={...s,...c,...a,...n};In.track(e,u)}catch(Qt){console.error(`Error tracking event '${e}':`,Qt)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Wn,Vn={exports:{}};Wn=Vn,function webpackUniversalModuleDefinition(e,t){Wn.exports=t()}("undefined"!=typeof self&&self,(function(){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=3)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.post(c,t,u)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion,i=t.queryParams,s=t.apiType,c=buildUrl({endpoint:e,apiVersion:n,queryParams:i,apiType:s});return a.get(c,u)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.put(c,t,u)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion;t.queryParams;var i=t.apiType,s=buildUrl({endpoint:e,apiVersion:n,apiType:i});return a.deleteMethod(s,u)},t.poll=function poll(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments[3],a=arguments[4],u=buildUrl({endpoint:e,apiVersion:s,apiType:a}),d=i({url:u,eachCall:t},n);return new c.default(d)};var s=_interopRequireDefault(n(1)),a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),c=_interopRequireDefault(n(9));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var u={apiKey:s.default.apiKey};function serializeQueryParams(e){if(!e)return"";var t=[null,void 0,""].concat(function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])),n=[];return Object.keys(e).forEach((function(i){var s=e[i];t.includes(s)||n.push(i+"="+s)})),n.length?"?"+n.join("&"):""}function buildUrl(e){var t=e.endpoint,n=e.apiVersion,i=void 0===n?s.default.version:n,a=e.queryParams;return"core"===e.apiType?s.default.coreUrl+"/"+s.default.coreVersion+"/"+t+serializeQueryParams(a):(/search|redirect|places/.test(t)?s.default.searchUrl:s.default.purchaseUrl)+"/"+i+"/"+t+serializeQueryParams(a)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.setConfig=function setConfig(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0!==e.env&&(e.searchUrl=i[e.env].search,e.purchaseUrl=i[e.env].purchase,e.coreUrl=i[e.env].core,e.coreVersion=i[e.env].coreVersion),Object.assign(c,e)},t.setUserAuthToken=function setUserAuthToken(e){return Object.assign(c,{userAuthToken:e})};var i={sandbox:{search:"https://search.resertravel.com/api",purchase:"https://purchases.resertravel.com/api",core:""},production:{search:"https://search.reservamos.mx/api",purchase:"https://compras.reservamos.mx/api",core:""}},s="sandbox",a={env:s,headers:{},searchUrl:i[s].search,purchaseUrl:i[s].purchase,coreUrl:i[s].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1},c=t.config=Object.assign({},a);t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"POST",body:JSON.stringify(t)},n)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return fetchJson(e,t,{},n)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"PUT",body:JSON.stringify(t)},n)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetchJson(e,{method:"DELETE"},t)};var s=_interopRequireDefault(n(1)),a=_interopRequireDefault(n(7)),c=_interopRequireDefault(n(8));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function checkStatus(e){var t=e.json();if(e.ok)return t;if(![404,422,500].includes(e.status))throw new a.default(e.status,e.statusText);switch(e.status){case 404:throw new a.default(100,"Not found");case 422:return t;case 500:throw new a.default(101,"Server error");default:throw new a.default}}function handleErrors(e){if(e.errors instanceof Array){var t=e.errors[0]||{},n=t.code,i=void 0===n?-100:n,s=t.message,u=void 0===s?"Unknown error":s,d=(0,c.default)(u)[i];throw d?new a.default(d.code,d.message):new a.default(i,u)}return e}function buildHeaders(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=Object.keys(Object.assign.apply(Object,[{}].concat(t))).reduce((function(e,n){return i({},e,function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},n,t.map((function(e){return n in e&&e[n]})).filter(Boolean)))}),{});return new Headers(s)}function fetchJson(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=s.default.apiKey,c=s.default.withCredentials,u=s.default.userAuthToken,d=s.default.headers,l={Accept:"application/json",Authorization:"Token token="+(n.apiKey||a),"Content-Type":"application/json"};return u&&(l.Authorization="Token "+(n.apiKey||a)+", Bearer "+u),t.headers=buildHeaders(d,l),t.credentials=c?"include":"omit","string"!=typeof t.body&&(t.body=JSON.stringify(t.body)),fetch(e,t).then(checkStatus).then(handleErrors).catch(i)}},function(e,t,n){n(4),n(5),e.exports=n(6)},function(e,t){"function"!=typeof Object.assign&&(Object.assign=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])}return n})},function(e,t){!function(e){if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,a="ArrayBuffer"in e;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isDataView=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};Headers2.prototype.append=function(e,t){e=normalizeName(e),t=normalizeValue(t);var n=this.map[e];this.map[e]=n?n+","+t:t},Headers2.prototype.delete=function(e){delete this.map[normalizeName(e)]},Headers2.prototype.get=function(e){return e=normalizeName(e),this.has(e)?this.map[e]:null},Headers2.prototype.has=function(e){return this.map.hasOwnProperty(normalizeName(e))},Headers2.prototype.set=function(e,t){this.map[normalizeName(e)]=normalizeValue(t)},Headers2.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},Headers2.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),iteratorFor(e)},Headers2.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),iteratorFor(e)},Headers2.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),iteratorFor(e)},n&&(Headers2.prototype[Symbol.iterator]=Headers2.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response2.prototype),Response2.prototype.clone=function(){return new Response2(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers2(this.headers),url:this.url})},Response2.error=function(){var e=new Response2(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];Response2.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new Response2(null,{status:t,headers:{location:e}})},e.Headers=Headers2,e.Request=Request,e.Response=Response2,e.fetch=function(e,t){return new Promise((function(n,s){var a=new Request(e,t),c=new XMLHttpRequest;c.onload=function(){var e,t,i={status:c.status,statusText:c.statusText,headers:(e=c.getAllResponseHeaders()||"",t=new Headers2,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),i=n.shift().trim();if(i){var s=n.join(":").trim();t.append(i,s)}})),t)};i.url="responseURL"in c?c.responseURL:i.headers.get("X-Request-URL");var s="response"in c?c.response:c.responseText;n(new Response2(s,i))},c.onerror=function(){s(new TypeError("Network request failed"))},c.ontimeout=function(){s(new TypeError("Network request failed"))},c.open(a.method,a.url,!0),"include"===a.credentials?c.withCredentials=!0:"omit"===a.credentials&&(c.withCredentials=!1),"responseType"in c&&i&&(c.responseType="blob"),a.headers.forEach((function(e,t){c.setRequestHeader(t,e)})),c.send(void 0===a._bodyInit?null:a._bodyInit)}))},e.fetch.polyfill=!0}function normalizeName(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function normalizeValue(e){return"string"!=typeof e&&(e=String(e)),e}function iteratorFor(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function Headers2(e){this.map={},e instanceof Headers2?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function consumed(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function fileReaderReady(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function readBlobAsArrayBuffer(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsArrayBuffer(e),n}function bufferClone(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(i&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(s&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(a&&i&&isDataView(e))this._bodyArrayBuffer=bufferClone(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!a||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=bufferClone(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return function readBlobAsText(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(e){for(var t=new Uint8Array(e),n=new Array(t.length),i=0;i<t.length;i++)n[i]=String.fromCharCode(t[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}function Request(e,t){var n=(t=t||{}).body;if(e instanceof Request){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Headers2(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new Headers2(t.headers)),this.method=function normalizeMethod(e){var t=e.toUpperCase();return d.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function decode(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),i=n.shift().replace(/\+/g," "),s=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(s))}})),t}function Response2(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new Headers2(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.core=t.adyen=t.exchange=t.priceAlert=t.users=t.quotes=t.redirect=t.utils=t.purchase=t.trip=t.search=t.collections=t.session=t.apiRequest=t.setUserAuthToken=t.setConfig=void 0;var i=n(1),s=_interopRequireWildcard(n(0)),a=_interopRequireWildcard(n(10)),c=_interopRequireWildcard(n(11)),u=_interopRequireWildcard(n(12)),d=_interopRequireWildcard(n(13)),l=_interopRequireWildcard(n(14)),p=_interopRequireWildcard(n(17)),h=_interopRequireWildcard(n(19)),f=_interopRequireWildcard(n(20)),m=_interopRequireWildcard(n(21)),g=_interopRequireWildcard(n(22)),_=_interopRequireWildcard(n(23)),y=_interopRequireWildcard(n(24)),v=_interopRequireWildcard(n(25));function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.setConfig=i.setConfig,t.setUserAuthToken=i.setUserAuthToken,t.apiRequest=s,t.session=a,t.collections=c,t.search=u,t.trip=d,t.purchase=l,t.utils=p,t.redirect=h,t.quotes=f,t.users=m,t.priceAlert=g,t.exchange=_,t.adyen=y,t.core=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function NetworkError2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-100,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unknown error";!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,NetworkError2);var n=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(NetworkError2.__proto__||Object.getPrototypeOf(NetworkError2)).call(this,t));return n.code=e,n.stack=(new Error).stack,n}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(NetworkError2,Error),NetworkError2}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s={1:{code:200,message:"Operación no autorizada"}},a={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},c={10:{code:400,message:"No existe el viaje"},20:{code:60,message:"No se encontró el viaje"},21:{code:60,message:"Tarifa no disponible"},22:{code:60,message:"Tarifa no disponible"}},u={23:{code:60,message:"Estudiante no disponible"},24:{code:60,message:"Profesor no disponible"},25:{code:60,message:"Menor no disponible"},26:{code:60,message:"Capacidades diferentes no disponible"},27:{code:60,message:"INSEN no disponible"},28:{code:60,message:"General no disponible"},29:{code:60,message:"Error desconocido"}},d={50:{code:50,message:"Unknow Error"}},l=t.apiErrors=function apiErrors2(e){return i({},s,a,c,function discountCodeErrors2(e){return{11:{code:500,message:e},12:{code:501,message:e}}}(e),u,d,function exchange2(e){return{30:{code:30,message:e}}}(e))};t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),a=function(){function Poll2(e){var t=e.url,n=e.watch,i=e.expect,s=e.maxRetries,a=void 0===s?30:s,c=e.interval,u=void 0===c?2e3:c,d=e.eachCall,l=void 0===d?null:d;!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Poll2),this.url=t,this.watch=n,this.expect=i instanceof Array?i:[i],this.interval=u,this.maxRetries=a,this.eachCall=l&&l.bind(this),this.aborted=!1,this.timers=[],this.execute=this.execute.bind(this),this.executeEachCall=this.executeEachCall.bind(this)}return i(Poll2,[{key:"start",value:function start(){return this.execute(this.maxRetries)}},{key:"abort",value:function abort(){this.aborted=!0}},{key:"execute",value:function execute(e){var t=this;return s.get(this.url,{},(function onRequestError2(e){return t.executeEachCall("error",e)})).then((function onRequestSuccess2(n){if(t.expect.includes(n[t.watch])||1===e||t.aborted){var i=n[t.watch];1===e?i="retries_exceeded":t.aborted&&(i="aborted"),t.timers.forEach(clearInterval),t.executeEachCall(i,n)}else if("failed"===n[t.watch])t.timers.forEach(clearInterval),t.executeEachCall("failed",n);else{t.executeEachCall("pending",n);var s=window.setTimeout(t.execute,t.interval,e-1);t.timers.push(s)}}))}},{key:"executeEachCall",value:function executeEachCall(e,t){this.eachCall instanceof Function&&this.eachCall({status:e,payload:t})&&this.abort()}}]),Poll2}();t.default=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(){return new Promise((function(e,t){i.get("session",{apiVersion:"v1"}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.agency=function agency(){return new Promise((function(e,t){i.get("get_agency").then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getCountries=function getCountries(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.prefetch,n=void 0===t||t,s=e.q,a={prefetch:n,q:void 0===s?"":s};return new Promise((function(e,t){i.get("countries",{queryParams:a}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.getPlaces=function getPlaces(e,t){var n=e?{q:e,from:t}:{prefetch:!0};return new Promise((function(e,t){i.get("places",{queryParams:n}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.create=function create(e,t){return a.post("search",e).then((function onCreateSuccess2(e){return startPolls(e,t)}))},t.stopSearch=function stopSearch(e){return!!(c&&e&&c[e])&&(c[e].forEach((function(e){return e.abort()})),Reflect.deleteProperty(c,e),!0)},t.stopAllSearches=function stopAllSearches(){return!!c&&(Object.entries(c).forEach((function(e){var t=i(e,2);return t[0],t[1].forEach((function(e){return e.abort()}))})),c={},!0)},t.get=function get(e,t){return new Promise((function(n,i){a.get("search/"+e+"/info").then((function(e){return n(startPolls(e,t))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateExternalCoupon=function validateExternalCoupon(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get("search/discounts/validate_external_coupon/"+e+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.walletSearchDiscount=function walletSearchDiscount(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get(e+"/discounts"+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),c={};function startPolls(e,t){var n=e.search,i=n.id,u=n.type_of_transport,d=u.bus,l=u.flights,p=u.mix,h=t.initBuses,f=void 0===h||h,m=t.initFlights,g=void 0===m||m,_=t.initRides,y=void 0!==_&&_,v=t.initMix,b=void 0===v||v,w=t.onReceiveBuses,S=t.onReceiveFlights,I=t.onReceiveRides,x=t.onReceiveMixed,O=s({watch:"state",expect:"finished"},t.options||{}),T=[];if(d&&d.active&&f){var C=a.poll("search/"+i+"?type=bus",w,O);C.start(),T.push(C)}else w&&w({status:"deactivated"});if(l&&l.active&&g){var R=a.poll("search/"+i+"?type=plane",S,O);R.start(),T.push(R)}else S&&S({status:"deactivated"});if(p&&p.active&&b){var P=a.poll("search/"+i+"?type=mix",x,O);P.start(),T.push(P)}else x&&x({status:"deactivated"});if(y){var N=a.poll("search/"+i+"?type=car",I,O);N.start(),T.push(N)}return c[i]=T,e}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,i){s.get("trips/"+e+"?"+function encodePassengers(e){var t=[];return Object.keys(e).forEach((function(n){var i=e[n];i&&t.push(n+"="+i)})),t.join("&")}(t)).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getWithBus=function getWithBus(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i({with_pricing:!0},t);return new Promise((function(t,c){s.post("trips/"+e+"/details_requests",a).then((function(a){return t(function startPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.options,l=void 0===d?{}:d,p=n.onReceiveTrip,h=i({watch:"state",expect:"finished"},l),f=void 0,m=void 0;return u&&(m=(f=s.poll("trips/"+e+"/details_requests/"+a,p,h)).start()),{payload:t,polls:{trip:m,abort:function abort(){return f.abort()}}}}(e,a,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.startTicketsPoll=void 0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPurchasePoll=startPurchasePoll,t.create=function create(e){return new Promise((function(t,n){s.post(u,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.get=get,t.update=function update(e,t){return new Promise((function(n,i){s.put(u+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createPassengers=function createPassengers(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+p,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.updatePassengers=function updatePassengers(e,t){return new Promise((function(n,i){s.put(u+"/"+e+"/"+h,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.deletePassenger=function deletePassenger(e,t){return new Promise((function(n,i){s.deleteMethod(u+"/"+e+"/"+p+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createTickets=function createTickets(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,a){s.post(u+"/"+e+"/"+f,t).then((function(t){return i((0,c.startTicketsPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknown error":i})}))}))},t.applyDiscountCode=function applyDiscountCode(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+g,{code:t},{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.removeDiscountCode=function removeDiscountCode(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+g+"/"+_,{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.createPayment=function createPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.post(u+"/"+e+"/"+v,t).then((function(t){return i((0,a.startPaymentPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.getPayment=function getPayment(e,t,n){return n?(0,a.startPaymentPoll)(e,{id:t},n):new Promise((function(n,i){s.get(u+"/"+e+"/"+v+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.sendEmail=function sendEmail(e,t){var n={email:t};return new Promise((function(t,i){s.get(u+"/"+e+"/"+m,{queryParams:n}).then((function(){return t()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.confirmPaypalPayment=function confirmPaypalPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.put(u+"/"+e+"/"+v+"/"+t+"/confirm.json").then((function(s){i((0,a.startPaymentPoll)(e,{id:t},n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.updateWallet=function updateWallet(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=u+"/"+e+"/"+d,a=t?i:i+"/"+l;return s.post(a,n).then((function(){return get(e)}))},t.verifyPhoneNumber=function verifyPhoneNumber(e,t,n){return s.put(u+"/"+e+"/"+v+"/"+t+"/send_verification",n)},t.verifySmsCode=function verifySmsCode(e,t,n){return s.post(u+"/"+e+"/"+v+"/"+t+"/verify_code",{code:n})},t.unlockSeats=function unlockSeats(e){return new Promise((function(t,n){s.post(u+"/"+e+"/unlock_seats").then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.generateOTP=function generateOTP(e,t){return new Promise((function(n,i){s.post(e+"/otp-generate",t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateOTP=function validateOTP(e,t){return new Promise((function(n,i){var a={otp:t};s.post(e+"/otp-validate",a).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPayment=function membershipDiscountPayment(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+y,t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPaymentDelete=function membershipDiscountPaymentDelete(e){return new Promise((function(t,n){s.deleteMethod(u+"/"+e+"/"+y).then((function(){return t()})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadTickets=function downloadTickets(e){return new Promise((function(t,n){s.post("tickets/pdf",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadPurchasesHistory=function downloadPurchasesHistory(e){return new Promise((function(t,n){s.post(b,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.increaseExpiration=function increaseExpiration(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+w).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(15),c=n(16),u="purchases",d="wallet_movements",l="cancel",p="passenger_requests",h=p+"/update",f="ticket_requests",m="tickets/resend",g="discounts",_="cancel",y="payment_discounts",v="payments",b="purchase_history/search",w="session-extension";function startPurchasePoll(e,t){var n=t.init,a=void 0===n||n,c=t.onReceivePurchase,u="purchases/"+e,d=i({watch:"state",expect:["completed"]},t.options||{}),l=void 0,p=void 0;return a&&(p=(l=s.poll(u,c,d)).start()),{polls:{payment:p,abort:function abort(){return l.abort()}}}}function get(e,t,n){return n?startPurchasePoll(e,n):new Promise((function(n,i){s.get(u+"/"+e,{queryParams:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))}t.startTicketsPoll=c.startTicketsPoll},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPaymentPoll=function startPaymentPoll(e,t,n){var c=t.id,u=n.init,d=void 0===u||u,l=n.onReceivePayment,p="purchases/"+e+"/payments/"+c,h=i({watch:"purchase_state",expect:["completed","pending"]},n.options||{}),f=void 0,m=void 0;return d&&(f=s.poll(p,function checkPaymentPayload(e){return function(t){var n=t.payload,i=n.using_3d_secure,s=n.needs_verification;return e&&e(t),a(t)||i||s}}(l),h),m=f.start()),{payload:t,polls:{payment:m,abort:function abort(){return f.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=function paymentFailed2(e){var t=e.payload;return["suspicious","failed","rejected"].includes(t.status)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startTicketsPoll=function startTicketsPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.onReceiveTickets,l="purchases/"+e+"/ticket_requests/"+a,p=i({watch:"state",expect:"finished"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{tickets:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=n(18);Object.defineProperty(t,"findSeats",{enumerable:!0,get:function get(){return i.findSeats}})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function findAvailableSeats(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments[3],s=t.length,a=n.length,c=t,u=void 0;if(void 0===i&&(i=e-a),!i)return n;for(var d=0;d<s;d++)if((u=findAvailableAdjecentSeats(i,t[d].filter((function(e){return["seat","seat_tv"].includes(e.category)})),n)).length===i){c=(c=t.slice(d)).concat(t.slice(0,d)),a=(n=n.concat(u)).length;break}return u.length?i=e-a:i-=1,findAvailableSeats(e,c,n,i)}function findAvailableAdjecentSeats(e,t){var n=[],i=!1;if(!function hasAvailableSeats(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.filter((function(e){return!(e.occupied||n.includes(e.number))})).length>=t}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))return n;for(var s=t.length-1;s>=0;s--){var a=t[s];if(a.occupied?n=[]:n.push(a.number),n.length===e){i=!0;break}}return i?n:[]}t.findSeats=function findSeats(e,t){var n=i(t,2),s=n[0],a=n[1],c=findAvailableSeats(e,s),u=[];if(c.length<e&&a){var d=findAvailableSeats(e,a);u=d.length<e?c.concat(d).slice(0,e):d}else u=c;return u.length?u:null}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("redirect",{apiVersion:"v2",queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("quotes",{queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getUser=function getUser(){return s.default.userAuthToken?i.get(c):null},t.getCreditCards=function getCreditCards(){return s.default.userAuthToken?i.get(u):null};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n(1)),a="users",c=a+"/profile.json",u=a+"/list_cards.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.createPriceAlert=function createPriceAlert(e){return i.post(s+".json",e)},t.deletePriceAlert=function deletePriceAlert(e){return i.get(s+"/"+e+"/"+a)};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="price_alerts",a="cancel.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.validate=function validate(e,t,n,c,u,d,l){var p=i({},d&&{email:d},l&&{document:l},{operation_number:e},t&&{nit:t},n&&{origin:n},c&&{destination:c},u&&{recaptcha_token:u});return new Promise((function(e,t){s.post(a+"/validate",p).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.cancelTicket=function cancelTicket(e,t){var n={operation_number:t};return new Promise((function(t,i){s.post("purchases/"+e+"/cancellations",n).then((function(e){return t(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getCancelledTicketStatusPoll=function getCancelledTicketStatusPoll(e,t,n){var a=t,c=n.init,u=void 0===c||c,d=n.onGetCancelStatus,l="purchases/"+e+"/cancellations/"+a,p=i({watch:"status",expect:"success"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{data:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a="exchanges"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.paymentCards=function paymentCards(e){return new Promise((function(t,n){i.post("adyen/payment_cards",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.deleteCard=function deleteCard(e){return new Promise((function(t,n){i.post("adyen/delete_payment_card",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getRecommendedTrips=function getRecommendedTrips(e){var t=e.searchId,n=e.userIdentifier;return new Promise((function(e,s){i.get("trip_recommendations/"+t+"/"+n,{apiType:"core"}).then((function(t){return e(t)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return s({code:n,message:void 0===i?"Unknown error":i})}))}))},t.createTripPriceAlerts=function createTripPriceAlerts(e){return new Promise((function(t,n){i.post(""+s,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.updateTripPriceAlerts=function updateTripPriceAlerts(e,t){return new Promise((function(n,a){i.put(s+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknow error":i})}))}))},t.deleteTripPriceAlerts=function deleteTripPriceAlerts(e){return new Promise((function(t,n){i.deleteMethod(s+"/"+e).then((function(){return t({code:200,message:"Trip Price Alert deleted"})})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.createAnonymousProfile=function createAnonymousProfile2(e){return new Promise((function(t,n){i.post(a,e,{apiType:"core"}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="trip_price_alerts",a="anonymous_profiles/identify"}])}));var Hn=Vn.exports;const Kn=_e.object({email:_e.string().email().optional(),phone:_e.string().optional(),cpf:_e.string().optional(),passport:_e.string().optional(),rg:_e.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{Bn.validateProps(e,Kn);const t=[],n=st.getCachedFingerprint(),i=In.getMixpanelDistinctId();n&&t.push({key:"fingerprint",value:n}),i&&t.push({key:"distinct_id",value:i});const s=function getAnonymousProfilePayload(e,t){let n="phone",i=e.phone||"";const s=[];e.email&&(n="email",i=e.email);const a=["cpf","passport","rg","email","phone","salesforceid"];return Object.entries(e).forEach((([e,t])=>{a.includes(e.toLowerCase())&&t&&e!==n&&s.push({key:e,value:t})})),t.length&&t.forEach((e=>s.push(e))),{identifier_key:n,identifier_value:i,details:{},identifiers:s}}(e,t);return(await Hn.core.createAnonymousProfile(s)).data}catch(Qt){return void console.error("Could not create anonymous profile:",Qt)}}const Gn=["firstName","lastName","email","phone"];const Jn=window.location.origin,Yn={coreAPIConfig:{sandbox:{coreUrl:"https://datalake-api-dev.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:Jn}},prod:{coreUrl:"https://data-lake.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:Jn}}}};const Xn={init:async function init(e){Bn.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i,isSandbox:s=!1,mixpanelProxyUrl:a,identifyProxyUrl:c}=e;await In.init(t,n,a);try{await st.initFingerprint(i,c)}catch(Qt){console.error("Error initializing identification service:",Qt)}const u=Yn.coreAPIConfig[s?"sandbox":"prod"];Hn.setConfig(u),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:function isTrackerReady(){return In.isReady()},identify:async function identify(e,t={}){try{if(!In.isReady())throw console.error("Mixpanel is not initialized."),new Error("Mixpanel is not initialized.");if(Bn.parseIdentifyProps(t),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const n=await createAnonymousProfile(t);n&&(t.reservamos_one_id=n.id);const i=function mapProperties(e){return{$first_name:null==e?void 0:e.firstName,$last_name:null==e?void 0:e.lastName,$email:null==e?void 0:e.email,$phone:null==e?void 0:e.phone,...Object.keys(e).reduce(((t,n)=>(Gn.includes(n)||(t[n]=e[n]),t)),{})}}(t);In.identify(e,i);const s=await st.getFingerprint();s&&In.attachProperty("Known Fingerprints",s)}catch(Qt){console.error("Error identifying user",Qt)}},identifiers:{getFingerprintId:st.getCachedFingerprint,getDistinctId:In.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},track:{search:function trackSearch(e,t={}){trackEvent("Search",e,t)},seatChange:function trackSeatChange(e,t={}){trackEvent("Seat Change",e,t)},interestInHome:function trackInterestInHome(e,t={}){trackEvent("Interest In Home",e,t)},interestInSearch:function trackInterestInSearch(e,t={}){trackEvent("Interest In Search",e,t)},viewResults:function trackViewResults(e,t={}){trackEvent("View Results",e,t)},passengersCreated:function trackPassengersCreated(e,t={}){trackEvent("Passengers Created",e,t)},paymentAttempt:async(e,t={})=>{trackEvent("Payment Attempt",e,t)},purchaseAttempt:function trackPurchaseAttempt(e,t={}){trackEvent("Purchase Attempt",e,t)},pickedDeparture:function trackSearch$1(e,t={}){trackEvent("Picked Departure",e,t)},customEvent:function trackCustomEvent(e,t={},n={}){try{be.parse(e),trackEvent(e,t,n)}catch(Qt){return void console.error("Error trackCustomEvent:",Qt)}},purchaseCanceled:function trackPurchaseCanceled(e,t={}){trackEvent("Purchase Canceled",e,t)}}};module.exports=Xn;
30
+ function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:u,dataURLOptions:d}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),u=yield c.arrayBuffer(),d=encode2(u);return s.set(i,d),d}return""}))}(c,u,d),p=new OffscreenCanvas(c,u);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(d),f=h.type,m=yield h.arrayBuffer(),g=encode2(m);if(!i.has(t)&&(yield l)===g)return i.set(t,g),a.postMessage({id:t});if(i.get(t)===g)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:g,width:c,height:u}),i.set(t,g)}}))}}()}));class CanvasManager{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(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,u=new jt;u.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:Tt["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const d=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<d||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);u.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[u])continue;const a=patch(t.CanvasRenderingContext2D.prototype,u,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:Tt["2D"],property:u,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,u,{set(t){e(this.canvas,{type:Tt["2D"],property:u,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,Tt.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,Tt.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]);return t})),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:St()})}let Lt,qt,Ut,Ft=!1;const Bt=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:u=null,maskTextClass:d="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:g,maskTextFn:_,hooks:y,packFn:v,sampling:b={},dataURLOptions:w={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:x=!1,recordCrossOriginIframes:O=!1,recordAfter:T=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:R=!1,inlineImages:P=!1,plugins:N,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:Z}=e;!function registerErrorHandler(e){Ct=e}(Z);const j=!O||window.parent===window;let L=!1;if(!j)try{window.parent.document&&(L=!1)}catch(G){L=!0}if(j&&!t)throw new Error("emit function is required");void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),Bt.reset();const q=!0===h?{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}:void 0!==f?f:{password:!0},U=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let B;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let $=0;const eventProcessor=e=>{for(const t of N||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!L&&(e=v(e)),e};Lt=(e,s)=>{var a;if(!(null===(a=Rt[0])||void 0===a?void 0:a.isFrozen())||e.type===It.FullSnapshot||e.type===It.IncrementalSnapshot&&e.data.source===xt.Mutation||Rt.forEach((e=>e.unfreeze())),j)null==t||t(eventProcessor(e),s);else if(L){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===It.FullSnapshot)B=e,$=0;else if(e.type===It.IncrementalSnapshot){if(e.data.source===xt.Mutation&&e.data.isAttachIframe)return;$++;const t=i&&$>=i,s=n&&e.timestamp-B.timestamp>n;(t||s)&&qt(!0)}};const wrappedMutationEmit=e=>{Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Mutation},e)}))},wrappedScrollEmit=e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Scroll},e)})),wrappedCanvasMutationEmit=e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.CanvasMutation},e)})),z=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.AdoptedStyleSheet},e)}))}),W=new IframeManager({mirror:Bt,mutationCb:wrappedMutationEmit,stylesheetManager:z,recordCrossOriginIframes:O,wrappedEmit:Lt});for(const J of N||[])J.getMirror&&J.getMirror({nodeMirror:Bt,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const H=new ProcessedNodeManager;Ut=new CanvasManager({recordCanvas:x,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:Bt,sampling:b.canvas,dataURLOptions:w});const K=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:q,dataURLOptions:w,maskTextFn:_,maskInputFn:g,recordCanvas:x,inlineImages:P,sampling:b,slimDOMOptions:U,iframeManager:W,stylesheetManager:z,canvasManager:Ut,keepIframeSrcFn:D,processedNodeManager:H},mirror:Bt});qt=(e=!1)=>{if(!I)return;Lt(wrapEvent({type:It.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),z.reset(),K.init(),Rt.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,inlineImages:d=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:!0===p?{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}:!1===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:g,inlineImages:d,recordCanvas:l,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:Bt,blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:q,maskTextFn:_,slimDOM:U,dataURLOptions:w,recordCanvas:x,inlineImages:P,onSerialize:e=>{isSerializedIframe(e,Bt)&&W.addIframe(e),isSerializedStylesheet(e,Bt)&&z.trackLinkElement(e),hasShadowRoot(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:D});if(!t)return console.warn("Failed to snapshot the document");Lt(wrapEvent({type:It.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),Rt.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,Bt.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.ViewportResize},e)})),inputCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Input},e)})),mediaInteractionCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.MediaInteraction},e)})),styleSheetRuleCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.StyleSheetRule},e)})),styleDeclarationCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Font},e)})),selectionCb:e=>{Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.Selection},e)}))},customElementCb:e=>{Lt(wrapEvent({type:It.IncrementalSnapshot,data:Object.assign({source:xt.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:u,maskTextClass:d,maskTextSelector:l,maskInputOptions:q,inlineStylesheet:p,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:P,userTriggeredOnInput:C,collectFonts:R,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:D,blockSelector:a,slimDOMOptions:U,dataURLOptions:w,mirror:Bt,iframeManager:W,stylesheetManager:z,shadowDomManager:K,processedNodeManager:H,canvasManager:Ut,ignoreCSSAttributes:A,plugins:(null===(t=null==N?void 0:N.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Lt(wrapEvent({type:It.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};W.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(Qt){console.warn(Qt)}}));const init2=()=>{qt(),e.push(observe(document)),Ft=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{Lt(wrapEvent({type:It.DomContentLoaded,data:{}})),"DOMContentLoaded"===T&&init2()}))),e.push(on("load",(()=>{Lt(wrapEvent({type:It.Load,data:{}})),"load"===T&&init2()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Ft=!1,function unregisterErrorHandler(){Ct=void 0}()}}catch(Qt){console.warn(Qt)}}record.addCustomEvent=(e,t)=>{if(!Ft)throw new Error("please add custom event after start recording");Lt(wrapEvent({type:It.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{Rt.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!Ft)throw new Error("please take full snapshot after start recording");qt(e)},record.mirror=Bt;var $t,zt=(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))(zt||{}),Wt=(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))(Wt||{}),Vt={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Ht={hostname:""};$t={navigator:{userAgent:"",onLine:!0},document:{location:Ht,referrer:""},screen:{width:0,height:0},location:Ht}}else $t=window;var Kt,Gt,Jt,Yt,Xt,Qt,er,tr,rr,nr,or=864e5,ir=8e3,sr=Array.prototype,ar=Function.prototype,cr=Object.prototype,ur=sr.slice,dr=cr.toString,lr=cr.hasOwnProperty,pr=$t.console,hr=$t.navigator,fr=$t.document,mr=$t.opera,gr=$t.screen,_r=hr.userAgent,yr=ar.bind,vr=sr.forEach,br=sr.indexOf,wr=sr.map,kr=Array.isArray,Sr={},Ir={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},xr={log:function(){if(Vt.DEBUG&&!Ir.isUndefined(pr)&&pr)try{pr.log.apply(pr,arguments)}catch(e){Ir.each(arguments,(function(e){pr.log(e)}))}},warn:function(){if(Vt.DEBUG&&!Ir.isUndefined(pr)&&pr){var e=["Mixpanel warning:"].concat(Ir.toArray(arguments));try{pr.warn.apply(pr,e)}catch(t){Ir.each(e,(function(e){pr.warn(e)}))}}},error:function(){if(Vt.DEBUG&&!Ir.isUndefined(pr)&&pr){var e=["Mixpanel error:"].concat(Ir.toArray(arguments));try{pr.error.apply(pr,e)}catch(t){Ir.each(e,(function(e){pr.error(e)}))}}},critical:function(){if(!Ir.isUndefined(pr)&&pr){var e=["Mixpanel error:"].concat(Ir.toArray(arguments));try{pr.error.apply(pr,e)}catch(t){Ir.each(e,(function(e){pr.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(xr,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(xr.log,e),error:log_func_with_prefix(xr.error,e),critical:log_func_with_prefix(xr.critical,e)}};Ir.bind=function(e,t){var n,i;if(yr&&e.bind===yr)return yr.apply(e,ur.call(arguments,1));if(!Ir.isFunction(e))throw new TypeError;return n=ur.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(ur.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(ur.call(arguments)));return Object(c)===c?c:a},i},Ir.each=function(e,t,n){if(null!=e)if(vr&&e.forEach===vr)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===Sr)return}else for(var a in e)if(lr.call(e,a)&&t.call(n,e[a],a,e)===Sr)return},Ir.extend=function(e){return Ir.each(ur.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},Ir.isArray=kr||function(e){return"[object Array]"===dr.call(e)},Ir.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Ir.isArguments=function(e){return!(!e||!lr.call(e,"callee"))},Ir.toArray=function(e){return e?e.toArray?e.toArray():Ir.isArray(e)||Ir.isArguments(e)?ur.call(e):Ir.values(e):[]},Ir.map=function(e,t,n){if(wr&&e.map===wr)return e.map(t,n);var i=[];return Ir.each(e,(function(e){i.push(t.call(n,e))})),i},Ir.keys=function(e){var t=[];return null===e||Ir.each(e,(function(e,n){t[t.length]=n})),t},Ir.values=function(e){var t=[];return null===e||Ir.each(e,(function(e){t[t.length]=e})),t},Ir.include=function(e,t){var n=!1;return null===e?n:br&&e.indexOf===br?-1!=e.indexOf(t):(Ir.each(e,(function(e){if(n||(n=e===t))return Sr})),n)},Ir.includes=function(e,t){return-1!==e.indexOf(t)},Ir.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Ir.isObject=function(e){return e===Object(e)&&!Ir.isArray(e)},Ir.isEmptyObject=function(e){if(Ir.isObject(e)){for(var t in e)if(lr.call(e,t))return!1;return!0}return!1},Ir.isUndefined=function(e){return void 0===e},Ir.isString=function(e){return"[object String]"==dr.call(e)},Ir.isDate=function(e){return"[object Date]"==dr.call(e)},Ir.isNumber=function(e){return"[object Number]"==dr.call(e)},Ir.isElement=function(e){return!(!e||1!==e.nodeType)},Ir.encodeDates=function(e){return Ir.each(e,(function(t,n){Ir.isDate(t)?e[n]=Ir.formatDate(t):Ir.isObject(t)&&(e[n]=Ir.encodeDates(t))})),e},Ir.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Ir.formatDate=function(e){function pad(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+pad(e.getUTCMonth()+1)+"-"+pad(e.getUTCDate())+"T"+pad(e.getUTCHours())+":"+pad(e.getUTCMinutes())+":"+pad(e.getUTCSeconds())},Ir.strip_empty_properties=function(e){var t={};return Ir.each(e,(function(e,n){Ir.isString(e)&&e.length>0&&(t[n]=e)})),t},Ir.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):Ir.isArray(e)?(n=[],Ir.each(e,(function(e){n.push(Ir.truncate(e,t))}))):Ir.isObject(e)?(n={},Ir.each(e,(function(e,i){n[i]=Ir.truncate(e,t)}))):n=e,n},Ir.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,u=n,d=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",d=[],"[object Array]"===dr.apply(l)){for(c=l.length,i=0;i<c;i+=1)d[i]=str(i,l)||"null";return a=0===d.length?"[]":n?"[\n"+n+d.join(",\n"+n)+"\n"+u+"]":"["+d.join(",")+"]",n=u,a}for(s in l)lr.call(l,s)&&(a=str(s,l))&&d.push(quote(s)+(n?": ":":")+a);return a=0===d.length?"{}":n?"{"+d.join(",")+u+"}":"{"+d.join(",")+"}",n=u,a}};return str("",{"":e})}}(),Ir.JSONDecode=(Xt={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Qt=function(e){var t=new SyntaxError(e);throw t.at=Kt,t.text=Jt,t},er=function(e){return e&&e!==Gt&&Qt("Expected '"+e+"' instead of '"+Gt+"'"),Gt=Jt.charAt(Kt),Kt+=1,Gt},tr=function(){var e,t="";for("-"===Gt&&(t="-",er("-"));Gt>="0"&&Gt<="9";)t+=Gt,er();if("."===Gt)for(t+=".";er()&&Gt>="0"&&Gt<="9";)t+=Gt;if("e"===Gt||"E"===Gt)for(t+=Gt,er(),"-"!==Gt&&"+"!==Gt||(t+=Gt,er());Gt>="0"&&Gt<="9";)t+=Gt,er();if(e=+t,isFinite(e))return e;Qt("Bad number")},rr=function(){var e,t,n,i="";if('"'===Gt)for(;er();){if('"'===Gt)return er(),i;if("\\"===Gt)if(er(),"u"===Gt){for(n=0,t=0;t<4&&(e=parseInt(er(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Xt[Gt])break;i+=Xt[Gt]}else i+=Gt}Qt("Bad string")},nr=function(){for(;Gt&&Gt<=" ";)er()},Yt=function(){switch(nr(),Gt){case"{":return function(){var e,t={};if("{"===Gt){if(er("{"),nr(),"}"===Gt)return er("}"),t;for(;Gt;){if(e=rr(),nr(),er(":"),Object.hasOwnProperty.call(t,e)&&Qt('Duplicate key "'+e+'"'),t[e]=Yt(),nr(),"}"===Gt)return er("}"),t;er(","),nr()}}Qt("Bad object")}();case"[":return function(){var e=[];if("["===Gt){if(er("["),nr(),"]"===Gt)return er("]"),e;for(;Gt;){if(e.push(Yt()),nr(),"]"===Gt)return er("]"),e;er(","),nr()}}Qt("Bad array")}();case'"':return rr();case"-":return tr();default:return Gt>="0"&&Gt<="9"?tr():function(){switch(Gt){case"t":return er("t"),er("r"),er("u"),er("e"),!0;case"f":return er("f"),er("a"),er("l"),er("s"),er("e"),!1;case"n":return er("n"),er("u"),er("l"),er("l"),null}Qt('Unexpected "'+Gt+'"')}()}},function(e){var t;return Jt=e,Kt=0,Gt=" ",t=Yt(),nr(),Gt&&Qt("Syntax error"),t}),Ir.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,d=0,l="",p=[];if(!e)return e;e=Ir.utf8Encode(e);do{t=(a=e.charCodeAt(u++)<<16|e.charCodeAt(u++)<<8|e.charCodeAt(u++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[d++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(u<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},Ir.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),u=null;c<128?n++:u=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==u&&(n>t&&(a+=e.substring(t,n)),a+=u,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Ir.UUID=function(){var T2=function(){var e,t=1*new Date;if($t.performance&&$t.performance.now)e=$t.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(gr.height*gr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=_r,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var Or=["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"];Ir.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Or.length;t++)if(-1!==e.indexOf(Or[t]))return!0;return!1},Ir.HTTPBuildQuery=function(e,t){var n,i,s=[];return Ir.isUndefined(t)&&(t="&"),Ir.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},Ir.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){xr.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},Ir.cookie={get:function(e){for(var t=e+"=",n=fr.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=Ir.JSONDecode(Ir.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(fr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),fr.cookie=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l},set:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(fr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l;return fr.cookie=f,f},remove:function(e,t,n){Ir.cookie.set(e,"",-1,t,!1,!1,n)}};var Er=null,localStorageSupported=function(e,t){if(null!==Er&&!t)return Er;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Er=n,n};Ir.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||xr.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){xr.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){Ir.localStorage.error(t)}return null},parse:function(e){try{return Ir.JSONDecode(Ir.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){Ir.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){Ir.localStorage.error(t)}}},Ir.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return Ir.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else xr.error("No valid element provided to register_event")}}();var Tr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Ir.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!fr.getElementsByTagName)return[];var t,n,i,s,a,c,u,d,l,p,h=e.split(" "),f=[fr];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],g=fr.getElementById(m);if(!g||i&&g.nodeName.toLowerCase()!=i)return[];f=[g]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var _=n[1];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];for(f=[],p=0,u=0;u<s.length;u++)s[u].className&&Ir.isString(s[u].className)&&hasClass(s[u],_)&&(f[p++]=s[u])}else{var y=t.match(Tr);if(y){i=y[1];var v,b=y[2],w=y[3],S=y[4];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];switch(f=[],p=0,w){case"=":v=function(e){return e.getAttribute(b)==S};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+S+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+S+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(S)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(S)==e.getAttribute(b).length-S.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(S)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,u=0;u<s.length;u++)v(s[u])&&(f[p++]=s[u])}else{for(i=t,s=[],a=0,u=0;u<f.length;u++)for(l=f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];f=s}}return f}return function(e){return Ir.isElement(e)?[e]:Ir.isObject(e)&&!Ir.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Cr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Rr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Ir.info={campaignParams:function(e){var t="",n={};return Ir.each(Cr,(function(i){(t=Ir.getQueryParam(fr.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return Ir.each(Rr,(function(n){(e=Ir.getQueryParam(fr.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return Ir.extend(Ir.info.campaignParams(),Ir.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var t=Ir.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=Ir.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||Ir.includes(e," OPR/")?Ir.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Ir.includes(e,"IEMobile")||Ir.includes(e,"WPDesktop")?"Internet Explorer Mobile":Ir.includes(e,"SamsungBrowser/")?"Samsung Internet":Ir.includes(e,"Edge")||Ir.includes(e,"Edg/")?"Microsoft Edge":Ir.includes(e,"FBIOS")?"Facebook Mobile":Ir.includes(e,"Chrome")?"Chrome":Ir.includes(e,"CriOS")?"Chrome iOS":Ir.includes(e,"UCWEB")||Ir.includes(e,"UCBrowser")?"UC Browser":Ir.includes(e,"FxiOS")?"Firefox iOS":Ir.includes(t,"Apple")?Ir.includes(e,"Mobile")?"Mobile Safari":"Safari":Ir.includes(e,"Android")?"Android Mobile":Ir.includes(e,"Konqueror")?"Konqueror":Ir.includes(e,"Firefox")?"Firefox":Ir.includes(e,"MSIE")||Ir.includes(e,"Trident/")?"Internet Explorer":Ir.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var 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+)?)/}[Ir.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=_r;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 $t.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Ir.extend(Ir.strip_empty_properties({$os:Ir.info.os(),$browser:Ir.info.browser(_r,hr.vendor,mr),$referrer:fr.referrer,$referring_domain:Ir.info.referringDomain(fr.referrer),$device:Ir.info.device(_r)}),{$current_url:Ir.info.currentUrl(),$browser_version:Ir.info.browserVersion(_r,hr.vendor,mr),$screen_height:gr.height,$screen_width:gr.width,mp_lib:"web",$lib_version:Vt.LIB_VERSION,$insert_id:cheap_guid(),time:Ir.timestamp()/1e3},Ir.strip_empty_properties(e))},people_properties:function(){return Ir.extend(Ir.strip_empty_properties({$os:Ir.info.os(),$browser:Ir.info.browser(_r,hr.vendor,mr)}),{$browser_version:Ir.info.browserVersion(_r,hr.vendor,mr)})},mpPageViewProperties:function(){return Ir.strip_empty_properties({current_page_title:fr.title,current_domain:$t.location.hostname,current_url_path:$t.location.pathname,current_url_protocol:$t.location.protocol,current_url_search:$t.location.search})}};var cheap_guid=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},Pr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Mr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=Mr,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Pr);var s=e.match(t);return s?s[0]:""},Nr=null,Dr=null;"undefined"!=typeof JSON&&(Nr=JSON.stringify,Dr=JSON.parse),Nr=Nr||Ir.JSONEncode,Dr=Dr||Ir.JSONDecode,Ir.toArray=Ir.toArray,Ir.isObject=Ir.isObject,Ir.JSONEncode=Ir.JSONEncode,Ir.JSONDecode=Ir.JSONDecode,Ir.isBlockedUA=Ir.isBlockedUA,Ir.isEmptyObject=Ir.isEmptyObject,Ir.info=Ir.info,Ir.info.device=Ir.info.device,Ir.info.browser=Ir.info.browser,Ir.info.browserVersion=Ir.info.browserVersion,Ir.info.properties=Ir.info.properties;var Ar="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||$t,n=t.navigator||{},i=!1;return Ir.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Ir.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return xr.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 n="0"===_getStorageValue(e,t);return n&&xr.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?Ir.localStorage:Ir.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Ar)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){Ir.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,Ir.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):xr.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:u}))}catch(l){xr.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var d=arguments[arguments.length-1];"function"==typeof d&&d(0)}}var Zr=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,u=this.timeoutMS,d=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>u)return Zr.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),d.removeItem(h),d.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=d.getItem(p);if(e&&e!==i)return!1;if(d.setItem(p,i),d.getItem(p)===i)return!0;if(!localStorageSupported(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){d.setItem(l,i),waitFor(getSetY,(function(){d.getItem(l)!==i?delay((function(){d.getItem(p)===i?waitFor((function(){return!d.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){d.setItem(h,"1");try{e()}finally{d.removeItem(h),d.getItem(p)===i&&d.removeItem(p),d.getItem(l)===i&&d.removeItem(l)}};try{if(!localStorageSupported(d,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var jr=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||Ir.bind(jr.error,jr),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(Ir.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),Ir.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};Ir.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return Ir.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(Ir.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=Ir.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),Ir.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return Ir.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(Ir.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),Ir.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=Dr(e),Ir.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Nr(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Ir.bind(this.reportError,this),storage:t.storage,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};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(Ir.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void Lr.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],u={};if(Ir.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Ir.extend({},t.properties,{mp_sent_by_lib_version:Vt.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}u[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var d=Ir.bind((function(c){this.requestInProgress=!1;try{var d=!1;if(e.unloading)this.queue.updatePayloads(u);else if(Ir.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(Ir.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=$t.navigator.onLine,!Ir.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(Ir.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),d=!0;else d=!0;d&&(this.queue.removeItemsByID(Ir.map(s,(function(e){return e.id})),Ir.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!a?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),Ir.each(s,Ir.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),Lr.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(Lr.error.apply(Lr.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Lr.error(n)}};var qr=console_with_prefix("recorder"),Ur=$t.CompressionStream,Fr={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},Br=new Set([Wt.MouseMove,Wt.MouseInteraction,Wt.Scroll,Wt.ViewportResize,Wt.Input,Wt.TouchMove,Wt.MediaInteraction,Wt.Drag,Wt.Selection]);var MixpanelRecorder=function(e){this._mixpanel=e,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=or,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Fr,sendRequestFunc:Ir.bind(this.flushEventsWithOptOut,this),errorReporter:Ir.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(e){return this._mixpanel.get_config(e)},MixpanelRecorder.prototype.startRecording=function(e){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>or&&(this.recordMaxMs=or,qr.critical("record_max_ms cannot be greater than "+or+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>ir&&(this.recordMinMs=ir,qr.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Ir.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=Ir.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Ir.bind((function(){qr.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:Ir.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===zt.IncrementalSnapshot&&Br.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),t(),this.maxTimeoutId=setTimeout(Ir.bind(this.resetRecording,this),this.recordMaxMs)}else qr.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,t,n){this._flushEvents(e,t,n,Ir.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=Ir.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);$t.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,u={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},d=Ir.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(u.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(u.$user_id=p),Ur){var h=new Blob([d],{type:"application/json"}).stream().pipeThrough(new Ur("gzip"));new Response(h).blob().then(Ir.bind((function(e){u.format="gzip",this._sendRequest(s,u,e,n)}),this))}else u.format="body",this._sendRequest(s,u,d,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){qr.error.apply(qr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){qr.error(n)}},$t.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,t,n,i){var s=this,a=Ir.dom_query(e);if(0!==a.length)return Ir.each(a,(function(e){Ir.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),u=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),u),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;xr.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):Ir.extend({},e)};var LinkTracker=function(){this.override_event="click"};Ir.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};Ir.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var $r="$set",zr="$set_once",Wr="$unset",Vr="$add",Hr="$append",Kr="$union",Gr="$remove",Jr={set_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[$r]=i,n},unset_action:function(e){var t={},n=[];return Ir.isArray(e)||(e=[e]),Ir.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[Wr]=n,t},set_once_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[zr]=i,n},union_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=Ir.isArray(e)?e:[e])}),this):i[e]=Ir.isArray(t)?t:[t],n[Kr]=i,n},append_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Hr]=i,n},remove_action:function(e,t){var n={},i={};return Ir.isObject(e)?Ir.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Gr]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Ir.extend(MixpanelGroup.prototype,Jr),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return Ir.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return Ir.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=Ir.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};Ir.extend(MixpanelPeople.prototype,Jr),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return Ir.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[$r]=Ir.extend({},Ir.info.people_properties(),i[$r]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return Ir.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return Ir.isObject(e)?(Ir.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void xr.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(Ir.isUndefined(t)&&(t=1),s[e]=t),i[Vr]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){Ir.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(Ir.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Ir.extend({$amount:e},t),n);xr.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}xr.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=Ir.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:a,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),Ir.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Ir.truncate(a,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){$r in e?this._mixpanel.persistence._add_to_people_queue($r,e):zr in e?this._mixpanel.persistence._add_to_people_queue(zr,e):Wr in e?this._mixpanel.persistence._add_to_people_queue(Wr,e):Vr in e?this._mixpanel.persistence._add_to_people_queue(Vr,e):Hr in e?this._mixpanel.persistence._add_to_people_queue(Hr,e):Gr in e?this._mixpanel.persistence._add_to_people_queue(Gr,e):Kr in e?this._mixpanel.persistence._add_to_people_queue(Kr,e):xr.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=Ir.extend({},this._mixpanel.persistence.load_queue(e)),c=a;Ir.isUndefined(a)||!Ir.isObject(a)||Ir.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),Ir.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var u=this;this._flush_one_queue($r,this.set,e),this._flush_one_queue(zr,this.set_once,i),this._flush_one_queue(Wr,this.unset,a,(function(e){return Ir.keys(e)})),this._flush_one_queue(Vr,this.increment,t),this._flush_one_queue(Kr,this.union,s);var d=this._mixpanel.persistence.load_queue(Hr);if(!Ir.isUndefined(d)&&Ir.isArray(d)&&d.length)for(var l,append_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(Hr,l),Ir.isUndefined(n)||n(e,t)},p=d.length-1;p>=0;p--)d=this._mixpanel.persistence.load_queue(Hr),l=d.pop(),u._mixpanel.persistence.save(),Ir.isEmptyObject(l)||u.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(Gr);if(!Ir.isUndefined(h)&&Ir.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(Gr,f),Ir.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(Gr),f=h.pop(),u._mixpanel.persistence.save(),Ir.isEmptyObject(f)||u.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var Yr,Xr="__mps",Qr="__mpso",en="__mpus",tn="__mpa",rn="__mpap",nn="__mpr",sn="__mpu",an="$people_distinct_id",cn="__alias",un="__timers",dn=[Xr,Qr,en,tn,rn,nn,sn,an,cn,un],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(xr.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Ir.localStorage.is_supported()?this.storage=Ir.localStorage:this.storage=Ir.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Ir.each(this.props,(function(t,n){Ir.include(dn,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Ir.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===Ir.localStorage?(e=Ir.cookie.parse(this.name),Ir.cookie.remove(this.name),Ir.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Ir.cookie&&(t=Ir.localStorage.parse(this.name),Ir.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Ir.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,t,n){return!!Ir.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),Ir.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!Ir.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Ir.extend(this.props,e),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(e){this.register(Ir.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Ir.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Ir.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue($r),a=this._get_or_create_queue(zr),c=this._get_or_create_queue(Wr),u=this._get_or_create_queue(Vr),d=this._get_or_create_queue(Kr),l=this._get_or_create_queue(Gr,[]),p=this._get_or_create_queue(Hr,[]);n===Xr?(Ir.extend(s,i),this._pop_from_people_queue(Vr,i),this._pop_from_people_queue(Kr,i),this._pop_from_people_queue(Wr,i)):n===Qr?(Ir.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(Wr,i)):n===en?Ir.each(i,(function(e){Ir.each([s,a,u,d],(function(t){e in t&&delete t[e]})),Ir.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===tn?(Ir.each(i,(function(e,t){t in s?s[t]+=e:(t in u||(u[t]=0),u[t]+=e)}),this),this._pop_from_people_queue(Wr,i)):n===sn?(Ir.each(i,(function(e,t){Ir.isArray(e)&&(t in d||(d[t]=[]),d[t]=d[t].concat(e))})),this._pop_from_people_queue(Wr,i)):n===nn?(l.push(i),this._pop_from_people_queue(Hr,i)):n===rn&&(p.push(i),this._pop_from_people_queue(Wr,i)),xr.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),xr.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];Ir.isUndefined(n)||Ir.each(t,(function(t,i){e===Hr||e===Gr?Ir.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===$r?Xr:e===zr?Qr:e===Wr?en:e===Vr?tn:e===Hr?rn:e===Gr?nn:e===Kr?sn:void xr.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=Ir.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(un)||{};n[e]=t,this.props[un]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(un)||{})[e];return Ir.isUndefined(t)||(delete this.props[un][e],this.save()),t};var ln,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},pn="mixpanel",hn="base64",fn="$device:",mn=$t.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,gn=!mn&&-1===_r.indexOf("MSIE")&&-1===_r.indexOf("Mozilla"),_n=null;hr.sendBeacon&&(_n=function(){return hr.sendBeacon.apply(hr,arguments)});var yn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},vn={api_host:"https://api-js.mixpanel.com",api_routes:yn,api_method:"POST",api_transport:"XHR",api_payload_format:hn,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:NOOP_FUNC,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:NOOP_FUNC,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:18e5,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:or,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},bn=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===pn?ln:ln[n];if(s&&0===Yr)i=s;else{if(s&&!Ir.isArray(s))return void xr.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=Ir.info.campaignParams(null),c={},u=!1;Ir.each(a,(function(e,t){c["initial_"+t]=e,e&&(u=!0)})),u&&i.people.set_once(c)}return Vt.DEBUG=Vt.DEBUG||i.get_config("debug"),!Ir.isUndefined(s)&&Ir.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(Ir.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==pn){var i=create_mplib(e,t,n);return ln[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||vn.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Ir.extend({},vn,i,t,{name:n,token:e,callback_fn:(n===pn?n:pn+"."+n)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(Ir.localStorage.is_supported(!0)&&mn){if(this.init_batchers(),_n&&$t.addEventListener){var s=Ir.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);$t.addEventListener("pagehide",(function(e){e.persisted&&s()})),$t.addEventListener("visibilitychange",(function(){"hidden"===fr.visibilityState&&s()}))}}else this._batch_requests=!1,xr.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Ir.each(this.get_batcher_configs(),(function(e){xr.log("Clearing batch queue "+e.queue_key),Ir.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Ir.UUID();this.get_distinct_id()||this.register_once({distinct_id:fn+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if($t.MutationObserver){var e=Ir.bind((function(){this._recorder=this._recorder||new $t.__mp_recorder(this),this._recorder.startRecording()}),this);Ir.isUndefined($t.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else xr.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():xr.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=Ir.info.campaignParams(null);Ir.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(fr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Ir.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(fr.referrer)},MixpanelLib.prototype._dom_loaded=function(){Ir.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Ir.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!bn)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=Ir.info.currentUrl()),Ir.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){$t.addEventListener("popstate",(function(){$t.dispatchEvent(new Event("mp_locationchange"))})),$t.addEventListener("hashchange",(function(){$t.dispatchEvent(new Event("mp_locationchange"))}));var n=$t.history.pushState;"function"==typeof n&&($t.history.pushState=function(e,t,i){n.call($t.history,e,t,i),$t.dispatchEvent(new Event("mp_locationchange"))});var i=$t.history.replaceState;"function"==typeof i&&($t.history.replaceState=function(e,t,n){i.call($t.history,e,t,n),$t.dispatchEvent(new Event("mp_locationchange"))}),$t.addEventListener("mp_locationchange",function(){var n=Ir.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(Ir.isUndefined(e))return null;if(mn){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(gn)return this.__request_queue.push(arguments),s;var a={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},c=null;i||!Ir.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=Ir.extend(a,n||{}),mn||(n.method="GET");var u="POST"===n.method,d=_n&&u&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),mn||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),u&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Ir.HTTPBuildQuery(t);var p=this;if("img"in t){var h=fr.createElement("img");h.src=e,fr.body.appendChild(h)}else if(d){try{s=_n(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(mn)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(u&&(m["Content-Type"]="application/x-www-form-urlencoded"),Ir.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var g=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=Ir.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-g>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var _=fr.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var y=fr.getElementsByTagName("script")[0];y.parentNode.insertBefore(_,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];Ir.each(e,(function(e){e&&(t=e[0],Ir.isArray(t)?s.push(e):"function"==typeof e?e.call(this):Ir.isArray(e)&&"alias"===t?n.push(e):Ir.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){Ir.each(e,(function(e){if(Ir.isArray(e[0])){var n=t;Ir.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,this),execute(s,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=Ir.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Ir.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:Ir.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:Ir.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,Ir.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Ir.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var t=Ir.JSONEncode(e);return this.get_config("api_payload_format")===hn&&(t=Ir.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=Ir.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var u=!0,d=Ir.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(xr.log("MIXPANEL REQUEST:"),xr.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):d()})):u=d(),u&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),Ir.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Ir.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!Ir.isUndefined(c)){var u=(new Date).getTime()-c;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?Ir.info.marketingParams():{};t=Ir.extend({},Ir.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");Ir.isArray(l)?Ir.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){Ir.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=Ir.extend({},t||{});return Ir.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=Ir.extend(Ir.info.mpPageViewProperties(),Ir.info.campaignParams(),Ir.info.clickParams()),s=Ir.extend({},i,e);return this.track(n,s)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){Ir.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var wn={persistent:!0},options_for_register=function(e){var t;return t=Ir.isObject(e)?e:Ir.isUndefined(e)?{}:{days:e},Ir.extend({},wn,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):Ir.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),Ir.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,u){var d=this.get_distinct_id();if(e&&d!==e){if("string"==typeof e&&0===e.indexOf(fn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==d&&e!==this.get_property(cn)&&(this.unregister(cn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,u),e!==d&&this.track("$identify",{distinct_id:e,$anon_distinct_id:d},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Ir.UUID();this.register_once({distinct_id:fn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(an))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return Ir.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(cn,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){Ir.isObject(e)&&(Ir.extend(this.config,e),e.batch_size&&Ir.each(this.request_batchers,(function(e){e.resetBatchSize()})),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Vt.DEBUG=Vt.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,ur.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==pn&&(e=pn+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Ir.isBlockedUA(_r)||this._flags.disable_all_events||Ir.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Ir.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!Ir.cookie.get("mp_optout")||(Ir.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=Ir.extend({track:Ir.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),Ir.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=Ir.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Ir.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(hasOptedIn,e)},MixpanelLib.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hasOptedOut,e)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(e){e=Ir.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){xr.error.apply(xr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){xr.error(n)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=yn,MixpanelPersistence.prototype.properties=MixpanelPersistence.prototype.properties,MixpanelPersistence.prototype.update_search_keyword=MixpanelPersistence.prototype.update_search_keyword,MixpanelPersistence.prototype.update_referrer_info=MixpanelPersistence.prototype.update_referrer_info,MixpanelPersistence.prototype.get_cross_subdomain=MixpanelPersistence.prototype.get_cross_subdomain,MixpanelPersistence.prototype.clear=MixpanelPersistence.prototype.clear;var kn={},override_mp_init_func=function(){ln.init=function(e,t,n){if(n)return ln[n]||(ln[n]=kn[n]=create_mplib(e,t,n),ln[n]._loaded()),ln[n];var i=ln;kn[pn]?i=kn[pn]:e&&((i=create_mplib(e,t,pn))._loaded(),kn[pn]=i),ln=i,1===Yr&&($t[pn]=ln),Ir.each(kn,(function(e,t){t!==pn&&(ln[t]=e)})),ln._=Ir}};var Sn=function init_as_module(e){return load_extra_bundle=e,Yr=0,ln=new MixpanelLib,override_mp_init_func(),ln.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,bn=!0,gn=!1,Ir.each(kn,(function(e){e._dom_loaded()})))}if(fr.addEventListener)"complete"===fr.readyState?dom_loaded_handler():fr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(fr.attachEvent){fr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===$t.frameElement}catch(t){}fr.documentElement.doScroll&&e&&function do_scroll_check(){try{fr.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Ir.register_event($t,"load",dom_loaded_handler,!0)}(),ln}((function loadNoop(e,t){t()}));function isReady(){return void 0!==window.mixpanel}const In={init:function init$1(e,t=!1,n){return new Promise((i=>{Sn.init(e,{debug:t,loaded:()=>{window.mixpanel=Sn,i()},...n&&{api_host:n}})}))},isReady:isReady,track:function track(e,t){isReady()&&Sn.track(e,t)},identify:function identify$1(e,t){isReady()&&(Sn.identify(e),Sn.people.set(t))},attachProperty:function attachProperty(e,t){isReady()&&Sn.people.union(e,[t])},getMixpanelDistinctId:()=>Sn&&Sn.get_distinct_id?Sn.get_distinct_id():null},xn=_e.object({firstName:_e.string().optional(),lastName:_e.string().optional(),email:_e.string().email().optional(),phone:_e.string().regex(/^(\+?[1-9]\d{1,14})?$/).optional()}),On=["web","web-mobile","ios","android","app"],En=_e.enum(On).refine((e=>On.includes(e)),{message:`Product must be one of: ${On.join(", ")}`}),Tn=_e.object({product:En});const dateValidation=e=>!(!/^\d{4}-\d{2}-\d{2}$/.test(e)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))||!(!/^\d{4}-\d{2}-\d{2}/.test(e)||isNaN(Date.parse(e))),stringField=e=>_e.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>_e.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>_e.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>_e.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,t,n)=>_e.array(e).min(n,`${t} must have at least ${n} items`),Cn=_e.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:En});const Rn=_e.object({"Passenger Birthdate":dateField("Passenger Birthdate"),"Passenger Seat":stringField("Passenger Seat"),"Passenger Name":stringField("Passenger Name"),"Passenger Document Type":stringField("Document Type"),"Passenger Document Id":stringField("Document ID")}).strict(),Pn=_e.object({"Departure Arrival":dateField("Departure Arrival"),"Departure Destination":stringField("Departure Destination"),"Departure Destination Terminal":stringField("Departure Destination Terminal"),"Departure Line":stringField("Departure Line"),"Departure Origin":stringField("Departure Origin"),"Departure Origin Terminal":stringField("Departure Origin Terminal"),"Departure Price":numberField("Departure Price"),"Departure Route":stringField("Departure Route"),"Departure Stops":intField("Departure Stops"),"Departure Time":dateField("Departure Time"),"Departure Transport Type":stringField("Departure Transport Type"),"Departure Transporter":stringField("Departure Transporter"),"Return Arrival":dateField("Return Arrival").optional(),"Return Destination":stringField("Return Destination").optional(),"Return Destination Terminal":stringField("Return Destination Terminal").optional(),"Return Line":stringField("Return Line").optional(),"Return Origin":stringField("Return Origin").optional(),"Return Origin Terminal":stringField("Return Origin Terminal").optional(),"Return Price":numberField("Return Price").optional(),"Return Route":stringField("Return Route").optional(),"Return Stops":intField("Return Stops").optional(),"Return Time":dateField("Return Time").optional(),"Return Transport Type":stringField("Return Transport Type").optional(),"Return Transporter":stringField("Return Transporter").optional(),"Recommended Trip":_e.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),Mn=_e.object({Trips:arrayField(Pn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:En,Passengers:arrayField(Rn,"Passengers",1).optional()}).strict();const Nn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(Pn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":_e.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:En,Passengers:arrayField(Rn,"Passengers",1).optional(),Insurance:(Dn="Insurance",_e.boolean({required_error:`${Dn} is required`,invalid_type_error:`${Dn} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var Dn;const An=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Price:_e.number().positive("Price must be a positive number"),"Result Position":_e.number().int("Result Position must be an integer"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":_e.string().min(1,"Transport Type is required"),Transporter:_e.string().min(1,"Transporter is required"),product:En,"Recommended Trip":_e.boolean(),"Recommended Trip Type":_e.string().optional(),"Trip Type":_e.string().min(1,"Trip Type is required"),"Bus Type":_e.string().min(1,"Bus Type is required")});const Zn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(Pn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:En,Passengers:arrayField(Rn,"Passengers",1).optional()}).strict();const jn=_e.object({Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":_e.number().int("Departure Delta must be an integer"),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Passengers:_e.number().int("Passenger count must be an integer"),Return:_e.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:_e.string().min(1,"Route is required"),"Trip Length":_e.number().positive().optional(),Categories:_e.array(_e.string()).optional(),product:En});const Ln=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination Terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin Terminal is required"),Price:_e.number().positive("Price must be a positive number"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative().optional(),Tickets:_e.number().int("Tickets must be an integer").positive(),Transporter:_e.string().min(1,"Transporter is required"),Way:_e.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:En});const qn=_e.object({"Bus count":_e.number().int("Bus count must be an integer"),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":_e.number().int("Departure Delta must be an integer").optional(),Destination:_e.string().min(1,"Destination is required").optional(),"Destination Terminal":_e.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":_e.boolean().default(!1).optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Route:_e.string().min(1,"Route is required"),product:En}),Un=_e.object({mixpanelToken:_e.string().min(1,"Mixpanel token is required"),debug:_e.boolean().optional(),identificationKey:_e.string().min(1,"Identification key is required"),isSandbox:_e.boolean().optional(),mixpanelProxyUrl:_e.string().optional(),identifyProxyUrl:_e.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Fn={Search:jn,"Seat Change":Ln,"Interest In Home":Tn,"Passengers Created":Mn,"Payment Attempt":Nn,"Interest In Search":Cn,"View Results":qn,"Purchase Attempt":Zn,"Picked Departure":An};function validateProps(e,t){try{t.parse(e)}catch(Qt){if(Qt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Qt)}}throw{message:"Unknown validation error"}}}const Bn={parseEventProps:function parseEventProps(e,t){const n=Fn[e]||ve;try{n.parse(t)}catch(Qt){if(Qt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Qt)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,Un)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,xn)},validateProps:validateProps},$n=["Search","View Results"],zn={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,t){try{In.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==t?void 0:t.message)??"Failed to track event","Validation Errors":(null==t?void 0:t.errors)||[]})}catch(n){console.error("Failed to track error event:",n)}}async function trackEvent(e,t,n={}){if(!In.isReady())throw new Error("Mixpanel is not initialized.");try{Bn.parseEventProps(e,t);const i=!$n.includes(e),s={"User Fingerprint":await st.getFingerprint(i)},a=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),t={};return Object.entries(zn).forEach((([n,i])=>{const s=e.get(n);s&&(t[i]=s)})),t}catch(Qt){return console.error("Error extracting tracking parameters:",Qt),{}}}(),c=function flattenEventData(e){return Object.entries(e).reduce(((e,[t,n])=>Array.isArray(n)?Array.isArray(n)&&n.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[t]=n,e):(n.forEach((t=>{"object"==typeof t&&null!==t&&Object.entries(t).forEach((([t,n])=>{e[t]?e[t].push(n):e[t]=[n]}))})),e):(e[t]=n,e)),{})}(t),u={...s,...c,...a,...n};In.track(e,u)}catch(Qt){console.error(`Error tracking event '${e}':`,Qt),trackEventError(e,Qt)}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Wn,Vn={exports:{}};Wn=Vn,function webpackUniversalModuleDefinition(e,t){Wn.exports=t()}("undefined"!=typeof self&&self,(function(){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=3)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.post(c,t,u)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion,i=t.queryParams,s=t.apiType,c=buildUrl({endpoint:e,apiVersion:n,queryParams:i,apiType:s});return a.get(c,u)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.put(c,t,u)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion;t.queryParams;var i=t.apiType,s=buildUrl({endpoint:e,apiVersion:n,apiType:i});return a.deleteMethod(s,u)},t.poll=function poll(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments[3],a=arguments[4],u=buildUrl({endpoint:e,apiVersion:s,apiType:a}),d=i({url:u,eachCall:t},n);return new c.default(d)};var s=_interopRequireDefault(n(1)),a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),c=_interopRequireDefault(n(9));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var u={apiKey:s.default.apiKey};function serializeQueryParams(e){if(!e)return"";var t=[null,void 0,""].concat(function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])),n=[];return Object.keys(e).forEach((function(i){var s=e[i];t.includes(s)||n.push(i+"="+s)})),n.length?"?"+n.join("&"):""}function buildUrl(e){var t=e.endpoint,n=e.apiVersion,i=void 0===n?s.default.version:n,a=e.queryParams;return"core"===e.apiType?s.default.coreUrl+"/"+s.default.coreVersion+"/"+t+serializeQueryParams(a):(/search|redirect|places/.test(t)?s.default.searchUrl:s.default.purchaseUrl)+"/"+i+"/"+t+serializeQueryParams(a)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.setConfig=function setConfig(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0!==e.env&&(e.searchUrl=i[e.env].search,e.purchaseUrl=i[e.env].purchase,e.coreUrl=i[e.env].core,e.coreVersion=i[e.env].coreVersion),Object.assign(c,e)},t.setUserAuthToken=function setUserAuthToken(e){return Object.assign(c,{userAuthToken:e})};var i={sandbox:{search:"https://search.resertravel.com/api",purchase:"https://purchases.resertravel.com/api",core:""},production:{search:"https://search.reservamos.mx/api",purchase:"https://compras.reservamos.mx/api",core:""}},s="sandbox",a={env:s,headers:{},searchUrl:i[s].search,purchaseUrl:i[s].purchase,coreUrl:i[s].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1},c=t.config=Object.assign({},a);t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"POST",body:JSON.stringify(t)},n)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return fetchJson(e,t,{},n)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"PUT",body:JSON.stringify(t)},n)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetchJson(e,{method:"DELETE"},t)};var s=_interopRequireDefault(n(1)),a=_interopRequireDefault(n(7)),c=_interopRequireDefault(n(8));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function checkStatus(e){var t=e.json();if(e.ok)return t;if(![404,422,500].includes(e.status))throw new a.default(e.status,e.statusText);switch(e.status){case 404:throw new a.default(100,"Not found");case 422:return t;case 500:throw new a.default(101,"Server error");default:throw new a.default}}function handleErrors(e){if(e.errors instanceof Array){var t=e.errors[0]||{},n=t.code,i=void 0===n?-100:n,s=t.message,u=void 0===s?"Unknown error":s,d=(0,c.default)(u)[i];throw d?new a.default(d.code,d.message):new a.default(i,u)}return e}function buildHeaders(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=Object.keys(Object.assign.apply(Object,[{}].concat(t))).reduce((function(e,n){return i({},e,function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},n,t.map((function(e){return n in e&&e[n]})).filter(Boolean)))}),{});return new Headers(s)}function fetchJson(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=s.default.apiKey,c=s.default.withCredentials,u=s.default.userAuthToken,d=s.default.headers,l={Accept:"application/json",Authorization:"Token token="+(n.apiKey||a),"Content-Type":"application/json"};return u&&(l.Authorization="Token "+(n.apiKey||a)+", Bearer "+u),t.headers=buildHeaders(d,l),t.credentials=c?"include":"omit","string"!=typeof t.body&&(t.body=JSON.stringify(t.body)),fetch(e,t).then(checkStatus).then(handleErrors).catch(i)}},function(e,t,n){n(4),n(5),e.exports=n(6)},function(e,t){"function"!=typeof Object.assign&&(Object.assign=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])}return n})},function(e,t){!function(e){if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,a="ArrayBuffer"in e;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isDataView=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};Headers2.prototype.append=function(e,t){e=normalizeName(e),t=normalizeValue(t);var n=this.map[e];this.map[e]=n?n+","+t:t},Headers2.prototype.delete=function(e){delete this.map[normalizeName(e)]},Headers2.prototype.get=function(e){return e=normalizeName(e),this.has(e)?this.map[e]:null},Headers2.prototype.has=function(e){return this.map.hasOwnProperty(normalizeName(e))},Headers2.prototype.set=function(e,t){this.map[normalizeName(e)]=normalizeValue(t)},Headers2.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},Headers2.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),iteratorFor(e)},Headers2.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),iteratorFor(e)},Headers2.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),iteratorFor(e)},n&&(Headers2.prototype[Symbol.iterator]=Headers2.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response2.prototype),Response2.prototype.clone=function(){return new Response2(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers2(this.headers),url:this.url})},Response2.error=function(){var e=new Response2(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];Response2.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new Response2(null,{status:t,headers:{location:e}})},e.Headers=Headers2,e.Request=Request,e.Response=Response2,e.fetch=function(e,t){return new Promise((function(n,s){var a=new Request(e,t),c=new XMLHttpRequest;c.onload=function(){var e,t,i={status:c.status,statusText:c.statusText,headers:(e=c.getAllResponseHeaders()||"",t=new Headers2,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),i=n.shift().trim();if(i){var s=n.join(":").trim();t.append(i,s)}})),t)};i.url="responseURL"in c?c.responseURL:i.headers.get("X-Request-URL");var s="response"in c?c.response:c.responseText;n(new Response2(s,i))},c.onerror=function(){s(new TypeError("Network request failed"))},c.ontimeout=function(){s(new TypeError("Network request failed"))},c.open(a.method,a.url,!0),"include"===a.credentials?c.withCredentials=!0:"omit"===a.credentials&&(c.withCredentials=!1),"responseType"in c&&i&&(c.responseType="blob"),a.headers.forEach((function(e,t){c.setRequestHeader(t,e)})),c.send(void 0===a._bodyInit?null:a._bodyInit)}))},e.fetch.polyfill=!0}function normalizeName(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function normalizeValue(e){return"string"!=typeof e&&(e=String(e)),e}function iteratorFor(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function Headers2(e){this.map={},e instanceof Headers2?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function consumed(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function fileReaderReady(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function readBlobAsArrayBuffer(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsArrayBuffer(e),n}function bufferClone(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(i&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(s&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(a&&i&&isDataView(e))this._bodyArrayBuffer=bufferClone(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!a||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=bufferClone(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return function readBlobAsText(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(e){for(var t=new Uint8Array(e),n=new Array(t.length),i=0;i<t.length;i++)n[i]=String.fromCharCode(t[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}function Request(e,t){var n=(t=t||{}).body;if(e instanceof Request){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Headers2(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new Headers2(t.headers)),this.method=function normalizeMethod(e){var t=e.toUpperCase();return d.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function decode(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),i=n.shift().replace(/\+/g," "),s=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(s))}})),t}function Response2(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new Headers2(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.core=t.adyen=t.exchange=t.priceAlert=t.users=t.quotes=t.redirect=t.utils=t.purchase=t.trip=t.search=t.collections=t.session=t.apiRequest=t.setUserAuthToken=t.setConfig=void 0;var i=n(1),s=_interopRequireWildcard(n(0)),a=_interopRequireWildcard(n(10)),c=_interopRequireWildcard(n(11)),u=_interopRequireWildcard(n(12)),d=_interopRequireWildcard(n(13)),l=_interopRequireWildcard(n(14)),p=_interopRequireWildcard(n(17)),h=_interopRequireWildcard(n(19)),f=_interopRequireWildcard(n(20)),m=_interopRequireWildcard(n(21)),g=_interopRequireWildcard(n(22)),_=_interopRequireWildcard(n(23)),y=_interopRequireWildcard(n(24)),v=_interopRequireWildcard(n(25));function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.setConfig=i.setConfig,t.setUserAuthToken=i.setUserAuthToken,t.apiRequest=s,t.session=a,t.collections=c,t.search=u,t.trip=d,t.purchase=l,t.utils=p,t.redirect=h,t.quotes=f,t.users=m,t.priceAlert=g,t.exchange=_,t.adyen=y,t.core=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function NetworkError2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-100,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unknown error";!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,NetworkError2);var n=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(NetworkError2.__proto__||Object.getPrototypeOf(NetworkError2)).call(this,t));return n.code=e,n.stack=(new Error).stack,n}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(NetworkError2,Error),NetworkError2}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s={1:{code:200,message:"Operación no autorizada"}},a={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},c={10:{code:400,message:"No existe el viaje"},20:{code:60,message:"No se encontró el viaje"},21:{code:60,message:"Tarifa no disponible"},22:{code:60,message:"Tarifa no disponible"}},u={23:{code:60,message:"Estudiante no disponible"},24:{code:60,message:"Profesor no disponible"},25:{code:60,message:"Menor no disponible"},26:{code:60,message:"Capacidades diferentes no disponible"},27:{code:60,message:"INSEN no disponible"},28:{code:60,message:"General no disponible"},29:{code:60,message:"Error desconocido"}},d={50:{code:50,message:"Unknow Error"}},l=t.apiErrors=function apiErrors2(e){return i({},s,a,c,function discountCodeErrors2(e){return{11:{code:500,message:e},12:{code:501,message:e}}}(e),u,d,function exchange2(e){return{30:{code:30,message:e}}}(e))};t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),a=function(){function Poll2(e){var t=e.url,n=e.watch,i=e.expect,s=e.maxRetries,a=void 0===s?30:s,c=e.interval,u=void 0===c?2e3:c,d=e.eachCall,l=void 0===d?null:d;!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Poll2),this.url=t,this.watch=n,this.expect=i instanceof Array?i:[i],this.interval=u,this.maxRetries=a,this.eachCall=l&&l.bind(this),this.aborted=!1,this.timers=[],this.execute=this.execute.bind(this),this.executeEachCall=this.executeEachCall.bind(this)}return i(Poll2,[{key:"start",value:function start(){return this.execute(this.maxRetries)}},{key:"abort",value:function abort(){this.aborted=!0}},{key:"execute",value:function execute(e){var t=this;return s.get(this.url,{},(function onRequestError2(e){return t.executeEachCall("error",e)})).then((function onRequestSuccess2(n){if(t.expect.includes(n[t.watch])||1===e||t.aborted){var i=n[t.watch];1===e?i="retries_exceeded":t.aborted&&(i="aborted"),t.timers.forEach(clearInterval),t.executeEachCall(i,n)}else if("failed"===n[t.watch])t.timers.forEach(clearInterval),t.executeEachCall("failed",n);else{t.executeEachCall("pending",n);var s=window.setTimeout(t.execute,t.interval,e-1);t.timers.push(s)}}))}},{key:"executeEachCall",value:function executeEachCall(e,t){this.eachCall instanceof Function&&this.eachCall({status:e,payload:t})&&this.abort()}}]),Poll2}();t.default=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(){return new Promise((function(e,t){i.get("session",{apiVersion:"v1"}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.agency=function agency(){return new Promise((function(e,t){i.get("get_agency").then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getCountries=function getCountries(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.prefetch,n=void 0===t||t,s=e.q,a={prefetch:n,q:void 0===s?"":s};return new Promise((function(e,t){i.get("countries",{queryParams:a}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.getPlaces=function getPlaces(e,t){var n=e?{q:e,from:t}:{prefetch:!0};return new Promise((function(e,t){i.get("places",{queryParams:n}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.create=function create(e,t){return a.post("search",e).then((function onCreateSuccess2(e){return startPolls(e,t)}))},t.stopSearch=function stopSearch(e){return!!(c&&e&&c[e])&&(c[e].forEach((function(e){return e.abort()})),Reflect.deleteProperty(c,e),!0)},t.stopAllSearches=function stopAllSearches(){return!!c&&(Object.entries(c).forEach((function(e){var t=i(e,2);return t[0],t[1].forEach((function(e){return e.abort()}))})),c={},!0)},t.get=function get(e,t){return new Promise((function(n,i){a.get("search/"+e+"/info").then((function(e){return n(startPolls(e,t))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateExternalCoupon=function validateExternalCoupon(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get("search/discounts/validate_external_coupon/"+e+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.walletSearchDiscount=function walletSearchDiscount(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get(e+"/discounts"+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),c={};function startPolls(e,t){var n=e.search,i=n.id,u=n.type_of_transport,d=u.bus,l=u.flights,p=u.mix,h=t.initBuses,f=void 0===h||h,m=t.initFlights,g=void 0===m||m,_=t.initRides,y=void 0!==_&&_,v=t.initMix,b=void 0===v||v,w=t.onReceiveBuses,S=t.onReceiveFlights,I=t.onReceiveRides,x=t.onReceiveMixed,O=s({watch:"state",expect:"finished"},t.options||{}),T=[];if(d&&d.active&&f){var C=a.poll("search/"+i+"?type=bus",w,O);C.start(),T.push(C)}else w&&w({status:"deactivated"});if(l&&l.active&&g){var R=a.poll("search/"+i+"?type=plane",S,O);R.start(),T.push(R)}else S&&S({status:"deactivated"});if(p&&p.active&&b){var P=a.poll("search/"+i+"?type=mix",x,O);P.start(),T.push(P)}else x&&x({status:"deactivated"});if(y){var N=a.poll("search/"+i+"?type=car",I,O);N.start(),T.push(N)}return c[i]=T,e}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,i){s.get("trips/"+e+"?"+function encodePassengers(e){var t=[];return Object.keys(e).forEach((function(n){var i=e[n];i&&t.push(n+"="+i)})),t.join("&")}(t)).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getWithBus=function getWithBus(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i({with_pricing:!0},t);return new Promise((function(t,c){s.post("trips/"+e+"/details_requests",a).then((function(a){return t(function startPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.options,l=void 0===d?{}:d,p=n.onReceiveTrip,h=i({watch:"state",expect:"finished"},l),f=void 0,m=void 0;return u&&(m=(f=s.poll("trips/"+e+"/details_requests/"+a,p,h)).start()),{payload:t,polls:{trip:m,abort:function abort(){return f.abort()}}}}(e,a,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.startTicketsPoll=void 0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPurchasePoll=startPurchasePoll,t.create=function create(e){return new Promise((function(t,n){s.post(u,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.get=get,t.update=function update(e,t){return new Promise((function(n,i){s.put(u+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createPassengers=function createPassengers(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+p,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.updatePassengers=function updatePassengers(e,t){return new Promise((function(n,i){s.put(u+"/"+e+"/"+h,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.deletePassenger=function deletePassenger(e,t){return new Promise((function(n,i){s.deleteMethod(u+"/"+e+"/"+p+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createTickets=function createTickets(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,a){s.post(u+"/"+e+"/"+f,t).then((function(t){return i((0,c.startTicketsPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknown error":i})}))}))},t.applyDiscountCode=function applyDiscountCode(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+g,{code:t},{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.removeDiscountCode=function removeDiscountCode(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+g+"/"+_,{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.createPayment=function createPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.post(u+"/"+e+"/"+v,t).then((function(t){return i((0,a.startPaymentPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.getPayment=function getPayment(e,t,n){return n?(0,a.startPaymentPoll)(e,{id:t},n):new Promise((function(n,i){s.get(u+"/"+e+"/"+v+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.sendEmail=function sendEmail(e,t){var n={email:t};return new Promise((function(t,i){s.get(u+"/"+e+"/"+m,{queryParams:n}).then((function(){return t()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.confirmPaypalPayment=function confirmPaypalPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.put(u+"/"+e+"/"+v+"/"+t+"/confirm.json").then((function(s){i((0,a.startPaymentPoll)(e,{id:t},n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.updateWallet=function updateWallet(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=u+"/"+e+"/"+d,a=t?i:i+"/"+l;return s.post(a,n).then((function(){return get(e)}))},t.verifyPhoneNumber=function verifyPhoneNumber(e,t,n){return s.put(u+"/"+e+"/"+v+"/"+t+"/send_verification",n)},t.verifySmsCode=function verifySmsCode(e,t,n){return s.post(u+"/"+e+"/"+v+"/"+t+"/verify_code",{code:n})},t.unlockSeats=function unlockSeats(e){return new Promise((function(t,n){s.post(u+"/"+e+"/unlock_seats").then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.generateOTP=function generateOTP(e,t){return new Promise((function(n,i){s.post(e+"/otp-generate",t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateOTP=function validateOTP(e,t){return new Promise((function(n,i){var a={otp:t};s.post(e+"/otp-validate",a).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPayment=function membershipDiscountPayment(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+y,t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPaymentDelete=function membershipDiscountPaymentDelete(e){return new Promise((function(t,n){s.deleteMethod(u+"/"+e+"/"+y).then((function(){return t()})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadTickets=function downloadTickets(e){return new Promise((function(t,n){s.post("tickets/pdf",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadPurchasesHistory=function downloadPurchasesHistory(e){return new Promise((function(t,n){s.post(b,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.increaseExpiration=function increaseExpiration(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+w).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(15),c=n(16),u="purchases",d="wallet_movements",l="cancel",p="passenger_requests",h=p+"/update",f="ticket_requests",m="tickets/resend",g="discounts",_="cancel",y="payment_discounts",v="payments",b="purchase_history/search",w="session-extension";function startPurchasePoll(e,t){var n=t.init,a=void 0===n||n,c=t.onReceivePurchase,u="purchases/"+e,d=i({watch:"state",expect:["completed"]},t.options||{}),l=void 0,p=void 0;return a&&(p=(l=s.poll(u,c,d)).start()),{polls:{payment:p,abort:function abort(){return l.abort()}}}}function get(e,t,n){return n?startPurchasePoll(e,n):new Promise((function(n,i){s.get(u+"/"+e,{queryParams:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))}t.startTicketsPoll=c.startTicketsPoll},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPaymentPoll=function startPaymentPoll(e,t,n){var c=t.id,u=n.init,d=void 0===u||u,l=n.onReceivePayment,p="purchases/"+e+"/payments/"+c,h=i({watch:"purchase_state",expect:["completed","pending"]},n.options||{}),f=void 0,m=void 0;return d&&(f=s.poll(p,function checkPaymentPayload(e){return function(t){var n=t.payload,i=n.using_3d_secure,s=n.needs_verification;return e&&e(t),a(t)||i||s}}(l),h),m=f.start()),{payload:t,polls:{payment:m,abort:function abort(){return f.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=function paymentFailed2(e){var t=e.payload;return["suspicious","failed","rejected"].includes(t.status)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startTicketsPoll=function startTicketsPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.onReceiveTickets,l="purchases/"+e+"/ticket_requests/"+a,p=i({watch:"state",expect:"finished"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{tickets:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=n(18);Object.defineProperty(t,"findSeats",{enumerable:!0,get:function get(){return i.findSeats}})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function findAvailableSeats(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments[3],s=t.length,a=n.length,c=t,u=void 0;if(void 0===i&&(i=e-a),!i)return n;for(var d=0;d<s;d++)if((u=findAvailableAdjecentSeats(i,t[d].filter((function(e){return["seat","seat_tv"].includes(e.category)})),n)).length===i){c=(c=t.slice(d)).concat(t.slice(0,d)),a=(n=n.concat(u)).length;break}return u.length?i=e-a:i-=1,findAvailableSeats(e,c,n,i)}function findAvailableAdjecentSeats(e,t){var n=[],i=!1;if(!function hasAvailableSeats(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.filter((function(e){return!(e.occupied||n.includes(e.number))})).length>=t}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))return n;for(var s=t.length-1;s>=0;s--){var a=t[s];if(a.occupied?n=[]:n.push(a.number),n.length===e){i=!0;break}}return i?n:[]}t.findSeats=function findSeats(e,t){var n=i(t,2),s=n[0],a=n[1],c=findAvailableSeats(e,s),u=[];if(c.length<e&&a){var d=findAvailableSeats(e,a);u=d.length<e?c.concat(d).slice(0,e):d}else u=c;return u.length?u:null}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("redirect",{apiVersion:"v2",queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("quotes",{queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getUser=function getUser(){return s.default.userAuthToken?i.get(c):null},t.getCreditCards=function getCreditCards(){return s.default.userAuthToken?i.get(u):null};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n(1)),a="users",c=a+"/profile.json",u=a+"/list_cards.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.createPriceAlert=function createPriceAlert(e){return i.post(s+".json",e)},t.deletePriceAlert=function deletePriceAlert(e){return i.get(s+"/"+e+"/"+a)};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="price_alerts",a="cancel.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.validate=function validate(e,t,n,c,u,d,l){var p=i({},d&&{email:d},l&&{document:l},{operation_number:e},t&&{nit:t},n&&{origin:n},c&&{destination:c},u&&{recaptcha_token:u});return new Promise((function(e,t){s.post(a+"/validate",p).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.cancelTicket=function cancelTicket(e,t){var n={operation_number:t};return new Promise((function(t,i){s.post("purchases/"+e+"/cancellations",n).then((function(e){return t(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getCancelledTicketStatusPoll=function getCancelledTicketStatusPoll(e,t,n){var a=t,c=n.init,u=void 0===c||c,d=n.onGetCancelStatus,l="purchases/"+e+"/cancellations/"+a,p=i({watch:"status",expect:"success"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{data:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a="exchanges"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.paymentCards=function paymentCards(e){return new Promise((function(t,n){i.post("adyen/payment_cards",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.deleteCard=function deleteCard(e){return new Promise((function(t,n){i.post("adyen/delete_payment_card",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getRecommendedTrips=function getRecommendedTrips(e){var t=e.searchId,n=e.userIdentifier;return new Promise((function(e,s){i.get("trip_recommendations/"+t+"/"+n,{apiType:"core"}).then((function(t){return e(t)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return s({code:n,message:void 0===i?"Unknown error":i})}))}))},t.createTripPriceAlerts=function createTripPriceAlerts(e){return new Promise((function(t,n){i.post(""+s,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.updateTripPriceAlerts=function updateTripPriceAlerts(e,t){return new Promise((function(n,a){i.put(s+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknow error":i})}))}))},t.deleteTripPriceAlerts=function deleteTripPriceAlerts(e){return new Promise((function(t,n){i.deleteMethod(s+"/"+e).then((function(){return t({code:200,message:"Trip Price Alert deleted"})})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.createAnonymousProfile=function createAnonymousProfile2(e){return new Promise((function(t,n){i.post(a,e,{apiType:"core"}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="trip_price_alerts",a="anonymous_profiles/identify"}])}));var Hn=Vn.exports;const Kn=_e.object({email:_e.string().email().optional(),phone:_e.string().optional(),cpf:_e.string().optional(),passport:_e.string().optional(),rg:_e.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{Bn.validateProps(e,Kn);const t=[],n=st.getCachedFingerprint(),i=In.getMixpanelDistinctId();n&&t.push({key:"fingerprint",value:n}),i&&t.push({key:"distinct_id",value:i});const s=function getAnonymousProfilePayload(e,t){let n="phone",i=e.phone||"";const s=[];e.email&&(n="email",i=e.email);const a=["cpf","passport","rg","email","phone","salesforceid"];return Object.entries(e).forEach((([e,t])=>{a.includes(e.toLowerCase())&&t&&e!==n&&s.push({key:e,value:t})})),t.length&&t.forEach((e=>s.push(e))),{identifier_key:n,identifier_value:i,details:{},identifiers:s}}(e,t);return(await Hn.core.createAnonymousProfile(s)).data}catch(Qt){return void console.error("Could not create anonymous profile:",Qt)}}const Gn=["firstName","lastName","email","phone"];const Jn=window.location.origin,Yn={coreAPIConfig:{sandbox:{coreUrl:"https://datalake-api-dev.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:Jn}},prod:{coreUrl:"https://data-lake.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:Jn}}}};const Xn={init:async function init(e){Bn.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i,isSandbox:s=!1,mixpanelProxyUrl:a,identifyProxyUrl:c}=e;await In.init(t,n,a);try{await st.initFingerprint(i,c)}catch(Qt){console.error("Error initializing identification service:",Qt)}const u=Yn.coreAPIConfig[s?"sandbox":"prod"];Hn.setConfig(u),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:function isTrackerReady(){return In.isReady()},identify:async function identify(e,t={}){try{if(!In.isReady())throw console.error("Mixpanel is not initialized."),new Error("Mixpanel is not initialized.");if(Bn.parseIdentifyProps(t),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const n=await createAnonymousProfile(t);n&&(t.reservamos_one_id=n.id);const i=function mapProperties(e){return{$first_name:null==e?void 0:e.firstName,$last_name:null==e?void 0:e.lastName,$email:null==e?void 0:e.email,$phone:null==e?void 0:e.phone,...Object.keys(e).reduce(((t,n)=>(Gn.includes(n)||(t[n]=e[n]),t)),{})}}(t);In.identify(e,i);const s=await st.getFingerprint();s&&In.attachProperty("Known Fingerprints",s)}catch(Qt){console.error("Error identifying user",Qt),trackEventError("Identify",Qt)}},identifiers:{getFingerprintId:st.getCachedFingerprint,getDistinctId:In.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},track:{search:function trackSearch(e,t={}){trackEvent("Search",e,t)},seatChange:function trackSeatChange(e,t={}){trackEvent("Seat Change",e,t)},interestInHome:function trackInterestInHome(e,t={}){trackEvent("Interest In Home",e,t)},interestInSearch:function trackInterestInSearch(e,t={}){trackEvent("Interest In Search",e,t)},viewResults:function trackViewResults(e,t={}){trackEvent("View Results",e,t)},passengersCreated:function trackPassengersCreated(e,t={}){trackEvent("Passengers Created",e,t)},paymentAttempt:async(e,t={})=>{trackEvent("Payment Attempt",e,t)},purchaseAttempt:function trackPurchaseAttempt(e,t={}){trackEvent("Purchase Attempt",e,t)},pickedDeparture:function trackSearch$1(e,t={}){trackEvent("Picked Departure",e,t)},customEvent:function trackCustomEvent(e,t={},n={}){try{be.parse(e),trackEvent(e,t,n)}catch(Qt){console.error("Error trackCustomEvent:",Qt),trackEventError(e,Qt)}},purchaseCanceled:function trackPurchaseCanceled(e,t={}){trackEvent("Purchase Canceled",e,t)}}};module.exports=Xn;
31
31
  //# sourceMappingURL=browser-analytics.cjs.map