!function(e){!function(e){"use strict";var t,i,r,n,o,a,s,d,c,l,u,p,g,v,h,m,w,y,f,I,C,b,S,E=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},P=(e,t,i)=>(E(e,t,"read from private field"),i?i.call(e):t.get(e)),T=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},_=(e,t,i,r)=>(E(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),D=(e,t,i)=>(E(e,t,"access private method"),i),V=(e=>(e["SetDomain"]="setDomain",e["SetListToken"]="setListToken",e["SetUserId"]="setUserId",e["SetEvent"]="setEvent",e["SetCookie"]="setCookie",e["SetAutoFunnelData"]="setAutoFunnelData",e["Push"]="push",e["SetCustomServiceWorkerPath"]="setCustomSwPath",e["ViewItem"]="viewItem",e["ViewCategory"]="viewCategory",e["LikeItem"]="likeItem",e["UnlikeItem"]="unlikeItem",e["WishListItem"]="wishlistItem",e["Purchase"]="orderPlaced",e["CartUpdate"]="cartUpdate",e["ShopifyAbandonedCart"]="shopifyAbandonedCart",e["SaveEvent"]="saveEvent",e["FlushEvents"]="flushEvents",e["SetUserDevice"]="setUserDevice",e["SetUserLocation"]="setUserLocation",e["SetVisitUrlPath"]="setVisitUrlPath",e["SetLastActivityDate"]="setLastActivityDate",e["SetIsNewVisitor"]="setIsNewVisitor",e["SetHasUserVisitPage"]="setHasUserVisitPage",e["SetRawEvent"]="setRawEvent",e["ImportScript"]="importScript",e["DelayScript"]="delayScript",e["InitScript"]="initScript",e))(V||{});(S=b||(b={}))["PageVisit"]="visit",S["Popup"]="popup",S["ViewItem"]="view_item",S["ViewCategory"]="view_category",S["WishlistItem"]="wishlist_item",S["LikeItem"]="like_item",S["UnlikeItem"]="unlike_item",S["OrderPlaced"]="order_placed",S["Cart"]="cart_update",void(S["ShopifyAbandonedCart"]="shopify_webhook_abandoned_cart");class k extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}}class A extends k{constructor(e){super(e)}}const O={cartToken:"string",urlToken:"string",visitorEmail:"string"},L=["cartToken","urlToken"];var U,x,N,F,W,R,z,B,M,j,J,G,q,H;(H=U||(U={}))["Inline"]="inline",void(H["Popup"]="popup"),(q=x||(x={}))["Hq"]="Hq",void(q["Us"]="Us"),void((N||(N={}))["UserAid"]="X-Aid"),(G=F||(F={}))[G["OneSecond"]=1e3]="OneSecond",G[G["OneMinute"]=6e4]="OneMinute",G[G["OneHour"]=36e5]="OneHour",G[G["OneDay"]=864e5]="OneDay",void(G[G["OneWeek"]=6048e5]="OneWeek"),(J=W||(W={}))["Active"]="active",void(J["Inactive"]="inactive"),(j=R||(R={}))["EveryTime"]="everyTime",void(j["OnceEveryAmountTime"]="onceEveryAmountTime"),void((z||(z={}))["RemoveLastTransitionNodeEnter"]="removeLastTransitionNodeEnter"),(M=B||(B={}))["ReactSendWebPush"]="react_web_webpush",M["ReactCollectWebPushConsent"]="react_web_collect_webpush_subscription",M["ReactShowPopup"]="react_web_popup",M["FilterWebUrl"]="filter_web_url",M["FilterWebSubscribers"]="filter_web_subscriber",M["FilterLocation"]="filter_web_geolocation",M["FilterDevice"]="filter_web_device",M["FilterReturningVisitor"]="filter_web_returning_visitor",M["ConditionProductViewed"]="await_web_view_item_event",M["ConditionCategoryViewed"]="await_web_view_category_event",M["ConditionWebPushConsent"]="await_web_webpush_subscribe",M["ConditionProductLiked"]="await_web_like_item_event",M["ConditionWebAction"]="await_web_action",M["TransferToBackend"]="react_backend_transfer",M["AwaitScroll"]="await_scroll",void(M["ShowPopup"]="react_popup");var $=(e=>(e["UuidHasBeenSet"]="grUuidHasBeenSet",e["PopupsRendererCustomUrl"]="grPopupsRendererCustomUrl",e))($||{});const X="_grDebugMode",Z=new class{isDebugEnabled(){return!!window.sessionStorage.getItem(X)}startDebug(){window.sessionStorage.setItem(X,"true")}},Q=new class{get isLoggingEnabled(){return Z.isDebugEnabled()}log(...e){this.displayLog("log",...e)}info(...e){this.displayLog("info",...e)}error(...e){if(e[0]instanceof Error)e.push(e[0].stack);this.displayLog("error",...e)}forceLogError(...e){if(e[0]instanceof Error)e.push(e[0].stack);console.error(...e)}warn(...e){this.displayLog("warn",...e)}displayLog(e,...t){if(this.isLoggingEnabled)console[e](...t)}};class Y{constructor(){T(this,t,new Proxy({},{get(e,t){if(t in e)return e[t];else return e[t]=[],e[t]}}))}addEvent(e,i){P(this,t)[e].push(i)}drainEvents(e){const i=P(this,t)[e];return P(this,t)[e]=[],i}getEvents(e){return P(this,t)[e]}hasDelayedEvents(e){return P(this,t)[e].length>0}}t=new WeakMap,i=new WeakMap,r=new WeakMap;const K=new class{constructor(){T(this,i,{}),T(this,r,new Y)}publish(e,...t){var n;if(null==(n=P(this,i)[e])?void 0:n.length)P(this,i)[e].forEach((i=>{i(...t),Q.log(`Event ${e} published with arguments'`,...t)}));else P(this,r).addEvent(e,t)}subscribe(e,t,n={}){const{preventEventDraining:o,ignoreQueuedEvents:a}=n;if(!P(this,i)[e])P(this,i)[e]=[];if(P(this,r).hasDelayedEvents(e)&&!a)if(o)P(this,r).getEvents(e).forEach((e=>t(...e)));else P(this,r).drainEvents(e).forEach((e=>t(...e)));if(n.signal)n.signal.addEventListener("abort",(()=>{this.unsubscribe(e,t)}),{once:true});P(this,i)[e].push(t)}unsubscribe(e,t){var r;const n=null==(r=P(this,i)[e])?void 0:r.indexOf(t);if(n>-1)P(this,i)[e].splice(n,1)}removeListeners(e){delete P(this,i)[e]}};var ee=(e=>(e["DeviceType"]="debug_device_type",e["Location"]="debug_location",e["VisitUrlPath"]="debug_visit_url_path",e["BrowserStorageLastActivityDate"]="debug_browser_storage_last_activity_date",e["NewVisitor"]="debug_new_visitor",e["HasUserVisitPage"]="debug_has_user_visit_page",e["Events"]="debug_events",e))(ee||{});function te(){const e=e=>{const t=sessionStorage.getItem(e);if(t){if([ee.DeviceType,ee.VisitUrlPath,ee.Location].includes(e))return t;if(e===ee.BrowserStorageLastActivityDate){const e=new Date(t);return isNaN(e.getTime())?void 0:e}if([ee.NewVisitor,ee.HasUserVisitPage,ee.Events].includes(e))try{return JSON.parse(t)}catch(i){Q.error(`Invalid debug data for: ${e}`)}}};return{enabled:true,data:{[ee.DeviceType]:e(ee.DeviceType),[ee.BrowserStorageLastActivityDate]:e(ee.BrowserStorageLastActivityDate),[ee.Location]:e(ee.Location),[ee.NewVisitor]:e(ee.NewVisitor),[ee.VisitUrlPath]:e(ee.VisitUrlPath),[ee.HasUserVisitPage]:e(ee.HasUserVisitPage),[ee.Events]:e(ee.Events)}}}n=new WeakMap;const ie=new class{constructor(){T(this,n,{[b.LikeItem]:[],[b.OrderPlaced]:[],[b.UnlikeItem]:[],[b.ViewCategory]:[],[b.ViewItem]:[],[b.WishlistItem]:[],[b.PageVisit]:[],[b.Popup]:[],[b.Cart]:[]})}getEvents(e){return Promise.resolve(P(this,n)[e])}getAllEvents(){return Promise.resolve(Object.values(P(this,n)).flat(1))}getAllECommerceEvents(){return Promise.resolve([...P(this,n)[b.ViewItem],...P(this,n)[b.ViewCategory],...P(this,n)[b.LikeItem],...P(this,n)[b.UnlikeItem],...P(this,n)[b.WishlistItem],...P(this,n)[b.OrderPlaced],...P(this,n)[b.Cart]])}getAllPopupEvents(){return Promise.resolve([...P(this,n)[b.Popup]])}saveEvent(e){return P(this,n)[e.eventType].push(e),Promise.resolve()}};var re=(e=>(e["v2"]="v2",e["af"]="af",e["wp"]="wp",e["we"]="we",e["ec"]="ec",e))(re||{}),ne=(e=>(e["v2"]="GRV2",e["af"]="GRAF",e["wp"]="GRWP",e["we"]="GRWE",e["ec"]="GREC",e))(ne||{});const oe={[re.af]:"autoFunnel",[re.ec]:"ecommerce",[re.v2]:"tracking",[re.we]:"webEvents",[re.wp]:"webPush"};o=new WeakSet,a=e=>oe[e];const ae=new class{constructor(){T(this,o)}setScriptInitialized(e){const t=D(this,o,a).call(this,e);window.__grIntegrationConfig[t].isModuleInitialized=true}isScriptInitialized(e){var t,i;const r=D(this,o,a).call(this,e);return(null==(i=null==(t=null==window?void 0:window.__grIntegrationConfig)?void 0:t[r])?void 0:i.isModuleInitialized)??false}};if(false){if("undefined"!=typeof navigator&&"ReactNative"===navigator.product&&"undefined"==typeof crypto)throw new Error("React Native does not have a built-in secure random generator. If you don’t need unpredictable IDs use `nanoid/non-secure`. For secure IDs, import `react-native-get-random-values` before Nano ID.");if("undefined"!=typeof msCrypto&&"undefined"==typeof crypto)throw new Error("Import file with `if (!window.crypto) window.crypto = window.msCrypto` before importing Nano ID to fix IE 11 support");if("undefined"==typeof crypto)throw new Error("Your browser does not have secure random generator. If you don’t need unpredictable IDs, you can use nanoid/non-secure.")}function se(e){const t=document.cookie.match(new RegExp(`(^| )${e}=([^;]+)`));if(t)return t[2]}var de=(e=>(e["visitorUuid"]="gaVisitorUuid",e["visitorValuable"]="gaIsValuable",e["VisitorEmail"]="gaVisitorEId",e["VisitorResubscribed"]="gaVisitorResubscribed",e["NotificationConsentAcceptedFromPrompt"]="gaWpnConAcc",e["NotificationConsentCustomPromptRejectedDEPRECATED"]="gaWpnConRej-{promptId}",e["NotificationConsentCustomPromptRejected"]="gaWpnConRej-promptId",e))(de||{});const ce=new class{constructor(){this.timer=Date.now()}getCurrentVisitOnPageTime(){return Date.now()-this.timer}resetTimer(){this.timer=Date.now()}};s=new WeakMap,d=new WeakMap,c=new WeakMap,l=new WeakSet,u=function(){if(!P(this,s))window.history.pushState=new Proxy(window.history.pushState,{apply:(e,t,i)=>{const r=e.apply(t,i);for(const o of Array.from(P(this,d)))try{o.apply(t,i)}catch(n){Q.error("Push state callback error",n)}return r}}),window.history.replaceState=new Proxy(window.history.replaceState,{apply:(e,t,i)=>{const r=e.apply(t,i);for(const o of Array.from(P(this,c)))try{o.apply(t,i)}catch(n){Q.error("Replace state callback error",n)}return r}}),_(this,s,true)};const le=new class{constructor(){T(this,l),T(this,s,false),T(this,d,new Set),T(this,c,new Set)}init(){D(this,l,u).call(this)}onPushState(e,t={}){var i;if(!(null==(i=t.signal)?void 0:i.aborted))if(P(this,d).add(e),t.signal)t.signal.addEventListener("abort",(()=>{this.removePushStateListener(e)}),{once:true})}onReplaceState(e,t={}){var i;if(!(null==(i=t.signal)?void 0:i.aborted))if(P(this,c).add(e),t.signal)t.signal.addEventListener("abort",(()=>{this.removeReplaceStateListener(e)}),{once:true})}removePushStateListener(e){P(this,d).delete(e)}removeReplaceStateListener(e){P(this,c).delete(e)}};le.init();const ue=new class{constructor(){this.scriptModuleManager=ae}initialize(e){const{xsid:t,grid:i,clientLatestGrid:r,domain:n,aid:o,useNOStorage:a,useBetterSubscriberIdentification:s,isServedFromCustomDomain:d,scriptsDomain:c,scriptsVersion:l,tracking:u,isDebugMode:p,uuuid:g}=e;if(p)Z.startDebug();window.__grIntegrationConfig=window.__grIntegrationConfig||{cData:{aid:o,grid:i,domain:n,useNOStorage:a,useBetterSubscriberIdentification:s,isServedFromCustomDomain:d,clientLatestGrid:r,uuuid:g},visitor:{email:null,eComId:null,xsid:t},tracking:{isModuleInitialized:false,isEnabled:u},webEvents:{isModuleInitialized:false,visitorApplicationEndpoint:null,automationJourneyGraphs:{},webPushActivePromptGraph:null,popupGraphs:{}},webPush:{isModuleInitialized:false,customSwPath:null,wpid:null,pushDomain:null,promptEndpoint:null},analyticsData:{scriptsDomain:c,scriptsVersion:l},ecommerce:{isModuleInitialized:false},autoFunnel:{isModuleInitialized:false},eventBus:K,temporaryEventsStorage:ie,vts:ce,phs:le,debug:p?te():void 0,delayedScripts:{},scriptTypesInitialized:new Set}}canUseBackendForSubscriberIdentification(){return window.__grIntegrationConfig.cData.useBetterSubscriberIdentification}getUserAid(){return window.__grIntegrationConfig.cData.aid}getClientLatestGrid(){return window.__grIntegrationConfig.cData.clientLatestGrid}getVisitorUuid(){return se(de.visitorUuid)}getUserAnalyticsDomain(){return window.__grIntegrationConfig.cData.domain}getUserUuid(){return window.__grIntegrationConfig.cData.uuuid}enablePopupDevMode(){window.__grIntegrationConfig.setCustomPopupRendererUrl=e=>{window.sessionStorage.setItem($.PopupsRendererCustomUrl,e)}}getPopupRendererCustomUrl(){return window.sessionStorage.getItem($.PopupsRendererCustomUrl)}setCustomSwPath(e){if("string"!=typeof e)throw new Error("Path type must be string");if(!e.match(/gr_sw_main.js|service-worker\/service-worker.js$/))throw new Error("Invalid sw file name");window.__grIntegrationConfig.webPush.customSwPath=e}getCustomSwPath(){var e;return null==(e=window.__grIntegrationConfig)?void 0:e.webPush.customSwPath}isTrackingEnabled(){return window.__grIntegrationConfig.tracking.isEnabled}isTrackingScriptServedFromCustomDomain(){return window.__grIntegrationConfig.cData.isServedFromCustomDomain}set visitorEmail(e){window.__grIntegrationConfig.visitor.email=e}get visitorEmail(){return window.__grIntegrationConfig.visitor.email}get pushWpid(){return window.__grIntegrationConfig.webPush.wpid}set pushWpid(e){window.__grIntegrationConfig.webPush.wpid=e}set pushDomain(e){window.__grIntegrationConfig.webPush.pushDomain=e}get pushDomain(){return window.__grIntegrationConfig.webPush.pushDomain}set pushPromptEndpoint(e){window.__grIntegrationConfig.webPush.promptEndpoint=e}get pushPromptEndpoint(){return window.__grIntegrationConfig.webPush.promptEndpoint}get eventBus(){return window.__grIntegrationConfig.eventBus}get canUseBackendStorageForEvents(){return window.__grIntegrationConfig.cData.useNOStorage}get webConnectScriptCdnUrl(){return window.__grIntegrationConfig.analyticsData.scriptsDomain}get webConnectCurrentScriptsVersion(){return window.__grIntegrationConfig.analyticsData.scriptsVersion}get isDebug(){var e,t;return!!(null==(t=null==(e=window.__grIntegrationConfig)?void 0:e.debug)?void 0:t.enabled)}set debugObject(e){window.__grIntegrationConfig.debug=e}get debugObject(){var e;return null==(e=window.__grIntegrationConfig)?void 0:e.debug}get delayedScripts(){var e;return(null==(e=window.__grIntegrationConfig)?void 0:e.delayedScripts)||{}}set delayedScripts(e){window.__grIntegrationConfig.delayedScripts=e}set visitorApplicationEndpoint(e){window.__grIntegrationConfig.webEvents.visitorApplicationEndpoint=e}get visitorApplicationEndpoint(){return window.__grIntegrationConfig.webEvents.visitorApplicationEndpoint}get userEventsStorageApplicationUrl(){return window.__grIntegrationConfig.ecommerce.webEventsSearchApplicationEndpoint}set userEventsStorageApplicationUrl(e){window.__grIntegrationConfig.ecommerce.webEventsSearchApplicationEndpoint=e}get temporaryEventsStorage(){return window.__grIntegrationConfig.temporaryEventsStorage}get automationJourneyGraphs(){return window.__grIntegrationConfig.webEvents.automationJourneyGraphs}get webPushActivePromptGraph(){return window.__grIntegrationConfig.webEvents.webPushActivePromptGraph}set webPushActivePromptGraph(e){window.__grIntegrationConfig.webEvents.webPushActivePromptGraph=e}get popupGraphs(){return window.__grIntegrationConfig.webEvents.popupGraphs}get visitorXsid(){return window.__grIntegrationConfig.visitor.xsid}get visitorTimeService(){return window.__grIntegrationConfig.vts}get pageHistoryService(){return window.__grIntegrationConfig.phs}};var pe,ge,ve,he,me,we,ye,fe,Ie,Ce,be,Se,Ee,Pe,Te,_e,De,Ve,ke,Ae,Oe,Le,Ue,xe,Ne,Fe,We,Re,ze,Be,Me,je,Je,Ge,qe,He,$e,Xe,Ze,Qe,Ye=(e=>(e["Show"]="show",e["Close"]="close",e["Submit"]="submit",e))(Ye||{}),Ke=(e=>(e["One"]="1.0",e))(Ke||{}),et=(e=>(e["Web"]="web",e["Mobile"]="mobile",e))(et||{});(Qe=pe||(pe={}))["ShowWhenCondition"]="showWhenCondition",Qe["VisitorsCondition"]="visitors",Qe["DeviceCondition"]="device",Qe["LocationCondition"]="location",Qe["ECommerceCondition"]="ecommerce",Qe["TriggerFrequency"]="frequency",Qe["PreventDisplay"]="preventDisplay",void(Qe["DateRange"]="dateRange"),(Ze=ge||(ge={}))["Mobile"]="mobile",Ze["Tablet"]="tablet",void(Ze["Desktop"]="desktop"),(Xe=ve||(ve={}))["All"]="all",Xe["New"]="new",void(Xe["Returning"]="returning"),void((he||(he={}))["All"]="all"),($e=me||(me={}))["ConditionsLogicSeparator"]="conditionsLogicSeparator",void($e["ECommerceConditions"]="ecommerceConditions"),(He=we||(we={}))["Amount"]="amount",void(He["Date"]="date"),(qe=ye||(ye={}))["And"]="and",void(qe["Or"]="or"),(Ge=fe||(fe={}))["Exactly"]="exactly",Ge["LessThan"]="lessThan",void(Ge["MoreThan"]="moreThan"),(Je=Ie||(Ie={}))["LastDays"]="lastDays",void(Je["DateRange"]="dateRange"),(je=Ce||(Ce={}))["AnyProduct"]="any",je["AnyCategory"]="any",je["AnyProductLiked"]="any",je["AnyProductInPlacedOrder"]="any",je["AnyCategoryInPlacedOrder"]="any",je["AnyProductInUpdatedCart"]="any",void(je["AnyCategoryInUpdatedCart"]="any"),(Me=be||(be={}))["PastEvents"]="filter",void(Me["FutureEvents"]="await"),(Be=Se||(Se={}))["Category"]="category",void(Be["Product"]="product"),void((Ee||(Ee={}))["Product"]="product"),(ze=Pe||(Pe={}))["ViewProductOrCategory"]="productOrCategoryView",ze["LikeProduct"]="likeItem",ze["OrderPlaced"]="orderPlaced",void(ze["CartUpdated"]="cartUpdated"),(Re=Te||(Te={}))["Percent"]="percent",void(Re["Selector"]="selector"),(We=_e||(_e={}))["Instantly"]="instantly",We["Delay"]="delay",We["Exit"]="exit",We["Scroll"]="scroll",We["Inactivity"]="inactivity",void(We["Click"]="click"),(Fe=De||(De={}))["AfterSubmit"]="submit",Fe["AfterClose"]="close",void(Fe["AfterTimes"]="timesAmount"),(Ne=Ve||(Ve={}))["Always"]="always",Ne["Session"]="session",void(Ne["EveryDays"]="everyDays"),(xe=ke||(ke={}))["Exactly"]="equal",xe["LessThan"]="lessThan",void(xe["MoreThan"]="moreThan"),(Ue=Ae||(Ae={}))["Exactly"]="equal",Ue["LessThan"]="lessThan",void(Ue["MoreThan"]="moreThan"),(Le=Oe||(Oe={}))[Le["InvalidCssSelector"]=1]="InvalidCssSelector",Le[Le["EmptyCssSelector"]=2]="EmptyCssSelector",Le[Le["CssSelectorTooLong"]=3]="CssSelectorTooLong",Le[Le["CssInvalidType"]=4]="CssInvalidType",Le[Le["InvalidTimeoutProperty"]=5]="InvalidTimeoutProperty",Le[Le["ShowWhenScrollPercentInvalidValueType"]=6]="ShowWhenScrollPercentInvalidValueType",Le[Le["ShowWhenScrollPercentValueOutOfBound"]=7]="ShowWhenScrollPercentValueOutOfBound",Le[Le["VisitorTriggerEmpty"]=8]="VisitorTriggerEmpty",Le[Le["VisitorTriggerInvalidProperty"]=9]="VisitorTriggerInvalidProperty",Le[Le["DevicesTriggerEmpty"]=10]="DevicesTriggerEmpty",Le[Le["DevicesTriggerInvalidValue"]=11]="DevicesTriggerInvalidValue",Le[Le["FrequencyEmptyTrigger"]=12]="FrequencyEmptyTrigger",Le[Le["FrequencyTriggerInvalidName"]=13]="FrequencyTriggerInvalidName",Le[Le["FrequencyTriggerNDaysInvalidPropertyValue"]=14]="FrequencyTriggerNDaysInvalidPropertyValue",Le[Le["FrequencyTriggerNDaysEmptyValue"]=15]="FrequencyTriggerNDaysEmptyValue",Le[Le["PreventDisplayTriggerInvalidName"]=16]="PreventDisplayTriggerInvalidName",Le[Le["PreventDisplayTriggerAfterTimesNoValue"]=17]="PreventDisplayTriggerAfterTimesNoValue",Le[Le["PreventDisplayTriggerAfterTimesInvalidValue"]=18]="PreventDisplayTriggerAfterTimesInvalidValue",Le[Le["DateRangeInvalidFromDate"]=19]="DateRangeInvalidFromDate",Le[Le["DateRangeInvalidToDate"]=20]="DateRangeInvalidToDate",Le[Le["DateRangeDateFromAfterDateTo"]=21]="DateRangeDateFromAfterDateTo",Le[Le["LocationEmptyTrigger"]=22]="LocationEmptyTrigger",Le[Le["LocationInvalidType"]=23]="LocationInvalidType",Le[Le["LackOfLogicSeparator"]=24]="LackOfLogicSeparator",Le[Le["LackOfTriggerConditions"]=25]="LackOfTriggerConditions",Le[Le["InvalidTriggerConditions"]=26]="InvalidTriggerConditions",Le[Le["NoProductOrCategorySelected"]=27]="NoProductOrCategorySelected",Le[Le["ProductInvalidType"]=28]="ProductInvalidType",Le[Le["CategoryInvalidType"]=29]="CategoryInvalidType",Le[Le["AmountInvalidConditionName"]=30]="AmountInvalidConditionName",Le[Le["AmountInvalidConditionValueType"]=31]="AmountInvalidConditionValueType",Le[Le["DateInvalidConditionName"]=32]="DateInvalidConditionName",Le[Le["DateLastDaysInvalidConditionValue"]=33]="DateLastDaysInvalidConditionValue",Le[Le["DateDateRangeInvalidConditionValue"]=34]="DateDateRangeInvalidConditionValue",Le[Le["DateDateRangeFromInvalidValue"]=35]="DateDateRangeFromInvalidValue",Le[Le["DateDateRangeToInvalidValue"]=36]="DateDateRangeToInvalidValue",Le[Le["DateDateRangeDateFromAfterDateTo"]=37]="DateDateRangeDateFromAfterDateTo",Le[Le["PopupTriggerInvalidName"]=38]="PopupTriggerInvalidName",Le[Le["PopupTriggerLackOfValuesInLikeItemTrigger"]=39]="PopupTriggerLackOfValuesInLikeItemTrigger",Le[Le["PopupTriggerLikeItemInvalidValues"]=40]="PopupTriggerLikeItemInvalidValues",Le[Le["PopupTriggerOrderPlacedNoConditions"]=41]="PopupTriggerOrderPlacedNoConditions",Le[Le["PopupTriggerOrderPlacedInvalidProducts"]=42]="PopupTriggerOrderPlacedInvalidProducts",Le[Le["PopupTriggerOrderPlacedInvalidCategories"]=43]="PopupTriggerOrderPlacedInvalidCategories",Le[Le["PopupTriggerCartUpdatedNoConditions"]=44]="PopupTriggerCartUpdatedNoConditions",Le[Le["PopupTriggerCartUpdatedInvalidProducts"]=45]="PopupTriggerCartUpdatedInvalidProducts",Le[Le["PopupTriggerCartUpdatedInvalidCategories"]=46]="PopupTriggerCartUpdatedInvalidCategories",Le[Le["PopupTriggerPriceValueConditionInvalidComparator"]=47]="PopupTriggerPriceValueConditionInvalidComparator",Le[Le["PopupTriggerPriceValueConditionInvalidValue"]=48]="PopupTriggerPriceValueConditionInvalidValue",Le[Le["PopupTriggerProductsAmountValueConditionInvalidComparator"]=49]="PopupTriggerProductsAmountValueConditionInvalidComparator",Le[Le["PopupTriggerProductsAmountValueConditionInvalidValue"]=50]="PopupTriggerProductsAmountValueConditionInvalidValue",void(Le[Le["PopupTriggerInvalidTriggerType"]=51]="PopupTriggerInvalidTriggerType");var tt=(e=>(e[e["Mobile"]=768]="Mobile",e[e["Tablet"]=1023]="Tablet",e))(tt||{});const it=Symbol("DeviceService");p=new WeakSet,g=()=>window.matchMedia("(any-pointer: coarse)").matches&&navigator.maxTouchPoints>0,v=new WeakSet,h=()=>window.matchMedia("(pointer: coarse)").matches&&navigator.maxTouchPoints>0;const rt=new class e{constructor(t){if(T(this,p),T(this,v),new.target===e&&t!==it)throw new Error(`Invalid ${new.target.name} constructor`)}detectDeviceTypeByScreenWidth(e){var t;const{availWidth:i,availHeight:r}=screen;let n=null==(t=screen.orientation)?void 0:t.type;if(!n)n=window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait";const o=n.match(/landscape/)?r:i;if(tt.Mobile>=o)return ge.Mobile;else if(o>tt.Mobile&&tt.Tablet>=o)return ge.Tablet;return e?ge.Tablet:ge.Desktop}isDesktopDevice(){return this.getDeviceType()===ge.Desktop}getDeviceType(){var e,t;const{userAgentData:i}=window.navigator;if(i){if(i.mobile)return ge.Mobile;else if((null==(e=i.platform)?void 0:e.toLowerCase().includes("android"))||(null==(t=i.platform)?void 0:t.toLowerCase().includes("ipad")))return ge.Tablet;else if(P(this,v,h))return ge.Tablet}else if(P(this,v,h))return this.detectDeviceTypeByScreenWidth(true);else if(P(this,p,g))return this.detectDeviceTypeByScreenWidth();return ge.Desktop}getBrowserLanguage(){const{language:e}=window.navigator;if(e.match(/\w{2}-\w{2}/))return e.split("-")[0].toLowerCase();else return e.toLowerCase()}getUserOs(){const{userAgentData:e}=window.navigator;if(e)return e.platform.toLowerCase();else return this.getOsFromUserAgent()}getOsFromUserAgent(){let e="unknown";const{userAgent:t}=navigator,i=t.toLowerCase();if(i.includes("win"))e="windows";if(i.includes("mac"))e="macos";if(i.includes("x11"))e="unix";if(i.includes("linux"))e="Linux";if(i.includes("android"))e="android";if(/iphone|ipad|ipod/.test(i))e="ios";return e}}(it),nt=new class{encodeEmail(e){return btoa(e)}decode(e){return atob(e)}isEncodedString(e){try{return atob(e),true}catch{return false}}validateEmail(e){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(e)}};class ot extends Error{constructor(e){super(e)}static create(...[e,t]){switch(e){case"email":return new ot(`Provided string ${t} is not valid email address`);default:void Q.error(`Unsupported value: ${e}`)}}}class at{constructor({e}={}){if(e)this.e=nt.encodeEmail(e)}static createFromContextData(e){try{if(nt.isEncodedString(e.e))e.e=nt.decode(e.e);return at.validate(e),new at(e)}catch(t){if(t instanceof ot)return Q.error(t),at.createBlank();throw t}}static createBlank(){return new at}static validate(e){if("e"in e&&!nt.validateEmail(e.e))throw ot.create("email",e.e)}toJSON(){return{...this}}}class st{constructor(e){T(this,m,void 0),this.eventType=e,_(this,m,null),this.eventId=null,this.aid=ue.getUserAid(),this.grid=ue.getClientLatestGrid(),this.time=ue.visitorTimeService.getCurrentVisitOnPageTime(),this.context=at.createBlank(),this.uuid=ue.getVisitorUuid(),this.url=window.location.href,this.occurredOn=new Date,this.tags=[]}get externalUid(){return P(this,m)}toJSON(){return{eventId:this.eventId,aid:this.aid,grid:this.aid,uuid:this.uuid,externalUid:this.externalUid,context:this.context.toJSON(),time:this.time,url:this.url,tags:this.tags,eventType:this.eventType,occurredOn:this.occurredOn.toUTCString()}}toString({normalized:e}={}){if(e)return JSON.stringify(this.normalizeForExternalStorage());else return JSON.stringify(this.toJSON())}normalize(){const{eventId:e,...t}=this.toJSON();return t}getBaseNormalizedEvent(){return{version:Ke.One,user_uuid:ue.getUserUuid(),time:this.time,tags:this.tags,occurred_on:this.occurredOn.toISOString(),url:this.url,app:{lang:rt.getBrowserLanguage(),device:rt.getDeviceType(),os:rt.getUserOs()},channel:et.Web,visitor:{uuid:this.uuid,external_id:this.externalUid,xsid:ue.visitorXsid}}}}m=new WeakMap;class dt extends st{constructor(e,t,i=at.createBlank()){super(b.Popup),this.popupEvent=e,this.popupId=t,this.context=i}toJSON(){return{...super.toJSON(),popupId:this.popupId,popupEvent:this.popupEvent}}normalizeForExternalStorage(){return{...this.getBaseNormalizedEvent(),event:{version:"1.0",name:b.Popup}}}}class ct extends st{toJSON(){return{...super.toJSON(),data:this.data}}normalizeForExternalStorage(){const e=this.getBaseNormalizedEvent();return{...e,event:{version:this.eventVersion,name:this.eventType,data:this.data},visitor:{uuid:e.visitor.uuid,external_id:e.visitor.external_id}}}}class lt extends st{constructor(e){super(b.ShopifyAbandonedCart),this.data=e}toJSON(){return{...super.toJSON(),data:this.data}}normalizeForExternalStorage(){return{...this.getBaseNormalizedEvent(),event:{version:"1.0",name:b.ShopifyAbandonedCart,data:this.data}}}}const ut=class e{constructor(e){T(this,w,void 0),_(this,w,e)}static create(t){return new e(t)}validate(e){return Object.entries(P(this,w)).reduce(((t,[i,r])=>{if(false===t)return t;if(null==e[i]&&r._isOptional)return t;else return r.call(e,e[i])}),true)}stringifySchemaShape(){var t;return D(t=e,y,f).call(t,P(this,w))}trim(e,t=P(this,w)){var i;const r={};for(const[n,o]of Object.entries(e))if("object"==typeof o&&null!==o){if(n in t){const e=null==(i=t[n])?void 0:i.valueShape;if(Array.isArray(o))if(e)r[n]=o.map((t=>this.trim(t,e)));else r[n]=o;else r[n]=this.trim(o,e)}}else if(n in t)r[n]=o;return r}static string(){return gt((e=>"string"==typeof e),(()=>"string"))}static number(){return gt((e=>"number"==typeof e),(()=>"number"))}static boolean(){return gt((e=>"boolean"==typeof e),(()=>"boolean"))}static dateString(){return gt((e=>{if("string"!=typeof e)return false;else return!Number.isNaN(new Date(e).getTime())}),(()=>"date string"))}static object(t){return gt((i=>{if(!t||"object"!=typeof t)return false;else return e.create(t).validate(i)}),(()=>D(this,y,f).call(this,t)),t)}static array(t){return gt((i=>{if(!Array.isArray(i))return false;if("function"==typeof t)return i.every((e=>t(e)));const r=e.create(t);return i.every((e=>r.validate(e)))}),(()=>`[${D(this,y,f).call(this,t)}]`),"function"==typeof t?void 0:t)}};w=new WeakMap,y=new WeakSet,f=e=>{const t={};if("function"==typeof e)return e.getValueType();else for(const[i,r]of Object.entries(e))t[i]=r.getValueType();try{return JSON.stringify(t).replaceAll('\\"','"')}catch{return"Failed to parse validation shape"}},T(ut,y);let pt=ut;function gt(e,t,i){if(e.optional=()=>(e._isOptional=true,e),e.getValueType=t,i)e.valueShape=i;return e}const vt={id:pt.string(),sku:pt.string().optional(),name:pt.string().optional(),vendor:pt.string().optional(),price:pt.string().optional(),currency:pt.string().optional()},ht=pt.array({id:pt.string(),name:pt.string().optional()}).optional(),mt={id:pt.string()},wt={shop:pt.object({...mt}).optional(),product:pt.object({...vt}),categories:ht},yt={product:pt.object({...vt}),categories:ht,quantity:pt.number()},ft=pt.create({...wt}),It=pt.create({shop:pt.object({...mt}).optional(),id:pt.string(),name:pt.string().optional()}),Ct=pt.create({...wt}),bt=pt.create({...wt}),St=pt.create({...wt}),Et=pt.create({orderId:pt.string(),cartId:pt.string().optional(),price:pt.number(),currency:pt.string(),products:pt.array(yt)}),Pt=pt.create({price:pt.number(),cartId:pt.string(),cartUrl:pt.string(),currency:pt.string(),products:pt.array(yt)});class Tt extends Error{constructor(e){super(`Data doesn't match required schema: ${e}`)}}class _t extends st{constructor(e=at.createBlank()){super(b.PageVisit),this.context=e}normalizeForExternalStorage(){return{...this.getBaseNormalizedEvent(),event:{version:"1.0",name:this.eventType}}}}const Dt={[b.ViewItem]:ft,[b.ViewCategory]:It,[b.WishlistItem]:Ct,[b.LikeItem]:bt,[b.UnlikeItem]:St,[b.OrderPlaced]:Et,[b.Cart]:Pt},Vt={[b.ViewItem]:class extends ct{constructor(e,t){super(b.ViewItem),this.data=e,this.context=t,this.eventVersion="1.0"}normalizeForExternalStorage(){const e=super.normalizeForExternalStorage();return e.event.data.product.price=parseFloat(e.event.data.product.price),e.time=ue.visitorTimeService.getCurrentVisitOnPageTime(),e}},[b.ViewCategory]:class extends ct{constructor(e,t){super(b.ViewCategory),this.data=e,this.context=t,this.eventVersion="1.0"}normalizeForExternalStorage(){const e=super.normalizeForExternalStorage();return e.time=ue.visitorTimeService.getCurrentVisitOnPageTime(),e}},[b.WishlistItem]:class extends ct{constructor(e,t){super(b.WishlistItem),this.data=e,this.context=t,this.eventVersion="1.0"}},[b.LikeItem]:class extends ct{constructor(e,t){super(b.LikeItem),this.data=e,this.context=t,this.eventVersion="1.0"}normalizeForExternalStorage(){const e=super.normalizeForExternalStorage();return e.event.data.product.price=parseFloat(e.event.data.product.price),e}},[b.UnlikeItem]:class extends ct{constructor(e,t){super(b.UnlikeItem),this.data=e,this.context=t,this.eventVersion="1.0"}normalizeForExternalStorage(){const e=super.normalizeForExternalStorage();return e.event.data.product.price=parseFloat(e.event.data.product.price),e}},[b.OrderPlaced]:class extends ct{constructor(e,t){super(b.OrderPlaced),this.data=e,this.context=t,this.eventVersion="1.0"}normalizeForExternalStorage(){const e=super.normalizeForExternalStorage();return e.event.data.products=e.event.data.products.map((e=>({...e,product:{...e.product,price:parseFloat(e.product.price)}}))),e}},[b.Cart]:class extends ct{constructor(e,t){super(b.Cart),this.data=e,this.context=t,this.eventVersion="1.0"}normalizeForExternalStorage(){const e=super.normalizeForExternalStorage();return e.event.data.products=e.event.data.products.map((e=>({...e,product:{...e.product,price:parseFloat(e.product.price)}}))),e}}},kt=class e{static getPageVisitEvent(){return new _t}static getPopupEvent({popupId:e,popupEventName:t}){return new dt(t,e)}static getPopupSubmitEvent(e){return new dt(Ye.Submit,e)}static getPopupShowEvent(e){return new dt(Ye.Show,e)}static getPopupCloseEvent(e){return new dt(Ye.Close,e)}static getViewItemEvent(t,i){var r;return D(r=e,I,C).call(r,b.ViewItem,t,i)}static getWishlistItemEvent(t,i){var r;return D(r=e,I,C).call(r,b.WishlistItem,t,i)}static getLikeItemEvent(t,i){var r;return D(r=e,I,C).call(r,b.LikeItem,t,i)}static getUnlikeItemEvent(t,i){var r;return D(r=e,I,C).call(r,b.UnlikeItem,t,i)}static getViewCategoryEvent(t,i){var r;return D(r=e,I,C).call(r,b.ViewCategory,t,i)}static getOrderPlacedEvent(t,i){var r;return D(r=e,I,C).call(r,b.OrderPlaced,t,i)}static getCartUpdateEvent(t,i){var r;return D(r=e,I,C).call(r,b.Cart,t,i)}static getShopifyIntegrationAbandonedCartEvent(e){try{return(e=>{if("object"!=typeof e||null===e)throw new A("Invalid data parameter type");else{const t=Object.entries(O),i=Object.keys(e);if(!L.every((e=>i.includes(e))))throw new A("Lack of required parameters");if(!t.every((([t,i])=>!e[t]||typeof e[t]===i)))throw new A("Properties have invalid type")}return true})(e),new lt((t=e,i=Object.keys(O),Object.entries(t).reduce(((e,[t,r])=>{if(i.includes(t))e[t]=r;return e}),{})))}catch(r){return Q.error(r),null}var t,i}};I=new WeakSet,C=(e,t,i)=>{const r=Dt[e],n=Vt[e];if(!r||!n)throw new Error("Event type not supported in event factory");if(!r.validate(t))throw new Tt(r.stringifySchemaShape());return new n(r.trim(t),i)},T(kt,I);let At=kt;const Ot=new class{sendShopifyWebhookAbandonedCartEvent(e){(class{static sendJSON(e,t,i=true){const r=i?JSON.stringify({...JSON.parse(t),[N.UserAid]:ue.getUserAid()}):t;navigator.sendBeacon(e,new Blob([r],{type:"application/json"}))}}).sendJSON(new URL("activity/abandoned-cart",ue.getUserAnalyticsDomain()).href,JSON.stringify({...e.toJSON(),isUuidValuable:!!se(de.visitorValuable)}))}};class Lt{constructor(){this.onECommerceShopifyAbandonedCart=e=>{const t=At.getShopifyIntegrationAbandonedCartEvent(e);Ot.sendShopifyWebhookAbandonedCartEvent(t)}}static getInstance(){return new Lt}initialize(){ue.eventBus.subscribe(V.ShopifyAbandonedCart,this.onECommerceShopifyAbandonedCart)}}const Ut=new class{isScriptDelayed(e){return Object.keys(ue.delayedScripts).includes(e)}delay(e){if(!this.isScriptDelayed(e))ue.delayedScripts={...ue.delayedScripts,[e]:void 0}}storeDelayedScriptParams(e,t){if(this.isScriptDelayed(e))ue.delayedScripts={...ue.delayedScripts,[e]:t}}initScript(e){var t;const i=ue.delayedScripts[e];if(i){ue.delayedScripts=Object.fromEntries(Object.entries(ue.delayedScripts).filter((([t])=>t!==e)));const r=ne[e];null==(t=null==window?void 0:window[r])?void 0:t.init(...i)}}},xt=new class{constructor(){this.eCommerceShopify=new Lt,this.onViewItemEvent=(e,t={})=>{this.handleECommerceItemEvent(b.ViewItem,e,t)},this.onWishlistItemEvent=(e,t={})=>{this.handleECommerceItemEvent(b.WishlistItem,e,t,false)},this.onLikeItemEvent=(e,t={})=>{this.handleECommerceItemEvent(b.LikeItem,e,t)},this.onUnlikeItemEvent=(e,t={})=>{this.handleECommerceItemEvent(b.UnlikeItem,e,t)},this.onViewCategoryEvent=(e,t={})=>{this.handleECommerceItemEvent(b.ViewCategory,e,t)},this.onPurchaseItemsEvent=(e,t={})=>{this.handleECommerceItemEvent(b.OrderPlaced,e,t)},this.onCartUpdateEvent=(e,t={})=>{this.handleECommerceItemEvent(b.Cart,e,t)}}initialize(){this.eCommerceShopify.initialize(),this.attachEvents()}attachEvents(){ue.eventBus.subscribe(V.ViewItem,this.onViewItemEvent),ue.eventBus.subscribe(V.ViewCategory,this.onViewCategoryEvent),ue.eventBus.subscribe(V.WishListItem,this.onWishlistItemEvent),ue.eventBus.subscribe(V.LikeItem,this.onLikeItemEvent),ue.eventBus.subscribe(V.UnlikeItem,this.onUnlikeItemEvent),ue.eventBus.subscribe(V.Purchase,this.onPurchaseItemsEvent),ue.eventBus.subscribe(V.CartUpdate,this.onCartUpdateEvent)}handleECommerceItemEvent(e,t,i,r=true){ue.eventBus.publish(V.SaveEvent,{sendToBackend:r},at.createFromContextData(i),e,t)}};e.init=(e="{}")=>{const{userEventsStorageApplicationEndpoint:t}=JSON.parse(e);if(t)ue.userEventsStorageApplicationUrl=t;if(!ue.scriptModuleManager.isScriptInitialized(re.ec)){if(ue.scriptModuleManager.setScriptInitialized(re.ec),Ut.isScriptDelayed(re.ec))return Ut.storeDelayedScriptParams(re.ec,[]),null;try{xt.initialize()}catch(i){Q.error("Error while initializing eCommerce script")}}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}((e="undefined"!=typeof globalThis?globalThis:e||self).GREC={})}(this);