(()=>{(function(b){var u={};function e(t){if(u[t])return u[t].exports;var o=u[t]={i:t,l:!1,exports:{}};return b[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=b,e.c=u,e.d=function(t,o,h){e.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:h})},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,o){if(o&1&&(t=e(t)),o&8||o&4&&typeof t=="object"&&t&&t.__esModule)return t;var h=Object.create(null);if(e.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:t}),o&2&&typeof t!="string")for(var O in t)e.d(h,O,function(v){return t[v]}.bind(null,O));return h},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},e.p="",e(e.s=29)})([function(b,u,e){"use strict";e.d(u,"j",function(){return o}),e.d(u,"d",function(){return h}),e.d(u,"e",function(){return O}),e.d(u,"n",function(){return v}),e.d(u,"g",function(){return w}),e.d(u,"c",function(){return y}),e.d(u,"f",function(){return D}),e.d(u,"i",function(){return N}),e.d(u,"k",function(){return L}),e.d(u,"o",function(){return S}),e.d(u,"b",function(){return P}),e.d(u,"a",function(){return j}),e.d(u,"m",function(){return l}),e.d(u,"l",function(){return r}),e.d(u,"h",function(){return E});var t=function(i,f,p,C){function m(a){return a instanceof p?a:new p(function(s){s(a)})}return new(p||(p=Promise))(function(a,s){function n(R){try{A(C.next(R))}catch(c){s(c)}}function T(R){try{A(C.throw(R))}catch(c){s(c)}}function A(R){R.done?a(R.value):m(R.value).then(n,T)}A((C=C.apply(i,f||[])).next())})};function o(i){return typeof i=="undefined"}function h(i){return typeof i=="function"}function O(i){return i===null}const v=(i,f={})=>{if(Number.isFinite(+i))return f;try{return JSON.parse(i)}catch(p){}return f};function w(i){const f=function(){return t(this,void 0,void 0,function*(){})}.constructor;return typeof i=="object"&&!O(i)&&!Array.isArray(i)&&!(i instanceof f)&&i.constructor!=="function"&&Object.prototype.toString.call(i)==="[object Object]"}function y(i,f,p=void 0){if(O(i)||o(i))return p;const m=(f!=null?f:"").replace(/\[([^[\]]*)]/g,".$1.").split(".").filter(a=>a!=="").reduce((a,s)=>a&&a[s],i);return o(m)?p:m}function D(i){return typeof i=="number"&&Number.isFinite(i)}function N(i){return typeof i=="string"}function L(i){return N(i)&&i.length>0}const S=(i,f="",p)=>{const C=f&&f.length>0?f.split("."):[];let m=i;return C.slice(0,C.length-1).forEach(a=>{let s=m[a];(O(s)||o(s))&&(s={}),m[a]=s,m=m[a]}),m[C.pop()]=p,i};function P(i,f=100){let p;return(...C)=>{clearTimeout(p),p=setTimeout(()=>{i(...C)},f)}}const j=i=>{var f,p,C;return(C=(p=(f=i.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))===null||f===void 0?void 0:f.map(m=>m.toLowerCase()))===null||p===void 0?void 0:p.join("_"))!==null&&C!==void 0?C:i},l=i=>{const f=Object.keys(i),p=[],C=f.reduce((m,a,s)=>(m[s]=a,p.push(i[a]),m),{});return Promise.all(p).then(m=>m.reduce((a,s,n)=>(a[C[n]]=s,a),{}))},r=(i,f)=>{let p;try{p=Object.keys(i)}catch(C){throw new Error("Unable to extract keys from provided object")}return p.reduce((C,m)=>{const a=f(i[m],m),s=Object.assign({},C);return o(a)||(s[m]=a),s},{})},d=i=>typeof i=="object"&&!O(i);function E(i){if(!d(i)||i.toString()!=="[object Object]")return!1;if(Object.getPrototypeOf(i)===null)return!0;let f=i;for(;Object.getPrototypeOf(f)!==null;)f=Object.getPrototypeOf(f);return Object.getPrototypeOf(i)===f}},function(b,u,e){(function(t,o){o(u)})(this,function(t){"use strict";var o,h,O,v,w,y,D,N,L,S,P,j,l,r,d;t.AlignValue=void 0,(o=t.AlignValue||(t.AlignValue={})).LEFT="left",o.RIGHT="right",o.CENTER="center",t.AlignPosition=void 0,(h=t.AlignPosition||(t.AlignPosition={})).NATURAL="natural",h.CANVAS="canvas",t.ShapeKind=void 0,(O=t.ShapeKind||(t.ShapeKind={})).CIRCLE="circle",O.RECTANGLE="rectangle",O.POLYGON="polygon",t.ObjectType=void 0,(v=t.ObjectType||(t.ObjectType={})).TEXT="text",v.SHAPE="shape",v.IMAGE="image",v.GROUP="group",t.SizeUnit=void 0,(w=t.SizeUnit||(t.SizeUnit={})).PX="px",w.PERCENT="%",t.LogicalOp=void 0,(y=t.LogicalOp||(t.LogicalOp={})).AND="and",y.OR="or",t.ComparisonOp=void 0,(D=t.ComparisonOp||(t.ComparisonOp={})).GT="gt",D.LT="lt",D.GE="ge",D.LE="le",D.EQ="eq",D.NE="ne",t.ConditionVariable=void 0,(N=t.ConditionVariable||(t.ConditionVariable={})).H="h",N.W="w",N.AR="ar",t.CartUpdateAction=void 0,(L=t.CartUpdateAction||(t.CartUpdateAction={})).ADD_TO_CART="addToCart",L.INCREMENT_QUANTITY="increaseQuantity",L.DECREMENT_QUANTITY="decreaseQuantity",L.UPDATE_QUANTITY="updateQuantity",L.CHANGE_QUANTITY="changeQuantity",L.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.DISABLE_COUPON_CODES="disable_coupon_codes",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,(P=t.WidgetCategory||(t.WidgetCategory={})).CUSTOM_QUIZ="custom_recommendation-quiz",P.QUIZ="quiz",P.PRODUCT_BUNDLE="bundle",P.AB_CART="cart",P.SIDE_CART="side-cart",P.FORM="form",P.PRICE_DROP="price-drop",P.NEW_ARRIVALS="newarrivals",P.BESTSELLER="recommended",P.GENERIC="generic",P.FBT="fbt",P.REWARD_QUIZ="reward-quiz",P.BULK_BUY="bulk-buy",P.SPIN_WHEEL="spin-the-wheel",P.STICKY_CART_BUTTON="sticky-cart-button",P.PLAYBOOK="playbook",P.PRODUCT_INFO="info",t.WidgetType=void 0,(j=t.WidgetType||(t.WidgetType={})).STORE_BANNER="store",j.PRODUCT_BANNER="product",j.WIDGET="widget",t.InsertType=void 0,(l=t.InsertType||(t.InsertType={})).ABOVE="above",l.BELOW="below",l.REPLACE_CHILDREN="replaceChildren",l.LAST_CHILD="lastChild",l.FIRST_CHILD="firstChild",l.PAGE_TOP="pageTop",l.PAGE_BOTTOM="pageBottom",l.PAGE_HOVER_TOP="pageHoverTop",l.PAGE_HOVER_BOTTOM="pageHoverBottom",l.FLOATING="floating",l.SLIDE_IN="slideIn",t.WidgetTimingAction=void 0,(r=t.WidgetTimingAction||(t.WidgetTimingAction={})).CLICK="click",r.SCROLL="scroll",r.DELAY="delay",r.AB_CART="abcart",t.TargetType=void 0,(d=t.TargetType||(t.TargetType={})).PAGES="pages",d.PRODUCTS="products",d.COLLECTIONS="collections";var E,i,f,p,C,m,a,s,n,T;t.BreakpointId=void 0,(E=t.BreakpointId||(t.BreakpointId={})).XS="xs",E.M="m",E.L="l",E.XL="xl",t.FloatingPositionTypes=void 0,(i=t.FloatingPositionTypes||(t.FloatingPositionTypes={})).TOP="top",i.RIGHT="right",i.BOTTOM="bottom",i.LEFT="left",t.AddOn=void 0,(f=t.AddOn||(t.AddOn={})).RECOMMENDED="recommended",f.UPSELL="upsell",f.FBT="fbt",f.BXGY="bxgy",t.WidgetEntityState=void 0,(p=t.WidgetEntityState||(t.WidgetEntityState={})).ENABLED="enabled",p.DISABLED="disabled",p.SYSTEM_DISABLED="system_disabled",p.DELETED="deleted",t.ApplyType=void 0,(C=t.ApplyType||(t.ApplyType={})).MANUAL="manual",C.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,(a=t.AddonStatus||(t.AddonStatus={})).ENABLED="enabled",a.DISABLED="disabled",t.DiscountType=void 0,(s=t.DiscountType||(t.DiscountType={})).FIXED="fixed_amount",s.PERCENTAGE="percentage",s.TIERED="tiered",s.BXGY_PRODUCTS="bxgy::products",t.ChannelMethod=void 0,(n=t.ChannelMethod||(t.ChannelMethod={})).INITIALIZE="initialize",n.RESIZE="resize",n.TIMER_EXPIRED="timerExpired",n.CART_UPDATE="onCartUpdate",n.ORDER_CREATED="orderCreated",n.DISCOUNT_UPDATION="discountUpdation",n.FETCH_CART="getCart",n.CLOSE="closeWidget",n.CHANGE_VARIANT="onChangeVariant",n.SELECT_PRODUCT="onProductSelect",n.FORM_SUBMIT="onFormSubmit",n.FORM_RESET="onFormReset",n.UPDATE_WIDGET="update",n.URL_CHANGE="urlchange",n.WINDOW_RESIZED="window-resized",n.TIMER_STATE_UPDATE="timer-state-update",n.SPIN_WHEEL_STATE_UPDATE="spin-wheel-state-update",n.QUIZ_STATE_UPDATE="quiz-state-update",n.IN_VIEW="in-view",n.OUT_OF_VIEW="out-of-view",n.GET_QUERY_PARAMS="get-query-params",n.LINK_DATA_UPDATE="link-data-update",n.GET_STOREFRONT_DATA="get-storefront-data",t.CheckoutType=void 0,(T=t.CheckoutType||(t.CheckoutType={})).SWIFT="swift",T.FASTRR="fastrr",T.GOKWIK="gokwik",T.DEFAULT="default";var A,R,c,g;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,(R=t.FeaturesAPIApp||(t.FeaturesAPIApp={})).MODEMAGIC="modemagic",R.QUIZ_MASTER="quizmaster",t.CacheEntryVersion=void 0,(c=t.CacheEntryVersion||(t.CacheEntryVersion={})).ONE="1.0",c.TWO="2.0",t.TBAlign=void 0,(g=t.TBAlign||(t.TBAlign={})).CENTER="center",g.RIGHT="right",g.LEFT="left",t.LauncherPositions={BOTTOM_LEFT:"bottomLeft",BOTTOM_RIGHT:"bottomRight"},t.Platforms={SHOPIFY:"shopify",BIGCOMMERCE:"bigcommerce",UNKNOWN:"--unknown--"}})},function(b,u,e){"use strict";e.d(u,"a",function(){return h}),e.d(u,"b",function(){return O});var t=e(6);const h=["info","debug","error","log","group","groupEnd"].reduce((v,w)=>(v[w]=(...y)=>{t.b||window.console[w](...y)},v),{}),O=(v,w)=>{t.b||h.debug(`%c [Scripts] ${v}`,"background: #222; color: #d97b09",w!=null?w:"")}},,function(b,u,e){"use strict";(function(t){e.d(u,"f",function(){return L}),e.d(u,"i",function(){return d}),e.d(u,"d",function(){return f}),e.d(u,"a",function(){return C}),e.d(u,"b",function(){return m}),e.d(u,"c",function(){return a}),e.d(u,"h",function(){return s}),e.d(u,"g",function(){return T}),e.d(u,"j",function(){return A}),e.d(u,"e",function(){return R});var o=e(2),h=e(0),O=e(6),v=e(5),w;const y=((w=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||w===void 0?void 0:w.NODE_ENV)==="test",D=["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"],N=new Set(D),L=new RegExp(`((.${D.join("|.")})+)$`,"i"),S=["pico","icon","thumb","small","compact","medium","large","grande","original","master"],P=["center","top","right","bottom","left"],j=["progressive"],l=new RegExp(`((?:_(?:x|X)?)(?:(?:\\d{1,4}(?:x|X)\\d{0,4}|(?:x|X)\\d{1,4})|(?:${S.join("|")})))?(_crop_(?:${P.join("|")}))?(@[23]x)?(.(?:${j.join("|")}))?$`),r=(()=>{let c=[];return g=>{let I=g.replace(/\.([^.]+?)$/,"");c=I.split(".");let U=-1;for(let M=0;M0?U:void 0).join("."),I}})(),d=(()=>{const c={};return g=>{const I=c[g];if(typeof I=="string")return I;let U=g;U=U.replace(/\?v=.*/g,"");const B=r(U).match(l);if(B){const{index:W=0}=B,Q=U.slice(0,W),F=U.slice(W+B[0].length);U=`${Q}${F}`}return c[g]=U,U}})(),E=(()=>{const c={};return g=>{let I=c[g];return typeof I=="string"||(I=r(g),c[g]=I),I}})();function i(c,g){return E(c)===E(g)}function f(c,g){return g.find(I=>i(c,I))||""}function p(c){var g,I;return(I=(g=c.split("/").pop())===null||g===void 0?void 0:g.split("?"))===null||I===void 0?void 0:I[0]}const C=(()=>{const c=new Map([]);return(g,I)=>{var U;if(c.has(g))return c.get(g);const M=d(g),B=M.match(L);if(!g.startsWith("/")&&Array.isArray(B)&&B.length>0){const W=p(M);if(typeof W=="string"){const Q=`${I}/${W}`;c.set(g,Q)}}return(U=c.get(g))!==null&&U!==void 0?U:g}})();function m(c,g="/cdn"){return`${c}${g}`}function a(){const{store:c}=Object(v.a)(),g=window.location.pathname;return g.match(/^\/(?:[a-z]{2})?$/)?"home":g.match(/\/products\/.+?$/)?"product":g.match(/\/pages\/.+?$/)?"page":g.includes("collection")||g.includes("search")?"collection":c==="venustahome"&&g.includes("campaign")?"home":"_not_supported_"}const s=window.modeMagicPreviewSettings||window.modeMagicSettings||{},n=c=>{const g=M=>{const{visibility:B,display:W,opacity:Q}=getComputedStyle(M);return!(document.hidden||B==="hidden"||W==="none"||+Q==0)};let I=c,U=g(I);for(;U&&I.parentElement;)I=I.parentElement,U=g(I);return U},T=(c,{areaCheck:g}={areaCheck:!0})=>{if(!n(c))return!1;const{top:I,left:U,bottom:M,right:B}=c.getBoundingClientRect(),W={x:0,y:0},Q={x:window.innerWidth||document.documentElement.clientWidth,y:window.innerHeight||document.documentElement.clientHeight},F=(K,H)=>{const $=W[K],_=Q[K];return H<$?$:H>_?_:H},x=F("y",M)-F("y",I),V=F("x",B)-F("x",U),G=x*V;return g?G>0:x>0||V>0},A=c=>{let{logs:g}=c!=null?c:{};g||({logs:g}=c==null?void 0:c.constructor);let I=["",""];return g&&(I=[Object.keys(g).reduce((U,M)=>`${U}${M}: ${g[M]}; `,""),"background-color: rgb(76, 136, 255);color:white;","color: rgb(76, 136, 255)"]),O.b||y?c:new Proxy(c,{get(U,M,B){const W=Reflect.get(U,M,B);return typeof W=="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: `;o.a.group(V,...I),Q.length>0&&o.a.debug("Called with: ",...Q);const G=W.apply(this,Q);return o.a.debug("Returning",G),o.a.groupEnd(),G}:W}})},R=()=>{const{search:c}=window.location;return Object(h.k)(c)?JSON.parse(`{"${c.slice(1).replace(/&/g,'","').replace(/=/g,'":"')}"}`,(g,I)=>g===""?I:decodeURIComponent(I)):{}}}).call(this,e(16))},function(b,u,e){"use strict";e.d(u,"a",function(){return v});var t=e(1),o=e.n(t),h=e(0),O=e(13);const v=()=>{var w,y,D;const N={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({},N),window.__store_context__)),Object(h.k)(window.__mmStore)&&Object.assign(window.__store_context__,{store:window.__mmStore.split(".")[0]}),Object(h.g)(window.Shopify)){const L=Object(O.a)(),S=window.Shopify.shop.split(".")[0];Object.assign(window.__store_context__,{platform:t.Platforms.SHOPIFY,store:S,dumps:{},currency:{active_currency_code:(y=(w=window.Shopify.currency)===null||w===void 0?void 0:w.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:(D=window.Shopify.routes)===null||D===void 0?void 0:D.root},product:L.product})}return window.__store_context__}return N}},function(b,u,e){"use strict";(function(t){e.d(u,"b",function(){return w}),e.d(u,"a",function(){return D});var o,h,O,v;const w=((o=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||o===void 0?void 0:o.NODE_ENV)==="production",y=((h=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||h===void 0?void 0:h.NODE_ENV)==="test",D=(v=(O=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||O===void 0?void 0:O.NODE_ENV)!==null&&v!==void 0?v:"development"}).call(this,e(16))},function(b,u,e){"use strict";e.d(u,"d",function(){return l}),e.d(u,"b",function(){return d}),e.d(u,"c",function(){return E}),e.d(u,"a",function(){return C});const t="__SECRET_INTERNALS_DO_NOT_USE__";var o=e(18),h=e(6),O=e(4),v=e(2),w=e(9),y=e(0),D=e(15),N=e(19),L=e(5),S=function(m,a){var s={};for(var n in m)Object.prototype.hasOwnProperty.call(m,n)&&a.indexOf(n)<0&&(s[n]=m[n]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function")for(var T=0,n=Object.getOwnPropertySymbols(m);T{v.a.debug("MM:Clearing impressions cache"),a.impressionsCache=new Set,a.viewsCache=new Set,a.stats=i}),a.addOrderCompletionListener()}addOrderCompletionListener(){window.addEventListener("message",a=>{const{data:s}=a,{messageType:n,messageData:{actionType:T}={}}=s,A=Object(y.c)(s,"messageAuth.source",null),R=Object(y.c)(s,"messageData.payload.order",null),{id:c,line_items:g=[],cart_token:I="",email:U="",customer:M,customer_locale:B=""}=R!=null?R:{},{id:W=-1}=M!=null?M:{};n==="MODEMAGIC_CONVERSION_EVENT"&&T==="ORDER_CREATE"&&!Object(y.e)(A)&&j.has(A)&&!Object(y.j)(c)&&Object(D.b)({email:U,orderId:c,customerId:W,cartToken:I,customerLocale:B,source:A!=null?A:void 0,lineItems:g})})}flushQueue(){var a,s,n;const T=p.getInstance(),A=T.eventQueue.get(f.FLUSH_QUEUE);if(!Object(y.e)(A)&&!Object(y.j)(A)){const c=new Date().getTime();if(c-A.queued>T.queWaitTime){if(A.counter>=T.maxRetries){T.eventQueue.set(f.ACTIVE_QUEUE,[...(a=T.eventQueue.get(f.ACTIVE_QUEUE))!==null&&a!==void 0?a:[],...A.events]),T.eventQueue.set(f.FLUSH_QUEUE,void 0),T.flushQueue();return}T.eventQueue.set(f.FLUSH_QUEUE,Object.assign(Object.assign({},A),{queued:new Date().getTime(),counter:A.counter+1}))}else{if(T.retryQueTimeout!==-1)return;const g=T.queWaitTime-(c-A.queued)+1e3;T.retryQueTimeout=window.setTimeout(()=>{T.retryQueTimeout=-1,T.flushQueue()},g);return}}else{const c=(s=T.eventQueue.get(f.ACTIVE_QUEUE))!==null&&s!==void 0?s:[];Array.isArray(c)&&c.length>0&&(T.eventQueue.set(f.ACTIVE_QUEUE,[]),T.eventQueue.set(f.FLUSH_QUEUE,{events:c,queued:new Date().getTime(),counter:1}))}const R=(n=T.eventQueue.get(f.FLUSH_QUEUE))===null||n===void 0?void 0:n.events;if(Array.isArray(R)&&R.length>0){const c=JSON.stringify(R);fetch(l,{method:"POST",body:c}).then(()=>{T.eventQueue.set(f.FLUSH_QUEUE,void 0)}).catch(()=>{})}}queueEvent(a){var s;const n=p.getInstance(),T=[...(s=n.eventQueue.get(f.ACTIVE_QUEUE))!==null&&s!==void 0?s:[],a];n.eventQueue.set(f.ACTIVE_QUEUE,T),n.queTimeout>0&&(window.clearTimeout(n.queTimeout),n.queTimeout=-1),T.length>=r?n.flushQueue():n.queTimeout=window.setTimeout(()=>{n.flushQueue()},1e3)}raiseEvent(a){const{store:s}=Object(L.a)(),{appName:n=N.a,entity:T,eventType:A,data:R,element:c}=a,g=window.location.href,I=Object(O.e)(),U=R!=null?R:{},{product:M,storyboard:B,template:W,impressionsData:Q,widgets:F,playbookId:x}=U,V=S(U,["product","storyboard","template","impressionsData","widgets","playbookId"]),G=new Date().getTime()/1e3,K=p.getInstance();K.stats[A]+=1,K.log(T,A,R,c),K.queueEvent(Object.assign(Object.assign({app_name:n,store_id:s,product_id:M,storyboard_id:B,widget_ids:F,template_id:W,category:T,action:A,time:G,playbook_id:x,device_id:Object(w.a)(),full_url:g,query:I},V),Q))}log(a,s,n,T){v.a.debug(`MM:${a}:${s}`),T&&v.a.debug("src element: ",T),v.a.debug("data: ",JSON.stringify(n)),v.a.debug("stats: ",JSON.stringify(p.getInstance().stats))}click(a){const{entity:s,element:n,data:T,appName:A}=a;p.getInstance().raiseEvent({appName:A,entity:s,eventType:d.CLICK,data:T,element:n})}impression(a){const{entity:s,element:n,data:T,appName:A}=a,R=p.getInstance();R.impressionsCache.has(n)||(R.raiseEvent({appName:A,entity:s,eventType:d.IMPRESSION,data:T,element:n}),R.impressionsCache.add(n))}view(a){const{entity:s,element:n,data:T,appName:A}=a,R=p.getInstance();R.viewsCache.has(n)||(R.raiseEvent({appName:A,entity:s,eventType:d.VIEW,data:T,element:n}),R.viewsCache.add(n))}hide(a){const{entity:s,element:n,data:T,appName:A}=a;p.getInstance().raiseEvent({appName:A,entity:s,eventType:d.HIDE,data:T,element:n})}conversion(a){const{data:s,appName:n}=a;p.getInstance().raiseEvent({appName:n,entity:E.WIDGET,eventType:d.CONVERSION,data:s})}}const C=p.getInstance()},,function(b,u,e){"use strict";e.d(u,"a",function(){return h});var t=e(0);const o="mm.userDeviceID",h=()=>{const O=window.localStorage.getItem(o);if(Object(t.e)(O)){const v=JSON.stringify(performance.now())+Math.random().toString(36).substring(2,11);return window.localStorage.setItem(o,v),v}return O}},,,,function(b,u,e){"use strict";e.d(u,"a",function(){return t});const t=()=>{const o=document.querySelectorAll("[data-app='mm']");let h={};return o.forEach(O=>{h=Object.assign(Object.assign({},h),O.dataset)}),h}},,function(b,u,e){"use strict";e.d(u,"a",function(){return h}),e.d(u,"b",function(){return O});var t=e(7),o=e(0);const h={swift:!0,shopflo:!0,fastrr:!0};function O(v){const{customerLocale:w,customerId:y,orderId:D,lineItems:N,email:L,cartToken:S,source:P}=v,j=N.reduce((l,{properties:r={}})=>{const d=r.__mmWidget,E=Object(o.n)(d,null);return E!==null&&!Array.isArray(E)&&typeof E=="object"&&l.push(E),l},[]);t.a.conversion({appName:"shopify",data:{widgets:j,meta:{source:P,line_items:N,order:D,cartToken:S,src:window.location.href,customer:{id:y,locale:w,email:L}},impressionsData:{apply_type:"manual"}}})}},function(b,u){var e=b.exports={},t,o;function h(){throw new Error("setTimeout has not been defined")}function O(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?t=setTimeout:t=h}catch(r){t=h}try{typeof clearTimeout=="function"?o=clearTimeout:o=O}catch(r){o=O}})();function v(r){if(t===setTimeout)return setTimeout(r,0);if((t===h||!t)&&setTimeout)return t=setTimeout,setTimeout(r,0);try{return t(r,0)}catch(d){try{return t.call(null,r,0)}catch(E){return t.call(this,r,0)}}}function w(r){if(o===clearTimeout)return clearTimeout(r);if((o===O||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(r);try{return o(r)}catch(d){try{return o.call(null,r)}catch(E){return o.call(this,r)}}}var y=[],D=!1,N,L=-1;function S(){!D||!N||(D=!1,N.length?y=N.concat(y):L=-1,y.length&&P())}function P(){if(!D){var r=v(S);D=!0;for(var d=y.length;d;){for(N=y,y=[];++L1)for(var E=1;E{const[,,w]=v;h.apply(O,v),t.listeners.forEach(y=>typeof w=="string"&&y(w.split("?")[1]||""))}})}static listen(h){t.unlisten(h),t.listeners.push(h)}static unlisten(h){t.listeners=t.listeners.filter(O=>O!==h)}}t.listeners=[]},function(b,u,e){"use strict";e.d(u,"c",function(){return L}),e.d(u,"b",function(){return P}),e.d(u,"a",function(){return j});var t=e(13),o=e(0),h=e(1),O=e.n(h),v=e(5),w=e(9),y=function(l,r,d,E){function i(f){return f instanceof d?f:new d(function(p){p(f)})}return new(d||(d=Promise))(function(f,p){function C(s){try{a(E.next(s))}catch(n){p(n)}}function m(s){try{a(E.throw(s))}catch(n){p(n)}}function a(s){s.done?f(s.value):i(s.value).then(C,m)}a((E=E.apply(l,r||[])).next())})};const D="COD",N=()=>y(void 0,void 0,void 0,function*(){var l,r;let d=null;try{if(window.location.pathname.includes("/products/")){const i=yield fetch(`${window.location.pathname}.json`).then(f=>f.json());d=(r=(l=i==null?void 0:i.product)===null||l===void 0?void 0:l.id)===null||r===void 0?void 0:r.toString()}}catch(E){console.debug(E)}return d!=null?d:null}),L=()=>y(void 0,void 0,void 0,function*(){const l=Object(t.a)();if(!l.product&&Object(o.g)(window.Shopify)){const r=yield N();if(typeof r=="string"){l.product=r;const d=document.createElement("div");d.setAttribute("data-app","mm"),d.setAttribute("data-product",r),document.body.appendChild(d)}}return Promise.resolve()}),S=()=>new Promise(l=>{const r=setInterval(()=>{const d=Object(o.c)(window,"Shopflo.order.tags","").split(",").map(E=>E.trim()).filter(E=>E.length>0);if(d.length>0){const E=new Set(d);clearInterval(r),l(E.has(D)?"true":"false")}},100)}),P=(l=[])=>y(void 0,void 0,void 0,function*(){var r,d;const{store:E,product:i}=Object(v.a)(),f=!Object(o.j)(window.Shopflo),p=typeof((r=window.Shopify)===null||r===void 0?void 0:r.checkout)!="undefined"||f&&new URLSearchParams(window.location.search).get("page")==="thank_you"?"true":"false";let C="false",m=-1;return p==="true"&&(C=yield S(),m=(d=+Object(o.c)(window,"Shopflo.order.total_price","0"))!==null&&d!==void 0?d:-1),{shop:E,path:window.location.pathname,domain:window.location.host,product:i,app:h.FeaturesAPIApp.MODEMAGIC,hash:window.location.hash,device_id:Object(w.a)(),thankyou:p,shopflo_cod:C,cart_value:`${m}`,query:window.encodeURIComponent(window.location.search),features:l}}),j=(l,r)=>{Object.entries(r).forEach(([d,E])=>{E&&(Array.isArray(E)?E.forEach(i=>l.searchParams.set(d,i)):l.searchParams.set(d,E))})}},,,,,,,,function(b,u,e){"use strict";e.r(u),e.d(u,"addFeatureSettings",function(){return D});var t=e(2),o=e(9),h=e(7),O=e(5),v=e(20),w=e(21),y=function(l,r,d,E){function i(f){return f instanceof d?f:new d(function(p){p(f)})}return new(d||(d=Promise))(function(f,p){function C(s){try{a(E.next(s))}catch(n){p(n)}}function m(s){try{a(E.throw(s))}catch(n){p(n)}}function a(s){s.done?f(s.value):i(s.value).then(C,m)}a((E=E.apply(l,r||[])).next())})};function D(l,r,d="modeMagic"){const E=`${d}Settings`;typeof window[E]=="undefined"&&(window[E]={}),typeof r!="undefined"&&(window[E][l]=r)}function N(l){l.forEach(({name:r,src:d,data:E})=>{D(r,E,"modeMagic");const i=document.createElement("script");i.setAttribute("data-mm-script",r),i.setAttribute("type","text/javascript"),i.setAttribute("src",d),i.setAttribute("fetchPriority","high"),document.body.appendChild(i)})}function L(l){try{const d=JSON.parse(l.responseText).data;N(d)}catch(r){t.a.debug(r)}}const S=()=>{const{store:l,product:r}=Object(O.a)(),d=new Date().getTime()/1e3;fetch(h.d,{method:"POST",body:JSON.stringify({device_id:Object(o.a)(),meta:{url:window.location.href},product_id:r!=null?r:"",action:h.b.PAGE_VIEW,time:d,store_id:l,category:"price_drop"})})};function P(){return y(this,void 0,void 0,function*(){let l=!1;const r=yield Object(w.b)();l||(S(),l=!0,window==null||window.addEventListener("popstate",()=>{l&&S()}));const d=new URL("https://app.getmodemagic.com/api/features");Object(w.a)(d,r);const E=new XMLHttpRequest;E.addEventListener("load",L.bind(null,E)),window!=null&&window.MMScriptLoaded||(E.open("GET",d.toString(),!0),E.send(),window.MMScriptLoaded=!0)})}const j=()=>y(void 0,void 0,void 0,function*(){var l;window!=null&&window.MMScriptLoaded||(window.MMScriptLoaded=(l=window==null?void 0:window.MMScriptLoaded)!==null&&l!==void 0?l:!1,yield Object(w.c)(),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",P):yield P())});t.a.debug("[loader] starting initialization"),j(),v.a.init(),v.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,j())})}]);})();