From b65fc942d2278e053d8a811d60971390bf276239 Mon Sep 17 00:00:00 2001 From: KambleSonam Date: Thu, 8 Feb 2024 16:00:54 +0530 Subject: [PATCH] fix(SDK - 3413) : Updated package.json to version 1.7.0 --- clevertap.js | 2 +- clevertap.min.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clevertap.js b/clevertap.js index 422c66e9..c520a079 100644 --- a/clevertap.js +++ b/clevertap.js @@ -7303,7 +7303,7 @@ var proto = document.location.protocol; proto = proto.replace(':', ''); dataObject.af = _objectSpread2({ - lib: 'web-sdk-v2.0.0', + lib: 'web-sdk-v1.7.0', protocol: proto }, $ct.flutterVersion); // app fields diff --git a/clevertap.min.js b/clevertap.min.js index 152ab4f5..7e6cc963 100644 --- a/clevertap.min.js +++ b/clevertap.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).clevertap=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,n,i,o,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function n(e){return function(){var n=this,i=arguments;return new Promise((function(o,r){var a=e.apply(n,i);function s(e){t(a,o,r,s,l,"next",e)}function l(e){t(a,o,r,s,l,"throw",e)}s(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}var C=0;function x(e){return"__private_"+C+++"_"+e}function P(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var S=function(t){var n,i=Object.prototype,o=i.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var o=t&&t.prototype instanceof y?t:y,r=Object.create(o.prototype),a=new E(i||[]);return r._invoke=function(e,t,n){var i=p;return function(o,r){if(i===f)throw new Error("Generator is already running");if(i===v){if("throw"===o)throw r;return L()}for(n.method=o,n.arg=r;;){var a=n.delegate;if(a){var s=O(a,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var l=d(e,t,n);if("normal"===l.type){if(i=n.done?v:h,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=v,n.method="throw",n.arg=l.arg)}}}(e,n,a),r}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",h="suspendedYield",f="executing",v="completed",g={};function y(){}function b(){}function m(){}var w={};w[a]=function(){return this};var k=Object.getPrototypeOf,C=k&&k(k(A([])));C&&C!==i&&o.call(C,a)&&(w=C);var x=m.prototype=y.prototype=Object.create(w);function P(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(t,n){function i(r,a,s,l){var c=d(t[r],t,a);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"===e(p)&&o.call(p,"__await")?n.resolve(p.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):n.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}))}l(c.arg)}var r;this._invoke=function(e,t){function o(){return new n((function(n,o){i(e,t,n,o)}))}return r=r?r.then(o,o):o()}}function O(e,t){var i=e.iterator[t.method];if(i===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,O(e,t),"throw"===t.method))return g;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=d(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,g;var r=o.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,g):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function A(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(l&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;_(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:A(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=n),g}},t}("object"===("undefined"==typeof module?"undefined":e(module))?module.exports:{});try{regeneratorRuntime=S}catch(e){Function("r","regeneratorRuntime = r")(S)}var O,I="clevertap-prod.com",_="https:",E=x("accountId"),A=x("region"),L=x("targetDomain"),R=x("dcSdkversion"),M=x("token"),T=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.id,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";i(this,e),Object.defineProperty(this,E,{writable:!0,value:void 0}),Object.defineProperty(this,A,{writable:!0,value:""}),Object.defineProperty(this,L,{writable:!0,value:I}),Object.defineProperty(this,R,{writable:!0,value:""}),Object.defineProperty(this,M,{writable:!0,value:""}),this.id=n,o&&(this.region=o),r&&(this.targetDomain=r),a&&(this.token=a)}return r(e,[{key:"id",get:function(){return P(this,E)[E]},set:function(e){P(this,E)[E]=e}},{key:"region",get:function(){return P(this,A)[A]},set:function(e){P(this,A)[A]=e}},{key:"dcSDKVersion",get:function(){return P(this,R)[R]},set:function(e){P(this,R)[R]=e}},{key:"targetDomain",get:function(){return P(this,L)[L]},set:function(e){P(this,L)[L]=e}},{key:"token",get:function(){return P(this,M)[M]},set:function(e){P(this,M)[M]=e}},{key:"finalTargetDomain",get:function(){return this.region?"".concat(this.region,".").concat(this.targetDomain):this.targetDomain===I?"".concat("eu1",".").concat(this.targetDomain):this.targetDomain}},{key:"dataPostPEURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/defineVars")}},{key:"dataPostURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/a?t=96")}},{key:"recorderURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/r?r=1")}},{key:"emailURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/e?r=1")}}]),e}(),j=new RegExp("^\\s+|\\.|:|\\$|'|\"|\\\\|\\s+$","g"),D=new RegExp("^\\s+|'|\"|\\\\|\\s+$","g"),z=new RegExp("'","g"),B="clear",N="Charged ID",F="WZRK_CHARGED_ID",U="WZRK_G",q="WZRK_K",V="WZRK_CAMP",W="WZRK_CAMP_G",K="WZRK_EV",G="WZRK_META",H="WZRK_PR",J="WZRK_ARP",Z="WZRK_L",$="global",Y="optOut",Q="useIP",X="WZRK_X",ee="push",te=31536e3,ne="2",ie="wzrk_",oe="wzrk_id",re="Notification Viewed",ae="Notification Clicked",se="WZRK_FPU",le="WZRK_PSD",ce="$incr",ue="$decr",de="$set",pe="$add",he="$remove",fe="$delete",ve="WZRK_INBOX_CONFIG",ge="WZRK_INBOX",ye=1e3,be="wzrk_fetch",me=["Stayed","UTM Visited","App Launched","Notification Sent",re,ae],we=function(e){return"string"==typeof e||e instanceof String},ke=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Ce=function(t){return"object"===e(t)&&t instanceof Date},xe=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},Pe=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},Se=function(e){return/^-?[\d.]+(?:e-?\d+)?$/.test(e)&&"number"==typeof e},Oe=function(e){return null!=e&&"undefined"!==e},Ie=function t(n,i){var o;if("object"!==e(n))return we(n)?(o=_e(n,D)).length>1024&&(o=o.substring(0,1024),i.reportError(521,o+"... length exceeded 1024 chars. Trimmed.")):o=n,o;for(var r in n)if(n.hasOwnProperty(r)){var a=t(n[r],i),s=void 0;(s=_e(r,j)).length>1024&&(s=s.substring(0,1024),i.reportError(520,s+"... length exceeded 1024 chars. Trimmed.")),delete n[r],n[s]=a}return n},_e=function(e,t){return e.replace(t,"")},Ee=function(){var e=new Date;return e.getFullYear()+""+e.getMonth()+e.getDay()},Ae=function(){return Math.floor((new Date).getTime()/1e3)},Le=function(e){return"$D_"+Math.round(e.getTime()/1e3)},Re=function(e){if(Me(e))return"$D_"+e},Me=function(e){var t=/^(\d{4})(\d{2})(\d{2})$/.exec(e);if(null==t)return!1;var n=t[3],i=t[2]-1,o=t[1],r=new Date(o,i,n);return r.getDate()==n&&r.getMonth()==i&&r.getFullYear()==o},Te=function(){function e(){i(this,e)}return r(e,null,[{key:"save",value:function(e,t){return!(!e||!t)&&(this._isLocalStorageSupported()?(localStorage.setItem(e,"string"==typeof t?t:JSON.stringify(t)),!0):void 0)}},{key:"read",value:function(e){if(!e)return!1;var t=null;if(this._isLocalStorageSupported()&&(t=localStorage.getItem(e)),null!=t)try{t=JSON.parse(t)}catch(e){}return t}},{key:"remove",value:function(e){return!!e&&(this._isLocalStorageSupported()?(localStorage.removeItem(e),!0):void 0)}},{key:"removeCookie",value:function(e,t){var n=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;";t&&(n=n+" domain="+t+"; path=/"),document.cookie=n}},{key:"createCookie",value:function(e,t,n,i){var o="",r="";if(n){var a=new Date;a.setTime(a.getTime()+1e3*n),o="; expires="+a.toGMTString()}i&&(r="; domain="+i),t=encodeURIComponent(t),document.cookie=e+"="+t+o+r+"; path=/"}},{key:"readCookie",value:function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i=0;s--){if(a=0===s?r[s]+a:"."+r[s]+a,this.readCookie(e)){var l="test_"+e+s;if(this.createCookie(l,t,10,a),!this.readCookie(l))continue;this.removeCookie(l,a)}if(this.createCookie(e,t,n,a),this.readCookie(e)==t){o=a,je.broadDomain=o;break}}else this.createCookie(e,t,n,o)}else this.createCookie(e,t,n,i)}},{key:"getMetaProp",value:function(e){var t=this.readFromLSorCookie(G);if(null!=t)return t[e]}},{key:"setMetaProp",value:function(e,t){if(this._isLocalStorageSupported()){var n=this.readFromLSorCookie(G);null==n&&(n={}),void 0===t?delete n[e]:n[e]=t,this.saveToLSorCookie(G,n)}}},{key:"getAndClearMetaProp",value:function(e){var t=this.getMetaProp(e);return this.setMetaProp(e,void 0),t}},{key:"setInstantDeleteFlagInK",value:function(){var e=this.readFromLSorCookie(q);null==e&&(e={}),e.flag=!0,this.saveToLSorCookie(q,e)}},{key:"backupEvent",value:function(e,t,n){var i=this.readFromLSorCookie(Z);void 0===i&&(i={}),i[t]={q:e},this.saveToLSorCookie(Z,i),n.debug("stored in ".concat(Z," reqNo : ").concat(t," -> ").concat(e))}},{key:"removeBackup",value:function(e,t){var n=this.readFromLSorCookie(Z);null!=n&&void 0!==n[e]&&(t.debug("del event: ".concat(e," data-> ").concat(n[e].q)),delete n[e],this.saveToLSorCookie(Z,n))}}]),e}(),je={globalCache:{gcookie:null,REQ_N:0,RESP_N:0},LRU_CACHE:null,globalProfileMap:void 0,globalEventsMap:void 0,blockRequest:!1,isOptInRequest:!1,broadDomain:null,webPushEnabled:null,campaignDivMap:{},currentSessionId:null,wiz_counter:0,notifApi:{notifEnabledFromApi:!1},unsubGroups:[],updatedCategoryLong:null,inbox:null,isPrivacyArrPushed:!1,privacyArray:[],offline:!1,location:null,dismissSpamControl:!1,globalUnsubscribe:!0,flutterVersion:null,variableStore:{}},De=x("keyOrder"),ze=x("deleteFromObject"),Be=function(){function e(t){i(this,e),Object.defineProperty(this,ze,{value:Ne}),Object.defineProperty(this,De,{writable:!0,value:void 0}),this.max=t;var n=Te.readFromLSorCookie(X);if(n){var o={};for(var r in P(this,De)[De]=[],n=n.cache)n.hasOwnProperty(r)&&(o[n[r][0]]=n[r][1],P(this,De)[De].push(n[r][0]));this.cache=o}else this.cache={},P(this,De)[De]=[]}return r(e,[{key:"get",value:function(e){var t=this.cache[e];return t&&(this.cache=P(this,ze)[ze](e,this.cache),this.cache[e]=t,P(this,De)[De].push(e)),this.saveCacheToLS(this.cache),t}},{key:"set",value:function(e,t){var n=this.cache[e],i=P(this,De)[De];null!=n?this.cache=P(this,ze)[ze](e,this.cache):i.length===this.max&&(this.cache=P(this,ze)[ze](i[0],this.cache)),this.cache[e]=t,P(this,De)[De][P(this,De)[De]-1]!==e&&P(this,De)[De].push(e),this.saveCacheToLS(this.cache)}},{key:"saveCacheToLS",value:function(e){var t=[],n=P(this,De)[De];for(var i in n)if(n.hasOwnProperty(i)){var o=[];o.push(n[i]),o.push(e[n[i]]),t.push(o)}Te.saveToLSorCookie(X,{cache:t})}},{key:"getKey",value:function(e){if(null===e)return null;var t=P(this,De)[De];for(var n in t)if(t.hasOwnProperty(n)&&this.cache[t[n]]===e)return t[n];return null}},{key:"getSecondLastKey",value:function(){var e=P(this,De)[De];return null!=e&&e.length>1?e[e.length-2]:-1}},{key:"getLastKey",value:function(){var e=P(this,De)[De].length;if(e)return P(this,De)[De][e-1]}}]),e}(),Ne=function(e,t){var n,i=JSON.parse(JSON.stringify(P(this,De)[De])),o={};for(var r in i)i.hasOwnProperty(r)&&(i[r]!==e?o[i[r]]=t[i[r]]:n=r);return i.splice(n,1),P(this,De)[De]=JSON.parse(JSON.stringify(i)),o},Fe=x("logger"),Ue=x("request"),qe=x("device"),Ve=x("session"),We=function(){function e(t){var n=t.logger,o=t.request,r=t.device,a=t.session;i(this,e),Object.defineProperty(this,Fe,{writable:!0,value:void 0}),Object.defineProperty(this,Ue,{writable:!0,value:void 0}),Object.defineProperty(this,qe,{writable:!0,value:void 0}),Object.defineProperty(this,Ve,{writable:!0,value:void 0}),P(this,Fe)[Fe]=n,P(this,Ue)[Ue]=o,P(this,qe)[qe]=r,P(this,Ve)[Ve]=a}return r(e,[{key:"s",value:function(e,t,n,i,o){var r=!1,a=!1;if(window.isOULInProgress&&(n||"undefined"!==i&&i===window.oulReqN)&&(window.isOULInProgress=!1,r=!0),void 0===i&&(i=0),Te.removeBackup(i,P(this,Fe)[Fe]),!(i>je.globalCache.REQ_N)){if(Oe(P(this,qe)[qe].gcookie)||e&&(a=!0),!Oe(P(this,qe)[qe].gcookie)||n||"boolean"==typeof o){var s=P(this,Ve)[Ve].getSessionCookieObject();if(window.isOULInProgress||s.s&&t50&&t.reportError(522,"Charged Items exceed 50 limit. Actual count: "+e[n].length),e[n])if(e[n].hasOwnProperty(i)&&(!ke(e[n][i])||!rt(e[n][i])))return!1}else{if(ke(e[n])||Array.isArray(e[n]))return!1;Ce(e[n])&&(e[n]=Le(e[n]))}if(we(e[N])||Se(e[N])){var o=e[N]+"";if(void 0===O&&(O=Te.readFromLSorCookie(F)),void 0!==O&&O.trim()===o.trim())return t.error("Duplicate charged Id - Dropped"+e),!1;O=o,Te.saveToLSorCookie(F,o)}return!0}return!1},st=x("logger"),lt=x("oldValues"),ct=x("request"),ut=x("isPersonalisationActive"),dt=x("processEventArray"),pt=function(e){c(n,e);var t=y(n);function n(e,o){var r,a=e.logger,s=e.request,l=e.isPersonalisationActive;return i(this,n),r=t.call(this),Object.defineProperty(v(r),dt,{value:ht}),Object.defineProperty(v(r),st,{writable:!0,value:void 0}),Object.defineProperty(v(r),lt,{writable:!0,value:void 0}),Object.defineProperty(v(r),ct,{writable:!0,value:void 0}),Object.defineProperty(v(r),ut,{writable:!0,value:void 0}),P(v(r),st)[st]=a,P(v(r),lt)[lt]=o,P(v(r),ct)[ct]=s,P(v(r),ut)[ut]=l,r}return r(n,[{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0;){var t=e.shift();if(we(t))if(t.length>1024&&(t=t.substring(0,1024),P(this,st)[st].reportError(510,t+"... length exceeded 1024 chars. Trimmed.")),me.includes(t))P(this,st)[st].reportError(513,t+" is a restricted system event. It cannot be used as an event name.");else{var n={type:"event"};if(n.evtName=_e(t,j),0!==e.length){var i=e.shift();if(ke(i)){if("Charged"===t){if(!at(i,P(this,st)[st])){P(this,st)[st].reportError(511,"Charged event structure invalid. Not sent.");continue}}else if(!rt(i)){P(this,st)[st].reportError(512,t+" event structure invalid. Not sent.");continue}n.evtData=i}else e.unshift(i)}P(this,ct)[ct].processEvent(n)}else P(this,st)[st].error($e)}},ft=function(e){var t={},n=e.indexOf("?");if(n>1){var i,o=e.substring(n+1),r=/\+/g,a=/([^&=]+)=?([^&]*)/g,s=function(e){var t=e.replace(r," ");try{t=decodeURIComponent(t)}catch(e){}return t};for(i=a.exec(o);i;)t[s(i[1])]=s(i[2]),i=a.exec(o)}return t},vt=function(e,t,n){return e+"&"+t+"="+encodeURIComponent(n)},gt=function(){return window.location.hostname},yt=function(e,t){return t&&"function"==typeof t.debug&&t.debug("dobj:"+e),mt(e)},bt=function(){var e="",t=0;for(t=0;t<=25;t++)e+=String.fromCharCode(t+65);for(t=0;t<=25;t++)e+=String.fromCharCode(t+97);for(t=0;t<10;t++)e+=t;return e+"+/="}(),mt=function(e){if(null==e)return"";var t,n,i,o,r,a,s,l="",c=0;for(e=function(e){if(null==e)return"";var t,n,i,o={},r={},a="",s="",l="",c=2,u=3,d=2,p="",h=0,f=0,v=String.fromCharCode;for(i=0;i>=1}else{for(n=1,t=0;t>=1}0==--c&&(c=Math.pow(2,d),d++),delete r[l]}else for(n=o[l],t=0;t>=1;0==--c&&(c=Math.pow(2,d),d++),o[s]=u++,l=String(a)}if(""!==l){if(Object.prototype.hasOwnProperty.call(r,l)){if(l.charCodeAt(0)<256){for(t=0;t>=1}else{for(n=1,t=0;t>=1}0==--c&&(c=Math.pow(2,d),d++),delete r[l]}else for(n=o[l],t=0;t>=1;0==--c&&(c=Math.pow(2,d),d++)}for(n=2,t=0;t>=1;for(;;){if(h<<=1,15==f){p+=v(h);break}f++}return p}(e);c<2*e.length;)c%2==0?(t=e.charCodeAt(c/2)>>8,n=255&e.charCodeAt(c/2),i=c/2+1>8:NaN):(t=255&e.charCodeAt((c-1)/2),(c+1)/2>8,i=255&e.charCodeAt((c+1)/2)):n=i=NaN),c+=3,o=t>>2,r=(3&t)<<4|n>>4,a=(15&n)<<2|i>>6,s=63&i,isNaN(n)?a=s=64:isNaN(i)&&(s=64),l=l+bt.charAt(o)+bt.charAt(r)+bt.charAt(a)+bt.charAt(s);return l},wt=x("fireRequest"),kt=x("dropRequestDueToOptOut"),Ct=x("addUseIPToRequest"),xt=x("addARPToRequest"),Pt=function(){function e(){i(this,e),this.networkRetryCount=0,this.minDelayFrequency=0}return r(e,[{key:"getDelayFrequency",value:function(){if(this.logger.debug("Network retry #"+this.networkRetryCount),this.networkRetryCount<10)return this.logger.debug(this.account.id,"Failure count is "+this.networkRetryCount+". Setting delay frequency to 1s"),this.minDelayFrequency=ye,this.minDelayFrequency;if(null==this.account.region)return this.logger.debug(this.account.id,"Setting delay frequency to 1s"),ye;var e=1e3*(Math.floor(10*Math.random())+1);return this.minDelayFrequency+=e,this.minDelayFrequency<6e5?(this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency):(this.minDelayFrequency=ye,this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency)}}],[{key:"fireRequest",value:function(e,t,n,i){P(this,wt)[wt](e,1,t,n,i)}}]),e}();Pt.logger=void 0,Pt.device=void 0,Pt.account=void 0,Object.defineProperty(Pt,wt,{value:function(e,t,n,i,o){var r,a,s=this;if(P(this,kt)[kt]())this.logger.debug("req dropped due to optout cookie: "+this.device.gcookie);else{if(Oe(this.device.gcookie)||(je.blockRequest=!0),o&&o===be)!Oe(this.device.gcookie)&&je.globalCache.RESP_N url: "+e)}}}),Object.defineProperty(Pt,kt,{value:function(){return!je.isOptInRequest&&Oe(this.device.gcookie)&&we(this.device.gcookie)?":OO"===this.device.gcookie.slice(-3):(je.isOptInRequest=!1,!1)}}),Object.defineProperty(Pt,Ct,{value:function(e){var t=Te.getMetaProp(Q);return"boolean"!=typeof t&&(t=!1),vt(e,Q,t?"true":"false")}}),Object.defineProperty(Pt,xt,{value:function(e,t){if(!0===t){var n={skipResARP:!0};return vt(e,"arp",yt(JSON.stringify(n),this.logger))}return Te._isLocalStorageSupported()&&void 0!==localStorage.getItem(J)&&null!==localStorage.getItem(J)?vt(e,"arp",yt(JSON.stringify(Te.readFromLSorCookie(J)),this.logger)):e}});var St=function(){var e={};if(Te._isLocalStorageSupported()){var t=Te.read(V);null!=t?(t=JSON.parse(decodeURIComponent(t).replace(z,'"'))).hasOwnProperty("global")?e.wp=t:e=t:e={}}return e},Ot=function(e){if(Te._isLocalStorageSupported()){var t=l(l({},St()),e),n=JSON.stringify(t);Te.save(V,encodeURIComponent(n)),It()}},It=function(){if(Te._isLocalStorageSupported()){var e=Te.read(U);if(Oe(e))try{e=JSON.parse(decodeURIComponent(Te.read(U)));var t=Te.read(W)?JSON.parse(decodeURIComponent(Te.read(W))):{};if(e&&Te._isLocalStorageSupported()){var n={},i=St();Object.keys(i).forEach((function(o){var r=e in t&&Object.keys(t[e]).length&&t[e][o]?t[e][o]:{},s=i[o].global,c=Ee(),u=i[o][c];if(void 0!==s){var d=Object.keys(s);for(var p in d){var h=[];if(d.hasOwnProperty(p)){var f=0,v=0,g=d[p];if("tc"===g)continue;void 0!==u&&void 0!==u[g]&&(f=u[g]),void 0!==s&&void 0!==s[g]&&(v=s[g]),h=[g,f,v],r[g]=h}}}n=l(l({},n),{},a({},o,r))})),t[e]=n,Te.save(W,encodeURIComponent(JSON.stringify(t)))}}catch(e){console.error("Invalid clevertap Id "+e)}}},_t=function(){var e=JSON.parse(decodeURIComponent(Te.read(U))),t={};if(Te._isLocalStorageSupported()){t=St();var n=Te.read(W),i=n?decodeURIComponent(n):null,o=i?JSON.parse(i):null,r=e&&null!=n&&o&&o[e]&&o[e].wp?Object.values(o[e].wp):[],a=e&&null!=n&&o&&o[e]&&o[e].wi?Object.values(o[e].wi):[],s=Ee(),l=0,c=0;return t.wp&&t.wp[s]&&"undefined"!==t.wp[s].tc&&(l=t.wp[s].tc),t.wi&&t.wi[s]&&"undefined"!==t.wi[s].tc&&(c=t.wi[s].tc),{wmp:l,wimp:c,tlc:r,witlc:a}}},Et=function(e,t){var n=t.logger,i=!1;if(ke(e))for(var o in e)if(e.hasOwnProperty(o)){i=!0;var r=e[o];if(null==r){delete e[o];continue}"Gender"!==o||r.match(/^M$|^F$/)||(i=!1,n.error(Ye)),"Employed"!==o||r.match(/^Y$|^N$/)||(i=!1,n.error(Qe)),"Married"!==o||r.match(/^Y$|^N$/)||(i=!1,n.error(Xe)),"Education"!==o||r.match(/^School$|^College$|^Graduate$/)||(i=!1,n.error(et)),"Age"===o&&null!=r&&(Pe(r)?e.Age=+r:(i=!1,n.error(tt))),"DOB"===o?(/^\$D_/.test(r)&&11===(r+"").length||Ce(r)||(i=!1,n.error(nt)),Ce(r)&&(e[o]=Le(r))):Ce(r)&&(e[o]=Le(r)),"Phone"!==o||xe(r)||(r.length>8&&"+"===r.charAt(0)?(r=r.substring(1,r.length),Pe(r)?e.Phone=+r:(i=!1,n.error(ot+". Removed."))):(i=!1,n.error(ot+". Removed."))),i||delete e[o]}return i},At=function(e){var t={};t.Name=e.name,null!=e.id&&(t.FBID=e.id+""),"male"===e.gender?t.Gender="M":"female"===e.gender?t.Gender="F":t.Gender="O";null!=e.relationship_status&&(t.Married="N","Married"===e.relationship_status&&(t.Married="Y"));var n=function(e){if(null!=e){for(var t="",n="",i=0;i0?"Y":"N",null!=e.email&&(t.Email=e.email),null!=e.birthday){var o=e.birthday.split("/");t.DOB=Re(o[2]+o[0]+o[1])}return t},Lt=function(e,t){var n=t.logger,i={};if(null!=e.displayName&&(i.Name=e.displayName),null!=e.id&&(i.GPID=e.id+""),null!=e.gender&&("male"===e.gender?i.Gender="M":"female"===e.gender?i.Gender="F":"other"===e.gender&&(i.Gender="O")),null!=e.image&&!1===e.image.isDefault&&(i.Photo=e.image.url.split("?sz")[0]),null!=e.emails)for(var o=0;o0)for(var t in e)if(e.hasOwnProperty(t)){var n=e[t],i={},o=void 0;if(null!=n.Site){if(o=n.Site,xe(o)||!Et(o,{logger:P(this,Dt)[Dt]}))return}else if(null!=n.Facebook){var r=n.Facebook;xe(r)||r.error||(o=At(r))}else if(null!=n["Google Plus"]){var a=n["Google Plus"];xe(a)||a.error||(o=Lt(a,{logger:P(this,Dt)[Dt]}))}if(null!=o&&!xe(o)){i.type="profile",null==o.tz&&(o.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),i.profile=o,Rt(o,!0),i=P(this,zt)[zt].addSystemDataToObject(i,void 0),P(this,zt)[zt].addFlags(i);var s=yt(JSON.stringify(i),P(this,Dt)[Dt]),l=P(this,Bt)[Bt].dataPostURL;l=vt(l,"type",ee),l=vt(l,"d",s),P(this,zt)[zt].saveAndFireRequest(l,je.blockRequest)}}},Wt=x("request"),Kt=x("logger"),Gt=x("account"),Ht=x("session"),Jt=x("oldValues"),Zt=x("device"),$t=x("processOUL"),Yt=x("handleCookieFromCache"),Qt=x("deleteUser"),Xt=x("processLoginArray"),en=function(e){c(n,e);var t=y(n);function n(e,o){var r,a=e.request,s=e.account,l=e.session,c=e.logger,u=e.device;return i(this,n),r=t.call(this),Object.defineProperty(v(r),Xt,{value:rn}),Object.defineProperty(v(r),Qt,{value:on}),Object.defineProperty(v(r),Yt,{value:nn}),Object.defineProperty(v(r),$t,{value:tn}),Object.defineProperty(v(r),Wt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Kt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Gt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Ht,{writable:!0,value:void 0}),Object.defineProperty(v(r),Jt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Zt,{writable:!0,value:void 0}),P(v(r),Wt)[Wt]=a,P(v(r),Gt)[Gt]=s,P(v(r),Ht)[Ht]=l,P(v(r),Kt)[Kt]=c,P(v(r),Jt)[Jt]=o,P(v(r),Zt)[Zt]=u,r}return r(n,[{key:"clear",value:function(){P(this,Kt)[Kt].debug("clear called. Reset flag has been set."),P(this,Qt)[Qt](),Te.setMetaProp(B,!0)}},{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0)for(var o in e)if(e.hasOwnProperty(o)){var r=e[o],a={},s=void 0;if(null!=r.Site){if(s=r.Site,xe(s)||!Et(s,{logger:P(this,Kt)[Kt]}))return}else if(null!=r.Facebook){var l=r.Facebook;xe(l)||l.error||(s=At(l))}else if(null!=r["Google Plus"]){var c=r["Google Plus"];xe(c)&&!c.error&&(s=Lt(c,{logger:P(this,Kt)[Kt]}))}if(null!=s&&!xe(s)){a.type="profile",null==s.tz&&(s.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),a.profile=s;var u=[];Te._isLocalStorageSupported()&&(s.Identity&&u.push(s.Identity),s.Email&&u.push(s.Email),s.GPID&&u.push("GP:"+s.GPID),s.FBID&&u.push("FB:"+s.FBID),u.length>0&&i(u)),Rt(s,!0),a=P(this,Wt)[Wt].addSystemDataToObject(a,void 0),P(this,Wt)[Wt].addFlags(a),n&&(a.isOUL=!0);var d=yt(JSON.stringify(a),P(this,Kt)[Kt]),p=P(this,Gt)[Gt].dataPostURL;p=vt(p,"type",ee),p=vt(p,"d",d),P(this,Wt)[Wt].saveAndFireRequest(p,je.blockRequest,n)}}},nn=function(){je.blockRequest=!1,console.debug("Block request is false"),Te._isLocalStorageSupported()&&(delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),Te.removeCookie(V,gt()),Te.removeCookie(P(this,Ht)[Ht].cookieName,je.broadDomain),Te.removeCookie(J,je.broadDomain),P(this,Ht)[Ht].setSessionCookieObject("")},on=function(){je.blockRequest=!0,P(this,Kt)[Kt].debug("Block request is true"),je.globalCache={gcookie:null,REQ_N:0,RESP_N:0},Te._isLocalStorageSupported()&&(delete localStorage.WZRK_G,delete localStorage.WZRK_K,delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),Te.removeCookie(U,je.broadDomain),Te.removeCookie(V,gt()),Te.removeCookie(q,gt()),Te.removeCookie(P(this,Ht)[Ht].cookieName,je.broadDomain),Te.removeCookie(J,je.broadDomain),P(this,Zt)[Zt].gcookie=null,P(this,Ht)[Ht].setSessionCookieObject("")},rn=function(e){if(Array.isArray(e)&&e.length>0){var t=e.pop();if(null!=t&&ke(t)&&(null!=t.Site&&Object.keys(t.Site).length>0||null!=t.Facebook&&Object.keys(t.Facebook).length>0||null!=t["Google Plus"]&&Object.keys(t["Google Plus"]).length>0)){Te.setInstantDeleteFlagInK();try{P(this,$t)[$t]([t])}catch(e){P(this,Kt)[Kt].debug(e)}}else P(this,Kt)[Kt].error("Profile object is in incorrect format")}},an=function(e){c(n,e);var t=y(n);function n(){var e;return i(this,n),(e=t.call(this))._details=null,e.shadow=null,e.shadow=e.attachShadow({mode:"open"}),e}return r(n,[{key:"renderBanner",value:function(){var e=this;this.shadow.innerHTML=this.getBannerContent(),!1!==this.trackClick&&this.addEventListener("click",(function(){var t=e.details.onClick;t&&(e.details.window?window.open(t,"_blank"):window.parent.location.href=t),window.clevertap.renderNotificationClicked({msgId:e.msgId,pivotId:e.pivotId})})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId})}},{key:"getBannerContent",value:function(){return'\n \n \n ")}},{key:"details",get:function(){return this._details||""},set:function(e){null===this._details&&(this._details=e,this.renderBanner())}}]),n}(f(HTMLElement)),sn=function(e){c(n,e);var t=y(n);function n(){var e;return i(this,n),(e=t.call(this))._target=null,e._carousel=null,e.shadow=null,e.slides=0,e.previouslySelectedItem=-1,e.selectedItem=1,e.autoSlide=null,e.stopAutoSlideTimeout=null,e.shadow=e.attachShadow({mode:"open"}),void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",an),e}return r(n,[{key:"renderCarousel",value:function(){this.slides=this.details.length,this.shadow.innerHTML=this.getStyles();var e=this.getCarouselContent();this.display.showNavBtns&&e.insertAdjacentHTML("beforeend",this.display.navBtnsHtml),this.display.showNavArrows&&(e.insertAdjacentHTML("beforeend",this.display.leftNavArrowHtml),e.insertAdjacentHTML("beforeend",this.display.rightNavArrowHtml)),this._carousel=e,this.shadow.appendChild(e),this.setupClick(),this.updateSelectedItem(),this.startAutoSlide(),this.setupOnHover(),window.clevertap.renderNotificationViewed({msgId:this.target.wzrk_id,pivotId:this.target.wzrk_pivot})}},{key:"setupClick",value:function(){var e=this;this._carousel.addEventListener("click",(function(t){var n=t.target.id;if(n.startsWith("carousel__button")){var i=+n.split("-")[1];i!==e.selectedItem&&(e.previouslySelectedItem=e.selectedItem,e.selectedItem=i,e.updateSelectedItem(),e.startAutoSlide())}else if(n.startsWith("carousel__arrow"))n.endsWith("right")?e.goToNext():e.goToPrev(),e.startAutoSlide();else if(n.indexOf("-")>-1){var o=+n.split("-")[1],r=o-1;window.parent.clevertap&&window.clevertap.renderNotificationClicked({msgId:e.target.wzrk_id,pivotId:e.target.wzrk_pivot,wzrk_slideNo:o});var a=e.details[r].onClick;""!==a&&(e.details[r].window?window.open(a,"_blank"):window.location.href=a)}}))}},{key:"setupOnHover",value:function(){var e=this;this._carousel.addEventListener("mouseenter",(function(t){e.stopAutoSlideTimeout=setTimeout((function(){e.autoSlide=clearInterval(e.autoSlide)}),500)})),this._carousel.addEventListener("mouseleave",(function(t){clearTimeout(e.stopAutoSlideTimeout),void 0===e.autoSlide&&e.startAutoSlide()}))}},{key:"getCarouselContent",value:function(){var e=document.createElement("div");return e.setAttribute("class","carousel"),this.details.forEach((function(t,n){var i=document.createElement("ct-web-personalisation-banner");i.classList.add("carousel__item"),i.trackClick=!1,i.setAttribute("id","carousel__item-".concat(n+1)),i.details=t,e.appendChild(i)})),e}},{key:"getStyles",value:function(){var e,t;return"\n \n ")}},{key:"updateSelectedItem",value:function(){if(-1!==this.previouslySelectedItem){var e=this.shadow.getElementById("carousel__item-".concat(this.previouslySelectedItem)),t=this.shadow.getElementById("carousel__button-".concat(this.previouslySelectedItem));e.classList.remove("carousel__item--selected"),t.classList.remove("carousel__button--selected")}var n=this.shadow.getElementById("carousel__item-".concat(this.selectedItem)),i=this.shadow.getElementById("carousel__button-".concat(this.selectedItem));n.classList.add("carousel__item--selected"),i.classList.add("carousel__button--selected")}},{key:"startAutoSlide",value:function(){var e=this;clearInterval(this.autoSlide),this.autoSlide=setInterval((function(){e.goToNext()}),this.display.sliderTime?1e3*this.display.sliderTime:3e3)}},{key:"goToNext",value:function(){this.goTo(this.selectedItem,(this.selectedItem+1)%this.slides)}},{key:"goToPrev",value:function(){this.goTo(this.selectedItem,this.selectedItem-1)}},{key:"goTo",value:function(e,t){this.previouslySelectedItem=e,this.selectedItem=t,0===t&&(this.selectedItem=this.slides),this.updateSelectedItem()}},{key:"target",get:function(){return this._target||""},set:function(e){null===this._target&&(this._target=e,this.renderCarousel())}},{key:"details",get:function(){return this.target.display.details}},{key:"display",get:function(){return this.target.display}}]),n}(f(HTMLElement)),ln=function(e){c(n,e);var t=y(n);function n(){var e;return i(this,n),(e=t.call(this))._target=null,e._session=null,e.shadow=null,e.popup=null,e.container=null,e.resizeObserver=null,e.shadow=e.attachShadow({mode:"open"}),e}return r(n,[{key:"renderImageOnlyPopup",value:function(){var e=this,t=this.target.wzrk_id.split("_")[0],n=this.session.sessionId;this.shadow.innerHTML=this.getImageOnlyPopupContent(),this.popup=this.shadowRoot.getElementById("imageOnlyPopup"),this.container=this.shadowRoot.getElementById("container"),this.closeIcon=this.shadowRoot.getElementById("close"),this.popup.addEventListener("load",this.updateImageAndContainerWidth()),this.resizeObserver=new ResizeObserver((function(){return e.handleResize(e.popup,e.container)})),this.resizeObserver.observe(this.popup),this.closeIcon.addEventListener("click",(function(){if(e.resizeObserver.unobserve(e.popup),document.getElementById("wzrkImageOnlyDiv").style.display="none",e.remove(),null!=t&&"-1"!==t&&Te._isLocalStorageSupported()){var i=St(),o=i.wp[n];null==o&&(o={},i[n]=o),o[t]="dnd",Ot(i)}})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId}),this.onClickUrl&&this.popup.addEventListener("click",(function(){e.target.display.window?window.open(e.onClickUrl,"_blank"):window.parent.location.href=e.onClickUrl,window.clevertap.renderNotificationClicked({msgId:e.msgId,pivotId:e.pivotId})}))}},{key:"handleResize",value:function(e,t){var n=this.getRenderedImageWidth(e);t.style.setProperty("width","".concat(n,"px"))}},{key:"getImageOnlyPopupContent",value:function(){return"\n ".concat(this.target.msgContent.css,"\n ").concat(this.target.msgContent.html,"\n ")}},{key:"updateImageAndContainerWidth",value:function(){var e=this;return function(){var t=e.getRenderedImageWidth(e.popup);e.popup.style.setProperty("width","".concat(t,"px")),e.container.style.setProperty("width","".concat(t,"px")),e.container.style.setProperty("height","auto"),e.container.style.setProperty("position","fixed"),e.popup.style.setProperty("visibility","visible"),e.closeIcon.style.setProperty("visibility","visible"),document.getElementById("wzrkImageOnlyDiv").style.visibility="visible"}}},{key:"getRenderedImageWidth",value:function(e){var t=e.naturalWidth/e.naturalHeight;return e.height*t}},{key:"target",get:function(){return this._target||""},set:function(e){null===this._target&&(this._target=e,this.renderImageOnlyPopup())}},{key:"session",get:function(){return this._session||""},set:function(e){this._session=e}},{key:"msgId",get:function(){return this.target.wzrk_id}},{key:"pivotId",get:function(){return this.target.wzrk_pivot}},{key:"onClickUrl",get:function(){return this.target.display.onClickUrl}}]),n}(f(HTMLElement)),cn=function(e){c(n,e);var t=y(n);function n(e,o){var r;return i(this,n),(r=t.call(this)).wrapper=null,r.snackBar=null,r.shadow=r.attachShadow({mode:"open"}),r.config=e,r.message=o,r.renderMessage(o),r}return r(n,[{key:"createEl",value:function(e,t,n){var i=document.createElement(e);return i.setAttribute("id",t),i.setAttribute("part",n||t),i}},{key:"renderMessage",value:function(e){switch(this.wrapper=this.createEl("div","messageWrapper"),e.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":var t=this.prepareBasicMessage(e.msg[0]);this.wrapper.appendChild(t)}var n=this.createEl("div","timeStamp");if(n.innerHTML="".concat(mn(e.id.split("_")[1]),""),!e.viewed){var i=this.createEl("span","unreadMarker");n.appendChild(i)}this.wrapper.appendChild(n),this.shadow.appendChild(this.wrapper)}},{key:"prepareBasicMessage",value:function(e){var t=this.createEl("div","message");if(e.imageUrl){var n=this.addImage(e.imageUrl,"mainImg");t.appendChild(n)}var i=this.createEl("div","iconTitleDescWrapper");if(e.iconUrl){var o=this.addImage(e.iconUrl,"iconImg");i.appendChild(o)}var r=this.createEl("div","titleDescWrapper");if(e.title){var a=this.createEl("div","title");a.innerText=e.title,r.appendChild(a)}if(e.description){var s=this.createEl("div","description");s.innerText=e.description,r.appendChild(s)}if((e.title||e.description)&&i.appendChild(r),(e.iconUrl||e.title||e.description)&&t.appendChild(i),e.buttons&&e.buttons.length){var l=this.addButtons(e.buttons);t.appendChild(l)}return t}},{key:"addButtons",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.createEl("div","buttonsContainer"),i=!1;return t.forEach((function(t,o){var r=e.createEl("button","button-".concat(o),"button");r.innerText=t.text,o>0&&(r.style.cssText+="margin-left: 2px;"),"copy"===t.action&&(i=!0),n.appendChild(r)})),i&&this.addSnackbar(n),n}},{key:"addSnackbar",value:function(e){this.snackBar=this.createEl("div","snackbar-".concat(this.campaignId),"snackbar"),this.snackBar.innerHTML=Cn;var t=this.createEl("span","snackbar-msg-".concat(this.campaignId),"snackbar-msg");t.innerText="Copied to clipboard",this.snackBar.appendChild(t),e.appendChild(this.snackBar)}},{key:"addImage",value:function(e,t){var n=this.createEl("div","".concat(t,"Container")),i=this.createEl("img",t);return i.setAttribute("src",e),i.setAttribute("loading","lazy"),n.appendChild(i),n}},{key:"raiseClickedEvent",value:function(e,t){switch(this.message.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":this.raiseClickedForBasicTemplates(e,t)}}},{key:"raiseClickedForBasicTemplates",value:function(e,t){var n=this,i=this.message.msg[0],o={msgId:this.campaignId,pivotId:this.pivotId};if("BUTTON"===e.tagName){var r=e.id.split("-")[1],a=i.buttons[r];o.kv={wzrk_c2a:a.text},"url"===a.action?a.openUrlInNewTab?window.open(a.url,"_blank"):window.location=a.url:"copy"===a.action&&(window.focus(),navigator.clipboard.writeText(a.clipboardText),this.snackBar.style.setProperty("display","flex","important"),setTimeout((function(){n.snackBar.style.setProperty("display","none","important")}),2e3))}else"CT-INBOX-MESSAGE"===e.tagName&&i.onClickUrl&&(i.openUrlInNewTab?window.open(i.onClickUrl,"_blank"):window.location=i.onClickUrl);t?console.log("Notifiction clicked event will be raised at run time with payload ::",o):window.clevertap.renderNotificationClicked(o)}},{key:"pivotId",get:function(){return this.message.wzrk_pivot}},{key:"campaignId",get:function(){return this.message.wzrk_id}}]),n}(f(HTMLElement)),un=function(e){c(n,e);var t=y(n);function n(e){var o;return i(this,n),(o=t.call(this)).isInboxOpen=!1,o.isInboxFromFlutter=!1,o.selectedCategory=null,o.unviewedMessages={},o.unviewedCounter=0,o.isPreview=!1,o.inboxConfigForPreview={},o.inboxSelector=null,o.inbox=null,o.emptyInboxMsg=null,o.inboxCard=null,o.unviewedBadge=null,o.observer=null,o.selectedCategoryRef=null,o.addClickListenerOnDocument=function(e){if(e.composedPath().includes(o.inbox)){var t=e.path||e.composedPath&&e.composedPath();if(t.length){var n=t[0].id;if("closeInbox"===n)o.toggleInbox();else if(n.startsWith("category-"))o.prevCategoryRef=o.selectedCategoryRef,o.selectedCategoryRef=t[0],o.updateActiveCategory(t[0].innerText);else{var i=t.filter((function(e){var t;return(null===(t=e.id)||void 0===t?void 0:t.startsWith("button-"))||"CT-INBOX-MESSAGE"===e.tagName}));i.length&&i[i.length-1].raiseClickedEvent(i[0],o.isPreview)}}}else(o.inboxSelector.contains(e.target)||o.isInboxOpen)&&(o.isInboxFromFlutter?o.isInboxFromFlutter=!1:o.toggleInbox(e))},o.setBadgeStyle=function(e){null!==o.unviewedBadge&&(o.unviewedBadge.innerText=e>9?"9+":e,o.unviewedBadge.style.display=e>0?"flex":"none")},o.logger=e,o.shadow=o.attachShadow({mode:"open"}),o}return r(n,[{key:"connectedCallback",value:function(){this.init()}},{key:"init",value:function(){this.config=this.isPreview?this.inboxConfigForPreview:Te.readFromLSorCookie(ve)||{},0!==Object.keys(this.config).length&&(this.inboxSelector=document.getElementById(this.config.inboxSelector),null!==this.inboxSelector&&(this.config.styles.notificationsBadge?this.addUnviewedBadge():this.unviewedBadge&&this.unviewedBadge.remove(),this.createinbox(),document.removeEventListener("click",this.addClickListenerOnDocument),document.addEventListener("click",this.addClickListenerOnDocument),this.config.categories.length&&this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadow.innerHTML=this.getInboxStyles(),this.shadow.appendChild(this.inbox)))}},{key:"addMsgsToInboxFromLS",value:function(){var e=this,t=this.deleteExpiredAndGetUnexpiredMsgs(!1),n=t?Object.keys(t):[];0!==n.length&&(n.forEach((function(n){t[n].viewed||(e.unviewedMessages[n]=t[n],e.unviewedCounter++)})),this.buildUIForMessages(t),this.updateUnviewedBadgeCounter())}},{key:"deleteExpiredAndGetUnexpiredMsgs",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=fn(),n=Math.floor(Date.now()/1e3);for(var i in t)if(t[i].wzrk_ttl&&t[i].wzrk_ttl>0&&t[i].wzrk_ttl0&&(t=Object.values(t).sort((function(e,t){return t.date-e.date})).reduce((function(e,t){return e[t.id]=t,e}),{})),vn(t),t}},{key:"updateInboxMessages",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.deleteExpiredAndGetUnexpiredMsgs(),i=Date.now(),o={};t.forEach((function(t,r){var a="".concat(t.wzrk_id.split("_")[0],"_").concat(Date.now());t.id=a,t.date=i-r,t.viewed=0,n[a]=t,o[a]=t,e.unviewedMessages[a]=t,e.unviewedCounter++})),vn(n),this.buildUIForMessages(o),this.updateUnviewedBadgeCounter()}},{key:"createEl",value:function(e,t,n){var i=document.createElement(e);return i.setAttribute("id",t),i.setAttribute("part",n||t),i}},{key:"addUnviewedBadge",value:function(){var e=this;this.unviewedBadge||(this.unviewedBadge=this.createEl("div","unviewedBadge"),this.unviewedBadge.style.cssText="display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ".concat(this.config.styles.notificationsBadge.backgroundColor,"; font-size: 12px; color: ").concat(this.config.styles.notificationsBadge.textColor,"; font-weight: bold; align-items: center; justify-content: center;"),document.body.appendChild(this.unviewedBadge)),this.updateUnviewedBadgePosition(),window.addEventListener("resize",(function(){e.updateUnviewedBadgePosition()}))}},{key:"updateUnviewedBadgePosition",value:function(){var e=this.inboxSelector.getBoundingClientRect(),t=e.top,n=e.right;this.unviewedBadge.style.top="".concat(t-8,"px"),this.unviewedBadge.style.left="".concat(n-8,"px")}},{key:"createinbox",value:function(){var e=this;this.inbox=this.createEl("div","inbox");var t=this.createEl("div","header"),n=this.createEl("div","headerTitle");n.innerText=this.config.title;var i=this.createEl("div","closeInbox");if(i.innerHTML="×",t.appendChild(n),t.appendChild(i),this.inbox.appendChild(t),this.config.categories.length){var o=this.createCategories();this.inbox.appendChild(o)}this.inboxCard=this.createEl("div","inboxCard"),this.inbox.appendChild(this.inboxCard),this.emptyInboxMsg=this.createEl("div","emptyInboxMsg"),this.emptyInboxMsg.innerText="All messages will be displayed here.",this.inboxCard.appendChild(this.emptyInboxMsg);var r={root:this.inboxCard,rootMargin:"0px",threshold:.5};this.observer=new IntersectionObserver((function(t,n){e.handleMessageViewed(t)}),r),this.addMsgsToInboxFromLS()}},{key:"createCategories",value:function(){var e=this,t=this.createEl("div","categoriesContainer"),n=this.createEl("div","leftArrow");n.innerHTML=kn,n.children[0].style="transform: rotate(180deg)",n.addEventListener("click",(function(){e.shadowRoot.getElementById("categoriesWrapper").scrollBy(-70,0)})),t.appendChild(n);var i=this.createEl("div","categoriesWrapper");["All"].concat(b(this.config.categories)).forEach((function(t,n){var o=e.createEl("div","category-".concat(n),"category");o.innerText=t,0===n&&(e.selectedCategoryRef=o),i.appendChild(o)})),t.appendChild(i);var o=this.createEl("div","rightArrow");o.innerHTML=kn,o.addEventListener("click",(function(){e.shadowRoot.getElementById("categoriesWrapper").scrollBy(70,0)})),t.appendChild(o);var r={root:t,threshold:.9},a=i.children[0],s=i.children[this.config.categories.length];return new IntersectionObserver((function(t){e.categoryObserverCb(n,t[0].intersectionRatio>=.9)}),r).observe(a),new IntersectionObserver((function(t){e.categoryObserverCb(o,t[0].intersectionRatio>=.9)}),r).observe(s),t}},{key:"categoryObserverCb",value:function(e,t){e&&(e.style.display=t?"none":"flex")}},{key:"updateActiveCategory",value:function(e){var t=this;this.selectedCategory=e,this.inboxCard.scrollTop=0;var n=0;this.prevCategoryRef&&this.prevCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef.setAttribute("selected","true"),this.inboxCard.childNodes.forEach((function(e){"emptyInboxMsg"!==e.getAttribute("id")&&(e.style.display="All"===t.selectedCategory||e.getAttribute("category")===t.selectedCategory?"block":"none","block"===e.style.display&&n++)})),0===n?(this.emptyInboxMsg.innerText="".concat(e," messages will be displayed here."),this.emptyInboxMsg.style.display="block"):this.emptyInboxMsg.style.display="none"}},{key:"buildUIForMessages",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!this.isPreview&&this.updateTSForRenderedMsgs(),this.inboxCard.scrollTop=0;var n,i=null!==(e=this.config.maxMsgsInInbox)&&void 0!==e?e:15,o=this.inboxCard.firstChild,r=Object.values(t).sort((function(e,t){return t.date-e.date})).map((function(e){return e.id})),a=k(r);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=new cn(this.config,t[s]);l.setAttribute("id",t[s].id),l.setAttribute("pivot",t[s].wzrk_pivot),l.setAttribute("part","ct-inbox-message"),this.config.categories.length>0?(l.setAttribute("category",t[s].tags[0]||""),l.style.display="All"===this.selectedCategory||t[s].category===this.selectedCategory?"block":"none"):l.style.display="block",this.inboxCard.insertBefore(l,o),this.observer.observe(l)}}catch(e){a.e(e)}finally{a.f()}for(var c=this.inboxCard.querySelectorAll("ct-inbox-message").length;c>i;){var u=this.inboxCard.querySelectorAll("ct-inbox-message");u.length>0&&u[u.length-1].remove(),c--}var d=this.inboxCard.querySelectorAll('ct-inbox-message[style*="display: block"]').length;this.emptyInboxMsg.style.display=d?"none":"block"}},{key:"handleMessageViewed",value:function(e){var t=this,n=!this.isPreview;this.isInboxOpen&&e.forEach((function(e){e.isIntersecting&&t.unviewedMessages.hasOwnProperty(e.target.id)&&0===e.target.message.viewed&&(e.target.message.viewed=1,n?(window.clevertap.renderNotificationViewed({msgId:e.target.campaignId,pivotId:e.target.pivotId}),t.updateMessageInLS(e.target.id,l(l({},e.target.message),{},{viewed:1})),setTimeout((function(){e.target.shadowRoot.getElementById("unreadMarker").style.display="none"}),1e3)):console.log("Notifiction viewed event will be raised at run time with payload ::",{msgId:e.target.campaignId,pivotId:e.target.pivotId}),t.unviewedCounter--,t.updateUnviewedBadgeCounter(),delete t.unviewedMessages[e.target.id])}))}},{key:"updateMessageInLS",value:function(e,t){if(!this.isPreview){var n=fn();n[e]=t,vn(n)}}},{key:"toggleInbox",value:function(e){this.isInboxOpen=!this.isInboxOpen,this.isInboxFromFlutter=!!(null==e?void 0:e.rect),this.isInboxOpen?(this.inboxCard.scrollTop=0,!this.isPreview&&this.deleteExpiredAndGetUnexpiredMsgs(),this.inbox.style.display="block",this.inbox.style.zIndex="2147483647",this.config.categories.length&&(this.selectedCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef=this.shadowRoot.getElementById("category-0"),this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadowRoot.getElementById("categoriesWrapper").scrollLeft-=this.shadowRoot.getElementById("categoriesWrapper").scrollWidth),this.setInboxPosition(e)):this.inbox.style.display="none"}},{key:"setInboxPosition",value:function(e){var t=window.outerWidth,n=getComputedStyle(je.inbox),i=n.getPropertyValue("--inbox-top"),o=n.getPropertyValue("--inbox-bottom"),r=n.getPropertyValue("--inbox-left"),a=n.getPropertyValue("--inbox-right");if(t>481&&!(i||o||r||a)){var s=bn(e,this.inbox.clientHeight,this.inbox.clientWidth),l=s.xPos,c=s.yPos;this.inbox.style.top=c+"px",this.inbox.style.left=l+"px"}}},{key:"updateUnviewedBadgeCounter",value:function(){if(this.isPreview)this.setBadgeStyle(this.unviewedCounter);else{var e=0;this.inboxCard.querySelectorAll("ct-inbox-message").forEach((function(t){var n=fn();n[t.id]&&0===n[t.id].viewed&&e++})),this.setBadgeStyle(e)}}},{key:"updateTSForRenderedMsgs",value:function(){this.inboxCard.querySelectorAll("ct-inbox-message").forEach((function(e){var t=e.id.split("_")[1];e.shadow.getElementById("timeStamp").firstChild.innerText=mn(t)}))}},{key:"getInboxStyles",value:function(){var e=this.config.categories.length?64:16,t={panelBackgroundColor:this.config.styles.panelBackgroundColor,panelBorderColor:this.config.styles.panelBorderColor,headerBackgroundColor:this.config.styles.header.backgroundColor,headerTitleColor:this.config.styles.header.titleColor,closeIconColor:this.config.styles.closeIconColor,categoriesTabColor:this.config.styles.categories.tabColor,categoriesTitleColor:this.config.styles.categories.titleColor,selectedCategoryTabColor:this.config.styles.categories.selectedTab.tabColor,selectedCategoryTitleColor:this.config.styles.categories.selectedTab.titleColor,headerCategoryHeight:36+e};this.config.styles.categories.borderColor&&(t.categoriesBorderColor=this.config.styles.categories.borderColor),this.config.styles.categories.selectedTab.borderColor&&(t.selectedCategoryBorderColor=this.config.styles.categories.selectedTab.borderColor);var n,i,o,r,a,s,l,c,u,d,p,h,f,v,g,y,b,m,w,k,C,x=(i=(n=t).panelBackgroundColor,o=n.panelBorderColor,r=n.headerBackgroundColor,a=n.headerTitleColor,s=n.closeIconColor,l=n.categoriesTabColor,c=n.categoriesTitleColor,u=n.categoriesBorderColor,d=n.selectedCategoryTabColor,p=n.selectedCategoryTitleColor,h=n.selectedCategoryBorderColor,f=n.headerCategoryHeight,'\n \n ")),P=this.config.styles.cards;return x+(v={backgroundColor:P.backgroundColor,borderColor:P.borderColor,titleColor:P.titleColor,descriptionColor:P.descriptionColor,buttonColor:P.buttonColor,buttonTextColor:P.buttonTextColor,unreadMarkerColor:P.unreadMarkerColor},g=v.backgroundColor,y=v.borderColor,b=v.titleColor,m=v.descriptionColor,w=v.buttonColor,k=v.buttonTextColor,C=v.unreadMarkerColor,'\n \n "))}},{key:"incomingMessages",get:function(){return[]},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length>0&&this.inbox&&this.updateInboxMessages(e)}},{key:"incomingMessagesForPreview",get:function(){return[]},set:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n={};t.length>0&&this.inbox&&(this.isPreview=!0,this.unviewedCounter=0,t.forEach((function(t){var i="".concat(t.wzrk_id.split("_")[0],"_").concat(Date.now());t.id=i,n[i]=t,e.unviewedMessages[i]=t,e.unviewedCounter++})),this.buildUIForMessages(n),this.updateUnviewedBadgeCounter())}}]),n}(f(HTMLElement)),dn=function(e){e.inbox_preview?je.inbox.incomingMessagesForPreview=e.inbox_notifs:je.inbox.incomingMessages=e},pn=function(e){yn(),je.inbox=new un({logger:e}),document.body.appendChild(je.inbox)},hn=function(e){var t=Te.readFromLSorCookie(ge)||{};if(Object.keys(t).length>0&&Object.keys(t)[0].includes("_")){var n={};return n[e]=t,Te.saveToLSorCookie(ge,n),n}return t},fn=function(){var e=JSON.parse(decodeURIComponent(Te.read(U)));if(!Oe(e))return{};var t=hn(e);return t.hasOwnProperty(e)?t[e]:{}},vn=function(e){var t=JSON.parse(decodeURIComponent(Te.read(U)));if(Oe(t)){var n=l(l({},hn(t)),{},a({},t,e));Te.saveToLSorCookie(ge,n)}},gn=function(e){return new Promise((function(t,n){if("complete"===document.readyState)pn(e),t();else{var i=Te.readFromLSorCookie(ve)||{},o=function(){null===je.inbox&&pn(e),t()};window.addEventListener("load",(function(){if(document.getElementById(i.inboxSelector))o();else{var n=0;if(n<20)var r=setInterval((function(){document.getElementById(i.inboxSelector)?(o(),clearInterval(r),t()):n>=20&&(clearInterval(r),e.debug("Failed to add inbox")),n++}),500)}}))}}))},yn=function(){void 0===customElements.get("ct-web-inbox")&&(customElements.define("ct-web-inbox",un),customElements.define("ct-inbox-message",cn))},bn=function(e,t,n){var i,o,r=document.scrollingElement.scrollLeft,a=document.scrollingElement.scrollTop,s=window.innerWidth+r,l=window.innerHeight+a,c=e.rect||e.target.getBoundingClientRect(),u=c.x+r,d=c.y+a,p=c.left+r,h=c.right+r,f=c.top+a,v=c.bottom,g=c.height,y=c.width,b=!1,m=16;if(v+t<=l){var w=l-(v+t);o=w>=m?v+m:v+w}else if(f-t>=a){var k=f-t;o=k>=m?f-t-m:f-t-k}else b=!0,(o=d+g/2-t/2)l&&(o=l-t);if(b){var C=h+n;if(C<=s){i=h+(C+m<=s?m:s-C)}else{var x=p-n;i=x-(x-m>=r?m:x-r)}}else(i=u+y/2-n/2)s&&(i=h-n>=r?h-n:s-n);return{xPos:i,yPos:o}},mn=function(e){var t=Date.now(),n=Math.floor((t-e)/6e4);return n<5?"Just now":n<60?"".concat(n," minute").concat(n>1?"s":""," ago"):(n=Math.floor(n/60))<24?"".concat(n," hour").concat(n>1?"s":""," ago"):(n=Math.floor(n/24),"".concat(n," day").concat(n>1?"s":""," ago"))},wn=function(){return Object.keys(Te.readFromLSorCookie(ve)||{}).length>0},kn='\n\n\n',Cn='\n\n\n',xn=function e(t,n){var i,o=n.device,r=n.session,s=n.request,c=n.logger,u=o,d=r,p=s,h=c,f=0,v=function(n){var i=n.wzrk_id.split("_")[0],o=Ee(),r=function(e,t,n){var i=0,o=0;null!=e[t]&&(i=e[t]),i++,null!=e.tc&&(o=e.tc),n<0&&o++,e.tc=o,e[t]=i};if(Te._isLocalStorageSupported()){delete sessionStorage.WZRK_CAMP;var s={},l=St();s=3===n.display.wtarget_type&&l.hasOwnProperty("wi")?l.wi:0!==n.display.wtarget_type&&1!==n.display.wtarget_type||!l.hasOwnProperty("wp")?{}:l.wp,l.hasOwnProperty("global")&&(s.wp=l),null==n.display.wmc&&(n.display.wmc=1),null==n.display.wimc&&(n.display.wimc=1);var c=-1,f=-1,v=-1,g=-1,y=-1,b=-1,m=-1;null!=n.display.efc&&(c=parseInt(n.display.efc,10)),null!=n.display.mdc&&(f=parseInt(n.display.mdc,10)),null!=n.display.tdc&&(v=parseInt(n.display.tdc,10)),null!=n.display.tlc&&(g=parseInt(n.display.tlc,10)),null!=n.display.wmp&&(y=parseInt(n.display.wmp,10)),null!=n.display.wmc&&(b=parseInt(n.display.wmc,10)),null!=n.display.wimc&&(m=parseInt(n.display.wimc,10));var w=s[d.sessionId];if(w){var k=w[i],C=w.tc;if("dnd"===k&&!je.dismissSpamControl)return!1;if(3===n.display.wtarget_type){if(m>0&&C>=m&&c<0)return!1}else if(b>0&&C>=b&&c<0)return!1;if(f>0&&k>=f)return!1}else w={},s[d.sessionId]=w;var x=s[o];if(null!=x){var P=x[i],S=x.tc;if(y>0&&S>=y&&c<0)return!1;if(v>0&&P>=v)return!1}else x={},s[o]=x;var O=s.global;if(null!=O){var I=O[i];if(g>0&&I>=g)return!1}else O={},s.global=O}if(null!=n.display.delay&&n.display.delay>0){var _=n.display.delay;return n.display.delay=0,setTimeout(e,1e3*_,t,{device:u,session:d,request:p,logger:h}),!1}r(w,i,c),r(x,i,c),r(O,i,c);var E="wp";3===n.display.wtarget_type&&(E="wi");var A={};A[d.sessionId]=w,A[o]=x,A.global=O,Ot(a({},E,A))},g=function(){var e=u.getGuid(),t=d.getSessionCookieObject();return"&t=wc&d="+encodeURIComponent(mt(e+"|"+t.p+"|"+t.s))},y=function(e,t){var n=window.parent[e];"function"==typeof n&&(null!=t.display.kv?n(t.display.kv):n())},b=function(e,t,n,i,o){m(t),function(e,t,n,i,o){if(""!==e&&null!=e){var r,a;o?r=n:null!==n&&null!=(a=n.getElementsByClassName("jsCT_CTA"))&&1===a.length&&(r=a[0]);var s=t.display.jsFunc,l=t.display.preview;null==l&&(e+=g()),null!=r&&(r.onclick=function(){if(null!=s)return null==l&&Pt.fireRequest(e),y(s,t),void Mt("-1",0,d.sessionId);1===t.display.window?window.open(e,"_blank"):window.location=e})}}(e,t,n,0,o)},m=function(e){var t={type:"event"};t.evtName=re,t.evtData=a({},oe,e.wzrk_id),e.wzrk_pivot&&(t.evtData=l(l({},t.evtData),{},{wzrk_pivot:e.wzrk_pivot})),p.processEvent(t)},w=function(e){var t;void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",an);var n=null!==(t=e.display.divId)&&void 0!==t?t:e.display.divSelector,i=document.createElement("ct-web-personalisation-banner");i.msgId=e.wzrk_id,i.pivotId=e.wzrk_pivot,i.divHeight=e.display.divHeight,i.details=e.display.details[0];var o=e.display.divId?document.getElementById(n):document.querySelector(n);o.innerHTML="",o.appendChild(i)},C=function(e){var t;void 0===customElements.get("ct-web-personalisation-carousel")&&customElements.define("ct-web-personalisation-carousel",sn);var n=null!==(t=e.display.divId)&&void 0!==t?t:e.display.divSelector,i=document.createElement("ct-web-personalisation-carousel");i.target=e;var o=e.display.divId?document.getElementById(n):document.querySelector(n);o.innerHTML="",o.appendChild(i)},x=function(e){var t=e.wzrk_id.split("_")[0],n=e.display;if(2!==n.wtarget_type||1!==e.msgContent.type){if(1===n.layout)return I(void 0,e);if(3===n.layout){var i="wzrkImageOnlyDiv";if(!1===v(e))return;if(je.dismissSpamControl&&null!=document.getElementById(i))document.getElementById(i).remove();if(null!=document.getElementById(i)||null!=document.getElementById("intentPreview"))return;var o=document.createElement("div");return o.id=i,document.body.appendChild(o),void 0===customElements.get("ct-web-popup-imageonly")&&customElements.define("ct-web-popup-imageonly",ln),function(e){var t=document.createElement("ct-web-popup-imageonly");t.session=d,t.target=e;var n=document.getElementById("wzrkImageOnlyDiv");n.innerHTML="",n.style.visibility="hidden",n.appendChild(t)}(e)}if(!1!==v(e)){var r="wizParDiv"+n.layout;if(je.dismissSpamControl&&null!=document.getElementById(r))document.getElementById(r).remove();if(null==document.getElementById(r)){je.campaignDivMap[t]=r;var a=2===n.layout,s=document.createElement("div");s.id=r;var l=window.innerHeight,c=window.innerWidth,u=!1;if(a)s.setAttribute("style",n.iFrameStyle);else{var p=10,h=5*c/100,f=p+5*l/100,g=30*c/100+20,y="width:30%;";(/mobile/i.test(navigator.userAgent)||/mini/i.test(navigator.userAgent))&&!1===/iPad/i.test(navigator.userAgent)?(g=85*c/100+20,h=5*c/100,f=5*l/100,y="width:80%;"):("ontouchstart"in window||/tablet/i.test(navigator.userAgent))&&(g=50*c/100+20,h=5*c/100,f=5*l/100,y="width:50%;"),null==n.proto?(u=!0,s.setAttribute("style","display:block;overflow:hidden; bottom:"+f+"px !important;width:"+g+"px !important;right:"+h+"px !important;position:fixed;z-index:2147483647;")):s.setAttribute("style",y+n.iFrameStyle)}document.body.appendChild(s);var m=document.createElement("iframe"),w=!1===n.br?"0":"8";m.frameborder="0px",m.marginheight="0px",m.marginwidth="0px",m.scrolling="no",m.id="wiz-iframe";var k,C=e.display.onClick,x="";if(""!==C&&null!=C&&(x="cursor:pointer;"),1===e.msgContent.type)k=(k=(k=e.msgContent.html).replace(/##campaignId##/g,t)).replace(/##campaignId_batchId##/g,e.wzrk_id);else{var S,O,_,E,A,L='";"dark"===e.display.theme?(S="#2d2d2e",O="#eaeaea",_="#353535",E="#353535",A="#ffffff"):(S="#ffffff",O="#000000",E="#f4f4f4",_="#a5a6a6",A="#ffffff");var R=e.msgContent.title,M=e.msgContent.description,T="";null!=e.msgContent.imageUrl&&""!==e.msgContent.imageUrl&&(T=""),k=L+("
×
"+T+"
"+R+"
")+("
"+M+"
")}m.setAttribute("style","z-index: 2147483647; display:block; width: 100% !important; border:0px !important; border-color:none !important;"),s.appendChild(m);var j=(m.contentWindow?m.contentWindow:m.contentDocument.document?m.contentDocument.document:m.contentDocument).document,D=new Event("CT_campaign_rendered");document.dispatchEvent(D),j.open(),j.write(k),n["custom-editor"]&&P(e,j),j.close();var z=function(){p=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv").scrollHeight,!0===n["custom-editor"]||a||(p+=25),document.getElementById("wiz-iframe").contentDocument.body.style.margin="0px",document.getElementById("wiz-iframe").style.height=p+"px"},B=navigator.userAgent.toLowerCase();if(-1!==B.indexOf("safari"))if(B.indexOf("chrome")>-1)m.onload=function(){z();var t=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv");b(C,e,t,0,u)};else{var N=m.contentDocument||m.contentWindow;N.document&&(N=N.document),z();var F=setInterval((function(){if("complete"===N.readyState){clearInterval(F),z();var t=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv");b(C,e,t,0,u)}}),10)}else m.onload=function(){z();var t=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv");b(C,e,t,0,u)}}}}else{var U={};U.msgId=e.wzrk_id,e.wzrk_pivot&&(U.pivotId=e.wzrk_pivot),null!=e.msgContent.kv&&(U.kv=e.msgContent.kv);var q=new CustomEvent("CT_web_native_display",{detail:U});document.dispatchEvent(q)}},P=function(e,t){var n=t.createElement("script");n.innerHTML="\n const ct__camapignId = '".concat(e.wzrk_id,"';\n const ct__formatVal = (v) => {\n return v && v.trim().substring(0, 20);\n }\n const ct__parentOrigin = window.parent.origin;\n document.body.addEventListener('click', (event) => {\n const elem = event.target.closest?.('a[wzrk_c2a], button[wzrk_c2a]');\n if (elem) {\n const {innerText, id, name, value, href} = elem;\n const clickAttr = elem.getAttribute('onclick') || elem.getAttribute('click');\n const onclickURL = clickAttr?.match(/(window.open)[(](\"|')(.*)(\"|',)/)?.[3] || clickAttr?.match(/(location.href *= *)(\"|')(.*)(\"|')/)?.[3];\n const props = {innerText, id, name, value};\n let msgCTkv = Object.keys(props).reduce((acc, c) => {\n const formattedVal = ct__formatVal(props[c]);\n formattedVal && (acc['wzrk_click_' + c] = formattedVal);\n return acc;\n }, {});\n if(onclickURL) { msgCTkv['wzrk_click_' + 'url'] = onclickURL; }\n if(href) { msgCTkv['wzrk_click_' + 'c2a'] = href; }\n const notifData = { msgId: ct__camapignId, msgCTkv, pivotId: '").concat(e.wzrk_pivot,"' };\n window.parent.clevertap.renderNotificationClicked(notifData);\n }\n });\n "),t.body.appendChild(n)},S=!1,O=function(e){var t=e.display.onClick;if(window.clevertap.hasOwnProperty("notificationCallback")&&void 0!==window.clevertap.notificationCallback&&"function"==typeof window.clevertap.notificationCallback){var n=window.clevertap.notificationCallback;if(!S){var i={};i.msgContent=e.msgContent,i.msgId=e.wzrk_id,e.wzrk_pivot&&(i.pivotId=e.wzrk_pivot),null!=e.display.kv&&(i.kv=e.display.kv),window.clevertap.raiseNotificationClicked=function(){if(""!==t&&null!=t){var n=e.display.jsFunc;if(t+=g(),null!=n)return Pt.fireRequest(t),void y(n,e);1===e.display.window?window.open(t,"_blank"):window.location=t}},window.clevertap.raiseNotificationViewed=function(){m(e)},n(i),S=!0}}else if(window.clevertap.popupCurrentWzrkId=e.wzrk_id,x(e),window.clevertap.hasOwnProperty("popupCallbacks")&&void 0!==window.clevertap.popupCallbacks&&"function"==typeof window.clevertap.popupCallbacks[e.wzrk_id]){var o=window.clevertap.popupCallbacks[e.wzrk_id],r={};r.msgContent=e.msgContent,r.msgId=e.wzrk_id,e.wzrk_pivot&&(r.pivotId=e.wzrk_pivot);var s=[];for(var c in e)if(c.startsWith(ie)&&c!==oe){var u=a({},c,e[c]);s.push(u)}s.length>0&&(r.msgCTkv=s),null!=e.display.kv&&(r.kv=e.display.kv),window.clevertap.raisePopupNotificationClicked=function(t){if(t&&t.msgId){var n={type:"event"};if(n.evtName=ae,n.evtData=a({},oe,t.msgId),e.wzrk_pivot&&(n.evtData=l(l({},n.evtData),{},{wzrk_pivot:t.pivotId})),t.msgCTkv){var i,o=k(t.msgCTkv);try{for(o.s();!(i=o.n()).done;){var r=i.value;n.evtData=l(l({},n.evtData),r)}}catch(e){o.e(e)}finally{o.f()}}p.processEvent(n)}},o(r)}},I=function(e,t){var n;if(!(null!=e&&e.clientY>0)){if(n=null==t?i:t,je.dismissSpamControl&&0===n.display.wtarget_type&&null!=document.getElementById("intentPreview")&&null!=document.getElementById("intentOpacityDiv"))document.getElementById("intentPreview").remove(),document.getElementById("intentOpacityDiv").remove();if(null==document.getElementById("intentPreview")&&null==document.getElementById("wzrkImageOnlyDiv")&&(null!=n.display.layout||!(/mobile/i.test(navigator.userAgent)||/mini/i.test(navigator.userAgent)||/iPad/i.test(navigator.userAgent)||"ontouchstart"in window||/tablet/i.test(navigator.userAgent)))&&!1!==v(n)){var o=n.wzrk_id.split("_")[0];je.campaignDivMap[o]="intentPreview";var r=!1,a=document.createElement("div");a.id="intentOpacityDiv";var s=n.display.opacity||.7,l="rgba(0,0,0,".concat(s,")");a.setAttribute("style","position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ".concat(l,";")),document.body.appendChild(a);var c=document.createElement("div");c.id="intentPreview",null==n.display.proto?(r=!0,c.setAttribute("style","display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;")):c.setAttribute("style",n.display.iFrameStyle),document.body.appendChild(c);var u=document.createElement("iframe"),d=!1===n.display.br?"0":"8";u.frameborder="0px",u.marginheight="0px",u.marginwidth="0px",u.scrolling="no",u.id="wiz-iframe-intent";var p,h=n.display.onClick,f="";if(""!==h&&null!=h&&(f="cursor:pointer;"),1===n.msgContent.type)p=(p=(p=n.msgContent.html).replace(/##campaignId##/g,o)).replace(/##campaignId_batchId##/g,n.wzrk_id);else{var g,y,m,w,k='";"dark"===n.display.theme?(g="#2d2d2e",y="#eaeaea",m="#353535",w="#ffffff"):(g="#ffffff",y="#000000",m="#a5a6a6",w="#ffffff");var C=n.msgContent.title,x=n.msgContent.description,S="";null!=n.msgContent.ctaText&&""!==n.msgContent.ctaText&&(S="");var O="";null!=n.msgContent.imageUrl&&""!==n.msgContent.imageUrl&&(O="
+C+
"),p=k+("
×
"+C+"
")+("
"+x+"
"+O+S+"
")}u.setAttribute("style","z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;"),c.appendChild(u);var I=(u.contentWindow?u.contentWindow:u.contentDocument.document?u.contentDocument.document:u.contentDocument).document,_=new Event("CT_campaign_rendered");document.dispatchEvent(_),I.open(),I.write(p),n.display["custom-editor"]&&P(n,I),I.close();var E=document.getElementById("wiz-iframe-intent").contentDocument.getElementById("contentDiv");b(h,n,E,0,r)}}};if(document.body){var _=function(e){Object.keys(e).map((function(t){var n,i;e[t].display.divId?(n=e[t].display.divId,i=document.getElementById(n)):(n=e[t].display.divSelector,i=document.querySelector(n)),null!==i&&(2===e[t].msgContent.type?w(e[t]):C(e[t]),delete e[t])}))};if(null!=t.inapp_notifs){for(var E={},A=0;A1&&void 0!==arguments[1]&&arguments[1],n=Te.readFromLSorCookie(ve)||{};t?(je.inbox.inboxConfigForPreview=e,je.inbox.isPreview=!0,je.inbox&&je.inbox.init()):JSON.stringify(n)!==JSON.stringify(e)&&(Te.saveToLSorCookie(ve,e),je.inbox&&je.inbox.init())}(t.webInboxSetting),gn(h).then((function(){R()})).catch((function(e){}))):R()),t.vars)je.variableStore.mergeVariables(t.vars);else{var M=function(e,t){var n=St(),i=n[t].global;if(null!=i&&t)for(var o in e)if(e.hasOwnProperty(o)&&(delete i[e[o]],Te.read(W))){var r=JSON.parse(decodeURIComponent(Te.read(W))),a=JSON.parse(decodeURIComponent(Te.read(U)));r[a]&&r[a][t]&&r[a][t][e[o]]&&(delete r[a][t][e[o]],Te.save(W,encodeURIComponent(JSON.stringify(r))))}Ot(n)};if(Te._isLocalStorageSupported())try{if(null!=t.evpr){var T=t.evpr.events,j=t.evpr.profile,D=t.evpr.expires_in,z=Ae();Te.setMetaProp("lsTime",z),Te.setMetaProp("exTs",D),function(e){if(null!=je.globalEventsMap||(je.globalEventsMap=Te.readFromLSorCookie(K),null!=je.globalEventsMap)){for(var t in e)if(e.hasOwnProperty(t)){var n=je.globalEventsMap[t],i=e[t];null!=je.globalEventsMap[t]?null!=i[0]&&i[0]>n[0]&&(je.globalEventsMap[t]=i):je.globalEventsMap[t]=i}}else je.globalEventsMap=e}(T),Te.saveToLSorCookie(K,je.globalEventsMap),null==je.globalProfileMap?Rt(j,!0):Rt(j,!1)}null!=t.arp&&function(e){if(null!=e.skipResARP&&e.skipResARP)return console.debug("Update ARP Request rejected",e),null;var t=!0===e.isOUL;if(Te._isLocalStorageSupported())try{var n=Te.readFromLSorCookie(J);if(null==n||t){for(var i in n={},e)e.hasOwnProperty(i)&&(-1===e[i]?delete n[i]:n[i]=e[i]);Te.saveToLSorCookie(J,n)}}catch(e){console.error("Unable to parse ARP JSON: "+e)}}(t.arp),null!=t.inapp_stale&&t.inapp_stale.length>0&&M(t.inapp_stale,"wp"),null!=t.inbox_stale&&t.inbox_stale.length>0&&M(t.inbox_stale,"wi")}catch(e){h.error("Unable to persist evrp/arp: "+e)}}}else f<6&&(f++,setTimeout(e,1e3,t,{device:u,session:d,request:p,logger:h}))},Pn=x("isPersonalisationActive"),Sn=function(){function e(t){var n=t.isPersonalisationActive;i(this,e),Object.defineProperty(this,Pn,{writable:!0,value:void 0}),P(this,Pn)[Pn]=n}return r(e,[{key:"getTotalVisits",value:function(){if(P(this,Pn)[Pn]()){var e=Te.getMetaProp("sc");return null==e&&(e=1),e}}},{key:"getLastVisit",value:function(){if(P(this,Pn)[Pn]()){var e=Te.getMetaProp("ps");return null!=e?new Date(1e3*e):void 0}}}]),e}(),On=1,In=2,_n=3,En=4,An=x("logLevel"),Ln=x("log"),Rn=x("isLegacyDebug"),Mn=function(){function e(t){i(this,e),Object.defineProperty(this,Rn,{get:jn,set:void 0}),Object.defineProperty(this,Ln,{value:Tn}),Object.defineProperty(this,An,{writable:!0,value:void 0}),this.wzrkError={},P(this,An)[An]=null==t?t:In,this.wzrkError={}}return r(e,[{key:"error",value:function(e){P(this,An)[An]>=On&&P(this,Ln)[Ln]("error",e)}},{key:"info",value:function(e){P(this,An)[An]>=In&&P(this,Ln)[Ln]("log",e)}},{key:"debug",value:function(e){(P(this,An)[An]>=_n||P(this,Rn)[Rn])&&P(this,Ln)[Ln]("debug",e)}},{key:"debugPE",value:function(e){P(this,An)[An]>=En&&P(this,Ln)[Ln]("debug_pe",e)}},{key:"reportError",value:function(e,t){this.wzrkError.c=e,this.wzrkError.d=t,this.error("".concat(Je," ").concat(e,": ").concat(t))}},{key:"logLevel",get:function(){return P(this,An)[An]},set:function(e){P(this,An)[An]=e}}]),e}(),Tn=function(e,t){if(window.console)try{var n=(new Date).getTime();console[e]("CleverTap [".concat(n,"]: ").concat(t))}catch(e){}},jn=function(){return"undefined"!=typeof sessionStorage&&""===sessionStorage.WZRK_D},Dn=x("logger"),zn=x("sessionId"),Bn=x("isPersonalisationActive"),Nn=function(){function e(t){var n=t.logger,o=t.isPersonalisationActive;i(this,e),Object.defineProperty(this,Dn,{writable:!0,value:void 0}),Object.defineProperty(this,zn,{writable:!0,value:void 0}),Object.defineProperty(this,Bn,{writable:!0,value:void 0}),this.cookieName=void 0,this.scookieObj=void 0,this.sessionId=Te.getMetaProp("cs"),P(this,Dn)[Dn]=n,P(this,Bn)[Bn]=o}return r(e,[{key:"getSessionCookieObject",value:function(){var e=Te.readCookie(this.cookieName),t={};if(null!=e)if(e=e.replace(z,'"'),t=JSON.parse(e),ke(t)){if(void 0!==t.t){var n=t.t;Ae()-n>1260&&(t={})}}else t={};return this.scookieObj=t,t}},{key:"setSessionCookieObject",value:function(e){var t=JSON.stringify(e);Te.createBroadCookie(this.cookieName,t,1200,gt())}},{key:"manageSession",value:function(e){if(void 0===this.sessionId||this.sessionId!==e){var t=Te.getMetaProp("cs");if(void 0===t)Te.setMetaProp("ps",e),Te.setMetaProp("cs",e),Te.setMetaProp("sc",1);else if(t!==e){Te.setMetaProp("ps",t),Te.setMetaProp("cs",e);var n=Te.getMetaProp("sc");void 0===n&&(n=0),Te.setMetaProp("sc",n+1)}this.sessionId=e}}},{key:"getTimeElapsed",value:function(){if(P(this,Bn)[Bn]()){null!=this.scookieObj&&(this.scookieObj=this.getSessionCookieObject());var e=this.scookieObj.s;if(null!=e){var t=Ae();return Math.floor(t-e)}}}},{key:"getPageCount",value:function(){if(P(this,Bn)[Bn]())return null!=this.scookieObj&&(this.scookieObj=this.getSessionCookieObject()),this.scookieObj.p}},{key:"sessionId",get:function(){return P(this,zn)[zn]},set:function(e){P(this,zn)[zn]=e}}]),e}(),Fn=0,Un=0,qn=x("logger"),Vn=x("account"),Wn=x("device"),Kn=x("session"),Gn=x("isPersonalisationActive"),Hn=x("clearCookie"),Jn=x("addToLocalEventMap"),Zn=function(){function e(t){var n=t.logger,o=t.account,r=t.device,a=t.session,s=t.isPersonalisationActive;i(this,e),Object.defineProperty(this,Jn,{value:$n}),Object.defineProperty(this,qn,{writable:!0,value:void 0}),Object.defineProperty(this,Vn,{writable:!0,value:void 0}),Object.defineProperty(this,Wn,{writable:!0,value:void 0}),Object.defineProperty(this,Kn,{writable:!0,value:void 0}),Object.defineProperty(this,Gn,{writable:!0,value:void 0}),Object.defineProperty(this,Hn,{writable:!0,value:!1}),this.processingBackup=!1,P(this,qn)[qn]=n,P(this,Vn)[Vn]=o,P(this,Wn)[Wn]=r,P(this,Kn)[Kn]=a,P(this,Gn)[Gn]=s,Pt.logger=n,Pt.device=r,Pt.account=o}var t;return r(e,[{key:"processBackupEvents",value:function(){var e=Te.readFromLSorCookie(Z);if(null!=e){for(var t in this.processingBackup=!0,e)if(e.hasOwnProperty(t)){var n=e[t];void 0===n.fired&&(P(this,qn)[qn].debug("Processing backup event : "+n.q),void 0!==n.q&&Pt.fireRequest(n.q),n.fired=!0)}Te.saveToLSorCookie(Z,e),this.processingBackup=!1}}},{key:"addSystemDataToObject",value:function(e,t){void 0===t&&(e=Ie(e,P(this,qn)[qn])),xe(P(this,qn)[qn].wzrkError)||(e.wzrk_error=P(this,qn)[qn].wzrkError,P(this,qn)[qn].wzrkError={}),e.id=P(this,Vn)[Vn].id,Oe(P(this,Wn)[Wn].gcookie)&&(e.g=P(this,Wn)[Wn].gcookie);var n=P(this,Kn)[Kn].getSessionCookieObject();e.s=n.s,e.pg=void 0===n.p?1:n.p;var i=document.location.protocol;return i=i.replace(":",""),e.af=l({lib:"web-sdk-v2.0.0",protocol:i},je.flutterVersion),sessionStorage.hasOwnProperty("WZRK_D")&&(e.debug=!0),e}},{key:"addFlags",value:function(e){if(P(this,Hn)[Hn]=Te.getAndClearMetaProp(B),void 0!==P(this,Hn)[Hn]&&P(this,Hn)[Hn]&&(e.rc=!0,P(this,qn)[qn].debug("reset cookie sent in request and cleared from meta for future requests.")),P(this,Gn)[Gn]()){var t=Te.getMetaProp("lsTime"),n=Te.getMetaProp("exTs");if(void 0===t||void 0===n)return void(e.dsync=!0);t+n0?je.privacyArray:t):(i=je.privacyArray).push.apply(i,t);return 0}},{key:"_processOldValues",value:function(){P(this,Xn)[Xn]&&P(this,ti)[ti](P(this,Xn)[Xn]),P(this,Xn)[Xn]=null}}]),n}(f(Array)),ii=function(e){if(Array.isArray(e)&&e.length>0){var t=e.reduce((function(e,t){return l(l({},e),t)}),{}),n={},i={},o=!1;if(t.hasOwnProperty(Y)&&"boolean"==typeof(o=t.optOut)&&(i.ct_optout=o,je.isOptInRequest=!o),t.hasOwnProperty(Q)){var r=t.useIP,a="boolean"==typeof r&&r;Te.setMetaProp(Q,a)}if(!xe(i)){n.type="profile",n.profile=i,n=P(this,Yn)[Yn].addSystemDataToObject(n,void 0);var s=yt(JSON.stringify(n),P(this,ei)[ei]),c=P(this,Qn)[Qn].dataPostURL;c=vt(c,"type",ee),c=vt(c,"d",s),c=vt(c,Y,o?"true":"false"),P(this,Yn)[Yn].saveAndFireRequest(c,je.blockRequest),e.splice(0,e.length)}}},oi=x("oldValues"),ri=x("logger"),ai=x("request"),si=x("account"),li=x("wizAlertJSPath"),ci=x("fcmPublicKey"),ui=x("setUpWebPush"),di=x("setUpWebPushNotifications"),pi=x("setApplicationServerKey"),hi=x("setUpSafariNotifications"),fi=x("setUpChromeFirefoxNotifications"),vi=x("addWizAlertJS"),gi=x("removeWizAlertJS"),yi=x("handleNotificationRegistration"),bi=function(e){c(n,e);var t=y(n);function n(e,o){var r,a=e.logger;e.session;var s=e.request,l=e.account;return i(this,n),r=t.call(this),Object.defineProperty(v(r),yi,{value:Oi}),Object.defineProperty(v(r),gi,{value:Si}),Object.defineProperty(v(r),vi,{value:Pi}),Object.defineProperty(v(r),fi,{value:xi}),Object.defineProperty(v(r),hi,{value:Ci}),Object.defineProperty(v(r),pi,{value:ki}),Object.defineProperty(v(r),di,{value:wi}),Object.defineProperty(v(r),ui,{value:mi}),Object.defineProperty(v(r),oi,{writable:!0,value:void 0}),Object.defineProperty(v(r),ri,{writable:!0,value:void 0}),Object.defineProperty(v(r),ai,{writable:!0,value:void 0}),Object.defineProperty(v(r),si,{writable:!0,value:void 0}),Object.defineProperty(v(r),li,{writable:!0,value:void 0}),Object.defineProperty(v(r),ci,{writable:!0,value:void 0}),P(v(r),li)[li]="https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js",P(v(r),ci)[ci]=null,P(v(r),oi)[oi]=o,P(v(r),ri)[ri]=a,P(v(r),ai)[ai]=s,P(v(r),si)[si]=l,r}return r(n,[{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0?P(this,yi)[yi](e):null==je.webPushEnabled&&e.length>0?(je.notifApi.notifEnabledFromApi=!0,je.notifApi.displayArgs=e.slice()):!1===je.webPushEnabled&&e.length>0&&P(this,ri)[ri].error("Make sure push notifications are fully enabled and integrated")},wi=function(e,t,n,i){-1!==navigator.userAgent.indexOf("Chrome")||-1!==navigator.userAgent.indexOf("Firefox")?P(this,fi)[fi](e,t):-1!==navigator.userAgent.indexOf("Safari")&&P(this,hi)[hi](e,n,i)},ki=function(e){P(this,ci)[ci]=e},Ci=function(e,t,n){var i=this;void 0===t&&P(this,ri)[ri].error("Ensure that APNS Web Push ID is supplied"),void 0===n&&P(this,ri)[ri].error("Ensure that APNS Web Push service path is supplied"),"safari"in window&&"pushNotification"in window.safari&&window.safari.pushNotification.requestPermission(n,t,{},(function(e){if("granted"===e.permission){var t=JSON.parse(JSON.stringify(e));t.endpoint=e.deviceToken,t.browser="Safari",Te.saveToLSorCookie(le,t),P(i,ai)[ai].registerToken(t),P(i,ri)[ri].info("Safari Web Push registered. Device Token: "+e.deviceToken)}else"denied"===e.permission&&P(i,ri)[ri].info("Error subscribing to Safari web push")}))},xi=function(e,t){var n=this,i="";"serviceWorker"in navigator&&navigator.serviceWorker.register(t).then((function(e){if("undefined"!=typeof __wzrk_account_id)return new Promise((function(t){return setTimeout((function(){return t(e)}),5e3)}));i=e.scope;return/^(\.?)(\/?)([^/]*).js$/.test(t)?navigator.serviceWorker.ready:-1!==navigator.userAgent.indexOf("Chrome")?new Promise((function(t){return setTimeout((function(){return t(e)}),5e3)})):navigator.serviceWorker.getRegistrations()})).then((function(t){-1!==navigator.userAgent.indexOf("Firefox")&&Array.isArray(t)&&(t=t.filter((function(e){return e.scope===i}))[0]);var o={userVisibleOnly:!0};null!=P(n,ci)[ci]&&(o.applicationServerKey=function(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(t),i=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),Object.defineProperty(this,ro,{value:ho}),Object.defineProperty(this,oo,{value:po}),Object.defineProperty(this,io,{value:uo}),Object.defineProperty(this,no,{value:co}),Object.defineProperty(this,to,{value:lo}),Object.defineProperty(this,eo,{value:so}),Object.defineProperty(this,qi,{writable:!0,value:void 0}),Object.defineProperty(this,Vi,{writable:!0,value:void 0}),Object.defineProperty(this,Wi,{writable:!0,value:void 0}),Object.defineProperty(this,Ki,{writable:!0,value:void 0}),Object.defineProperty(this,Gi,{writable:!0,value:void 0}),Object.defineProperty(this,Hi,{writable:!0,value:void 0}),Object.defineProperty(this,Ji,{writable:!0,value:void 0}),Object.defineProperty(this,Zi,{writable:!0,value:void 0}),Object.defineProperty(this,$i,{writable:!0,value:void 0}),Object.defineProperty(this,Yi,{writable:!0,value:void 0}),Object.defineProperty(this,Qi,{writable:!0,value:P(this,no)[no].bind(this)}),Object.defineProperty(this,Xi,{writable:!0,value:void 0}),this.enablePersonalization=void 0,this.popupCallbacks={},this.popupCurrentWzrkId="",P(this,Wi)[Wi]=0,this._isPersonalisationActive=this._isPersonalisationActive.bind(this),this.raiseNotificationClicked=function(){},P(this,qi)[qi]=new Mn(In),P(this,Hi)[Hi]=new T(null===(t=u.account)||void 0===t?void 0:t[0],u.region||(null===(n=u.account)||void 0===n?void 0:n[1]),u.targetDomain||(null===(o=u.account)||void 0===o?void 0:o[2]),u.token||(null===(r=u.account)||void 0===r?void 0:r[3])),P(this,Ki)[Ki]=new Ge({logger:P(this,qi)[qi]}),P(this,Xi)[Xi]=u.dismissSpamControl||!1,P(this,Gi)[Gi]=new Nn({logger:P(this,qi)[qi],isPersonalisationActive:this._isPersonalisationActive}),P(this,Ji)[Ji]=new Zn({logger:P(this,qi)[qi],account:P(this,Hi)[Hi],device:P(this,Ki)[Ki],session:P(this,Gi)[Gi],isPersonalisationActive:this._isPersonalisationActive}),this.enablePersonalization=u.enablePersonalization||!1,this.event=new pt({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],isPersonalisationActive:this._isPersonalisationActive},u.event),this.profile=new qt({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],isPersonalisationActive:this._isPersonalisationActive},u.profile),this.onUserLogin=new en({request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],session:P(this,Gi)[Gi],logger:P(this,qi)[qi],device:P(this,Ki)[Ki]},u.onUserLogin),this.privacy=new ni({request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],logger:P(this,qi)[qi]},u.privacy),this.notifications=new bi({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],account:P(this,Hi)[Hi]},u.notifications),P(this,Zi)[Zi]=new Fi({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],event:this.event}),P(this,Vi)[Vi]=new We({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],device:P(this,Ki)[Ki],session:P(this,Gi)[Gi]}),this.spa=u.spa,this.dismissSpamControl=u.dismissSpamControl,this.user=new Sn({isPersonalisationActive:this._isPersonalisationActive}),this.session={getTimeElapsed:function(){return P(c,Gi)[Gi].getTimeElapsed()},getPageCount:function(){return P(c,Gi)[Gi].getPageCount()}},this.logout=function(){P(c,qi)[qi].debug("logout called"),Te.setInstantDeleteFlagInK()},this.clear=function(){c.onUserLogin.clear()},this.getCleverTapID=function(){return P(c,Ki)[Ki].getGuid()},this.getAccountID=function(){return P(c,Hi)[Hi].id},this.getSCDomain=function(){return P(c,Hi)[Hi].finalTargetDomain},this.setLibrary=function(e,t){je.flutterVersion=a({},e,t)},this.setSCSDKVersion=function(e){P(c,Hi)[Hi].scSDKVersion=e;var t={};t.af={scv:"sc-sdk-v"+P(c,Hi)[Hi].scSDKVersion};var n=P(c,Hi)[Hi].dataPostURL;n=vt(n,"type","page"),n=vt(n,"d",yt(JSON.stringify(t),P(c,qi)[qi])),P(c,Ji)[Ji].saveAndFireRequest(n,je.blockRequest)},wn()&&(yn(),gn(P(this,qi)[qi])),this.getInboxMessageCount=function(){var e=fn();return Object.keys(e).length},this.getInboxMessageUnreadCount=function(){if(je.inbox)return je.inbox.unviewedCounter;P(c,qi)[qi].debug("No unread messages")},this.getAllInboxMessages=function(){return fn()},this.getUnreadInboxMessages=function(){if(je.inbox)return je.inbox.unviewedMessages;P(c,qi)[qi].debug("No unread messages")},this.getInboxMessageForId=function(e){var t=fn();if((null!==e||""!==e)&&t.hasOwnProperty(e))return t[e];P(c,qi)[qi].error("No message available for message Id "+e)},this.deleteInboxMessage=function(e){var t=fn();if(null===e&&""===e||!t.hasOwnProperty(e))P(c,qi)[qi].error("No message available for message Id "+e);else{var n=document.querySelector("ct-web-inbox").shadowRoot.getElementById(e);0===t[e].viewed&&(je.inbox.unviewedCounter--,delete je.inbox.unviewedMessages[e],document.getElementById("unviewedBadge").innerText=je.inbox.unviewedCounter,document.getElementById("unviewedBadge").style.display=je.inbox.unviewedCounter>0?"flex":"none"),n&&n.remove(),delete t[e],vn(t)}},this.markReadInboxMessage=function(e){var t=je.inbox.unviewedMessages,n=fn();if(null===e&&""===e||!t.hasOwnProperty(e))P(c,qi)[qi].error("No message available for message Id "+e);else{var i=document.querySelector("ct-web-inbox").shadowRoot.getElementById(e);if(null!==i&&(i.shadowRoot.getElementById("unreadMarker").style.display="none"),n[e].viewed=1,document.getElementById("unviewedBadge")){var o=parseInt(document.getElementById("unviewedBadge").innerText)-1;document.getElementById("unviewedBadge").innerText=o,document.getElementById("unviewedBadge").style.display=o>0?"flex":"none"}window.clevertap.renderNotificationViewed({msgId:n[e].wzrk_id,pivotId:n[e].pivotId}),je.inbox.unviewedCounter--,delete je.inbox.unviewedMessages[e],vn(n)}},this.markReadInboxMessagesForIds=function(e){if(Array.isArray(e))for(var t=0;t0?(Object.keys(e).forEach((function(e){var n=document.querySelector("ct-web-inbox").shadowRoot.getElementById(e);null!==n&&(n.shadowRoot.getElementById("unreadMarker").style.display="none"),t[e].viewed=1,window.clevertap.renderNotificationViewed({msgId:t[e].wzrk_id,pivotId:t[e].wzrk_pivot})})),document.getElementById("unviewedBadge").innerText=0,document.getElementById("unviewedBadge").style.display="none",vn(t),je.inbox.unviewedCounter=0,je.inbox.unviewedMessages={}):P(c,qi)[qi].debug("All messages are already read")},this.toggleInbox=function(e){var t;return null===(t=je.inbox)||void 0===t?void 0:t.toggleInbox(e)},this.renderNotificationViewed=function(e){d(re,e)},this.renderNotificationClicked=function(e){d(ae,e)};var d=function(e,t){if(t&&t.msgId){var n={type:"event"};if(n.evtName=e,n.evtData=a({},oe,t.msgId),t.pivotId&&(n.evtData=l(l({},n.evtData),{},{wzrk_pivot:t.pivotId})),t.wzrk_slideNo&&(n.evtData=l(l({},n.evtData),{},{wzrk_slideNo:t.wzrk_slideNo})),t.kv&&null!==t.kv&&void 0!==t.kv)for(var i in t.kv)i.startsWith(ie)&&(n.evtData=l(l({},n.evtData),{},a({},i,t.kv[i])));if(t.msgCTkv&&null!==t.msgCTkv&&void 0!==t.msgCTkv)for(var o in t.msgCTkv)o.startsWith(ie)&&(n.evtData=l(l({},n.evtData),{},a({},o,t.msgCTkv[o])));P(c,Ji)[Ji].processEvent(n)}};this.setLogLevel=function(e){P(c,qi)[qi].logLevel=Number(e),3===e?sessionStorage.WZRK_D="":delete sessionStorage.WZRK_D},this.handleIncrementValue=function(e,t){c.profile._handleIncrementDecrementValue(e,t,ce)},this.handleDecrementValue=function(e,t){c.profile._handleIncrementDecrementValue(e,t,ue)},this.setMultiValuesForKey=function(e,t){Array.isArray(t)?c.profile._handleMultiValueSet(e,t,de):console.error("setMultiValuesForKey should be called with a value of type array")},this.addMultiValueForKey=function(e,t){"string"==typeof t||"number"==typeof t?c.profile._handleMultiValueAdd(e,t,pe):console.error("addMultiValueForKey should be called with a value of type string or number.")},this.addMultiValuesForKey=function(e,t){Array.isArray(t)?c.profile._handleMultiValueAdd(e,t,pe):console.error("addMultiValuesForKey should be called with a value of type array.")},this.removeMultiValueForKey=function(e,t){"string"==typeof t||"number"==typeof t?c.profile._handleMultiValueRemove(e,t,he):console.error("removeMultiValueForKey should be called with a value of type string or number.")},this.removeMultiValuesForKey=function(e,t){Array.isArray(t)?c.profile._handleMultiValueRemove(e,t,he):console.error("removeMultiValuesForKey should be called with a value of type array.")},this.removeValueForKey=function(e){c.profile._handleMultiValueDelete(e,fe)};var p=function(e,t,n){jt(e,t,n,P(c,Hi)[Hi],P(c,qi)[qi])};function h(e){var t=e.coords.latitude,n=e.coords.longitude;je.location={Latitude:t,Longitude:n},this.sendLocationData({Latitude:t,Longitude:n})}function f(e){switch(e.code){case e.PERMISSION_DENIED:console.log("User denied the request for Geolocation.");break;case e.POSITION_UNAVAILABLE:console.log("Location information is unavailable.");break;case e.TIMEOUT:console.log("The request to get user location timed out.");break;case e.UNKNOWN_ERROR:console.log("An unknown error occurred.")}}this.getLocation=function(e,t){if(e&&"number"!=typeof e||t&&"number"!=typeof t)console.log("Latitude and Longitude must be of number type");else if(e&&t){if(e<=-90||e>90)return void console.log("A vaid latitude must range between -90 and 90");if(t<=-180||t>180)return void console.log("A valid longitude must range between -180 and 180");je.location={Latitude:e,Longitude:t},this.sendLocationData({Latitude:e,Longitude:t})}else navigator.geolocation?navigator.geolocation.getCurrentPosition(h.bind(this),f):console.log("Geolocation is not supported by this browser.")};var v=P(this,Vi)[Vi];v.logout=this.logout,v.clear=this.clear,v.closeIframe=function(e,t){Mt(e,0,P(c,Gi)[Gi].sessionId)},v.enableWebPush=function(e,t){c.notifications._enableWebPush(e,t)},v.tr=function(e){xn(e,{device:P(c,Ki)[Ki],session:P(c,Gi)[Gi],request:P(c,Ji)[Ji],logger:P(c,qi)[qi]})},v.setEnum=function(e){Tt(e,P(c,qi)[qi])},v.is_onloadcalled=function(){return 1===P(c,Wi)[Wi]},v.subEmail=function(e){p("1",e)},v.getEmail=function(e,t){p("-1",e,t)},v.unSubEmail=function(e){p("0",e)},v.unsubEmailGroups=function(e){je.unsubGroups=[];for(var t=document.getElementsByClassName("ct-unsub-group-input-item"),n=0;n0&&this.privacy.push(je.privacyArray),P(this,eo)[eo](),this.pageChanged();var s=setInterval((function(){P(o,Ki)[Ki].gcookie&&(clearInterval(s),P(o,Ji)[Ji].processBackupEvents())}),3e3);P(this,$i)[$i]?document.addEventListener("click",P(this,Qi)[Qi]):document.removeEventListener("click",P(this,Qi)[Qi]),P(this,Wi)[Wi]=1}}}},{key:"pageChanged",value:function(){var e=this,t=window.location.href,n=ft(t.toLowerCase()),i=P(this,Gi)[Gi].getSessionCookieObject(),o=void 0===i.p?0:i.p;i.p=++o,P(this,Gi)[Gi].setSessionCookieObject(i);var r={},a=function(e){if(""===e)return"";var t=document.createElement("a");return t.href=e,t.hostname}(document.referrer);if(window.location.hostname!==a){var s=120;""!==a&&(a=a.length>s?a.substring(0,s):a,r.referrer=a);var l=n.utm_source||n.wzrk_source;void 0!==l&&(l=l.length>s?l.substring(0,s):l,r.us=l);var c=n.utm_medium||n.wzrk_medium;void 0!==c&&(c=c.length>s?c.substring(0,s):c,r.um=c);var u=n.utm_campaign||n.wzrk_campaign;if(void 0!==u&&(u=u.length>s?u.substring(0,s):u,r.uc=u),void 0!==n.wzrk_medium){var d=n.wzrk_medium;d.match(/^email$|^social$|^search$/)&&(r.wm=d)}}(r=P(this,Ji)[Ji].addSystemDataToObject(r,void 0)).cpg=t,r.WZRK_CAMP=_t();var p=P(this,Hi)[Hi].dataPostURL;P(this,Ji)[Ji].addFlags(r),1===parseInt(r.pg)&&P(this,ro)[ro](r),p=vt(p,"type","page"),p=vt(p,"d",yt(JSON.stringify(r),P(this,qi)[qi])),P(this,Ji)[Ji].saveAndFireRequest(p,je.blockRequest),1===parseInt(r.pg)&&this.event.push(be,{t:4}),P(this,Yi)[Yi]=t,setTimeout((function(){o<=3&&P(e,io)[io](),P(e,oo)[oo]()&&setInterval((function(){P(e,io)[io]()}),3e5)}),12e4)}},{key:"_isPersonalisationActive",value:function(){return Te._isLocalStorageSupported()&&this.enablePersonalization}},{key:"sendLocationData",value:function(e){var t={af:{}},n={};(t.type="profile",null==n.tz&&(n.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),t.profile=n,e)&&Object.keys(e).forEach((function(n){t.af[n]=e[n]}));je.location&&(t.af=l(l({},t.af),je.location)),t=P(this,Ji)[Ji].addSystemDataToObject(t,void 0),P(this,Ji)[Ji].addFlags(t);var i=yt(JSON.stringify(t),P(this,qi)[qi]),o=P(this,Hi)[Hi].dataPostURL;o=vt(o,"type",ee),o=vt(o,"d",i),P(this,Ji)[Ji].saveAndFireRequest(o,je.blockRequest)}},{key:"setOffline",value:function(e){"boolean"==typeof e?(je.offline=e,e||P(this,Ji)[Ji].processBackupEvents()):console.error("setOffline should be called with a value of type boolean")}},{key:"defineVariable",value:function(e,t){return _i.define(e,t,P(this,Zi)[Zi])}},{key:"syncVariables",value:(o=n(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(4!==P(this,qi)[qi].logLevel){e.next=4;break}return e.abrupt("return",P(this,Zi)[Zi].syncVariables(t,n));case 4:P(this,qi)[qi].error("App log level is not set to 4");case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"fetchVariables",value:(t=n(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",P(this,Zi)[Zi].fetchVariables(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"addVariablesChangedCallback",value:function(e){P(this,Zi)[Zi].addVariablesChangedCallback(e)}},{key:"addOneTimeVariablesChangedCallback",value:function(e){P(this,Zi)[Zi].addOneTimeVariablesChangedCallback(e)}},{key:"popupCallback",set:function(e){this.popupCallbacks[this.popupCurrentWzrkId]=e}}]),e}(),so=function(){this.onUserLogin._processOldValues(),this.privacy._processOldValues(),this.event._processOldValues(),this.profile._processOldValues(),this.notifications._processOldValues()},lo=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return function(){clearTimeout(t),t=setTimeout(e,n)}},co=function(){var e=this;P(this,to)[to]((function(){P(e,Yi)[Yi]!==location.href&&e.pageChanged()}))()},uo=function(){var e=P(this,Hi)[Hi].dataPostURL,t={};t=P(this,Ji)[Ji].addSystemDataToObject(t,void 0),e=vt(e,"type","ping"),e=vt(e,"d",yt(JSON.stringify(t),P(this,qi)[qi])),P(this,Ji)[Ji].saveAndFireRequest(e,je.blockRequest)},po=function(){return void 0!==window.wzrk_d&&"continuous"===window.wzrk_d.ping},ho=function(e){this._isPersonalisationActive()&&(e.dsync=!0)},fo=new ao(window.clevertap);return window.clevertap=window.wizrocket=fo,fo})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).clevertap=t()}(this,(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,n,i,o,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function n(e){return function(){var n=this,i=arguments;return new Promise((function(o,r){var a=e.apply(n,i);function s(e){t(a,o,r,s,l,"next",e)}function l(e){t(a,o,r,s,l,"throw",e)}s(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}var C=0;function x(e){return"__private_"+C+++"_"+e}function P(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var S=function(t){var n,i=Object.prototype,o=i.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var o=t&&t.prototype instanceof y?t:y,r=Object.create(o.prototype),a=new E(i||[]);return r._invoke=function(e,t,n){var i=p;return function(o,r){if(i===f)throw new Error("Generator is already running");if(i===v){if("throw"===o)throw r;return L()}for(n.method=o,n.arg=r;;){var a=n.delegate;if(a){var s=O(a,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var l=d(e,t,n);if("normal"===l.type){if(i=n.done?v:h,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=v,n.method="throw",n.arg=l.arg)}}}(e,n,a),r}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var p="suspendedStart",h="suspendedYield",f="executing",v="completed",g={};function y(){}function b(){}function m(){}var w={};w[a]=function(){return this};var k=Object.getPrototypeOf,C=k&&k(k(A([])));C&&C!==i&&o.call(C,a)&&(w=C);var x=m.prototype=y.prototype=Object.create(w);function P(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(t,n){function i(r,a,s,l){var c=d(t[r],t,a);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"===e(p)&&o.call(p,"__await")?n.resolve(p.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):n.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}))}l(c.arg)}var r;this._invoke=function(e,t){function o(){return new n((function(n,o){i(e,t,n,o)}))}return r=r?r.then(o,o):o()}}function O(e,t){var i=e.iterator[t.method];if(i===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,O(e,t),"throw"===t.method))return g;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var o=d(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,g;var r=o.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,g):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function A(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,r=function t(){for(;++i=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(l&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;_(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:A(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=n),g}},t}("object"===("undefined"==typeof module?"undefined":e(module))?module.exports:{});try{regeneratorRuntime=S}catch(e){Function("r","regeneratorRuntime = r")(S)}var O,I="clevertap-prod.com",_="https:",E=x("accountId"),A=x("region"),L=x("targetDomain"),R=x("dcSdkversion"),M=x("token"),T=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.id,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:I,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";i(this,e),Object.defineProperty(this,E,{writable:!0,value:void 0}),Object.defineProperty(this,A,{writable:!0,value:""}),Object.defineProperty(this,L,{writable:!0,value:I}),Object.defineProperty(this,R,{writable:!0,value:""}),Object.defineProperty(this,M,{writable:!0,value:""}),this.id=n,o&&(this.region=o),r&&(this.targetDomain=r),a&&(this.token=a)}return r(e,[{key:"id",get:function(){return P(this,E)[E]},set:function(e){P(this,E)[E]=e}},{key:"region",get:function(){return P(this,A)[A]},set:function(e){P(this,A)[A]=e}},{key:"dcSDKVersion",get:function(){return P(this,R)[R]},set:function(e){P(this,R)[R]=e}},{key:"targetDomain",get:function(){return P(this,L)[L]},set:function(e){P(this,L)[L]=e}},{key:"token",get:function(){return P(this,M)[M]},set:function(e){P(this,M)[M]=e}},{key:"finalTargetDomain",get:function(){return this.region?"".concat(this.region,".").concat(this.targetDomain):this.targetDomain===I?"".concat("eu1",".").concat(this.targetDomain):this.targetDomain}},{key:"dataPostPEURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/defineVars")}},{key:"dataPostURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/a?t=96")}},{key:"recorderURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/r?r=1")}},{key:"emailURL",get:function(){return"".concat(_,"//").concat(this.finalTargetDomain,"/e?r=1")}}]),e}(),j=new RegExp("^\\s+|\\.|:|\\$|'|\"|\\\\|\\s+$","g"),D=new RegExp("^\\s+|'|\"|\\\\|\\s+$","g"),z=new RegExp("'","g"),B="clear",N="Charged ID",F="WZRK_CHARGED_ID",U="WZRK_G",q="WZRK_K",V="WZRK_CAMP",W="WZRK_CAMP_G",K="WZRK_EV",G="WZRK_META",H="WZRK_PR",J="WZRK_ARP",Z="WZRK_L",$="global",Y="optOut",Q="useIP",X="WZRK_X",ee="push",te=31536e3,ne="2",ie="wzrk_",oe="wzrk_id",re="Notification Viewed",ae="Notification Clicked",se="WZRK_FPU",le="WZRK_PSD",ce="$incr",ue="$decr",de="$set",pe="$add",he="$remove",fe="$delete",ve="WZRK_INBOX_CONFIG",ge="WZRK_INBOX",ye=1e3,be="wzrk_fetch",me=["Stayed","UTM Visited","App Launched","Notification Sent",re,ae],we=function(e){return"string"==typeof e||e instanceof String},ke=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Ce=function(t){return"object"===e(t)&&t instanceof Date},xe=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},Pe=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},Se=function(e){return/^-?[\d.]+(?:e-?\d+)?$/.test(e)&&"number"==typeof e},Oe=function(e){return null!=e&&"undefined"!==e},Ie=function t(n,i){var o;if("object"!==e(n))return we(n)?(o=_e(n,D)).length>1024&&(o=o.substring(0,1024),i.reportError(521,o+"... length exceeded 1024 chars. Trimmed.")):o=n,o;for(var r in n)if(n.hasOwnProperty(r)){var a=t(n[r],i),s=void 0;(s=_e(r,j)).length>1024&&(s=s.substring(0,1024),i.reportError(520,s+"... length exceeded 1024 chars. Trimmed.")),delete n[r],n[s]=a}return n},_e=function(e,t){return e.replace(t,"")},Ee=function(){var e=new Date;return e.getFullYear()+""+e.getMonth()+e.getDay()},Ae=function(){return Math.floor((new Date).getTime()/1e3)},Le=function(e){return"$D_"+Math.round(e.getTime()/1e3)},Re=function(e){if(Me(e))return"$D_"+e},Me=function(e){var t=/^(\d{4})(\d{2})(\d{2})$/.exec(e);if(null==t)return!1;var n=t[3],i=t[2]-1,o=t[1],r=new Date(o,i,n);return r.getDate()==n&&r.getMonth()==i&&r.getFullYear()==o},Te=function(){function e(){i(this,e)}return r(e,null,[{key:"save",value:function(e,t){return!(!e||!t)&&(this._isLocalStorageSupported()?(localStorage.setItem(e,"string"==typeof t?t:JSON.stringify(t)),!0):void 0)}},{key:"read",value:function(e){if(!e)return!1;var t=null;if(this._isLocalStorageSupported()&&(t=localStorage.getItem(e)),null!=t)try{t=JSON.parse(t)}catch(e){}return t}},{key:"remove",value:function(e){return!!e&&(this._isLocalStorageSupported()?(localStorage.removeItem(e),!0):void 0)}},{key:"removeCookie",value:function(e,t){var n=e+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT;";t&&(n=n+" domain="+t+"; path=/"),document.cookie=n}},{key:"createCookie",value:function(e,t,n,i){var o="",r="";if(n){var a=new Date;a.setTime(a.getTime()+1e3*n),o="; expires="+a.toGMTString()}i&&(r="; domain="+i),t=encodeURIComponent(t),document.cookie=e+"="+t+o+r+"; path=/"}},{key:"readCookie",value:function(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i=0;s--){if(a=0===s?r[s]+a:"."+r[s]+a,this.readCookie(e)){var l="test_"+e+s;if(this.createCookie(l,t,10,a),!this.readCookie(l))continue;this.removeCookie(l,a)}if(this.createCookie(e,t,n,a),this.readCookie(e)==t){o=a,je.broadDomain=o;break}}else this.createCookie(e,t,n,o)}else this.createCookie(e,t,n,i)}},{key:"getMetaProp",value:function(e){var t=this.readFromLSorCookie(G);if(null!=t)return t[e]}},{key:"setMetaProp",value:function(e,t){if(this._isLocalStorageSupported()){var n=this.readFromLSorCookie(G);null==n&&(n={}),void 0===t?delete n[e]:n[e]=t,this.saveToLSorCookie(G,n)}}},{key:"getAndClearMetaProp",value:function(e){var t=this.getMetaProp(e);return this.setMetaProp(e,void 0),t}},{key:"setInstantDeleteFlagInK",value:function(){var e=this.readFromLSorCookie(q);null==e&&(e={}),e.flag=!0,this.saveToLSorCookie(q,e)}},{key:"backupEvent",value:function(e,t,n){var i=this.readFromLSorCookie(Z);void 0===i&&(i={}),i[t]={q:e},this.saveToLSorCookie(Z,i),n.debug("stored in ".concat(Z," reqNo : ").concat(t," -> ").concat(e))}},{key:"removeBackup",value:function(e,t){var n=this.readFromLSorCookie(Z);null!=n&&void 0!==n[e]&&(t.debug("del event: ".concat(e," data-> ").concat(n[e].q)),delete n[e],this.saveToLSorCookie(Z,n))}}]),e}(),je={globalCache:{gcookie:null,REQ_N:0,RESP_N:0},LRU_CACHE:null,globalProfileMap:void 0,globalEventsMap:void 0,blockRequest:!1,isOptInRequest:!1,broadDomain:null,webPushEnabled:null,campaignDivMap:{},currentSessionId:null,wiz_counter:0,notifApi:{notifEnabledFromApi:!1},unsubGroups:[],updatedCategoryLong:null,inbox:null,isPrivacyArrPushed:!1,privacyArray:[],offline:!1,location:null,dismissSpamControl:!1,globalUnsubscribe:!0,flutterVersion:null,variableStore:{}},De=x("keyOrder"),ze=x("deleteFromObject"),Be=function(){function e(t){i(this,e),Object.defineProperty(this,ze,{value:Ne}),Object.defineProperty(this,De,{writable:!0,value:void 0}),this.max=t;var n=Te.readFromLSorCookie(X);if(n){var o={};for(var r in P(this,De)[De]=[],n=n.cache)n.hasOwnProperty(r)&&(o[n[r][0]]=n[r][1],P(this,De)[De].push(n[r][0]));this.cache=o}else this.cache={},P(this,De)[De]=[]}return r(e,[{key:"get",value:function(e){var t=this.cache[e];return t&&(this.cache=P(this,ze)[ze](e,this.cache),this.cache[e]=t,P(this,De)[De].push(e)),this.saveCacheToLS(this.cache),t}},{key:"set",value:function(e,t){var n=this.cache[e],i=P(this,De)[De];null!=n?this.cache=P(this,ze)[ze](e,this.cache):i.length===this.max&&(this.cache=P(this,ze)[ze](i[0],this.cache)),this.cache[e]=t,P(this,De)[De][P(this,De)[De]-1]!==e&&P(this,De)[De].push(e),this.saveCacheToLS(this.cache)}},{key:"saveCacheToLS",value:function(e){var t=[],n=P(this,De)[De];for(var i in n)if(n.hasOwnProperty(i)){var o=[];o.push(n[i]),o.push(e[n[i]]),t.push(o)}Te.saveToLSorCookie(X,{cache:t})}},{key:"getKey",value:function(e){if(null===e)return null;var t=P(this,De)[De];for(var n in t)if(t.hasOwnProperty(n)&&this.cache[t[n]]===e)return t[n];return null}},{key:"getSecondLastKey",value:function(){var e=P(this,De)[De];return null!=e&&e.length>1?e[e.length-2]:-1}},{key:"getLastKey",value:function(){var e=P(this,De)[De].length;if(e)return P(this,De)[De][e-1]}}]),e}(),Ne=function(e,t){var n,i=JSON.parse(JSON.stringify(P(this,De)[De])),o={};for(var r in i)i.hasOwnProperty(r)&&(i[r]!==e?o[i[r]]=t[i[r]]:n=r);return i.splice(n,1),P(this,De)[De]=JSON.parse(JSON.stringify(i)),o},Fe=x("logger"),Ue=x("request"),qe=x("device"),Ve=x("session"),We=function(){function e(t){var n=t.logger,o=t.request,r=t.device,a=t.session;i(this,e),Object.defineProperty(this,Fe,{writable:!0,value:void 0}),Object.defineProperty(this,Ue,{writable:!0,value:void 0}),Object.defineProperty(this,qe,{writable:!0,value:void 0}),Object.defineProperty(this,Ve,{writable:!0,value:void 0}),P(this,Fe)[Fe]=n,P(this,Ue)[Ue]=o,P(this,qe)[qe]=r,P(this,Ve)[Ve]=a}return r(e,[{key:"s",value:function(e,t,n,i,o){var r=!1,a=!1;if(window.isOULInProgress&&(n||"undefined"!==i&&i===window.oulReqN)&&(window.isOULInProgress=!1,r=!0),void 0===i&&(i=0),Te.removeBackup(i,P(this,Fe)[Fe]),!(i>je.globalCache.REQ_N)){if(Oe(P(this,qe)[qe].gcookie)||e&&(a=!0),!Oe(P(this,qe)[qe].gcookie)||n||"boolean"==typeof o){var s=P(this,Ve)[Ve].getSessionCookieObject();if(window.isOULInProgress||s.s&&t50&&t.reportError(522,"Charged Items exceed 50 limit. Actual count: "+e[n].length),e[n])if(e[n].hasOwnProperty(i)&&(!ke(e[n][i])||!rt(e[n][i])))return!1}else{if(ke(e[n])||Array.isArray(e[n]))return!1;Ce(e[n])&&(e[n]=Le(e[n]))}if(we(e[N])||Se(e[N])){var o=e[N]+"";if(void 0===O&&(O=Te.readFromLSorCookie(F)),void 0!==O&&O.trim()===o.trim())return t.error("Duplicate charged Id - Dropped"+e),!1;O=o,Te.saveToLSorCookie(F,o)}return!0}return!1},st=x("logger"),lt=x("oldValues"),ct=x("request"),ut=x("isPersonalisationActive"),dt=x("processEventArray"),pt=function(e){c(n,e);var t=y(n);function n(e,o){var r,a=e.logger,s=e.request,l=e.isPersonalisationActive;return i(this,n),r=t.call(this),Object.defineProperty(v(r),dt,{value:ht}),Object.defineProperty(v(r),st,{writable:!0,value:void 0}),Object.defineProperty(v(r),lt,{writable:!0,value:void 0}),Object.defineProperty(v(r),ct,{writable:!0,value:void 0}),Object.defineProperty(v(r),ut,{writable:!0,value:void 0}),P(v(r),st)[st]=a,P(v(r),lt)[lt]=o,P(v(r),ct)[ct]=s,P(v(r),ut)[ut]=l,r}return r(n,[{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0;){var t=e.shift();if(we(t))if(t.length>1024&&(t=t.substring(0,1024),P(this,st)[st].reportError(510,t+"... length exceeded 1024 chars. Trimmed.")),me.includes(t))P(this,st)[st].reportError(513,t+" is a restricted system event. It cannot be used as an event name.");else{var n={type:"event"};if(n.evtName=_e(t,j),0!==e.length){var i=e.shift();if(ke(i)){if("Charged"===t){if(!at(i,P(this,st)[st])){P(this,st)[st].reportError(511,"Charged event structure invalid. Not sent.");continue}}else if(!rt(i)){P(this,st)[st].reportError(512,t+" event structure invalid. Not sent.");continue}n.evtData=i}else e.unshift(i)}P(this,ct)[ct].processEvent(n)}else P(this,st)[st].error($e)}},ft=function(e){var t={},n=e.indexOf("?");if(n>1){var i,o=e.substring(n+1),r=/\+/g,a=/([^&=]+)=?([^&]*)/g,s=function(e){var t=e.replace(r," ");try{t=decodeURIComponent(t)}catch(e){}return t};for(i=a.exec(o);i;)t[s(i[1])]=s(i[2]),i=a.exec(o)}return t},vt=function(e,t,n){return e+"&"+t+"="+encodeURIComponent(n)},gt=function(){return window.location.hostname},yt=function(e,t){return t&&"function"==typeof t.debug&&t.debug("dobj:"+e),mt(e)},bt=function(){var e="",t=0;for(t=0;t<=25;t++)e+=String.fromCharCode(t+65);for(t=0;t<=25;t++)e+=String.fromCharCode(t+97);for(t=0;t<10;t++)e+=t;return e+"+/="}(),mt=function(e){if(null==e)return"";var t,n,i,o,r,a,s,l="",c=0;for(e=function(e){if(null==e)return"";var t,n,i,o={},r={},a="",s="",l="",c=2,u=3,d=2,p="",h=0,f=0,v=String.fromCharCode;for(i=0;i>=1}else{for(n=1,t=0;t>=1}0==--c&&(c=Math.pow(2,d),d++),delete r[l]}else for(n=o[l],t=0;t>=1;0==--c&&(c=Math.pow(2,d),d++),o[s]=u++,l=String(a)}if(""!==l){if(Object.prototype.hasOwnProperty.call(r,l)){if(l.charCodeAt(0)<256){for(t=0;t>=1}else{for(n=1,t=0;t>=1}0==--c&&(c=Math.pow(2,d),d++),delete r[l]}else for(n=o[l],t=0;t>=1;0==--c&&(c=Math.pow(2,d),d++)}for(n=2,t=0;t>=1;for(;;){if(h<<=1,15==f){p+=v(h);break}f++}return p}(e);c<2*e.length;)c%2==0?(t=e.charCodeAt(c/2)>>8,n=255&e.charCodeAt(c/2),i=c/2+1>8:NaN):(t=255&e.charCodeAt((c-1)/2),(c+1)/2>8,i=255&e.charCodeAt((c+1)/2)):n=i=NaN),c+=3,o=t>>2,r=(3&t)<<4|n>>4,a=(15&n)<<2|i>>6,s=63&i,isNaN(n)?a=s=64:isNaN(i)&&(s=64),l=l+bt.charAt(o)+bt.charAt(r)+bt.charAt(a)+bt.charAt(s);return l},wt=x("fireRequest"),kt=x("dropRequestDueToOptOut"),Ct=x("addUseIPToRequest"),xt=x("addARPToRequest"),Pt=function(){function e(){i(this,e),this.networkRetryCount=0,this.minDelayFrequency=0}return r(e,[{key:"getDelayFrequency",value:function(){if(this.logger.debug("Network retry #"+this.networkRetryCount),this.networkRetryCount<10)return this.logger.debug(this.account.id,"Failure count is "+this.networkRetryCount+". Setting delay frequency to 1s"),this.minDelayFrequency=ye,this.minDelayFrequency;if(null==this.account.region)return this.logger.debug(this.account.id,"Setting delay frequency to 1s"),ye;var e=1e3*(Math.floor(10*Math.random())+1);return this.minDelayFrequency+=e,this.minDelayFrequency<6e5?(this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency):(this.minDelayFrequency=ye,this.logger.debug(this.account.id,"Setting delay frequency to "+this.minDelayFrequency),this.minDelayFrequency)}}],[{key:"fireRequest",value:function(e,t,n,i){P(this,wt)[wt](e,1,t,n,i)}}]),e}();Pt.logger=void 0,Pt.device=void 0,Pt.account=void 0,Object.defineProperty(Pt,wt,{value:function(e,t,n,i,o){var r,a,s=this;if(P(this,kt)[kt]())this.logger.debug("req dropped due to optout cookie: "+this.device.gcookie);else{if(Oe(this.device.gcookie)||(je.blockRequest=!0),o&&o===be)!Oe(this.device.gcookie)&&je.globalCache.RESP_N url: "+e)}}}),Object.defineProperty(Pt,kt,{value:function(){return!je.isOptInRequest&&Oe(this.device.gcookie)&&we(this.device.gcookie)?":OO"===this.device.gcookie.slice(-3):(je.isOptInRequest=!1,!1)}}),Object.defineProperty(Pt,Ct,{value:function(e){var t=Te.getMetaProp(Q);return"boolean"!=typeof t&&(t=!1),vt(e,Q,t?"true":"false")}}),Object.defineProperty(Pt,xt,{value:function(e,t){if(!0===t){var n={skipResARP:!0};return vt(e,"arp",yt(JSON.stringify(n),this.logger))}return Te._isLocalStorageSupported()&&void 0!==localStorage.getItem(J)&&null!==localStorage.getItem(J)?vt(e,"arp",yt(JSON.stringify(Te.readFromLSorCookie(J)),this.logger)):e}});var St=function(){var e={};if(Te._isLocalStorageSupported()){var t=Te.read(V);null!=t?(t=JSON.parse(decodeURIComponent(t).replace(z,'"'))).hasOwnProperty("global")?e.wp=t:e=t:e={}}return e},Ot=function(e){if(Te._isLocalStorageSupported()){var t=l(l({},St()),e),n=JSON.stringify(t);Te.save(V,encodeURIComponent(n)),It()}},It=function(){if(Te._isLocalStorageSupported()){var e=Te.read(U);if(Oe(e))try{e=JSON.parse(decodeURIComponent(Te.read(U)));var t=Te.read(W)?JSON.parse(decodeURIComponent(Te.read(W))):{};if(e&&Te._isLocalStorageSupported()){var n={},i=St();Object.keys(i).forEach((function(o){var r=e in t&&Object.keys(t[e]).length&&t[e][o]?t[e][o]:{},s=i[o].global,c=Ee(),u=i[o][c];if(void 0!==s){var d=Object.keys(s);for(var p in d){var h=[];if(d.hasOwnProperty(p)){var f=0,v=0,g=d[p];if("tc"===g)continue;void 0!==u&&void 0!==u[g]&&(f=u[g]),void 0!==s&&void 0!==s[g]&&(v=s[g]),h=[g,f,v],r[g]=h}}}n=l(l({},n),{},a({},o,r))})),t[e]=n,Te.save(W,encodeURIComponent(JSON.stringify(t)))}}catch(e){console.error("Invalid clevertap Id "+e)}}},_t=function(){var e=JSON.parse(decodeURIComponent(Te.read(U))),t={};if(Te._isLocalStorageSupported()){t=St();var n=Te.read(W),i=n?decodeURIComponent(n):null,o=i?JSON.parse(i):null,r=e&&null!=n&&o&&o[e]&&o[e].wp?Object.values(o[e].wp):[],a=e&&null!=n&&o&&o[e]&&o[e].wi?Object.values(o[e].wi):[],s=Ee(),l=0,c=0;return t.wp&&t.wp[s]&&"undefined"!==t.wp[s].tc&&(l=t.wp[s].tc),t.wi&&t.wi[s]&&"undefined"!==t.wi[s].tc&&(c=t.wi[s].tc),{wmp:l,wimp:c,tlc:r,witlc:a}}},Et=function(e,t){var n=t.logger,i=!1;if(ke(e))for(var o in e)if(e.hasOwnProperty(o)){i=!0;var r=e[o];if(null==r){delete e[o];continue}"Gender"!==o||r.match(/^M$|^F$/)||(i=!1,n.error(Ye)),"Employed"!==o||r.match(/^Y$|^N$/)||(i=!1,n.error(Qe)),"Married"!==o||r.match(/^Y$|^N$/)||(i=!1,n.error(Xe)),"Education"!==o||r.match(/^School$|^College$|^Graduate$/)||(i=!1,n.error(et)),"Age"===o&&null!=r&&(Pe(r)?e.Age=+r:(i=!1,n.error(tt))),"DOB"===o?(/^\$D_/.test(r)&&11===(r+"").length||Ce(r)||(i=!1,n.error(nt)),Ce(r)&&(e[o]=Le(r))):Ce(r)&&(e[o]=Le(r)),"Phone"!==o||xe(r)||(r.length>8&&"+"===r.charAt(0)?(r=r.substring(1,r.length),Pe(r)?e.Phone=+r:(i=!1,n.error(ot+". Removed."))):(i=!1,n.error(ot+". Removed."))),i||delete e[o]}return i},At=function(e){var t={};t.Name=e.name,null!=e.id&&(t.FBID=e.id+""),"male"===e.gender?t.Gender="M":"female"===e.gender?t.Gender="F":t.Gender="O";null!=e.relationship_status&&(t.Married="N","Married"===e.relationship_status&&(t.Married="Y"));var n=function(e){if(null!=e){for(var t="",n="",i=0;i0?"Y":"N",null!=e.email&&(t.Email=e.email),null!=e.birthday){var o=e.birthday.split("/");t.DOB=Re(o[2]+o[0]+o[1])}return t},Lt=function(e,t){var n=t.logger,i={};if(null!=e.displayName&&(i.Name=e.displayName),null!=e.id&&(i.GPID=e.id+""),null!=e.gender&&("male"===e.gender?i.Gender="M":"female"===e.gender?i.Gender="F":"other"===e.gender&&(i.Gender="O")),null!=e.image&&!1===e.image.isDefault&&(i.Photo=e.image.url.split("?sz")[0]),null!=e.emails)for(var o=0;o0)for(var t in e)if(e.hasOwnProperty(t)){var n=e[t],i={},o=void 0;if(null!=n.Site){if(o=n.Site,xe(o)||!Et(o,{logger:P(this,Dt)[Dt]}))return}else if(null!=n.Facebook){var r=n.Facebook;xe(r)||r.error||(o=At(r))}else if(null!=n["Google Plus"]){var a=n["Google Plus"];xe(a)||a.error||(o=Lt(a,{logger:P(this,Dt)[Dt]}))}if(null!=o&&!xe(o)){i.type="profile",null==o.tz&&(o.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),i.profile=o,Rt(o,!0),i=P(this,zt)[zt].addSystemDataToObject(i,void 0),P(this,zt)[zt].addFlags(i);var s=yt(JSON.stringify(i),P(this,Dt)[Dt]),l=P(this,Bt)[Bt].dataPostURL;l=vt(l,"type",ee),l=vt(l,"d",s),P(this,zt)[zt].saveAndFireRequest(l,je.blockRequest)}}},Wt=x("request"),Kt=x("logger"),Gt=x("account"),Ht=x("session"),Jt=x("oldValues"),Zt=x("device"),$t=x("processOUL"),Yt=x("handleCookieFromCache"),Qt=x("deleteUser"),Xt=x("processLoginArray"),en=function(e){c(n,e);var t=y(n);function n(e,o){var r,a=e.request,s=e.account,l=e.session,c=e.logger,u=e.device;return i(this,n),r=t.call(this),Object.defineProperty(v(r),Xt,{value:rn}),Object.defineProperty(v(r),Qt,{value:on}),Object.defineProperty(v(r),Yt,{value:nn}),Object.defineProperty(v(r),$t,{value:tn}),Object.defineProperty(v(r),Wt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Kt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Gt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Ht,{writable:!0,value:void 0}),Object.defineProperty(v(r),Jt,{writable:!0,value:void 0}),Object.defineProperty(v(r),Zt,{writable:!0,value:void 0}),P(v(r),Wt)[Wt]=a,P(v(r),Gt)[Gt]=s,P(v(r),Ht)[Ht]=l,P(v(r),Kt)[Kt]=c,P(v(r),Jt)[Jt]=o,P(v(r),Zt)[Zt]=u,r}return r(n,[{key:"clear",value:function(){P(this,Kt)[Kt].debug("clear called. Reset flag has been set."),P(this,Qt)[Qt](),Te.setMetaProp(B,!0)}},{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0)for(var o in e)if(e.hasOwnProperty(o)){var r=e[o],a={},s=void 0;if(null!=r.Site){if(s=r.Site,xe(s)||!Et(s,{logger:P(this,Kt)[Kt]}))return}else if(null!=r.Facebook){var l=r.Facebook;xe(l)||l.error||(s=At(l))}else if(null!=r["Google Plus"]){var c=r["Google Plus"];xe(c)&&!c.error&&(s=Lt(c,{logger:P(this,Kt)[Kt]}))}if(null!=s&&!xe(s)){a.type="profile",null==s.tz&&(s.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),a.profile=s;var u=[];Te._isLocalStorageSupported()&&(s.Identity&&u.push(s.Identity),s.Email&&u.push(s.Email),s.GPID&&u.push("GP:"+s.GPID),s.FBID&&u.push("FB:"+s.FBID),u.length>0&&i(u)),Rt(s,!0),a=P(this,Wt)[Wt].addSystemDataToObject(a,void 0),P(this,Wt)[Wt].addFlags(a),n&&(a.isOUL=!0);var d=yt(JSON.stringify(a),P(this,Kt)[Kt]),p=P(this,Gt)[Gt].dataPostURL;p=vt(p,"type",ee),p=vt(p,"d",d),P(this,Wt)[Wt].saveAndFireRequest(p,je.blockRequest,n)}}},nn=function(){je.blockRequest=!1,console.debug("Block request is false"),Te._isLocalStorageSupported()&&(delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),Te.removeCookie(V,gt()),Te.removeCookie(P(this,Ht)[Ht].cookieName,je.broadDomain),Te.removeCookie(J,je.broadDomain),P(this,Ht)[Ht].setSessionCookieObject("")},on=function(){je.blockRequest=!0,P(this,Kt)[Kt].debug("Block request is true"),je.globalCache={gcookie:null,REQ_N:0,RESP_N:0},Te._isLocalStorageSupported()&&(delete localStorage.WZRK_G,delete localStorage.WZRK_K,delete localStorage.WZRK_PR,delete localStorage.WZRK_EV,delete localStorage.WZRK_META,delete localStorage.WZRK_ARP,delete localStorage.WZRK_CAMP,delete localStorage.WZRK_CHARGED_ID),Te.removeCookie(U,je.broadDomain),Te.removeCookie(V,gt()),Te.removeCookie(q,gt()),Te.removeCookie(P(this,Ht)[Ht].cookieName,je.broadDomain),Te.removeCookie(J,je.broadDomain),P(this,Zt)[Zt].gcookie=null,P(this,Ht)[Ht].setSessionCookieObject("")},rn=function(e){if(Array.isArray(e)&&e.length>0){var t=e.pop();if(null!=t&&ke(t)&&(null!=t.Site&&Object.keys(t.Site).length>0||null!=t.Facebook&&Object.keys(t.Facebook).length>0||null!=t["Google Plus"]&&Object.keys(t["Google Plus"]).length>0)){Te.setInstantDeleteFlagInK();try{P(this,$t)[$t]([t])}catch(e){P(this,Kt)[Kt].debug(e)}}else P(this,Kt)[Kt].error("Profile object is in incorrect format")}},an=function(e){c(n,e);var t=y(n);function n(){var e;return i(this,n),(e=t.call(this))._details=null,e.shadow=null,e.shadow=e.attachShadow({mode:"open"}),e}return r(n,[{key:"renderBanner",value:function(){var e=this;this.shadow.innerHTML=this.getBannerContent(),!1!==this.trackClick&&this.addEventListener("click",(function(){var t=e.details.onClick;t&&(e.details.window?window.open(t,"_blank"):window.parent.location.href=t),window.clevertap.renderNotificationClicked({msgId:e.msgId,pivotId:e.pivotId})})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId})}},{key:"getBannerContent",value:function(){return'\n \n \n ")}},{key:"details",get:function(){return this._details||""},set:function(e){null===this._details&&(this._details=e,this.renderBanner())}}]),n}(f(HTMLElement)),sn=function(e){c(n,e);var t=y(n);function n(){var e;return i(this,n),(e=t.call(this))._target=null,e._carousel=null,e.shadow=null,e.slides=0,e.previouslySelectedItem=-1,e.selectedItem=1,e.autoSlide=null,e.stopAutoSlideTimeout=null,e.shadow=e.attachShadow({mode:"open"}),void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",an),e}return r(n,[{key:"renderCarousel",value:function(){this.slides=this.details.length,this.shadow.innerHTML=this.getStyles();var e=this.getCarouselContent();this.display.showNavBtns&&e.insertAdjacentHTML("beforeend",this.display.navBtnsHtml),this.display.showNavArrows&&(e.insertAdjacentHTML("beforeend",this.display.leftNavArrowHtml),e.insertAdjacentHTML("beforeend",this.display.rightNavArrowHtml)),this._carousel=e,this.shadow.appendChild(e),this.setupClick(),this.updateSelectedItem(),this.startAutoSlide(),this.setupOnHover(),window.clevertap.renderNotificationViewed({msgId:this.target.wzrk_id,pivotId:this.target.wzrk_pivot})}},{key:"setupClick",value:function(){var e=this;this._carousel.addEventListener("click",(function(t){var n=t.target.id;if(n.startsWith("carousel__button")){var i=+n.split("-")[1];i!==e.selectedItem&&(e.previouslySelectedItem=e.selectedItem,e.selectedItem=i,e.updateSelectedItem(),e.startAutoSlide())}else if(n.startsWith("carousel__arrow"))n.endsWith("right")?e.goToNext():e.goToPrev(),e.startAutoSlide();else if(n.indexOf("-")>-1){var o=+n.split("-")[1],r=o-1;window.parent.clevertap&&window.clevertap.renderNotificationClicked({msgId:e.target.wzrk_id,pivotId:e.target.wzrk_pivot,wzrk_slideNo:o});var a=e.details[r].onClick;""!==a&&(e.details[r].window?window.open(a,"_blank"):window.location.href=a)}}))}},{key:"setupOnHover",value:function(){var e=this;this._carousel.addEventListener("mouseenter",(function(t){e.stopAutoSlideTimeout=setTimeout((function(){e.autoSlide=clearInterval(e.autoSlide)}),500)})),this._carousel.addEventListener("mouseleave",(function(t){clearTimeout(e.stopAutoSlideTimeout),void 0===e.autoSlide&&e.startAutoSlide()}))}},{key:"getCarouselContent",value:function(){var e=document.createElement("div");return e.setAttribute("class","carousel"),this.details.forEach((function(t,n){var i=document.createElement("ct-web-personalisation-banner");i.classList.add("carousel__item"),i.trackClick=!1,i.setAttribute("id","carousel__item-".concat(n+1)),i.details=t,e.appendChild(i)})),e}},{key:"getStyles",value:function(){var e,t;return"\n \n ")}},{key:"updateSelectedItem",value:function(){if(-1!==this.previouslySelectedItem){var e=this.shadow.getElementById("carousel__item-".concat(this.previouslySelectedItem)),t=this.shadow.getElementById("carousel__button-".concat(this.previouslySelectedItem));e.classList.remove("carousel__item--selected"),t.classList.remove("carousel__button--selected")}var n=this.shadow.getElementById("carousel__item-".concat(this.selectedItem)),i=this.shadow.getElementById("carousel__button-".concat(this.selectedItem));n.classList.add("carousel__item--selected"),i.classList.add("carousel__button--selected")}},{key:"startAutoSlide",value:function(){var e=this;clearInterval(this.autoSlide),this.autoSlide=setInterval((function(){e.goToNext()}),this.display.sliderTime?1e3*this.display.sliderTime:3e3)}},{key:"goToNext",value:function(){this.goTo(this.selectedItem,(this.selectedItem+1)%this.slides)}},{key:"goToPrev",value:function(){this.goTo(this.selectedItem,this.selectedItem-1)}},{key:"goTo",value:function(e,t){this.previouslySelectedItem=e,this.selectedItem=t,0===t&&(this.selectedItem=this.slides),this.updateSelectedItem()}},{key:"target",get:function(){return this._target||""},set:function(e){null===this._target&&(this._target=e,this.renderCarousel())}},{key:"details",get:function(){return this.target.display.details}},{key:"display",get:function(){return this.target.display}}]),n}(f(HTMLElement)),ln=function(e){c(n,e);var t=y(n);function n(){var e;return i(this,n),(e=t.call(this))._target=null,e._session=null,e.shadow=null,e.popup=null,e.container=null,e.resizeObserver=null,e.shadow=e.attachShadow({mode:"open"}),e}return r(n,[{key:"renderImageOnlyPopup",value:function(){var e=this,t=this.target.wzrk_id.split("_")[0],n=this.session.sessionId;this.shadow.innerHTML=this.getImageOnlyPopupContent(),this.popup=this.shadowRoot.getElementById("imageOnlyPopup"),this.container=this.shadowRoot.getElementById("container"),this.closeIcon=this.shadowRoot.getElementById("close"),this.popup.addEventListener("load",this.updateImageAndContainerWidth()),this.resizeObserver=new ResizeObserver((function(){return e.handleResize(e.popup,e.container)})),this.resizeObserver.observe(this.popup),this.closeIcon.addEventListener("click",(function(){if(e.resizeObserver.unobserve(e.popup),document.getElementById("wzrkImageOnlyDiv").style.display="none",e.remove(),null!=t&&"-1"!==t&&Te._isLocalStorageSupported()){var i=St(),o=i.wp[n];null==o&&(o={},i[n]=o),o[t]="dnd",Ot(i)}})),window.clevertap.renderNotificationViewed({msgId:this.msgId,pivotId:this.pivotId}),this.onClickUrl&&this.popup.addEventListener("click",(function(){e.target.display.window?window.open(e.onClickUrl,"_blank"):window.parent.location.href=e.onClickUrl,window.clevertap.renderNotificationClicked({msgId:e.msgId,pivotId:e.pivotId})}))}},{key:"handleResize",value:function(e,t){var n=this.getRenderedImageWidth(e);t.style.setProperty("width","".concat(n,"px"))}},{key:"getImageOnlyPopupContent",value:function(){return"\n ".concat(this.target.msgContent.css,"\n ").concat(this.target.msgContent.html,"\n ")}},{key:"updateImageAndContainerWidth",value:function(){var e=this;return function(){var t=e.getRenderedImageWidth(e.popup);e.popup.style.setProperty("width","".concat(t,"px")),e.container.style.setProperty("width","".concat(t,"px")),e.container.style.setProperty("height","auto"),e.container.style.setProperty("position","fixed"),e.popup.style.setProperty("visibility","visible"),e.closeIcon.style.setProperty("visibility","visible"),document.getElementById("wzrkImageOnlyDiv").style.visibility="visible"}}},{key:"getRenderedImageWidth",value:function(e){var t=e.naturalWidth/e.naturalHeight;return e.height*t}},{key:"target",get:function(){return this._target||""},set:function(e){null===this._target&&(this._target=e,this.renderImageOnlyPopup())}},{key:"session",get:function(){return this._session||""},set:function(e){this._session=e}},{key:"msgId",get:function(){return this.target.wzrk_id}},{key:"pivotId",get:function(){return this.target.wzrk_pivot}},{key:"onClickUrl",get:function(){return this.target.display.onClickUrl}}]),n}(f(HTMLElement)),cn=function(e){c(n,e);var t=y(n);function n(e,o){var r;return i(this,n),(r=t.call(this)).wrapper=null,r.snackBar=null,r.shadow=r.attachShadow({mode:"open"}),r.config=e,r.message=o,r.renderMessage(o),r}return r(n,[{key:"createEl",value:function(e,t,n){var i=document.createElement(e);return i.setAttribute("id",t),i.setAttribute("part",n||t),i}},{key:"renderMessage",value:function(e){switch(this.wrapper=this.createEl("div","messageWrapper"),e.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":var t=this.prepareBasicMessage(e.msg[0]);this.wrapper.appendChild(t)}var n=this.createEl("div","timeStamp");if(n.innerHTML="".concat(mn(e.id.split("_")[1]),""),!e.viewed){var i=this.createEl("span","unreadMarker");n.appendChild(i)}this.wrapper.appendChild(n),this.shadow.appendChild(this.wrapper)}},{key:"prepareBasicMessage",value:function(e){var t=this.createEl("div","message");if(e.imageUrl){var n=this.addImage(e.imageUrl,"mainImg");t.appendChild(n)}var i=this.createEl("div","iconTitleDescWrapper");if(e.iconUrl){var o=this.addImage(e.iconUrl,"iconImg");i.appendChild(o)}var r=this.createEl("div","titleDescWrapper");if(e.title){var a=this.createEl("div","title");a.innerText=e.title,r.appendChild(a)}if(e.description){var s=this.createEl("div","description");s.innerText=e.description,r.appendChild(s)}if((e.title||e.description)&&i.appendChild(r),(e.iconUrl||e.title||e.description)&&t.appendChild(i),e.buttons&&e.buttons.length){var l=this.addButtons(e.buttons);t.appendChild(l)}return t}},{key:"addButtons",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.createEl("div","buttonsContainer"),i=!1;return t.forEach((function(t,o){var r=e.createEl("button","button-".concat(o),"button");r.innerText=t.text,o>0&&(r.style.cssText+="margin-left: 2px;"),"copy"===t.action&&(i=!0),n.appendChild(r)})),i&&this.addSnackbar(n),n}},{key:"addSnackbar",value:function(e){this.snackBar=this.createEl("div","snackbar-".concat(this.campaignId),"snackbar"),this.snackBar.innerHTML=Cn;var t=this.createEl("span","snackbar-msg-".concat(this.campaignId),"snackbar-msg");t.innerText="Copied to clipboard",this.snackBar.appendChild(t),e.appendChild(this.snackBar)}},{key:"addImage",value:function(e,t){var n=this.createEl("div","".concat(t,"Container")),i=this.createEl("img",t);return i.setAttribute("src",e),i.setAttribute("loading","lazy"),n.appendChild(i),n}},{key:"raiseClickedEvent",value:function(e,t){switch(this.message.templateType){case"text-only":case"text-with-icon":case"text-with-icon-and-image":this.raiseClickedForBasicTemplates(e,t)}}},{key:"raiseClickedForBasicTemplates",value:function(e,t){var n=this,i=this.message.msg[0],o={msgId:this.campaignId,pivotId:this.pivotId};if("BUTTON"===e.tagName){var r=e.id.split("-")[1],a=i.buttons[r];o.kv={wzrk_c2a:a.text},"url"===a.action?a.openUrlInNewTab?window.open(a.url,"_blank"):window.location=a.url:"copy"===a.action&&(window.focus(),navigator.clipboard.writeText(a.clipboardText),this.snackBar.style.setProperty("display","flex","important"),setTimeout((function(){n.snackBar.style.setProperty("display","none","important")}),2e3))}else"CT-INBOX-MESSAGE"===e.tagName&&i.onClickUrl&&(i.openUrlInNewTab?window.open(i.onClickUrl,"_blank"):window.location=i.onClickUrl);t?console.log("Notifiction clicked event will be raised at run time with payload ::",o):window.clevertap.renderNotificationClicked(o)}},{key:"pivotId",get:function(){return this.message.wzrk_pivot}},{key:"campaignId",get:function(){return this.message.wzrk_id}}]),n}(f(HTMLElement)),un=function(e){c(n,e);var t=y(n);function n(e){var o;return i(this,n),(o=t.call(this)).isInboxOpen=!1,o.isInboxFromFlutter=!1,o.selectedCategory=null,o.unviewedMessages={},o.unviewedCounter=0,o.isPreview=!1,o.inboxConfigForPreview={},o.inboxSelector=null,o.inbox=null,o.emptyInboxMsg=null,o.inboxCard=null,o.unviewedBadge=null,o.observer=null,o.selectedCategoryRef=null,o.addClickListenerOnDocument=function(e){if(e.composedPath().includes(o.inbox)){var t=e.path||e.composedPath&&e.composedPath();if(t.length){var n=t[0].id;if("closeInbox"===n)o.toggleInbox();else if(n.startsWith("category-"))o.prevCategoryRef=o.selectedCategoryRef,o.selectedCategoryRef=t[0],o.updateActiveCategory(t[0].innerText);else{var i=t.filter((function(e){var t;return(null===(t=e.id)||void 0===t?void 0:t.startsWith("button-"))||"CT-INBOX-MESSAGE"===e.tagName}));i.length&&i[i.length-1].raiseClickedEvent(i[0],o.isPreview)}}}else(o.inboxSelector.contains(e.target)||o.isInboxOpen)&&(o.isInboxFromFlutter?o.isInboxFromFlutter=!1:o.toggleInbox(e))},o.setBadgeStyle=function(e){null!==o.unviewedBadge&&(o.unviewedBadge.innerText=e>9?"9+":e,o.unviewedBadge.style.display=e>0?"flex":"none")},o.logger=e,o.shadow=o.attachShadow({mode:"open"}),o}return r(n,[{key:"connectedCallback",value:function(){this.init()}},{key:"init",value:function(){this.config=this.isPreview?this.inboxConfigForPreview:Te.readFromLSorCookie(ve)||{},0!==Object.keys(this.config).length&&(this.inboxSelector=document.getElementById(this.config.inboxSelector),null!==this.inboxSelector&&(this.config.styles.notificationsBadge?this.addUnviewedBadge():this.unviewedBadge&&this.unviewedBadge.remove(),this.createinbox(),document.removeEventListener("click",this.addClickListenerOnDocument),document.addEventListener("click",this.addClickListenerOnDocument),this.config.categories.length&&this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadow.innerHTML=this.getInboxStyles(),this.shadow.appendChild(this.inbox)))}},{key:"addMsgsToInboxFromLS",value:function(){var e=this,t=this.deleteExpiredAndGetUnexpiredMsgs(!1),n=t?Object.keys(t):[];0!==n.length&&(n.forEach((function(n){t[n].viewed||(e.unviewedMessages[n]=t[n],e.unviewedCounter++)})),this.buildUIForMessages(t),this.updateUnviewedBadgeCounter())}},{key:"deleteExpiredAndGetUnexpiredMsgs",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=fn(),n=Math.floor(Date.now()/1e3);for(var i in t)if(t[i].wzrk_ttl&&t[i].wzrk_ttl>0&&t[i].wzrk_ttl0&&(t=Object.values(t).sort((function(e,t){return t.date-e.date})).reduce((function(e,t){return e[t.id]=t,e}),{})),vn(t),t}},{key:"updateInboxMessages",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=this.deleteExpiredAndGetUnexpiredMsgs(),i=Date.now(),o={};t.forEach((function(t,r){var a="".concat(t.wzrk_id.split("_")[0],"_").concat(Date.now());t.id=a,t.date=i-r,t.viewed=0,n[a]=t,o[a]=t,e.unviewedMessages[a]=t,e.unviewedCounter++})),vn(n),this.buildUIForMessages(o),this.updateUnviewedBadgeCounter()}},{key:"createEl",value:function(e,t,n){var i=document.createElement(e);return i.setAttribute("id",t),i.setAttribute("part",n||t),i}},{key:"addUnviewedBadge",value:function(){var e=this;this.unviewedBadge||(this.unviewedBadge=this.createEl("div","unviewedBadge"),this.unviewedBadge.style.cssText="display: none; position: absolute; height: 16px; width: 26px; border-radius: 8px; background-color: ".concat(this.config.styles.notificationsBadge.backgroundColor,"; font-size: 12px; color: ").concat(this.config.styles.notificationsBadge.textColor,"; font-weight: bold; align-items: center; justify-content: center;"),document.body.appendChild(this.unviewedBadge)),this.updateUnviewedBadgePosition(),window.addEventListener("resize",(function(){e.updateUnviewedBadgePosition()}))}},{key:"updateUnviewedBadgePosition",value:function(){var e=this.inboxSelector.getBoundingClientRect(),t=e.top,n=e.right;this.unviewedBadge.style.top="".concat(t-8,"px"),this.unviewedBadge.style.left="".concat(n-8,"px")}},{key:"createinbox",value:function(){var e=this;this.inbox=this.createEl("div","inbox");var t=this.createEl("div","header"),n=this.createEl("div","headerTitle");n.innerText=this.config.title;var i=this.createEl("div","closeInbox");if(i.innerHTML="×",t.appendChild(n),t.appendChild(i),this.inbox.appendChild(t),this.config.categories.length){var o=this.createCategories();this.inbox.appendChild(o)}this.inboxCard=this.createEl("div","inboxCard"),this.inbox.appendChild(this.inboxCard),this.emptyInboxMsg=this.createEl("div","emptyInboxMsg"),this.emptyInboxMsg.innerText="All messages will be displayed here.",this.inboxCard.appendChild(this.emptyInboxMsg);var r={root:this.inboxCard,rootMargin:"0px",threshold:.5};this.observer=new IntersectionObserver((function(t,n){e.handleMessageViewed(t)}),r),this.addMsgsToInboxFromLS()}},{key:"createCategories",value:function(){var e=this,t=this.createEl("div","categoriesContainer"),n=this.createEl("div","leftArrow");n.innerHTML=kn,n.children[0].style="transform: rotate(180deg)",n.addEventListener("click",(function(){e.shadowRoot.getElementById("categoriesWrapper").scrollBy(-70,0)})),t.appendChild(n);var i=this.createEl("div","categoriesWrapper");["All"].concat(b(this.config.categories)).forEach((function(t,n){var o=e.createEl("div","category-".concat(n),"category");o.innerText=t,0===n&&(e.selectedCategoryRef=o),i.appendChild(o)})),t.appendChild(i);var o=this.createEl("div","rightArrow");o.innerHTML=kn,o.addEventListener("click",(function(){e.shadowRoot.getElementById("categoriesWrapper").scrollBy(70,0)})),t.appendChild(o);var r={root:t,threshold:.9},a=i.children[0],s=i.children[this.config.categories.length];return new IntersectionObserver((function(t){e.categoryObserverCb(n,t[0].intersectionRatio>=.9)}),r).observe(a),new IntersectionObserver((function(t){e.categoryObserverCb(o,t[0].intersectionRatio>=.9)}),r).observe(s),t}},{key:"categoryObserverCb",value:function(e,t){e&&(e.style.display=t?"none":"flex")}},{key:"updateActiveCategory",value:function(e){var t=this;this.selectedCategory=e,this.inboxCard.scrollTop=0;var n=0;this.prevCategoryRef&&this.prevCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef.setAttribute("selected","true"),this.inboxCard.childNodes.forEach((function(e){"emptyInboxMsg"!==e.getAttribute("id")&&(e.style.display="All"===t.selectedCategory||e.getAttribute("category")===t.selectedCategory?"block":"none","block"===e.style.display&&n++)})),0===n?(this.emptyInboxMsg.innerText="".concat(e," messages will be displayed here."),this.emptyInboxMsg.style.display="block"):this.emptyInboxMsg.style.display="none"}},{key:"buildUIForMessages",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!this.isPreview&&this.updateTSForRenderedMsgs(),this.inboxCard.scrollTop=0;var n,i=null!==(e=this.config.maxMsgsInInbox)&&void 0!==e?e:15,o=this.inboxCard.firstChild,r=Object.values(t).sort((function(e,t){return t.date-e.date})).map((function(e){return e.id})),a=k(r);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=new cn(this.config,t[s]);l.setAttribute("id",t[s].id),l.setAttribute("pivot",t[s].wzrk_pivot),l.setAttribute("part","ct-inbox-message"),this.config.categories.length>0?(l.setAttribute("category",t[s].tags[0]||""),l.style.display="All"===this.selectedCategory||t[s].category===this.selectedCategory?"block":"none"):l.style.display="block",this.inboxCard.insertBefore(l,o),this.observer.observe(l)}}catch(e){a.e(e)}finally{a.f()}for(var c=this.inboxCard.querySelectorAll("ct-inbox-message").length;c>i;){var u=this.inboxCard.querySelectorAll("ct-inbox-message");u.length>0&&u[u.length-1].remove(),c--}var d=this.inboxCard.querySelectorAll('ct-inbox-message[style*="display: block"]').length;this.emptyInboxMsg.style.display=d?"none":"block"}},{key:"handleMessageViewed",value:function(e){var t=this,n=!this.isPreview;this.isInboxOpen&&e.forEach((function(e){e.isIntersecting&&t.unviewedMessages.hasOwnProperty(e.target.id)&&0===e.target.message.viewed&&(e.target.message.viewed=1,n?(window.clevertap.renderNotificationViewed({msgId:e.target.campaignId,pivotId:e.target.pivotId}),t.updateMessageInLS(e.target.id,l(l({},e.target.message),{},{viewed:1})),setTimeout((function(){e.target.shadowRoot.getElementById("unreadMarker").style.display="none"}),1e3)):console.log("Notifiction viewed event will be raised at run time with payload ::",{msgId:e.target.campaignId,pivotId:e.target.pivotId}),t.unviewedCounter--,t.updateUnviewedBadgeCounter(),delete t.unviewedMessages[e.target.id])}))}},{key:"updateMessageInLS",value:function(e,t){if(!this.isPreview){var n=fn();n[e]=t,vn(n)}}},{key:"toggleInbox",value:function(e){this.isInboxOpen=!this.isInboxOpen,this.isInboxFromFlutter=!!(null==e?void 0:e.rect),this.isInboxOpen?(this.inboxCard.scrollTop=0,!this.isPreview&&this.deleteExpiredAndGetUnexpiredMsgs(),this.inbox.style.display="block",this.inbox.style.zIndex="2147483647",this.config.categories.length&&(this.selectedCategoryRef.setAttribute("selected","false"),this.selectedCategoryRef=this.shadowRoot.getElementById("category-0"),this.updateActiveCategory(this.selectedCategoryRef.innerText),this.shadowRoot.getElementById("categoriesWrapper").scrollLeft-=this.shadowRoot.getElementById("categoriesWrapper").scrollWidth),this.setInboxPosition(e)):this.inbox.style.display="none"}},{key:"setInboxPosition",value:function(e){var t=window.outerWidth,n=getComputedStyle(je.inbox),i=n.getPropertyValue("--inbox-top"),o=n.getPropertyValue("--inbox-bottom"),r=n.getPropertyValue("--inbox-left"),a=n.getPropertyValue("--inbox-right");if(t>481&&!(i||o||r||a)){var s=bn(e,this.inbox.clientHeight,this.inbox.clientWidth),l=s.xPos,c=s.yPos;this.inbox.style.top=c+"px",this.inbox.style.left=l+"px"}}},{key:"updateUnviewedBadgeCounter",value:function(){if(this.isPreview)this.setBadgeStyle(this.unviewedCounter);else{var e=0;this.inboxCard.querySelectorAll("ct-inbox-message").forEach((function(t){var n=fn();n[t.id]&&0===n[t.id].viewed&&e++})),this.setBadgeStyle(e)}}},{key:"updateTSForRenderedMsgs",value:function(){this.inboxCard.querySelectorAll("ct-inbox-message").forEach((function(e){var t=e.id.split("_")[1];e.shadow.getElementById("timeStamp").firstChild.innerText=mn(t)}))}},{key:"getInboxStyles",value:function(){var e=this.config.categories.length?64:16,t={panelBackgroundColor:this.config.styles.panelBackgroundColor,panelBorderColor:this.config.styles.panelBorderColor,headerBackgroundColor:this.config.styles.header.backgroundColor,headerTitleColor:this.config.styles.header.titleColor,closeIconColor:this.config.styles.closeIconColor,categoriesTabColor:this.config.styles.categories.tabColor,categoriesTitleColor:this.config.styles.categories.titleColor,selectedCategoryTabColor:this.config.styles.categories.selectedTab.tabColor,selectedCategoryTitleColor:this.config.styles.categories.selectedTab.titleColor,headerCategoryHeight:36+e};this.config.styles.categories.borderColor&&(t.categoriesBorderColor=this.config.styles.categories.borderColor),this.config.styles.categories.selectedTab.borderColor&&(t.selectedCategoryBorderColor=this.config.styles.categories.selectedTab.borderColor);var n,i,o,r,a,s,l,c,u,d,p,h,f,v,g,y,b,m,w,k,C,x=(i=(n=t).panelBackgroundColor,o=n.panelBorderColor,r=n.headerBackgroundColor,a=n.headerTitleColor,s=n.closeIconColor,l=n.categoriesTabColor,c=n.categoriesTitleColor,u=n.categoriesBorderColor,d=n.selectedCategoryTabColor,p=n.selectedCategoryTitleColor,h=n.selectedCategoryBorderColor,f=n.headerCategoryHeight,'\n \n ")),P=this.config.styles.cards;return x+(v={backgroundColor:P.backgroundColor,borderColor:P.borderColor,titleColor:P.titleColor,descriptionColor:P.descriptionColor,buttonColor:P.buttonColor,buttonTextColor:P.buttonTextColor,unreadMarkerColor:P.unreadMarkerColor},g=v.backgroundColor,y=v.borderColor,b=v.titleColor,m=v.descriptionColor,w=v.buttonColor,k=v.buttonTextColor,C=v.unreadMarkerColor,'\n \n "))}},{key:"incomingMessages",get:function(){return[]},set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length>0&&this.inbox&&this.updateInboxMessages(e)}},{key:"incomingMessagesForPreview",get:function(){return[]},set:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n={};t.length>0&&this.inbox&&(this.isPreview=!0,this.unviewedCounter=0,t.forEach((function(t){var i="".concat(t.wzrk_id.split("_")[0],"_").concat(Date.now());t.id=i,n[i]=t,e.unviewedMessages[i]=t,e.unviewedCounter++})),this.buildUIForMessages(n),this.updateUnviewedBadgeCounter())}}]),n}(f(HTMLElement)),dn=function(e){e.inbox_preview?je.inbox.incomingMessagesForPreview=e.inbox_notifs:je.inbox.incomingMessages=e},pn=function(e){yn(),je.inbox=new un({logger:e}),document.body.appendChild(je.inbox)},hn=function(e){var t=Te.readFromLSorCookie(ge)||{};if(Object.keys(t).length>0&&Object.keys(t)[0].includes("_")){var n={};return n[e]=t,Te.saveToLSorCookie(ge,n),n}return t},fn=function(){var e=JSON.parse(decodeURIComponent(Te.read(U)));if(!Oe(e))return{};var t=hn(e);return t.hasOwnProperty(e)?t[e]:{}},vn=function(e){var t=JSON.parse(decodeURIComponent(Te.read(U)));if(Oe(t)){var n=l(l({},hn(t)),{},a({},t,e));Te.saveToLSorCookie(ge,n)}},gn=function(e){return new Promise((function(t,n){if("complete"===document.readyState)pn(e),t();else{var i=Te.readFromLSorCookie(ve)||{},o=function(){null===je.inbox&&pn(e),t()};window.addEventListener("load",(function(){if(document.getElementById(i.inboxSelector))o();else{var n=0;if(n<20)var r=setInterval((function(){document.getElementById(i.inboxSelector)?(o(),clearInterval(r),t()):n>=20&&(clearInterval(r),e.debug("Failed to add inbox")),n++}),500)}}))}}))},yn=function(){void 0===customElements.get("ct-web-inbox")&&(customElements.define("ct-web-inbox",un),customElements.define("ct-inbox-message",cn))},bn=function(e,t,n){var i,o,r=document.scrollingElement.scrollLeft,a=document.scrollingElement.scrollTop,s=window.innerWidth+r,l=window.innerHeight+a,c=e.rect||e.target.getBoundingClientRect(),u=c.x+r,d=c.y+a,p=c.left+r,h=c.right+r,f=c.top+a,v=c.bottom,g=c.height,y=c.width,b=!1,m=16;if(v+t<=l){var w=l-(v+t);o=w>=m?v+m:v+w}else if(f-t>=a){var k=f-t;o=k>=m?f-t-m:f-t-k}else b=!0,(o=d+g/2-t/2)l&&(o=l-t);if(b){var C=h+n;if(C<=s){i=h+(C+m<=s?m:s-C)}else{var x=p-n;i=x-(x-m>=r?m:x-r)}}else(i=u+y/2-n/2)s&&(i=h-n>=r?h-n:s-n);return{xPos:i,yPos:o}},mn=function(e){var t=Date.now(),n=Math.floor((t-e)/6e4);return n<5?"Just now":n<60?"".concat(n," minute").concat(n>1?"s":""," ago"):(n=Math.floor(n/60))<24?"".concat(n," hour").concat(n>1?"s":""," ago"):(n=Math.floor(n/24),"".concat(n," day").concat(n>1?"s":""," ago"))},wn=function(){return Object.keys(Te.readFromLSorCookie(ve)||{}).length>0},kn='\n\n\n',Cn='\n\n\n',xn=function e(t,n){var i,o=n.device,r=n.session,s=n.request,c=n.logger,u=o,d=r,p=s,h=c,f=0,v=function(n){var i=n.wzrk_id.split("_")[0],o=Ee(),r=function(e,t,n){var i=0,o=0;null!=e[t]&&(i=e[t]),i++,null!=e.tc&&(o=e.tc),n<0&&o++,e.tc=o,e[t]=i};if(Te._isLocalStorageSupported()){delete sessionStorage.WZRK_CAMP;var s={},l=St();s=3===n.display.wtarget_type&&l.hasOwnProperty("wi")?l.wi:0!==n.display.wtarget_type&&1!==n.display.wtarget_type||!l.hasOwnProperty("wp")?{}:l.wp,l.hasOwnProperty("global")&&(s.wp=l),null==n.display.wmc&&(n.display.wmc=1),null==n.display.wimc&&(n.display.wimc=1);var c=-1,f=-1,v=-1,g=-1,y=-1,b=-1,m=-1;null!=n.display.efc&&(c=parseInt(n.display.efc,10)),null!=n.display.mdc&&(f=parseInt(n.display.mdc,10)),null!=n.display.tdc&&(v=parseInt(n.display.tdc,10)),null!=n.display.tlc&&(g=parseInt(n.display.tlc,10)),null!=n.display.wmp&&(y=parseInt(n.display.wmp,10)),null!=n.display.wmc&&(b=parseInt(n.display.wmc,10)),null!=n.display.wimc&&(m=parseInt(n.display.wimc,10));var w=s[d.sessionId];if(w){var k=w[i],C=w.tc;if("dnd"===k&&!je.dismissSpamControl)return!1;if(3===n.display.wtarget_type){if(m>0&&C>=m&&c<0)return!1}else if(b>0&&C>=b&&c<0)return!1;if(f>0&&k>=f)return!1}else w={},s[d.sessionId]=w;var x=s[o];if(null!=x){var P=x[i],S=x.tc;if(y>0&&S>=y&&c<0)return!1;if(v>0&&P>=v)return!1}else x={},s[o]=x;var O=s.global;if(null!=O){var I=O[i];if(g>0&&I>=g)return!1}else O={},s.global=O}if(null!=n.display.delay&&n.display.delay>0){var _=n.display.delay;return n.display.delay=0,setTimeout(e,1e3*_,t,{device:u,session:d,request:p,logger:h}),!1}r(w,i,c),r(x,i,c),r(O,i,c);var E="wp";3===n.display.wtarget_type&&(E="wi");var A={};A[d.sessionId]=w,A[o]=x,A.global=O,Ot(a({},E,A))},g=function(){var e=u.getGuid(),t=d.getSessionCookieObject();return"&t=wc&d="+encodeURIComponent(mt(e+"|"+t.p+"|"+t.s))},y=function(e,t){var n=window.parent[e];"function"==typeof n&&(null!=t.display.kv?n(t.display.kv):n())},b=function(e,t,n,i,o){m(t),function(e,t,n,i,o){if(""!==e&&null!=e){var r,a;o?r=n:null!==n&&null!=(a=n.getElementsByClassName("jsCT_CTA"))&&1===a.length&&(r=a[0]);var s=t.display.jsFunc,l=t.display.preview;null==l&&(e+=g()),null!=r&&(r.onclick=function(){if(null!=s)return null==l&&Pt.fireRequest(e),y(s,t),void Mt("-1",0,d.sessionId);1===t.display.window?window.open(e,"_blank"):window.location=e})}}(e,t,n,0,o)},m=function(e){var t={type:"event"};t.evtName=re,t.evtData=a({},oe,e.wzrk_id),e.wzrk_pivot&&(t.evtData=l(l({},t.evtData),{},{wzrk_pivot:e.wzrk_pivot})),p.processEvent(t)},w=function(e){var t;void 0===customElements.get("ct-web-personalisation-banner")&&customElements.define("ct-web-personalisation-banner",an);var n=null!==(t=e.display.divId)&&void 0!==t?t:e.display.divSelector,i=document.createElement("ct-web-personalisation-banner");i.msgId=e.wzrk_id,i.pivotId=e.wzrk_pivot,i.divHeight=e.display.divHeight,i.details=e.display.details[0];var o=e.display.divId?document.getElementById(n):document.querySelector(n);o.innerHTML="",o.appendChild(i)},C=function(e){var t;void 0===customElements.get("ct-web-personalisation-carousel")&&customElements.define("ct-web-personalisation-carousel",sn);var n=null!==(t=e.display.divId)&&void 0!==t?t:e.display.divSelector,i=document.createElement("ct-web-personalisation-carousel");i.target=e;var o=e.display.divId?document.getElementById(n):document.querySelector(n);o.innerHTML="",o.appendChild(i)},x=function(e){var t=e.wzrk_id.split("_")[0],n=e.display;if(2!==n.wtarget_type||1!==e.msgContent.type){if(1===n.layout)return I(void 0,e);if(3===n.layout){var i="wzrkImageOnlyDiv";if(!1===v(e))return;if(je.dismissSpamControl&&null!=document.getElementById(i))document.getElementById(i).remove();if(null!=document.getElementById(i)||null!=document.getElementById("intentPreview"))return;var o=document.createElement("div");return o.id=i,document.body.appendChild(o),void 0===customElements.get("ct-web-popup-imageonly")&&customElements.define("ct-web-popup-imageonly",ln),function(e){var t=document.createElement("ct-web-popup-imageonly");t.session=d,t.target=e;var n=document.getElementById("wzrkImageOnlyDiv");n.innerHTML="",n.style.visibility="hidden",n.appendChild(t)}(e)}if(!1!==v(e)){var r="wizParDiv"+n.layout;if(je.dismissSpamControl&&null!=document.getElementById(r))document.getElementById(r).remove();if(null==document.getElementById(r)){je.campaignDivMap[t]=r;var a=2===n.layout,s=document.createElement("div");s.id=r;var l=window.innerHeight,c=window.innerWidth,u=!1;if(a)s.setAttribute("style",n.iFrameStyle);else{var p=10,h=5*c/100,f=p+5*l/100,g=30*c/100+20,y="width:30%;";(/mobile/i.test(navigator.userAgent)||/mini/i.test(navigator.userAgent))&&!1===/iPad/i.test(navigator.userAgent)?(g=85*c/100+20,h=5*c/100,f=5*l/100,y="width:80%;"):("ontouchstart"in window||/tablet/i.test(navigator.userAgent))&&(g=50*c/100+20,h=5*c/100,f=5*l/100,y="width:50%;"),null==n.proto?(u=!0,s.setAttribute("style","display:block;overflow:hidden; bottom:"+f+"px !important;width:"+g+"px !important;right:"+h+"px !important;position:fixed;z-index:2147483647;")):s.setAttribute("style",y+n.iFrameStyle)}document.body.appendChild(s);var m=document.createElement("iframe"),w=!1===n.br?"0":"8";m.frameborder="0px",m.marginheight="0px",m.marginwidth="0px",m.scrolling="no",m.id="wiz-iframe";var k,C=e.display.onClick,x="";if(""!==C&&null!=C&&(x="cursor:pointer;"),1===e.msgContent.type)k=(k=(k=e.msgContent.html).replace(/##campaignId##/g,t)).replace(/##campaignId_batchId##/g,e.wzrk_id);else{var S,O,_,E,A,L='";"dark"===e.display.theme?(S="#2d2d2e",O="#eaeaea",_="#353535",E="#353535",A="#ffffff"):(S="#ffffff",O="#000000",E="#f4f4f4",_="#a5a6a6",A="#ffffff");var R=e.msgContent.title,M=e.msgContent.description,T="";null!=e.msgContent.imageUrl&&""!==e.msgContent.imageUrl&&(T=""),k=L+("
×
"+T+"
"+R+"
")+("
"+M+"
")}m.setAttribute("style","z-index: 2147483647; display:block; width: 100% !important; border:0px !important; border-color:none !important;"),s.appendChild(m);var j=(m.contentWindow?m.contentWindow:m.contentDocument.document?m.contentDocument.document:m.contentDocument).document,D=new Event("CT_campaign_rendered");document.dispatchEvent(D),j.open(),j.write(k),n["custom-editor"]&&P(e,j),j.close();var z=function(){p=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv").scrollHeight,!0===n["custom-editor"]||a||(p+=25),document.getElementById("wiz-iframe").contentDocument.body.style.margin="0px",document.getElementById("wiz-iframe").style.height=p+"px"},B=navigator.userAgent.toLowerCase();if(-1!==B.indexOf("safari"))if(B.indexOf("chrome")>-1)m.onload=function(){z();var t=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv");b(C,e,t,0,u)};else{var N=m.contentDocument||m.contentWindow;N.document&&(N=N.document),z();var F=setInterval((function(){if("complete"===N.readyState){clearInterval(F),z();var t=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv");b(C,e,t,0,u)}}),10)}else m.onload=function(){z();var t=document.getElementById("wiz-iframe").contentDocument.getElementById("contentDiv");b(C,e,t,0,u)}}}}else{var U={};U.msgId=e.wzrk_id,e.wzrk_pivot&&(U.pivotId=e.wzrk_pivot),null!=e.msgContent.kv&&(U.kv=e.msgContent.kv);var q=new CustomEvent("CT_web_native_display",{detail:U});document.dispatchEvent(q)}},P=function(e,t){var n=t.createElement("script");n.innerHTML="\n const ct__camapignId = '".concat(e.wzrk_id,"';\n const ct__formatVal = (v) => {\n return v && v.trim().substring(0, 20);\n }\n const ct__parentOrigin = window.parent.origin;\n document.body.addEventListener('click', (event) => {\n const elem = event.target.closest?.('a[wzrk_c2a], button[wzrk_c2a]');\n if (elem) {\n const {innerText, id, name, value, href} = elem;\n const clickAttr = elem.getAttribute('onclick') || elem.getAttribute('click');\n const onclickURL = clickAttr?.match(/(window.open)[(](\"|')(.*)(\"|',)/)?.[3] || clickAttr?.match(/(location.href *= *)(\"|')(.*)(\"|')/)?.[3];\n const props = {innerText, id, name, value};\n let msgCTkv = Object.keys(props).reduce((acc, c) => {\n const formattedVal = ct__formatVal(props[c]);\n formattedVal && (acc['wzrk_click_' + c] = formattedVal);\n return acc;\n }, {});\n if(onclickURL) { msgCTkv['wzrk_click_' + 'url'] = onclickURL; }\n if(href) { msgCTkv['wzrk_click_' + 'c2a'] = href; }\n const notifData = { msgId: ct__camapignId, msgCTkv, pivotId: '").concat(e.wzrk_pivot,"' };\n window.parent.clevertap.renderNotificationClicked(notifData);\n }\n });\n "),t.body.appendChild(n)},S=!1,O=function(e){var t=e.display.onClick;if(window.clevertap.hasOwnProperty("notificationCallback")&&void 0!==window.clevertap.notificationCallback&&"function"==typeof window.clevertap.notificationCallback){var n=window.clevertap.notificationCallback;if(!S){var i={};i.msgContent=e.msgContent,i.msgId=e.wzrk_id,e.wzrk_pivot&&(i.pivotId=e.wzrk_pivot),null!=e.display.kv&&(i.kv=e.display.kv),window.clevertap.raiseNotificationClicked=function(){if(""!==t&&null!=t){var n=e.display.jsFunc;if(t+=g(),null!=n)return Pt.fireRequest(t),void y(n,e);1===e.display.window?window.open(t,"_blank"):window.location=t}},window.clevertap.raiseNotificationViewed=function(){m(e)},n(i),S=!0}}else if(window.clevertap.popupCurrentWzrkId=e.wzrk_id,x(e),window.clevertap.hasOwnProperty("popupCallbacks")&&void 0!==window.clevertap.popupCallbacks&&"function"==typeof window.clevertap.popupCallbacks[e.wzrk_id]){var o=window.clevertap.popupCallbacks[e.wzrk_id],r={};r.msgContent=e.msgContent,r.msgId=e.wzrk_id,e.wzrk_pivot&&(r.pivotId=e.wzrk_pivot);var s=[];for(var c in e)if(c.startsWith(ie)&&c!==oe){var u=a({},c,e[c]);s.push(u)}s.length>0&&(r.msgCTkv=s),null!=e.display.kv&&(r.kv=e.display.kv),window.clevertap.raisePopupNotificationClicked=function(t){if(t&&t.msgId){var n={type:"event"};if(n.evtName=ae,n.evtData=a({},oe,t.msgId),e.wzrk_pivot&&(n.evtData=l(l({},n.evtData),{},{wzrk_pivot:t.pivotId})),t.msgCTkv){var i,o=k(t.msgCTkv);try{for(o.s();!(i=o.n()).done;){var r=i.value;n.evtData=l(l({},n.evtData),r)}}catch(e){o.e(e)}finally{o.f()}}p.processEvent(n)}},o(r)}},I=function(e,t){var n;if(!(null!=e&&e.clientY>0)){if(n=null==t?i:t,je.dismissSpamControl&&0===n.display.wtarget_type&&null!=document.getElementById("intentPreview")&&null!=document.getElementById("intentOpacityDiv"))document.getElementById("intentPreview").remove(),document.getElementById("intentOpacityDiv").remove();if(null==document.getElementById("intentPreview")&&null==document.getElementById("wzrkImageOnlyDiv")&&(null!=n.display.layout||!(/mobile/i.test(navigator.userAgent)||/mini/i.test(navigator.userAgent)||/iPad/i.test(navigator.userAgent)||"ontouchstart"in window||/tablet/i.test(navigator.userAgent)))&&!1!==v(n)){var o=n.wzrk_id.split("_")[0];je.campaignDivMap[o]="intentPreview";var r=!1,a=document.createElement("div");a.id="intentOpacityDiv";var s=n.display.opacity||.7,l="rgba(0,0,0,".concat(s,")");a.setAttribute("style","position: fixed;top: 0;bottom: 0;left: 0;width: 100%;height: 100%;z-index: 2147483646;background: ".concat(l,";")),document.body.appendChild(a);var c=document.createElement("div");c.id="intentPreview",null==n.display.proto?(r=!0,c.setAttribute("style","display:block;overflow:hidden;top:55% !important;left:50% !important;position:fixed;z-index:2147483647;width:600px !important;height:600px !important;margin:-300px 0 0 -300px !important;")):c.setAttribute("style",n.display.iFrameStyle),document.body.appendChild(c);var u=document.createElement("iframe"),d=!1===n.display.br?"0":"8";u.frameborder="0px",u.marginheight="0px",u.marginwidth="0px",u.scrolling="no",u.id="wiz-iframe-intent";var p,h=n.display.onClick,f="";if(""!==h&&null!=h&&(f="cursor:pointer;"),1===n.msgContent.type)p=(p=(p=n.msgContent.html).replace(/##campaignId##/g,o)).replace(/##campaignId_batchId##/g,n.wzrk_id);else{var g,y,m,w,k='";"dark"===n.display.theme?(g="#2d2d2e",y="#eaeaea",m="#353535",w="#ffffff"):(g="#ffffff",y="#000000",m="#a5a6a6",w="#ffffff");var C=n.msgContent.title,x=n.msgContent.description,S="";null!=n.msgContent.ctaText&&""!==n.msgContent.ctaText&&(S="");var O="";null!=n.msgContent.imageUrl&&""!==n.msgContent.imageUrl&&(O="
+C+
"),p=k+("
×
"+C+"
")+("
"+x+"
"+O+S+"
")}u.setAttribute("style","z-index: 2147483647; display:block; height: 100% !important; width: 100% !important;min-height:80px !important;border:0px !important; border-color:none !important;"),c.appendChild(u);var I=(u.contentWindow?u.contentWindow:u.contentDocument.document?u.contentDocument.document:u.contentDocument).document,_=new Event("CT_campaign_rendered");document.dispatchEvent(_),I.open(),I.write(p),n.display["custom-editor"]&&P(n,I),I.close();var E=document.getElementById("wiz-iframe-intent").contentDocument.getElementById("contentDiv");b(h,n,E,0,r)}}};if(document.body){var _=function(e){Object.keys(e).map((function(t){var n,i;e[t].display.divId?(n=e[t].display.divId,i=document.getElementById(n)):(n=e[t].display.divSelector,i=document.querySelector(n)),null!==i&&(2===e[t].msgContent.type?w(e[t]):C(e[t]),delete e[t])}))};if(null!=t.inapp_notifs){for(var E={},A=0;A1&&void 0!==arguments[1]&&arguments[1],n=Te.readFromLSorCookie(ve)||{};t?(je.inbox.inboxConfigForPreview=e,je.inbox.isPreview=!0,je.inbox&&je.inbox.init()):JSON.stringify(n)!==JSON.stringify(e)&&(Te.saveToLSorCookie(ve,e),je.inbox&&je.inbox.init())}(t.webInboxSetting),gn(h).then((function(){R()})).catch((function(e){}))):R()),t.vars)je.variableStore.mergeVariables(t.vars);else{var M=function(e,t){var n=St(),i=n[t].global;if(null!=i&&t)for(var o in e)if(e.hasOwnProperty(o)&&(delete i[e[o]],Te.read(W))){var r=JSON.parse(decodeURIComponent(Te.read(W))),a=JSON.parse(decodeURIComponent(Te.read(U)));r[a]&&r[a][t]&&r[a][t][e[o]]&&(delete r[a][t][e[o]],Te.save(W,encodeURIComponent(JSON.stringify(r))))}Ot(n)};if(Te._isLocalStorageSupported())try{if(null!=t.evpr){var T=t.evpr.events,j=t.evpr.profile,D=t.evpr.expires_in,z=Ae();Te.setMetaProp("lsTime",z),Te.setMetaProp("exTs",D),function(e){if(null!=je.globalEventsMap||(je.globalEventsMap=Te.readFromLSorCookie(K),null!=je.globalEventsMap)){for(var t in e)if(e.hasOwnProperty(t)){var n=je.globalEventsMap[t],i=e[t];null!=je.globalEventsMap[t]?null!=i[0]&&i[0]>n[0]&&(je.globalEventsMap[t]=i):je.globalEventsMap[t]=i}}else je.globalEventsMap=e}(T),Te.saveToLSorCookie(K,je.globalEventsMap),null==je.globalProfileMap?Rt(j,!0):Rt(j,!1)}null!=t.arp&&function(e){if(null!=e.skipResARP&&e.skipResARP)return console.debug("Update ARP Request rejected",e),null;var t=!0===e.isOUL;if(Te._isLocalStorageSupported())try{var n=Te.readFromLSorCookie(J);if(null==n||t){for(var i in n={},e)e.hasOwnProperty(i)&&(-1===e[i]?delete n[i]:n[i]=e[i]);Te.saveToLSorCookie(J,n)}}catch(e){console.error("Unable to parse ARP JSON: "+e)}}(t.arp),null!=t.inapp_stale&&t.inapp_stale.length>0&&M(t.inapp_stale,"wp"),null!=t.inbox_stale&&t.inbox_stale.length>0&&M(t.inbox_stale,"wi")}catch(e){h.error("Unable to persist evrp/arp: "+e)}}}else f<6&&(f++,setTimeout(e,1e3,t,{device:u,session:d,request:p,logger:h}))},Pn=x("isPersonalisationActive"),Sn=function(){function e(t){var n=t.isPersonalisationActive;i(this,e),Object.defineProperty(this,Pn,{writable:!0,value:void 0}),P(this,Pn)[Pn]=n}return r(e,[{key:"getTotalVisits",value:function(){if(P(this,Pn)[Pn]()){var e=Te.getMetaProp("sc");return null==e&&(e=1),e}}},{key:"getLastVisit",value:function(){if(P(this,Pn)[Pn]()){var e=Te.getMetaProp("ps");return null!=e?new Date(1e3*e):void 0}}}]),e}(),On=1,In=2,_n=3,En=4,An=x("logLevel"),Ln=x("log"),Rn=x("isLegacyDebug"),Mn=function(){function e(t){i(this,e),Object.defineProperty(this,Rn,{get:jn,set:void 0}),Object.defineProperty(this,Ln,{value:Tn}),Object.defineProperty(this,An,{writable:!0,value:void 0}),this.wzrkError={},P(this,An)[An]=null==t?t:In,this.wzrkError={}}return r(e,[{key:"error",value:function(e){P(this,An)[An]>=On&&P(this,Ln)[Ln]("error",e)}},{key:"info",value:function(e){P(this,An)[An]>=In&&P(this,Ln)[Ln]("log",e)}},{key:"debug",value:function(e){(P(this,An)[An]>=_n||P(this,Rn)[Rn])&&P(this,Ln)[Ln]("debug",e)}},{key:"debugPE",value:function(e){P(this,An)[An]>=En&&P(this,Ln)[Ln]("debug_pe",e)}},{key:"reportError",value:function(e,t){this.wzrkError.c=e,this.wzrkError.d=t,this.error("".concat(Je," ").concat(e,": ").concat(t))}},{key:"logLevel",get:function(){return P(this,An)[An]},set:function(e){P(this,An)[An]=e}}]),e}(),Tn=function(e,t){if(window.console)try{var n=(new Date).getTime();console[e]("CleverTap [".concat(n,"]: ").concat(t))}catch(e){}},jn=function(){return"undefined"!=typeof sessionStorage&&""===sessionStorage.WZRK_D},Dn=x("logger"),zn=x("sessionId"),Bn=x("isPersonalisationActive"),Nn=function(){function e(t){var n=t.logger,o=t.isPersonalisationActive;i(this,e),Object.defineProperty(this,Dn,{writable:!0,value:void 0}),Object.defineProperty(this,zn,{writable:!0,value:void 0}),Object.defineProperty(this,Bn,{writable:!0,value:void 0}),this.cookieName=void 0,this.scookieObj=void 0,this.sessionId=Te.getMetaProp("cs"),P(this,Dn)[Dn]=n,P(this,Bn)[Bn]=o}return r(e,[{key:"getSessionCookieObject",value:function(){var e=Te.readCookie(this.cookieName),t={};if(null!=e)if(e=e.replace(z,'"'),t=JSON.parse(e),ke(t)){if(void 0!==t.t){var n=t.t;Ae()-n>1260&&(t={})}}else t={};return this.scookieObj=t,t}},{key:"setSessionCookieObject",value:function(e){var t=JSON.stringify(e);Te.createBroadCookie(this.cookieName,t,1200,gt())}},{key:"manageSession",value:function(e){if(void 0===this.sessionId||this.sessionId!==e){var t=Te.getMetaProp("cs");if(void 0===t)Te.setMetaProp("ps",e),Te.setMetaProp("cs",e),Te.setMetaProp("sc",1);else if(t!==e){Te.setMetaProp("ps",t),Te.setMetaProp("cs",e);var n=Te.getMetaProp("sc");void 0===n&&(n=0),Te.setMetaProp("sc",n+1)}this.sessionId=e}}},{key:"getTimeElapsed",value:function(){if(P(this,Bn)[Bn]()){null!=this.scookieObj&&(this.scookieObj=this.getSessionCookieObject());var e=this.scookieObj.s;if(null!=e){var t=Ae();return Math.floor(t-e)}}}},{key:"getPageCount",value:function(){if(P(this,Bn)[Bn]())return null!=this.scookieObj&&(this.scookieObj=this.getSessionCookieObject()),this.scookieObj.p}},{key:"sessionId",get:function(){return P(this,zn)[zn]},set:function(e){P(this,zn)[zn]=e}}]),e}(),Fn=0,Un=0,qn=x("logger"),Vn=x("account"),Wn=x("device"),Kn=x("session"),Gn=x("isPersonalisationActive"),Hn=x("clearCookie"),Jn=x("addToLocalEventMap"),Zn=function(){function e(t){var n=t.logger,o=t.account,r=t.device,a=t.session,s=t.isPersonalisationActive;i(this,e),Object.defineProperty(this,Jn,{value:$n}),Object.defineProperty(this,qn,{writable:!0,value:void 0}),Object.defineProperty(this,Vn,{writable:!0,value:void 0}),Object.defineProperty(this,Wn,{writable:!0,value:void 0}),Object.defineProperty(this,Kn,{writable:!0,value:void 0}),Object.defineProperty(this,Gn,{writable:!0,value:void 0}),Object.defineProperty(this,Hn,{writable:!0,value:!1}),this.processingBackup=!1,P(this,qn)[qn]=n,P(this,Vn)[Vn]=o,P(this,Wn)[Wn]=r,P(this,Kn)[Kn]=a,P(this,Gn)[Gn]=s,Pt.logger=n,Pt.device=r,Pt.account=o}var t;return r(e,[{key:"processBackupEvents",value:function(){var e=Te.readFromLSorCookie(Z);if(null!=e){for(var t in this.processingBackup=!0,e)if(e.hasOwnProperty(t)){var n=e[t];void 0===n.fired&&(P(this,qn)[qn].debug("Processing backup event : "+n.q),void 0!==n.q&&Pt.fireRequest(n.q),n.fired=!0)}Te.saveToLSorCookie(Z,e),this.processingBackup=!1}}},{key:"addSystemDataToObject",value:function(e,t){void 0===t&&(e=Ie(e,P(this,qn)[qn])),xe(P(this,qn)[qn].wzrkError)||(e.wzrk_error=P(this,qn)[qn].wzrkError,P(this,qn)[qn].wzrkError={}),e.id=P(this,Vn)[Vn].id,Oe(P(this,Wn)[Wn].gcookie)&&(e.g=P(this,Wn)[Wn].gcookie);var n=P(this,Kn)[Kn].getSessionCookieObject();e.s=n.s,e.pg=void 0===n.p?1:n.p;var i=document.location.protocol;return i=i.replace(":",""),e.af=l({lib:"web-sdk-v1.7.0",protocol:i},je.flutterVersion),sessionStorage.hasOwnProperty("WZRK_D")&&(e.debug=!0),e}},{key:"addFlags",value:function(e){if(P(this,Hn)[Hn]=Te.getAndClearMetaProp(B),void 0!==P(this,Hn)[Hn]&&P(this,Hn)[Hn]&&(e.rc=!0,P(this,qn)[qn].debug("reset cookie sent in request and cleared from meta for future requests.")),P(this,Gn)[Gn]()){var t=Te.getMetaProp("lsTime"),n=Te.getMetaProp("exTs");if(void 0===t||void 0===n)return void(e.dsync=!0);t+n0?je.privacyArray:t):(i=je.privacyArray).push.apply(i,t);return 0}},{key:"_processOldValues",value:function(){P(this,Xn)[Xn]&&P(this,ti)[ti](P(this,Xn)[Xn]),P(this,Xn)[Xn]=null}}]),n}(f(Array)),ii=function(e){if(Array.isArray(e)&&e.length>0){var t=e.reduce((function(e,t){return l(l({},e),t)}),{}),n={},i={},o=!1;if(t.hasOwnProperty(Y)&&"boolean"==typeof(o=t.optOut)&&(i.ct_optout=o,je.isOptInRequest=!o),t.hasOwnProperty(Q)){var r=t.useIP,a="boolean"==typeof r&&r;Te.setMetaProp(Q,a)}if(!xe(i)){n.type="profile",n.profile=i,n=P(this,Yn)[Yn].addSystemDataToObject(n,void 0);var s=yt(JSON.stringify(n),P(this,ei)[ei]),c=P(this,Qn)[Qn].dataPostURL;c=vt(c,"type",ee),c=vt(c,"d",s),c=vt(c,Y,o?"true":"false"),P(this,Yn)[Yn].saveAndFireRequest(c,je.blockRequest),e.splice(0,e.length)}}},oi=x("oldValues"),ri=x("logger"),ai=x("request"),si=x("account"),li=x("wizAlertJSPath"),ci=x("fcmPublicKey"),ui=x("setUpWebPush"),di=x("setUpWebPushNotifications"),pi=x("setApplicationServerKey"),hi=x("setUpSafariNotifications"),fi=x("setUpChromeFirefoxNotifications"),vi=x("addWizAlertJS"),gi=x("removeWizAlertJS"),yi=x("handleNotificationRegistration"),bi=function(e){c(n,e);var t=y(n);function n(e,o){var r,a=e.logger;e.session;var s=e.request,l=e.account;return i(this,n),r=t.call(this),Object.defineProperty(v(r),yi,{value:Oi}),Object.defineProperty(v(r),gi,{value:Si}),Object.defineProperty(v(r),vi,{value:Pi}),Object.defineProperty(v(r),fi,{value:xi}),Object.defineProperty(v(r),hi,{value:Ci}),Object.defineProperty(v(r),pi,{value:ki}),Object.defineProperty(v(r),di,{value:wi}),Object.defineProperty(v(r),ui,{value:mi}),Object.defineProperty(v(r),oi,{writable:!0,value:void 0}),Object.defineProperty(v(r),ri,{writable:!0,value:void 0}),Object.defineProperty(v(r),ai,{writable:!0,value:void 0}),Object.defineProperty(v(r),si,{writable:!0,value:void 0}),Object.defineProperty(v(r),li,{writable:!0,value:void 0}),Object.defineProperty(v(r),ci,{writable:!0,value:void 0}),P(v(r),li)[li]="https://d2r1yp2w7bby2u.cloudfront.net/js/wzrk_dialog.min.js",P(v(r),ci)[ci]=null,P(v(r),oi)[oi]=o,P(v(r),ri)[ri]=a,P(v(r),ai)[ai]=s,P(v(r),si)[si]=l,r}return r(n,[{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0?P(this,yi)[yi](e):null==je.webPushEnabled&&e.length>0?(je.notifApi.notifEnabledFromApi=!0,je.notifApi.displayArgs=e.slice()):!1===je.webPushEnabled&&e.length>0&&P(this,ri)[ri].error("Make sure push notifications are fully enabled and integrated")},wi=function(e,t,n,i){-1!==navigator.userAgent.indexOf("Chrome")||-1!==navigator.userAgent.indexOf("Firefox")?P(this,fi)[fi](e,t):-1!==navigator.userAgent.indexOf("Safari")&&P(this,hi)[hi](e,n,i)},ki=function(e){P(this,ci)[ci]=e},Ci=function(e,t,n){var i=this;void 0===t&&P(this,ri)[ri].error("Ensure that APNS Web Push ID is supplied"),void 0===n&&P(this,ri)[ri].error("Ensure that APNS Web Push service path is supplied"),"safari"in window&&"pushNotification"in window.safari&&window.safari.pushNotification.requestPermission(n,t,{},(function(e){if("granted"===e.permission){var t=JSON.parse(JSON.stringify(e));t.endpoint=e.deviceToken,t.browser="Safari",Te.saveToLSorCookie(le,t),P(i,ai)[ai].registerToken(t),P(i,ri)[ri].info("Safari Web Push registered. Device Token: "+e.deviceToken)}else"denied"===e.permission&&P(i,ri)[ri].info("Error subscribing to Safari web push")}))},xi=function(e,t){var n=this,i="";"serviceWorker"in navigator&&navigator.serviceWorker.register(t).then((function(e){if("undefined"!=typeof __wzrk_account_id)return new Promise((function(t){return setTimeout((function(){return t(e)}),5e3)}));i=e.scope;return/^(\.?)(\/?)([^/]*).js$/.test(t)?navigator.serviceWorker.ready:-1!==navigator.userAgent.indexOf("Chrome")?new Promise((function(t){return setTimeout((function(){return t(e)}),5e3)})):navigator.serviceWorker.getRegistrations()})).then((function(t){-1!==navigator.userAgent.indexOf("Firefox")&&Array.isArray(t)&&(t=t.filter((function(e){return e.scope===i}))[0]);var o={userVisibleOnly:!0};null!=P(n,ci)[ci]&&(o.applicationServerKey=function(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(t),i=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),Object.defineProperty(this,ro,{value:ho}),Object.defineProperty(this,oo,{value:po}),Object.defineProperty(this,io,{value:uo}),Object.defineProperty(this,no,{value:co}),Object.defineProperty(this,to,{value:lo}),Object.defineProperty(this,eo,{value:so}),Object.defineProperty(this,qi,{writable:!0,value:void 0}),Object.defineProperty(this,Vi,{writable:!0,value:void 0}),Object.defineProperty(this,Wi,{writable:!0,value:void 0}),Object.defineProperty(this,Ki,{writable:!0,value:void 0}),Object.defineProperty(this,Gi,{writable:!0,value:void 0}),Object.defineProperty(this,Hi,{writable:!0,value:void 0}),Object.defineProperty(this,Ji,{writable:!0,value:void 0}),Object.defineProperty(this,Zi,{writable:!0,value:void 0}),Object.defineProperty(this,$i,{writable:!0,value:void 0}),Object.defineProperty(this,Yi,{writable:!0,value:void 0}),Object.defineProperty(this,Qi,{writable:!0,value:P(this,no)[no].bind(this)}),Object.defineProperty(this,Xi,{writable:!0,value:void 0}),this.enablePersonalization=void 0,this.popupCallbacks={},this.popupCurrentWzrkId="",P(this,Wi)[Wi]=0,this._isPersonalisationActive=this._isPersonalisationActive.bind(this),this.raiseNotificationClicked=function(){},P(this,qi)[qi]=new Mn(In),P(this,Hi)[Hi]=new T(null===(t=u.account)||void 0===t?void 0:t[0],u.region||(null===(n=u.account)||void 0===n?void 0:n[1]),u.targetDomain||(null===(o=u.account)||void 0===o?void 0:o[2]),u.token||(null===(r=u.account)||void 0===r?void 0:r[3])),P(this,Ki)[Ki]=new Ge({logger:P(this,qi)[qi]}),P(this,Xi)[Xi]=u.dismissSpamControl||!1,P(this,Gi)[Gi]=new Nn({logger:P(this,qi)[qi],isPersonalisationActive:this._isPersonalisationActive}),P(this,Ji)[Ji]=new Zn({logger:P(this,qi)[qi],account:P(this,Hi)[Hi],device:P(this,Ki)[Ki],session:P(this,Gi)[Gi],isPersonalisationActive:this._isPersonalisationActive}),this.enablePersonalization=u.enablePersonalization||!1,this.event=new pt({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],isPersonalisationActive:this._isPersonalisationActive},u.event),this.profile=new qt({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],isPersonalisationActive:this._isPersonalisationActive},u.profile),this.onUserLogin=new en({request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],session:P(this,Gi)[Gi],logger:P(this,qi)[qi],device:P(this,Ki)[Ki]},u.onUserLogin),this.privacy=new ni({request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],logger:P(this,qi)[qi]},u.privacy),this.notifications=new bi({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],account:P(this,Hi)[Hi]},u.notifications),P(this,Zi)[Zi]=new Fi({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],account:P(this,Hi)[Hi],event:this.event}),P(this,Vi)[Vi]=new We({logger:P(this,qi)[qi],request:P(this,Ji)[Ji],device:P(this,Ki)[Ki],session:P(this,Gi)[Gi]}),this.spa=u.spa,this.dismissSpamControl=u.dismissSpamControl,this.user=new Sn({isPersonalisationActive:this._isPersonalisationActive}),this.session={getTimeElapsed:function(){return P(c,Gi)[Gi].getTimeElapsed()},getPageCount:function(){return P(c,Gi)[Gi].getPageCount()}},this.logout=function(){P(c,qi)[qi].debug("logout called"),Te.setInstantDeleteFlagInK()},this.clear=function(){c.onUserLogin.clear()},this.getCleverTapID=function(){return P(c,Ki)[Ki].getGuid()},this.getAccountID=function(){return P(c,Hi)[Hi].id},this.getSCDomain=function(){return P(c,Hi)[Hi].finalTargetDomain},this.setLibrary=function(e,t){je.flutterVersion=a({},e,t)},this.setSCSDKVersion=function(e){P(c,Hi)[Hi].scSDKVersion=e;var t={};t.af={scv:"sc-sdk-v"+P(c,Hi)[Hi].scSDKVersion};var n=P(c,Hi)[Hi].dataPostURL;n=vt(n,"type","page"),n=vt(n,"d",yt(JSON.stringify(t),P(c,qi)[qi])),P(c,Ji)[Ji].saveAndFireRequest(n,je.blockRequest)},wn()&&(yn(),gn(P(this,qi)[qi])),this.getInboxMessageCount=function(){var e=fn();return Object.keys(e).length},this.getInboxMessageUnreadCount=function(){if(je.inbox)return je.inbox.unviewedCounter;P(c,qi)[qi].debug("No unread messages")},this.getAllInboxMessages=function(){return fn()},this.getUnreadInboxMessages=function(){if(je.inbox)return je.inbox.unviewedMessages;P(c,qi)[qi].debug("No unread messages")},this.getInboxMessageForId=function(e){var t=fn();if((null!==e||""!==e)&&t.hasOwnProperty(e))return t[e];P(c,qi)[qi].error("No message available for message Id "+e)},this.deleteInboxMessage=function(e){var t=fn();if(null===e&&""===e||!t.hasOwnProperty(e))P(c,qi)[qi].error("No message available for message Id "+e);else{var n=document.querySelector("ct-web-inbox").shadowRoot.getElementById(e);0===t[e].viewed&&(je.inbox.unviewedCounter--,delete je.inbox.unviewedMessages[e],document.getElementById("unviewedBadge").innerText=je.inbox.unviewedCounter,document.getElementById("unviewedBadge").style.display=je.inbox.unviewedCounter>0?"flex":"none"),n&&n.remove(),delete t[e],vn(t)}},this.markReadInboxMessage=function(e){var t=je.inbox.unviewedMessages,n=fn();if(null===e&&""===e||!t.hasOwnProperty(e))P(c,qi)[qi].error("No message available for message Id "+e);else{var i=document.querySelector("ct-web-inbox").shadowRoot.getElementById(e);if(null!==i&&(i.shadowRoot.getElementById("unreadMarker").style.display="none"),n[e].viewed=1,document.getElementById("unviewedBadge")){var o=parseInt(document.getElementById("unviewedBadge").innerText)-1;document.getElementById("unviewedBadge").innerText=o,document.getElementById("unviewedBadge").style.display=o>0?"flex":"none"}window.clevertap.renderNotificationViewed({msgId:n[e].wzrk_id,pivotId:n[e].pivotId}),je.inbox.unviewedCounter--,delete je.inbox.unviewedMessages[e],vn(n)}},this.markReadInboxMessagesForIds=function(e){if(Array.isArray(e))for(var t=0;t0?(Object.keys(e).forEach((function(e){var n=document.querySelector("ct-web-inbox").shadowRoot.getElementById(e);null!==n&&(n.shadowRoot.getElementById("unreadMarker").style.display="none"),t[e].viewed=1,window.clevertap.renderNotificationViewed({msgId:t[e].wzrk_id,pivotId:t[e].wzrk_pivot})})),document.getElementById("unviewedBadge").innerText=0,document.getElementById("unviewedBadge").style.display="none",vn(t),je.inbox.unviewedCounter=0,je.inbox.unviewedMessages={}):P(c,qi)[qi].debug("All messages are already read")},this.toggleInbox=function(e){var t;return null===(t=je.inbox)||void 0===t?void 0:t.toggleInbox(e)},this.renderNotificationViewed=function(e){d(re,e)},this.renderNotificationClicked=function(e){d(ae,e)};var d=function(e,t){if(t&&t.msgId){var n={type:"event"};if(n.evtName=e,n.evtData=a({},oe,t.msgId),t.pivotId&&(n.evtData=l(l({},n.evtData),{},{wzrk_pivot:t.pivotId})),t.wzrk_slideNo&&(n.evtData=l(l({},n.evtData),{},{wzrk_slideNo:t.wzrk_slideNo})),t.kv&&null!==t.kv&&void 0!==t.kv)for(var i in t.kv)i.startsWith(ie)&&(n.evtData=l(l({},n.evtData),{},a({},i,t.kv[i])));if(t.msgCTkv&&null!==t.msgCTkv&&void 0!==t.msgCTkv)for(var o in t.msgCTkv)o.startsWith(ie)&&(n.evtData=l(l({},n.evtData),{},a({},o,t.msgCTkv[o])));P(c,Ji)[Ji].processEvent(n)}};this.setLogLevel=function(e){P(c,qi)[qi].logLevel=Number(e),3===e?sessionStorage.WZRK_D="":delete sessionStorage.WZRK_D},this.handleIncrementValue=function(e,t){c.profile._handleIncrementDecrementValue(e,t,ce)},this.handleDecrementValue=function(e,t){c.profile._handleIncrementDecrementValue(e,t,ue)},this.setMultiValuesForKey=function(e,t){Array.isArray(t)?c.profile._handleMultiValueSet(e,t,de):console.error("setMultiValuesForKey should be called with a value of type array")},this.addMultiValueForKey=function(e,t){"string"==typeof t||"number"==typeof t?c.profile._handleMultiValueAdd(e,t,pe):console.error("addMultiValueForKey should be called with a value of type string or number.")},this.addMultiValuesForKey=function(e,t){Array.isArray(t)?c.profile._handleMultiValueAdd(e,t,pe):console.error("addMultiValuesForKey should be called with a value of type array.")},this.removeMultiValueForKey=function(e,t){"string"==typeof t||"number"==typeof t?c.profile._handleMultiValueRemove(e,t,he):console.error("removeMultiValueForKey should be called with a value of type string or number.")},this.removeMultiValuesForKey=function(e,t){Array.isArray(t)?c.profile._handleMultiValueRemove(e,t,he):console.error("removeMultiValuesForKey should be called with a value of type array.")},this.removeValueForKey=function(e){c.profile._handleMultiValueDelete(e,fe)};var p=function(e,t,n){jt(e,t,n,P(c,Hi)[Hi],P(c,qi)[qi])};function h(e){var t=e.coords.latitude,n=e.coords.longitude;je.location={Latitude:t,Longitude:n},this.sendLocationData({Latitude:t,Longitude:n})}function f(e){switch(e.code){case e.PERMISSION_DENIED:console.log("User denied the request for Geolocation.");break;case e.POSITION_UNAVAILABLE:console.log("Location information is unavailable.");break;case e.TIMEOUT:console.log("The request to get user location timed out.");break;case e.UNKNOWN_ERROR:console.log("An unknown error occurred.")}}this.getLocation=function(e,t){if(e&&"number"!=typeof e||t&&"number"!=typeof t)console.log("Latitude and Longitude must be of number type");else if(e&&t){if(e<=-90||e>90)return void console.log("A vaid latitude must range between -90 and 90");if(t<=-180||t>180)return void console.log("A valid longitude must range between -180 and 180");je.location={Latitude:e,Longitude:t},this.sendLocationData({Latitude:e,Longitude:t})}else navigator.geolocation?navigator.geolocation.getCurrentPosition(h.bind(this),f):console.log("Geolocation is not supported by this browser.")};var v=P(this,Vi)[Vi];v.logout=this.logout,v.clear=this.clear,v.closeIframe=function(e,t){Mt(e,0,P(c,Gi)[Gi].sessionId)},v.enableWebPush=function(e,t){c.notifications._enableWebPush(e,t)},v.tr=function(e){xn(e,{device:P(c,Ki)[Ki],session:P(c,Gi)[Gi],request:P(c,Ji)[Ji],logger:P(c,qi)[qi]})},v.setEnum=function(e){Tt(e,P(c,qi)[qi])},v.is_onloadcalled=function(){return 1===P(c,Wi)[Wi]},v.subEmail=function(e){p("1",e)},v.getEmail=function(e,t){p("-1",e,t)},v.unSubEmail=function(e){p("0",e)},v.unsubEmailGroups=function(e){je.unsubGroups=[];for(var t=document.getElementsByClassName("ct-unsub-group-input-item"),n=0;n0&&this.privacy.push(je.privacyArray),P(this,eo)[eo](),this.pageChanged();var s=setInterval((function(){P(o,Ki)[Ki].gcookie&&(clearInterval(s),P(o,Ji)[Ji].processBackupEvents())}),3e3);P(this,$i)[$i]?document.addEventListener("click",P(this,Qi)[Qi]):document.removeEventListener("click",P(this,Qi)[Qi]),P(this,Wi)[Wi]=1}}}},{key:"pageChanged",value:function(){var e=this,t=window.location.href,n=ft(t.toLowerCase()),i=P(this,Gi)[Gi].getSessionCookieObject(),o=void 0===i.p?0:i.p;i.p=++o,P(this,Gi)[Gi].setSessionCookieObject(i);var r={},a=function(e){if(""===e)return"";var t=document.createElement("a");return t.href=e,t.hostname}(document.referrer);if(window.location.hostname!==a){var s=120;""!==a&&(a=a.length>s?a.substring(0,s):a,r.referrer=a);var l=n.utm_source||n.wzrk_source;void 0!==l&&(l=l.length>s?l.substring(0,s):l,r.us=l);var c=n.utm_medium||n.wzrk_medium;void 0!==c&&(c=c.length>s?c.substring(0,s):c,r.um=c);var u=n.utm_campaign||n.wzrk_campaign;if(void 0!==u&&(u=u.length>s?u.substring(0,s):u,r.uc=u),void 0!==n.wzrk_medium){var d=n.wzrk_medium;d.match(/^email$|^social$|^search$/)&&(r.wm=d)}}(r=P(this,Ji)[Ji].addSystemDataToObject(r,void 0)).cpg=t,r.WZRK_CAMP=_t();var p=P(this,Hi)[Hi].dataPostURL;P(this,Ji)[Ji].addFlags(r),1===parseInt(r.pg)&&P(this,ro)[ro](r),p=vt(p,"type","page"),p=vt(p,"d",yt(JSON.stringify(r),P(this,qi)[qi])),P(this,Ji)[Ji].saveAndFireRequest(p,je.blockRequest),1===parseInt(r.pg)&&this.event.push(be,{t:4}),P(this,Yi)[Yi]=t,setTimeout((function(){o<=3&&P(e,io)[io](),P(e,oo)[oo]()&&setInterval((function(){P(e,io)[io]()}),3e5)}),12e4)}},{key:"_isPersonalisationActive",value:function(){return Te._isLocalStorageSupported()&&this.enablePersonalization}},{key:"sendLocationData",value:function(e){var t={af:{}},n={};(t.type="profile",null==n.tz&&(n.tz=(new Date).toString().match(/([A-Z]+[\+-][0-9]+)/)[1]),t.profile=n,e)&&Object.keys(e).forEach((function(n){t.af[n]=e[n]}));je.location&&(t.af=l(l({},t.af),je.location)),t=P(this,Ji)[Ji].addSystemDataToObject(t,void 0),P(this,Ji)[Ji].addFlags(t);var i=yt(JSON.stringify(t),P(this,qi)[qi]),o=P(this,Hi)[Hi].dataPostURL;o=vt(o,"type",ee),o=vt(o,"d",i),P(this,Ji)[Ji].saveAndFireRequest(o,je.blockRequest)}},{key:"setOffline",value:function(e){"boolean"==typeof e?(je.offline=e,e||P(this,Ji)[Ji].processBackupEvents()):console.error("setOffline should be called with a value of type boolean")}},{key:"defineVariable",value:function(e,t){return _i.define(e,t,P(this,Zi)[Zi])}},{key:"syncVariables",value:(o=n(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(4!==P(this,qi)[qi].logLevel){e.next=4;break}return e.abrupt("return",P(this,Zi)[Zi].syncVariables(t,n));case 4:P(this,qi)[qi].error("App log level is not set to 4");case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"fetchVariables",value:(t=n(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",P(this,Zi)[Zi].fetchVariables(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"addVariablesChangedCallback",value:function(e){P(this,Zi)[Zi].addVariablesChangedCallback(e)}},{key:"addOneTimeVariablesChangedCallback",value:function(e){P(this,Zi)[Zi].addOneTimeVariablesChangedCallback(e)}},{key:"popupCallback",set:function(e){this.popupCallbacks[this.popupCurrentWzrkId]=e}}]),e}(),so=function(){this.onUserLogin._processOldValues(),this.privacy._processOldValues(),this.event._processOldValues(),this.profile._processOldValues(),this.notifications._processOldValues()},lo=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;return function(){clearTimeout(t),t=setTimeout(e,n)}},co=function(){var e=this;P(this,to)[to]((function(){P(e,Yi)[Yi]!==location.href&&e.pageChanged()}))()},uo=function(){var e=P(this,Hi)[Hi].dataPostURL,t={};t=P(this,Ji)[Ji].addSystemDataToObject(t,void 0),e=vt(e,"type","ping"),e=vt(e,"d",yt(JSON.stringify(t),P(this,qi)[qi])),P(this,Ji)[Ji].saveAndFireRequest(e,je.blockRequest)},po=function(){return void 0!==window.wzrk_d&&"continuous"===window.wzrk_d.ping},ho=function(e){this._isPersonalisationActive()&&(e.dsync=!0)},fo=new ao(window.clevertap);return window.clevertap=window.wizrocket=fo,fo})); diff --git a/package.json b/package.json index a36f5698..62ed5042 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clevertap-web-sdk", - "version": "2.0.0", + "version": "1.7.0", "description": "", "main": "clevertap.js", "scripts": {