(()=>{(function(b){var d={};function e(t){if(d[t])return d[t].exports;var r=d[t]={i:t,l:!1,exports:{}};return b[t].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=b,e.c=d,e.d=function(t,r,g){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:g})},e.r=function(t){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(r&1&&(t=e(t)),r&8||r&4&&typeof t=="object"&&t&&t.__esModule)return t;var g=Object.create(null);if(e.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:t}),r&2&&typeof t!="string")for(var T in t)e.d(g,T,function(O){return t[O]}.bind(null,T));return g},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=29)})([function(b,d,e){"use strict";e.d(d,"i",function(){return r}),e.d(d,"d",function(){return g}),e.d(d,"e",function(){return T}),e.d(d,"m",function(){return O}),e.d(d,"g",function(){return D}),e.d(d,"c",function(){return y}),e.d(d,"f",function(){return C}),e.d(d,"h",function(){return U}),e.d(d,"j",function(){return N}),e.d(d,"n",function(){return S}),e.d(d,"b",function(){return R}),e.d(d,"a",function(){return W}),e.d(d,"l",function(){return a}),e.d(d,"k",function(){return s});var t=function(n,i,h,E){function l(w){return w instanceof h?w:new h(function(m){m(w)})}return new(h||(h=Promise))(function(w,m){function v(u){try{o(E.next(u))}catch(A){m(A)}}function p(u){try{o(E.throw(u))}catch(A){m(A)}}function o(u){u.done?w(u.value):l(u.value).then(v,p)}o((E=E.apply(n,i||[])).next())})};function r(n){return typeof n=="undefined"}function g(n){return typeof n=="function"}function T(n){return n===null}const O=(n,i={})=>{if(Number.isFinite(+n))return i;try{return JSON.parse(n)}catch(h){}return i};function D(n){const i=function(){return t(this,void 0,void 0,function*(){})}.constructor;return typeof n=="object"&&!T(n)&&!Array.isArray(n)&&!(n instanceof i)&&n.constructor!=="function"&&Object.prototype.toString.call(n)==="[object Object]"}function y(n,i,h=void 0){if(T(n)||r(n))return h;const l=(i!=null?i:"").replace(/\[([^[\]]*)]/g,".$1.").split(".").filter(w=>w!=="").reduce((w,m)=>w&&w[m],n);return r(l)?h:l}function C(n){return typeof n=="number"&&Number.isFinite(n)}function U(n){return typeof n=="string"}function N(n){return U(n)&&n.length>0}const S=(n,i="",h)=>{const E=i&&i.length>0?i.split("."):[];let l=n;return E.slice(0,E.length-1).forEach(w=>{let m=l[w];(T(m)||r(m))&&(m={}),l[w]=m,l=l[w]}),l[E.pop()]=h,n};function R(n,i=100){let h;return(...E)=>{clearTimeout(h),h=setTimeout(()=>{n(...E)},i)}}const W=n=>{var i,h,E;return(E=(h=(i=n.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))===null||i===void 0?void 0:i.map(l=>l.toLowerCase()))===null||h===void 0?void 0:h.join("_"))!==null&&E!==void 0?E:n},a=n=>{const i=Object.keys(n),h=[],E=i.reduce((l,w,m)=>(l[m]=w,h.push(n[w]),l),{});return Promise.all(h).then(l=>l.reduce((w,m,v)=>(w[E[v]]=m,w),{}))},s=(n,i)=>{let h;try{h=Object.keys(n)}catch(E){throw new Error("Unable to extract keys from provided object")}return h.reduce((E,l)=>{const w=i(n[l],l),m=Object.assign({},E);return r(w)||(m[l]=w),m},{})}},function(b,d,e){(function(t,r){r(d)})(this,function(t){"use strict";var r,g,T,O,D,y,C,U,N,S,R,W,a,s,n;t.AlignValue=void 0,(r=t.AlignValue||(t.AlignValue={})).LEFT="left",r.RIGHT="right",r.CENTER="center",t.AlignPosition=void 0,(g=t.AlignPosition||(t.AlignPosition={})).NATURAL="natural",g.CANVAS="canvas",t.ShapeKind=void 0,(T=t.ShapeKind||(t.ShapeKind={})).CIRCLE="circle",T.RECTANGLE="rectangle",T.POLYGON="polygon",t.ObjectType=void 0,(O=t.ObjectType||(t.ObjectType={})).TEXT="text",O.SHAPE="shape",O.IMAGE="image",O.GROUP="group",t.SizeUnit=void 0,(D=t.SizeUnit||(t.SizeUnit={})).PX="px",D.PERCENT="%",t.LogicalOp=void 0,(y=t.LogicalOp||(t.LogicalOp={})).AND="and",y.OR="or",t.ComparisonOp=void 0,(C=t.ComparisonOp||(t.ComparisonOp={})).GT="gt",C.LT="lt",C.GE="ge",C.LE="le",C.EQ="eq",C.NE="ne",t.ConditionVariable=void 0,(U=t.ConditionVariable||(t.ConditionVariable={})).H="h",U.W="w",U.AR="ar",t.CartUpdateAction=void 0,(N=t.CartUpdateAction||(t.CartUpdateAction={})).ADD_TO_CART="addToCart",N.INCREMENT_QUANTITY="increaseQuantity",N.DECREMENT_QUANTITY="decreaseQuantity",N.UPDATE_QUANTITY="updateQuantity",N.CHANGE_QUANTITY="changeQuantity",N.CHANGE_CART="changeCart",t.WidgetFeature=void 0,(S=t.WidgetFeature||(t.WidgetFeature={})).AUTOMATED_DISCOUNTS="cart_discounts_inclusion",S.MANUAL_DISCOUNT_ALLOCATIONS="allow_manual_discount_allocations",S.PRODUCT_VARIANTS="product_variants",S.EXCLUDE_OOS="exclude_oos",S.TIMER="timer",S.EMBEDDED_PRICE_DROP="embed-price-drop",S.PRODUCT_SELECTION="product_selection",S.RECOMMENDATION_REMINDER="recommendation_reminder",S.QUIZ_TIMER="quiz-timer",S.FS_FLOATING="fullscreen-floating",S.FLOATING_LAUNCHER="floating-launcher",S.SINGLE_SELECTION_DISCOUNT="single_selection_discount",S.EXCLUDE_DOUBLE_SELECTION_DISCOUNT="exclude_double_selection_discount",S.TIERED_DISCOUNT="tiered_discount",S.NO_DEFAULT_SELECTION="no_default_selection",S.PRODUCT_DISCOUNT="product_discount",S.NEW_USER_VIEW="new_user_view",S.TIMED_VIEW="timed_view",S.MOBILE_BOTTOM_DRAWER="mobile_bottom_drawer",S.USER_SPECIFIC="user-specific",S.COD_HIDDEN="cod_hidden",t.WidgetCategory=void 0,(R=t.WidgetCategory||(t.WidgetCategory={})).CUSTOM_QUIZ="custom_recommendation-quiz",R.QUIZ="quiz",R.PRODUCT_BUNDLE="bundle",R.AB_CART="cart",R.SIDE_CART="side-cart",R.FORM="form",R.PRICE_DROP="price-drop",R.NEW_ARRIVALS="newarrivals",R.BESTSELLER="recommended",R.GENERIC="generic",R.FBT="fbt",R.REWARD_QUIZ="reward-quiz",R.BULK_BUY="bulk-buy",R.SPIN_WHEEL="spin-the-wheel",R.STICKY_CART_BUTTON="sticky-cart-button",R.PLAYBOOK="playbook",R.PRODUCT_INFO="info",t.WidgetType=void 0,(W=t.WidgetType||(t.WidgetType={})).STORE_BANNER="store",W.PRODUCT_BANNER="product",W.WIDGET="widget",t.InsertType=void 0,(a=t.InsertType||(t.InsertType={})).ABOVE="above",a.BELOW="below",a.REPLACE_CHILDREN="replaceChildren",a.LAST_CHILD="lastChild",a.FIRST_CHILD="firstChild",a.PAGE_TOP="pageTop",a.PAGE_BOTTOM="pageBottom",a.PAGE_HOVER_TOP="pageHoverTop",a.PAGE_HOVER_BOTTOM="pageHoverBottom",a.FLOATING="floating",a.SLIDE_IN="slideIn",t.WidgetTimingAction=void 0,(s=t.WidgetTimingAction||(t.WidgetTimingAction={})).CLICK="click",s.SCROLL="scroll",s.DELAY="delay",s.AB_CART="abcart",t.TargetType=void 0,(n=t.TargetType||(t.TargetType={})).PAGES="pages",n.PRODUCTS="products",n.COLLECTIONS="collections";var i,h,E,l,w,m,v,p,o,u;t.BreakpointId=void 0,(i=t.BreakpointId||(t.BreakpointId={})).XS="xs",i.M="m",i.L="l",i.XL="xl",t.FloatingPositionTypes=void 0,(h=t.FloatingPositionTypes||(t.FloatingPositionTypes={})).TOP="top",h.RIGHT="right",h.BOTTOM="bottom",h.LEFT="left",t.AddOn=void 0,(E=t.AddOn||(t.AddOn={})).RECOMMENDED="recommended",E.UPSELL="upsell",E.FBT="fbt",E.BXGY="bxgy",t.WidgetEntityState=void 0,(l=t.WidgetEntityState||(t.WidgetEntityState={})).ENABLED="enabled",l.DISABLED="disabled",l.SYSTEM_DISABLED="system_disabled",l.DELETED="deleted",t.ApplyType=void 0,(w=t.ApplyType||(t.ApplyType={})).MANUAL="manual",w.AUTOMATION="automation",t.PublishAs=void 0,(m=t.PublishAs||(t.PublishAs={})).BADGE="badge",m.FEATURE_CARD="feature-card",m.TRUST_BADGE="trust-badges",m.STORE_BANNER="store-banner",m.PRODUCT_BANNER="product-banner",m.STANDALONE="standalone",m.WIDGET="widget",t.AddonStatus=void 0,(v=t.AddonStatus||(t.AddonStatus={})).ENABLED="enabled",v.DISABLED="disabled",t.DiscountType=void 0,(p=t.DiscountType||(t.DiscountType={})).FIXED="fixed_amount",p.PERCENTAGE="percentage",p.TIERED="tiered",p.BXGY_PRODUCTS="bxgy::products",t.ChannelMethod=void 0,(o=t.ChannelMethod||(t.ChannelMethod={})).INITIALIZE="initialize",o.RESIZE="resize",o.TIMER_EXPIRED="timerExpired",o.CART_UPDATE="onCartUpdate",o.ORDER_CREATED="orderCreated",o.DISCOUNT_UPDATION="discountUpdation",o.FETCH_CART="getCart",o.CLOSE="closeWidget",o.CHANGE_VARIANT="onChangeVariant",o.SELECT_PRODUCT="onProductSelect",o.FORM_SUBMIT="onFormSubmit",o.FORM_RESET="onFormReset",o.UPDATE_WIDGET="update",o.URL_CHANGE="urlchange",o.WINDOW_RESIZED="window-resized",o.TIMER_STATE_UPDATE="timer-state-update",o.SPIN_WHEEL_STATE_UPDATE="spin-wheel-state-update",o.QUIZ_STATE_UPDATE="quiz-state-update",o.IN_VIEW="in-view",o.OUT_OF_VIEW="out-of-view",o.GET_QUERY_PARAMS="get-query-params",o.LINK_DATA_UPDATE="link-data-update",o.GET_STOREFRONT_DATA="get-storefront-data",t.CheckoutType=void 0,(u=t.CheckoutType||(t.CheckoutType={})).SWIFT="swift",u.FASTRR="fastrr",u.GOKWIK="gokwik",u.DEFAULT="default";var A,L,c,f;t.ScriptName=void 0,(A=t.ScriptName||(t.ScriptName={})).ANALYTICS="analytics",A.LOADER="loader",A.LOFOODS="lofoods",A.OVERLAY="overlay",A.PREVIEW="preview",A.REPLACE="replace",A.SIDECART="sidecart",A.THANKYOU="thankyou",A.TRUSTBADGES="trustbadges",A.WIDGETS="widgets",A.QUIZ="quiz",t.FeaturesAPIApp=void 0,(L=t.FeaturesAPIApp||(t.FeaturesAPIApp={})).MODEMAGIC="modemagic",L.QUIZ_MASTER="quizmaster",t.CacheEntryVersion=void 0,(c=t.CacheEntryVersion||(t.CacheEntryVersion={})).ONE="1.0",c.TWO="2.0",t.TBAlign=void 0,(f=t.TBAlign||(t.TBAlign={})).CENTER="center",f.RIGHT="right",f.LEFT="left",t.LauncherPositions={BOTTOM_LEFT:"bottomLeft",BOTTOM_RIGHT:"bottomRight"},t.Platforms={SHOPIFY:"shopify",BIGCOMMERCE:"bigcommerce",UNKNOWN:"--unknown--"}})},function(b,d,e){"use strict";e.d(d,"a",function(){return g}),e.d(d,"b",function(){return T});var t=e(6);const g=["info","debug","error","log","group","groupEnd"].reduce((O,D)=>(O[D]=(...y)=>{t.b||window.console[D](...y)},O),{}),T=(O,D)=>{t.b||g.debug(`%c [Scripts] ${O}`,"background: #222; color: #d97b09",D!=null?D:"")}},,function(b,d,e){"use strict";(function(t){e.d(d,"f",function(){return N}),e.d(d,"i",function(){return n}),e.d(d,"d",function(){return E}),e.d(d,"a",function(){return w}),e.d(d,"b",function(){return m}),e.d(d,"c",function(){return v}),e.d(d,"h",function(){return p}),e.d(d,"g",function(){return u}),e.d(d,"j",function(){return A}),e.d(d,"e",function(){return L});var r=e(2),g=e(0),T=e(6),O=e(5),D;const y=((D=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||D===void 0?void 0:D.NODE_ENV)==="test",C=["ase","art","bmp","blp","cd5","cit","cpt","cr2","cut","dds","dib","djvu","egt","exif","gif","gpl","grf","icns","ico","iff","jng","jpeg","jpg","jfif","jp2","jps","lbm","max","miff","mng","msp","nef","nitf","ota","pbm","pc1","pc2","pc3","pcf","pcx","pdn","pgm","PI1","PI2","PI3","pict","pct","pnm","pns","ppm","psb","psd","pdd","psp","px","pxm","pxr","qfx","raw","rle","sct","sgi","rgb","int","bw","tga","tiff","tif","vtf","xbm","xcf","xpm","3dv","amf","ai","awg","cgm","cdr","cmx","dxf","e2d","egt","eps","fs","gbr","odg","svg","stl","vrml","x3d","sxd","v2d","vnd","wmf","emf","art","xar","png","webp","jxr","hdp","wdp","cur","ecw","iff","lbm","liff","nrrd","pam","pcx","pgf","sgi","rgb","rgba","bw","int","inta","sid","ras","sun","tga","heic","heif"],U=new Set(C),N=new RegExp(`((.${C.join("|.")})+)$`,"i"),S=["pico","icon","thumb","small","compact","medium","large","grande","original","master"],R=["center","top","right","bottom","left"],W=["progressive"],a=new RegExp(`((?:_(?:x|X)?)(?:(?:\\d{1,4}(?:x|X)\\d{0,4}|(?:x|X)\\d{1,4})|(?:${S.join("|")})))?(_crop_(?:${R.join("|")}))?(@[23]x)?(.(?:${W.join("|")}))?$`),s=(()=>{let c=[];return f=>{let I=f.replace(/\.([^.]+?)$/,"");c=I.split(".");let P=-1;for(let M=0;M0?P:void 0).join("."),I}})(),n=(()=>{const c={};return f=>{const I=c[f];if(typeof I=="string")return I;let P=f;P=P.replace(/\?v=.*/g,"");const B=s(P).match(a);if(B){const{index:j=0}=B,Q=P.slice(0,j),F=P.slice(j+B[0].length);P=`${Q}${F}`}return c[f]=P,P}})(),i=(()=>{const c={};return f=>{let I=c[f];return typeof I=="string"||(I=s(f),c[f]=I),I}})();function h(c,f){return i(c)===i(f)}function E(c,f){return f.find(I=>h(c,I))||""}function l(c){var f,I;return(I=(f=c.split("/").pop())===null||f===void 0?void 0:f.split("?"))===null||I===void 0?void 0:I[0]}const w=(()=>{const c=new Map([]);return(f,I)=>{var P;if(c.has(f))return c.get(f);const M=n(f),B=M.match(N);if(!f.startsWith("/")&&Array.isArray(B)&&B.length>0){const j=l(M);if(typeof j=="string"){const Q=`${I}/${j}`;c.set(f,Q)}}return(P=c.get(f))!==null&&P!==void 0?P:f}})();function m(c,f="/cdn"){return`${c}${f}`}function v(){const{store:c}=Object(O.a)(),f=window.location.pathname;return f.match(/^\/(?:[a-z]{2})?$/)?"home":f.match(/\/products\/.+?$/)?"product":f.match(/\/pages\/.+?$/)?"page":f.includes("collection")||f.includes("search")?"collection":c==="venustahome"&&f.includes("campaign")?"home":"_not_supported_"}const p=window.modeMagicPreviewSettings||window.modeMagicSettings||{},o=c=>{const f=M=>{const{visibility:B,display:j,opacity:Q}=getComputedStyle(M);return!(document.hidden||B==="hidden"||j==="none"||+Q==0)};let I=c,P=f(I);for(;P&&I.parentElement;)I=I.parentElement,P=f(I);return P},u=(c,{areaCheck:f}={areaCheck:!0})=>{if(!o(c))return!1;const{top:I,left:P,bottom:M,right:B}=c.getBoundingClientRect(),j={x:0,y:0},Q={x:window.innerWidth||document.documentElement.clientWidth,y:window.innerHeight||document.documentElement.clientHeight},F=(K,H)=>{const _=j[K],$=Q[K];return H<_?_:H>$?$:H},x=F("y",M)-F("y",I),V=F("x",B)-F("x",P),G=x*V;return f?G>0:x>0||V>0},A=c=>{let{logs:f}=c!=null?c:{};f||({logs:f}=c==null?void 0:c.constructor);let I=["",""];return f&&(I=[Object.keys(f).reduce((P,M)=>`${P}${M}: ${f[M]}; `,""),"background-color: rgb(76, 136, 255);color:white;","color: rgb(76, 136, 255)"]),T.b||y?c:new Proxy(c,{get(P,M,B){const j=Reflect.get(P,M,B);return typeof j=="function"?function(...Q){var F,x;const V=`%c[${(F=c==null?void 0:c.name)!==null&&F!==void 0?F:(x=c==null?void 0:c.constructor)===null||x===void 0?void 0:x.name}]%c[${M.toString()}]%c: `;r.a.group(V,...I),Q.length>0&&r.a.debug("Called with: ",...Q);const G=j.apply(this,Q);return r.a.debug("Returning",G),r.a.groupEnd(),G}:j}})},L=()=>{const{search:c}=window.location;return Object(g.j)(c)?JSON.parse(`{"${c.slice(1).replace(/&/g,'","').replace(/=/g,'":"')}"}`,(f,I)=>f===""?I:decodeURIComponent(I)):{}}}).call(this,e(16))},function(b,d,e){"use strict";e.d(d,"a",function(){return O});var t=e(1),r=e.n(t),g=e(0),T=e(13);const O=()=>{var D,y,C;const U={cart:null,platform:t.Platforms.UNKNOWN,product:"",store:"",currency:{active_currency_code:"",active_currency_id:1},settings:{store_hash:"",secure_host:"",cdn_url:"",secure_base_url:"",channel_id:1},customer:null,dumps:{},urls:{home:""}};if(typeof window!="undefined"){if(typeof window.__store_context__=="undefined"&&(window.__store_context__={}),Object.assign(window.__store_context__,Object.assign(Object.assign({},U),window.__store_context__)),Object(g.j)(window.__mmStore)&&Object.assign(window.__store_context__,{store:window.__mmStore.split(".")[0]}),Object(g.g)(window.Shopify)){const N=Object(T.a)(),S=window.Shopify.shop.split(".")[0];Object.assign(window.__store_context__,{platform:t.Platforms.SHOPIFY,store:S,dumps:{},currency:{active_currency_code:(y=(D=window.Shopify.currency)===null||D===void 0?void 0:D.active)!==null&&y!==void 0?y:"USD",active_currency_id:1},settings:{secure_base_url:`https://${window.Shopify.shop}`,secure_host:window.Shopify.shop,cdn_url:window.Shopify.cdnHost,store_hash:S,channel_id:1},cart:null,urls:{home:(C=window.Shopify.routes)===null||C===void 0?void 0:C.root},product:N.product})}return window.__store_context__}return U}},function(b,d,e){"use strict";(function(t){e.d(d,"b",function(){return D}),e.d(d,"a",function(){return C});var r,g,T,O;const D=((r=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||r===void 0?void 0:r.NODE_ENV)==="production",y=((g=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||g===void 0?void 0:g.NODE_ENV)==="test",C=(O=(T=t==null?void 0:{USER_FEATURES_API:"https://app.getmodemagic.com/api/features",APP_URL:"https://app.getmodemagic.com/widgets/view",NODE_ENV:"production"})===null||T===void 0?void 0:T.NODE_ENV)!==null&&O!==void 0?O:"development"}).call(this,e(16))},function(b,d,e){"use strict";e.d(d,"d",function(){return a}),e.d(d,"b",function(){return n}),e.d(d,"c",function(){return i}),e.d(d,"a",function(){return w});const t="__SECRET_INTERNALS_DO_NOT_USE__";var r=e(18),g=e(6),T=e(4),O=e(2),D=e(9),y=e(0),C=e(15),U=e(19),N=e(5),S=function(m,v){var p={};for(var o in m)Object.prototype.hasOwnProperty.call(m,o)&&v.indexOf(o)<0&&(p[o]=m[o]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,o=Object.getOwnPropertySymbols(m);u{O.a.debug("MM:Clearing impressions cache"),v.impressionsCache=new Set,v.viewsCache=new Set,v.stats=h}),v.addOrderCompletionListener()}addOrderCompletionListener(){window.addEventListener("message",v=>{const{data:p}=v,{messageType:o,messageData:{actionType:u}={}}=p,A=Object(y.c)(p,"messageAuth.source",null),L=Object(y.c)(p,"messageData.payload.order",null),{id:c,line_items:f=[],cart_token:I="",email:P="",customer:M,customer_locale:B=""}=L!=null?L:{},{id:j=-1}=M!=null?M:{};o==="MODEMAGIC_CONVERSION_EVENT"&&u==="ORDER_CREATE"&&!Object(y.e)(A)&&W.has(A)&&!Object(y.i)(c)&&Object(C.b)({email:P,orderId:c,customerId:j,cartToken:I,customerLocale:B,source:A!=null?A:void 0,lineItems:f})})}flushQueue(){var v,p,o;const u=l.getInstance(),A=u.eventQueue.get(E.FLUSH_QUEUE);if(!Object(y.e)(A)&&!Object(y.i)(A)){const c=new Date().getTime();if(c-A.queued>u.queWaitTime){if(A.counter>=u.maxRetries){u.eventQueue.set(E.ACTIVE_QUEUE,[...(v=u.eventQueue.get(E.ACTIVE_QUEUE))!==null&&v!==void 0?v:[],...A.events]),u.eventQueue.set(E.FLUSH_QUEUE,void 0),u.flushQueue();return}u.eventQueue.set(E.FLUSH_QUEUE,Object.assign(Object.assign({},A),{queued:new Date().getTime(),counter:A.counter+1}))}else{if(u.retryQueTimeout!==-1)return;const f=u.queWaitTime-(c-A.queued)+1e3;u.retryQueTimeout=window.setTimeout(()=>{u.retryQueTimeout=-1,u.flushQueue()},f);return}}else{const c=(p=u.eventQueue.get(E.ACTIVE_QUEUE))!==null&&p!==void 0?p:[];Array.isArray(c)&&c.length>0&&(u.eventQueue.set(E.ACTIVE_QUEUE,[]),u.eventQueue.set(E.FLUSH_QUEUE,{events:c,queued:new Date().getTime(),counter:1}))}const L=(o=u.eventQueue.get(E.FLUSH_QUEUE))===null||o===void 0?void 0:o.events;if(Array.isArray(L)&&L.length>0){const c=JSON.stringify(L);fetch(a,{method:"POST",body:c}).then(()=>{u.eventQueue.set(E.FLUSH_QUEUE,void 0)}).catch(()=>{})}}queueEvent(v){var p;const o=l.getInstance(),u=[...(p=o.eventQueue.get(E.ACTIVE_QUEUE))!==null&&p!==void 0?p:[],v];o.eventQueue.set(E.ACTIVE_QUEUE,u),o.queTimeout>0&&(window.clearTimeout(o.queTimeout),o.queTimeout=-1),u.length>=s?o.flushQueue():o.queTimeout=window.setTimeout(()=>{o.flushQueue()},1e3)}raiseEvent(v){const{store:p}=Object(N.a)(),{appName:o=U.a,entity:u,eventType:A,data:L,element:c}=v,f=window.location.href,I=Object(T.e)(),P=L!=null?L:{},{product:M,storyboard:B,template:j,impressionsData:Q,widgets:F,playbookId:x}=P,V=S(P,["product","storyboard","template","impressionsData","widgets","playbookId"]),G=new Date().getTime()/1e3,K=l.getInstance();K.stats[A]+=1,K.log(u,A,L,c),K.queueEvent(Object.assign(Object.assign({app_name:o,store_id:p,product_id:M,storyboard_id:B,widget_ids:F,template_id:j,category:u,action:A,time:G,playbook_id:x,device_id:Object(D.a)(),full_url:f,query:I},V),Q))}log(v,p,o,u){O.a.debug(`MM:${v}:${p}`),u&&O.a.debug("src element: ",u),O.a.debug("data: ",JSON.stringify(o)),O.a.debug("stats: ",JSON.stringify(l.getInstance().stats))}click(v){const{entity:p,element:o,data:u,appName:A}=v;l.getInstance().raiseEvent({appName:A,entity:p,eventType:n.CLICK,data:u,element:o})}impression(v){const{entity:p,element:o,data:u,appName:A}=v,L=l.getInstance();L.impressionsCache.has(o)||(L.raiseEvent({appName:A,entity:p,eventType:n.IMPRESSION,data:u,element:o}),L.impressionsCache.add(o))}view(v){const{entity:p,element:o,data:u,appName:A}=v,L=l.getInstance();L.viewsCache.has(o)||(L.raiseEvent({appName:A,entity:p,eventType:n.VIEW,data:u,element:o}),L.viewsCache.add(o))}hide(v){const{entity:p,element:o,data:u,appName:A}=v;l.getInstance().raiseEvent({appName:A,entity:p,eventType:n.HIDE,data:u,element:o})}conversion(v){const{data:p,appName:o}=v;l.getInstance().raiseEvent({appName:o,entity:i.WIDGET,eventType:n.CONVERSION,data:p})}}const w=l.getInstance()},,function(b,d,e){"use strict";e.d(d,"a",function(){return g});var t=e(0);const r="mm.userDeviceID",g=()=>{const T=window.localStorage.getItem(r);if(Object(t.e)(T)){const O=JSON.stringify(performance.now())+Math.random().toString(36).substring(2,11);return window.localStorage.setItem(r,O),O}return T}},,,,function(b,d,e){"use strict";e.d(d,"a",function(){return t});const t=()=>{const r=document.querySelectorAll("[data-app='mm']");let g={};return r.forEach(T=>{g=Object.assign(Object.assign({},g),T.dataset)}),g}},,function(b,d,e){"use strict";e.d(d,"a",function(){return g}),e.d(d,"b",function(){return T});var t=e(7),r=e(0);const g={swift:!0,shopflo:!0,fastrr:!0};function T(O){const{customerLocale:D,customerId:y,orderId:C,lineItems:U,email:N,cartToken:S,source:R}=O,W=U.reduce((a,{properties:s={}})=>{const n=s.__mmWidget,i=Object(r.m)(n,null);return i!==null&&!Array.isArray(i)&&typeof i=="object"&&a.push(i),a},[]);t.a.conversion({appName:"shopify",data:{widgets:W,meta:{source:R,line_items:U,order:C,cartToken:S,src:window.location.href,customer:{id:y,locale:D,email:N}},impressionsData:{apply_type:"manual"}}})}},function(b,d){var e=b.exports={},t,r;function g(){throw new Error("setTimeout has not been defined")}function T(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?t=setTimeout:t=g}catch(s){t=g}try{typeof clearTimeout=="function"?r=clearTimeout:r=T}catch(s){r=T}})();function O(s){if(t===setTimeout)return setTimeout(s,0);if((t===g||!t)&&setTimeout)return t=setTimeout,setTimeout(s,0);try{return t(s,0)}catch(n){try{return t.call(null,s,0)}catch(i){return t.call(this,s,0)}}}function D(s){if(r===clearTimeout)return clearTimeout(s);if((r===T||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(s);try{return r(s)}catch(n){try{return r.call(null,s)}catch(i){return r.call(this,s)}}}var y=[],C=!1,U,N=-1;function S(){!C||!U||(C=!1,U.length?y=U.concat(y):N=-1,y.length&&R())}function R(){if(!C){var s=O(S);C=!0;for(var n=y.length;n;){for(U=y,y=[];++N1)for(var i=1;i{const[,,D]=O;g.apply(T,O),t.listeners.forEach(y=>typeof D=="string"&&y(D.split("?")[1]||""))}})}static listen(g){t.unlisten(g),t.listeners.push(g)}static unlisten(g){t.listeners=t.listeners.filter(T=>T!==g)}}t.listeners=[]},function(b,d,e){"use strict";e.d(d,"c",function(){return N}),e.d(d,"b",function(){return R}),e.d(d,"a",function(){return W});var t=e(13),r=e(0),g=e(1),T=e.n(g),O=e(5),D=e(9),y=function(a,s,n,i){function h(E){return E instanceof n?E:new n(function(l){l(E)})}return new(n||(n=Promise))(function(E,l){function w(p){try{v(i.next(p))}catch(o){l(o)}}function m(p){try{v(i.throw(p))}catch(o){l(o)}}function v(p){p.done?E(p.value):h(p.value).then(w,m)}v((i=i.apply(a,s||[])).next())})};const C="COD",U=()=>y(void 0,void 0,void 0,function*(){var a,s;let n=null;try{if(window.location.pathname.includes("/products/")){const h=yield fetch(`${window.location.pathname}.json`).then(E=>E.json());n=(s=(a=h==null?void 0:h.product)===null||a===void 0?void 0:a.id)===null||s===void 0?void 0:s.toString()}}catch(i){console.debug(i)}return n!=null?n:null}),N=()=>y(void 0,void 0,void 0,function*(){const a=Object(t.a)();if(!a.product&&Object(r.g)(window.Shopify)){const s=yield U();if(typeof s=="string"){a.product=s;const n=document.createElement("div");n.setAttribute("data-app","mm"),n.setAttribute("data-product",s),document.body.appendChild(n)}}return Promise.resolve()}),S=()=>new Promise(a=>{const s=setInterval(()=>{const n=Object(r.c)(window,"Shopflo.order.tags","").split(",").map(i=>i.trim()).filter(i=>i.length>0);if(n.length>0){const i=new Set(n);clearInterval(s),a(i.has(C)?"true":"false")}},100)}),R=(a=[])=>y(void 0,void 0,void 0,function*(){var s,n;const{store:i,product:h}=Object(O.a)(),E=!Object(r.i)(window.Shopflo),l=typeof((s=window.Shopify)===null||s===void 0?void 0:s.checkout)!="undefined"||E&&new URLSearchParams(window.location.search).get("page")==="thank_you"?"true":"false";let w="false",m=-1;return l==="true"&&(w=yield S(),m=(n=+Object(r.c)(window,"Shopflo.order.total_price","0"))!==null&&n!==void 0?n:-1),{shop:i,path:window.location.pathname,domain:window.location.host,product:h,app:g.FeaturesAPIApp.MODEMAGIC,hash:window.location.hash,device_id:Object(D.a)(),thankyou:l,shopflo_cod:w,cart_value:`${m}`,query:window.encodeURIComponent(window.location.search),features:a}}),W=(a,s)=>{Object.entries(s).forEach(([n,i])=>{i&&(Array.isArray(i)?i.forEach(h=>a.searchParams.set(n,h)):a.searchParams.set(n,i))})}},,,,,,,,function(b,d,e){"use strict";e.r(d),e.d(d,"addFeatureSettings",function(){return C});var t=e(2),r=e(9),g=e(7),T=e(5),O=e(20),D=e(21),y=function(a,s,n,i){function h(E){return E instanceof n?E:new n(function(l){l(E)})}return new(n||(n=Promise))(function(E,l){function w(p){try{v(i.next(p))}catch(o){l(o)}}function m(p){try{v(i.throw(p))}catch(o){l(o)}}function v(p){p.done?E(p.value):h(p.value).then(w,m)}v((i=i.apply(a,s||[])).next())})};function C(a,s,n="modeMagic"){const i=`${n}Settings`;typeof window[i]=="undefined"&&(window[i]={}),typeof s!="undefined"&&(window[i][a]=s)}function U(a){a.forEach(({name:s,src:n,data:i})=>{C(s,i,"modeMagic");const h=document.createElement("script");h.setAttribute("data-mm-script",s),h.setAttribute("type","text/javascript"),h.setAttribute("src",n),h.setAttribute("fetchPriority","high"),document.body.appendChild(h)})}function N(a){try{const n=JSON.parse(a.responseText).data;U(n)}catch(s){t.a.debug(s)}}const S=()=>{const{store:a,product:s}=Object(T.a)(),n=new Date().getTime()/1e3;fetch(g.d,{method:"POST",body:JSON.stringify({device_id:Object(r.a)(),meta:{url:window.location.href},product_id:s!=null?s:"",action:g.b.PAGE_VIEW,time:n,store_id:a,category:"price_drop"})})};function R(){return y(this,void 0,void 0,function*(){let a=!1;const s=yield Object(D.b)();a||(S(),a=!0,window==null||window.addEventListener("popstate",()=>{a&&S()}));const n=new URL("https://app.getmodemagic.com/api/features");Object(D.a)(n,s);const i=new XMLHttpRequest;i.addEventListener("load",N.bind(null,i)),window!=null&&window.MMScriptLoaded||(i.open("GET",n.toString(),!0),i.send(),window.MMScriptLoaded=!0)})}const W=()=>y(void 0,void 0,void 0,function*(){var a;window!=null&&window.MMScriptLoaded||(window.MMScriptLoaded=(a=window==null?void 0:window.MMScriptLoaded)!==null&&a!==void 0?a:!1,yield Object(D.c)(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",R):yield R())});t.a.debug("[loader] starting initialization"),W(),O.a.init(),O.a.listen(()=>{typeof window!="undefined"&&window.MMScriptLoaded&&typeof window.Shopflo!="undefined"&&new URLSearchParams(window.location.search).get("page")==="thank_you"&&(t.a.debug("[loader] re-initializing as shopflo integration changed query param in thank you page"),window.MMScriptLoaded=!1,W())})}]);})();