UNPKG

zipy-for-rd

Version:

SDK for zipy

2 lines 99.5 kB
import{record as e,EventType as t,pack as n,MouseInteractions as r}from"zipy-rrweb";import{v4 as o}from"uuid";import{strToU8 as i,zlibSync as s,strFromU8 as a}from"fflate";import c from"lz-string";var u,d,l;!function(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.ReplayerEvent=11]="ReplayerEvent",e[e.ConsoleInfo=50]="ConsoleInfo",e[e.ConsoleError=51]="ConsoleError",e[e.ConsoleWarning=52]="ConsoleWarning",e[e.ConsoleDebug=53]="ConsoleDebug",e[e.Error=70]="Error",e[e.RangeError=71]="RangeError",e[e.ReferenceError=72]="ReferenceError",e[e.TypeError=73]="TypeError",e[e.SyntaxError=74]="SyntaxError",e[e.URIError=75]="URIError",e[e.EvalError=76]="EvalError",e[e.UnhandledRejection=77]="UnhandledRejection",e[e.BROWSERDATA=100]="BROWSERDATA",e[e.NAVIGATION=101]="NAVIGATION",e[e.Online=102]="Online",e[e.Offline=103]="Offline",e[e.XHR=104]="XHR",e[e.WSOPEN=105]="WSOPEN",e[e.WSCLOSE=106]="WSCLOSE",e[e.WSMESSAGE=107]="WSMESSAGE",e[e.WSERROR=108]="WSERROR",e[e.Fonts=109]="Fonts",e[e.Link=110]="Link",e[e.Css=111]="Css",e[e.Image=112]="Image",e[e.Js=113]="Js",e[e.Media=114]="Media",e[e.ZipyLogMessage=115]="ZipyLogMessage",e[e.ZipyLogException=116]="ZipyLogException",e[e.ZipyLogFrontendError=117]="ZipyLogFrontendError",e[e.ZipyLogNetworkError=118]="ZipyLogNetworkError",e[e.Performance=119]="Performance",e[e.PerfNavigation=120]="PerfNavigation",e[e.OtherNetworkCall=121]="OtherNetworkCall",e[e.WebVitals=122]="WebVitals",e[e.NavigationStart=123]="NavigationStart",e[e.DEBUG_INFO=124]="DEBUG_INFO",e[e.CustomEvent=125]="CustomEvent"}(u||(u={})),function(e){e[e.MESSAGESEND=0]="MESSAGESEND",e[e.MESSAGERECEIVED=1]="MESSAGERECEIVED",e[e.SOCKETCLOSE=2]="SOCKETCLOSE",e[e.SOCKETERROR=3]="SOCKETERROR",e[e.SOCKETOPEN=4]="SOCKETOPEN"}(d||(d={})),function(e){e[e.ELEMENT=0]="ELEMENT",e[e.EVENT=1]="EVENT",e[e.FIRST_INPUT=2]="FIRST_INPUT",e[e.LARGEST_CONTENTFUL_PAINT=3]="LARGEST_CONTENTFUL_PAINT",e[e.LAYOUT_SHIFT=4]="LAYOUT_SHIFT",e[e.LONGTASK=5]="LONGTASK",e[e.MARK=6]="MARK",e[e.MEASURE=7]="MEASURE",e[e.NAVIGATION=8]="NAVIGATION",e[e.PAINT=9]="PAINT",e[e.RESOURCE=10]="RESOURCE"}(l||(l={}));var f,p,v,g="zipy",m="rrweb";!function(e){e[e.POSTENDUSERINFOANDGETUSERCONFIG=0]="POSTENDUSERINFOANDGETUSERCONFIG",e[e.POSTENDUSERINFO=1]="POSTENDUSERINFO",e[e.GETUSERCONFIG=2]="GETUSERCONFIG"}(f||(f={})),function(e){e[e.ANONYMS=0]="ANONYMS",e[e.IDENTIFIED=1]="IDENTIFIED"}(p||(p={})),function(e){e[e.NORECORDING=0]="NORECORDING",e[e.RECORDINGPENDING=1]="RECORDINGPENDING",e[e.RECORDINGSUCCESSFUL=2]="RECORDINGSUCCESSFUL"}(v||(v={}));var y,w,h,E,S="logEvent",I="exceptionEvent",z="errorEvent",C=1024,T="startIframeRecording",k="stopIframeRecording",N="iframeContentLoaded";(E=y||(y={})).DEBUG="1",E.WARNING="2",E.ERROR="3",E.LOG="4",function(e){e[e.BLOCKING=0]="BLOCKING",e[e.NON_BLOCKING=1]="NON_BLOCKING"}(w||(w={})),function(e){e.session_data="_zsession-data",e.total_data_sent="_ztotal-data-sent",e.enduser_last_activity_time="_zenduser-last-activity-time",e.last_activity_time="_zlast-activity-time",e.utms="_utms"}(h||(h={}));var b,R=/^(?!-)[A-Za-z0-9-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,6}$/,O=/^(https?|ftp):\/\/(([a-z\d]([a-z\d-]*[a-z\d])?\.)+[a-z]{2,}|localhost)(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/i,P=499;!function(e){e[e.FCP=0]="FCP",e[e.FP=1]="FP",e[e.FID=2]="FID",e[e.CLS=3]="CLS",e[e.LCP=4]="LCP"}(b||(b={}));var D,U,x,L={"Content-Type":"application/json","Content-Encoding":"gzip"};!function(e){e.INIT="init",e.REINIT="reinit",e.PAGE_OUT="pageout"}(D||(D={})),function(e){e.PAGELOAD="pageload",e.VISIBLE="visibility visible",e.HIDDEN="visibility hidden",e.IDENTIFY="identify",e.ANONYMIZE="anonymize",e.STREAMDATARECORDINGPAUSE="streamdata recording paused",e.STREAMDATAEXPIRE="streamdata session expired",e.NA=""}(U||(U={})),function(e){e[e.IDLE=0]="IDLE",e[e.PENDING=1]="PENDING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED"}(x||(x={}));var A,F=["utm_source","utm_medium","utm_term","utm_content","utm_campaign"];!function(e){e[e.STOP=0]="STOP",e[e.START=1]="START"}(A||(A={}));var _={streamMgrUrl:"https://services.zipy.ai/sdk-session-manager/v2/enduser-info",registerSessionUrl:"https://services.zipy.ai/sdk-session-manager/v1/register-sdk-session",sdkVersion:"1.0.37",errorUrl:"divolte.collector",streamMgrRetryCount:5,zipyDeploymentEnviornment:"Production",sdkLoopTime:1e3,perfLoopTime:5e3,ignoreEmptyErros:!0,ignoreLargeResponse:!0,debugLogs:!1,sessionLinkUrl:"https://app.zipy.ai",isNPM:!0,streamMgrRetryDelay:5e3},M=!1;function G(e){M&&console.info(g,e)}function q(e){M&&console.debug(g,e)}function J(e){M&&console.log(g,e)}function B(e){M&&console.error(g,e)}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function W(){return W=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W.apply(null,arguments)}function H(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(H=function(){return!!e})()}function V(e,t){return V=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},V(e,t)}var K=new Map;function X(e){try{var t=window.localStorage.getItem(e);return G("inside zLocalStorageGetItem for key :"+e+" and value :"+t),!t&&(G("fetched value from hashmap :"+(t=K.get(e))),t)?(G("Going to update local storage:"),function(){try{G("inside localStorageUpdate function");for(var e,t=j(K.entries());!(e=t()).done;){var n=e.value;window.localStorage.getItem(n[0])||(G("Going inside localStorageUpdate-2 for key :"+n[0]+" and value :"+n[1]),Y(n[0],n[1]))}}catch(e){B("inside updateLocalStorage catch block ${e.message}")}}(),t):t}catch(e){return void B("inside zLocalStorageGetItem catch block ${e.message}")}}function Y(e,t){try{G("inside zLocalStorageSetItem for key :"+e+" and value :"+t),K.set(e,t),window.localStorage.setItem(e,t)}catch(e){B("inside zLocalStorageSetItem catch block ${e.message}")}}function $(e){try{G("inside zLocalStorageRemoveItem for key :"+e),K.delete(e),window.localStorage.removeItem(e)}catch(e){B("inside zLocalStorageSetItem catch block ${e.message}")}}var Q=/*#__PURE__*/function(){function e(){this.sessionId="",this.isSessionExpired=!1,this.lastActivityTime=void 0,this.enduserLastActivityTime=void 0,this.sessionBlockInfo={isBlocked:!1,blockedEndTime:0,apiKey:""},this.apiKey="",this.isNewSession=!1,this.isCheckoutFlowTriggered=!1}return e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e}();function ee(){var e=X("zsdk-config");if(e)try{return JSON.parse(e)}catch(e){return void B("Failed to parse sdk Config Data")}}function te(e){if(e)try{G("Updating zsession-blocked-info"+JSON.stringify(e)),Y("zsession-blocked-info",JSON.stringify(e))}catch(e){B("Failed to stringify zsession-blocked-info ")}}function ne(e){var t=Q.getInstance(),n={isBlocked:!1,blockedEndTime:0,apiKey:e};try{t.sessionBlockInfo=n,G("Updating zsession-blocked-info"+JSON.stringify(n)),Y("zsession-blocked-info",JSON.stringify(n))}catch(e){B("Failed to stringify zsession-blocked-info ")}}function re(){var e=X("zsession-blocked-info"),t=Q.getInstance();if(e)try{var n=JSON.parse(e);return t.sessionBlockInfo=n,n}catch(e){return void B("Failed to parse zsession-blocked-info")}}function oe(){var e=X("zId");return e||(Y("zId",e=Je()),e)}function ie(){var e=X("zenduser-info");if(e)try{return JSON.parse(e)}catch(e){return void B("Failed to parse end user Info data")}}function se(){var e=X("zenduser-info-temp");if(e)try{return JSON.parse(e)}catch(e){return void B("Failed to parse end user Info data")}}function ae(e){oe(),ie()||G("Creating new enduser-info"+JSON.stringify(e));try{G("Updating enduser-info"+JSON.stringify(e)),Y("zenduser-info",JSON.stringify(e))}catch(e){B("Failed to stringify  enduser-info ")}}function ce(e){oe(),ie()||G("Creating new enduser-info-temp"+JSON.stringify(e));try{G("Updating enduser-info-temp"+JSON.stringify(e)),Y("zenduser-info-temp",JSON.stringify(e))}catch(e){B("Failed to stringify  enduser-info-temp ")}}function ue(){se()?(G("Removing zenduser-info-temp"),$("zenduser-info-temp")):G("zenduser temp Data dosen't exists")}function de(){var e=ie();return e?e.userType===p.IDENTIFIED:(G("zenduser-info doesn't exists"),!1)}function le(e,t){e.euId=0,e.euZName="",e.isBlocked=!1,e.zAnonymsUserInfo={euId:0,euZName:"",zId:null!=t?t:""}}function fe(e,t){var n,r,o=oe();(null==e||null==(n=e.zAnonymsUserInfo)?void 0:n.zId)===o?(G("ZId match"),e.euId=e.zAnonymsUserInfo.euId,e.euZName=e.zAnonymsUserInfo.euZName):(G("ZId dosen't match Zid : "+o+" and Anonyms user Zid: "+(null==e||null==(r=e.zAnonymsUserInfo)?void 0:r.zId)),le(e,o)),t?ce(e):ae(e)}function pe(){if(se())return G("Temp storage has some pending data to post"),!0;var e=ie();if(!e)return G("zenduser Data dosen't exists"),!0;if(0===e.euId)return G("Euid value is 0, required to fetch data again"),!0;if(e.userType===p.ANONYMS){var t,n;if(null==e||null==(t=e.zExternalUserInfo)?void 0:t.externalId)return G("External User details exists, and userType is ANONYMS need to post data"),!0;var r=oe();if((null==(n=e.zAnonymsUserInfo)?void 0:n.zId)!==r)return G("ZId dosen't match Zid : "+r+" and Anonyms user Zid: "+e.zAnonymsUserInfo.zId),le(e,r),ae(e),!0;G("ZId match No need to update for anonyms user")}return!1}Q.instance=void 0;var ve=/*#__PURE__*/function(){function e(){this.rootDomain="",this.releaseVer="",this.recordOnlyIframe=!1,this.proxyURL="",this.rootDomain="",this.releaseVer="",this.recordOnlyIframe=!1,this.proxyURL=""}var t=e.prototype;return t.saveOptions=function(e){this.releaseVer=e.releaseVer?e.releaseVer:this.releaseVer,this.rootDomain=this.isValidRootDomain(e.rootDomain)?e.rootDomain:this.rootDomain,this.recordOnlyIframe="boolean"==typeof e.recordOnlyIframe?e.recordOnlyIframe:this.recordOnlyIframe,this.proxyURL=this.isValidProxyURL(e.proxyURL)?e.proxyURL:this.proxyURL},t.isValidRootDomain=function(e){return!(!e||!new RegExp(R).test(e))},t.isValidProxyURL=function(e){return!(!e||!new RegExp(O).test(e))},e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e}();function ge(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}ve.instance=void 0;var me=function e(t,n,r){try{return Promise.resolve(ge(function(){var o=Ke(),i=ve.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:Ze(o.customEventUrl,i.proxyURL,L),body:JSON.stringify(n)})).then(function(o){return o.ok?(q("Response status = "+o.status),!0):(q("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(B("Not able to send data after all retries"),!1))})},function(e){return B("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},ye=function e(t,n,r,o,i){void 0===n&&(n=5),void 0===i&&(i={});try{return Promise.resolve(ge(function(){var s=ve.getInstance(),a=new URL(t),c=new URL((s.proxyURL?s.proxyURL:a.origin)+a.pathname);return null!=r&&Object.keys(r).forEach(function(e){return c.searchParams.append(e,r[e])}),Promise.resolve(fetch(c.href,{method:"POST",headers:Ze(a.origin,s.proxyURL,{"Content-Type":"application/json"}),body:JSON.stringify(o)})).then(function(s){return s.ok?(q("postDataOnServer :: Response status = "+s.status),Promise.resolve(s.json()).then(function(e){return q("postDataOnServer :: Response JSON = "+e),e})):404==s.status?(Y("is-api-key-valid","false"),Te(!1),!1):(q("Error :: Response status = "+s.status),n>0?void setTimeout(function(){return ze+=_.streamMgrRetryDelay,e(t,n-1,r,o,i)},ze):(B("Not able to post enduser config after multiple retries"),!1))})},function(e){return B("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},we=function e(t,n,r){try{return Promise.resolve(ge(function(){var o=Ke(),i=ve.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:Ze(o.pagePerfUrl,i.proxyURL,L),body:JSON.stringify(n)})).then(function(o){return o.ok?(q("Response status = "+o.status),!0):(q("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(B("Not able to send data after all retries"),!1))})},function(e){return B("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},he=function e(t,n,r){try{return Promise.resolve(ge(function(){var o=Ke(),i=ve.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:Ze(o.heatMapUrl,i.proxyURL,L),body:JSON.stringify(n)})).then(function(o){return o.ok?(q("Response status = "+o.status),!0):(q("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(B("Not able to send data after all retries"),!1))})},function(e){return B("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},Ee=function e(t,n,r){try{return Promise.resolve(ge(function(){var o=Ke(),i=ve.getInstance();return Promise.resolve(fetch(t,{method:"POST",headers:Ze(o.perfUrl,i.proxyURL,L),body:JSON.stringify(n)})).then(function(o){return o.ok?(q("Response status = "+o.status),!0):(q("Error :: Response status = "+o.status),r>0?e(t,n,r-1):(B("Not able to send data after all retries"),!1))})},function(e){return B("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},Se=function t(n){var r=n.divolteUrl,o=n.divolteJson,i=n.failureRetryCount;try{return Promise.resolve(ge(function(){var n=JSON.stringify(o),s=Ke(),a=ve.getInstance();return Promise.resolve(fetch(r,{method:"POST",headers:Ze(s.streamUrl,a.proxyURL,L),body:n})).then(function(s){return Ke()&&Ke().splitSessionSize>0&&(J("Request size "+(new TextEncoder).encode(n).byteLength),function(t){try{var n=JSON.parse(t).events,r=xt(n),o=Q.getInstance(),i=X("ztotal-data-sent")?X("ztotal-data-sent"):"0",s=parseInt(i)+r;J("Current data size "+i),J("Merged data size "+s);var a=!0;o.isCheckoutFlowTriggered?a=!function(e){for(var t,n=Q.getInstance(),r=0,o=e.length-1;r<o;){if(!0===e[r].isCheckout){t=r,n.isCheckoutFlowTriggered=!1;break}if(!0===e[o].isCheckout){t=o,n.isCheckoutFlowTriggered=!1;break}r++,o--}return t>=0&&(Y("ztotal-data-sent",xt(e.slice(t,e.length)).toString()),!0)}(n):s>Ke().splitSessionSize&&!o.isCheckoutFlowTriggered&&function(){try{J("Trigger checkout flow triggered"),e.takeFullSnapshot(!0)}catch(e){B("Error in checking full snapshot. Error is - "+e.message)}}(),a&&Y("ztotal-data-sent",JSON.stringify(s))}catch(e){B("Error in checking data size. Error is - "+e.message)}}(o.parameters.eventData)),s.ok?(q("Response status = "+s.status),!0):(q("Error :: Response status = "+s.status),i>0?t({divolteUrl:r,divolteJson:o,failureRetryCount:i-1}):(B("Not able to send data after all retries"),!1))})},function(e){return B("Not able to get response from server with ERROR: "+e),!1}))}catch(e){return Promise.reject(e)}},Ie=!0,ze=_.streamMgrRetryDelay;function Ce(){return Ie}function Te(e){Ie=e}function ke(){var e=X("session-data");if(e)try{return JSON.parse(e)}catch(e){return void B("Failed to parse session data")}}function Ne(e){var t=Q.getInstance();if(t.isSessionExpired)return q("Session is already expired"),!0;var n=(ke()||{}).sessionId,r=Number(X("last-activity-time"));return!n||r+e.sessionTimeout<=Date.now()?(G("Session is expired"),t.isSessionExpired=!0,!0):!function(e){var t=be();return!(!t||t+e.sessionTimeout<=Date.now())}(e)&&(t.isSessionExpired=!0,!0)}function be(){try{var e=Q.getInstance().enduserLastActivityTime;if(!e){if(!(e=Number(X("zenduser-last-activity-time"))))return 0;e=Number(e)}return e}catch(e){return B("inside getZendUserActivityTime catch block"),0}}function Re(){var e=X("pack");if(!e){var t=Ke();Y("pack",e=t.pack?t.pack.toString():(!1).toString())}return"true"===e}function Oe(e){ne(e),Y("ztotal-data-sent","0"),$("zUTMParams"),$("session-data"),Ae(e+h.utms)}function Pe(e){var t=Q.getInstance(),n=X("zId");n||Y("zId",n=Je());var r=Je(),o="0:"+Je().replace("-",":");Oe(e);var i={sessionId:r,dSession:o,isNewSession:!0,sdkKey:e};Y("is-api-key-valid","true"),Te(!0);try{G("Created new Session"+JSON.stringify(i)),t.sessionId=i.sessionId,t.apiKey=i.sdkKey,t.isNewSession=i.isNewSession,t.isSessionExpired=!1,t.lastActivityTime=Date.now(),t.enduserLastActivityTime=Date.now(),t.isCheckoutFlowTriggered=!1,window.buffered=!1,Y("last-activity-time",t.lastActivityTime.toString()),Y("zenduser-last-activity-time",t.enduserLastActivityTime.toString()),Y("session-data",JSON.stringify(i))}catch(e){B("Failed to stringify  session data")}}function De(e){var t=ke();return!!t&&e!==(null==t?void 0:t.sdkKey)&&(G("Sdk key is chnaged going to create session data"),!0)}function Ue(){window.zEventsPerfData=[],window.zClickEventsData=[],window.zFetchTempData=[],window.zEventsData=[],window.zCustomEventData=[],window.zPagePerfData=[]}var xe=function(e){try{var t,n,r=document.cookie,o=null==r?void 0:r.split(";"),i=!1;return o.forEach(function(r){var o=r.split("=");if(o[0].trim()===e){var s=o[1].split(",");s.length>1?(n=Fe(s),i=!0):t=o[1]?o[1]:""}}),i?n:t}catch(e){return void B("inside zGetCookie catch block")}},Le=function(e,t){var n=ve.getInstance(),r=new Date((new Date).valueOf()+216e5).toUTCString();document.cookie=e+"="+t+"; path=/; domain="+n.rootDomain+"; expires="+r+";"},Ae=function(e){var t=ve.getInstance(),n=new Date((new Date).valueOf()-1e3).toUTCString();document.cookie=e+'=""; path=/; domain='+t.rootDomain+"; expires="+n+";"},Fe=function(e){var t={};return e.forEach(function(e){var n=e.split("#");t[n[0]]=n[1]?n[1]:""}),t||{}},_e=function(e){var t=xe(e+h.enduser_last_activity_time),n=xe(e+h.total_data_sent)?xe(e+h.total_data_sent):"0",r=xe(e+h.session_data),o=xe(e+h.last_activity_time),i=Q.getInstance();try{if(o){(t||r||o)&&(i.isSessionExpired=!1);var s="0:"+Je().replace("-",":");Y("ztotal-data-sent",n),Y("last-activity-time",o),Y("zenduser-last-activity-time",t),i.enduserLastActivityTime=t,i.lastActivityTime=o;var a=ie()||{},c=re()||{},u=ke()||{};a.isBlocked="true"===(null==r?void 0:r.isBlocked),a.euId=Number(null==r?void 0:r.euId),a.zAnonymsUserInfo.zId=(null==r?void 0:r.zId)||"",de()||(a.zExternalUserInfo.externalId=(null==r?void 0:r.externalId)||""),c.isBlocked="true"===(null==r?void 0:r.isBlocked),u.dSession=s,u.sessionId=(null==r?void 0:r.sessionId)||"",u.sdkKey=(null==r?void 0:r.sdkKey)||"",Y("zId",(null==r?void 0:r.zId)||""),te(c),Y("zenduser-info",JSON.stringify(a)),Y("zenduser-info-temp",JSON.stringify(a)),Y("session-data",JSON.stringify(u))}}catch(e){return void B("inside zSetLocalStorageDataFromCookie catch block")}},Me=function(e){var t=function(){try{var e=ie(),t=re(),n=ke()||{},r=X("zId"),o=X("last-activity-time"),i=X("ztotal-data-sent")?X("ztotal-data-sent"):"0",s=X("zenduser-last-activity-time");return{sessionId:null==n?void 0:n.sessionId,zId:r,euId:null==e?void 0:e.euId,isBlocked:null==t?void 0:t.isBlocked,sdkKey:null==n?void 0:n.sdkKey,lastActivityTime:o,totalDataSent:i,endUserLastActivityTime:s,externalId:(null==e?void 0:e.zExternalUserInfo.externalId)||""}}catch(e){return void B("inside zGetCookieDatafromLocalStorage catch block")}}();try{var n="sessionId#"+t.sessionId+",isBlocked#"+t.isBlocked+",sdkKey#"+e+",zId#"+t.zId+",euId#"+Number(t.euId)+",externalId#"+t.externalId;Le(e+h.session_data,n),Le(e+h.last_activity_time,t.lastActivityTime),Le(e+h.enduser_last_activity_time,t.endUserLastActivityTime),Le(e+h.total_data_sent,t.totalDataSent)}catch(e){return void B("inside zSetCookieDataFromLocalStorage catch block")}};function Ge(){return Date.now()}function qe(e,t,n){var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}function Je(){var e=Math.floor(Date.now()/1e3);return o()+"-"+e}function Be(e){var t={externalId:"enduser_external_id",firstName:"eu_first_name",lastName:"eu_last_name",email:"eu_email",age:"eu_age",customerName:"eu_customer_name",avatar:"eu_avatar",phone:"eu_phone"};return e in t?t[e]:e}function Ze(e,t,n){var r=e.split("//")[1];return t&&(n["X-host"]=r),n}var je,We={attributes:!0,childList:!0,characterData:!0,subtree:!0};!function(e){e[e.Progress=0]="Progress",e[e.Completed=1]="Completed",e[e.Failed=2]="Failed"}(je||(je={}));var He={domCapture:!0,consoleCapture:!0,networkCapture:!0,stackTraceCapture:!0,webSocketsCapture:!1,ipCapture:!0,inputMasking:!0,textMasking:!1,paid:!1,apiKey:"",streamUrl:"https://collector.zipy.ai",perfUrl:"https://perfcollector.zipy.ai",heatMapUrl:"https://heatmapcollector.zipy.ai",pagePerfUrl:"https://pageperfcollector.zipy.ai",customEventUrl:"https://customeventcollector.zipy.ai",maxBufferSize:5e6,compression:!0,compressionType:"gzip",timeFrequency:1e3,perfTimeFrequency:5e3,clickTimeFrequency:1e3,encodingType:"",sessionTimeout:18e5,failureRetryCount:5,bufferSizeFrequency:1048576,perfBufferSizeFrequency:1024,clickBufferSizeFrequency:1024,ignoreUrl:["google.com","zipy.ai","mixpanel","extreme-ip-lookup.com","hotjar","smartlook.com","newrelic.com","bugsnag","fullstory","sentry.io","google-analytics.com","bam.nr-data.net","wistia.com","amplitude.com","segment.io","pendo.io","raygun","smartlook.cloud","segment.com","visualstudio.com","stats.g.doubleclick.net","pagead2.googlesyndication.com","r.lr-in.com","clarity.ms","appcues.net","datadoghq.com"],ignoreError:["rrweb","zipy","Script error","pagead2.googlesyndication.com","adsbygoogle"],ignoreConsole:["{}"],isIgnoreUrlError:["google.com","zipy.ai","mixpanel","extreme-ip-lookup.com","hotjar","smartlook.com","newrelic.com","bugsnag","fullstory","sentry.io","google-analytics.com","bam.nr-data.net","wistia.com","amplitude.com","segment.io","pendo.io","raygun","smartlook.cloud","segment.com","visualstudio.com","stats.g.doubleclick.net","pagead2.googlesyndication.com","r.lr-in.com","clarity.ms","appcues.net","datadoghq.com"],isIgnoreConsoleError:["{}"],ip:"",pack:!0,blockClasses:"zipy-block",xhrReqPayloadCapture:!1,xhrRespPayloadCapture:!1,canvasCapture:!1,scrubbingKey:["password","secret","passwd","api_key","apikey","access_token","auth","credentials","mysql_pwd","stripetoken","cardnumber"],requestCapSize:1e6,responseCapSize:1e6,sizeExceededMessage:{message:"size too large",source:"zipy"},eventCountCapInSingleChunk:0,captureCustomZipyLogMessage:!1,captureCustomZipyLogError:!1,captureCustomZipyLogException:!1,startCaptureWithoutUserActivity:!1,consoleLogLevel:"3",recordCrossOriginIframes:!0,splitSessionSize:0,capturePerformance:!1,capturePagePerf:!1,captureClickEvents:!1,captureCustomEvents:!1,isApiIdentifierEnable:!1,apiUniqueIdentifier:[],ignoreUrlErrorCodes:{},ignoreUrlCodes:{},sessionStitching:!1,captureCancelledRequest:!1,clsEventCount:5,clsTimeout:3e4,xhrEventsTimeout:3e4,blockSelector:"",maxCustomEventProperties:10,maxCustomEventPayloadSize:524288,sanitizePayloadResponse:!0,captureUTM:!1};function Ve(e){return W({},e,{timestamp:Ge()})}function Ke(){try{return window.sdkConfig?window.sdkConfig:He}catch(e){return B("Failed to parse end user Info data"),He}}function Xe(e){try{var t=Ke();return t&&t.hasOwnProperty&&t.hasOwnProperty(e)?t[e]:null}catch(e){return B(e.message?JSON.stringify(e):e),null}}var Ye=function(e,t,n){return e&&e.constructor===String&&n.indexOf(e)===t},$e=function(e){return e&&e.constructor===String&&e.trim()};function Qe(){var e=Xe("headersToSanitize");return e&&e.length?e.split(","):[]}function et(e){if(!Array.isArray(e))return[];for(var t,n=[],r=j(e);!(t=r()).done;){var o=t.value;try{o&&"object"==typeof o&&JSON.stringify(o)?o.constructor.name.toLowerCase().includes("error")?n.push({message:o.message,name:o.name,stack:o.stack}):n.push(o):n.push(String(o))}catch(e){n.push("[console log value cannot be serialized]")}}return n}var tt=[];try{tt=Xe("scrubbingKey")||[]}catch(e){B("Error in obtaining scrubbing keys"),tt=He.scrubbingKey}function nt(e){try{var t=new URL(e);if(e){var n=new URLSearchParams(new URL(e).search);n.forEach(function(e,t){tt.includes(t.toLowerCase())&&n.set(t,"xxx")}),t.search=n.toString()}return t.toString()}catch(t){return B("updateQueryStringFromRequestUrl: ERROR WHILE HIDING QUERY PARAM VALUE: "+t),e}}function rt(e,t,n){n++;try{e&&"object"==typeof e&&n<=2&&Object.keys(e).forEach(function(r){tt.includes(r.toLowerCase())&&(e[r]="xxx"),t.push(r);var o=e[r];"object"==typeof o&&rt(o,t,n)})}catch(e){B("error while hiding the sensitive information: "+e)}return JSON.stringify(e)}function ot(e,t,n,r){var o=r?e.request:e.response,i=Xe(r?"xhrReqPayloadCapture":"xhrRespPayloadCapture"),s=function(t){try{r?(e.request=t,""!=e.request&&(e.requestByteSize=n)):(e.response=t,""!=e.response&&(e.responseByteSize=n))}catch(e){B("error while converting xhr data to string"+e)}};if(i){var a=Xe("responseCapSize")||1e6,c=Xe("requestCapSize")||1e6,u=r?c:a,d=Xe("sizeExceededMessage"),l=Xe("sanitizePayloadResponse");"string"==typeof o&&o.length>0?(n=n||o.length)<=u?l&&function(){try{s(rt(JSON.parse(o),[],t))}catch(t){var e=tt.some(function(e){return o.indexOf(e)>=0});s(o=r?e?"No request payload captured for this request as you may have some sensitive information in the payload.":o:e?"No response captured for this request as you may have some sensitive information in the payload.":o)}}():n>0&&s(JSON.stringify(d)):"object"==typeof o?(n=n||JSON.stringify(o,null,4).length)<=u?l&&s(rt(o,[],t)):n>0&&s(d):o&&o.length>0&&((n=n||o.length)<=u?l&&s(rt(o,[],t)):n>0&&s(JSON.stringify(d)))}else r?e.request="":e.response="";return e}function it(e){if(!e)return!1;var t=e.toLowerCase(),n=Xe("ignoreError")||[];try{if(n.some(function(e){return t.includes(e.toLowerCase())}))return q("Ignoring error for data: "+e),!0}catch(e){B("Error in ignore errors. Error - "+e.message)}return!1}function st(){try{return window.self!==window.top}catch(e){return!0}}function at(e,t){if(e&&null!=e)try{var n="";n="string"!=typeof e?JSON.stringify(e):e;for(var r=u.RangeError;r<=u.EvalError;r++)if(-1!=n.search(u[r]))return r}catch(e){B(e)}return t}function ct(e){switch(e){case"link":case"css":return u.Link;case"img":case"image":return u.Image;case"script":return u.Js;case"fetch":case"beacon":case"xmlhttprequest":return u.XHR;case"other":return u.OtherNetworkCall;default:return 0}}var ut=["img","script","css","link","image","script"];function dt(e,t,n){try{var r=Xe("isIgnoreUrlError"),o=Xe("ignoreUrl"),i=Xe("ignoreUrlErrorCodes"),s=Xe("ignoreUrlCodes"),a=[],c={};n?(a=r,c=i||{}):(a=o,c=s||{});var u=function(e,n){return!!e.includes(n.toLowerCase())&&function(e){return!c.hasOwnProperty(e)||c[e].includes(t)}(n)},d=e.toLowerCase(),l=ft(d),f=d.indexOf("?"),p=d,v=l;return f>0&&(p=p.substring(0,f),v=ft(p)),a.some(function(e){return e.includes("?")?e.includes("{id}")?u(l,e):u(d,e):e.includes("{id}")?u(v,e):u(p,e)})}catch(t){B("Error in url decoding for url : "+e+" Error is - "+t)}return!1}function lt(e){return{initiatorType:e.initiatorType,nextHopProtocol:e.nextHopProtocol,workerStart:e.workerStart,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,connectEnd:e.connectEnd,secureConnectionStart:e.secureConnectionStart,requestStart:e.requestStart,responseStart:e.responseStart,responseEnd:e.responseEnd,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,responseStatus:e.responseStatus,renderBlockingStatus:e.renderBlockingStatus,duration:e.duration,entryType:e.entryType,name:e.name,startTime:e.startTime}}function ft(e){try{var t=e.match(/\/\d+\//g);if(t)for(var n,r=j(t);!(n=r()).done;)e=e.replace(n.value,"/{id}/")}catch(e){B("Error while masking numeric value.")}return e}function pt(e,t){if(!(e.indexOf("http://")>-1||e.indexOf("https://")>-1)){var n=new URL(t);return n.pathname+n.search===e}return!1}function vt(){var e=window.navigator.userAgent;return/Mobi|Android/i.test(e)?"Mobile":/Tablet|iPad/i.test(e)?"Tablet":"Web"}function gt(e){if("online"!=(navigator.onLine?"online":"offline")){if(!window.iszInternetDisconnected)return window.iszInternetDisconnected=!0,q("handleConnectionChange :: send internet disconnected"),e(Ve({eventType:u.Offline,data:{status:"Offline",type:""},isError:!1}))}else var t=setInterval(function(){fetch("//google.com",{mode:"no-cors"}).then(function(){return window.iszInternetDisconnected&&(window.iszInternetDisconnected=!1,q("handleConnectionChange :: send internet connected"),e(Ve({eventType:u.Online,data:{status:"Online",type:""},isError:!1}))),clearInterval(t)}).catch(function(){window.iszInternetDisconnected||(window.iszInternetDisconnected=!0,q("handleConnectionChange :: send internet disconnected"),e(Ve({eventType:u.Offline,data:{status:"Offline",type:""},isError:!1})))})},5e3)}var mt,yt=function(e){try{var t,n=function(n,r){try{var o="string"==typeof e.data.response?(t=1,e):"xmlHttpClient"===e.data.sourceLibrary&&"Blob"===(null==(i=e.data.response)||null==(i=i.constructor)?void 0:i.name)?Promise.resolve(new Response(e.data.response).text()).then(function(t){e.data.response=t}):function(){if("fetch"===e.data.sourceLibrary&&e.data.response instanceof Promise)return Promise.resolve(e.data.response).then(function(t){e.data.response=t});throw new Error("Unsupported response type: "+typeof e.data.response)}()}catch(e){return r(e)}var i;return o&&o.then?o.then(void 0,r):o}(0,function(t){B("Error in resolving response. Error is - "+t.message),e.data.response=""});return Promise.resolve(n&&n.then?n.then(function(n){return t?n:e}):t?n:e)}catch(e){return Promise.reject(e)}};function wt(e){try{return window.sessionStorage.getItem(e)||""}catch(e){return B("inside zSessionStorageGetItem catch block "+e.message),""}}function ht(e,t){try{window.sessionStorage.setItem(e,t)}catch(e){console.error("inside zSessionStorageSetItem catch block "+e.message)}}var Et=/*#__PURE__*/function(){function e(){this.dataSync=void 0,this.sdkTimer=void 0,this.dataSync=x.IDLE,this.sdkTimer=A.START}return e.prototype.isDataProcessingDone=function(){var e=this;return new Promise(function(t,n){var r=setInterval(function(){e.dataSync!==x.PENDING&&(t(!0),clearInterval(r))},1)})},e.getInstance=function(){return this.instance||(this.instance=new e),this.instance},e}();Et.instance=void 0;var St=function(e,t,n){void 0===t&&(t=0);try{var r={v:_.sdkVersion,e:"Production",o:t,ns:n};if(t==f.POSTENDUSERINFOANDGETUSERCONFIG||t==f.GETUSERCONFIG){var o=ee();window.sdkConfig=o||He}var i=re(),s=Q.getInstance();if(i&&i.isBlocked)return G("Not going to call post end user info as session is already blocked"),Promise.resolve(window.sdkConfig);window.iszHandshakeDone=!1,window.zpendingOp=t,q("config.sdkversion"+_.sdkVersion);var a=se()||{zAnonymsUserInfo:{}},c={},u=p.ANONYMS;if(a){var d,l=a.zExternalUserInfo||{};for(var v in l)c[Be(v)]=l[v]?l[v]:"";c.enduser_zipy_id=null==(d=a.zAnonymsUserInfo)?void 0:d.zId,l.externalId&&(G("Get User info for user Type Identified "+l.externalId),u=p.IDENTIFIED)}return window.ztryForHandshake=!1,Promise.resolve(ye(_.streamMgrUrl+"/"+e,_.streamMgrRetryCount,r,c)).then(function(n){if(n)if((null==n?void 0:n.api_key)==e){var r=re(),o=ke()||{},i=!(null==n||!n.is_blocked)&&(null==n?void 0:n.is_blocked);if(s.sessionId=o.sessionId,s.apiKey=o.sdkKey,s.isNewSession=o.isNewSession,s.isSessionExpired=!1,s.lastActivityTime=Date.now(),s.enduserLastActivityTime=Date.now(),s.sessionBlockInfo=r,r&&(r.isBlocked||function(e,t){var n,r=(null==e?void 0:e.blocked_till)>0?null==e?void 0:e.blocked_till:0,o=r>0?Ge()+r:0,i=!(null==e||!e.is_blocked)&&(null==e?void 0:e.is_blocked);Q.getInstance().sessionBlockInfo=n={isBlocked:i,apiKey:t,blockedEndTime:o},te(n)}(n,e)),i)return window.sdkConfig;if(t==f.POSTENDUSERINFOANDGETUSERCONFIG||t==f.GETUSERCONFIG){var c=Pt(n);window.iszHandshakeDone=!0,G("sdkConfigResp"+JSON.stringify(c)),c&&(window.sdkConfig=c)}if(t==f.POSTENDUSERINFOANDGETUSERCONFIG||t==f.POSTENDUSERINFO){var d=n.enduser_info||{};G("Response object received for End User from stream manager: "+JSON.stringify(d)),d&&(G("Going to add enduser info after data parsing"),a.userType=u,a.euId=d.id?d.id:0,a.euZName=d.zipy_eu_name?d.zipy_eu_name:"",a.isBlocked=!!d.is_blocked&&d.is_blocked,u==p.ANONYMS&&(a.zAnonymsUserInfo.euId=a.euId,a.zAnonymsUserInfo.euZName=a.euZName,a.zExternalUserInfo={}),ae(a),ue())}}else B("Not able to get response from stream manager for sdk Key: "+e);else B("Not able to get response from stream manager ");return window.sdkConfig})}catch(e){return Promise.reject(e)}},It=function(e){try{var t,n=Ke(),r=window.zCustomEventData||[],o=ve.getInstance(),i="";try{i=JSON.stringify(r)}catch(e){B("Failed to stringify zEvents")}var s=r.length,a=function(){if(2*i.length>=n.bufferSizeFrequency||window.customEventLastSynctime+n.timeFrequency<=Date.now()&&s>0){var a=r.slice(0,s),c=ke()||{},d={key:e,s_id:c.sessionId,events:a,eventType:u.CustomEvent},l=(o.proxyURL?o.proxyURL:n.customEventUrl)+"/customevent";return Ce()?(window.isDataSyncInProgress=!0,Promise.resolve(me(l,d,n.failureRetryCount)).then(function(e){if(e)return window.customEventLastSynctime=Date.now(),function(e){window.zCustomEventData&&Array.isArray(window.zCustomEventData)?window.zCustomEventData.splice(0,e):window.zCustomEventData=[]}(s),window.isDataSyncInProgress=!1,t=!0;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(a&&a.then?a.then(function(e){return!t||e}):!t||a)}catch(e){return Promise.reject(e)}},zt=function(e){try{var t,n=Ke(),r=window.zPagePerfData||[],o="",i=ve.getInstance();try{o=JSON.stringify(r)}catch(e){B("Failed to stringify zEvents")}var s=r.length,a=function(){if(2*o.length>=n.perfBufferSizeFrequency||window.pagePerfLastSynctime+n.perfTimeFrequency<=Date.now()&&s>0){var a,c,d=r.slice(0,s),l=ke()||{},f=ie()||{},p=X("zId"),v=null!=(a=f.zExternalUserInfo)&&a.externalId?null==(c=f.zExternalUserInfo)?void 0:c.externalId:"",g=/\((.*)\)/.exec((new Date).toString())[1],m=Re(),y={key:e,sdk_ver:_.sdkVersion,src:"Frontend",s_id:l.sessionId,euz_id:p,eue_id:v,events:d,eu_info_id:f.euId,rel_ver:window.zRelVer,handshake_status:window.iszHandshakeDone,ip:n.ip,deviceName:vt()||"",userAgent:window.navigator.userAgent,timeZone:g,eventType:u.WebVitals,pack:m},w=(i.proxyURL?i.proxyURL:n.pagePerfUrl)+"/pageperf";return Ce()?(window.isDataSyncInProgress=!0,Promise.resolve(we(w,y,n.failureRetryCount)).then(function(e){if(e)return window.pagePerfLastSynctime=Date.now(),function(e){window.zPagePerfData&&Array.isArray(window.zPagePerfData)?window.zPagePerfData.splice(0,e):window.zPagePerfData=[]}(s),window.isDataSyncInProgress=!1,t=!0;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(a&&a.then?a.then(function(e){return!t||e}):!t||a)}catch(e){return Promise.reject(e)}},Ct=function(e){try{var t,n=Ke(),o=window.zClickEventsData||[],i=ve.getInstance(),s="";try{s=JSON.stringify(o)}catch(e){B("Failed to stringify zEvents")}var a=o.length,c=function(){if(2*s.length>=n.bufferSizeFrequency||window.clickLastSyncTime+n.timeFrequency<=Date.now()&&a>0){var c,u,d=o.slice(0,a),l=ke()||{},f=ie()||{},p=X("zId"),v=null!=(c=f.zExternalUserInfo)&&c.externalId?null==(u=f.zExternalUserInfo)?void 0:u.externalId:"",g=/\((.*)\)/.exec((new Date).toString())[1],m=Re(),y={key:e,sdk_ver:_.sdkVersion,src:"Frontend",s_id:l.sessionId,euz_id:p,eue_id:v,events:d,eu_info_id:f.euId,rel_ver:i.releaseVer,handshake_status:window.iszHandshakeDone,ip:n.ip,deviceName:vt()||"",userAgent:window.navigator.userAgent,timeZone:g,eventType:r.Click,pack:m},w=(i.proxyURL?i.proxyURL:n.heatMapUrl)+"/heatmap";return Ce()?(window.isDataSyncInProgress=!0,Promise.resolve(he(w,y,n.failureRetryCount)).then(function(e){if(e)return window.clickLastSyncTime=Date.now(),function(e){window.zClickEventsData&&Array.isArray(window.zClickEventsData)?window.zClickEventsData.splice(0,e):window.zClickEventsData=[]}(a),window.isDataSyncInProgress=!1,t=!0;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(c&&c.then?c.then(function(e){return!t||e}):!t||c)}catch(e){return Promise.reject(e)}},Tt=function(e){try{var t,n=Ke(),r=ve.getInstance();q("Data Length for direct streaming ");var o=window.zEventsPerfData||[],i=o.length,s=function(){if(2*o.length>=n.perfBufferSizeFrequency||window.perfLastSyncTime+n.perfTimeFrequency<=Date.now()&&i>0){var s,a,c=o.slice(0,i),u=ke()||{},d=ie()||{},l=X("zId"),f=null!=(s=d.zExternalUserInfo)&&s.externalId?null==(a=d.zExternalUserInfo)?void 0:a.externalId:"",p=/\((.*)\)/.exec((new Date).toString())[1],v={key:e,sdk_ver:_.sdkVersion,isNPM:_.isNPM,src:"Frontend",s_id:u.sessionId,euz_id:l,eue_id:f,events:c,eu_info_id:d.euId,rel_ver:r.releaseVer,handshake_status:window.iszHandshakeDone,ip:n.ip,deviceName:"",screenWidth:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,screenHeight:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,userAgent:window.navigator.userAgent,timeZone:p},g=(r.proxyURL?r.proxyURL:n.perfUrl)+"/perf";return Ce()?(window.isDataSyncInProgress=!0,Promise.resolve(Ee(g,v,n.failureRetryCount)).then(function(e){if(e)return window.perfLastSyncTime=Date.now(),n=i,window.zEventsPerfData&&Array.isArray(window.zEventsPerfData)?window.zEventsPerfData.splice(0,n):window.zEventsPerfData=[],window.isDataSyncInProgress=!1,t=!0;var n;window.isDataSyncInProgress=!1})):(t=1,!1)}}();return Promise.resolve(s&&s.then?s.then(function(e){return!t||e}):!t||s)}catch(e){return Promise.reject(e)}},kt=function(e){try{var t=Ke(),n=window.zEventsData||[],r=ve.getInstance(),o=Q.getInstance(),i=Et.getInstance();q("Data Length for direct streaming ");var s="";try{s=JSON.stringify(n)}catch(e){B("Failed to stringify zEvents")}var a=null!=t&&t.eventCountCapInSingleChunk?t.eventCountCapInSingleChunk:0,c=a>0&&n.length>a?a:n.length;if(window.lastSyncDataLength=c,G("Going to send data with chunk "+c+" total events count "+n.length+" chunk size "+a),2*s.length>=t.bufferSizeFrequency||window.lastSyncTime+t.timeFrequency<=Date.now()&&c>0){var u,d,l=n.slice(0,c),f=ke()||{},p=ie()||{},v=X("zId"),g=null!=(u=p.zExternalUserInfo)&&u.externalId?null==(d=p.zExternalUserInfo)?void 0:d.externalId:"",m=/\((.*)\)/.exec((new Date).toString())[1],y=Re(),w={key:e,sdk_ver:_.sdkVersion,isNPM:_.isNPM,src:"Frontend",s_id:f.sessionId,euz_id:v,eue_id:g,events:l,eu_info_id:p.euId,rel_ver:r.releaseVer,handshake_status:window.iszHandshakeDone,ip:t.ip,deviceName:"",screenWidth:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,screenHeight:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,userAgent:window.navigator.userAgent,timeZone:m,pack:y},h="";try{h=JSON.stringify(w)}catch(e){B("Failed to stringify zipyDataJson")}var E={eventData:h};if(Dt())return function(){for(;window.zEventsData.length;)window.zEventsData.pop();window.zEventsData=[]}(),Promise.resolve(!0);var S={session_id:f.dSession,event_id:"AruZ~Em0WNlAnbyzVmwM~GR0cMb6Xl9r",is_new_party:f.isNewSession,is_new_session:f.isNewSession,client_timestamp_iso:(new Date).toISOString(),event_type:"MyEventRecord",parameters:E},I=(r.proxyURL?r.proxyURL:t.streamUrl)+"?p="+f.sessionId;return Ce()?(window.isDataSyncInProgress=!0,i.dataSync=x.PENDING,Promise.resolve(Se({divolteUrl:I,divolteJson:S,failureRetryCount:t.failureRetryCount})).then(function(e){if(e){if(window.lastSyncTime=Date.now(),function(e){window.zEventsData&&Array.isArray(window.zEventsData)?window.zEventsData.splice(0,e):window.zEventsData=[]}(c),window.isDataSyncInProgress=!1,i.dataSync=x.SUCCESS,Y("last-activity-time",o.lastActivityTime.toString()),Y("zenduser-last-activity-time",o.enduserLastActivityTime.toString()),f.isNewSession){var t=ke();if(t){t.isNewSession=!1,o.isNewSession=!1;try{Y("session-data",JSON.stringify(t))}catch(e){B("Failed to set session-data in localstorage")}}}return!0}return window.isDataSyncInProgress=!1,i.dataSync=x.FAILED,!1})):(Y("last-activity-time",o.lastActivityTime.toString()),Y("zenduser-last-activity-time",o.enduserLastActivityTime.toString()),i.dataSync=x.FAILED,Promise.resolve(!1))}return Promise.resolve(!1)}catch(e){return Promise.reject(e)}};function Nt(o,c){void 0===o&&(o=He.inputMasking);var d=ve.getInstance(),l=Q.getInstance();q("Going to init rrweb Recorder"),window.zrrwebRecorderStatus=v.RECORDINGPENDING;var f,p=function(){};try{var g=Ke();p=e({emit:function(e,o){if(!st()||d.recordOnlyIframe){var c=-1;e.type!=t.IncrementalSnapshot?c=u.ReplayerEvent:(c=e.data.source?e.data.source:u.ReplayerEvent,(g.startCaptureWithoutUserActivity||c>=u.MouseInteraction&&c<=u.MediaInteraction)&&(window.zrrwebRecorderStatus=v.RECORDINGSUCCESSFUL,l.enduserLastActivityTime=Date.now()));try{var f=!1;window.reinitializationInProgress||(f=Re());var p={data:f?n(e):JSON.stringify(e),time:e.timestamp,type:c,rrwebEvent:null==e?void 0:e.type,isError:!1,navigatedUrl:window.location.origin+window.location.pathname};if(o&&e.type==t.Meta?(l.isCheckoutFlowTriggered=!0,J("Checkout flow is triggered. Meta event expected type - "+t.Meta+" actual event "+e.type),p.isCheckout=o):o&&J("Full snapshot event. Expected event type - "+t.FullSnapshot+" Event type "+e.type),Rt(p),t.IncrementalSnapshot&&c===u.MouseInteraction&&g.captureClickEvents){var m=e.data;if(m.type&&m.type===r.Click){var y=function(e){G("Heatmap: Pack event");try{var t=JSON.stringify(e),n=i(t),r=s(n);return a(r,!0)}catch(e){return G("Heatmap: Unable to pack the data"),""}}(m);!function(e){var t=Ke();window.zrecordingPaused||Dt()&&!Ne(t)||Ce()&&t.captureClickEvents&&window.zClickEventsData.push(e)}({data:y,time:e.timestamp,type:m.type,isError:!1})}}}catch(e){B("Failed to store rrweb recorder events")}}},recordCanvas:Xe("canvasCapture"),blockClass:(f=Xe("blockClasses"),f&&"string"==typeof f?new RegExp(f):f instanceof RegExp?f:/zipy-block/),blockSelector:Xe("blockSelector"),ignoreClass:"zipy-ignore",maskAllInputs:o,sampling:{mousemove:150,scroll:150,mouseInteraction:{MouseUp:!0,MouseDown:!0,Click:!0,ContextMenu:!1,DblClick:!0,Focus:!1,Blur:!1,TouchStart:!0,TouchEnd:!0}},userTriggeredOnInput:!0,recordCrossOriginIframes:!d.recordOnlyIframe,captureClickEvents:g.captureClickEvents||!1,maskAllText:g.textMasking})}catch(e){B(e)}return p}function bt(e){var t=Q.getInstance();return q("Going to init zipy Recorder"),function(e){void 0===e&&(e={});var t=e.emit;if(!t)return B("emit function is required to record data from zipy-event-recorder"),function(){};mt=function(e){t(e)};try{var n=[],r=Ke();return n.push(r.capturePagePerf?function(e){var t="",n=window.history.pushState,r=window.history.replaceState;if(window.history.pushState=function(){n.apply(window.history,arguments),window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange"))},window.history.replaceState=function(){r.apply(window.history,arguments),window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange"))},window.PerformanceObserver&&"function"==typeof window.PerformanceObserver){var o=function(n){var r=n.loadTime,o=n.navigationType,i=n.isRouteChange,s=n.navigationUrl,a=void 0===s?"":s,c=n.eventType;try{var u={navigatedUrl:a||window.location.href,loadTime:r,navigationType:o,isRouteChange:i};t!==a&&(e(Ve({eventType:c,data:u,isError:!1})),u.loadTime>-1&&(t=u.navigatedUrl))}catch(e){B("not able to capture the navigation url")}},i=function(){o({loadTime:-1,navigationType:"navigate",isRouteChange:!0,navigationUrl:window.location.href,eventType:u.NavigationStart});var e=0,t=0,n=null,r=1,i=window.location.href,s=new PerformanceObserver(function(e){e.getEntries().filter(function(e){return"fetch"!==e.initiatorType&&"xmlhttprequest"!==e.initiatorType}).forEach(function(e){t=performance.now()})}),a=new MutationObserver(function(){try{return t=performance.now(),Promise.resolve()}catch(e){return Promise.reject(e)}});e=performance.now(),t=performance.now(),s.observe({entryTypes:["resource"]}),a.observe(document,We),r>0&&(r=0,n=setInterval(function(){performance.now()-t>100&&(clearInterval(n),function(){s.disconnect(),a.disconnect(),n&&clearInterval(n);var c=t-e;q("Page Performance Observer: Page Load Time:"),o({loadTime:c,navigationType:"navigate",isRouteChange:!0,navigationUrl:i,eventType:u.NAVIGATION}),e=0,t=0,n=null,r=1}())},1e3))};window.buffered||o({loadTime:-1,navigationType:"current",isRouteChange:!1,navigationUrl:window.location.href,eventType:u.NAVIGATION});var s=new PerformanceObserver(function(e){var t=e.getEntries().find(function(e){return"navigation"===e.entryType});if(t){var n=t.name,r=t.loadEventEnd-t.startTime;r>0&&(q("Page Performance: Initial Page Load Time:"),o({loadTime:r,navigationType:t.type,isRouteChange:!1,navigationUrl:n,eventType:u.NAVIGATION}))}});return s.observe({type:"navigation",buffered:window.buffered}),window.addEventListener("locationchange",i,!1),window.addEventListener("popstate",i),window.addEventListener("hashchange",i),function(){history.pushState=n,history.replaceState=r,window.removeEventListener("locationchange",i),window.removeEventListener("popstate",i),window.removeEventListener("hashchange",i),s.disconnect()}}return function(){}}(mt):function(e){var t=location.href,n=performance.getEntriesByType("navigation")[0],r={navigatedUrl:window.location.href,loadTime:-1,navigationType:window.location.href===(null==n?void 0:n.name)?"reload":"navigate",isRouteChange:!1};e(Ve({eventType:u.NAVIGATION,data:r,isError:!1}));var o=window.history.pushState,i=window.history.replaceState;function s(){try{var r={navigatedUrl:window.location.href,loadTime:-1,navigationType:window.location.href===(null==n?void 0:n.name)?"reload":"navigate",isRouteChange:!0};t!=r.navigatedUrl&&(e(Ve({eventType:u.NAVIGATION,data:r,isError:!1})),t=r.navigatedUrl)}catch(e){B("not able to capture the navigation url")}}return window.history.pushState=function(){o.apply(window.history,arguments),window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange"))},window.history.replaceState=function(){i.apply(window.history,arguments),window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange"))},window.addEventListener("locationchange",s,!1),window.addEventListener("popstate",s),window.addEventListener("hashchange",s),function(){history.pushState=o,history.replaceState=i,window.removeEventListener("locationchange",s),window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s)}}(mt)),G("In zipy-event-record "+JSON.stringify(r)),r.consoleCapture&&n.push(function(e){function t(e){var t="";if("string"!=typeof e)try{t=JSON.stringify(e)}catch(e){}else t=e;try{if(-1!=t.search(g)||-1!=t.search(m))return!0}catch(e){return!0}return!1}function n(t,n){try{var r;r=function(e){if(!Array.isArray(e))return"";for(var t,n=[],r=j(e);!(t=r()).done;){var o=t.value;try{o&&"object"==typeof o&&o instanceof Error?n.push(String(o)):n.push(new Error(JSON.stringify(o)))}catch(e){n.push("[console log value cannot be serialized]")}}return n.join(" ")}(Array.from(n));var o=t==u.ConsoleError,i=o?function(e){if(!Array.isArray(e))return{hasErrorObj:!1};for(var t,n=j(e);!(t=n()).done;){var r=t.value;try{if(r&&"object"==typeof r&&(r.constructor.name.toLowerCase().includes("error")||(null==r?void 0:r.name).toLowerCase().includes("error")))return{hasErrorObj:!0,errObj:r}}catch(e){B("Error in checking error argument. Error is - "+e.message)}}return{hasErrorObj:!1}}(Array.from(n)):{hasErrorObj:!1};if(function(e,t,n){if(null==e)return!1;var r,o=e.toLowerCase(),i=Ke();if(n[0]instanceof Error&&it(o))return!0;try{r=t?i.isIgnoreConsoleError:i.ignoreConsole}catch(e){B(e)}try{if(r.some(function(e){return o.includes(e.toLowerCase())&&function(e){try{var t=JSON.parse(e.split("error:")[1]);return Object.keys(t).length<1||"{}"===t}catch(e){return!0}}(o)}))return!0}catch(e){return!1}return!1}(r,o,n))return;if(o&&i.hasErrorObj){var s={message:r,error:i.errObj.stack,filename:"",colno:0,lineno:0};e(Ve({eventType:at(r,u.Error),data:s,isError:!0}))}else e(Ve({eventType:t,data:{arguments:r,argumentsObj:et(Array.from(n))},isError:o}))}catch(e){return void B("Error in parsing console log. Error is: "+e.message)}}try{var r,o,i,s,a;a=Ke().consoleLogLevel.split(",");try{a.includes(y.ERROR)&&(r=console.error.bind(console),console.error=function(){t(arguments[0])||n(u.ConsoleError,arguments),r.apply(console,arguments)})}catch(e){B("Error in parsing console error. Error is: "+e.message)}try{a.includes(y.LOG)&&(o=console.log.bind(console),console.log=function(){t(arguments[0])||n(u.ConsoleInfo,arguments),o.apply(console,arguments)})}catch(e){B("Error in parsing console log. Error is: "+e.message)}try{a.includes(y.WARNING)&&(i=console.warn.bind(console),console.warn=function(){t(arguments[0])||n(u.ConsoleWarning,arguments),i.apply(console,arguments)})}catch(e){B("Error in parsing console warning. Error is: "+e.message)}try{a.includes(y.DEBUG)&&(s=console.debug.bind(console),console.debug=function(){t(arguments[0])||n(u.ConsoleDebug,arguments),s.apply(console,arguments)})}catch(e){B("Error in parsing console debug. Error is: "+e.message)}return function(){r&&(console.error=r),o&&(console.log=o),i&&(console.warn=i),s&&(console.debug=s)}}catch(e){return B("Error while getting console log level from sdk config. Error is: "+e.message),function(){}}}(mt)),r.stackTraceCapture&&n.push(function(e){var t=[qe("error",function(t){!function(e,t){var n=e.message,r=e.filename,o=e.lineno,i=e.colno;if(it(n)||it(r))q("Ignoring error from error callback "+n);else if(e.error){var s,a,c;if(it(null==(s=e.error)?void 0:s.stack))return void q("Ignoring error from error callback "+(null==(c=e.error)?void 0:c.stack));var d,l=null==(a=e.error)?void 0:a.stack;try{d="string"!=typeof l?JSON.stringify(l):l}catch(e){B("Failed to stringfy errorMsg inside error callback with exception"+e)}var f={message:n,filename:r,lineno:o,colno:i,error:d};t(Ve({eventType:at(n,u.Error),data:f,isError:!0}))}else{if((null==n||""==n)&&_.ignoreEmptyErros)return void q("Ignored empty error");var p={message:n,filename:r,lineno:o,colno:i,error:""};t(Ve({eventType:at(n,u.Error),data:p,isError:!0}))}}(t,e)},window)];return t.push(qe("unhandledrejection",function(t){var n,r="reason"in t?null==t?void 0:t.reason:t,o=null!=t&&t.reason.stack?t.reason.stack:t;try{n="string"!=typeof o?JSON.stringify(o):o}catch(t){B("Failed to stringfy errorMsg inside unhandledrejection callback with exception"+t)}var i={message:""+r,error:n,filename:"",colno:0,lineno:0};if(null!=r&&""!=r||""!=i.error&&null!=i.error||!_.ignoreEmptyErros){var s="";try{s=JSON.stringify(i.error)}catch(t){B("Failed to stringfy exception")}it(i.message)||it(s)?q("Ignoring error from unhandled "+r):e(Ve({eventType:at(r,u.UnhandledRejection),data:i,isError:!0}))}else q("Ignoring empty errors")},window)),function(){t.forEach(function(e){return e()})}}(mt)),r.networkCapture&&(n.push(function(e){var t=0;function n(e,n){if(Xe("networkCapture")&&!window.stopRecording&&!dt(n.requestUrl,n.status,n.status>=400)){n.requestUrl=nt(n.requestUrl);var r=Ke();if(r&&r.isApiIdentifierEnable&&r.apiUniqueIdentifier.length>0){var o=r.apiUniqueIdentifier.filter(function(e){return e.apiUrl===n.requestUrl});o.length>0&&(n.apiIdentifier=function(e,t){try{var n=JSON.parse(e);if(n&&"object"==typeof n)for(var r=Object.keys(n),o=0,i=r;o<i.length;o++){var s=i[o];if(s===t)return"string"==typeof n[s]?n[s]:""}}catch(e){B("error while parsing api payload: "+e)}return""}(n.request,o[0].identifierName))}G("Pushing fetch Data when performance is enabled "+(n=ot(n,t,n.requestByteSize||0,!0)).requestUrl),window.zFetchTempData.push({eventType:e,data:n,isError:n.status>=400})}}function r(e,t){if("GET"==t||"get"==t)try{var n=e.split("/"),r=n[n.length-1];if(""==r&&n.length>=2&&(r=n[n.length-2]),-1!=r.indexOf(".js")&&!r.indexOf(".json")||-1!=r.indexOf(".map")||-1!=r.indexOf(".html")||-1!=r.indexOf(".css"))return G("Going to ignore response text for url "+e),!0}catch(e){return!1}return!1}if(null!=window.zxhrInit||1==window.zxhrInit)return G("Network in already initialized"),function(){};var o=window.XMLHttpRequest.prototype.open;window.XMLHttpRequest.prototype.open=function(){var e="";null!=arguments[1]&&null!=arguments[1]&&("string"==typeof arguments[1]?e=arguments[1]:arguments[1]instanceof URL&&(e=arguments[1].href));var t,i,c={request:"",requestMethod:arguments[0]?arguments[0]:"",requestUrl:e,sourceLibrary:"xmlHttpClient",headers:{},response:"",responseHeaders:{},status:400,requestStartTime:0,duration:0,requestByteSize:0,responseByteSize:0},d=this.send;this.send=function(){c.requestStartTime=Date.now(),c.request=arguments[0]?arguments[0]:"",c=ot(c,0,0,!0),d.apply(this,arguments)};var l=this.setRequestHeader;this.setRequestHeader=function(){var e,t;2!==arguments.length||(e=arguments[0],(t=Qe()).length>0&&t.indexOf(e)>-1)||(c.headers[arguments[0]]=arguments[1]),l.apply(this,arguments)},this.addEventListener("load",function(){try{var o=this;if(t=Date.now(),!r(e,c.requestMethod))try{var s,d=a(o),l=d["content-length"]?d["content-length"]:0;c.responseHeaders=d,"blob"===(null==o?void 0:o.responseType)?(l=l||(null==o||null==(s=o.response)?void 0:s.size),i=null==o?void 0:o.response):(i=null!=o&&o.responseText?o.responseText:"",l=l||i.length),c.responseByteSize=l,c.response=i}catch(e){q("Error while capturing response text")}return c.status=o.status,c.duration=t-c.requestStartTime,n(u.XHR,c),Promise.resolve()}catch(e){return Promise.reject(e)}}),this.addEventListener("error",function(){if(t=Date.now(),!r(e,c.requestMethod))try{var o,s=a(this),d=s["content-length"]?s["content-length"]:0;c.responseHeaders=s,"blob"===(null==this?void 0:this.responseType)?(d=d||(null==this||null==(o=this.response)?void 0:o.size),i=null==this?void 0:this.response):(i=null!=this&&this.responseText?this.responseText:"",d=d||i.length),c.responseByteSize=d,c.response=i}catch(e){q("Error while capturing response text")}c.status=this.status?this.status:404,c.duration=t-c.requestStartTime,n(u.XHR,c)}),this.addEventListener("abort",function(){G("Request got aborted in fetch"),s(c,e,this)}),this.addEventListener("timeout",function(){G("Request got timeout"),s(c,e,this)}),o.apply(this,arguments)};var i=window.fetch;return window.fetch=function(){var e,t,o,s,a="",c={sourceLibrary:"fetch",requestUrl:"",requestMethod:"",headers:"",request:"",response:"",responseHeaders:{},status:400,requestStartTime:0,duration:0,requestByteSize:0,responseByteSize:0};c.requestStartTime=Date.now(),null!=arguments[0]&&null!=arguments[0]&&(a="string"==typeof(e=arguments[0])?e:e?e instanceof URL?e.href:e instanceof Request?e.url:"":"");try{if(null!=arguments[1]&&null!=arguments[1]){var d=arguments[1].body;d&&(c.requestByteSize=JSON.stringify(d,null,4).length)}}catch(e){B("error while capturing data length")}try{arguments[1]&&arguments[1].headers&&(t=W({},arguments[1].headers))}catch(e){B("header is not present in the call")}c=ot(c={sourceLibrary:"fetch",requestUrl:a||"",requestMethod:arguments[1]&&arguments[1].method?arguments[1].method:"GET",headers:t?(o=t,s=Qe(),s.length>0?(s.forEach(function(e){return delete o[e]}),o):o):"",request:arguments[1]&&arguments[1].body?arguments[1].body:"",response:"",responseHeaders:{},status:400,duration:0,requestByteSize:0,responseByteSize:0,requestStartTime:c.requestStartTime},0,0,!0);var l=i.apply(window,arguments);return new Promise(function(e,t){var o={status:400},i=0;l.then(function(t){o={status:t.status};for(var s,d=j(t.headers);!(s=d()).done;){var l=s.value;l&&(c.responseHeaders[l[0]]=l[1],!i&&l[0]&&"content-length"==l[0].toLowerCase()&&(i=l[1]))}var f=Date.now(),p=Xe("xhrRespPayloadCapture");if(!r(a,c.requestMethod)&&o.status>=400||p){var v=t.clone(),g=null;try{if(window.TextDecoder&&v&&v.body){var m=v.body.getReader(),y=new TextDecoder("utf-8"),w="";g=m.read().then(function e(t){var n=t.done,r=t.value,o=r?y.decode(r,{stream:!0}):"";return w+=o,n?w:m.read().then(e)})}else g=v.text()}catch(e){B("Not able to extract fetch response: "+e.message)}c.response=g,c.responseByteSize=i}c.duration=f-c.requestStartTime,c.status=o.status,n(u.XHR,c),e(t.clone())}).catch(function(r){var o=Ke();if("AbortError"===r.name&&o.captureCancelledRequest){var i=Date.now();c.status=P,c.duration=i-c.requestStartTime,n(u.XHR,c),e(r)}B("Error in fetch response: "+r.message),t(r)})})},window.zxhrInit=!0,function(){};function s(e,t,o){var i,s;if(Ke().captureCancelledRequest){if(!r(t,e.requestMethod))try{i=Date.now();var c,d=a(o),l=d["content-length"]?d["content-length"]:0;e.responseHeaders=d,"blob"===(null==o?void 0:o.responseType)?(l=l||(null==o||null==(c=o.response)?void 0:c.size),s=null==o?void 0:o.response):(s=null!=o&&o.responseText?o.responseText:"",l=l||s.length),e.responseByteSize=l,e.response=s}catch(e){q("Error while capturing response text")}e.duration=i-e.requestStartTime,e.status=null!=o&&o.status?null==o?void 0:o.status:P,n(u.XHR,e)}}function a(e){var t=e.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};return t&&t.length&&t.forEach(function(e){try{if(""!==e){var t=null==e?void 0:e.split(": "),r=null==t?void 0:t.shift(),o=null==t?void 0:t.join(": ");n[r]=o||""}}catch(e){B("Error in extracting response headers: "+e.message)}}),n}}()),n.push(function(e){var t=[qe("online",function(t){gt(e)},window)];return t.push(qe("offline",function(t){gt(e)},window)),function(){t.forEach(function(e){return e()})}}(mt))),n.push(function(e){var t=[];return t.push(qe(S,function(t){try{var n=null==t?void 0:t.detail,r=n.message,o=n.options,i=void 0===o?{}:o;q("Capturing log message for message : "+r+" options: "+JSON.stringify(i)),r&&i&&i.constructor===Object?e(Ve({eventType:u.ZipyLogMessage,data:{message:r.length<C?r:r.substring(0,C),options:i},isError:!1})):G("Didn't capture log message for message : "+r+" options: "+JSON.stringify(i))}catch(e){B("Error in capturing log message. Error is - "+e.message)}},window)),t.push(qe(I,function(t){try{var n,r=(null==(n=t.detail)?void 0:n.error)||{},o=r.message,i=r.name,s=void 0===i?"":i,a=r.filename,c=void 0===a?"":a,d=r.lineno,l=void 0===d?0:d,f=r.colno,p=void 0===f?0:f,v=r.cause,g=void 0===v?"":v,m=r.stack,y=void 0===m?"":m;if(g=g?String(g):"",q("Capturing exception message for message : "+o+" name: "+s+" stack: "+y),it(o)||it(s))return void q("Ignoring exception logs for message: "+o);o?e(Ve({eventType:u.ZipyLogException,data:{message:o,name:s,filename:c,lineno:l,colno:p,cause:g,stack:y},isError:!0})):G("Didn't capture exception message for message : "+o+" name: "+s)}catch(e){B("Error in capturing log message. Error is - "+e.message)}},window)),t.push(qe(z,function(t){try{var n=null==t?void 0:t.detail,r=n.name,o=n.message,i=void 0===o?"":o,s=n.category,a=void 0===s?"FE":s,c=n.options,d=void 0===c?{}:c;if(q("Capturing exception message for message : "+i+" name: "+r),it(i)||it(r))return void q("Ignoring error logs for message: "+i);i&&r&&d&&d.constructor===Object?e(Ve({eventType:"NE"===a?u.ZipyLogNetworkError:u.ZipyLogFrontendError,data:{message:i.length<C?i:i.substring(0,C),name:r,category:a,options:d},isError:!0})):G("Didn't capture error message for message : "+i+" name: "+r+" category:"+a+" options: "+JSON.stringify(d))}catch(e){B("Error in capturing log message. Error is - "+e.message)}},window)),function(){t.forEach(function(e){return e()})}}(mt)),n.push(function(e){if(window.PerformanceObserver&&"function"==typeof window.PerformanceObserver){var t=new PerformanceObserver(function(t){var n=t.getEntries();G("perf event size is - "+n.length),B("Perf entires"),B(n.filter(function(e){return"fetch"==e.initiatorType||"xmlhttprequest"==e.initiatorType}));for(var r,o=j(n);!(r=o()).done;){var i=r.value;try{var s=ct(i.initiatorType);if(s===u.XHR&&window.zFetchTempData&&window.zFetchTempData.length>0)for(var a=[].concat(window.zFetchTempData)||[],c=function(t){var n;B("Compare tempData[j].data?.requestUrl {} and entries[i].name"),G("Merging XHR calls");var r=(null==(n=a[t].data)?void 0:n.requestUrl)||"",o=nt(i.name)||"";if(o&&r&&decodeURIComponent(r)===decodeURIComponent(o)||pt(r,o)){var s,c,d,l;G("INSIDE :: Compare xhrUrl "+r+" and perfURL "+o);var f=lt(i);f.responseStatus=i.responseStatus?i.responseStatus:null==(s=a[t].data)?void 0:s.status,f.transferSize=i.transferSize?i.transferSize:null==(c=a[t].data)?void 0:c.responseByteSize,f.apiIdentifier=(null==(d=a[t].data)?void 0:d.apiIdentifier)||"",f.name=o,r.indexOf("http://")>-1||r.indexOf("https://")>-1||(a[t].data.requestUrl=o);var p=W({},a[t].data,f);return a[t]=W({},a[t],{data:p}),G("Merged XHR calls is "+a[t]),e(Ve({eventType:u.Performance,data:W({},f,{method:null==(l=a[t].data)?void 0:l.requestMethod}),isError:f.responseStatus>=400})),yt(a[t]).then(function(t){t.data=ot(t.data,0,t.data.responseByteSize||0,!1),e(Ve(t))}).catch(function(e){B("Error in capturing perf data. Error is - "+e.message)}),G("Old temp XHR data calls length "+window.zFetchTempData.length),window.zFetchTempData=window.zFetchTempData.filter(function(e,n){return n!=t}),G("New temp XHR data calls length "+window.zFetchTempData.length),1}},d=0;d<a.length&&!c(d);d++);else if(s&&s!=u.XHR){var l=lt(i),f=l.responseStatus>=400;dt(i.name,i.responseStatus,f)||e(Ve({eventType:u.Performance,data:W({},l,{method:"GET"}),isError:f}))}else B("XHR request but zFetchTempData is empty. API: "+i.name+", Event type: "+s+". Initiator type - "+i.initiatorType)}catch(e){B("Error in capturing perf data. Error is - "+e.message)}}var p=[].concat(window.zFetchTempData)||[];if(p.length>0)for(var v=function(t){var n=p[t].data,r=n.requestStartTime,o=n.duration,i=Xe("xhrEventsTimeout");Date.now()-(r+o)>i&&yt(p[t]).then(function(n){n.data=ot(n.data,0,n.data.responseByteSize||0,!1),e(Ve(n)),window.zFetchTempData=window.zFetchTempData.filter(function(e,n){return n!=t})}).catch(function(e){B("Error in capturing perf data. Error is - "+e.message)})},g=0;g<p.length;g++)v(g)});return t.observe({entryTypes:["resource"]}),function(){return t.disconnect()}}return function(){}}(mt)),n.push(function(e){if(window.buffered){var t=performance.getEntriesByType("resource").filter(function(e){return ut.indexOf(e.initiatorType)>-1});q("Inside initial perf event function. Size of data is - "+t.length);for(var n,r=j(t);!(n=r()).done;){var o=n.value;if(!dt(o.name,o.responseStatus,o.responseStatus>=400)){var i=lt(o);e(Ve({eventType:u.Performance,data:W({},i,{method:"GET"}),isError:(null==i?void 0:i.responseStatus)>=400}))}}}return function(){}}(mt)),r.capturePagePerf&&n.push(function(e){if(window.PerformanceObserver&&"function"==typeof window.PerformanceObserver){q("Page Performance: PerfObserver is supported");var t=new PerformanceObserver(function(t){var n=t.getEntries(),r=window.location.href,o=n.find(function(e){return"first-contentful-paint"===e.name});if(o){var i=window.performance.timeOrigin+o.startTime,s={data:{name:"FCP",type:b.FCP,value:o.startTime,navigationUrl:r},type:u.WebVitals,time:i};q("Page Performance: FCP entries present",JSON.stringify(s)),Ot(s),e(Ve({eventType:u.WebVitals,data:s,isError:!1}))}var a=n.find(function(e){return"first-paint"===e.name});if(a){var c=window.performance.timeOrigin+a.startTime,d={data:{name:"FP",type:b.FP,value:a.startTime,navigationUrl:r},type:u.WebVitals,time:c};q("Page Performance: FP entries present",JSON.stringify(d)),Ot(d),e(Ve({eventType:u.WebVitals,data:d,isError:!1}))}});t.observe({type:"paint",buffered:window.buffered});var n=new PerformanceObserver(function(t){var n=t.getEntries(),r=window.location.href,o=n.find(function(e){return"largest-contentful-paint"===e.entryType});if(o){var i=window.performance.timeOrigin+o.startTime,s={data:{name:"LCP",type:b.LCP,value:o.startTime,navigationUrl:r},type:u.WebVitals,time:i};q("Page Performance: LCP entries present",JSON.stringify(s)),Ot(s),e(Ve({eventType:u.WebVitals,data:s,isError:!1}))}});n.observe({type:"largest-contentful-paint",buffered:window.buffered});var r,o=0,i=new PerformanceObserver(function(t){var n=t.getEntries(),i=window.location.href,s=n.find(function(e){return"layout-shift"===e.entryType}),a=Ke();if(s){var c=window.performance.timeOrigin+s.startTime,d={data:{name:"CLS",type:b.CLS,value:s.value,navigationUrl:i},type:u.WebVitals,time:c};q("Page Performance: CLS entries present",JSON.stringify(d)),o<a.clsEventCount&&(q("Page Performance: CLS within the threshold",JSON.stringify(d)),Ot(d),e(Ve({eventType:u.WebVitals,data:d,isError:!1})),o++),r||(r=setTimeout(function(){o=0,r=null},a.clsTimeout))}});i.observe({type:"layout-shift",buffered:window.buffered});var s=new PerformanceObserver(function(t){var n=t.getEntries(),r=window.location.href,o=n.find(function(e){return"first-input"===e.entryType});if(o){var i=window.performance.timeOrigin+o.startTime,s={data:{name:"FID",type:b.FID,value:o.processingStart-o.startTime,navigationUrl:r},type:u.WebVitals,time:i};q("Page Performance: FID entries present",JSON.stringify(s)),Ot(s),e(Ve({eventType:u.WebVitals,data:s,isError:!1}))}});return s.observe({type:"first-input",buffered:window.buffered}),function(){t.disconnect(),n.disconnect(),i.disconnect(),s.disconnect(),r&&(clearTimeout(r),r=null)}}return function(){}}(mt)),r.webSocketsCapture&&(J("Going to init websockets",window),window.sdkInit!==je.Completed?function(e){function t(t,n){window.stopRecording||e(Ve({eventType:t,data:n,isError:t==u.WSERROR}))}function n(e){J("onmessage: ");var n={data:e.data,type:e.type,wsTimestamp:e.timeStamp},r={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:d.MESSAGERECEIVED};r.responseData=n,t(u.WSMESSAGE,r)}function r(e){J("onclose: ");var n=window._websockets.indexOf(this.ws);n>-1&&window._websockets.splice(n,1);var r={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:d.SOCKETCLOSE};r.responseData={code:e.code,reason:e.reason,type:e.type,wsTimestamp:e.timeStamp},t(u.WSCLOSE,r)}function o(e){J("onopen: ");var n={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:d.SOCKETERROR};t(u.WSOPEN,n)}function i(e){J("onerror: ");var n={requestUrl:this.url?this.url:"",responseData:{},status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,timestamp:Date.now(),wsMsgType:d.SOCKETERROR};n.responseData={code:e.code,reason:e.reason,type:e.type,wsTimestamp:e.timeStamp},t(u.WSERROR,n)}J("Inside captureWebSocketRequest"),J("Going to call WebSocket connection");var s=new Proxy(window.WebSocket,{construct:function(e,s){J("WebSocket connection");var a=function(e,t,n){if(H())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&V(o,n.prototype),o}(e,s),c=n,l=r,f=o,p=i,v=a.send;return a.zRecordStatus="initiated",a.zRecordStart=function(){"started"!==a.zRecordStatus&&(function(e){var n=e.send;e.send=function(e){J("onsend");var r={requestUrl:this.url?this.url:"",status:"",protocols:this.protocol,extension:"string"==typeof this.extensions?[this.extensions]:this.extensions,readyState:this.readyState,requestData:arguments[0]?arguments[0]:"",timestamp:Date.now(),wsMsgType:d.MESSAGESEND};n.apply(this,[e]),t(u.WSMESSAGE,r)}}(a),a.addEventListener("message",c),a.addEventListener("open",f),a.addEventListener("error",p),a.addEventListener("close",l),a.zRecordStatus="started")},a.zRecordStop=function(){"stopped"!==a.zRecordStatus&&(a.send=v,a.removeEventListener("message",c),a.removeEventListener("open",f),a.removeEventListener("error",p),a.removeEventListener("close",l),a.zRecordStatus="stopped")},window._websockets=window._websockets||[],window._websockets.push(a),window.stopRecording||a.zRecordStart(),a}});J("Going to set WebSocket connection"),window.WebSocket=s}(mt):function(){if(J("Start recording"),window._websockets&&window._websockets.length)for(var e=0;e<window._websockets.length;e++)window._websockets[e]&&window._websockets[e].zRecordStart&&"function"==typeof window._websockets[e].zRecordStart&&(window._websockets[e].zRecordStart(),J("Zipy Recording Status:"))}()),function(){n.forEach(function(e){return e()}),function(){if(J("Stop recording"),window._websockets&&window._websockets.length)for(var e=0;e<window._websockets.length;e++)window._websockets[e]&&window._websockets[e].zRecordStop&&"function"==typeof window._websockets[e].zRecordStop&&(window._websockets[e].zRecordStop(),J("Zipy Recording Status:"))}()}}catch(e){return B(e),function(){}}}({emit:function(e){try{var n=Ke();if(e.eventType!=u.Online||window.iszHandshakeDone||(window.ztryForHandshake=!0),t.isSessionExpired)return void q("Don't store zipy events if session is expired");(n.startCaptureWithoutUserActivity||e.eventType>=u.Error&&e.eventType<=u.UnhandledRejection)&&(window.zrrwebRecorderStatus=v.RECORDINGSUCCESSFUL);var r,o={data:JSON.stringify(e.data),time:e.timestamp,type:e.eventType===u.Performance?ct(e.data.initiatorType):e.eventType,isError:e.isError,navigatedUrl:window.location.origin+window.location.pathname};o.type===u.XHR&&e.eventType==u.Performance||Rt(o),n.capturePerformance&&u.Performance===e.eventType&&function(e){var t=Ke();window.zrecordingPaused||Dt()&&!Ne(t)||Ce()&&window.zEventsPerfData.push(e)}({data:e.data,type:null==(r=e.data)?void 0:r.initiatorType,time:e.timestamp})}catch(e){B("Failed to store events")}}})}function Rt(e){var t=Ke(),n=Q.getInstance();window.zrecordingPaused||Dt()&&!Ne(t)||Ce()&&window.zEventsData.push(e),n.lastActivityTime=Date.now()}function Ot(e){var t=Ke();window.zrecordingPaused||Dt()&&!Ne(t)||Ce()&&window.zPagePerfData.push(e)}var Pt=function(e){var t,n,r=ve.getInstance(),o={domCapture:"boolean"==typeof(null==e?void 0:e.dom_capture)?null==e?void 0:e.dom_capture:He.domCapture,consoleCapture:"boolean"==typeof(null==e?void 0:e.console_capture)?null==e?void 0:e.console_capture:He.consoleCapture,networkCapture:"boolean"==typeof(null==e?void 0:e.network_capture)?null==e?void 0:e.network_capture:He.networkCapture,stackTraceCapture:"boolean"==typeof(null==e?void 0:e.stack_trace_capture)?null==e?void 0:e.stack_trace_capture:He.stackTraceCapture,webSocketsCapture:"boolean"==typeof(null==e?void 0:e.web_sockets_capture)?null==e?void 0:e.web_sockets_capture:He.webSocketsCapture,ipCapture:"boolean"==typeof(null==e?void 0:e.ip_capture)?null==e?void 0:e.ip_capture:He.ipCapture,inputMasking:"boolean"==typeof(null==e?void 0:e.input_masking)?null==e?void 0:e.input_masking:He.inputMasking,textMasking:"boolean"==typeof(null==e?void 0:e.text_masking)?null==e?void 0:e.text_masking:He.textMasking,paid:"boolean"==typeof(null==e?void 0:e.paid)?null==e?void 0:e.paid:He.paid,apiKey:null==e?void 0:e.api_key,streamUrl:null!=e&&e.stream_url?null==e?void 0:e.stream_url:He.streamUrl,maxBufferSize:null!=e&&e.max_buffer_size?1024*(null==e?void 0:e.max_buffer_size):He.maxBufferSize,compression:"boolean"==typeof(null==e?void 0:e.compression)?null==e?void 0:e.compression:He.compression,compressionType:null!=e&&e.compression_type?null==e?void 0:e.compression_type:He.compressionType,timeFrequency:null!=e&&e.time_frequency?1e3*(null==e?void 0:e.time_frequency):He.timeFrequency,encodingType:null==e?void 0:e.encoding_type,sessionTimeout:null!=e&&e.session_timeout?1e3*(null==e?void 0:e.session_timeout):He.sessionTimeout,failureRetryCount:null!=e&&e.failure_retry_count?null==e?void 0:e.failure_retry_count:He.failureRetryCount,bufferSizeFrequency:null!=e&&e.buffer_size_frequency?1024*(null==e?void 0:e.buffer_size_frequency):He.bufferSizeFrequency,ignoreUrl:null!=e&&e.ignoreUrl?null==e?void 0:e.ignoreUrl:He.ignoreUrl,ignoreError:null!=e&&e.ignoreError?null==e?void 0:e.ignoreError:He.ignoreError,ignoreConsole:null!=e&&e.ignoreConsole?null==e?void 0:e.ignoreConsole:He.ignoreConsole,isIgnoreUrlError:null!=e&&e.isIgnoreUrlError?null==e?void 0:e.isIgnoreUrlError:He.isIgnoreUrlError,isIgnoreConsoleError:null!=e&&e.isIgnoreConsoleError?null==e?void 0:e.isIgnoreConsoleError:He.isIgnoreConsoleError,ip:null!=e&&e.ip?null==e?void 0:e.ip:"",pack:!(null==e||!e.pack||!e.pack),blockClasses:(t=null!=e&&e.blockClasses?null==e?void 0:e.blockClasses:He.blockClasses,n="zipy-block",t=(t=t&&t.length?t+(n?","+n:""):n).split(",").filter(Ye).map($e).join("|"),new RegExp(t)),customerId:null==e?void 0:e.cId,headersToSanitize:null!=e&&e.headersToSanitize?e.headersToSanitize:"",xhrReqPayloadCapture:"boolean"==typeof(null==e?void 0:e.xhrReqPayloadCap)?null==e?void 0:e.xhrReqPayloadCap:He.xhrReqPayloadCapture,xhrRespPayloadCapture:"boolean"==typeof(null==e?void 0:e.xhrRespPayloadCap)?null==e?void 0:e.xhrRespPayloadCap:He.xhrRespPayloadCapture,canvasCapture:"boolean"==typeof(null==e?void 0:e.canvasCapture)?null==e?void 0:e.canvasCapture:He.canvasCapture,requestCapSize:null!=e&&e.requestCapSize?null==e?void 0:e.requestCapSize:He.requestCapSize,responseCapSize:null!=e&&e.responseCapSize?null==e?void 0:e.responseCapSize:He.responseCapSize,sizeExceededMessage:null!=e&&e.sizeExceededMessage?null==e?void 0:e.sizeExceededMessage:He.sizeExceededMessage,eventCountCapInSingleChunk:"number"==typeof(null==e?void 0:e.eventCountCapInSingleChunk)?e.eventCountCapInSingleChunk:He.eventCountCapInSingleChunk,captureCustomZipyLogMessage:"boolean"==typeof(null==e?void 0:e.captureCustomZipyLogMessage)?e.captureCustomZipyLogMessage:He.captureCustomZipyLogMessage,captureCustomZipyLogError:"boolean"==typeof(null==e?void 0:e.captureCustomZipyLogError)?e.captureCustomZipyLogError:He.captureCustomZipyLogError,captureCustomZipyLogException:"boolean"==typeof(null==e?void 0:e.captureCustomZipyLogException)?e.captureCustomZipyLogException:He.captureCustomZipyLogException,startCaptureWithoutUserActivity:"boolean"==typeof(null==e?void 0:e.startCaptureWithoutUserActivity)?e.startCaptureWithoutUserActivity:He.startCaptureWithoutUserActivity,consoleLogLevel:null!=e&&e.consoleLogLevel?e.consoleLogLevel:He.consoleLogLevel,recordCrossOriginIframes:!r.recordOnlyIframe,splitSessionSize:"number"==typeof(null==e?void 0:e.splitSessionSize)?e.splitSessionSize:He.splitSessionSize,capturePerformance:"boolean"==typeof(null==e?void 0:e.capturePerformance)?e.capturePerformance:He.capturePerformance,perfUrl:null!=e&&e.perfUrl?null==e?void 0:e.perfUrl:He.perfUrl,perfTimeFrequency:"number"==typeof(null==e?void 0:e.perfTimeFrequency)?e.perfTimeFrequency:He.perfTimeFrequency,perfBufferSizeFrequency:"number"==typeof(null==e?void 0:e.perfBufferSizeFrequency)?e.perfBufferSizeFrequency:He.perfBufferSizeFrequency,clickTimeFrequency:"number"==typeof(null==e?void 0:e.clickTimeFrequency)?e.clickTimeFrequency:He.clickTimeFrequency,clickBufferSizeFrequency:"number"==typeof(null==e?void 0:e.clickBufferSizeFrequency)?e.clickBufferSizeFrequency:He.clickBufferSizeFrequency,isApiIdentifierEnable:"boolean"==typeof(null==e?void 0:e.isApiIdentifierEnable)?e.isApiIdentifierEnable:He.isApiIdentifierEnable,apiUniqueIdentifier:null!=e&&e.apiUniqueIdentifier&&Array.isArray(e.apiUniqueIdentifier)?e.apiUniqueIdentifier:He.apiUniqueIdentifier,ignoreUrlErrorCodes:null!=e&&e.ignoreUrlErrorCodes?e.ignoreUrlErrorCodes:He.ignoreUrlErrorCodes,ignoreUrlCodes:null!=e&&e.ignoreUrlCodes?e.ignoreUrlCodes:He.ignoreUrlCodes,heatMapUrl:null!=e&&e.heatMapUrl?e.heatMapUrl:He.heatMapUrl,captureClickEvents:"boolean"==typeof(null==e?void 0:e.captureClickEvents)?e.captureClickEvents:He.captureClickEvents,sessionStitching:null!=e&&e.sessionStitching?e.sessionStitching:He.sessionStitching,captureCancelledRequest:"boolean"==typeof(null==e?void 0:e.captureCancelledRequest)?e.captureCancelledRequest:He.captureCancelledRequest,capturePagePerf:null!=e&&e.capturePagePerf?e.capturePagePerf:He.capturePagePerf,clsEventCount:null!=e&&e.clsEventCount?e.clsEventCount:He.clsEventCount,clsTimeout:null!=e&&e.clsTimeout?e.clsTimeout:He.clsTimeout,pagePerfUrl:null!=e&&e.pagePerfUrl?e.pagePerfUrl:He.pagePerfUrl,xhrEventsTimeout:null!=e&&e.xhrEventsTimeout?e.xhrEventsTimeout:He.xhrEventsTimeout,blockSelector:null!=e&&e.blockSelector?null==e?void 0:e.blockSelector:He.blockSelector,captureCustomEvents:"boolean"==typeof(null==e?void 0:e.captureCustomEvents)?null==e?void 0:e.captureCustomEvents:null==He?void 0:He.captureCustomEvents,customEventUrl:null!=e&&e.customEventUrl?null==e?void 0:e.customEventUrl:He.customEventUrl,maxCustomEventProperties:null!=e&&e.maxCustomEventProperties?null==e?void 0:e.maxCustomEventProperties:He.maxCustomEventProperties,maxCustomEventPayloadSize:null!=e&&e.maxCustomEventPayloadSize?null==e?void 0:e.maxCustomEventPayloadSize:He.maxCustomEventPayloadSize,sanitizePayloadResponse:"boolean"==typeof(null==e?void 0:e.sanitizePayloadResponse)?null==e?void 0:e.sanitizePayloadResponse:He.sanitizePayloadResponse,captureUTM:"boolean"==typeof(null==e?void 0:e.captureUTM)?null==e?void 0:e.captureUTM:He.captureUTM};return o.ignoreUrl.push(o.streamUrl.substring(o.streamUrl.indexOf("://")+3)),o.ignoreUrl.push(o.streamUrl.substring(o.perfUrl.indexOf("://")+3)),o.ignoreUrl.push(o.streamUrl.substring(o.heatMapUrl.indexOf("://")+3)),o.ignoreUrl.push(_.streamMgrUrl.substring(_.streamMgrUrl.indexOf("://")+3)),o.ignoreUrl.push("google.com"),o.isIgnoreUrlError.push(o.streamUrl.substring(o.streamUrl.indexOf("://")+3)),o.isIgnoreUrlError.push(_.streamMgrUrl.substring(_.streamMgrUrl.indexOf("://")+3)),o.isIgnoreUrlError.push("google.com"),function(e){if(e)try{var t;G("Updating zsdk-config"+JSON.stringify(e)),e.blockClasses=null==(t=e.blockClasses)?void 0:t.source,Y("zsdk-config",JSON.stringify(e))}catch(e){B("Failed to stringify zsdk-config ")}}(o),o};function Dt(){var e=Q.getInstance().sessionBlockInfo;return!(null==e||!e.isBlocked)&&e.isBlocked}var Ut=function(e,t){var n={},r=Q.getInstance();e===D.PAGE_OUT?n.type="visibility hidden":(e===D.INIT||D.REINIT)&&(n.type=e,n.newSession=r.isNewSession,n.initiator=t),n.tabId=wt("zTId"),Rt({data:JSON.stringify(n),time:Date.now(),type:u.DEBUG_INFO,isError:!1,navigatedUrl:window.location.origin+window.location.pathname,rrwebEvent:0})};function xt(e){var t=new TextEncoder,n=JSON.stringify(e);return t.encode(n).byteLength}function Lt(e,t){try{for(var n,r=j(window.document.querySelectorAll("iframe"));!(n=r()).done;){var o=n.value;try{var i=new URL(o.src);if(t){if(i.origin!==window.document.location.origin&&o.contentWindow===(null==t?void 0:t.source))return q("sending message to iframe to start recording"),void o.contentWindow.postMessage({action:T,config:e},"*");continue}i.origin!==window.document.location.origin&&(q("sending message to iframe to start recording"),o.contentWindow.postMessage({action:T,config:e},"*"))}catch(e){B("failed to start recording for iframe:")}}}catch(e){B("failed to start recording")}}function At(){try{var e=window.document.querySelectorAll("iframe");q("going to stop iframe");for(var t,n=j(e);!(t=n()).done;){var r=t.value;try{new URL(r.src).origin!==window.document.location.origin&&(q("sending message to iframe to stop recording"),r.contentWindow.postMessage({action:k},"*"))}catch(e){B("failed to stop recording for iframe:")}}}catch(e){B("failed to stop recording")}}var Ft=/*#__PURE__*/function(){function e(){this.zipySessionData=void 0,this.zipyStates=void 0,this.zipySessionData=Q.getInstance(),this.zipyStates=Et.getInstance()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.stopHandlers=function(){var e=this,t=Et.getInstance();this.zipyStates.isDataProcessingDone().then(function(n){if(n){t.sdkTimer=A.STOP,window.zrrwebRecorderStatus=v.RECORDINGPENDING,window.sdkInit=je.Failed;var r=window.zStop;r&&r(),Ue(),Oe(e.zipySessionData.apiKey)}})},t.stop=function(){this.stopHandlers()},e}();function _t(e,t,n){if(!e.s){if(n instanceof Gt){if(!n.s)return void(n.o=_t.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(_t.bind(null,e,t),_t.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}Ft.instance=void 0;var Mt=function(e){try{var t,n=function(n){if(t)return n;function o(){function t(t){function n(){function t(t){function n(t){function n(t){function n(t){t&&q("Successfully sent custom event data to server via session storage"),Ht(_.sdkLoopTime,e)}t&&q("Successfully sent page perf data to server via session storage");var r=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!==v.RECORDINGPENDING;return r?Promise.resolve(It(e)).then(n):n(r)}t&&q("Successfully sent click data to server via session storage");var r=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=v.RECORDINGPENDING;return r?Promise.resolve(zt(e)).then(n):n(r)}t&&q("Successfully sent pref data to server via session storage");var o=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=v.RECORDINGPENDING&&r.captureClickEvents;return o?Promise.resolve(Ct(e)).then(n):n(o)}var n=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=v.RECORDINGPENDING&&r.capturePerformance;return n?Promise.resolve(Tt(e)).then(t):t(n)}var o=function(){if(t){var n=function(){q("Successfully send data to server via session storage")},o=function(){if(window.zrecordingPaused){window.zrecordingPaused=!1,window.reinitializationInProgress=!0;var t=f.GETUSERCONFIG;return pe()&&(t=f.POSTENDUSERINFOANDGETUSERCONFIG),Promise.resolve(St(e,t,!1)).then(function(e){r=e,window.zStop=Wt(),Ut(D.REINIT,U.STREAMDATARECORDINGPAUSE)})}}();return o&&o.then?o.then(n):n()}var i=window.zEventsData||[],s="";try{s=JSON.stringify(i)}catch(e){B("Failed stringify events while stream data server")}0!=r.maxBufferSize&&2*s.length>r.maxBufferSize&&!window.zrecordingPaused&&(window.zrecordingPaused=!0,G("Max Buffer size is reached going to pause recording"))}();return o&&o.then?o.then(n):n()}var n=!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=v.RECORDINGPENDING;return n?Promise.resolve(kt(e)).then(t):t(n)}var i=function(){if(window.ztryForHandshake)return Promise.resolve(St(e,window.zpendingOp,!1)).then(function(e){r=e})}();return i&&i.then?i.then(o):o()};if(window.sdkInit!==je.Completed)return G("Sdk is not initialized yet"),Ht(_.sdkLoopTime,e),Promise.resolve();if(window.isDataSyncInProgress)return q("Data sync in in progress"),Ht(_.sdkLoopTime,e),Promise.resolve();if(window.reinitializationInProgress)return q("Reinit is in progress"),Ht(_.sdkLoopTime,e),Promise.resolve();var r=Ke(),o=function(){if(Ne(r)&&window.zEventsData&&window.zEventsData.length>0&&!window.iszInternetDisconnected&&window.zrrwebRecorderStatus!=v.RECORDINGPENDING){G("Session is expired Going to recreate session"),window.reinitializationInProgress=!0,Pe(e);var n=f.GETUSERCONFIG;return pe()&&(n=f.POSTENDUSERINFOANDGETUSERCONFIG),Promise.resolve(St(e,n,!0)).then(function(n){r=n,window.zrecordingPaused=!1,window.zStop=Wt(),Ut(D.REINIT,U.STREAMDATAEXPIRE),Ht(_.sdkLoopTime,e),t=1})}}();return Promise.resolve(o&&o.then?o.then(n):n(o))}catch(e){return Promise.reject(e)}},Gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{_t(r,1,i(this.v))}catch(e){_t(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?_t(r,1,t?t(o):o):n?_t(r,1,n(o)):_t(r,2,o)}catch(e){_t(r,2,e)}},r},e}();function qt(e){return e instanceof Gt&&1&e.s}var Jt=5,Bt=function(e,t){void 0===t&&(t={releaseVer:"",rootDomain:""});try{try{if(void 0!==window.sdkInit&&window.sdkInit!==je.Failed)return Promise.resolve();var n=ve.getInstance();if(window.sdkInit=je.Progress,n.saveOptions(t),M=_.debugLogs,st()){if(function(){try{return window.top.window.zipy?(q("Zipy is present in parent"),!0):(q("Zipy is not present in parent"),!1)}catch(e){return B("Error in is same origin method. Error - "+(e?e.message:e)),!1}}())return G("Not initializing sdk as function is called inside iframe."),Promise.resolve();if(!function(e){var t=null;try{var n,r,o=null==e||null==(n=e.window)||null==(n=n.top)?void 0:n.document;t=null==o||null==(r=o.body)?void 0:r.innerHTML}catch(e){q("iframe is cross-domain")}return null!==t}(window.self)&&He&&!n.recordOnlyIframe){window.recordingStatus||(window.recordingStatus=!1);try{window.onload=function(){q("Iframe content loaded!"),window.parent.postMessage({action:N},"*")}}catch(e){B("not able to notify about iframe content loaded event:")}var r=e;try{G("init: We will start recording cross-origin iframe now!"),function(e,t){window.addEventListener("message",function(n){try{var r,o;(null==n||null==(r=n.data)?void 0:r.action)===T&&(null==n||null==(o=n.data)||null==(o=o.config)?void 0:o.apiKey)==e&&!0!==window.recordingStatus&&(q("going to init iframe recording"),t.push(Nt(n.data.config.inputMasking)),window.sdkConfig=n.data.config,window.recordingStatus=!0)}catch(e){B("cannot start recording for iframe:")}try{var i;(null==n||null==(i=n.data)?void 0:i.action)==k&&!1!==window.recordingStatus&&(q("going to stop recording for iframe"),window.stopRecording=!0,t.forEach(function(e){return e()}),window.recordingStatus=!1)}catch(e){B("failed to stop iframe recording:")}})}(r,[])}catch(e){B(e.message)}return Promise.resolve()}}var o=new RegExp(/^[a-zA-Z0-9]{8}$/);if(!e||!o.test(e))return B("Not able to process as sdk api key null or invalid."),Promise.resolve();window.zRelVer=t.releaseVer,window.zsdkKey=e,function(){try{for(var e=Object.keys(localStorage),t=0;t<e.length;t++)["zsession-blocked-info","session-data","zId","zenduser-info-temp","zenduser-info","last-activity-time","pack","zsdk-config","is-api-key-valid","zenduser-last-activity-time","ztotal-data-sent"].includes(e[t])&&(K.set(e[t],localStorage.getItem(e[t])),G("updated value in map is :"+K.get(e[t])))}catch(e){B("inside zLocalStorgeMapUpdate catch block ${e.message}")}}(),function(e){var t=[];try{var n=Q.getInstance();window.isDataSyncInProgress=!1,window.iszInternetDisconnected=!1,n.lastActivityTime=Date.now(),window.buffered=!0,Ue(),n.enduserLastActivityTime=be(),n.enduserLastActivityTime||(n.enduserLastActivityTime=Date.now()),window.zrecordingPaused=!1,window.ztryForHandshake=!1,n.isSessionExpired=!1,window.zrrwebRecorderStatus=v.NORECORDING;var r=ve.getInstance();Et.getInstance().sdkTimer=A.START,wt("zTId")||ht("zTId",Math.floor(1e4*Math.random()).toString());var o=ee()||{},i=wt("pending-zEvents");if(i&&!Ne(o))try{var s;s=c.decompressFromUTF16(i),window.zEventsData=JSON.parse(s)}catch(e){B("Failed to parse pendingEvents")}finally{!function(e){try{window.sessionStorage.removeItem("pending-zEvents")}catch(e){console.error("inside zSessionStorageRemoveItem catch block "+e.message)}}()}var a=re();a&&a.apiKey==e||ne(e),q("Zipy Recorder init"),De(e)&&(ie()?(G("Removing enduser-info"),$("zenduser-info")):G("zenduser Data dosen't exists"),ue());var u=f.GETUSERCONFIG;if(!ie()&&!se()){u=f.POSTENDUSERINFOANDGETUSERCONFIG;var d=oe(),l={euId:0,euZName:"",userType:p.ANONYMS,isBlocked:!1,zExternalUserInfo:{},zAnonymsUserInfo:{zId:d,euId:0,euZName:""}};ce(l),ae(l)}pe()&&(u=f.POSTENDUSERINFOANDGETUSERCONFIG);var g=!1;r.rootDomain&&_e(e),(Ne(o)||De(e))&&(Pe(e),g=!0),Ut(D.INIT,U.PAGELOAD),St(e,u,g).then(function(n){if(window.lastSyncTime=0,window.perfLastSyncTime=0,window.clickLastSyncTime=0,window.pagePerfLastSynctime=0,window.customEventLastSynctime=0,null!=n&&n.captureUTM&&function(e){try{var t=Q.getInstance(),n=new URL(e),r=Ke();if(c=n.searchParams,F.some(function(e){return c.has(e)})){var o=[];if(r.sessionStitching){var i=xe(t.apiKey+h.utms);i&&"undefined"!==i&&(o=JSON.parse(decodeURIComponent(i)))}else{var s=X("zUTMParams");s&&"undefined"!==s&&(o=JSON.parse(s))}o.find(function(e){return e===n.searchParams.toString()})||o.push(n.searchParams.toString());var a=JSON.stringify(o);Y("zUTMParams",a),r.sessionStitching&&Le(t.apiKey+h.utms,encodeURIComponent(a))}}catch(e){B("Error in handling UTM")}var c}(window.location.href),n.domCapture){var r=Nt(n.inputMasking);t.push(r)}t.push(bt());try{window.addEventListener("message",function(e){var t;(null==e||null==(t=e.data)?void 0:t.action)===N&&!0!==window.stopRecording&&Lt(n,e)})}catch(e){B("failed to start recording for iframe content loaded event")}Lt(n),window.zStop=function(){try{window.stopRecording=!0,t.forEach(function(e){return e()}),J("Calling zipy Stop Recorder"),At()}catch(e){B("Failed to stop recording")}},window.sdkInit=je.Completed,Ht(_.sdkLoopTime,e),function(e){var t=ve.getInstance();document.addEventListener("visibilitychange",function(n){try{var r=Ke();if(t.rootDomain&&r.sessionStitching)try{document.hidden?Me(e):_e(e)}catch(e){B("Failed to set CookieData on tab visibility. Error - "+e.message)}var o=function(){if("visible"===document.visibilityState)try{if(window.zrecordingPaused=!1,Ne(e)){var t=window.zStop;t&&t(),window.stopRecording=!1;var n=Ke();window.zStop=Nt(n.inputMasking)}else window.reinitializationInProgress=!0,window.buffered=!1,window.zStop=Wt(),Ut(D.REINIT,U.VISIBLE),G("reinitializing the session on tabActive event")}catch(e){B("Failed to reinit on tab visibility. Error - "+e.message)}else{Ut(D.PAGE_OUT,U.NA);var r=Et.getInstance(),o=Ke(),i=window.zStop;i&&i();var s=function(t,n){try{var i=function(){function t(){window.zEventsData=[]}var n=r.dataSync!==x.PENDING&&!Ne(o)&&!window.iszInternetDisconnected&&window.zEventsData&&window.zEventsData.length>0&&window.zrrwebRecorderStatus!==v.RECORDINGPENDING,i=function(){if(n){var t,r=0,o=function(e,t,n){for(var r;;){var o=e();if(qt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!qt(i)){r=1;break}i=i.s}if(t){var s=t();if(s&&s.then&&!qt(s)){r=2;break}}}var a=new Gt,c=_t.bind(null,a,2);return(0===r?o.then(d):1===r?i.then(u):s.then(l)).then(void 0,c),a;function u(r){i=r;do{if(t&&(s=t())&&s.then&&!qt(s))return void s.then(l).then(void 0,c);if(!(o=e())||qt(o)&&!o.v)return void _t(a,1,i);if(o.then)return void o.then(d).then(void 0,c);qt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(u).then(void 0,c)}function d(e){e?(i=n())&&i.then?i.then(u).then(void 0,c):u(i):_t(a,1,i)}function l(){(o=e())?o.then?o.then(d).then(void 0,c):d(o):_t(a,1,i)}}(function(){return!t&&r<5},void 0,function(){return Promise.resolve(kt(e)).then(function(e){e&&0!==window.zEventsData.length?r++:t=1})});if(o&&o.then)return o.then(function(){})}}();return i&&i.then?i.then(t):t()}()}catch(e){return n(e)}return i&&i.then?i.then(void 0,n):i}(0,function(e){B("Failed to send the pending rrweb events. Error - "+e.message)});if(s&&s.then)return s.then(function(){})}}();return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}})}(e),function(e){var t=ve.getInstance();window.addEventListener("beforeunload",function(n){var r=Ke();try{if(window.zEventsData&&window.zEventsData.length&&window.zrrwebRecorderStatus!==v.RECORDINGPENDING){var o=JSON.stringify(window.zEventsData);ht("pending-zEvents",c.compressToUTF16(o))}}catch(e){B("Failed to set data in session storage on tab beforeunload. Error - "+e.message)}try{t.rootDomain&&r.sessionStitching&&Me(e)}catch(e){B("Failed to set CookieData on tab beforeunload. Error - "+e.message)}})}(e),window.addEventListener("storage",function(e){var t=Q.getInstance();if("session-data"===e.key){var n=JSON.parse(e.newValue),r=JSON.parse(e.oldValue);if(n.sessionId!==r.sessionId&&""!==n.sessionId){var o=parseInt(X("last-activity-time")),i=parseInt(X("zenduser-last-activity-time")),s=JSON.parse(X("zsession-blocked-info")),a=JSON.parse(X("session-data"));t.apiKey=a.sdkKey,t.isNewSession=a.isNewSession,t.sessionId=a.sessionId,t.enduserLastActivityTime=i,t.isSessionExpired=!1,t.lastActivityTime=o,t.sessionBlockInfo=s}}})}).catch(function(e){window.sdkInit=je.Failed,B("Failed to get get sdk config from server: ")})}catch(e){B(e)}}(e)}catch(e){B("Not able to init SDK: "+e.message)}return Promise.resolve()}catch(e){return Promise.reject(e)}},Zt=function(e,t){void 0===t&&(t={});try{if(!ve.getInstance().recordOnlyIframe&&window.self!==window.parent)return}catch(e){B(e.message?e.message:e)}try{if(window.sdkInit!==je.Completed)return B("Identify: SDK not initialized"),void setTimeout(function(){G("Calling identify again after 10 seconds"),function(e,t,n){void 0===t&&(t={}),(Jt-=1)>0?Zt(e,t):B("Identify session retries count exceeded")}(e,t)},1e4);if(!e||"string"!=typeof e||e.length<=0||e.trim().length<=0)return void B("Got wrong external UUID, Please validate: "+e);G("identify :: externalUUId - "+e);var n=ie(),r=ke()||{},o=f.POSTENDUSERINFO,i=t;i.externalId=e;var s=!1;if(n){var a;n.userType==p.ANONYMS||(d=null==(a=n)?void 0:a.zExternalUserInfo,l=i,G("NewEndUserInfo :: "+JSON.stringify(l)),G("PrevEndUserInfo :: "+JSON.stringify(d)),(null==d?void 0:d.externalId)===(null==l?void 0:l.externalId)?o=f.POSTENDUSERINFOANDGETUSERCONFIG:(n.euId=0,n.euZName="",n.userType=p.ANONYMS,n.isBlocked=!1,s=!0,o=f.POSTENDUSERINFOANDGETUSERCONFIG,Pe(r.sdkKey),window.reinitializationInProgress=!0))}else{var c=oe();n={euId:0,euZName:"",userType:p.ANONYMS,isBlocked:!1,zExternalUserInfo:{},zAnonymsUserInfo:{zId:c,euId:0,euZName:""}}}window.iszHandshakeDone||(o=f.POSTENDUSERINFOANDGETUSERCONFIG),n.zExternalUserInfo=i,ce(n);var u=re();u&&r?!s&&u.isBlocked?G("No need to do backend call if session is blocked"):St(r.sdkKey,o,s).then(function(e){s&&(window.zStop=Wt(),Ut(D.REINIT,U.IDENTIFY))}).catch(function(e){B("Failed to post/get sdk config from server: ")}):B("Value doesn't exists in sessionBlockInfo or sessionData : ")}catch(e){B("Not able to identify SDK: "+e.message)}var d,l},jt=function(){try{if(!ve.getInstance().recordOnlyIframe&&window.self!==window.parent)return}catch(e){B(e.message?e.message:e)}if(window.sdkInit===je.Completed){G("Going to anonymize end user");var e,t=!1;(de()||((e=se())?e.userType===p.IDENTIFIED:(G("zenduser-info doesn't exists"),0)))&&(t=!0);var n=function(){var e=ie();return e?(e.zExternalUserInfo={},e.userType=p.ANONYMS,fe(e,!1),e):(G("zenduser Data dosen't exists"),function(){var e=se();if(e)return e.zExternalUserInfo={},e.userType=p.ANONYMS,fe(e,!0),e;G("zenduser Data dosen't exists in temp storage")}())}()||{},r=f.GETUSERCONFIG;0===n.euId?(r=f.POSTENDUSERINFOANDGETUSERCONFIG,ce(n),ae(n)):(ae(n),ue());var o=ke();o&&t?(window.reinitializationInProgress=!0,Pe(null==o?void 0:o.sdkKey),St(null==o?void 0:o.sdkKey,r,!0).then(function(e){window.zStop=Wt(),Ut(D.REINIT,U.ANONYMIZE)}).catch(function(e){B("Failed to post/get sdk config from server: ")})):G("Identified user doesn't exists in system No need to break session")}else B("Anonymize: SDK not initialized")};function Wt(e){var t=[];try{if(q("Zipy Recorder Reinit"),window.sdkConfig=ee(),window.isDataSyncInProgress=!1,!window.stopRecording){G("Going to stop recording ");var n=window.zStop;n&&n()}window.iszInternetDisconnected=!1,Ue(),window.stopRecording=!1,window.zrecordingPaused=!1;var r=Ke();if(r.domCapture){var o=Nt(r.inputMasking);t.push(o)}return t.push(bt()),Lt(r),window.reinitializationInProgress=!1,function(){try{window.stopRecording=!0,J("Calling zipy Stop Recorder"),t.forEach(function(e){return e()}),At()}catch(e){B("Failed to stop recording")}}}catch(e){B(e)}return function(){}}function Ht(e,t){Et.getInstance().sdkTimer===A.START&&setTimeout(Mt,e,t)}var Vt=function(){try{if(!ve.getInstance().recordOnlyIframe&&window.self!==window.parent)return""}catch(e){B(e.message?e.message:e)}try{var e=Ke(),t=X("zsession-blocked-info"),n=JSON.parse(t);if(window.sdkInit!==je.Completed||n.is_blocked)return B("SessionLink: SDK not initialized"),"";var r=ke()||{},o=X("zId");return e.customerId?_.sessionLinkUrl+"/"+r.sdkKey+"/"+e.customerId+"?is_error=false&id="+o+"&euid="+r.sessionId:(B("SessionLink: Could not find customer id"),"")}catch(e){return B("Error in generating session url. Error is - "+e.message),""}},Kt=function(e,t){try{var n=Ke();if(!n||n&&!n.captureCustomZipyLogMessage)return void G("Custom Zipy Message not enabled.");if(e&&"string"==typeof e){var r=new CustomEvent(S,{detail:{message:e,options:t}});window.dispatchEvent(r)}else q("Mandatory params missing for zipy logs")}catch(e){q("Error in capturing zipy logs. Error - "+e.message)}},Xt=function(e){try{var t=Ke();if(!t||t&&!t.captureCustomZipyLogMessage)return void G("Custom Zipy Exception not enabled.");if(e){var n=new CustomEvent(I,{detail:{error:e instanceof Error?e:{message:String(e)}}});window.dispatchEvent(n)}else q("Mandatory params missing for zipy exception missing")}catch(e){q("Error in capturing zipy exception event. Error - "+e.message)}},Yt=function(e,t,n,r){try{var o=Ke();if(!o||o&&!o.captureCustomZipyLogError)return void G("Custom Zipy Error not enabled.");if(e&&t&&"string"==typeof e&&"string"==typeof t){var i=new CustomEvent(z,{detail:{name:e,message:t,category:n,options:r}});window.dispatchEvent(i)}else q("Mandatory params missing for zipy error logs")}catch(e){B("Error in capturing zipy error event. Error - "+e.message)}},$t=function(){try{if(!ve.getInstance().recordOnlyIframe&&window.self!==window.parent)return[]}catch(e){B(e.message?e.message:e)}try{var e=Ke(),t=Q.getInstance(),n=[];if(null!=e&&e.captureUTM)if(e.sessionStitching){var r=xe(t.apiKey+h.utms);r&&"undefined"!==r&&(n=JSON.parse(decodeURIComponent(r)))}else{var o=X("zUTMParams");o&&(n=JSON.parse(o))}return n}catch(e){return B("Error in getting utm params. Error is - "+e.message),[]}},Qt={stop:Ft.getInstance().stop.bind(Ft.getInstance())},en=function(e,t){void 0===t&&(t={});try{if(window.sdkInit!==je.Completed)throw new Error("SDK is not initialized");var n=Ke();if(!n.captureCustomEvents)return;var r=function(e){var t=e.eventName,n=e.properties,r=e.maxLength,o=e.maxPayloadSize;if(!t.trim()||t.length>255)throw new Error("Event name doesn't meet the requirement.");for(var i={},s=0,a=Object.entries(n);s<a.length;s++){var c=a[s],d=c[0],l=c[1];if(("number"==typeof l||"boolean"==typeof l||"string"==typeof l&&l.trim().length<255||Array.isArray(l)&&l.length>0&&l.length<r)&&(i[d]=l,Object.keys(i).length>=r))break}if(2*JSON.stringify(i).length>o)throw new Error("Max Payload limit exceeded.");return{data:{eventName:t,properties:i},type:u.CustomEvent,time:Date.now()}}({eventName:e,properties:t,maxLength:n.maxCustomEventProperties,maxPayloadSize:n.maxCustomEventPayloadSize});o=r,i=Ke(),window.zrecordingPaused||Dt()&&!Ne(i)||Ce()&&window.zCustomEventData.push(o),Rt({data:JSON.stringify(r.data),type:u.CustomEvent,time:r.time,isError:!1,navigatedUrl:window.location.origin+window.location.pathname})}catch(e){B("Custom Events: Failed to send custom event. Error - "+e.message)}var o,i},tn={init:Bt,identify:Zt,anonymize:jt,getCurrentSessionURL:Vt,logError:Yt,logException:Xt,logMessage:Kt,logEvent:en,extractUTMParameters:$t,record:Qt};export{jt as anonymize,tn as default,$t as extractUTMParameters,Vt as getCurrentSessionURL,Zt as identify,Bt as init,Yt as logError,en as logEvent,Xt as logException,Kt as logMessage,Qt as record};