/*! For license information please see sdk.cards.js.LICENSE.txt */ (()=>{var e={483:(e,t,n)=>{e.exports=function e(t,n,i){function a(o,s){if(!n[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}l=n[o]={exports:{}},t[o][0].call(l.exports,(function(e){return a(t[o][1][e]||e)}),l,l.exports,e,t,n,i)}return n[o].exports}for(var r=void 0,o=0;oe.db.version;return i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),(a||n)&&(!n||(n=e.db.version+1)>e.version&&(e.version=n),1)}function w(e){return r([function(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),a=0;a>4,l[s++]=(15&n)<<4|i>>2,l[s++]=(3&i)<<6|63&a;return r}function F(e){for(var t=new Uint8Array(e),n="",i=0;i>2],n+=L[(3&t[i])<<4|t[i+1]>>4],n+=L[(15&t[i+1])<<2|t[i+2]>>6],n+=L[63&t[i+2]];return t.length%3==2?n=n.substring(0,n.length-1)+"=":t.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var H={serialize:function(e,t){var n="";if(e&&(n=B.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===B.call(e.buffer))){var i,a=k;e instanceof ArrayBuffer?(i=e,a+=P):(i=e.buffer,"[object Int8Array]"===n?a+="si08":"[object Uint8Array]"===n?a+="ui08":"[object Uint8ClampedArray]"===n?a+="uic8":"[object Int16Array]"===n?a+="si16":"[object Uint16Array]"===n?a+="ur16":"[object Int32Array]"===n?a+="si32":"[object Uint32Array]"===n?a+="ui32":"[object Float32Array]"===n?a+="fl32":"[object Float64Array]"===n?a+="fl64":t(new Error("Failed to get type for BinaryArray"))),t(a+F(i))}else if("[object Blob]"===n)(n=new FileReader).onload=function(){var n="~~local_forage_type~"+e.type+"~"+F(this.result);t(k+R+n)},n.readAsArrayBuffer(e);else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,x)!==k)return JSON.parse(e);var t,n=e.substring(M),i=e.substring(x,M);i===R&&N.test(n)&&(t=(e=n.match(N))[1],n=n.substring(e[0].length));var a=U(n);switch(i){case P:return a;case R:return r([a],{type:t});case"si08":return new Int8Array(a);case"ui08":return new Uint8Array(a);case"uic8":return new Uint8ClampedArray(a);case"si16":return new Int16Array(a);case"ur16":return new Uint16Array(a);case"si32":return new Int32Array(a);case"ui32":return new Uint32Array(a);case"fl32":return new Float32Array(a);case"fl64":return new Float64Array(a);default:throw new Error("Unkown type: "+i)}},stringToBuffer:U,bufferToString:F};function W(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function $(e,t,n,i,a,r){e.executeSql(n,i,a,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?r(e,o):W(e,t,(function(){e.executeSql(n,i,a,r)}),r)}),r):r(e,o)}),r)}function G(e,t,n,i){var a=this;e=d(e);var r=new o((function(r,o){a.ready().then((function(){var s=t=void 0===t?null:t,l=a._dbInfo;l.serializer.serialize(t,(function(t,d){d?o(d):l.db.transaction((function(n){$(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){r(s)}),(function(e,t){o(t)}))}),(function(t){t.code===t.QUOTA_ERR&&(0 '__WebKitDatabaseInfoTable__'",[],(function(t,n){for(var i=[],r=0;r{let i;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:n.g):e=>(i=i||Promise.resolve()).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},967:(e,t,n)=>{e.exports=function(e,t,n){if("number"!=typeof t)throw new Error("second argument must be a Number");let a,r,o,s,l,d,c=!0;function u(e){function t(){n&&n(e,a),n=null}c?i(t):t()}function g(t,n,i){if(a[t]=i,n&&(l=!0),0==--o||n)u(n);else if(!l&&d{var i=n(570),a=n(171);(n=a).v1=i,n.v4=a,e.exports=n},327:e=>{for(var t=[],n=0;n<256;++n)t[n]=(n+256).toString(16).substr(1);e.exports=function(e,n){var i=n||0;return[(n=t)[e[i++]],n[e[i++]],n[e[i++]],n[e[i++]],"-",n[e[i++]],n[e[i++]],"-",n[e[i++]],n[e[i++]],"-",n[e[i++]],n[e[i++]],"-",n[e[i++]],n[e[i++]],n[e[i++]],n[e[i++]],n[e[i++]],n[e[+i]]].join("")}},217:e=>{var t,n,i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);i?(t=new Uint8Array(16),e.exports=function(){return i(t),t}):(n=new Array(16),e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n})},570:(e,t,n)=>{var i,a,r=n(217),o=n(327),s=0,l=0;e.exports=function(e,t,n){var d=t&&n||0,c=t||[],u=(e=e||{}).node||i,g=void 0!==e.clockseq?e.clockseq:a;null!=u&&null!=g||(p=r(),null==u&&(u=i=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==g&&(g=a=16383&(p[6]<<8|p[7])));var m=void 0!==e.msecs?e.msecs:(new Date).getTime(),p=(n=void 0!==e.nsecs?e.nsecs:l+1,m-s+(n-l)/1e4);if(p<0&&void 0===e.clockseq&&(g=g+1&16383),1e4<=(n=(p<0||s>>24&255,c[d++]=n>>>16&255,c[d++]=n>>>8&255,c[d++]=255&n,m=m/4294967296*1e4&268435455,c[d++]=m>>>8&255,c[d++]=255&m,c[d++]=m>>>24&15|16,c[d++]=m>>>16&255,c[d++]=g>>>8|128,c[d++]=255&g;for(var h=0;h<6;++h)c[d+h]=u[h];return t||o(c)}},171:(e,t,n)=>{var i=n(217),a=n(327);e.exports=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[r+s]=o[s];return t||a(o)}}},t={};function n(i){var a=t[i];return void 0!==a||(a=t[i]={exports:{}},e[i](a,a.exports,n)),a.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};(()=>{"use strict";n.r(i),n.d(i,{MoeCards:()=>Lr});const e="initData",t="browserDetails",a="unifiedLogs",r={USER_DATA:"USER_DATA",PUSH_TOKEN:"PUSH_TOKEN",SUBSCRIPTION_DETAILS:"SUBSCRIPTION_DETAILS",SETUP_TIME:"SETUP_TIME",OPT_IN_SHOWN_TIME:"OPT_IN_SHOWN_TIME",OPTED_STATUS_TRACK_TIME:"OPTED_STATUS_TRACK_TIME",SOFT_ASK_STATUS:"SOFT_ASK_STATUS",HARD_ASK_STATUS:"HARD_ASK_STATUS",WEB_SETTINGS:"WEB_SETTINGS",GRACEFUL_DATA:"GRACEFUL_DATA",Q:{PREFIX:"Q",REPORT:"REPORT",DEVICE:"DEVICE"},INIT_DATA:"INIT_DATA",OLD_SDK:{USER_DATA:"moengage_data",SUBSCRIPTION_DETAILS:"MOE_PUSH_ENDPOINT",PUSH_TOKEN:"MOE_PUSH_TOKEN"},BROWSER_DETAILS:"browserDetails",SESSION:"SESSION",DEVICE_DATA:"DEVICE_DATA",IDENTITY_MAP:"IDENTITY_MAP",SDK_VERSION:"SDK_VERSION",SDK_DISABLED:"SDK_DISABLED"},o=2,s="COOKIE_SHARING",l="MOE_WEB_UNSUBSCRIBED",d="MOE_WEB_OPTIN_BANNER_LOAD",c="MOE_WEB_OPTIN_CLOSED",u="MOE_WEB_OPTIN_ACCEPTED",g="MOE_OPT_IN_SHOWN",m="MOE_OPT_IN_ALLOWED",p="MOE_OPT_IN_DISMISSED",h="MOE_OPT_IN_BLOCKED",f="MOE_OPT_IN_ATTEMPT",v="MOE_LOGOUT",y="EVENT_ACTION_DEVICE_ATTRIBUTE",b="MOE_PUSH_PERMISSION_STATE_ALLOWED",E="MOE_PUSH_PERMISSION_STATE_BLOCKED",S="MOE_PAGE_EXIT",_="MOE_PAGE_SCROLL",I="MOE_PAGE_URL_EVENT",T="USER_ATTRIBUTE_UNIQUE_ID",w="USER_ATTRIBUTE_USER_EMAIL",A="USER_ATTRIBUTE_USER_NAME",C="USER_ATTRIBUTE_USER_FIRST_NAME",D="USER_ATTRIBUTE_USER_LAST_NAME",O="USER_ATTRIBUTE_USER_MOBILE",L="USER_ATTRIBUTE_USER_GENDER",N="USER_ATTRIBUTE_USER_BDAY",k=[T,"USER_ID_MODIFIED_FROM",w,O],x="MOE_LIFECYCLE",P={MOE_INIT:"SDK_INITIALIZED",SETTINGS_FETCHED:"SETTINGS_FETCHED",EVENT_TRACKED:"EVENT_TRACKED",DEVICE_UUID:"DEVICE_UUID",MOE_INIT_COMPLETED:"SDK_INITIALIZATION_COMPLETED",CARDS_INIT:"CARDS_INITIALIZED",SDK_DISABLED:"SDK_DISABLED",SDK_ENABLED:"SDK_ENABLED",OSM_INIT:"OSM_INITIALIZED",WEBP_INIT:"WEBP_INITIALIZED"},R={HARD_ASK_SHOWN:"HARD_ASK_SHOWN",HARD_ASK_DISMISSED:"HARD_ASK_DISMISSED",HARD_ASK_ATTEMPTED:"HARD_ASK_ATTEMPTED",HARD_ASK_ALLOWED:"HARD_ASK_ALLOWED",HARD_ASK_DENIED:"HARD_ASK_DENIED",SOFT_ASK_SHOWN:"SOFT_ASK_SHOWN",SOFT_ASK_DISMISSED:"SOFT_ASK_DISMISSED",SOFT_ASK_ALLOWED:"SOFT_ASK_ALLOWED"},M="USER_LIFECYCLE",B={USER_IDENTITY_UPDATE:"USER_IDENTITY_UPDATE",LOGOUT:"LOGOUT"},U="SPA",F={PAGE_CHANGED:"PAGE_CHANGED"},H={code:1e3,reason:"Web push not supported in current browser environment"},W={code:1001,reason:"Registering the service worker failed"},$={code:1002,reason:"Web push settings not configured"},G={code:1004,reason:"Hard ask was dismissed to many times"},K={code:1005,reason:"Service worker can not be registered on this page due to scope issues"},V="https://media.giphy.com/media/KDRv3QggAjyo/giphy.gif",j={DC_1:"sdk-01.moengage.com",DC_2:"sdk-02.moengage.com",DC_3:"sdk-03.moengage.com",DC_4:"sdk-04.moengage.com",DC_5:"sdk-05.moengage.com",DC_6:"sdk-06.moengage.com",DC_100:"sdk-100.moengage.com",EU:"sdk-02.moengage.com",IN:"sdk-03.moengage.com"},z={MOE_DASHBOARD:"https://dashboard.moengage.com",WEBSDK_DOCS:"https://developers.moengage.com/hc/en-us/articles/360060713252-Web-SDK-Integration",SELF_HANDLED_DOCS:"https://developers.moengage.com/hc/en-us/articles/360061219351-Configure-Self-Handled-Opt-In"},q="Dashboard --\x3e Settings --\x3e Channel --\x3e Push",Y="SESSION",J="batched_events",X="moe_uuid",Q={HOST_1:"https://sdk-01.moengage.com/",HOST_2:"https://sdk-02.moengage.com/",HOST_3:"https://sdk-03.moengage.com/",HOST_4:"https://sdk-04.moengage.com/",HOST_5:"https://sdk-05.moengage.com/",HOST_6:"https://sdk-06.moengage.com/",HOST_100:"https://sdk-100.moengage.com/",API:{META:"v3/campaigns/inapp/live",CAMPAIGN_PAYLOAD:"v3/campaigns/inapp/live/",DRAFT_CAMPAIGN_PAYLOAD:"v3/campaigns/inapp/test/",STATS:"v3/campaigns/inapp/live/stats",CAMPAIGNS_PAYLOAD:"v3/campaigns/inapp/live/campaigns"},DRAFT_CAMPAIGN_TPYES:{WEB_PERSONALIZATON:"web_personalization",ONSITE_MESSAGING:"onsite_messaging"},META_REFRESH_TIME:9e5,DATABASE_NAME:"moe_onsite",OSM_MODULE:"moeOnsite",DELIVERY_FUNNEL:{ATTEMPTED:{CAMPAIGN_ATTEMPTED:"ATM"},PRIORITIZED:{CAMPAIGN_PRIORITY_HIGH_PRIORITY_CAMPAIGN_AVAILABLE:"PRT_HIGH_PRT_CMP_AVL",CAMPAIGN_PRIORITY_MAX_TIMES_SHOWN:"PRT_MAX_TIM_SWN",CAMPAIGN_PRIORITY_MIN_DELAY:"PRT_MIN_DEL",CAMPAIGN_PRIORITY_GLOBAL_DELAY:"PRT_GBL_DEL",CAMPAIGN_PRIORITY_EXPIRED:"PRT_EXP"},DELIVERED:{CAMPAIGN_DELIVERED_API_FAILURE:"DLV_API_FLR",CAMPAIGN_DELIVERED_MANDATORY_PARAMS_MISSING:"DLV_MAND_PARM_MIS"},IMPRESSION:{CAMPAIGN_IMPRESSION_URL_CHANGED:"IMP_URL_CHG",CAMPAIGN_IMPRESSION_GLOBAL_DELAY:"IMP_GBL_DEL",CAMPAIGN_IMPRESSION_MAX_TIMES_SHOWN:"IMP_MAX_TIM_SHW",CAMPAIGN_IMPRESSION_ANOTHER_CAMPAIGN_VISIBLE:"IMP_ANTR_CMP_VISB",CAMPAIGN_IMPRESSION_CANCEL_BEFORE_DELAY:"IMP_CNCL_BFR_DEL"},EVALUATION:{CAMPAIGN_EVALUATION_PATH_TIME_EXPIRED:"EVL_PATH_TIME_EXP",CAMPAIGN_EVALUATION_USER_NOT_ON_APP:"EVL_USER_NOT_ON_APP"}},STORES:{CAMPAIGNS_META:{NAME:"campaigns_meta"},CAMPAIGNS_TAGS:{NAME:"campaigns_tags"},CAMPAIGNS_STATS:{NAME:"campaigns_stats"},EXIT_INTENT_CAMPAIGN_STORE:{NAME:"exit_intent"},SERVICE_META:{NAME:"service_meta",KEYS:{LAST_META_CALL_TIME:"last_meta_call_time",GLOBAL_DELAY:"global_delay_between_inapps",LAST_INAPP_SHOWN_TIME:"last_inapp_shown",LAST_FETCH_SDK_VERSION:"last_fetch_sdk_version",UNIQUE_ID:"unique_id"}},PENDING_SECONDARY_EVENTS:{NAME:"pending_secondary_events"},PENDING_TIMER_CAMPAIGNS:{NAME:"pending_timer_campaigns"},TRIGGERING_PRIMARY_EVENTS:{NAME:"triggering_primary_events"}},EVENT_NAMES:{OSM:{CLICK:"MOE_ONSITE_MESSAGE_CLICKED",IMPRESSION:"MOE_ONSITE_MESSAGE_SHOWN",DISMISS:"MOE_ONSITE_MESSAGE_DISMISSED",AUTO_DISMIS:"MOE_ONSITE_MESSAGE_AUTO_DISMISS",DELIVERED:"MOE_ONSITE_MESSAGE_DELIVERED",TYPE:"onsite"},WP:{CLICK:"MOE_WEBP_MESSAGE_CLICKED",IMPRESSION:"MOE_WEBP_MESSAGE_SHOWN",DISMISS:"MOE_WEBP_MESSAGE_DISMISSED",DELIVERED:"MOE_WEBP_MESSAGE_DELIVERED",TYPE:"webp"}},WEB_HELPER_IFRAME_URL:"https://cdn.moengage.com/webpush/beta/webpushhelper.html",IFRAME_CHANNEL:"inapp_helper",IFRAME_TOPICS:{COOKIE_STORAGE:"COOKIE_STORAGE"},COOKIE_STORAGE:{TEST_DRAFT_TYPE:"moe_inapp_draft_type",TEST_DRAFT_ID:"moe_inapp_draft_id",TEST_DRAFT_TAG:"moe_inapp_draft_tag",TEST_CAMPAIGN_META:"test_campaign_meta",TEST_TEMPLATE_TYPE:"test_template_type",TEST_VARIATION:"moe_inapp_draft_variation",TEST_LOCALE:"moe_inapp_draft_locale"},CSS_SELECTORS:{CLICK_INAPP:"moe-inapp-click",DISMISS_INAPP:"moe-inapp-close"},EXIT_INTENT:{CONFIG:{SCROLL_DOWN_THRESHOLD:50,SCROLL_UP_THRESHOLD:5,SCROLL_INTERVAL:1e3}},POSITIONED_TEMPLATE:'data-editor-type="MOE_EDITOR"',SIDE_BANNER:'data-template-type="SIDE_BANNER"',PUSH_BANNER:"moe-osm-pusher",GCG_ERROR_CODE:"E001",SCROLL_CAMPAIGN_THROTTLING_TIME:1500},Z={CARDS:{name:"CARDS",src:"https://cdn.moengage.com/release/dc_3/versions/2.56.0/moe_webSdk_cards.min.latest.js",windowLocation:"moeCards"}},ee="moe_database",te={NAME:"offline_data"},ne="v2/sdk/report/",ie=15e3,ae="number",re={TOPIC:"MOE_AUTOMATED_EVENTS",NAMES:[l,"EVENT_ACTION_WEB_SESSION_START","MOE_PAGE_VIEWED",d,c,u,"MOE_USER_SUBSCRIBED",f,g,m,p,h,b,E,v,Q.EVENT_NAMES.OSM.CLICK,Q.EVENT_NAMES.OSM.IMPRESSION,Q.EVENT_NAMES.OSM.DISMISS,Q.EVENT_NAMES.OSM.AUTO_DISMIS]},oe=[f],se="IOS_PERMISSION_DENIED",le="moe_push_opted",de="v1/sdk_logging/",ce="v2/device/add",ue="v2/device/token-check",ge="v2/report/add",me={TV:"tv",TABLET:"tablet",MOBILE:"mobile",WEB:"web"},pe="User is offline.",he=[{moeName:"uid",attributeName:"USER_ATTRIBUTE_UNIQUE_ID",programName:"id"},{moeName:"u_em",attributeName:"USER_ATTRIBUTE_USER_EMAIL",programName:"email"},{moeName:"u_gd",attributeName:"USER_ATTRIBUTE_USER_GENDER",programName:"gender"},{moeName:"u_bd",attributeName:"USER_ATTRIBUTE_USER_BDAY",programName:"birthday"},{moeName:"u_n",attributeName:"USER_ATTRIBUTE_USER_NAME",programName:"name"},{moeName:"u_fn",attributeName:"USER_ATTRIBUTE_USER_FIRST_NAME",programName:"first_name"},{moeName:"u_ln",attributeName:"USER_ATTRIBUTE_USER_LAST_NAME",programName:"last_name"},{moeName:"u_mb",attributeName:"USER_ATTRIBUTE_USER_MOBILE",programName:"mobile"}],fe=["Google Chrome","Mozilla Firefox","Opera","Apple Safari","Edge"],ve="identifiers",ye=["moe-card=1"],be=[r.DEVICE_DATA],Ee="moe-floating-icon-iframe",Se="moe-floating-icon",_e="moe_cards",Ie={STORE_NAME:"campaigns"},Te={STORE_NAME:"meta",LAST_FETCH_SDK_VERSION:"last_fetch_sdk_version",LAST_META_CALL_TIME:"last_meta_call_time",UNIQUE_ID:"unique_id",LAST_SYNC_CARDS:"last_sync_cards",SYNC_INTERVALS:"sync_intervals",SHOW_ALL_TAB:"show_all_tab",ACCESSIBILITY_DATA:"accessibility_data"},we="basic",Ae="v1/cards/get",Ce="v1/cards/user",De="v1/cards/user/delete",Oe="categories",Le="MOE_CARD_DELIVERED",Ne="MOE_CARD_IMPRESSION",ke="MOE_CARD_CLICKED",xe="MOE_CARD_DISMISSED",Pe="MOE_CARD_INBOX_CLICKED",Re="appOpen",Me="appInbox",Be="moe-floating-icon-iframe",Ue="moe-floating-icon",Fe="moe-inbox",He="moe-card-box",We="moe-card=1",$e="inboxOpen",Ge="inboxClosed",Ke="cardClick",Ve="moe-osm-pusher";function je(e,t,n){return null!=e&&t?(e=e[(t=Array.isArray(t)?t:t.split("."))[0]])&&1{Xe.log(e,t,n,...i)}))}static remoteLogTracking(e,t,n,i,...a){Ye.log(t,n,i,...a),this.log(e,n,i,...a)}static error(e,t,n,...i){var a;null!==(a=i[i.length-1])&&void 0!==a&&a.isCached||Ye.log("error",t,n,...i),e<=Xe.logLevel?console.error("%c "+Xe.logBrand+" %c %c error %c %c "+t+" ",Je,"","color: white; background: #cc0a0a; border-radius: 5px;","",Xe.tagLogStyle,n,...i.slice(0,-1)):Xe.cacheLog((()=>{Xe.error(e,t,n,...i,{isCached:!0})}))}static warn(e,t,n,...i){var a;null!==(a=i[i.length-1])&&void 0!==a&&a.isCached||Ye.log("warning",t,n,...i),e<=Xe.logLevel?console.warn("%c "+Xe.logBrand+" %c %c warn %c %c "+t+" ",Je,"","color: white; background: #e8ab51; border-radius: 5px;","",Xe.tagLogStyle,n,...i.slice(0,-1)):Xe.cacheLog((()=>{Xe.warn(e,t,n,...i,{isCached:!0})}))}static customLabel(e,t,n,...i){e<=Xe.logLevel?console.log("%c "+Xe.logBrand+" %c %c "+t+" %c %c "+n+" %c ",Je,"",Xe.tagLogStyle,"","color: white; background: #a400ff; border-radius: 5px;","",...i):Xe.cacheLog((()=>{Xe.customLabel(e,t,n,...i)}))}static image(e,t){e<=Xe.logLevel?console.log("%c+","font-size: 1px; padding: 20px 80px; line-height: 45px; background: url("+t+"); background-size: 160px 90px; color: transparent;"):Xe.cacheLog((()=>{Xe.image(e,t)}))}static releaseAllLogs(){var e=ze.get(a),t=e.length;const n=e;if(ze.set(a,[]),0{if(e){var t=e.indexOf("?");if(t<0)return{};const n=(e=e.slice(t+1)).replace("?","").split("&"),i={};return n.forEach((e=>{e=(t=e.split("="))[0];var t=decodeURIComponent(t[1]||"");i[e]?"[object Array]"===Object.prototype.toString.call(i[e])?i[e].push(t):i[e]=[i[e],t]:i[e]=t})),JSON.parse(JSON.stringify(i))}return{}},ot=(e,t)=>{if(!t)return e;"?"!==e[e.length-1]&&(e+="?");for(const n in t)t.hasOwnProperty(n)&&null!=t[n]&&(e+=n+"="+encodeURIComponent(t[n])+"&");return"&"===e[e.length-1]?e.slice(0,-1):e};class st{static getListeners(){return this.listeners}static getTopicListeners(e){return je(st.topicListeners,e,[])}static addListener(e){st.listeners.push(e)}static addTopicListener(e,t){st.topicListeners[e]=st.getTopicListeners(e),st.topicListeners[e].push(t)}static broadcast(e){st.listeners.map((t=>{t(e)})),je(st.topicListeners,e.topic,[]).map((t=>{t(e)}))}static broadcastToWindow(e,t=!1){window&&(t||bn())&&window.dispatchEvent(new CustomEvent(e.topic,{detail:{name:e.name,data:e.data||null}}))}static deprecatedSdkCallback(e){window.dispatchEvent(new CustomEvent("MOE_OPT_IN",{detail:e}))}static resetAllListeners(){st.listeners=[],st.topicListeners={}}static resetListeners(){st.listeners=[]}}st.listeners=[],st.topicListeners={};const lt=st;function dt(e,t){return!vt.get().disableWebPush&&e.isWebPushEnabled&&0<=fe.indexOf(t.name)&&navigator.serviceWorker&&"PushManager"in window&&"Notification"in window}function ct(e,t){var n,i,a;return t.isChrome()||t.isOpera()||t.isEdge()||t.isSafari()?"vapid"===(null===(n=null==e?void 0:e.chrome)||void 0===n?void 0:n.subscriptionMode)&&null!==(i=null==e?void 0:e.chrome)&&void 0!==i&&i.vapidPublicKey:t.isFirefox()&&"vapid"===(null===(t=null==e?void 0:e.firefox)||void 0===t?void 0:t.subscriptionMode)&&null!==(a=null==e?void 0:e.firefox)&&void 0!==a&&a.vapidPublicKey}function ut(){var e;const t=null===(e=vt.get())||void 0===e?void 0:e.swPath;return!(!t||!t.includes("tools/moengage"))}function gt(e,t){return!(e!==w&&e!==O&&!t.includes(e))}function mt(e,t){var n;return t.isChrome()||t.isOpera()||t.isEdge()||t.isSafari()?(null===(n=null==e?void 0:e.chrome)||void 0===n?void 0:n.vapidPublicKey)||"":t.isFirefox()&&(null===(e=null==e?void 0:e.firefox)||void 0===e?void 0:e.vapidPublicKey)||""}class pt{constructor(){this.items=[]}static enqueue(e,t){e=pt.getLocalStorageQName(e);let n=new pt;ft.get(e)&&(n=ft.get(e)),n.items.push(t),n.items=n.items.slice(Math.max(n.items.length-50,0)),ft.set(e,n)}static dequeue(e){e=pt.getLocalStorageQName(e);const t=ft.get(e);let n=null;return t&&0!(!k.includes(t.key)&&!gt(t.key,e))))}e===r.SUBSCRIPTION_DETAILS&&(i.domain=t.domain,i.token=t.token,i.endpoint=t.endpoint,i.keys=t.keys),yt.set(e,i)}}static get(e){return ft.baseLogTag,e=ft.prefix+e,localStorage?je(ft.getMoeData(),e,null):null}static remove(e){var t=ft.baseLogTag+".remove",n=ft.prefix+e;if(localStorage&&null!=ft.get(e)){const i=ft.getMoeData();delete i[n],localStorage.setItem(ht,JSON.stringify(i)),Xe.log(2,t,"Key",e,"removed.")}ft.isSharedWithCookie&&0<=ft.KEYS_SHARED_WITH_COOKIE.indexOf(e)&&yt.remove(e)}static logout(){const e=["INIT_DATA","Q","WEB_SETTINGS","SUBSCRIPTION_DETAILS","PUSH_TOKEN","GRACEFUL_DATA","DEVICE_DATA","SDK_VERSION","SDK_DISABLED"];for(const t in r)e.indexOf(t)<0&&ft.remove(r[t]);for(const e in r.Q)pt.purge(e)}static getString(e){if(e=ft.prefix+e,localStorage)return"string"==typeof(e=ft.get(e))||e instanceof String?e:JSON.stringify(e)}static removePrefix(){ft.prefix=""}static copyKeysFromCookie(){for(let n=0;n{var n=e.findIndex((e=>e.key===t.key));0<=n?e[n]=t:e.push(t)}));const i=(null===(t=null===(t=ft.get(r.WEB_SETTINGS))||void 0===t?void 0:t.configs)||void 0===t?void 0:t.subscriberBasedBillingAttributes)||[];e=e.filter((e=>!((k.includes(e.key)||gt(e.key,i))&&n.attributes.findIndex((t=>t.key===e.key))<0))),n.attributes=e}}ft.set(e,n)}}ft.removeStaleKeysFromLS(),ft.copyIdentitiesFromCookiesToIDB()}static copyIdentitiesFromCookiesToIDB(){var e,t,n=this.baseLogTag+".copyIdentitiesFromCookiesToIDB",i=yt.get(r.IDENTITY_MAP);const a=yt.get(r.USER_DATA),o={};null!=i&&i.userIdentities&&(({userIdentities:e,previousIdentities:i,previousIdentitiesUpdatedTime:t}=i),o.userIdentities=e,o.previousIdentities=i,o.previousIdentitiesUpdatedTime=t),null!==(t=null==a?void 0:a.attributes)&&void 0!==t&&t.length&&a.attributes.find((e=>e.key===T))&&(o.moe_user_id=a.attributes.find((e=>e.key===T)).value),null!==(t=this.moeDataStore)&&void 0!==t&&t.getItem||(this.moeDataStore=Ze.createInstance({driver:[Ze.INDEXEDDB],name:"moe_database",storeName:"moe_data"}),this.moeDataStore&&(this.moeDataStore.setItem(ve,o),Xe.log(2,n,"Copied identities from cookie to IndexedDB")))}static removeStaleKeysFromLS(){var e=ft.baseLogTag+".removeStaleKeysFromLS";try{Object.keys(ft.getMoeData()).forEach((e=>{var t=yt.get(e);!this.KEYS_SHARED_WITH_COOKIE.includes(e)||be.includes(e)||t||!1===t||ft.remove(e)}))}catch(t){Xe.error(1,e,t)}}static getMoeData(){var e=ft.baseLogTag+".getMoeData",t=localStorage.getItem(ht);if(null==t)return{};try{return JSON.parse(t)}catch(t){return Xe.error(1,e,t),{}}}}ft.baseLogTag="PersistentStorage",ft.prefix="",ft.isSharedWithCookie=!1,ft.KEYS_SHARED_WITH_COOKIE=[r.USER_DATA,r.SUBSCRIPTION_DETAILS,r.SOFT_ASK_STATUS,r.PUSH_TOKEN,r.OPT_IN_SHOWN_TIME,r.HARD_ASK_STATUS,r.SESSION,r.DEVICE_DATA,r.IDENTITY_MAP,r.SDK_DISABLED];class vt{constructor(e){this.debugLevel=0,this.cluster=null,this.environment=null,this.baseDomainName="https://sdk-01.moengage.com/",this.inapp=null,this.customSoftAsk=null;var t=vt.baseLogTag+".constructor";null!=je(e,"app_id",null)?(this.appId=je(e,"app_id",null),this.integrationType=Qe.OLD_SDK):null!=je(e,"appId",null)?(this.appId=je(e,"appId",null),this.integrationType=Qe.NEW_SDK):(Xe.error(1,t,"App Id not specified. Please check docs page to complete the integration - ",z.WEBSDK_DOCS),this.integrationType=null),null!=je(e,"debug_logs",null)?this.debugLevel=je(e,"debug_logs",0):null!=je(e,"debugLevel",null)?this.debugLevel=je(e,"debugLevel",0):(Xe.log(2,t,"No log level config found. Using default value of",0),this.debugLevel=0),this.appId&&(this.baseDomainName="https://sdk-01.moengage.com/",this.forceSwUpdate=je(e,"forceSwUpdate",!1),this.cluster="DC_3",this.cluster=je(e,"cluster",this.cluster),this.cluster&&null!=j[this.cluster.toUpperCase()]&&(this.environment=j[this.cluster.toUpperCase()]),je(e,"environment",null)&&(this.environment=e.environment),this.environment&&(this.baseDomainName="https://"+this.environment+"/"),0{let n=t.trim();"%"===n.slice(-1)&&(n+="25");try{return decodeURIComponent(n)}catch(t){return Xe.error(2,e,"Error decoding cookie:",n,t),n}}))}}yt.baseTag="CookieStorage";var bt=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};class Et{static getIdentityMap(){var e=ft.get(r.WEB_SETTINGS);return null!=e&&e.isDomainLevelStorage?this.getIdentitiesFromCookies():this.getIdentitiesFromLocalStorage()}static getIdentitiesFromLocalStorage(){var e=ft.get(r.IDENTITY_MAP);return null!=e&&e.userIdentities?e:null}static getIdentitiesFromCookies(){var e=yt.get(r.IDENTITY_MAP);if(e&&"object"==typeof e&&e.userIdentities){const t={userIdentities:e.userIdentities};return e.previousIdentities&&(t.previousIdentities=e.previousIdentities,t.previousIdentitiesUpdatedTime=e.previousIdentitiesUpdatedTime),t}return null}static getUserIdentities(){var e=this.getIdentityMap();return null!=e&&e.userIdentities?e.userIdentities:null}static updateCurrentUserIdentities(e){return bt(this,void 0,void 0,(function*(){let t;var n=this.getIdentityMap();t=null!=n&&n.userIdentities?Object.assign(Object.assign({},n),{userIdentities:Object.assign(Object.assign({},n.userIdentities),e)}):(this.createIdentityMap(),Object.assign(Object.assign({},this.getIdentityMap()),{userIdentities:e})),ft.set(r.IDENTITY_MAP,t),yield this.updateIdentifiersIDB(t)}))}static broadcastUserIdentityUpdate(){var e=this.baseLogTag+".broadcastUserIdentityUpdate";Xe.log(1,e,"User Identities Updated."),lt.broadcastToWindow({topic:M,name:B.USER_IDENTITY_UPDATE})}static broadcastLogout(){lt.broadcastToWindow({topic:M,name:B.LOGOUT})}static updatePreviousUserIdentities(e,t){return bt(this,void 0,void 0,(function*(){let n;var i,a=this.getIdentityMap();n=null!=a&&a.userIdentities?(i=(null==a?void 0:a.previousIdentities)||{},Object.assign(Object.assign({},a),{previousIdentities:Object.assign(Object.assign({},i),e),previousIdentitiesUpdatedTime:t||(new Date).getTime()})):(this.createIdentityMap(),Object.assign(Object.assign({},this.getIdentityMap()),{previousIdentities:e,previousIdentitiesUpdatedTime:t||(new Date).getTime()})),ft.set(r.IDENTITY_MAP,n),yield this.updateIdentifiersIDB(n)}))}static updateIdentifiersIDB(e){var t;return bt(this,void 0,void 0,(function*(){var n;null!==(t=this.moeDataStore)&&void 0!==t&&t.getItem||(this.moeDataStore=Ze.createInstance({driver:[Ze.INDEXEDDB],name:"moe_database",storeName:"moe_data"})),this.moeDataStore&&(Object.keys(e).length?(n=(yield this.moeDataStore.getItem(ve))||{},yield this.moeDataStore.setItem(ve,Object.assign(Object.assign({},n),e))):yield this.moeDataStore.setItem(ve,e))}))}static copyUidIntoIdentityMap(e){var t=this.baseLogTag+".copyUidIntoIdentityMap";(e=e.getAttribute("id"))&&(this.updateCurrentUserIdentities({uid:e}),Xe.log(1,t,"UID copied into IdentityMap."))}static getIdentifiersFromIdentities(){var{userIdentities:e,previousIdentities:t,previousIdentitiesUpdatedTime:n}=this.getIdentityMap()||{};const i={};return e&&Object.keys(e).length&&(i.userIdentities=e),0-1!==n.indexOf(e)))&&n.every((n=>It(e[n],t[n])))}class Tt{constructor(e,t,n){this.os="web",this.osPlatform=e.userAgent,this.isMobile=nt(),this.os=nt()?"mweb":"web",this.name=Tt.getBrowserName(e.userAgent,t),this.isIncognito=n}static getInstance(){return e=this,i=function*(){if(null!=ze.get(t))return ze.get(t);var e=yield Tt.isIncognito(window),n=new Tt(navigator,document,e);return ze.set(t,n),(e=ft.get(r.BROWSER_DETAILS))&&Tt.isBrowserUpdated(e,n)||ft.set(t,n),n},new(n=(n=void 0)||Promise)((function(t,a){function r(e){try{s(i.next(e))}catch(e){a(e)}}function o(e){try{s(i.throw(e))}catch(e){a(e)}}function s(e){var i;e.done?t(e.value):((i=e.value)instanceof n?i:new n((function(e){e(i)}))).then(r,o)}s((i=i.apply(e,[])).next())}));var e,n,i}static isIncognito(e){const t=e.RequestFileSystem||e.webkitRequestFileSystem;return new Promise((n=>{t?t(e.TEMPORARY,100,(()=>{n(!1)}),(()=>{n(!0)})):n(!1)}))}static getBrowserName(e,t){return-1!==e.indexOf("MSIE")||1==t.documentMode?Tt.BROWSER_NAMES.INTERNET_EXPLORER:-1new Promise(((e,t)=>{try{var n=JSON.parse(localStorage.getItem("MOE_DATA"));n&&n.WEB_SETTINGS&&n.WEB_SETTINGS.configs&&e(n.WEB_SETTINGS),t("Error in getting sdk settings from localstorage - no data found")}catch(e){Xe.error(1,"getSDKSettings","Error in getting sdk settings from localstorage ",e),t(e)}})),Ct=()=>new Promise(((e,t)=>{try{var n=JSON.parse(localStorage.getItem("MOE_DATA"));return n&&n.INIT_DATA&&e(n.INIT_DATA),{}}catch(e){Xe.error(1,"getSDKSettings","Error in getting init data from localstorage ",e),t(e)}}));class Dt{constructor(e,t){this.key=e,this.value=t,this.updated_at=(new Date).getTime()}static equal(e,t){return e.key===t.key&&JSON.stringify(e.value)===JSON.stringify(t.value)}}class Ot{static get(e,t){return Ot.makeNetworkCall(St.METHODS.GET,e,t)}static post(e,t){return Ot.makeNetworkCall(St.METHODS.POST,e,t)}static makeNetworkCall(e,t,n={}){return new Promise(((i,a)=>{var r=JSON.stringify(je(n,"postData",null));t=ot(t,je(n,"queryParams",null));const o=new XMLHttpRequest;o.open(e,t,!0),Ot.addRequestHeaders(o,je(n,"headers",{})),o.onreadystatechange=()=>{4===o.readyState&&200===o.status||4===o.readyState&&410===o.status?i({status:o.status,responseText:o.responseText}):4===o.readyState&&200!==o.status&&a({code:o.status,reason:o.responseText})},o.send(r)}))}static addRequestHeaders(e,t){for(const n in t)t.hasOwnProperty(n)&&e.setRequestHeader(n,t[n]);return e}}(zt=(zt=St=St||{}).METHODS||(zt.METHODS={})).GET="GET",zt.POST="POST";class Lt{constructor(){this.p=null,this.res=null,this.rej=null;try{this.p=new Promise(((e,t)=>{this.res=e,this.rej=t}))}catch(e){Xe.error(1,"Utils.PromiseObject","Promises not supported")}}}const Nt=e=>e===l||e===E,kt=e=>{let t;try{t=JSON.stringify(e)}catch(e){return!1}return new Blob([t]).size/1024>195};function xt(e){return`Event "${e}" can't get tracked as its size is more than 195 KB. Max permissible event size is 195 KB.`}const Pt=e=>"string"==typeof e,Rt=e=>"[object Date]"===Object.prototype.toString.call(e);class Mt{initiateSessionAndSource(e){return new Promise(((t,n)=>{this.isSessionRunning()&&this.isCurrentSourceSameAsPreviousSource()||this.startNewSession(e),t(!0)}))}clearSessionAndSource(){ft.remove(Y)}isSessionRunning(){return this.getSessionKey()&&!this.isSessionExpired()}isSessionExpired(){var e=this.getSessionExpiryTime(),t=ze.get("wasBrowserInactive");return!(!t&&null!==t)&&(this.isWindowActive()&&ze.set("wasBrowserInactive",!1),(new Date).getTime()>e)}isNonEventInteractive(e){return Mt.NON_INTERACTIVE_EVENTS.includes(e.name)||0"moe_non_interactive"===e.key&&1===e.value)).length}getCurrentSource(){const e=rt(window.location.href);let t="";const n={};if(Object.keys(e).includes("utm_source")){t="utm_",this.geCustomIdentifiersToTrack().forEach((t=>{e[t]&&(n[t]=e[t])}));const i={source_url:window.location.href};return e[t+"source"]&&(i.source=e[t+"source"]),e[t+"medium"]&&(i.medium=e[t+"medium"]),e[t+"term"]&&(i.term=e[t+"term"]),e[t+"campaign"]&&(i.campaign_name=e[t+"campaign"]),e[t+"content"]&&(i.content=e[t+"content"]),e.utm_id&&(i.campaign_id=e.utm_id),Object.keys(n).length&&(i.extra=n),i}}getActiveSource(){return this.getSavedSource()||this.getCurrentSource()}isSourceOrganic(){const e=rt(window.location.href),t=Object.keys(e);let n=!1;return this.geCustomIdentifiersToTrack().forEach((t=>{e[t]&&(n=!0)})),!t.includes("utm_source")&&!t.includes("source")&&!n}setCurrentSource(e){const t=this.getSession()||{};t.currentSource=e,ft.set(Y,t)}removeCurrentSource(){const e=this.getSession();e&&(e.currentSource=void 0,ft.set(Y,e))}getSavedSource(){var e=je(this.getSession(),"currentSource",void 0);if(e)return e}isCurrentSourceSameAsPreviousSource(){if(this.isSourceOrganic())return!0;const e=Object.assign({},this.getCurrentSource());delete e.source_url;const t=Object.assign({},this.getSavedSource());return delete t.source_url,It(e,t)}getSessionKey(){return je(this.getSession(),"sessionKey",null)}getSessionStartTime(){return je(this.getSession(),"sessionStartTime",null)}getSessionExpiryTime(){return je(this.getSession(),"sessionExpiryTime",null)}getSessionMaxTime(){return je(this.getSession(),"sessionMaxTime",null)}getSession(){return ft.get(Y)}geCustomIdentifiersToTrack(){return je(this.getSession(),"customIdentifiersToTrack",[])||[]}generateSessionKey(){return(0,_t.v4)()}startNewSession(e){this.removeCurrentSource();var t=this.getNumberOfSessions();t={sessionKey:this.generateSessionKey(),sessionStartTime:(new Date).toISOString(),sessionMaxTime:e.configs.sessionInactiveDuration,customIdentifiersToTrack:e.configs.sourceExtraParams,sessionExpiryTime:(new Date).getTime()+1e3*e.configs.sessionInactiveDuration,numberOfSessions:++t},ft.set(Y,t)}extendSession(){const e=this.getSession();e&&(e.sessionExpiryTime=(new Date).getTime()+1e3*e.sessionMaxTime,ft.set(Y,e))}handleBrowserInactivity(e){"hidden"===e&&ze.set("wasBrowserInactive",!0)}isWindowActive(){return!!ze.get("isWindowActive")}getNumberOfSessions(){return je(ft.get(Y),"numberOfSessions")||0}}Mt.NON_INTERACTIVE_EVENTS=[d,g,d,v];const Bt=n(967),Ut=r.Q;class Ft{static clear(e){var t=Ft.baseLogTag+".clear";if(bn()){const n=[];for(;!pt.isEmpty(e);)switch(e){case Ut.REPORT:const i=pt.dequeue(Ut.REPORT);n.push((e=>{rn.reportAdd(i).then((()=>{e()}))}));break;case Ut.DEVICE:pt.dequeue(Ut.DEVICE)&&n.push((e=>{rn.deviceAdd().then((()=>{e()}))}));break;default:Xe.error(1,t,"Do not know how to handle queue with name:",e)}setTimeout((()=>{Ft.processing[e]=!0,Bt(n,5,((t,n)=>{Ft.processing[e]=!1}))}),0)}}static startPeriodicClear(e){const t=Ft.baseLogTag+".startPeriodicCleanQ";Ft.clearInterval(e);var n=()=>{pt.isEmpty(e)?(Xe.log(1,t,"If you see multiple event tracks with same, they were captured over multiple visits or page refreshes."),je(Ft.processing,e,!1)||Ft.clearInterval(e)):(Ft.clear(e),Xe.log(1,t,"Starting periodic queue clear for",e))};n(),Ft.intervals[e]=setInterval(n,6e3)}static clearInterval(e){null!=Ft.intervals[e]&&(clearInterval(Ft.intervals[e]),Ft.intervals[e]=null)}}function Ht(e){const t=e?new Date(e):new Date;return`${t.getDate()}:${t.getMonth()+1}:${t.getFullYear()}:${t.getHours()}:${t.getMinutes()}:`+t.getSeconds()}Ft.baseLogTag="QManager",Ft.intervals={},Ft.processing={};class Wt{constructor(e){this.EVENT_ACTION=e.event.name,this.EVENT_ATTRS=e.event.attributes&&$t(e.event.attributes),this.EVENT_G_TIME=(new Date).getTime().toString(),this.EVENT_L_TIME=Ht(e.event.timestamp),this.EVENT_ATTRS_CUST=e.postData.c,this.N_I_E=e.postData.nie}}Wt.baseLogTag="ReportAddViewEvent";const $t=e=>{const t={};return e.forEach((e=>{t[e.key]=e.value})),t};class Gt{static visibilityChange(){"hidden"===document.visibilityState&&(Gt.windowClosed||Jt.reactToTriggerEvents())}static removeEventListeners(){document.removeEventListener("visibilitychange",Gt.visibilityChange,!1)}static addListeners(){document.addEventListener("visibilitychange",Gt.visibilityChange,!1)}}Gt.windowClosed=!1;const Kt=Gt;class Vt{static initialize(){return e=this,n=function*(){if(null==Vt.ready){Vt.offlineDataStore=Ze.createInstance({driver:[Ze.INDEXEDDB],name:ee,storeName:te.NAME});const t=Ze.createInstance({driver:[Ze.INDEXEDDB],name:ee,storeName:"moe_data"}),n=Ze.createInstance({driver:[Ze.INDEXEDDB],name:ee,storeName:"moe_backup"});var e=[Vt.offlineDataStore.ready(),t.ready(),n.ready()];Vt.ready=Promise.all(e)}return yield Vt.ready},new(t=(t=void 0)||Promise)((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var n;e.done?i(e.value):((n=e.value)instanceof t?n:new t((function(e){e(n)}))).then(r,o)}s((n=n.apply(e,[])).next())}));var e,t,n}}class jt{static getRemoteLogsBatchRequestOptions(e){return new Promise((t=>{rn.collectGetParams().then((n=>{n={query_params:Object.assign(Object.assign({},n),{unique_id:n.unique_id,os:"web"===n.os?"Web":"mWeb"}),logs:[...e]},t(n)}))}))}static sendBatchOfLogs(e){const t=rn.baseLogTag+".sendBatchOfLogs";return new Promise(((n,i)=>{jt.getRemoteLogsBatchRequestOptions(e).then((i=>{var a=(a=Ct()).baseDomainName+de+i.query_params.os.toLowerCase()+"/"+a.appId;Ot.post(a,{postData:i}).then((()=>{Xe.log(1,t,"[sendBatchOfLogs] batch payload: "+JSON.stringify(e)),Xe.log(1,t,"Batch Remote Logs sent to MoEngage successfully"),jt.batchRemoteLogsApiRetries=1,n(!0)})).catch((n=>{Xe.log(1,t,"Batch Remote Logs API failed",n),this.handleRemoteLogsFailure(e)}))}))}))}static handleRemoteLogsFailure(e){var t=rn.baseLogTag+".handleRemoteLogsFailure";Xe.log(1,t,"Retry Batch Logs Failed API",jt.batchRemoteLogsApiRetries),jt.batchRemoteLogsApiRetries<3&&setTimeout((()=>{jt.batchRemoteLogsApiRetries++,jt.sendBatchOfLogs(e)}),3e3*jt.batchRemoteLogsApiRetries)}static sendBeacon(e){jt.getRemoteLogsBatchRequestOptions(e).then((e=>{var t=(t=Ct()).baseDomainName+de+e.query_params.os.toLowerCase()+"/"+t.appId+"?"+(new Date).getTime();Xe.log(1,"RemoteLogsApi.sendBeacon","[sendBeacon] Remote Logs batch payload: "+JSON.stringify(e)),navigator.sendBeacon(t,JSON.stringify(e))}))}}jt.batchRemoteLogsApiRetries=1;var zt,qt=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};class Yt{static updateEventStore(){it()!==me.TV&&Ze.createInstance({driver:[Ze.INDEXEDDB,Ze.WEBSQL,Ze.LOCALSTORAGE],name:"moe_tracking",storeName:J}).setItem(J,Yt.reports)}static spliceReports(e=Yt.reports.length){return e=Yt.reports.splice(0,e),Yt.updateEventStore(),e}static spliceRemoteLogs(e=Yt.remoteLogs.length){return Yt.remoteLogs.splice(0,e)}static suspendBatching(){var e=Yt.baseLogTag+".suspendBatching";this.spliceReports(),this.spliceRemoteLogs(),Yt.periodicSyncInterval&&Yt.clearInterval(),Kt.removeEventListeners(),Xe.log(2,e,"Batching has stopped.")}static shouldCreateNewBatch(){return!Yt.lastbatchCreatedAt||(new Date).getTime()-Yt.lastbatchCreatedAt>=ie}static shouldCreateNewBatchForRemoteLogs(){return!Yt.lastRemoteLogsbatchCreatedAt||(new Date).getTime()-Yt.lastRemoteLogsbatchCreatedAt>=ie}static reactToTriggerEvents(){var e=Yt.baseLogTag+".reactToTriggerEvents";0qt(this,void 0,void 0,(function*(){(Yt.isOfflineBatchingSupported(t,e)||e.configs.remoteLogTracking)&&(yield Vt.initialize(),Yt.periodicSyncInterval&&Yt.clearInterval(),Yt.periodicSyncInterval=window.setInterval(Yt.periodicSync.bind(this,e.configs.periodicFlushTime),1e3*e.configs.periodicFlushTime),Kt.addListeners())}))))}static sendBatch(e){const t=Yt.baseLogTag+".sendBatch";return new Promise((n=>{try{rn.sendBatchOfReports(e).then((()=>{Yt.lastbatchCreatedAt=(new Date).getTime(),n(!0)}))}catch(e){Xe.error(1,t,"Error in sending batch",e),n(!1)}}))}static sendRemoteLogs(e){const t=Yt.baseLogTag+".sendRemoteLogs";return new Promise((n=>{try{jt.sendBatchOfLogs(e).then((()=>{Yt.lastRemoteLogsbatchCreatedAt=(new Date).getTime(),n(!0)}))}catch(e){Xe.error(1,t,"Error in sending batch of remote logs",e),n(!1)}}))}static createBatch(e){0{const i=[];var a=e.key;switch(e.key){case"id":e.key=T;break;case"email":e.key=w;break;case"name":e.key=A;break;case"first_name":e.key=C;break;case"last_name":e.key=D;break;case"mobile":e.key=O;break;case"gender":e.key=L;break;case"birthday":e.key=N}i.push(e),e.key!==a&&Xe.log(2,"Event.createUserAttributeEvent","Key changed to MoE reserved keyname: ",e.key),t(new en("EVENT_ACTION_USER_ATTRIBUTE",i,!1))}))}static createEvent(e,t,n){return new Promise(((i,a)=>{ln.get().then((a=>function(e,t,n,i){return new(n=n||Promise)((function(t,a){function r(e){try{s(i.next(e))}catch(e){a(e)}}function o(e){try{s(i.throw(e))}catch(e){a(e)}}function s(e){var i;e.done?t(e.value):((i=e.value)instanceof n?i:new n((function(e){e(i)}))).then(r,o)}s((i=i.apply(e,[])).next())}))}(this,0,void 0,(function*(){try{var r=new Dt("moe_logged_in_status",!!a.getAttribute("id"));const s=new Mt;var o=new Dt("moe_first_visit",s.getNumberOfSessions()<=1);t.push(r,o),i(new en(e,t,n))}catch(r){Xe.error(1,"Event.createEvent","Error occurred in create events ",r)}}))))}))}}class tn{static addEvent(e){tn.history.push(e),tn.listeners.forEach((t=>{t(e)}))}static getHistory(){return tn.history}static addEventListener(e){tn.listeners.push(e)}static clear(){tn.history=[]}static clearAll(){tn.history=[],tn.listeners=[]}}tn.history=[],tn.listeners=[];class nn{static track(e,t,n){const i="MoEngage.event.trackEvent";return new Promise(((a,r)=>function(e,t,n,i){return new(n=n||Promise)((function(t,a){function r(e){try{s(i.next(e))}catch(e){a(e)}}function o(e){try{s(i.throw(e))}catch(e){a(e)}}function s(e){var i;e.done?t(e.value):((i=e.value)instanceof n?i:new n((function(e){e(i)}))).then(r,o)}s((i=i.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r,o;if(!bn())return Xe.warn(2,i,`Not tracking the event "${e}" as Web SDK has been disabled.`),void a(!1);let s;n=!!n;try{s=yield At()}catch(o){return Xe.warn(1,i,"SDK not yet initialized. Caching event and will track when SDK is initialized.",o),null!==(r=window.moengage_q)&&void 0!==r&&r.push({f:"track_event",a:[e,t]}),void a(!1)}if("string"==typeof e&&e)if(s.configs.blacklistedEvents&&s.configs.blacklistedEvents.includes(e))Xe.error(1,i,`This event "${e}" is blacklisted. Please contact Moengage team to whitelist it.`),a({error:5001,message:`Event "${e}" is blacklisted.`});else if(!oe.includes(e)||s.configs.whitelistedEvents&&s.configs.whitelistedEvents.includes(e))try{const r=[];if(null==t||null!==t&&t===Object(t)&&"[object Object]"===Object.prototype.toString.call(t)){for(const e in t=null==t?{}:t)t.hasOwnProperty(e)&&r.push(new Dt(e,t[e]));const i=new Mt;yield i.initiateSessionAndSource(s);const l=yield en.createEvent(e,r);tn.addEvent(l),null!=s&&s.configs.isWebPersonalizationModuleEnabled&&null!==(o=window.MoeWebP)&&void 0!==o&&o.handleInSessionEvent(l),rn.collectGetParams().then((t=>{Nt(e)&&delete t.push_id;const r=new Zt(Zt.REPORT_ADD_TYPE.EVENT,t,l);var o={session_id:i.getSessionKey(),start_time:i.getSessionStartTime(),background_initiated:0};const s=[];(t=i.getActiveSource())&&(i.setCurrentSource(t),s.push(t)),r.postData.meta.session=o,s.length&&(r.postData.meta.source=s),i.isNonEventInteractive(l)&&(r.postData.nie=1),rn.reportAdd(r,n).then((()=>{i.isNonEventInteractive(l)||i.extendSession(),a(!0)}))}))}else Xe.error(1,i,"Event attributes were not passed a key-value pair object for event: "+e),a({error:5002,message:"Event value needs to be a key-value pair object"})}catch(o){Xe.error(1,i,"Error occurred in tracking events ",o)}else Xe.error(1,i,`This event "${e}" has not been whitelisted. Please contact Moengage team to whitelist it.`),a({error:5001,message:`Event "${e}" is not whitelisted.`});else Xe.error(1,i,"Event name not a string or null or empty string:",e),a({error:5001,message:"Event name can not be null"})}))))}}var an=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};class rn{static deviceAdd(){var e=rn.baseLogTag+".deviceAdd";return rn.isExecutingDeviceAdd?(Xe.warn(2,e,"Device add is already in progress. Skipping this call."),Promise.resolve(!1)):(rn.isExecutingDeviceAdd=!0,new Promise(((e,t)=>an(this,void 0,void 0,(function*(){if(bn()){const n=vt.get();return rn.collectGetParams(ce).then((i=>{i={queryParams:i=Object.assign(Object.assign({},i),{url:window.location.href})},Ot.post(n.baseDomainName+ce,i).then((()=>{ln.get().then((e=>{e.deviceAdded=!0,e.save().then((()=>{Ft.startPeriodicClear(r.Q.REPORT),rn.onDeviceAdd.res()}))})).then((()=>{this.trackDeviceAttributes(),rn.isExecutingDeviceAdd=!1,e(!0)}))})).catch((e=>{pt.enqueue(r.Q.DEVICE,!0),rn.isExecutingDeviceAdd=!1,t(!1)}))}))}e(!1)})))))}static trackDeviceAttributes(){const e=rn.baseLogTag+".trackDeviceAttributes";return new Promise(((t,n)=>an(this,void 0,void 0,(function*(){try{let t=it().toUpperCase();t="WEB"===t?"DESKTOP":t,nn.track(y,{deviceType:t});let n=!1;wt.getInstance().then((t=>{At().then((i=>an(this,void 0,void 0,(function*(){if(dt(i,t)){let t=ft.get(r.PUSH_TOKEN);if(!t)try{const e=qe()||{};let n="";"function"==typeof e.getPermissionState&&(n=yield e.getPermissionState()),"granted"===n&&(t=!0)}catch(t){Xe.error(2,e,"Failed to get push notification permission state.",t)}n=t}})))).then((()=>{nn.track(y,{[le]:!!n,source:"deviceAdd"}),ft.set(r.OPTED_STATUS_TRACK_TIME,Date.now())}))}))}catch(t){Xe.error(2,e,"Failed to track device attributes.",t)}t(null)}))))}static reportAdd(e,t){const n=rn.baseLogTag+".reportAdd";return new Promise(((i,a)=>(t=!!t,At().then((o=>{o.isPushSubBilling?ln.get().then((s=>{s.deviceAdded?rn.reportAddInternal(e,t).then((()=>{this.sendBroadcast(e),i(!0)})).catch((()=>{a(!1)})):(pt.enqueue(r.Q.REPORT,e),Xe.log(1,n,"Report added to queue as device not added yet:",e.event.name),Xe.log(2,n,"Event Queued:",e.event.name),e.type===Zt.REPORT_ADD_TYPE.USER_ATTRIBUTE&&(gt(e.event.attributes[0].key,null===(s=null==o?void 0:o.configs)||void 0===s?void 0:s.subscriberBasedBillingAttributes)?(Xe.log(1,n,"Attribute accepted for push sub billing."),rn.deviceAdd()):Xe.log(2,n,"Attribute NOT accepted for push sub billing.")),i(!0))})):rn.reportAddInternal(e,t).then((()=>{this.sendBroadcast(e),i(!0)})).catch((()=>{a(!1)}))})).catch((e=>{Xe.error(1,n,"Error in getting Web SDK Settings. This might indicate that the App is blocked."),a(!1)})))))}static sendBroadcast(e){re.NAMES.includes(e.event.name)&<.broadcastToWindow({topic:re.TOPIC,name:e.event.name,data:e.event.attributes})}static getSegmentId(){const e=window.analytics;if(e&&e.user)return e.user().anonymousId()}static getBatchRequestOptions(e){return new Promise((t=>{rn.collectGetParams(ne).then((n=>an(this,void 0,void 0,(function*(){var i=rn.getSegmentId()||"";const a=ln.getSync();var r=vt.get();const o=new Mt;var s={session_id:o.getSessionKey(),start_time:o.getSessionStartTime(),background_initiated:0};const l=[];(u=o.getActiveSource())&&(o.setCurrentSource(u),l.push(u));var{userIdentities:d,previousIdentities:c}=yield Et.getIdentifiersFromIdentities(),u={user_identities:d||void 0,previous_identities:c||void 0},c=yield this.getParamsFromCookie();let g=null;const m=Object.assign({},n);null!==c&&"object"==typeof c&&(g=c.moe_user_id,null!==c.push_id&&(m.push_id=c.push_id),null!==c.unique_id&&(m.unique_id=c.unique_id)),r={query_params:m,identifiers:Object.assign(Object.assign({moe_user_id:null!==g?g:a.getAttribute("id")||(null==d?void 0:d.uid)||void 0,segment_id:i||void 0},u),{moe_aid:yn()}),meta:{bid:(0,_t.v4)(),request_time:(new Date).toISOString(),session:s,source:l.length?l:void 0,initiator:null!==(r=null===(r=null==r?void 0:r.proxyDomains)||void 0===r?void 0:r.api)&&void 0!==r&&r.length?"proxy_server":void 0},viewsCount:e.length,viewsInfo:[...e]},t(r)}))))}))}static getParamsFromCookie(){const e=this.baseLogTag+".getMoeUserIdFromCookies",t={moe_user_id:null,unique_id:null,push_id:null};return new Promise((n=>{At().then((e=>{if(null!=e&&e.isDomainLevelStorage){const n=yt.get(r.USER_DATA);var i=yt.get(r.PUSH_TOKEN);n&&(null!==(e=n.attributes)&&void 0!==e&&e.length&&n.attributes.find((e=>e.key===T))?t.moe_user_id=n.attributes.find((e=>e.key===T)).value:t.moe_user_id=void 0,null!==(e=n.deviceUuid)&&void 0!==e&&e.length&&(t.unique_id=n.deviceUuid)),null!=i&&i.length&&En(i)?t.push_id=i:t.push_id=void 0}n(t)})).catch((i=>{Xe.error(2,e,"Error occurred while trying to fetch SDK Settings: ",i),n(t)}))}))}static addReportsToOfflineDB(e,t){return an(this,void 0,void 0,(function*(){const n=rn.baseLogTag+".addReportsToOfflineDB";var i=yield rn.getBatchRequestOptions([]);yield Vt.offlineDataStore.setItem(t||"report_add_"+(new Date).getTime(),e),yield Vt.offlineDataStore.setItem("requestMetaData",i),yield Vt.offlineDataStore.setItem(t||"batch_"+(new Date).getTime(),Object.assign(Object.assign({},i),{viewsCount:e.length,viewsInfo:e})),navigator.serviceWorker&&navigator.serviceWorker.ready.then((e=>{e.sync?e.sync.register("moe_offline_data_sync").then((()=>{Xe.log(2,n,"offline sync event registered")})).catch((e=>{Xe.error(1,n,"Service worker sync error",e)})):Xe.log(2,n,"Service worker sync unavailable")}))}))}static sendReportBeacon(e,t,n){var i=rn.baseLogTag+".sendReportBeacon";try{if(!e&&navigator.sendBeacon&&navigator.sendBeacon(t,new Blob([JSON.stringify(n)],{type:"text/plain;charset=UTF-8"})))return!0}catch(e){Xe.error(2,i,"Failed to send Report call with Beacon:",e)}return!1}static sendBatchOfReports(e){const t=rn.baseLogTag+".sendBatchOfReports";return new Promise(((n,i)=>{rn.getBatchRequestOptions(e).then((a=>{var r=vt.get();const o=r.baseDomainName+ne+r.appId;At().then((i=>window.navigator.onLine?rn.sendReportBeacon(i.configs.isBeaconDisabled,o,a)?(Xe.log(1,t,"[sendBatchOfReports] batch payload: "+JSON.stringify(e)),Xe.log(1,t,"Batch sent to MoEngage successfully through beacon"),void n(!0)):void Ot.post(o,{postData:a}).then((()=>{Xe.log(1,t,"[sendBatchOfReports] batch payload: "+JSON.stringify(e)),Xe.log(1,t,"Batch sent to MoEngage successfully"),n(!0)})).catch((a=>{Xe.error(1,t,"Batch Report add API failed",a),n(this.sendToOfflineTracking(e,a,i))})):this.sendToOfflineTracking(e,pe,i))).catch((e=>{e!==pe&&Xe.error(1,t,"Error in getting Web SDK Settings. This might indicate that the App is blocked."),i(e)}))}))}))}static sendToOfflineTracking(e,t,n){const i=rn.baseLogTag+".sendToOfflineTracking";return new Promise(((a,r)=>{if(!bn())return Xe.warn(2,i,"Not adding report(s) to offline db as SDK has been disabled."),void r(t);wt.getInstance().then((o=>{Jt.isOfflineBatchingSupported(o,n)?(Xe.error(1,i,"Add Report API failed, adding reports to offline db. ",t),rn.addReportsToOfflineDB(e).then((()=>{Xe.log(2,i,"Network offline: Batch added to offline db")})),a(!0)):(Xe.warn(1,i,"Report not added to offline db. Offline tracking is supported only if batching is enabled. It is supported only on Chrome, Edge and Opera browsers on desktop web and Chrome and Opera browsers on Android web."),r(t))})).catch((()=>{r(t)}))}))}static reportAddInternal(e,t){const n=rn.baseLogTag+".reportAddInternal";return new Promise(((i,a)=>{At().then((a=>{wt.getInstance().then((o=>{if(t){const t=rn.getUpdatedPushDetails();for(const n in t)!t.hasOwnProperty(n)||Nt(e.event.name)&&"push_id"===n||(e.getParams[n]=t[n]);var s=at();const n={queryParams:Object.assign(Object.assign({},e.getParams),s)};if(e.postData.nie){const t=Object.assign({},e);delete t.postData.meta.source,delete t.postData.meta.session,n.postData=t.postData}else n.postData=e.postData;s=vt.get().baseDomainName,s+=ce,Ot.post(s,n).then((()=>{let t=it().toUpperCase();t="WEB"===t?"DESKTOP":t,nn.track(y,{deviceType:t}),i(rn.handleReportAddSuccess(e))})).catch((t=>{Jt.isBatchingSupported(a,o)?pt.enqueue(r.Q.DEVICE,e):rn.handleReportAddFailure(e,t)}))}else Jt.isBatchingSupported(a,o)?(Jt.addReport(e,a.configs.eventBatchCount)&&(Xe.log(1,n,"Event batched successfully:",e.event),this.addEventsToIDB(e.event)),i(!0)):(s=new Wt(e),kt(s)?(Xe.error(1,n,xt(s.EVENT_ACTION)),i(!1)):rn.sendBatchOfReports([s]).then((()=>{i(rn.handleReportAddSuccess(e))})).catch((t=>{rn.handleReportAddFailure(e,t)})))}))})).catch((e=>{Xe.error(1,n,"Error in getting Web SDK Settings. This might indicate that the App is blocked."),a(!1)}))}))}static handleReportAddSuccess(e){var t=rn.baseLogTag+".handleReportAddSuccess";return e.type===Zt.REPORT_ADD_TYPE.EVENT?(Xe.log(1,t,"Event tracked successfully:",e.event),this.addEventsToIDB(e.event)):e.type===Zt.REPORT_ADD_TYPE.USER_ATTRIBUTE&&Xe.log(1,t,"User attribute added successfully:",e.event.attributes),rn.addReportApiRetries=1,!0}static handleReportAddFailure(e,t){var n=rn.baseLogTag+".handleReportAddFailure";Xe.error(1,n,"Add Report API failed",t),e.type===Zt.REPORT_ADD_TYPE.EVENT?Xe.log(1,n,"Queueing unsuccessful event tracking:",e.event):e.type===Zt.REPORT_ADD_TYPE.USER_ATTRIBUTE&&Xe.log(1,n,"Queueing unsuccessful user attribute add:",e.event.attributes),rn.addReportApiRetries<3&&setTimeout((()=>{rn.addReportApiRetries++,pt.enqueue(r.Q.REPORT,e),Ft.startPeriodicClear(r.Q.REPORT)}),3e3*rn.addReportApiRetries)}static checkIfTokenValid(e){const t=vt.get().baseDomainName+ue,n=vt.get();return new Promise((i=>{e?ln.get().then((a=>{a={queryParams:{app_id:n.appId,unique_id:a.deviceUuid,push_id:e}},Ot.post(t,a).then((e=>{200===e.status?i(!0):i(!1)})).catch((e=>{i(!1)}))})):i(!1)}))}static collectGetParams(e){return new Promise(((t,n)=>{ln.get().then((n=>an(this,void 0,void 0,(function*(){let i=vt.get();null!=i&&null!=i.appId||(i=new vt(ft.get(r.INIT_DATA)));const a=yield At(),o=new Date,s=Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds());wt.getInstance().then((o=>{var l=this.getDeviceUniqueId(),d=at(e,[ge,ce,ne]);const c=Object.assign({os:o.os,os_platform:o.osPlatform,is_incognito:o.isIncognito,app_id:i.appId,os_ver:o.name,sdk_ver:"2.56.0",model:o.name,app_ver:"1.0",device_ts:Number(s),device_tz_offset:(-6e4*(new Date).getTimezoneOffset()).toString(),unique_id:n.deviceUuid,device_tz:(new Date).getTimezoneOffset().toString(),device_unique_id:l},d);d=n.getAttribute("cart_token"),ut()&&d&&null!=a&&a.configs.isMultiIdEnabled&&e!==ce&&(c.cart_token=d),En(d=ft.get(r.PUSH_TOKEN))&&(c.push_id=d),o.isWebPushCompatible()&&(ct(a.webPushPlatformData,o)?(c.subscription_type="vapid",c.vapid_public=mt(a.webPushPlatformData,o)):c.subscription_type="normal"),null!=i.environment&&(c.environment=i.environment);var u=ft.get(r.SUBSCRIPTION_DETAILS);if(null!=u&&null!=u.keys){for(const e in u.keys)c["keys_"+e]=encodeURI(u.keys[e]);null!=u.endpoint&&(c.endpoint=encodeURI(u.endpoint)),c.expirationTime=u.expirationTime}t(c)}))}))))}))}static getDeviceUniqueId(){var e;return(null===(e=ft.get(r.DEVICE_DATA))||void 0===e?void 0:e.deviceUniqueId)||void 0}static getUpdatedPushDetails(){const e={};var t=ft.get(r.SUBSCRIPTION_DETAILS);if(null!=t){var n=ft.get(r.PUSH_TOKEN);if(null!=n&&"NA"!==n&&""!==n&&"null"!==n&&(e.push_id=n),t.keys){for(const n in t.keys)e["keys_"+n]=encodeURI(t.keys[n]);null!=t.endpoint&&(e.endpoint=encodeURI(t.endpoint)),e.expirationTime=t.expirationTime}}return e}static sendBeacon(e){if(!window.navigator.onLine)return this.sendToOfflineTracking(e,pe);rn.getBatchRequestOptions(e).then((e=>{var t=(t=vt.get()).baseDomainName+ne+t.appId+"?"+(new Date).getTime();Xe.log(1,"MoeApi.sendBeacon","[sendBeacon] batch payload: "+JSON.stringify(e)),navigator.sendBeacon(t,JSON.stringify(e))}))}static addEventsToIDB(e){if(it()!==me.TV){const t=Ze.createInstance({driver:[Ze.INDEXEDDB,Ze.WEBSQL,Ze.LOCALSTORAGE],name:"moe_tracking",storeName:"events"});null!=t&&t.setItem(e.name,e)}}}rn.baseLogTag="MoeApi",rn.onDeviceAdd=new Lt,rn.webSdkApiRetries=1,rn.offlineEvents=[],rn.addReportApiRetries=1,rn.isExecutingDeviceAdd=!1;var on=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};let sn=null;class ln{constructor(e){this.attributes=[],this.subscribedToOldSdk=!1,null==e?(this.deviceUuid=(0,_t.v4)(),this.attributes=[],this.deviceAdded=!1):(this.deviceUuid=je(e,"deviceUuid",(0,_t.v4)()),this.attributes=je(e,"attributes",[]),this.deviceAdded=je(e,"deviceAdded",!1))}addAttribute(e){const t=ln.baseLogTag+".addAttribute";return new Promise((n=>on(this,void 0,void 0,(function*(){let i=!0;e.key=ln.getMorphedKey(e.key);let a=-1;for(let t=this.attributes.length-1;0<=t;t--)e.key===this.attributes[t].key&&(a=t);0<=a?(It(this.attributes[a].value,e.value)&&(Xe.log(2,t,"Duplicate attribute found: ",e),i=yield this.isAttibuteTrackingRequired(this.attributes[a].updated_at)),i&&(this.attributes[a].value=e.value,this.attributes[a].updated_at=(new Date).getTime())):(Xe.log(2,t,"Adding attribute:",e),this.attributes.push(e)),this.save().then((()=>{n(i)}))}))))}isAttibuteTrackingRequired(e){return on(this,void 0,void 0,(function*(){var t=yield At();if(null===t.configs.userAttributeCacheTime)return!0;var n=(new Date).getTime()-e;return Math.round(n/1e3)>t.configs.userAttributeCacheTime}))}static getLocalUser(){const e=ln.baseLogTag+".getLocalUser";return new Promise((t=>{var n;ft.get(r.USER_DATA)?(Xe.log(2,e,"Found user in localstorage"),n=ft.get(r.USER_DATA),t(new ln(n))):t(null)}))}static getCookieUser(){return new Promise((e=>{var t=ln.baseLogTag+".getLocalUser";yt.get(r.USER_DATA)?(Xe.log(2,t,"Found user in cookie"),t=yt.get(r.USER_DATA),e(new ln(t))):e(null)}))}static getMigrationUser(){const e=ln.baseLogTag+".getLocalUser";return new Promise((t=>{var n=localStorage.getItem(r.OLD_SDK.USER_DATA);if(n)try{var i=JSON.parse(n);if(i.is_new_sdk_migrated)t(null);else{const e=new ln({deviceAdded:je(i,"device_add",!1),deviceUuid:je(i,"uuid",(0,_t.v4)())}),n=je(i,"user_attrs",{});for(const t in n)n.hasOwnProperty(t)&&e.attributes.push(new Dt(t,n[t]));var a=localStorage.getItem(r.OLD_SDK.PUSH_TOKEN);null!=a&&"NA"!==a&&"null"!==a&&(e.subscribedToOldSdk=!0),t(e)}}catch(n){Xe.error(1,e,"Error getting the migration user. Resolving as a new user."),Xe.error(1,e,n),t(null)}else t(null)}))}static getSync(){return ln.instance}static get(){const e=ln.baseLogTag+".get";return null!=sn||(sn=new Promise((t=>{wt.getInstance().then((n=>{At().then((n=>{var i=ln.getLocalUser(),a=n.isDomainLevelStorage?ln.getCookieUser():"resolved",o=ln.getMigrationUser();Promise.all([i,a,o]).then((i=>{const a=i[0],o=i[1],s=i[2];i=()=>{var i;if(o&&"resolved"!==o)Xe.log(1,e,"User resolved from cookie: ",o),o.save().then((e=>{t(e)}));else{Xe.log(1,e,"Local user: ",a);const o=new ln(a);n.isPushSubBilling&&(null!==(i=ft.get(r.SUBSCRIPTION_DETAILS))&&void 0!==i&&i.token||function(e,t){const n=[w,O,...t];return 0n.includes(e.key))).length||yn()}(o.attributes,null==n?void 0:n.configs.subscriberBasedBillingAttributes)?(o.deviceAdded=!0,rn.trackDeviceAttributes()):o.deviceAdded=!1),o.save().then((e=>{t(e)}))}},s?s.save().then((n=>{var i=localStorage.getItem(r.OLD_SDK.USER_DATA);if(i){const e=JSON.parse(i);e.is_new_sdk_migrated=!0,localStorage.setItem(r.OLD_SDK.USER_DATA,JSON.stringify(e))}Xe.log(1,e,"User resolved from older SDK: ",n),t(n)})):i()})).catch((t=>{Xe.log(1,e,"Error in fetching/creating user",t)}))})).catch((t=>{Xe.error(1,e,"Error in getting Web SDK Settings. This might indicate that the App is blocked.",t)}))}))}))),sn}static logout(){return new Promise((e=>{sn=null,this.instance=null,window.MoeWebP&&(window.MoeWebP.deviceUuid=null),e(!0)}))}save(){var e;ln.baseLogTag,ln.isAmpEnabled()&&(this.deviceUuid=yt.get("moe_uuid")),ft.get("WEB_SETTINGS");var t=ft.get(r.WEB_SETTINGS);return null!=t&&t.configs.isWebPersonalizationModuleEnabled&&null!==(e=window.MoeWebP)&&void 0!==e&&e.deviceUuid&&this.deviceUuid!==window.MoeWebP.deviceUuid&&(this.deviceUuid=window.MoeWebP.deviceUuid),ln.instance=this,new Promise((e=>{ft.set(r.USER_DATA,this),yt.setRaw(X,ln.instance.deviceUuid),e(this)}))}static isAmpEnabled(){const e=yt.get(X);return e&&e.includes("amp")}getAttribute(e){let t=null;return e=ln.getMorphedKey(e),this.attributes.map((n=>{n.key===e&&(t=n.value)})),t}indexOfAttribute(e){let t=-1;return e=ln.getMorphedKey(e),this.attributes.map(((n,i)=>{n.key===e&&(t=i)})),t}static getMorphedKey(e){switch(e){case"id":e=T;break;case"email":e=w;break;case"name":e=A;break;case"first_name":e=C;break;case"last_name":e=D;break;case"mobile":e=O;break;case"gender":e=L;break;case"birthday":e=N}return e}}ln.baseLogTag="UserModel",ln.isResolved=!1,ln.instance=null;var dn,cn=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};function un(e){e=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/");const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e>18,s=(258048&c)>>12,l=(4032&c)>>6,d=63&c,t+=n[o]+n[s]+n[l]+n[d];return 1==e?(c=i[r],o=(252&c)>>2,s=(3&c)<<4,t+=n[o]+n[s]+"=="):2==e&&(c=i[r]<<8|i[1+r],o=(64512&c)>>10,s=(1008&c)>>4,l=(15&c)<<2,t+=n[o]+n[s]+n[l]+"="),t}function mn(e){return e.replace(/[\uff0e]/g,".")}function pn(e){return new Date(Date.parse(e))}function hn(){return cn(this,void 0,void 0,(function*(){const e=yield ln.get();var t=e.getAttribute(T)||"";return{uniqueId:e.deviceUuid,uid:t}}))}function fn(){return cn(this,void 0,void 0,(function*(){const e={};var t=Et.getIdentityMap(),n=yield hn();return t&&(t.userIdentities&&(e.user_identities=t.userIdentities),t.previousIdentities&&(e.previous_identities=t.previousIdentities)),n.uid&&(e.uid=n.uid),{identifiers:e,uniqueId:n.uniqueId}}))}function vn(e){var t;let n=e;return e=vt.get(),"string"==typeof n&&n.length&&null!==(t=null==e?void 0:e.proxyDomains)&&void 0!==t&&t.api&&(e.proxyDomains.cdnApp&&(n=n.replace(/app-cdn\.moengage\.com/gi,e.proxyDomains.cdnApp)),e.proxyDomains.cdnScript&&(n=n.replace(/cdn\.moengage\.com/gi,e.proxyDomains.cdnScript)),e.proxyDomains.cdnImage&&(n=n.replace(/image\.moengage\.com/gi,e.proxyDomains.cdnImage))),n}function yn(){if(!ze.get("hasUserLoggedOut")){const e=rt(window.location.href);return e.moe_aid&&!e.moe_aid.includes("{{")?e.moe_aid:void 0}}function bn(){var e,t=!!vt.get().disableSdk;let n=!1;return n=((null==(e=ft.get(r.WEB_SETTINGS))?void 0:e.isDomainLevelStorage)?yt:ft).get(r.SDK_DISABLED),!(n||t&&!1!==n)}function En(e){return null!=e&&"NA"!==e&&""!==e&&"null"!==e}class Sn{constructor(e){Sn.baseLogTag,this.placeholder=je(e,"placeholder",""),this.enable=je(e,"enable",!1),this.overLayColor=je(e,"overLayColor","rgba(0, 0, 0, 0.8)"),this.backgroundColor=je(e,"backgroundColor","#F6FBFC"),this.navigationBar=new _n(je(e,"navigationBar",{})),this.closeButton=new wn(je(e,"closeButton",{})),this.tab=new An(je(e,"tab",{})),this.cardDismiss=new Cn(je(e,"cardDismiss",{})),this.optionButtonColor=je(e,"optionButtonColor","#C4C4C4"),this.dateTimeColor=je(e,"dateTimeColor","#8E8E8E"),this.unclickedCardIndicatorColor=je(e,"unclickedIndicatorColor","blue"),this.pinIcon=je(e,"pinIcon",vn("https://app-cdn.moengage.com/sdk/pin-icon.svg")),this.refreshIcon=je(e,"refreshIcon",vn("https://app-cdn.moengage.com/sdk/refresh-icon.svg")),this.webFloating=new Ln(je(e,"webFloating",{})),this.mWebFloating=new Ln(je(e,"mWebFloating",{countBackgroundColor:"#FF5A5F",enable:!1,icon:vn("https://app-cdn.moengage.com/sdk/bell-icon.svg"),countColor:"#fff",postion:"0px 10px 40px 0",iconBackgroundColor:"#D9DFED"})),this.card=new Tn(je(e,"card",{})),this.errorContent=new In(je(e,"errorContent",{})),this.noDataContent=new Nn(je(e,"noDataContent",{})),this.openInbox=je(e,"openInbox",(()=>{})),this.zIndex=je(e,"zIndex","2147483647"),this.fontFaces=(null===(e=e.fontFaces)||void 0===e?void 0:e.map((e=>new Dn(e))))||[]}}Sn.baseLogTag="CardsConfigModel";class _n{constructor(e){this.backgroundColor=je(e,"backgroundColor","#00237C"),this.text=je(e,"text","Notification"),this.color=je(e,"color","#fff"),this.fontSize=je(e,"fontSize","16px"),this.fontFamily=je(e,"fontFamily","inherit")}}class In{constructor(e={}){this.img=je(e,"img",vn("https://app-cdn.moengage.com/sdk/cards-error.svg")),this.text=je(e,"text",'Error something went wrong ')}}class Tn{constructor(e){this.headerFontSize=je(e,"headerFontSize","16px"),this.descriptionFontSize=je(e,"descriptionFontSize","14px"),this.ctaFontSize=je(e,"ctaFontSize","12px"),this.fontFamily=je(e,"fontFamily","inherit"),this.horizontalRowColor=je(e,"horizontalRowColor","#D9DFED")}}class wn{constructor(e){this.mWebIcon=je(e,"mWebIcon",vn("https://app-cdn.moengage.com/sdk/back-icon.svg")),this.webIcon=je(e,"webIcon",vn("https://app-cdn.moengage.com/sdk/cross-icon.svg")),this.callBack=je(e,"callBack",(()=>{}))}}class An{constructor(e){this.inactiveTabFontColor=je(e,"inactiveTabFontColor","#7C7C7C"),this.fontSize=je(e,"fontSize","14px"),this.fontFamily=je(e,"fontFamily","inherit"),this.backgroundColor=je(e,"backgroundColor","#F6FBFC"),this.active=new On(je(e,"active",{}))}}class Cn{constructor(e){this.color=je(e,"color","red"),this.enable=je(e,"enable",!1)}}class Dn{constructor(e){this.family=je(e,"family",""),this.url=je(e,"url","")}}class On{constructor(e){this.color=je(e,"color","#06A6B7"),this.underlineColor=je(e,"underlineColor","#06A6B7"),this.backgroundColor=je(e,"backgroundColor","transparent")}}class Ln{constructor(e){this.enable=je(e,"enable",!1),this.icon=je(e,"icon",vn("https://app-cdn.moengage.com/sdk/bell-icon.svg")),this.postion=je(e,"postion","0px 10px 40px 0"),this.countBackgroundColor=je(e,"countBackgroundColor","#FF5A5F"),this.countColor=je(e,"countColor","#fff"),this.zIndex=je(e,"zIndex","2147483640"),this.iconBackgroundColor=je(e,"iconBackgroundColor","#D9DFED"),this.fontFamily=je(e,"fontFamily","inherit")}}class Nn{constructor(e){this.img=je(e,"img",vn("https://app-cdn.moengage.com/sdk/cards-no-result.svg")),this.text=je(e,"text","No notifications to show, check again later.")}}const kn=class{constructor(e){this.isBeaconDisabled=this.parseSentryBooleanFlag(je(e,"b_d",!1)),this.isCardsModuleEnabled=this.parseSentryBooleanFlag(je(e,"c_s",!1)),this.isWebPersonalizationModuleEnabled=this.parseSentryBooleanFlag(je(e,"c_w_p_e",!1)),this.eventBatchCount=je(e,"e_b_c",15),this.logLevel=je(e,"log_level"),this.periodicFlushTime=je(e,"p_f_t",30),this.isBatchingEnabled=this.parseSentryBooleanFlag(je(e,"s_e_b_e",!1)),this.sessionInactiveDuration=je(e,"s_i_d",1800),this.isRemoteLoggingEnabled=this.parseSentryBooleanFlag(je(e,"s_log",!1)),this.sourceExtraParams=je(e,"src_ext",[]),this.whitelistedEvents=je(e,"w_e",[]),this.blacklistedEvents=je(e,"b_e",[]),this.isAppActive=this.parseSentryBooleanFlag(je(e,"a_s",!0)),this.remoteLogTracking=this.isRemoteLoggingEnabled&&!!this.logLevel,this.subscriberBasedBillingAttributes=je(e,"s_b_a",[]),this.isMultiIdEnabled=this.parseSentryBooleanFlag(je(e,"m_i_e",!1)),this.userAttributeCacheTime=je(e,"u_a_c_t",43200),this.identityAttributes=je(e,"u_i_s",[])}parseSentryBooleanFlag(e="blocked"){return"allowed"===e||!0===e||"true"===e}};class xn{constructor(e){this.mobile=new Pn(je(e,"mobile",{})),this.web=new Pn(je(e,"web",{}))}}class Pn{constructor(e){this.nudge=e.nudge?new Rn(e.nudge):void 0,this.banner=e.banner?new Rn(e.banner):void 0,this.allowButton=e.allow_button?new Mn(e.allow_button):void 0,this.dismissButton=e.dismiss_button?new Mn(e.dismiss_button):void 0,this.logo=e.logo?new Un(e.logo):void 0}}class Rn{constructor(e){this.title=new Bn(je(e,"title",{})),this.body=null!=e&&e.body?new Bn(je(e,"body",{})):void 0,this.backgroundColor=null==e?void 0:e.background_color,this.icon=null==e?void 0:e.icon,this.altText=(null==e?void 0:e.alt_text)||""}}class Mn{constructor(e){this.textColor=null==e?void 0:e.text_color,this.text=je(e,"text",""),this.backgroundColor=null==e?void 0:e.background_color}}class Bn{constructor(e){this.textColor=null==e?void 0:e.text_color,this.text=je(e,"text","")}}class Un{constructor(e){this.logoUrl=(null==e?void 0:e.logo_url)||"",this.logoColor=(null==e?void 0:e.logo_color)||"",this.altText=(null==e?void 0:e.alt_text)||""}}(Ta=dn=dn||{}).ONE_STEP="1-step",Ta.TWO_STEP="2-step",Ta.SELF_HANDLED="self-handled";class Fn{constructor(e){this.subscriptionMode=je(e,"subscription_mode","vapid"),this.vapidPublicKey=je(e,"vapid_public_key",null)}}class Hn{constructor(e){this.chrome=new Fn(null==e?void 0:e.chrome),this.firefox=new Fn(null==e?void 0:e.firefox)}}class Wn{static getWebSDKSettings(){return Wn.BASE_LOG_TAG,new Promise(((e,t)=>{const n=Wn.getInitData();var i,a,o,l,d=n=>{Wn.isAppBlocked(n)?t(!1):(yt.set(s,(null==n?void 0:n.isDomainLevelStorage)||!1),e(n))};Wn.sdkSettings?d(Wn.sdkSettings):bn()?(i=(new Date).getTime(),l=()=>Wn.getAndPersistWebSettings(n).then((t=>e(t))).catch((e=>t(!1))),null==(a=ft.get(r.SETUP_TIME))||060*Wn.RESET_DURATION_IN_HOURS*60*1e3||!(o=ft.get(r.WEB_SETTINGS))?l():(Wn.sdkSettings=o,d(Wn.sdkSettings))):(l=ft.get(r.WEB_SETTINGS))&&(Wn.sdkSettings=l,d(Wn.sdkSettings))}))}static getAndPersistWebSettings(e){const t=Wn.BASE_LOG_TAG+".getAndPersistWebSettings";return new Promise(((n,i)=>function(e,t,n,i){return new(n=n||Promise)((function(t,a){function r(e){try{s(i.next(e))}catch(e){a(e)}}function o(e){try{s(i.throw(e))}catch(e){a(e)}}function s(e){var i;e.done?t(e.value):((i=e.value)instanceof n?i:new n((function(e){e(i)}))).then(r,o)}s((i=i.apply(e,[])).next())}))}(this,0,void 0,(function*(){try{Xe.log(1,t,"Fetching latest settings for",e.appId);var a={queryParams:{app_id:e.appId}},o={postData:{query_params:{unique_id:(c=ft.get(r.USER_DATA))&&c.deviceUuid}}},l=Ot.get(Wn.API_URLS.SETTINGS(e.baseDomainName),a),d=Ot.post(Wn.API_URLS.CONFIG(e.baseDomainName,nt()?"mweb":"web",e.appId),o);Promise.all([l,d]).then((e=>{let t=e[0].responseText;"string"==typeof t&&(t=JSON.parse(t));let a=e[1].responseText;200===e[1].status&&"string"==typeof a&&(a=JSON.parse(a));var r=new class{constructor(e){this.isDomainLevelStorage=!1,this.configs=new kn({}),this.settingsVersion="V2",this.isDomainLevelStorage=je(e,"domain_level_storage",!1),it()===me.TV&&(this.isDomainLevelStorage=!1),this.toShowOverlay=je(e,"show_overlay",!1),this.loadTime=je(e,"load_time",0),this.promptAgain=je(e,"prompt_again",24),this.optInType=je(e,"opt_in_type",dn.TWO_STEP),this.isWebPushEnabled=je(e,"is_enabled",!1),this.optInPreview=new xn(je(e,"opt_in_preview",{})),this.overlay=je(e,"overlay",null),this.webPushPlatformData=new Hn(e.web_push_platform_data),this.isPushSubBilling=je(e,"sub_billing",!1),this.isBrandingHidden=je(e,"hide_moe_branding",!1),this.configs=new kn(e)}}(Object.assign(Object.assign({},t.webData),a));Wn.updateLocalStorage(r),Wn.isAppBlocked(r)?i(!1):(Wn.sdkSettings=r,yt.set(s,(null===(e=Wn.sdkSettings)||void 0===e?void 0:e.isDomainLevelStorage)||!1),n(r))})).catch((e=>{Xe.error(1,t,"Config API failed",e)}))}catch(a){Xe.error(1,t,"Settings APi Failed: ",a),Wn.webSdkApiRetries{Wn.webSdkApiRetries++,n(Wn.getAndPersistWebSettings(e))}),3e3*Wn.webSdkApiRetries):i(!1)}var c}))))}static isAppBlocked(e){return!(!e||!e.configs||!1!==e.configs.isAppActive)}static getInitData(){let e=vt.get();return null!=e&&null!=e.appId||(e=new vt(ft.get(r.INIT_DATA))),e}static updateLocalStorage(e){var t=(new Date).getTime();ft.set(r.WEB_SETTINGS,e),ft.set(r.SETUP_TIME,t),ft.set(r.SDK_VERSION,qe().getSdkVersion())}}Wn.BASE_LOG_TAG="CoreApi",Wn.RESET_DURATION_IN_HOURS=24,Wn.API_URLS={SETTINGS:e=>e+"v2/websdksettings",CONFIG:(e,t,n)=>e+`v3/sdkconfig/${t}/`+n},Wn.webSdkApiRetries=1,Wn.WEB_SDK_API_MAX_RETRIES=3;var $n=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};function Gn(){return $n(this,void 0,void 0,(function*(){return yield tt.metaStore.getItem(Te.LAST_META_CALL_TIME)}))}function Kn(){return $n(this,void 0,void 0,(function*(){return yield tt.metaStore.removeItem(Te.LAST_META_CALL_TIME)}))}function Vn(e,t,n){return e?t:n||""}function jn(e){return $n(this,void 0,void 0,(function*(){var t=e.reduce(((e,t)=>((t.displayControls.is_pin?e.pinned:e.nonPinned).push(t),e)),{pinned:[],nonPinned:[]});const n=zn([...t.pinned]);return t=zn([...t.nonPinned]),n.concat(t)}))}function zn(e){return e.sort(((e,t)=>t.updatedAt-e.updatedAt))}const qn=()=>{var e=window.moengage_object||"Moengage";return window[e]},Yn=()=>window.moengage_object||"Moengage";function Jn(){var{appId:e,baseDomainName:t}=ft.get(r.INIT_DATA);return{appId:e,baseDomainName:t}}function Xn(e){const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild}var Qn=function(e,t,n,i){return new(n=n||Promise)((function(a,r){function o(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((i=i.apply(e,t||[])).next())}))};class Zn{constructor(e){this.requestId=je(e,"request_id",null),this.status=je(e,"status",!0),this.data=new ei(je(e,"data",null))}static get(){return Qn(this,void 0,void 0,(function*(){const e=[];return yield tt.campaignStore.iterate(((t,n)=>{e.push(t)})),e}))}static getVisibleCards(){return Qn(this,void 0,void 0,(function*(){const e=[],t=(new Date).getTime();return yield tt.campaignStore.iterate((n=>{var{displayControls:i,userActivity:a}=n,{first_delivered:r,first_seen:o}=a,s=ei.getShowCount(n),{show_time:l,max_times_to_show:d,expire_after_delivered:c,expire_at:a,expire_after_seen:i}=i;"show"!==n.status||d<=s||l&&!function(e,t){const n=new Date,i=new Date(n.getTime());i.setHours(e.split(":")[0]),i.setMinutes(e.split(":")[1]);const a=new Date(n.getTime());return a.setHours(t.split(":")[0]),a.setMinutes(t.split(":")[1]),i<=n&&a>n}(null==l?void 0:l.start_time,null==l?void 0:l.end_time)||1e3*a{e.push(t.id)})),e}))}static getCategories(){return Qn(this,void 0,void 0,(function*(){return yield tt.metaStore.getItem(Oe)}))}static showAllTabs(){return Qn(this,void 0,void 0,(function*(){return yield tt.metaStore.getItem(Te.SHOW_ALL_TAB)}))}}class ei{constructor(e){this.showAllTab=je(e,"show_all_tab",!0),this.cardCategories=je(e,"card_categories",[]),this.syncIntervals=new ti(je(e,"sync_intervals")),this.deletedCardIds=je(e,"deleted_card_ids",[]);const t=je(e,"cards",[]);this.cards=t.map((e=>new ni(e))),this.accessibility=new ii(je(e,"accessibility",{}))}static getCardInfo(e){return Qn(this,void 0,void 0,(function*(){return yield tt.campaignStore.getItem(e)}))}static setCardInfo(e,t){return Qn(this,void 0,void 0,(function*(){return yield tt.campaignStore.setItem(e,t)}))}static removeCard(e){return Qn(this,void 0,void 0,(function*(){yield tt.campaignStore.removeItem(e)}))}static getShowCount(e,t){const n=e.userActivity.show_count;return t&&n?n&&n[t]?n[t]:0:n?Object.keys(n).reduce(((e,t)=>(0{this.accessibiltyAltText=e}))}init(){return ui(this,void 0,void 0,(function*(){this.cardsCategories=(yield Zn.showAllTabs())?["All"].concat(yield Zn.getCategories()):yield Zn.getCategories(),this.cards=(yield Zn.getVisibleCards())||[],this.isError=this.isErrorPage()}))}cardFrame(){return ui(this,void 0,void 0,(function*(){var e=this.cardsConfig.navigationBar;return`\n \n \n