@ordergroove/offers 2.43.0 → 2.44.1-alpha-PR-1166-3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/bundle-report.html +55 -53
  3. package/dist/offers.js +38 -38
  4. package/dist/offers.js.map +4 -4
  5. package/package.json +2 -2
  6. package/src/components/FrequencyStatus.js +13 -10
  7. package/src/components/Offer.js +33 -14
  8. package/src/components/OptinButton.js +2 -2
  9. package/src/components/OptinSelect.js +5 -5
  10. package/src/components/OptinStatus.js +15 -9
  11. package/src/components/Price.js +3 -3
  12. package/src/components/SelectFrequency.js +11 -6
  13. package/src/components/TestWizard.js +45 -41
  14. package/src/components/UpsellModal.js +9 -3
  15. package/src/components/__tests__/Offer.spec.js +0 -19
  16. package/src/components/__tests__/OptinStatus.spec.js +17 -4
  17. package/src/core/__tests__/actions.spec.js +47 -1
  18. package/src/core/__tests__/base.spec.js +0 -77
  19. package/src/core/__tests__/offerRequest.spec.js +2 -1
  20. package/src/core/__tests__/selectors.spec.js +7 -7
  21. package/src/core/actions-preview.js +6 -3
  22. package/src/core/actions.js +22 -13
  23. package/src/core/base.js +0 -23
  24. package/src/core/experiments.js +2 -4
  25. package/src/core/offerRequest.js +1 -1
  26. package/src/core/{reducer.js → reducer.ts} +30 -10
  27. package/src/core/{selectors.js → selectors.ts} +73 -57
  28. package/src/core/types/api.ts +71 -0
  29. package/src/core/types/reducer.ts +95 -0
  30. package/src/core/types/utility.ts +1 -0
  31. package/src/core/utils.ts +32 -15
  32. package/src/make-api.js +1 -1
  33. package/src/shopify/__tests__/productPlan.spec.js +18 -8
  34. package/src/shopify/__tests__/reducers/config.spec.js +497 -0
  35. package/src/shopify/__tests__/shopifyReducer.spec.js +68 -611
  36. package/src/shopify/__tests__/utils.spec.js +68 -1
  37. package/src/shopify/reducers/config.ts +223 -0
  38. package/src/shopify/reducers/productPlans.ts +3 -10
  39. package/src/shopify/shopifyMiddleware.ts +2 -9
  40. package/src/shopify/{shopifyReducer.js → shopifyReducer.ts} +52 -221
  41. package/src/shopify/types/shopify.ts +1 -1
  42. package/src/shopify/utils.ts +70 -0
  43. package/src/types.ts +0 -16
package/dist/offers.js CHANGED
@@ -8,10 +8,10 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.getOwnPropertyDescriptor;var La=Object.getOwnPropertyNames;var Ma=Object.getPrototypeOf,$a=Object.prototype.hasOwnProperty;var n=(t,e)=>dt(t,"name",{value:e,configurable:!0});var Q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kn=(t,e)=>{for(var r in e)dt(t,r,{get:e[r],enumerable:!0})},qn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of La(e))!$a.call(t,i)&&i!==r&&dt(t,i,{get:()=>e[i],enumerable:!(o=Ua(e,i))||o.enumerable});return t};var se=(t,e,r)=>(r=t!=null?Fa(Ma(t)):{},qn(e||!t||!t.__esModule?dt(r,"default",{value:t,enumerable:!0}):r,t)),Va=t=>qn(dt({},"__esModule",{value:!0}),t);var Ht=Q((jt,jn)=>{(function(t,e){typeof jt=="object"&&typeof jn<"u"?e(jt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(jt,function(t){"use strict";function e(o,i,s,a){var c,l=!1,p=0;function d(){c&&clearTimeout(c)}n(d,"clearExistingTimeout");function u(){d(),l=!0}n(u,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var _=arguments.length,S=new Array(_),m=0;m<_;m++)S[m]=arguments[m];var b=this,P=Date.now()-p;if(l)return;function E(){p=Date.now(),s.apply(b,S)}n(E,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&E(),d(),a===void 0&&P>o?E():i!==!0&&(c=setTimeout(a?w:E,a===void 0?o-P:o))}return n(h,"wrapper"),h.cancel=u,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var _t=Q((zu,ci)=>{var Za="Expected a function",ri="__lodash_hash_undefined__",Xa="[object Function]",ec="[object GeneratorFunction]",tc=/[\\^$.*+?()[\]{}|]/g,rc=/^\[object .+?Constructor\]$/,oc=typeof window=="object"&&window&&window.Object===Object&&window,nc=typeof self=="object"&&self&&self.Object===Object&&self,oi=oc||nc||Function("return this")();function ic(t,e){return t?.[e]}n(ic,"getValue");function sc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(sc,"isHostObject");var ac=Array.prototype,cc=Function.prototype,ni=Object.prototype,uo=oi["__core-js_shared__"],ti=function(){var t=/[^.]+$/.exec(uo&&uo.keys&&uo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ii=cc.toString,fo=ni.hasOwnProperty,lc=ni.toString,pc=RegExp("^"+ii.call(fo).replace(tc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),uc=ac.splice,dc=si(oi,"Map"),bt=si(Object,"create");function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"Hash");function fc(){this.__data__=bt?bt(null):{}}n(fc,"hashClear");function hc(t){return this.has(t)&&delete this.__data__[t]}n(hc,"hashDelete");function mc(t){var e=this.__data__;if(bt){var r=e[t];return r===ri?void 0:r}return fo.call(e,t)?e[t]:void 0}n(mc,"hashGet");function gc(t){var e=this.__data__;return bt?e[t]!==void 0:fo.call(e,t)}n(gc,"hashHas");function yc(t,e){var r=this.__data__;return r[t]=bt&&e===void 0?ri:e,this}n(yc,"hashSet");Te.prototype.clear=fc;Te.prototype.delete=hc;Te.prototype.get=mc;Te.prototype.has=gc;Te.prototype.set=yc;function Be(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Be,"ListCache");function bc(){this.__data__=[]}n(bc,"listCacheClear");function _c(t){var e=this.__data__,r=sr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():uc.call(e,r,1),!0}n(_c,"listCacheDelete");function Sc(t){var e=this.__data__,r=sr(e,t);return r<0?void 0:e[r][1]}n(Sc,"listCacheGet");function Ec(t){return sr(this.__data__,t)>-1}n(Ec,"listCacheHas");function xc(t,e){var r=this.__data__,o=sr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(xc,"listCacheSet");Be.prototype.clear=bc;Be.prototype.delete=_c;Be.prototype.get=Sc;Be.prototype.has=Ec;Be.prototype.set=xc;function we(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(we,"MapCache");function vc(){this.__data__={hash:new Te,map:new(dc||Be),string:new Te}}n(vc,"mapCacheClear");function Pc(t){return ar(this,t).delete(t)}n(Pc,"mapCacheDelete");function Oc(t){return ar(this,t).get(t)}n(Oc,"mapCacheGet");function Tc(t){return ar(this,t).has(t)}n(Tc,"mapCacheHas");function wc(t,e){return ar(this,t).set(t,e),this}n(wc,"mapCacheSet");we.prototype.clear=vc;we.prototype.delete=Pc;we.prototype.get=Oc;we.prototype.has=Tc;we.prototype.set=wc;function sr(t,e){for(var r=t.length;r--;)if(Ic(t[r][0],e))return r;return-1}n(sr,"assocIndexOf");function Cc(t){if(!ai(t)||Ac(t))return!1;var e=kc(t)||sc(t)?pc:rc;return e.test(Nc(t))}n(Cc,"baseIsNative");function ar(t,e){var r=t.__data__;return Rc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(ar,"getMapData");function si(t,e){var r=ic(t,e);return Cc(r)?r:void 0}n(si,"getNative");function Rc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Rc,"isKeyable");function Ac(t){return!!ti&&ti in t}n(Ac,"isMasked");function Nc(t){if(t!=null){try{return ii.call(t)}catch{}try{return t+""}catch{}}return""}n(Nc,"toSource");function ho(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Za);var r=n(function(){var o=arguments,i=e?e.apply(this,o):o[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,o);return r.cache=s.set(i,a),a},"memoized");return r.cache=new(ho.Cache||we),r}n(ho,"memoize");ho.Cache=we;function Ic(t,e){return t===e||t!==t&&e!==e}n(Ic,"eq");function kc(t){var e=ai(t)?lc.call(t):"";return e==Xa||e==ec}n(kc,"isFunction");function ai(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(ai,"isObject");ci.exports=ho});var Yi=Q((Pd,wo)=>{function cl(t,e){var r,o,i,s,a,c,l,p,d,u;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,l=461845907,u=0;u<o;)d=t.charCodeAt(u)&255|(t.charCodeAt(++u)&255)<<8|(t.charCodeAt(++u)&255)<<16|(t.charCodeAt(++u)&255)<<24,++u,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*l+(((d>>>16)*l&65535)<<16)&4294967295,i^=d,i=i<<13|i>>>19,s=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(s&65535)+27492+(((s>>>16)+58964&65535)<<16);switch(d=0,r){case 3:d^=(t.charCodeAt(u+2)&255)<<16;case 2:d^=(t.charCodeAt(u+1)&255)<<8;case 1:d^=t.charCodeAt(u)&255,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*l+(((d>>>16)*l&65535)<<16)&4294967295,i^=d}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}n(cl,"murmurhash3_32_gc");typeof wo<"u"&&(wo.exports=cl)});var Wi=Q((Od,Co)=>{function ll(t,e){for(var r=t.length,o=e^r,i=0,s;r>=4;)s=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^s,r-=4,++i;switch(r){case 3:o^=(t.charCodeAt(i+2)&255)<<16;case 2:o^=(t.charCodeAt(i+1)&255)<<8;case 1:o^=t.charCodeAt(i)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}n(ll,"murmurhash2_32_gc");typeof Co!==void 0&&(Co.exports=ll)});var Ki=Q((Td,_r)=>{var Ji=Yi(),pl=Wi();_r.exports=Ji;_r.exports.murmur3=Ji;_r.exports.murmur2=pl});var Dr=Q((mh,As)=>{var cp={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};As.exports=cp});var Is=Q((gh,Ns)=>{var Ie=Dr(),lp=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ie.PAR_OPEN:case Ie.PAR_CLOSE:case Ie.OP_NOT:case Ie.BINARY_AND:case Ie.BINARY_OR:e&&(r.push({type:Ie.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ie.LITERAL,value:e}),r},"Tokenizer");Ns.exports=lp});var qs=Q((yh,ks)=>{var Se=Dr(),pp=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Se.LITERAL:e.unshift(i);break;case Se.BINARY_AND:case Se.BINARY_OR:case Se.OP_NOT:case Se.PAR_OPEN:r.push(i);break;case Se.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Se.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Se.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),up=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");ks.exports={PolishNotation:pp,PolishGenerator:up}});var Fs=Q((bh,Ds)=>{var L=Dr(),H=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===L.LEAF}isAtomic(){return this.isLeaf()||this.op===L.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new H(L.BINARY_AND,e,r)}static CreateNot(e){return new H(L.OP_NOT,e)}static CreateOr(e,r){return new H(L.BINARY_OR,e,r)}static CreateLiteral(e){return new H(L.LEAF,null,null,e)}};n(H,"ExpNode");var st=n(t=>{let e=t.next().value;switch(e.type){case L.LITERAL:return H.CreateLiteral(e.value);case L.OP_NOT:return H.CreateNot(st(t));case L.BINARY_AND:{let r=st(t),o=st(t);return H.CreateAnd(r,o)}case L.BINARY_OR:{let r=st(t),o=st(t);return H.CreateOr(r,o)}}return null},"make"),at=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===L.OP_NOT)return!at(t.left,e);if(t.op===L.BINARY_OR)return at(t.left,e)||at(t.right,e);if(t.op===L.BINARY_AND)return at(t.left,e)&&at(t.right,e)},"nodeEvaluator");Ds.exports={make:st,nodeEvaluator:at}});var $s=Q((_h,Ms)=>{var dp=Is(),Us=qs(),Ls=Fs(),fp=n((t,e)=>{let r=dp(t),o=Us.PolishNotation(r),i=Us.PolishGenerator(o),s=Ls.make(i);return Ls.nodeEvaluator(s,e)},"parse");Ms.exports={parse:fp}});var Uu={};kn(Uu,{addOptinChangedCallback:()=>mu,addTemplate:()=>gu,autoInit:()=>Du,clear:()=>yu,config:()=>bu,default:()=>Fu,disableOptinChangedCallbacks:()=>_u,getOptins:()=>Su,getProductsForPurchasePost:()=>Eu,initialize:()=>xu,isReady:()=>hu,offers:()=>v,platform:()=>D,previewMode:()=>vu,register:()=>Pu,resolveSettings:()=>Ou,setAuthUrl:()=>Tu,setEnvironment:()=>wu,setLocale:()=>Cu,setMerchantId:()=>Ru,setPublicPath:()=>Au,setTemplates:()=>Nu,setupCart:()=>Iu,setupProduct:()=>ku,setupProducts:()=>qu,store:()=>qa});function no(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(no,"symbolObservablePonyfill");var De;typeof self<"u"?De=self:typeof window<"u"||typeof window<"u"?De=window:typeof module<"u"?De=module:De=Function("return this")();var ja=no(De),io=ja;var so=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),ft={INIT:"@@redux/INIT"+so(),REPLACE:"@@redux/REPLACE"+so(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+so()},"PROBE_UNKNOWN_ACTION")};function Ha(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(Ha,"isPlainObject");function ao(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(ao)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var i=t,s=e,a=[],c=a,l=!1;function p(){c===a&&(c=a.slice())}n(p,"ensureCanMutateNextListeners");function d(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(d,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var b=!0;return p(),c.push(m),n(function(){if(!!b){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");b=!1,p();var E=c.indexOf(m);c.splice(E,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!Ha(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,s=i(s,m)}finally{l=!1}for(var b=a=c,P=0;P<b.length;P++){var E=b[P];E()}return m}n(h,"dispatch");function _(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:ft.REPLACE})}n(_,"replaceReducer");function S(){var m,b=u;return m={subscribe:n(function(E){if(typeof E!="object"||E===null)throw new TypeError("Expected the observer to be an object.");function w(){E.next&&E.next(d())}n(w,"observeState"),w();var C=b(w);return{unsubscribe:C}},"subscribe")},m[io]=function(){return this},m}return n(S,"observable"),h({type:ft.INIT}),o={dispatch:h,subscribe:u,getState:d,replaceReducer:_},o[io]=S,o}n(ao,"createStore");function Ga(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ga,"getUndefinedStateErrorMessage");function Ba(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:ft.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:ft.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+ft.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(Ba,"assertReducerShape");function Vt(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var i=e[o];typeof t[i]=="function"&&(r[i]=t[i])}var s=Object.keys(r),a,c;try{Ba(r)}catch(l){c=l}return n(function(p,d){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var h=!1,_={},S=0;S<s.length;S++){var m=s[S],b=r[m],P=p[m],E=b(P,d);if(typeof E>"u"){var w=Ga(m,d);throw new Error(w)}_[m]=E,h=h||E!==P}return h=h||s.length!==Object.keys(p).length,h?_:p},"combination")}n(Vt,"combineReducers");function Dn(t,e){return function(){return e(t.apply(this,arguments))}}n(Dn,"bindActionCreator");function Un(t,e){if(typeof t=="function")return Dn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=Dn(i,e))}return r}n(Un,"bindActionCreators");function za(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(za,"_defineProperty");function Fn(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(Fn,"ownKeys");function Ya(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fn(r,!0).forEach(function(o){za(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Ya,"_objectSpread2");function co(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,i){return function(){return o(i.apply(void 0,arguments))}})}n(co,"compose");function Ln(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var i=o.apply(void 0,arguments),s=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:i.getState,dispatch:n(function(){return s.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return s=co.apply(void 0,c)(i.dispatch),Ya({},i,{dispatch:s})}}}n(Ln,"applyMiddleware");function Mn(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Mn,"createThunkMiddleware");var $n=Mn();$n.withExtraArgument=Mn;var Vn=$n;var Di=se(Ht());var Hn=/^og_auth=/,Wa=n((t=Hn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Hn,""),"c"),Gt=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),Ja=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),Ka=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Gn(){return typeof window.og_auth<"u"?Gt(window.og_auth):null}n(Gn,"a");async function Qa(t=100){return new Promise(e=>{setTimeout(()=>e(Gn()),t)})}n(Qa,"f");async function Bn(t,e=Wa,r=Ja){let o;if(o=Gt(Gn())||Gt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Ka(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Qa());if(o=Gt(o),o)return o;throw new Error("Unauthorized")}n(Bn,"u");var R="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ae="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Fe="SET_MERCHANT_ID",q="REQUEST_OFFER",T="RECEIVE_OFFER",ht="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",Bt="SET_AUTH_URL",zn="REQUEST_AUTH",zt="AUTHORIZE",xe="UNAUTHORIZED",Yn="REQUEST_ORDERS",Yt="RECEIVE_ORDERS",mt="CART_PRODUCT_KEY_HAS_CHANGED",Wt="RECEIVE_ORDER_ITEMS",Wn="FETCH_RESPONSE_ERROR",Le="SET_ENVIRONMENT_LOCAL",Me="SET_ENVIRONMENT_STAGING",$e="SET_ENVIRONMENT_DEV",Ve="SET_ENVIRONMENT_PROD",Jt="READY",Jn="CONCLUDE_UPSELL",Kn="REQUEST_CREATE_IU_ORDER",Kt="CREATE_ONE_TIME",Qn="REQUEST_CONVERT_ONE_TIME",Qt="CONVERT_ONE_TIME";var je="CHECKOUT",Zn="RECEIVE_FETCH",Zt="SET_LOCALE",He="SET_CONFIG",ue="SET_PREVIEW_STANDARD_OFFER",gt="SET_PREVIEW_UPSELL_OFFER",lo="SET_PREVIEW_PREPAID_OFFER",Xt="ADD_TEMPLATE",er="SET_TEMPLATES",ve="LOCAL_STORAGE_CHANGE",de="LOCAL_STORAGE_CLEAR",tr="SET_FIRST_ORDER_PLACE_DATE",rr="SET_PRODUCT_TO_SUBSCRIBE",Y="RECEIVE_PRODUCT_PLANS",F="SETUP_PRODUCT",fe="SETUP_CART",ce="RECEIVE_MERCHANT_SETTINGS",po="SET_EXPERIMENT_VARIANT",Ge="pdp",Xn="local",or="dev",Pe="staging",Oe="prod",nr="static.ordergroove.com",ir="staging.static.ordergroove.com",ei="og-cart-updated";var cr=se(_t());var mo=n((...t)=>JSON.stringify(t),"memoizeKey"),St=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Et=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),lr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),li=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),pi=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),qc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Dc=(0,cr.default)(St(Et((t,e,r,o="pdp",i={})=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=[["session_id",e],["page_type",1],["p",qc(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(i)];return[`/offer/${t}/${o}?${pi(s)}`]})),mo),Fc=(0,cr.default)(St(Et(lr((t=1,e="place")=>[`/orders/?${pi([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),mo),Uc=(0,cr.default)(St(Et(lr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),mo),Lc=St(Et(lr(li((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),xt=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),go=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Mc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),ui=n(t=>[...new Set(t&&t.split(/\s+/))].filter(go).sort(Mc),"parseFrequenciesList");var vt=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),$c=St(Et(lr(li((t,e,r,o)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let i=xt(e);if(!i)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,session_id:o,...i}}]})))),ze={fetchOffer:Dc,fetchOrders:Fc,fetchItems:Uc,createOneTime:Lc,convertOneTimeToSubscription:$c},di=ze;var yo=Pt(),D={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(yo==null?void 0:yo.dataset.shopifySellingPlans)!="undefined"};function Vc(t,e){return t===e}n(Vc,"defaultEqualityCheck");function jc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,i=0;i<o;i++)if(!t(e[i],r[i]))return!1;return!0}n(jc,"areArgumentsShallowlyEqual");function Hc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Vc,r=null,o=null;return function(){return jc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Hc,"defaultMemoize");function Gc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Gc,"getDependencies");function Bc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var c=0,l=s.pop(),p=Gc(s),d=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],_=p.length,S=0;S<_;S++)h.push(p[S].apply(null,arguments));return d.apply(null,h)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}n(Bc,"createSelectorCreator");var Z=Bc(Hc);var W=se(_t());W.default.Cache=Map;function zc(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(zc,"arraysEqual");function Yc(t,e,r){let o=vt(r);return D.shopify_selling_plans?re(t,e,o):o}n(Yc,"resolveFrequency");var A=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||zc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Ot=n(t=>t.optedin||[],"optedinSelector"),fi=n(t=>t.optedout||[],"optedoutSelector"),bo=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Wc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Jc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Kc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Qc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Zc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),X=(0,W.default)(t=>Z(Ot,fi,bo,(e,r,o)=>{let i=e.find(s=>A(t,s));return i||(r.find(s=>A(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),pr=(0,W.default)(t=>Z(Ot,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),hi=(0,W.default)(t=>Z(Ot,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),ee=(0,W.default)(t=>Z(Zc,e=>e[t.id]||null),t=>JSON.stringify(t)),ur=(0,W.default)(t=>Z(fi,e=>e.find(r=>A(t,r))));var te=(0,W.default)(t=>Z(X(t),e=>e&&e.frequency||null)),M=(0,W.default)(t=>Z(X(t),e=>e&&e.prepaidShipments||null)),$=(0,W.default)(t=>Z(Qc,e=>{var o;return(((o=e[O(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ye=(0,W.default)(t=>Z(Wc,Jc,Kc,(e,r,o)=>e[O(t)]&&Yc(r,o,e[O(t)])||null)),_o=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),V=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(_o(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),We=n(t=>({templates:t.templates||[]}),"templatesSelector");function dr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(dr,"onReady");function Pt(){return document.querySelector([`script[src^="https://${nr}"]`,`script[src^="https://${ir}"]`,`script[src^="http://${nr}"]`,`script[src^="http://${ir}"]`].join(","))}n(Pt,"getMainJs");function So(){let t=Pt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Pe)?Pe:Oe,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(So,"resolveEnvAndMerchant");var O=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=D)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),mi=n((t,e)=>{var r;if(D.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Tt=n((t,e)=>{var o,i,s;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:((i=e.frequencies)==null?void 0:i.length)>0&&((s=e.frequenciesEveryPeriod)==null?void 0:s.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),e.frequencies[0]):t},"frequencyToSellingPlan");function gi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=So();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Oe?nr:ir}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(gi,"autoInitializeOffers");var yi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function bi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(bi,"getCookieValue");var Je=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),he=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),fr=n((t=[],e=[])=>{var r;return!!(((r=D)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),re=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function Eo(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(Eo,"getOrCreateHidden");function Ke(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Ke,"getMatchingProductIfExists");var J=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Qe=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),_i=n((t,e)=>({type:ht,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),mr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),ge=n((t,e,r)=>({type:ae,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var gr=n(t=>({type:Jn,payload:{product:t}}),"concludeUpsell"),Si=n(t=>({type:Fe,payload:t}),"setMerchantId"),xo=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Xc=n(t=>({type:zn,payload:t}),"requestAuth"),wt=n((t,e,r,o)=>({type:zt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),me=n(t=>({type:xe,payload:t}),"unauthorized"),Ei=n(t=>({type:Bt,payload:t}),"setAuthUrl"),Ct=n(t=>({type:Zn,payload:t}),"fetchDone"),xi=n((t=Bn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(me({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Xc(s);return r(a),t(s).then(({sig_field:c,ts:l,sig:p})=>r(wt(i,c,l,p)),c=>r(me(c))).finally(()=>r(Ct(a)))},"fetchAuthThunk"),"fetchAuth"),el=n((t,e)=>({type:Yn,payload:{status:t,ordering:e}}),"requestOrders"),vo=n(t=>({type:Yt,payload:t}),"receiveOrders"),Po=n(t=>({type:Wt,payload:t}),"receiveItems"),yr=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(me("No auth set."));let c=el(t,e);return o(c),ze.fetchOrders(s,a,t,e).then(l=>{if(l.results){o(vo(l));let p=(l.results[0]||{}).public_id;if(p)return ze.fetchItems(s,a,p).then(d=>o(Po(d)))}return o(me(l.detail)),null},l=>o(me(l))).finally(()=>o(Ct(c)))},"fetchOrdersThunk"),"fetchOrders"),vi=n(t=>{switch(t){case Xn:return{type:Le,payload:t};case or:return{type:$e,payload:t};case Pe:return{type:Me,payload:t};case Oe:return{type:Ve,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Pi=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(xo(r)),o},"requestSessionId"),ye=n((t,e)=>({type:T,payload:{...t,offer:e}}),"receiveOffer"),hr=n(t=>({type:Wn,payload:t}),"fetchResponseError"),Oo=n((t,e=Ge,r)=>({type:q,payload:{product:t,module:e,offer:r}}),"requestOffer"),Oi=Oo,Ti=n(()=>({type:je}),"checkout"),tl=n((t,e,r,o)=>({type:Kn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),rl=n(t=>({type:Kt,payload:t}),"receiveCreateOneTime"),ol=n((t,e)=>({type:Qn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),nl=n((t,e)=>({type:Qt,payload:{response:t,product:e}}),"receiveConvertOneTime"),br=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:d},previewUpsellOffer:u,offerId:h,sessionId:_}=c();if(!l)return a(me("No auth set."));let S=mi(i,p),m=tl(t,e,r,h);return a(m),(u?Promise.resolve({legoUrl:d,product:t,order:e,quantity:r,offer:h}):ze.createOneTime(d,l,t.id,e,r,h)).then(b=>(a(rl(b)),o?(a(ol(b,S)),(u?Promise.resolve({item:b,frequency:S}):ze.convertOneTimeToSubscription(d,l,b,S,h,_)).then(P=>a(nl(P,t)),P=>a(hr(P)))):b),b=>a(hr(b))).finally(()=>a(Ct(m)))},"createIuThunk"),"createIu"),wi=n(t=>({type:Zt,payload:t}),"setLocale"),Ci=n(t=>({type:He,payload:t}),"setConfig"),Ri=n((t,e,r)=>({type:Xt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Ai=n(t=>({type:er,payload:t}),"setTemplates"),Ni=n((t,e)=>({type:tr,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Ii=n((t,e)=>({type:rr,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),ki=n(t=>({type:ce,payload:t}),"receiveMerchantSettings");var Rt="OG_STATE",Fi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),To=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Ui=n(()=>To()?{}:Fi(localStorage.getItem(Rt)),"loadState"),il=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),Li=n(t=>{if(To())return;t&&t.sessionId&&(document.cookie="og_session_id="+encodeURIComponent(t.sessionId)+"; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax");let e=il(t);e&&localStorage.getItem(Rt)!==e&&localStorage.setItem(Rt,e)},"saveState"),Mi=n(t=>(0,Di.throttle)(500,e=>{if(To())return;let{key:r,newValue:o}=e;r===Rt&&o===null?(t.dispatch({type:de}),setTimeout(()=>t.dispatch(Pi()),0)):r===Rt&&t.dispatch({type:ve,newValue:Fi(o)})}),"listenLocalStorageChanges");var Vi=se(Ht());var sl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),$i=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>sl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),al=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:$i(!0)},{expressions:[({type:t}={})=>t===I],fn:$i(!1)}],ji=n(t=>e=>r=>{let o=t.getState();al.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Hi=n(t=>e=>r=>{var i;let o;switch(r.type){case T:case I:case R:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Gi=n(t=>e=>r=>{e(r);let o=(0,Vi.throttle)(500,()=>{Li({...t.getState()})});r.type!==ve&&o()},"localStorageMiddleware");var At=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Bi(t){let[e,r]=At(),[o,i]=At(),[s,a]=At();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(xo(l)):a(p)});let c=Promise.all([o,e,s]);return c.then(()=>{var l;t.dispatch({type:Jt,payload:{}}),window.addEventListener("storage",Mi(t)),(l=t.getState().auth)!=null&&l.ts||t.dispatch(xi())}),l=>async p=>{Le===p.type||$e===p.type||Me===p.type||Ve===p.type?r(p.payload):Fe===p.type?i(p.payload):Ue===p.type?a(p.payload):await c,l(p)}}n(Bi,"waitUntilOffersReady");function zi(t){return e=>r=>{if(r.type===q){let{merchantId:o,sessionId:i,environment:{apiUrl:s}}=t.getState(),a=O(r.payload.product);a&&di.fetchOffer(s,o,i,a,r.payload.module||Ge,r.payload.searchParams).then(c=>t.dispatch(ye(c,r.payload.offer)),c=>t.dispatch(hr(c))).finally(()=>t.dispatch(Ct(r)))}return e(r)}}n(zi,"offerRequestMiddleware");var ls=se(Ki());var Ro=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...t.sessionId&&{session_id:t.sessionId},...xt(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),Ze=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var Sr=n((t=[],e)=>{switch(e.type){case de:return[];case ve:return e.newValue?e.newValue.optedin:t;case R:case k:{let[{prepaidShipments:r,...o},i]=Ke(t,e.payload.product);return i.concat({...o,...e.payload.product,frequency:e.payload.frequency})}case ae:{let{payload:r}=e,[{prepaidShipments:o,...i},s]=Ke(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case I:return t.filter(r=>!A(e.payload.product,r));case ht:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Qt:return t.filter(r=>!A(e.payload.product,r));case je:return[];default:return t}},"optedin"),Ao=n((t=[],e)=>{switch(e.type){case de:return[];case ve:return e.newValue?e.newValue.optedout:t;case R:case k:return t.filter(r=>!A(e.payload.product,r));case I:{let[r,o]=Ke(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case ht:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case je:return[];default:return t}},"optedout"),No=n((t={},{type:e,payload:r})=>{switch(e){case Yt:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case Wt:return{...t,products:(r.results||[]).map(o=>o.product)};case Kt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),dl=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),fl=n((t={},e)=>{switch(e.type){case q:return{...t};case T:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Io=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Qi=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),ko=n((t={},e)=>{switch(e.type){case T:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([i])=>i===o).reduce((i,[,{initial:s,ongoing:a}])=>({...i,initial:[...i.initial||[],...Qi(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...Qi(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),hl=n((t={},e)=>{switch(e.type){case R:case k:return{...t,[O(e.payload.product)]:e.payload.frequency};case I:return{...t,[O(e.payload.product)]:void 0};default:return t}},"frequency"),qo=n((t=!1,e)=>{switch(e.type){case zt:return{...e.payload};case xe:return!1;default:return t}},"auth"),Do=n((t="",e)=>{switch(e.type){case Fe:return e.payload;default:return t}},"merchantId"),Fo=n((t=null,e)=>{switch(e.type){case Bt:return e.payload;default:return t}},"authUrl"),ml=n((t={},e)=>{switch(e.type){case T:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Uo=n((t="",e)=>{switch(e.type){case T:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Lo=n((t=null,e)=>{switch(e.type){case de:return null;case Ue:return e.payload;default:return t}},"sessionId"),gl=n((t={},e)=>{switch(e.type){case T:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}),{})};case je:return{};default:return t}},"productOffer"),Mo=n((t={},e)=>{switch(e.type){case tr:return{...t,[O(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),$o=n((t={},e)=>{switch(e.type){case rr:return{...t,[O(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Vo=n((t={},e)=>{switch(e.type){case Le:return{...t,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case Me:return{...t,name:Pe,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case $e:return{...t,name:or,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Ve:return{...t,name:Oe,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),jo=n((t={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{1:"day",2:"week",3:"month"},prepaidOptInLabel:"Prepaid Subscription",prepaidShipmentsLabel:"Number of prepaid shipments"},e)=>{switch(e.type){case Zt:return{...t,...e.payload};default:return t}},"locale"),yl=n((t={offerType:"radio"},e)=>{switch(e.type){case He:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?vt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(vt):t.frequencies};case ce:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),Ho=n((t=!1,e)=>{switch(e.type){case ue:return e.payload.isPreview;default:return t}},"previewStandardOffer"),Go=n((t=!1,e)=>{switch(e.type){case gt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var Bo=n((t=[],e)=>{switch(e.type){case T:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),zo=n((t=[],e)=>{switch(e.type){case T:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Yo=n((t=[],e)=>{switch(e.type){case er:return[...e.payload||[]];case Xt:return[e.payload,...t];default:return t}},"templates"),bl=n((t={},e)=>{switch(e.type){case Y:return Ze(e.payload);default:return t}},"productPlans"),Wo=n((t={},e)=>{switch(e.type){case mt:{let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r}}case ae:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Er=Vt({optedin:Sr,optedout:Ao,nextUpcomingOrder:No,autoshipEligible:dl,inStock:fl,eligibilityGroups:Io,incentives:ko,frequency:hl,auth:qo,merchantId:Do,authUrl:Fo,offer:ml,offerId:Uo,experiments:xr,sessionId:Lo,productOffer:gl,firstOrderPlaceDate:Mo,productToSubscribe:$o,environment:Vo,locale:jo,config:yl,previewStandardOffer:Ho,previewUpsellOffer:Go,autoshipByDefault:Bo,defaultFrequencies:zo,templates:Yo,productPlans:bl,prepaidShipmentsSelected:Wo});var le=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),vr=n(t=>`${t}%`,"percentage");var Pr=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),Or=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),_l=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Sl=n((t,e)=>le(t.compare_at_price,e),"getAllocationRegularPrice"),El=n((t,e)=>{var r;if(Pr(t)){let o=Or((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return le(i,e)}return le(t.price,e)},"getAllocationSubscriptionPrice"),Zi=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),xl=n((t,e)=>{var o,i,s;if(Pr(t)){let a=Or((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,l=Zi(t,c);return vr(l)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=vr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=le(t.price_adjustments[0].value,e):t.compare_at_price&&(r=le(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),vl=n(t=>{var e;return Pr(t)?Or((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),Pl=n((t,e,r,o)=>{var d,u;let i=Or((d=t.selling_plan)==null?void 0:d.options),s=t.price/i,a=t.compare_at_price-s,c=Zi(t,s),l=(u=r==null?void 0:r.price_adjustments)==null?void 0:u[0],p=l&&l.value_type==="percentage"?l.value:null;return e.regularPrepaidPrice=le(t.price,o),e.prepaidSavingsPerShipment=le(Math.round(a),o),e.prepaidSavingsTotal=le(Math.round(a*i),o),p&&c&&(e.prepaidExtraSavingsPercentage=vr(c-p)),e},"addPrepaidPriceAndSavings"),Jo="Subscribe and Save",Ol=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:_l(t),regularPrice:Sl(t,r),subscriptionPrice:El(t,r),discountRate:xl(t,r),prepaidShipments:vl(t)};if(Pr(t)){let i=e.find(s=>s.group_name===Jo&&s.options.length===1);return Pl(t,o,i,r)}return o},"mapSellingPlanToDiscount"),Ko=n((t,e,r=[],o)=>[...t,Ol(e,r,o)],"sellingPlanAllocationsReducer"),Xi=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Tr="ordergroove-subscribe-and-save-",ts=n((t,e,r)=>{let o=Object.keys(t).filter(i=>i.startsWith(e.toString()));return o.length?{...t,...o.reduce((i,s)=>({...i,[s]:r}),{})}:t},"overrideLineKey"),es=n((t,e,r)=>{if(!r)return null;if(!Je(r))return r;if(fr(t,e)){let o=re(t,e,r);return o||he(t)}return r},"getDefaultSellingPlan"),Tl=n((t,e)=>t.map(r=>{var o,i,s,a,c,l,p;return Je(r==null?void 0:r.frequency)?{...r,frequency:fr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?re((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||re((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e==null?void 0:e.defaultFrequency)||he((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),wl=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:d}=s||{},u=r[c],h;return r[c]&&fr(l,p)?h=re(l,p,`${u.every}_${u.every_period}`)||es(l,p,d)||he(l):r[c]?h=`${u.every}_${u.every_period}`:h=es(l,p,d)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),Cl=n(t=>t==null?void 0:t.selling_plan_groups.find(e=>{var r;return(r=e.app_id)==null?void 0:r.startsWith(Tr)}),"getExperimentSellingPlanGroup"),rs=n(t=>(t==null?void 0:t.selling_plan_groups.find(Qo))||Al(t)||Cl(t),"getOGSellingPlanGroup"),Rl=n(t=>((t==null?void 0:t.selling_plan_groups)||[]).filter(r=>{var o;return os(r)||Qo(r)||((o=r.app_id)==null?void 0:o.startsWith(Tr))}),"getOGSellingPlanGroups"),Al=n(t=>t==null?void 0:t.selling_plan_groups.find(os),"getDefaultSubscriptionSellingPlanGroup"),os=n(t=>t.name===Jo,"isDefaultSellingPlanGroup"),Qo=n(t=>t.name.startsWith("og_psfl"),"isProductSpecificFrequencySellingPlanGroup"),Nl=n((t,e)=>({...ts(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ns=n((t,[e])=>({...t,[e]:!0}),"productTrue"),is=n((t,e)=>{let r=O(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Il=n((t={},e)=>{var r;if(Y===e.type)return Object.entries(e.payload).reduce(ns,t);if(fe===e.type){let{payload:o}=e;return o.items.reduce(is,t)}if(F===e.type){let{payload:{product:o}}=e,i=Rl(o),s=new Set((r=i.flatMap(a=>a.selling_plans.map(c=>c.id)))!=null?r:[]);return[o,...(o==null?void 0:o.variants)||[]].reduce((a,c)=>{var d,u;let p=((u=(d=c==null?void 0:c.selling_plan_allocations)==null?void 0:d.filter(h=>s.has(h.selling_plan_id)))!=null?u:[]).length>0;return{...ts(a,c.id,p),[c.id]:p}},t)}return ue===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function kl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(kl,"textToFreq");function ss(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>kl(r))}n(ss,"sellingPlansToEveryPeriod");function as(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(as,"sellingPlansToFrequencies");function cs(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(cs,"getPrepaidShipments");function ql(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:cs(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(ql,"getPrepaidSellingPlans");var Dl=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(Y===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(F===e.type){let{payload:{product:s,currency:a}}=e,c={},l=rs(s),p=as(l);if(p!=null&&p.length){let u=ss(l),h=((o=(r=l.options)==null?void 0:r[0])==null?void 0:o.values)||p,_=t.defaultFrequency;_&&Je(_)&&(_=re(p,u,_)||he(p)||_),c={frequencies:p,frequenciesEveryPeriod:u,frequenciesText:h,..._?{defaultFrequency:_}:{},hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||Qo(l)}}let d=s==null?void 0:s.selling_plan_groups.filter(u=>/^Prepaid-.*/.test(u.name));return d.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...ql(d)}}),{...t,...c,storeCurrency:a}}if(T===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:l,prepaidSellingPlans:p={}}={},product:d}=s||{};return(i=p[d==null?void 0:d.id])!=null&&i.some(({sellingPlan:u})=>u===a)?{...t,defaultFrequency:he(c)||a}:Je(a)?{...t,defaultFrequency:re(c,l,a)||he(c)||a}:{...t,defaultFrequency:a}}return ce===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),Fl=n((t={},e)=>{var r;if(Y===e.type)return Object.entries(e.payload).reduce(ns,t);if(fe===e.type)return e.payload.items.reduce(is,t);if(F===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(Nl,t)||t}return q===e.type&&e.payload.product===null?{...t}:ue===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),Ul=n((t={},e)=>t,"offer");function Ll({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=O(r.id),s=(o=e==null?void 0:e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e==null?void 0:e.config.frequencies[0]}n(Ll,"getFrequencyForPrepaidShipments");function Ml(t){let e=cs(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(Ml,"getOptedInItem");var $l=n((t=[],e)=>{if(fe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,Ml(i)]:o,[]))}if(T===e.type){let{offer:r={},...o}=e.payload,i=Tl(t,r),s=wl(o,i,r);return[...i,...s]}if(F===e.type){let{product:r}=e.payload,o=rs(r);if(!o)return t;let i=as(o),s=ss(o);return t.map(a=>Je(a.frequency)?{...a,frequency:re(i,s,a.frequency)||he(i)}:a)}if(ae===e.type){let{payload:r}=e,o=Sr(t,e),[i,s]=Ke(o,r.product);return s.concat({...i,...r.product,frequency:Ll(r)})}return Sr(t,e)},"optedin"),Vl=n((t={},e)=>t,"productOffer"),jl=n((t={},e)=>{var r;if(F===e.type){let{payload:{product:o,currency:i}}=e,s=Xi(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var l;return{...a,[c.id]:(l=c.selling_plan_allocations)==null?void 0:l.reduce((p,d)=>Ko(p,d,s,i),[])}},t)||t}if(fe===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:Ko([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return Y===e.type?Ze(e.payload):t},"productPlans"),Hl=Vt({auth:qo,authUrl:Fo,autoshipByDefault:Bo,autoshipEligible:Il,config:Dl,defaultFrequencies:zo,eligibilityGroups:Io,environment:Vo,firstOrderPlaceDate:Mo,incentives:ko,inStock:Fl,locale:jo,merchantId:Do,nextUpcomingOrder:No,offer:Ul,offerId:Uo,experiments:xr,optedin:$l,optedout:Ao,previewStandardOffer:Ho,previewUpsellOffer:Go,productOffer:Vl,productPlans:jl,productToSubscribe:$o,sessionId:Lo,templates:Yo,prepaidShipmentsSelected:Wo});function Zo(t,e){return window.og&&window.og.previewMode?Er(t,e):Hl(t,e)}n(Zo,"shopifyReducer");function Gl(t,e){e.map(a=>a.weight).reduce((a,c)=>a+c,0)!==100&&console.error("OG: Sum of weights for variants must be 100. Defaulting to last variant.");let i=ls.default.murmur3(t,0)%100,s=0;for(let a=0;a<e.length;a++){let c=e[a],l=s+c.weight;if(c.weight>0&&i<l)return a;s=l}return e.length-1}n(Gl,"getVariantIx");function xr(t={},e){var r;switch(e.type){case ce:return{...t,...e.payload.experiments};case po:return{...t,currentVariant:e.payload.index,offerProfileId:(r=e.payload.parameters)==null?void 0:r.offer_profile_public_id};default:return t}}n(xr,"experimentsReducer");function Bl(t,e,r){if(!t||r.variants.length===0)return;let o=e.selling_plan_groups.filter(s=>{var a;return(a=s.app_id)==null?void 0:a.startsWith(Tr)});if(o.length!==r.variants.length)return;let i=o.find(({app_id:s})=>s.endsWith(t.public_id));if(!!i)return{...e,selling_plan_groups:[i],variants:e.variants.map(({selling_plan_allocations:s,...a})=>({...a,selling_plan_allocations:s.filter(({selling_plan_group_id:c})=>c===i.id)}))}}n(Bl,"resolveShopifySetupProductWhenExperiment");function zl(t,e){let r=t==null?void 0:t.public_id;if(!r)return null;let o=t.variants,i=Gl(`${r}|${e}`,o);return{...o[i],index:i}}n(zl,"getAssignedExperimentVariant");function ps(t){let[e,r]=At(),o,i;return s=>async a=>{if(a.type===Jt)r();else if(a.type===ce){await e,i=a.payload.experiments;let{sessionId:c}=t.getState();o=zl(i,c),o&&t.dispatch({type:po,payload:o})}else if(a.type===q)await e,o&&(a.payload.searchParams={...a.payload.searchParams,variant:o.public_id});else if(a.type===F){await e;let c=Bl(o,a.payload.product,i);if(c)return s({type:F,payload:{...a.payload,experiments:!0,originalPayload:a.payload,product:c}})}return s(a)}}n(ps,"experimentsMiddleware");function us(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):co,i=[Bi,Vn,ps,zi,ji,Hi],s={};if(!r)try{s=Ui(),i.push(Gi)}catch{}let a=o(Ln(...i,...e.filter(l=>l))),c=ao(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(us,"makeStore");var Yl=Object.defineProperty,wr=n((t,e)=>Yl(t,"name",{value:e,configurable:!0}),"i"),Wl=wr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),fs=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000","http://localhost:3010","http://0.0.0.0:3010",window.location.origin],ds=wr(t=>(e,r)=>{fs.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Xo(t=window.opener,e=window.og){let r=wr(o=>{let i=Wl(fs),s=ds(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.7/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),ds(t)("READY"))}n(Xo,"h");wr(Xo,"offersLiveEditor");var Cr=null,Jl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),hs=n(t=>{if(!Cr)throw new Error("Missing redux store.");return Cr},"resolveStore"),Kl=n((t,e)=>r=>{let{getState:o,dispatch:i}=hs(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=Jl)=>r=>{let i=Kl(t,typeof e=="function"?e:s=>Un(e,s));return class extends r{get store(){return Cr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=hs(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(s,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(s,a,c),this._storeUnsubscribe&&a!==c&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),ms=n(t=>{Cr=t},"setStore");var en=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ce=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var j=`{{lit-${String(Math.random()).slice(2)}}}`,tn=`<!--${j}-->`,gs=new RegExp(`${j}|${tn}`),Xe="$lit$",be=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:p,values:{length:d}}=e;for(;l<d;){let u=s.nextNode();if(u===null){s.currentNode=i.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:_}=h,S=0;for(let m=0;m<_;m++)ys(h[m].name,Xe)&&S++;for(;S-- >0;){let m=p[l],b=Rr.exec(m)[2],P=b.toLowerCase()+Xe,E=u.getAttribute(P);u.removeAttribute(P);let w=E.split(gs);this.parts.push({type:"attribute",index:c,name:b,strings:w}),l+=w.length-1}}u.tagName==="TEMPLATE"&&(i.push(u),s.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf(j)>=0){let _=u.parentNode,S=h.split(gs),m=S.length-1;for(let b=0;b<m;b++){let P,E=S[b];if(E==="")P=oe();else{let w=Rr.exec(E);w!==null&&ys(w[2],Xe)&&(E=E.slice(0,w.index)+w[1]+w[2].slice(0,-Xe.length)+w[3]),P=document.createTextNode(E)}_.insertBefore(P,u),this.parts.push({type:"node",index:++c})}S[m]===""?(_.insertBefore(oe(),u),o.push(u)):u.data=S[m],l+=m}}else if(u.nodeType===8)if(u.data===j){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(oe(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let h=-1;for(;(h=u.data.indexOf(j,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(be,"Template");var ys=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Nt=n(t=>t.index!==-1,"isTemplatePartActive"),oe=n(()=>document.createComment(""),"createMarker"),Rr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var rn=133;function on(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,rn,null,!1),s=It(o),a=o[s],c=-1,l=0,p=[],d=null;for(;i.nextNode();){c++;let u=i.currentNode;for(u.previousSibling===d&&(d=null),e.has(u)&&(p.push(u),d===null&&(d=u)),d!==null&&l++;a!==void 0&&a.index===c;)a.index=d!==null?-1:a.index-l,s=It(o,s),a=o[s]}p.forEach(u=>u.parentNode.removeChild(u))}n(on,"removeNodesFromTemplate");var Ql=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,rn,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),It=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Nt(o))return r}return-1},"nextActiveIndexInTemplateParts");function bs(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,rn,null,!1),a=It(i),c=0,l=-1;for(;s.nextNode();)for(l++,s.currentNode===r&&(c=Ql(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===l;){if(c>0){for(;a!==-1;)i[a].index+=c,a=It(i,a);return}a=It(i,a)}}n(bs,"insertNodeIntoTemplate");var Zl=new WeakMap;var Re=n(t=>typeof t=="function"&&Zl.has(t),"isDirective");var U={},Ar={};var pe=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=en?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1),s=0,a=0,c,l=i.nextNode();for(;s<o.length;){if(c=o[s],!Nt(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),i.currentNode=l.content),(l=i.nextNode())===null&&(i.currentNode=r.pop(),l=i.nextNode());if(c.type==="node"){let p=this.processor.handleTextExpression(this.options);p.insertAfterNode(l.previousSibling),this.__parts.push(p)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));s++}return en&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(pe,"TemplateInstance");var _s=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),ep=` ${j} `,ne=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=Rr.exec(s);c===null?r+=s+(o?ep:tn):r+=s.substr(0,c.index)+c[1]+c[2]+Xe+c[3]+j}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return _s!==void 0&&(r=_s.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult");var Ir=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Nr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ae=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new et(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!Nr(s))return s}let i="";for(let s=0;s<r;s++){i+=e[s];let a=o[s];if(a!==void 0){let c=a.value;if(Ir(c)||!Nr(c))i+=typeof c=="string"?c:String(c);else for(let l of c)i+=typeof l=="string"?l:String(l)}}return i+=e[r],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ae,"AttributeCommitter");var et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==U&&(!Ir(e)||e!==this.value)&&(this.value=e,Re(e)||(this.committer.dirty=!0))}commit(){for(;Re(this.value);){let e=this.value;this.value=U,e(this)}this.value!==U&&this.committer.commit()}};n(et,"AttributePart");var ie=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(oe()),this.endNode=e.appendChild(oe())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=oe()),e.__insert(this.endNode=oe())}insertAfterPart(e){e.__insert(this.startNode=oe()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=U,r(this)}let e=this.__pendingValue;e!==U&&(Ir(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Nr(e)?this.__commitIterable(e):e===Ar?(this.value=Ar,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof pe&&this.value.template===r)this.value.update(e.values);else{let o=new pe(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new ie(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ce(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ie,"NodePart");var tt=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=U,r(this)}if(this.__pendingValue===U)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=U}};n(tt,"BooleanAttributePart");var rt=class extends Ae{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new kt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(rt,"PropertyCommitter");var kt=class extends et{};n(kt,"PropertyPart");var Ss=!1;(()=>{try{let t={get capture(){return Ss=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var ot=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Re(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=U,s(this)}if(this.__pendingValue===U)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),i=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=tp(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=U}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ot,"EventPart");var tp=n(t=>t&&(Ss?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function nn(t){let e=Ne.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ne.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(j);return r=e.keyString.get(o),r===void 0&&(r=new be(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(nn,"templateFactory");var Ne=new Map;var _e=new WeakMap,sn=n((t,e,r)=>{let o=_e.get(e);o===void 0&&(Ce(e,e.firstChild),_e.set(e,o=new ie(Object.assign({templateFactory:nn},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var qt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new rt(e,r.slice(1),o).parts:s==="@"?[new ot(e,r.slice(1),i.eventContext)]:s==="?"?[new tt(e,r.slice(1),o)]:new Ae(e,r,o).parts}handleTextExpression(e){return new ie(e)}};n(qt,"DefaultTemplateProcessor");var an=new qt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var f=n((t,...e)=>new ne(t,e,"html",an),"html");var xs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),kr=!0;typeof window.ShadyCSS>"u"?kr=!1:typeof window.ShadyCSS.prepareTemplateDom>"u"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),kr=!1);var op=n(t=>e=>{let r=xs(e.type,t),o=Ne.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ne.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(j);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();kr&&window.ShadyCSS.prepareTemplateDom(a,t),i=new be(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),np=["html","svg"],ip=n(t=>{np.forEach(e=>{let r=Ne.get(xs(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:i}}=o,s=new Set;Array.from(i.querySelectorAll("style")).forEach(a=>{s.add(a)}),on(o,s)})})},"removeStylesFromLitTemplates"),vs=new Set,sp=n((t,e,r)=>{vs.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let p=0;p<s;p++){let d=i[p];d.parentNode.removeChild(d),a.textContent+=d.textContent}ip(t);let c=o.content;r?bs(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let p=new Set;p.add(a),on(r,p)}},"prepareTemplateStyles"),Ps=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=_e.has(e),s=kr&&e.nodeType===11&&!!e.host,a=s&&!vs.has(o),c=a?document.createDocumentFragment():e;if(sn(t,c,Object.assign({templateFactory:op(o)},r)),a){let l=_e.get(c);_e.delete(c);let p=l.value instanceof pe?l.value.template:void 0;sp(o,c,p),Ce(e,e.firstChild),e.appendChild(c),_e.set(e,l)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Os;window.JSCompiler_renameProperty=(t,e)=>t;var fn={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Ts=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),cn={attribute:!0,type:String,converter:fn,reflect:!1,hasChanged:Ts},ln=1,pn=1<<2,un=1<<3,dn=1<<4,hn="finalized",nt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=cn){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(i){let s=this[e];this[r]=i,this.requestUpdateInternal(e,s,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||cn}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(hn)||e.finalize(),this[hn]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let i of o)this.createProperty(i,r[i])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=Ts){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||fn,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||fn.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=cn){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|un,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~un}}_attributeToProperty(e,r){if(this._updateState&un)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|dn,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~dn}}requestUpdateInternal(e,r,o){let i=!0;if(e!==void 0){let s=this.constructor;o=o||s.getPropertyOptions(e),s._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&dn)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|pn;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&pn}get hasUpdated(){return this._updateState&ln}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&ln||(this._updateState=this._updateState|ln,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~pn}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(nt,"UpdatingElement");Os=hn;nt[Os]=!0;var ws=Element.prototype,nh=ws.msMatchesSelector||ws.webkitMatchesSelector;var qr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,mn=Symbol(),it=class{constructor(e,r){if(r!==mn)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(qr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(it,"CSSResult");var Cs=n(t=>new it(String(t),mn),"unsafeCSS"),ap=n(t=>{if(t instanceof it)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
12
- take care to ensure page security.`)},"textFromCSSResult"),y=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+ap(i)+t[s+1],t[0]);return new it(r,mn)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Rs={},x=class extends nt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((s,a)=>s.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),i=[];o.forEach(s=>i.unshift(s)),this._styles=i}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!qr){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return Cs(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):qr?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==Rs&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let i=document.createElement("style");i.textContent=o.cssText,this.renderRoot.appendChild(i)}))}render(){return Rs}};n(x,"LitElement");x.finalized=!0;x.render=Ps;var Ys=se($s());var hp=n(t=>{let e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t},"sanitizeFrequencyString"),Vs=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Dt=n(t=>{let e=Vs(t);if(!e){let r=t.offer;r&&(e=Vs(r))}return e},"resolveProduct"),mp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),gn=n(t=>class extends t{get offer(){return mp(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),N=n(t=>class extends gn(t){get product(){return Dt(this)}},"withProduct"),Fr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=hp(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Ur={};kn(Ur,{autoshipByDefault:()=>gp,eligibilityGroups:()=>bn,eligible:()=>js,hasPrepaidOptions:()=>Ep,hasUpcomingOrder:()=>Bs,hasUpsellGroup:()=>Gs,inStock:()=>yn,optedout:()=>_p,prepaidEligible:()=>yp,prepaidSubscribed:()=>Sp,regularEligible:()=>vp,subscribed:()=>bp,subscriptionEligible:()=>Hs,upcomingOrderContainsProduct:()=>xp,upsellEligible:()=>zs});var yn=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),js=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),gp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),Hs=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&js(t,e)&&yn(t,e),"subscriptionEligible"),bn=n((t,e)=>{let r=O((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),Gs=n((t,e)=>{let r=bn(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),yp=n((t,e)=>{let r=bn(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),bp=n((t,e)=>pr(e.product)(t),"subscribed"),_p=n((t,e)=>ur(e.product)(t),"optedout"),Sp=n((t,e)=>hi(e.product)(t),"prepaidSubscribed"),Ep=n((t,e)=>$(e.product.id)(t).length>0,"hasPrepaidOptions"),Bs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),xp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),zs=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&yn(t,e)&&Bs(t)&&Gs(t,e)},"upsellEligible"),vp=n((t,e)=>Hs(t,e)&&!zs(t,e),"regularEligible");var Pp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Lr=class extends N(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return f``;let e=Pp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),Ys.default.parse(e,o=>Ur[o]&&Ur[o](this.state,this))?f`
11
+ var lib=(()=>{var Ba=Object.create;var yt=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ya=Object.getOwnPropertyNames;var Wa=Object.getPrototypeOf,Ka=Object.prototype.hasOwnProperty;var n=(t,e)=>yt(t,"name",{value:e,configurable:!0});var ee=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Mn=(t,e)=>{for(var r in e)yt(t,r,{get:e[r],enumerable:!0})},$n=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ya(e))!Ka.call(t,i)&&i!==r&&yt(t,i,{get:()=>e[i],enumerable:!(o=za(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?Ba(Wa(t)):{},$n(e||!t||!t.__esModule?yt(r,"default",{value:t,enumerable:!0}):r,t)),Ja=t=>$n(yt({},"__esModule",{value:!0}),t);var Yt=ee((zt,Wn)=>{(function(t,e){typeof zt=="object"&&typeof Wn<"u"?e(zt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(zt,function(t){"use strict";function e(o,i,s,a){var c,l=!1,p=0;function u(){c&&clearTimeout(c)}n(u,"clearExistingTimeout");function d(){u(),l=!0}n(d,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var _=arguments.length,P=new Array(_),m=0;m<_;m++)P[m]=arguments[m];var E=this,T=Date.now()-p;if(l)return;function y(){p=Date.now(),s.apply(E,P)}n(y,"exec");function v(){c=void 0}n(v,"clear"),a&&!c&&y(),u(),a===void 0&&T>o?y():i!==!0&&(c=setTimeout(a?v:y,a===void 0?o-T:o))}return n(h,"wrapper"),h.cancel=d,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var Pt=ee((Ju,hi)=>{var ac="Expected a function",ci="__lodash_hash_undefined__",cc="[object Function]",lc="[object GeneratorFunction]",pc=/[\\^$.*+?()[\]{}|]/g,uc=/^\[object .+?Constructor\]$/,dc=typeof window=="object"&&window&&window.Object===Object&&window,fc=typeof self=="object"&&self&&self.Object===Object&&self,li=dc||fc||Function("return this")();function hc(t,e){return t?.[e]}n(hc,"getValue");function mc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(mc,"isHostObject");var gc=Array.prototype,yc=Function.prototype,pi=Object.prototype,_o=li["__core-js_shared__"],ai=function(){var t=/[^.]+$/.exec(_o&&_o.keys&&_o.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ui=yc.toString,Eo=pi.hasOwnProperty,bc=pi.toString,Sc=RegExp("^"+ui.call(Eo).replace(pc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_c=gc.splice,Ec=di(li,"Map"),xt=di(Object,"create");function Ce(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Ce,"Hash");function xc(){this.__data__=xt?xt(null):{}}n(xc,"hashClear");function Pc(t){return this.has(t)&&delete this.__data__[t]}n(Pc,"hashDelete");function Oc(t){var e=this.__data__;if(xt){var r=e[t];return r===ci?void 0:r}return Eo.call(e,t)?e[t]:void 0}n(Oc,"hashGet");function vc(t){var e=this.__data__;return xt?e[t]!==void 0:Eo.call(e,t)}n(vc,"hashHas");function Tc(t,e){var r=this.__data__;return r[t]=xt&&e===void 0?ci:e,this}n(Tc,"hashSet");Ce.prototype.clear=xc;Ce.prototype.delete=Pc;Ce.prototype.get=Oc;Ce.prototype.has=vc;Ce.prototype.set=Tc;function Ke(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Ke,"ListCache");function wc(){this.__data__=[]}n(wc,"listCacheClear");function Cc(t){var e=this.__data__,r=pr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():_c.call(e,r,1),!0}n(Cc,"listCacheDelete");function Rc(t){var e=this.__data__,r=pr(e,t);return r<0?void 0:e[r][1]}n(Rc,"listCacheGet");function Ac(t){return pr(this.__data__,t)>-1}n(Ac,"listCacheHas");function Ic(t,e){var r=this.__data__,o=pr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Ic,"listCacheSet");Ke.prototype.clear=wc;Ke.prototype.delete=Cc;Ke.prototype.get=Rc;Ke.prototype.has=Ac;Ke.prototype.set=Ic;function Re(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Re,"MapCache");function Nc(){this.__data__={hash:new Ce,map:new(Ec||Ke),string:new Ce}}n(Nc,"mapCacheClear");function kc(t){return ur(this,t).delete(t)}n(kc,"mapCacheDelete");function Fc(t){return ur(this,t).get(t)}n(Fc,"mapCacheGet");function qc(t){return ur(this,t).has(t)}n(qc,"mapCacheHas");function Dc(t,e){return ur(this,t).set(t,e),this}n(Dc,"mapCacheSet");Re.prototype.clear=Nc;Re.prototype.delete=kc;Re.prototype.get=Fc;Re.prototype.has=qc;Re.prototype.set=Dc;function pr(t,e){for(var r=t.length;r--;)if(Vc(t[r][0],e))return r;return-1}n(pr,"assocIndexOf");function Uc(t){if(!fi(t)||Mc(t))return!1;var e=jc(t)||mc(t)?Sc:uc;return e.test($c(t))}n(Uc,"baseIsNative");function ur(t,e){var r=t.__data__;return Lc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(ur,"getMapData");function di(t,e){var r=hc(t,e);return Uc(r)?r:void 0}n(di,"getNative");function Lc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Lc,"isKeyable");function Mc(t){return!!ai&&ai in t}n(Mc,"isMasked");function $c(t){if(t!=null){try{return ui.call(t)}catch{}try{return t+""}catch{}}return""}n($c,"toSource");function xo(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(ac);var r=n(function(){var o=arguments,i=e?e.apply(this,o):o[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,o);return r.cache=s.set(i,a),a},"memoized");return r.cache=new(xo.Cache||Re),r}n(xo,"memoize");xo.Cache=Re;function Vc(t,e){return t===e||t!==t&&e!==e}n(Vc,"eq");function jc(t){var e=fi(t)?bc.call(t):"";return e==cc||e==lc}n(jc,"isFunction");function fi(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(fi,"isObject");hi.exports=xo});var ts=ee((Cd,qo)=>{function hl(t,e){var r,o,i,s,a,c,l,p,u,d;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,l=461845907,d=0;d<o;)u=t.charCodeAt(d)&255|(t.charCodeAt(++d)&255)<<8|(t.charCodeAt(++d)&255)<<16|(t.charCodeAt(++d)&255)<<24,++d,u=(u&65535)*a+(((u>>>16)*a&65535)<<16)&4294967295,u=u<<15|u>>>17,u=(u&65535)*l+(((u>>>16)*l&65535)<<16)&4294967295,i^=u,i=i<<13|i>>>19,s=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(s&65535)+27492+(((s>>>16)+58964&65535)<<16);switch(u=0,r){case 3:u^=(t.charCodeAt(d+2)&255)<<16;case 2:u^=(t.charCodeAt(d+1)&255)<<8;case 1:u^=t.charCodeAt(d)&255,u=(u&65535)*a+(((u>>>16)*a&65535)<<16)&4294967295,u=u<<15|u>>>17,u=(u&65535)*l+(((u>>>16)*l&65535)<<16)&4294967295,i^=u}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}n(hl,"murmurhash3_32_gc");typeof qo<"u"&&(qo.exports=hl)});var rs=ee((Rd,Do)=>{function ml(t,e){for(var r=t.length,o=e^r,i=0,s;r>=4;)s=t.charCodeAt(i)&255|(t.charCodeAt(++i)&255)<<8|(t.charCodeAt(++i)&255)<<16|(t.charCodeAt(++i)&255)<<24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>24,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)^s,r-=4,++i;switch(r){case 3:o^=(t.charCodeAt(i+2)&255)<<16;case 2:o^=(t.charCodeAt(i+1)&255)<<8;case 1:o^=t.charCodeAt(i)&255,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16)}return o^=o>>>13,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>15,o>>>0}n(ml,"murmurhash2_32_gc");typeof Do!==void 0&&(Do.exports=ml)});var ns=ee((Ad,Pr)=>{var os=ts(),gl=rs();Pr.exports=os;Pr.exports.murmur3=os;Pr.exports.murmur2=gl});var Mr=ee((oh,Rs)=>{var Ml={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};Rs.exports=Ml});var Is=ee((nh,As)=>{var qe=Mr(),$l=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case qe.PAR_OPEN:case qe.PAR_CLOSE:case qe.OP_NOT:case qe.BINARY_AND:case qe.BINARY_OR:e&&(r.push({type:qe.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:qe.LITERAL,value:e}),r},"Tokenizer");As.exports=$l});var ks=ee((ih,Ns)=>{var xe=Mr(),Vl=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case xe.LITERAL:e.unshift(i);break;case xe.BINARY_AND:case xe.BINARY_OR:case xe.OP_NOT:case xe.PAR_OPEN:r.push(i);break;case xe.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==xe.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===xe.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),jl=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Ns.exports={PolishNotation:Vl,PolishGenerator:jl}});var qs=ee((sh,Fs)=>{var M=Mr(),B=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===M.LEAF}isAtomic(){return this.isLeaf()||this.op===M.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new B(M.BINARY_AND,e,r)}static CreateNot(e){return new B(M.OP_NOT,e)}static CreateOr(e,r){return new B(M.BINARY_OR,e,r)}static CreateLiteral(e){return new B(M.LEAF,null,null,e)}};n(B,"ExpNode");var ut=n(t=>{let e=t.next().value;switch(e.type){case M.LITERAL:return B.CreateLiteral(e.value);case M.OP_NOT:return B.CreateNot(ut(t));case M.BINARY_AND:{let r=ut(t),o=ut(t);return B.CreateAnd(r,o)}case M.BINARY_OR:{let r=ut(t),o=ut(t);return B.CreateOr(r,o)}}return null},"make"),dt=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===M.OP_NOT)return!dt(t.left,e);if(t.op===M.BINARY_OR)return dt(t.left,e)||dt(t.right,e);if(t.op===M.BINARY_AND)return dt(t.left,e)&&dt(t.right,e)},"nodeEvaluator");Fs.exports={make:ut,nodeEvaluator:dt}});var Ms=ee((ah,Ls)=>{var Gl=Is(),Ds=ks(),Us=qs(),Hl=n((t,e)=>{let r=Gl(t),o=Ds.PolishNotation(r),i=Ds.PolishGenerator(o),s=Us.make(i);return Us.nodeEvaluator(s,e)},"parse");Ls.exports={parse:Hl}});var Vu={};Mn(Vu,{addOptinChangedCallback:()=>Su,addTemplate:()=>_u,autoInit:()=>Mu,clear:()=>Eu,config:()=>xu,default:()=>$u,disableOptinChangedCallbacks:()=>Pu,getOptins:()=>Ou,getProductsForPurchasePost:()=>vu,initialize:()=>Tu,isReady:()=>bu,offers:()=>O,platform:()=>D,previewMode:()=>wu,register:()=>Cu,resolveSettings:()=>Ru,setAuthUrl:()=>Au,setEnvironment:()=>Iu,setLocale:()=>Nu,setMerchantId:()=>ku,setPublicPath:()=>Fu,setTemplates:()=>qu,setupCart:()=>Du,setupProduct:()=>Uu,setupProducts:()=>Lu,store:()=>Ga});function fo(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(fo,"symbolObservablePonyfill");var Le;typeof self<"u"?Le=self:typeof window<"u"||typeof window<"u"?Le=window:typeof module<"u"?Le=module:Le=Function("return this")();var Qa=fo(Le),ho=Qa;var mo=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),bt={INIT:"@@redux/INIT"+mo(),REPLACE:"@@redux/REPLACE"+mo(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+mo()},"PROBE_UNKNOWN_ACTION")};function Za(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(Za,"isPlainObject");function go(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(go)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var i=t,s=e,a=[],c=a,l=!1;function p(){c===a&&(c=a.slice())}n(p,"ensureCanMutateNextListeners");function u(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(u,"getState");function d(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var E=!0;return p(),c.push(m),n(function(){if(!!E){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");E=!1,p();var y=c.indexOf(m);c.splice(y,1),a=null}},"unsubscribe")}n(d,"subscribe");function h(m){if(!Za(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,s=i(s,m)}finally{l=!1}for(var E=a=c,T=0;T<E.length;T++){var y=E[T];y()}return m}n(h,"dispatch");function _(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:bt.REPLACE})}n(_,"replaceReducer");function P(){var m,E=d;return m={subscribe:n(function(y){if(typeof y!="object"||y===null)throw new TypeError("Expected the observer to be an object.");function v(){y.next&&y.next(u())}n(v,"observeState"),v();var C=E(v);return{unsubscribe:C}},"subscribe")},m[ho]=function(){return this},m}return n(P,"observable"),h({type:bt.INIT}),o={dispatch:h,subscribe:d,getState:u,replaceReducer:_},o[ho]=P,o}n(go,"createStore");function Xa(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Xa,"getUndefinedStateErrorMessage");function ec(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:bt.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:bt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+bt.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(ec,"assertReducerShape");function Bt(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var i=e[o];typeof t[i]=="function"&&(r[i]=t[i])}var s=Object.keys(r),a,c;try{ec(r)}catch(l){c=l}return n(function(p,u){if(p===void 0&&(p={}),c)throw c;if(!1)var d;for(var h=!1,_={},P=0;P<s.length;P++){var m=s[P],E=r[m],T=p[m],y=E(T,u);if(typeof y>"u"){var v=Xa(m,u);throw new Error(v)}_[m]=y,h=h||y!==T}return h=h||s.length!==Object.keys(p).length,h?_:p},"combination")}n(Bt,"combineReducers");function Vn(t,e){return function(){return e(t.apply(this,arguments))}}n(Vn,"bindActionCreator");function Gn(t,e){if(typeof t=="function")return Vn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=Vn(i,e))}return r}n(Gn,"bindActionCreators");function tc(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(tc,"_defineProperty");function jn(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(jn,"ownKeys");function rc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jn(r,!0).forEach(function(o){tc(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(rc,"_objectSpread2");function yo(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,i){return function(){return o(i.apply(void 0,arguments))}})}n(yo,"compose");function Hn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var i=o.apply(void 0,arguments),s=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:i.getState,dispatch:n(function(){return s.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return s=yo.apply(void 0,c)(i.dispatch),rc({},i,{dispatch:s})}}}n(Hn,"applyMiddleware");function Bn(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Bn,"createThunkMiddleware");var zn=Bn();zn.withExtraArgument=Bn;var Yn=zn;var Gi=ce(Yt());var Kn=/^og_auth=/,oc=n((t=Kn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Kn,""),"c"),Wt=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),nc=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),ic=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Jn(){return typeof window.og_auth<"u"?Wt(window.og_auth):null}n(Jn,"a");async function sc(t=100){return new Promise(e=>{setTimeout(()=>e(Jn()),t)})}n(sc,"f");async function Qn(t,e=oc,r=nc){let o;if(o=Wt(Jn())||Wt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(ic(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await sc());if(o=Wt(o),o)return o;throw new Error("Unauthorized")}n(Qn,"u");var R="OPTIN_PRODUCT",N="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",le="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Me="SET_MERCHANT_ID",F="REQUEST_OFFER",w="RECEIVE_OFFER",St="PRODUCT_HAS_CHANGED",$e="CREATED_SESSION_ID",Kt="SET_AUTH_URL",Zn="REQUEST_AUTH",Jt="AUTHORIZE",Oe="UNAUTHORIZED",Xn="REQUEST_ORDERS",Qt="RECEIVE_ORDERS",_t="CART_PRODUCT_KEY_HAS_CHANGED",Zt="RECEIVE_ORDER_ITEMS",ei="FETCH_RESPONSE_ERROR",Ve="SET_ENVIRONMENT_LOCAL",je="SET_ENVIRONMENT_STAGING",Ge="SET_ENVIRONMENT_DEV",He="SET_ENVIRONMENT_PROD",Xt="READY",ti="CONCLUDE_UPSELL",ri="REQUEST_CREATE_IU_ORDER",er="CREATE_ONE_TIME",oi="REQUEST_CONVERT_ONE_TIME",tr="CONVERT_ONE_TIME";var Be="CHECKOUT",ni="RECEIVE_FETCH",rr="SET_LOCALE",ze="SET_CONFIG",he="SET_PREVIEW_STANDARD_OFFER",Et="SET_PREVIEW_UPSELL_OFFER",bo="SET_PREVIEW_PREPAID_OFFER",or="ADD_TEMPLATE",nr="SET_TEMPLATES",ve="LOCAL_STORAGE_CHANGE",me="LOCAL_STORAGE_CLEAR",ir="SET_FIRST_ORDER_PLACE_DATE",sr="SET_PRODUCT_TO_SUBSCRIBE",$="RECEIVE_PRODUCT_PLANS",q="SETUP_PRODUCT",ge="SETUP_CART",pe="RECEIVE_MERCHANT_SETTINGS",So="SET_EXPERIMENT_VARIANT",Ye="pdp",ii="local",ar="dev",Te="staging",we="prod",cr="static.ordergroove.com",lr="staging.static.ordergroove.com",si="og-cart-updated";var dr=ce(Pt());var Po=n((...t)=>JSON.stringify(t),"memoizeKey"),Ot=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),vt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),fr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),mi=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),gi=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Gc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Hc=(0,dr.default)(Ot(vt((t,e,r,o="pdp",i={})=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=[["session_id",e],["page_type",1],["p",Gc(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(i)];return[`/offer/${t}/${o}?${gi(s)}`]})),Po),Bc=(0,dr.default)(Ot(vt(fr((t=1,e="place")=>[`/orders/?${gi([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Po),zc=(0,dr.default)(Ot(vt(fr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Po),Yc=Ot(vt(fr(mi((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),Tt=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),Oo=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Wc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),yi=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Oo).sort(Wc),"parseFrequenciesList");var wt=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),Kc=Ot(vt(fr(mi((t,e,r,o)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let i=Tt(e);if(!i)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,session_id:o,...i}}]})))),Je={fetchOffer:Hc,fetchOrders:Bc,fetchItems:zc,createOneTime:Yc,convertOneTimeToSubscription:Kc},bi=Je;var vo=Ct(),D={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(vo==null?void 0:vo.dataset.shopifySellingPlans)!="undefined"};function Jc(t,e){return t===e}n(Jc,"defaultEqualityCheck");function Qc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,i=0;i<o;i++)if(!t(e[i],r[i]))return!1;return!0}n(Qc,"areArgumentsShallowlyEqual");function Zc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jc,r=null,o=null;return function(){return Qc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Zc,"defaultMemoize");function Xc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Xc,"getDependencies");function el(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var c=0,l=s.pop(),p=Xc(s),u=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),d=t(function(){for(var h=[],_=p.length,P=0;P<_;P++)h.push(p[P].apply(null,arguments));return u.apply(null,h)});return d.resultFunc=l,d.dependencies=p,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(el,"createSelectorCreator");var U=el(Zc);var K=ce(Pt());K.default.Cache=Map;function tl(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(tl,"arraysEqual");function rl(t,e,r){let o=wt(r);return D.shopify_selling_plans?Q(t,e,o):o}n(rl,"resolveFrequency");var A=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||tl((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Rt=n(t=>t.optedin||[],"optedinSelector"),Si=n(t=>t.optedout||[],"optedoutSelector"),To=n(t=>t.autoshipByDefault||{},"autoshipSelector"),ol=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),_i=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),nl=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),te=(0,K.default)(t=>U(Rt,Si,To,(e,r,o)=>{let i=e.find(s=>A(t,s));return i||(r.find(s=>A(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),hr=(0,K.default)(t=>U(Rt,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),Ei=(0,K.default)(t=>U(Rt,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),re=(0,K.default)(t=>U(nl,e=>e[t.id]||null),t=>JSON.stringify(t)),mr=(0,K.default)(t=>U(Si,e=>e.find(r=>A(t,r))));var oe=(0,K.default)(t=>U(te(t),e=>e&&"frequency"in e&&e.frequency||null)),V=(0,K.default)(t=>U(te(t),e=>e&&"prepaidShipments"in e&&e.prepaidShipments||null)),j=(0,K.default)(t=>U(_i,e=>{var o;return(((o=e[S(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Qe=(0,K.default)(t=>U(ol,J(t),(e,{frequencies:r=[],frequenciesEveryPeriod:o=[]})=>e[S(t)]&&rl(r,o,e[S(t)])||null)),Ze=n(t=>U(J(t),e=>e.frequencies),"makeProductFrequencyOptionsSelector"),ne=n(t=>U(J(t),e=>e.defaultFrequency),"makeProductDefaultFrequencySelector"),J=n(t=>U(e=>{var r;return((r=e==null?void 0:e.config)==null?void 0:r.productFrequencies)||{}},e=>e[S(t)]||{}),"makeProductFrequenciesSelector"),xi=n((t,e)=>U(_i,J(t.id),(r,{frequencies:o})=>{var i;if(e){let s=S(t.id),a=(i=r[s])==null?void 0:i.find(c=>c.numberShipments===e);return a?a.sellingPlan:null}return o[0]}),"makeFrequencyForPrepaidShipmentsSelector"),wo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),G=n((t,e,r)=>t&&t.hasAttribute&&t.hasAttribute(wo(e))&&t[e]||t.offer&&typeof(t.offer[e]!=="undefined")&&t.offer[e]||r,"getFallbackValue"),Xe=n(t=>({templates:t.templates||[]}),"templatesSelector");function gr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(gr,"onReady");function Ct(){return document.querySelector([`script[src^="https://${cr}"]`,`script[src^="https://${lr}"]`,`script[src^="http://${cr}"]`,`script[src^="http://${lr}"]`].join(","))}n(Ct,"getMainJs");function Co(){let t=Ct();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Te)?Te:we,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(Co,"resolveEnvAndMerchant");var S=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=D)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),Pi=n((t,e,r)=>{if(D.shopify_selling_plans){let o=e==null?void 0:e.indexOf(t);if(o>=0&&r[o])return r[o]}return t},"safeOgFrequency"),At=n((t,e)=>{if(!`${t}`.includes("_"))return t;let{frequencies:r,frequenciesEveryPeriod:o}=e,i=o==null?void 0:o.indexOf(t);return i>=0&&o[i]?r[i]:(r==null?void 0:r.length)>0&&(o==null?void 0:o.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),r[0]):t},"frequencyToSellingPlan");function Oi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Co();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===we?cr:lr}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(Oi,"autoInitializeOffers");var vi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function Ti(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(Ti,"getCookieValue");var Ae=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),ue=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),yr=n((t=[],e=[])=>{var r;return!!(((r=D)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),Q=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function Ro(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(Ro,"getOrCreateHidden");function et(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(et,"getMatchingProductIfExists");var Z=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),tt=n((t,e)=>({type:N,payload:{product:t,offer:e}}),"optoutProduct"),wi=n((t,e)=>({type:St,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Sr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),be=n((t,e,r)=>(o,i)=>{let s=xi(t,e)(i());o({type:le,payload:{product:t,prepaidShipments:e,offer:r,frequency:s}})},"productChangePrepaidShipments");var _r=n(t=>({type:ti,payload:{product:t}}),"concludeUpsell"),Ci=n(t=>({type:Me,payload:t}),"setMerchantId"),Ao=n(t=>({type:$e,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),il=n(t=>({type:Zn,payload:t}),"requestAuth"),It=n((t,e,r,o)=>({type:Jt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ye=n(t=>({type:Oe,payload:t}),"unauthorized"),Ri=n(t=>({type:Kt,payload:t}),"setAuthUrl"),Nt=n(t=>({type:ni,payload:t}),"fetchDone"),Ai=n((t=Qn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(ye({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=il(s);return r(a),t(s).then(({sig_field:c,ts:l,sig:p})=>r(It(i,c,l,p)),c=>r(ye(c))).finally(()=>r(Nt(a)))},"fetchAuthThunk"),"fetchAuth"),sl=n((t,e)=>({type:Xn,payload:{status:t,ordering:e}}),"requestOrders"),Io=n(t=>({type:Qt,payload:t}),"receiveOrders"),No=n(t=>({type:Zt,payload:t}),"receiveItems"),Er=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(ye("No auth set."));let c=sl(t,e);return o(c),Je.fetchOrders(s,a,t,e).then(l=>{if(l.results){o(Io(l));let p=(l.results[0]||{}).public_id;if(p)return Je.fetchItems(s,a,p).then(u=>o(No(u)))}return o(ye(l.detail)),null},l=>o(ye(l))).finally(()=>o(Nt(c)))},"fetchOrdersThunk"),"fetchOrders"),Ii=n(t=>{switch(t){case ii:return{type:Ve,payload:t};case ar:return{type:Ge,payload:t};case Te:return{type:je,payload:t};case we:return{type:He,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Ni=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Ao(r)),o},"requestSessionId"),Se=n((t,e,r)=>(o,i)=>{let s=J(r)(i());o({type:w,payload:{...t,offer:e,frequencyConfig:s}})},"receiveOffer"),br=n(t=>({type:ei,payload:t}),"fetchResponseError"),ko=n((t,e=Ye,r)=>({type:F,payload:{product:t,module:e,offer:r}}),"requestOffer"),ki=ko,Fi=n(()=>({type:Be}),"checkout"),al=n((t,e,r,o)=>({type:ri,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),cl=n(t=>({type:er,payload:t}),"receiveCreateOneTime"),ll=n((t,e)=>({type:oi,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),pl=n((t,e)=>({type:tr,payload:{response:t,product:e}}),"receiveConvertOneTime"),xr=n((t,e,r,o=!1,i=null)=>n(function(a,c){let l=c(),{auth:p,environment:{legoUrl:u},previewUpsellOffer:d,offerId:h,sessionId:_}=l;if(!p)return a(ye("No auth set."));let{frequencies:P,frequenciesEveryPeriod:m}=J(t.id)(l),E=Pi(i,P,m),T=al(t,e,r,h);return a(T),(d?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:h}):Je.createOneTime(u,p,t.id,e,r,h)).then(y=>(a(cl(y)),o?(a(ll(y,E)),(d?Promise.resolve({item:y,frequency:E}):Je.convertOneTimeToSubscription(u,p,y,E,h,_)).then(v=>a(pl(v,t)),v=>a(br(v)))):y),y=>a(br(y))).finally(()=>a(Nt(T)))},"createIuThunk"),"createIu"),qi=n(t=>({type:rr,payload:t}),"setLocale"),Di=n(t=>({type:ze,payload:t}),"setConfig"),Ui=n((t,e,r)=>({type:or,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Li=n(t=>({type:nr,payload:t}),"setTemplates"),Mi=n((t,e)=>({type:ir,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),$i=n((t,e)=>({type:sr,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),Vi=n(t=>({type:pe,payload:t}),"receiveMerchantSettings");var kt="OG_STATE",Hi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Fo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Bi=n(()=>Fo()?{}:Hi(localStorage.getItem(kt)),"loadState"),ul=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),zi=n(t=>{if(Fo())return;t&&t.sessionId&&(document.cookie="og_session_id="+encodeURIComponent(t.sessionId)+"; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax");let e=ul(t);e&&localStorage.getItem(kt)!==e&&localStorage.setItem(kt,e)},"saveState"),Yi=n(t=>(0,Gi.throttle)(500,e=>{if(Fo())return;let{key:r,newValue:o}=e;r===kt&&o===null?(t.dispatch({type:me}),setTimeout(()=>t.dispatch(Ni()),0)):r===kt&&t.dispatch({type:ve,newValue:Hi(o)})}),"listenLocalStorageChanges");var Ki=ce(Yt());var dl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Wi=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>dl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),fl=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Wi(!0)},{expressions:[({type:t}={})=>t===N],fn:Wi(!1)}],Ji=n(t=>e=>r=>{let o=t.getState();fl.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Qi=n(t=>e=>r=>{var i;let o;switch(r.type){case w:case N:case R:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Zi=n(t=>e=>r=>{e(r);let o=(0,Ki.throttle)(500,()=>{zi({...t.getState()})});r.type!==ve&&o()},"localStorageMiddleware");var Ft=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Xi(t){let[e,r]=Ft(),[o,i]=Ft(),[s,a]=Ft();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(Ao(l)):a(p)});let c=Promise.all([o,e,s]);return c.then(()=>{var l;t.dispatch({type:Xt,payload:{}}),window.addEventListener("storage",Yi(t)),(l=t.getState().auth)!=null&&l.ts||t.dispatch(Ai())}),l=>async p=>{Ve===p.type||Ge===p.type||je===p.type||He===p.type?r(p.payload):Me===p.type?i(p.payload):$e===p.type?a(p.payload):await c,l(p)}}n(Xi,"waitUntilOffersReady");function es(t){return e=>r=>{if(r.type===F){let{merchantId:o,sessionId:i,environment:{apiUrl:s}}=t.getState(),a=S(r.payload.product);a&&bi.fetchOffer(s,o,i,a,r.payload.module||Ye,r.payload.searchParams).then(c=>t.dispatch(Se(c,r.payload.offer,a)),c=>t.dispatch(br(c))).finally(()=>t.dispatch(Nt(r)))}return e(r)}}n(es,"offerRequestMiddleware");var cs=ce(ns());var de=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),Or=n(t=>`${t}%`,"percentage"),yl="Subscribe and Save",bl="ordergroove-subscribe-and-save-",rt=n((t=[])=>t.find(vr)||t.find(ss)||t.find(Tr),"getPayAsYouGoSellingPlanGroup"),is=n((t=[])=>t.filter(e=>ss(e)||vr(e)||Tr(e)),"getPayAsYouGoSellingPlanGroups"),ss=n(t=>t.name===yl||t.app_id==="ordergroove-subscribe-and-save","isDefaultSellingPlanGroup"),vr=n(t=>t.name.startsWith("og_psfl")||t.app_id==="ordergroove-product-specific-frequency-list","isProductSpecificFrequencySellingPlanGroup"),Tr=n(t=>{var e;return(e=t.app_id)==null?void 0:e.startsWith(bl)},"isExperimentSellingPlanGroup"),as=n(t=>{let e=rt(t.map(r=>r.group));return t.find(r=>r.group===e)},"getPayAsYouGoSellingPlan");function wr(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(wr,"sellingPlansToFrequencies");function Cr(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Sl(r))}n(Cr,"sellingPlansToEveryPeriod");function Sl(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(Sl,"textToFreq");function Rr(t){var r;let e=(r=t==null?void 0:t.options.find(({name:o})=>o==="Shipment amount"))==null?void 0:r.value.split(" ")[0];return e?Number(e):void 0}n(Rr,"getPrepaidShipments");function _l(t,e){e.map(a=>a.weight).reduce((a,c)=>a+c,0)!==100&&console.error("OG: Sum of weights for variants must be 100. Defaulting to last variant.");let i=cs.default.murmur3(t,0)%100,s=0;for(let a=0;a<e.length;a++){let c=e[a],l=s+c.weight;if(c.weight>0&&i<l)return a;s=l}return e.length-1}n(_l,"getVariantIx");function Ar(t={},e){var r;switch(e.type){case pe:return{...t,...e.payload.experiments};case So:return{...t,currentVariant:e.payload.index,offerProfileId:(r=e.payload.parameters)==null?void 0:r.offer_profile_public_id};default:return t}}n(Ar,"experimentsReducer");function El(t,e,r){if(!t||r.variants.length===0)return;let o=e.selling_plan_groups.filter(Tr);if(o.length!==r.variants.length)return;let i=o.find(({app_id:s})=>s.endsWith(t.public_id));if(!!i)return{...e,selling_plan_groups:[i],variants:e.variants.map(({selling_plan_allocations:s,...a})=>({...a,selling_plan_allocations:s.filter(({selling_plan_group_id:c})=>c===i.id)}))}}n(El,"resolveShopifySetupProductWhenExperiment");function xl(t,e){let r=t==null?void 0:t.public_id;if(!r)return null;let o=t.variants,i=_l(`${r}|${e}`,o);return{...o[i],index:i}}n(xl,"getAssignedExperimentVariant");function ls(t){let[e,r]=Ft(),o,i;return s=>async a=>{if(a.type===Xt)r();else if(a.type===pe){await e,i=a.payload.experiments;let{sessionId:c}=t.getState();o=xl(i,c),o&&t.dispatch({type:So,payload:o})}else if(a.type===F)await e,o&&(a.payload.searchParams={...a.payload.searchParams,variant:o.public_id});else if(a.type===q){await e;let c=El(o,a.payload.product,i);if(c)return s({type:q,payload:{...a.payload,experiments:!0,originalPayload:a.payload,product:c}})}return s(a)}}n(ls,"experimentsMiddleware");function ps(t,...e){if(window.og&&window.og.store)return window.og.store;let r=window.og&&window.og.previewMode,o=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"Ordergroove Offers"}):yo,i=[Xi,Yn,ls,es,Ji,Qi],s={};if(!r)try{s=Bi(),i.push(Zi)}catch{}let a=o(Hn(...i,...e.filter(l=>l))),c=go(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(ps,"makeStore");var Pl=Object.defineProperty,Ir=n((t,e)=>Pl(t,"name",{value:e,configurable:!0}),"i"),Ol=Ir(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),ds=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000","http://localhost:3010","http://0.0.0.0:3010",window.location.origin],us=Ir(t=>(e,r)=>{ds.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Uo(t=window.opener,e=window.og){let r=Ir(o=>{let i=Ol(ds),s=us(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.7/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),us(t)("READY"))}n(Uo,"h");Ir(Uo,"offersLiveEditor");var Nr=null,vl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),fs=n(t=>{if(!Nr)throw new Error("Missing redux store.");return Nr},"resolveStore"),Tl=n((t,e)=>r=>{let{getState:o,dispatch:i}=fs(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=vl)=>r=>{let i=Tl(t,typeof e=="function"?e:s=>Gn(e,s));return class extends r{get store(){return Nr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=fs(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(s,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(s,a,c),this._storeUnsubscribe&&a!==c&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),hs=n(t=>{Nr=t},"setStore");var Lo=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],...t.sessionId&&{session_id:t.sessionId},...Tt(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),ot=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var Mo=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ie=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var H=`{{lit-${String(Math.random()).slice(2)}}}`,$o=`<!--${H}-->`,ms=new RegExp(`${H}|${$o}`),nt="$lit$",_e=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:p,values:{length:u}}=e;for(;l<u;){let d=s.nextNode();if(d===null){s.currentNode=i.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let h=d.attributes,{length:_}=h,P=0;for(let m=0;m<_;m++)gs(h[m].name,nt)&&P++;for(;P-- >0;){let m=p[l],E=kr.exec(m)[2],T=E.toLowerCase()+nt,y=d.getAttribute(T);d.removeAttribute(T);let v=y.split(ms);this.parts.push({type:"attribute",index:c,name:E,strings:v}),l+=v.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let h=d.data;if(h.indexOf(H)>=0){let _=d.parentNode,P=h.split(ms),m=P.length-1;for(let E=0;E<m;E++){let T,y=P[E];if(y==="")T=ie();else{let v=kr.exec(y);v!==null&&gs(v[2],nt)&&(y=y.slice(0,v.index)+v[1]+v[2].slice(0,-nt.length)+v[3]),T=document.createTextNode(y)}_.insertBefore(T,d),this.parts.push({type:"node",index:++c})}P[m]===""?(_.insertBefore(ie(),d),o.push(d)):d.data=P[m],l+=m}}else if(d.nodeType===8)if(d.data===H){let h=d.parentNode;(d.previousSibling===null||c===a)&&(c++,h.insertBefore(ie(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),l++}else{let h=-1;for(;(h=d.data.indexOf(H,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let d of o)d.parentNode.removeChild(d)}};n(_e,"Template");var gs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),qt=n(t=>t.index!==-1,"isTemplatePartActive"),ie=n(()=>document.createComment(""),"createMarker"),kr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Vo=133;function jo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Vo,null,!1),s=Dt(o),a=o[s],c=-1,l=0,p=[],u=null;for(;i.nextNode();){c++;let d=i.currentNode;for(d.previousSibling===u&&(u=null),e.has(d)&&(p.push(d),u===null&&(u=d)),u!==null&&l++;a!==void 0&&a.index===c;)a.index=u!==null?-1:a.index-l,s=Dt(o,s),a=o[s]}p.forEach(d=>d.parentNode.removeChild(d))}n(jo,"removeNodesFromTemplate");var Cl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Vo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Dt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(qt(o))return r}return-1},"nextActiveIndexInTemplateParts");function ys(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Vo,null,!1),a=Dt(i),c=0,l=-1;for(;s.nextNode();)for(l++,s.currentNode===r&&(c=Cl(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===l;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Dt(i,a);return}a=Dt(i,a)}}n(ys,"insertNodeIntoTemplate");var Rl=new WeakMap;var Ne=n(t=>typeof t=="function"&&Rl.has(t),"isDirective");var L={},Fr={};var fe=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=Mo?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1),s=0,a=0,c,l=i.nextNode();for(;s<o.length;){if(c=o[s],!qt(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),i.currentNode=l.content),(l=i.nextNode())===null&&(i.currentNode=r.pop(),l=i.nextNode());if(c.type==="node"){let p=this.processor.handleTextExpression(this.options);p.insertAfterNode(l.previousSibling),this.__parts.push(p)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));s++}return Mo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(fe,"TemplateInstance");var bs=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Il=` ${H} `,se=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=kr.exec(s);c===null?r+=s+(o?Il:$o):r+=s.substr(0,c.index)+c[1]+c[2]+nt+c[3]+H}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return bs!==void 0&&(r=bs.createHTML(r)),e.innerHTML=r,e}};n(se,"TemplateResult");var Dr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),qr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),ke=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new it(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!qr(s))return s}let i="";for(let s=0;s<r;s++){i+=e[s];let a=o[s];if(a!==void 0){let c=a.value;if(Dr(c)||!qr(c))i+=typeof c=="string"?c:String(c);else for(let l of c)i+=typeof l=="string"?l:String(l)}}return i+=e[r],i}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(ke,"AttributeCommitter");var it=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==L&&(!Dr(e)||e!==this.value)&&(this.value=e,Ne(e)||(this.committer.dirty=!0))}commit(){for(;Ne(this.value);){let e=this.value;this.value=L,e(this)}this.value!==L&&this.committer.commit()}};n(it,"AttributePart");var ae=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(ie()),this.endNode=e.appendChild(ie())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=ie()),e.__insert(this.endNode=ie())}insertAfterPart(e){e.__insert(this.startNode=ie()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ne(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=L,r(this)}let e=this.__pendingValue;e!==L&&(Dr(e)?e!==this.value&&this.__commitText(e):e instanceof se?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):qr(e)?this.__commitIterable(e):e===Fr?(this.value=Fr,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof fe&&this.value.template===r)this.value.update(e.values);else{let o=new fe(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new ae(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ie(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ae,"NodePart");var st=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Ne(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=L,r(this)}if(this.__pendingValue===L)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=L}};n(st,"BooleanAttributePart");var at=class extends ke{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Ut(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(at,"PropertyCommitter");var Ut=class extends it{};n(Ut,"PropertyPart");var Ss=!1;(()=>{try{let t={get capture(){return Ss=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var ct=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Ne(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=L,s(this)}if(this.__pendingValue===L)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),i=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=Nl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=L}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ct,"EventPart");var Nl=n(t=>t&&(Ss?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Go(t){let e=Fe.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Fe.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(H);return r=e.keyString.get(o),r===void 0&&(r=new _e(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(Go,"templateFactory");var Fe=new Map;var Ee=new WeakMap,Ho=n((t,e,r)=>{let o=Ee.get(e);o===void 0&&(Ie(e,e.firstChild),Ee.set(e,o=new ae(Object.assign({templateFactory:Go},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Lt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new at(e,r.slice(1),o).parts:s==="@"?[new ct(e,r.slice(1),i.eventContext)]:s==="?"?[new st(e,r.slice(1),o)]:new ke(e,r,o).parts}handleTextExpression(e){return new ae(e)}};n(Lt,"DefaultTemplateProcessor");var Bo=new Lt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var f=n((t,...e)=>new se(t,e,"html",Bo),"html");var Es=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Ur=!0;typeof window.ShadyCSS>"u"?Ur=!1:typeof window.ShadyCSS.prepareTemplateDom>"u"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Ur=!1);var Fl=n(t=>e=>{let r=Es(e.type,t),o=Fe.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Fe.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(H);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Ur&&window.ShadyCSS.prepareTemplateDom(a,t),i=new _e(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),ql=["html","svg"],Dl=n(t=>{ql.forEach(e=>{let r=Fe.get(Es(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:i}}=o,s=new Set;Array.from(i.querySelectorAll("style")).forEach(a=>{s.add(a)}),jo(o,s)})})},"removeStylesFromLitTemplates"),xs=new Set,Ul=n((t,e,r)=>{xs.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let p=0;p<s;p++){let u=i[p];u.parentNode.removeChild(u),a.textContent+=u.textContent}Dl(t);let c=o.content;r?ys(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let p=new Set;p.add(a),jo(r,p)}},"prepareTemplateStyles"),Ps=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=Ee.has(e),s=Ur&&e.nodeType===11&&!!e.host,a=s&&!xs.has(o),c=a?document.createDocumentFragment():e;if(Ho(t,c,Object.assign({templateFactory:Fl(o)},r)),a){let l=Ee.get(c);Ee.delete(c);let p=l.value instanceof fe?l.value.template:void 0;Ul(o,c,p),Ie(e,e.firstChild),e.appendChild(c),Ee.set(e,l)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Os;window.JSCompiler_renameProperty=(t,e)=>t;var Qo={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},vs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),zo={attribute:!0,type:String,converter:Qo,reflect:!1,hasChanged:vs},Yo=1,Wo=1<<2,Ko=1<<3,Jo=1<<4,Zo="finalized",lt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=zo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(i){let s=this[e];this[r]=i,this.requestUpdateInternal(e,s,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||zo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Zo)||e.finalize(),this[Zo]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let i of o)this.createProperty(i,r[i])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=vs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||Qo,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||Qo.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=zo){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Ko,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Ko}}_attributeToProperty(e,r){if(this._updateState&Ko)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Jo,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Jo}}requestUpdateInternal(e,r,o){let i=!0;if(e!==void 0){let s=this.constructor;o=o||s.getPropertyOptions(e),s._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&Jo)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Wo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Wo}get hasUpdated(){return this._updateState&Yo}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&Yo||(this._updateState=this._updateState|Yo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Wo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(lt,"UpdatingElement");Os=Zo;lt[Os]=!0;var Ts=Element.prototype,zf=Ts.msMatchesSelector||Ts.webkitMatchesSelector;var Lr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Xo=Symbol(),pt=class{constructor(e,r){if(r!==Xo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Lr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(pt,"CSSResult");var ws=n(t=>new pt(String(t),Xo),"unsafeCSS"),Ll=n(t=>{if(t instanceof pt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
12
+ take care to ensure page security.`)},"textFromCSSResult"),b=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+Ll(i)+t[s+1],t[0]);return new pt(r,Xo)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Cs={},x=class extends lt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((s,a)=>s.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),i=[];o.forEach(s=>i.unshift(s)),this._styles=i}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!Lr){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return ws(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):Lr?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==Cs&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let i=document.createElement("style");i.textContent=o.cssText,this.renderRoot.appendChild(i)}))}render(){return Cs}};n(x,"LitElement");x.finalized=!0;x.render=Ps;var zs=ce(Ms());var Bl=n(t=>{let e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t},"sanitizeFrequencyString"),$s=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Mt=n(t=>{let e=$s(t);if(!e){let r=t.offer;r&&(e=$s(r))}return e},"resolveProduct"),zl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),en=n(t=>class extends t{get offer(){return zl(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),I=n(t=>class extends en(t){get product(){return Mt(this)}},"withProduct"),$r=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=Bl(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Vr={};Mn(Vr,{autoshipByDefault:()=>Yl,eligibilityGroups:()=>rn,eligible:()=>Vs,hasPrepaidOptions:()=>Zl,hasUpcomingOrder:()=>Hs,hasUpsellGroup:()=>Gs,inStock:()=>tn,optedout:()=>Jl,prepaidEligible:()=>Wl,prepaidSubscribed:()=>Ql,regularEligible:()=>ep,subscribed:()=>Kl,subscriptionEligible:()=>js,upcomingOrderContainsProduct:()=>Xl,upsellEligible:()=>Bs});var tn=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),Vs=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Yl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),js=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&Vs(t,e)&&tn(t,e),"subscriptionEligible"),rn=n((t,e)=>{let r=S((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),Gs=n((t,e)=>{let r=rn(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Wl=n((t,e)=>{let r=rn(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Kl=n((t,e)=>hr(e.product)(t),"subscribed"),Jl=n((t,e)=>mr(e.product)(t),"optedout"),Ql=n((t,e)=>Ei(e.product)(t),"prepaidSubscribed"),Zl=n((t,e)=>j(e.product.id)(t).length>0,"hasPrepaidOptions"),Hs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Xl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Bs=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&tn(t,e)&&Hs(t)&&Gs(t,e)},"upsellEligible"),ep=n((t,e)=>js(t,e)&&!Bs(t,e),"regularEligible");var tp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),jr=class extends I(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return f``;let e=tp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),zs.default.parse(e,o=>Vr[o]&&Vr[o](this.state,this))?f`
13
13
  <slot></slot>
14
- `:f``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(Lr,"When");var Op=n(t=>({state:t}),"mapStateToProps"),Ws=g(Op)(Lr);var Js={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Ee={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&go(t)?t:null}}},Mr={type:Boolean,attribute:!0,reflect:!0},ct={type:Object,attribute:!1};var Tp=n(t=>class extends t{getOption(e,r=e){let o=_o(e);if(this.hasAttribute(o)){let i=this.getAttribute(o);return i.toString().toLowerCase()==="true"?!0:i.toString().toLowerCase()==="false"?!1:i}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),G=Tp(x);var B=class extends N(G){static get properties(){return{subscribed:Mr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
14
+ `:f``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(jr,"When");var rp=n(t=>({state:t}),"mapStateToProps"),Ys=g(rp)(jr);var Ws={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Pe={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Oo(t)?t:null}}},Gr={type:Boolean,attribute:!0,reflect:!0},ft={type:Object,attribute:!1};var op=n(t=>class extends t{applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),z=op(x);var Y=class extends I(z){static get properties(){return{subscribed:Gr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return b`
15
15
  :host {
16
16
  cursor: default;
17
17
  display: inline-block;
@@ -85,7 +85,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
85
85
  <slot name="frequency-mismatch"></slot>
86
86
  `:f`
87
87
  <slot name="not-subscribed"></slot>
88
- `}};n(B,"OptinStatus");var K=n((t,e={})=>({subscribed:X(e.product)(t),frequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),prepaidShipmentsOptedIn:M(e.product)(t),...V(t,e,"defaultFrequency"),...V(t,e,"frequencies"),...We(t,e)}),"mapStateToProps"),Ks=g(K)(B);var lt=class extends B{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:Ee,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(D.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=Tt(r,this.store.getState().config),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,D.shopify_selling_plans&&this.store&&(e=Tt(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(Dt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return f`
88
+ `}};n(Y,"OptinStatus");var X=n((t,e={})=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:Qe((e.product||{}).id)(t),prepaidShipmentsOptedIn:V(e.product)(t),defaultFrequency:ne((r=e.product)==null?void 0:r.id)(t)||G(e,"defaultFrequency"),frequencies:Ze((o=e.product)==null?void 0:o.id)(t)||G(e,"frequencies"),...Xe(t,e),productFrequencies:J(e.product)(t)}},"mapStateToProps"),Ks=g(X)(Y);var ht=class extends Y{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:Pe,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(D.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=At(r,this.productFrequencies),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,D.shopify_selling_plans&&this.store&&(e=At(e,this.productFrequencies)),e}handleClick(e){this.optinProduct(Mt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return f`
89
89
  <slot name="default">
90
90
  <button
91
91
  aria-labelledby="ogOfferOptInLabel"
@@ -99,7 +99,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
99
99
  </slot>
100
100
  </label>
101
101
  </slot>
102
- `}};n(lt,"OptinButton");var Qs=g(K,{optinProduct:J})(lt);var $r=class extends B{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return f`
102
+ `}};n(ht,"OptinButton");var Js=g(X,{optinProduct:Z})(ht);var Hr=class extends Y{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return f`
103
103
  <slot name="default">
104
104
  <button
105
105
  aria-labelledby="ogOfferOptOutLabel"
@@ -113,13 +113,13 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
113
113
  </slot>
114
114
  </label>
115
115
  </slot>
116
- `}};n($r,"OptoutButton");var Zs=g(K,{optoutProduct:Qe})($r);var ke=n((t,e)=>{let{every:r,every_period:o}=xt(t);return r&&o?f`
116
+ `}};n(Hr,"OptoutButton");var Qs=g(X,{optoutProduct:tt})(Hr);var De=n((t,e)=>{let{every:r,every_period:o}=Tt(t);return r&&o?f`
117
117
  ${r}
118
118
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
119
119
  ${e&&e===t?f`
120
120
  <og-text key="defaultFrequencyCopy"></og-text>
121
121
  `:""}
122
- `:t},"frequencyText"),pt=class extends N(G){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Mr,frequency:{type:String},defaultFrequency:Ee,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:ui}}}}static get styles(){return y`
122
+ `:t},"frequencyText"),mt=class extends I(z){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Gr,frequency:{type:String},defaultFrequency:Pe,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:yi}}}}static get styles(){return b`
123
123
  :host[hidden] {
124
124
  display: none;
125
125
  }
@@ -129,7 +129,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
129
129
  `}constructor(){super(),this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return f`
130
130
  <span>
131
131
  ${this.subscribed&&f`
132
- <slot name="subscribed">${ke(e)}</slot>
132
+ <slot name="subscribed">${De(e)}</slot>
133
133
  `||""}
134
134
  ${!this.subscribed&&f`
135
135
  <slot name="not-subscribed"></slot>
@@ -138,7 +138,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
138
138
  <slot name="frequency-mismatch"></slot>
139
139
  `||""}
140
140
  </span>
141
- `}};n(pt,"FrequencyStatus");var Ft=n((t,e)=>{var r,o;return{subscribed:X(e.product)(t),frequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...V(t,e,"frequencies"),...V(t,e,"defaultFrequency"),...We(t,e)}},"mapStateToProps"),Xs=g(Ft)(pt);var Vr=class extends Fr(B){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Ee}}static get styles(){return y`
141
+ `}};n(mt,"FrequencyStatus");var $t=n((t,e)=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:Qe((e.product||{}).id)(t),frequencies:Ze((r=e.product)==null?void 0:r.id)(t)||G(e,"frequencies"),defaultFrequency:ne((o=e.product)==null?void 0:o.id)(t)||G(e,"defaultFrequency"),...Xe(t,e),productFrequencies:J(e.product)(t)}},"mapStateToProps"),Zs=g($t)(mt);var Br=class extends $r(Y){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Pe}}static get styles(){return b`
142
142
  :host {
143
143
  display: inline-block;
144
144
  cursor: pointer;
@@ -148,24 +148,24 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
148
148
  border-width: var(--og-select-border-width, 1px);
149
149
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
150
150
  }
151
- `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return(o=this.frequencies)!=null&&o.length?r=[e.find(i=>i.value==="optedOut"),...this.frequencies.map((i,s)=>({value:i,text:this.frequenciesText&&s in this.frequenciesText?this.frequenciesText[s]:ke(i,this.defaultFrequency)}))]:r=e,f`
151
+ `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;if((o=this.frequencies)!=null&&o.length){let{frequenciesText:i}=this.productFrequencies;r=[e.find(s=>s.value==="optedOut"),...this.frequencies.map((s,a)=>({value:s,text:i&&a in i?i[a]:De(s,this.defaultFrequency)}))]}else r=e;return f`
152
152
  <og-select
153
153
  .options="${r}"
154
154
  .selected="${this.currentFrequency}"
155
155
  .onChange="${({target:{value:i}})=>this.onOptinChange(i)}"
156
156
  ></og-select>
157
- `}};n(Vr,"OptinSelect");var ea=g((t,e)=>({...K(t,e),...Ft(t,e),...V(t,e,"frequencies")}),{productChangeFrequency:mr,optoutProduct:Qe})(Vr);var jr=class extends N(G){static get styles(){return y`
157
+ `}};n(Br,"OptinSelect");var Xs=g((t,e)=>{var r;return{...X(t,e),...$t(t,e),frequencies:Ze((r=e.product)==null?void 0:r.id)(t)||G(e,"frequencies")}},{productChangeFrequency:Sr,optoutProduct:tt})(Br);var zr=class extends I(z){static get styles(){return b`
158
158
  :host[hidden] {
159
159
  display: none;
160
160
  }
161
161
  :host {
162
162
  display: inline-block;
163
163
  }
164
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ct,isPreview:{type:Boolean,attribute:!1},target:{type:String},skipModal:{type:Boolean,attribute:"skip-modal"}}}constructor(){super(),this.fetchOrders=()=>0,this.createIu=()=>0,this.concludeUpsell=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(this.skipModal)this.createIu(this.product,this.nextUpcomingOrder.public_id,1,!1,null),this.concludeUpsell(this.product);else if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return f`
164
+ `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ft,isPreview:{type:Boolean,attribute:!1},target:{type:String},skipModal:{type:Boolean,attribute:"skip-modal"}}}constructor(){super(),this.fetchOrders=()=>0,this.createIu=()=>0,this.concludeUpsell=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(this.skipModal)this.createIu(this.product,this.nextUpcomingOrder.public_id,1,!1,null),this.concludeUpsell(this.product);else if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return f`
165
165
  <slot>
166
166
  <og-next-upcoming-order></og-next-upcoming-order>
167
167
  </slot>
168
- `}};n(jr,"UpsellButton");var wp=n(t=>({isPreview:t.previewUpsellOffer,nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder}),"mapStateToProps"),ta=g(wp,{fetchOrders:yr,createIu:br,concludeUpsell:gr})(jr);var Hr=class extends N(G){static get properties(){return{...super.properties,defaultFrequency:Ee,auth:ct,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super(),this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return f`
168
+ `}};n(zr,"UpsellButton");var np=n(t=>({isPreview:t.previewUpsellOffer,nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder}),"mapStateToProps"),ea=g(np,{fetchOrders:Er,createIu:xr,concludeUpsell:_r})(zr);var Yr=class extends I(z){static get properties(){return{...super.properties,defaultFrequency:Pe,auth:ft,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super(),this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return f`
169
169
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
170
170
  <div slot="content">
171
171
  <slot>
@@ -203,7 +203,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
203
203
  </slot>
204
204
  </span>
205
205
  </og-modal>
206
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(Hr,"UpsellModal");var Cp=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:X(e.product)(t),frequency:te(e.product)(t),...V(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),ra=g(Cp,{concludeUpsell:gr,createIu:br})(Hr);var Gr=class extends B{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return y`
206
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(Yr,"UpsellModal");var ip=n((t,e)=>{var r;return{auth:t.auth,offerId:t.offerId,subscribed:te(e.product)(t),frequency:oe(e.product)(t),defaultFrequency:ne((r=e.product)==null?void 0:r.id)(t)||G(e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}},"mapStateToProps"),ta=g(ip,{concludeUpsell:_r,createIu:xr})(Yr);var Wr=class extends Y{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return b`
207
207
  :host {
208
208
  cursor: default;
209
209
  display: inline-block;
@@ -244,13 +244,13 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
244
244
  </slot>
245
245
  </label>
246
246
  </slot>
247
- `}};n(Gr,"OptinToggle");var oa=g(K,{optoutProduct:Qe,optinProduct:J})(Gr);var Rp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Br=class extends gn(x){static get properties(){return{pluralize:{type:Number},variant:{type:Number},i18n:{type:Object,attribute:!1},locale:{type:Object,attribute:!1},key:{type:String}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._textOverride=this.innerText.trim()}getText(){return this._textOverride?this._textOverride:this.getPluralizedText(this.getVariantText(this.key))}getVariantText(e){let r={...this.i18n,...this.offer&&this.offer.locale},o=typeof r[e]!="undefined"?r[e]:"";return typeof this.variant=="undefined"?o:o[this.variant]}getPluralizedText(e){return typeof this.pluralize=="undefined"?e:e&&Rp(e,this.pluralize)}render(){return f`
247
+ `}};n(Wr,"OptinToggle");var ra=g(X,{optoutProduct:tt,optinProduct:Z})(Wr);var sp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Kr=class extends en(x){static get properties(){return{pluralize:{type:Number},variant:{type:Number},i18n:{type:Object,attribute:!1},locale:{type:Object,attribute:!1},key:{type:String}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._textOverride=this.innerText.trim()}getText(){return this._textOverride?this._textOverride:this.getPluralizedText(this.getVariantText(this.key))}getVariantText(e){let r={...this.i18n,...this.offer&&this.offer.locale},o=typeof r[e]!="undefined"?r[e]:"";return typeof this.variant=="undefined"?o:o[this.variant]}getPluralizedText(e){return typeof this.pluralize=="undefined"?e:e&&sp(e,this.pluralize)}render(){return f`
248
248
  ${this.getText()}
249
- `}};n(Br,"Text");var Ap=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),na=g(Ap)(Br);var qe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(qe,"DiscountAmount");var ut=class extends qe{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(ut,"DiscountPercent");var zr=class extends ut{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(zr,"ShippingDiscountPercent");var _n="Discount Percent",Sn="Discount Amount",ia="total_price",sa="shipping_total",aa="sub_total",En=n(({field:t,object:e,type:r,value:o})=>{let s=[[new ut(o),{field:ia,object:"item",type:_n}],[new qe(o),{field:ia,object:"item",type:Sn}],[new zr(o),{field:sa,object:"order",type:_n}],[new qe(o),{field:sa,object:"order",type:Sn}],[new ut(o),{field:aa,object:"order",type:_n}],[new qe(o),{field:aa,object:"order",type:Sn}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Np(t){return!(En(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Np,"filterIncentives");var Yr=class extends N(x){static get properties(){return{...super.properties,incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}}}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",i=(this.incentives[o]||[]).find(Np.bind({incentiveClass:e,incentiveValue:r}));return f`
250
- ${this.label} ${i?En(i):this.renderFallback()}
249
+ `}};n(Kr,"Text");var ap=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),oa=g(ap)(Kr);var Ue=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Ue,"DiscountAmount");var gt=class extends Ue{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(gt,"DiscountPercent");var Jr=class extends gt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Jr,"ShippingDiscountPercent");var on="Discount Percent",nn="Discount Amount",na="total_price",ia="shipping_total",sa="sub_total",sn=n(({field:t,object:e,type:r,value:o})=>{let s=[[new gt(o),{field:na,object:"item",type:on}],[new Ue(o),{field:na,object:"item",type:nn}],[new Jr(o),{field:ia,object:"order",type:on}],[new Ue(o),{field:ia,object:"order",type:nn}],[new gt(o),{field:sa,object:"order",type:on}],[new Ue(o),{field:sa,object:"order",type:nn}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function cp(t){return!(sn(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(cp,"filterIncentives");var Qr=class extends I(x){static get properties(){return{...super.properties,incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}}}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",i=(this.incentives[o]||[]).find(cp.bind({incentiveClass:e,incentiveValue:r}));return f`
250
+ ${this.label} ${i?sn(i):this.renderFallback()}
251
251
  `}renderFallback(){return f`
252
- ${En({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
253
- `}};n(Yr,"IncentiveText");var Ip=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&O((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),ca=g(Ip)(Yr);var Wr=class extends Fr(pt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
252
+ ${sn({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
253
+ `}};n(Qr,"IncentiveText");var lp=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&S((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),aa=g(lp)(Qr);var Zr=class extends $r(mt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return b`
254
254
  :host {
255
255
  display: inline-block;
256
256
  cursor: pointer;
@@ -261,7 +261,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
261
261
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
262
262
  z-index: 1;
263
263
  }
264
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var i,s,a,c;let{options:e,isSelected:r}=this.childOptions,o;return this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=(i=this.config)==null?void 0:i.frequencies)==null?void 0:s.length)&&o&&((c=(a=this.config)==null?void 0:a.frequenciesEveryPeriod)==null?void 0:c.length)?Tt(o,this.config):o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return(o=this.frequencies)!=null&&o.length?e=this.frequencies.map((i,s)=>{let a;return this.config.frequenciesEveryPeriod&&s in this.config.frequenciesEveryPeriod?a=ke(this.config.frequenciesEveryPeriod[s],r):this.frequenciesText&&s in this.frequenciesText?a=this.frequenciesText[s]:a=ke(i,this.defaultFrequency),{value:i,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(i=>({value:i,text:ke(i,r)}))),e=e.map(({text:i,value:s})=>({text:s===r?f`
264
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var i,s,a,c;let{options:e,isSelected:r}=this.childOptions,o;return this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=(i=this.productFrequencies)==null?void 0:i.frequencies)==null?void 0:s.length)&&o&&((c=(a=this.productFrequencies)==null?void 0:a.frequenciesEveryPeriod)==null?void 0:c.length)?At(o,this.productFrequencies):o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return(o=this.frequencies)!=null&&o.length?e=this.frequencies.map((i,s)=>{let a,{frequenciesEveryPeriod:c,frequenciesText:l}=this.productFrequencies;return c&&s in c?a=De(c[s],r):l&&s in l?a=l[s]:a=De(i,this.defaultFrequency),{value:i,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(i=>({value:i,text:De(i,r)}))),e=e.map(({text:i,value:s})=>({text:s===r?f`
265
265
  ${i} ${this.defaultText||""}
266
266
  `:i,value:s})),f`
267
267
  <og-select
@@ -270,9 +270,9 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
270
270
  .selected="${this.currentFrequency}"
271
271
  .onChange="${({target:{value:i}})=>{this.productChangeFrequency(this.product,i,this.offer)}}"
272
272
  ></og-select>
273
- `}};n(Wr,"SelectFrequency");var la=g(Ft,{productChangeFrequency:mr})(Wr);var kp={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var pa=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=kp[o];if(typeof i=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",i).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Jr=class extends x{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return f`
274
- ${pa(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
275
- `}};n(Jr,"FormattedDate");var qp=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),ua=g(qp)(Jr);var ha=se(_t());var da=n((t,e,r)=>n(async function(i){await i({type:ue,payload:{isPreview:t,productId:e}}),await i({type:xe}),await i(ye({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Dp=n((t,e)=>(Object.entries(e).forEach(([r,o])=>{if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r].concat(o),s=[...new Set(i.map(a=>JSON.stringify(a)))];t[r]=s.map(a=>JSON.parse(a))}else t[r]=o}),t),"mergeProductPlansToState"),Fp=n((t,e,r)=>n(async function(i,s){await i({type:gt,payload:{isPreview:t,productId:e}});let{merchantId:a}=s();t?(await i(ye({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await i(vo({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await i(wt(a,"sig_field","ts","sig"))):await i(me())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Up=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:lo,payload:{isPreview:t,productId:e}}),await i({type:xe}),await i(ye({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r)),await i({type:Y,payload:Dp(a,Ze({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:He,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),fa=n((t,e,r)=>async function(o,i){switch(await o({type:de}),await o({type:ue,payload:{isPreview:!1,productId:r.product.id}}),await o({type:gt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(da(!0,r.product.id,r));break;case"upsell":o(Fp(!0,r.product.id,r));break;case"subscribed":o(da(!0,r.product.id,r)),o(J(r.product,"2_2"));break;case"prepaid":o(Up(!0,r.product.id,r)),o(J(r.product,"1_3"));break;default:}},"setPreview");var Lp=n((...t)=>JSON.stringify(t),"memoizeKey"),ma=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),Mp=ma((t,e)=>`Hiding Ordergroove offer since the store currency ${t} does not match your configured currency ${e} and you are not set up for multicurrency. Contact your Ordergroove representative for next steps.`),$p=ma(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),Vp=(0,ha.default)((t,e)=>Object.assign({components:e},t),Lp),Kr=class extends G{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Js,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ct,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"?this.preview="subscribed":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return y`
273
+ `}};n(Zr,"SelectFrequency");var ca=g($t,{productChangeFrequency:Sr})(Zr);var pp={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var la=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=pp[o];if(typeof i=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",i).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Xr=class extends x{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return f`
274
+ ${la(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
275
+ `}};n(Xr,"FormattedDate");var up=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),pa=g(up)(Xr);var fa=ce(Pt());var ua=n((t,e,r)=>n(async function(i){await i({type:he,payload:{isPreview:t,productId:e}}),await i({type:Oe}),await i(Se({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r,e))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),dp=n((t,e)=>(Object.entries(e).forEach(([r,o])=>{if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r].concat(o),s=[...new Set(i.map(a=>JSON.stringify(a)))];t[r]=s.map(a=>JSON.parse(a))}else t[r]=o}),t),"mergeProductPlansToState"),fp=n((t,e,r)=>n(async function(i,s){await i({type:Et,payload:{isPreview:t,productId:e}});let{merchantId:a}=s();t?(await i(Se({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r,e)),await i(Io({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await i(It(a,"sig_field","ts","sig"))):await i(ye())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),hp=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:bo,payload:{isPreview:t,productId:e}}),await i({type:Oe}),await i(Se({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r,e)),await i({type:$,payload:dp(a,ot({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:ze,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),da=n((t,e,r)=>async function(o,i){switch(await o({type:me}),await o({type:he,payload:{isPreview:!1,productId:r.product.id}}),await o({type:Et,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(ua(!0,r.product.id,r));break;case"upsell":o(fp(!0,r.product.id,r));break;case"subscribed":o(ua(!0,r.product.id,r)),o(Z(r.product,"2_2"));break;case"prepaid":o(hp(!0,r.product.id,r)),o(Z(r.product,"1_3"));break;default:}},"setPreview");var mp=n((...t)=>JSON.stringify(t),"memoizeKey"),ha=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),gp=ha((t,e)=>`Hiding Ordergroove offer since the store currency ${t} does not match your configured currency ${e} and you are not set up for multicurrency. Contact your Ordergroove representative for next steps.`),ag=ha(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),yp=(0,fa.default)((t,e)=>Object.assign({components:e},t),mp),eo=class extends z{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Ws,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ft,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"?this.preview="subscribed":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return b`
276
276
  :host[hidden] {
277
277
  display: none;
278
278
  }
@@ -423,9 +423,9 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
423
423
  </og-when>
424
424
  </og-when>
425
425
 
426
- `}constructor(){super(),this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let i=new CustomEvent("template-changed");this.dispatchEvent(i)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&dr(()=>this.fetchOffer(this.product.id,Ge,this)),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=Vp(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});A(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>A(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}get shouldEnableOffer(){var e;return this.config&&this.config.storeCurrency&&this.config.merchantSettings&&!(this.config.merchantSettings.multicurrency_enabled||this.config.storeCurrency===this.config.merchantSettings.currency_code)?(Mp(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):this.isCart&&((e=this.config)==null?void 0:e.hasProductSpecificFrequencies)?($p(),!1):!0}render(){return this.shouldEnableOffer?f`
426
+ `}constructor(){super(),this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let i=new CustomEvent("template-changed");this.dispatchEvent(i)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&gr(()=>this.fetchOffer(this.product.id,Ye,this)),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=yp(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});A(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>A(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}get shouldEnableOffer(){return this.config&&this.config.storeCurrency&&this.config.merchantSettings&&!(this.config.merchantSettings.multicurrency_enabled||this.config.storeCurrency===this.config.merchantSettings.currency_code)?(gp(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):!0}render(){return this.shouldEnableOffer?f`
427
427
  <slot></slot>
428
- `:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Kr,"Offer");var jp=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),...V(t,e,"autoshipByDefault",bo(t)[(e.product||{}).id]),...ur(e.product)(t)&&{autoshipByDefault:!1},optedin:Ot(t),subscribed:X(e.product)(t),...We(t)}),"mapStateToProps"),ga=g(jp,{fetchOffer:Oi,fetchOrders:yr,productHasChangedComponents:_i,optinProduct:J,setFirstOrderPlaceDate:Ni,setProductToSubscribe:Ii,setPreview:fa})(Kr);var Ut=class extends x{constructor(){super(),this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return y`
428
+ `:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");if(r&&r.currentFrequency)return r.currentFrequency;let o=this.getValueFromAttribute("defaultFrequency");return o||(this.template&&this.template.config&&typeof this.template.config.defaultFrequency!="undefined"?this.template.config.defaultFrequency:this.configDefaultFrequency)}getValueFromAttribute(e){let r=wo(e);if(this.hasAttribute(r)){let o=this.getAttribute(r);return o.toString().toLowerCase()==="true"?!0:o.toString().toLowerCase()==="false"?!1:o}}};n(eo,"Offer");var bp=n((t,e)=>{var r;return{config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],configDefaultFrequency:ne((r=e.product)==null?void 0:r.id)(t),productFrequency:oe(e.product)(t),productDefaultFrequency:Qe((e.product||{}).id)(t),autoshipByDefault:t.config&&t.config.autoshipByDefault||G(e,"autoshipByDefault",To(t)[(e.product||{}).id]),...mr(e.product)(t)&&{autoshipByDefault:!1},optedin:Rt(t),subscribed:te(e.product)(t),...Xe(t)}},"mapStateToProps"),ma=g(bp,{fetchOffer:ki,fetchOrders:Er,productHasChangedComponents:wi,optinProduct:Z,setFirstOrderPlaceDate:Mi,setProductToSubscribe:$i,setPreview:da})(eo);var Vt=class extends x{constructor(){super(),this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return b`
429
429
  :host[hidden] {
430
430
  display: none;
431
431
  }
@@ -570,7 +570,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
570
570
  </div>
571
571
  </div>
572
572
  </div>
573
- `:f``}};n(Ut,"Modal");var Lt=class extends x{static get styles(){return y`
573
+ `:f``}};n(Vt,"Modal");var jt=class extends x{static get styles(){return b`
574
574
  :host {
575
575
  display: inline-block;
576
576
  color: inherit;
@@ -635,7 +635,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
635
635
  `)}
636
636
  </select>
637
637
  <span>&#9660;</span>
638
- `}};n(Lt,"Select");var Mt=class extends x{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return y`
638
+ `}};n(jt,"Select");var Gt=class extends x{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return b`
639
639
  :host[hidden] {
640
640
  display: none;
641
641
  }
@@ -795,7 +795,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
795
795
  <slot name="content">${this.content}</slot>
796
796
  </div>
797
797
  </span>
798
- `}};n(Mt,"Tooltip");var z=class extends N(x){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return f``}};n(z,"PrepaidStatus");var Hp=n((t,e)=>({options:$(e.product.id)(t),shipmentsOptedIn:M(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),Ig=g(Hp,{productChangePrepaidShipments:ge})(z);var Qr=class extends z{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
798
+ `}};n(Gt,"Tooltip");var W=class extends I(x){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return f``}};n(W,"PrepaidStatus");var Sp=n((t,e)=>({options:j(e.product.id)(t),shipmentsOptedIn:V(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),_g=g(Sp,{productChangePrepaidShipments:be})(W);var to=class extends W{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return b`
799
799
  og-select {
800
800
  display: inline-block;
801
801
  cursor: pointer;
@@ -829,18 +829,18 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
829
829
  <slot name="append"></slot>
830
830
  </label>
831
831
  </div>
832
- `}};n(Qr,"PrepaidToggle");var Gp=n((t,e)=>({options:$(e.product.id)(t),shipmentsOptedIn:M(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),ya=g(Gp,{productChangePrepaidShipments:ge})(Qr);var Zr=class extends z{static get properties(){return{...super.properties,productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return y`
832
+ `}};n(to,"PrepaidToggle");var _p=n((t,e)=>({options:j(e.product.id)(t),shipmentsOptedIn:V(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),ga=g(_p,{productChangePrepaidShipments:be})(to);var ro=class extends W{static get properties(){return{...super.properties,productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return b`
833
833
  :host {
834
834
  display: inline-block;
835
835
  text-indent: initial;
836
836
  }
837
- `}get value(){let e=O(this.product),r=this.productPlans[e]||[],o=this.selectedNumberOfShipments,i=r.find(h=>h.prepaidShipments>1&&h.prepaidShipments===o);if(!i&&(i=r.find(h=>h.prepaidShipments>1),!i))return"";let{discountRate:s,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:l,prepaidSavingsPerShipment:p,prepaidSavingsTotal:d,prepaidExtraSavingsPercentage:u}=i;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?d:this.perDeliverySavings?p:this.percentageSavings?s:this.extraPercentageSavings?u:this.numberOfShipments?c:""}render(){let e=this.value;return e?f`
837
+ `}get value(){let e=S(this.product),r=this.productPlans[e]||[],o=this.selectedNumberOfShipments,i=r.find(h=>h.prepaidShipments>1&&h.prepaidShipments===o);if(!i&&(i=r.find(h=>h.prepaidShipments>1),!i))return"";let{discountRate:s,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:l,prepaidSavingsPerShipment:p,prepaidSavingsTotal:u,prepaidExtraSavingsPercentage:d}=i;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?u:this.perDeliverySavings?p:this.percentageSavings?s:this.extraPercentageSavings?d:this.numberOfShipments?c:""}render(){let e=this.value;return e?f`
838
838
  <slot name="prepend"></slot>
839
839
  ${e}
840
840
  <slot name="append"></slot>
841
841
  `:f`
842
842
  <slot name="fallback"></slot>
843
- `}};n(Zr,"PrepaidData");var Bp=n((t,e)=>({options:$(e.product.id)(t),shipmentsOptedIn:M(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),ba=g(Bp)(Zr);var Xr=class extends z{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
843
+ `}};n(ro,"PrepaidData");var Ep=n((t,e)=>({options:j(e.product.id)(t),shipmentsOptedIn:V(e.product)(t),prepaidShipmentsSelected:re(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),ya=g(Ep)(ro);var oo=class extends W{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return b`
844
844
  :host {
845
845
  cursor: pointer;
846
846
  display: inline-block;
@@ -894,7 +894,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
894
894
  <slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
895
895
  </label>
896
896
  </slot>
897
- `}};n(Xr,"PrepaidButton");var zp=n((t,e)=>({options:$(e.product.id)(t),shipmentsOptedIn:M(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),_a=g(zp,{productChangePrepaidShipments:ge})(Xr);var eo=class extends z{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
897
+ `}};n(oo,"PrepaidButton");var xp=n((t,e)=>({options:j(e.product.id)(t),shipmentsOptedIn:V(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),ba=g(xp,{productChangePrepaidShipments:be})(oo);var no=class extends W{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return b`
898
898
  og-select {
899
899
  display: inline-block;
900
900
  cursor: pointer;
@@ -915,7 +915,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
915
915
  <span>${e[0].text}</span>
916
916
  `}
917
917
  <slot name="append"></slot>
918
- `}};n(eo,"PrepaidSelect");var Yp=n((t,e)=>({options:$(e.product.id)(t),shipmentsOptedIn:M(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),Sa=g(Yp,{productChangePrepaidShipments:ge})(eo);var to=class extends lt{static get properties(){return{...super.properties,prepaidShipmentsOptedIn:{type:Number}}}get isActive(){return this.prepaidShipmentsOptedIn>0?!1:this.subscribed}handleClick(e){if(!this.isActive){let r=this.frequencies&&this.frequencies.length>0?this.frequencies[0]:this.optinFrequency;this.optinProduct(Dt(this),r,this.offer)}e.preventDefault()}render(){return f`
918
+ `}};n(no,"PrepaidSelect");var Pp=n((t,e)=>({options:j(e.product.id)(t),shipmentsOptedIn:V(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),Sa=g(Pp,{productChangePrepaidShipments:be})(no);var io=class extends ht{static get properties(){return{...super.properties,prepaidShipmentsOptedIn:{type:Number}}}get isActive(){return this.prepaidShipmentsOptedIn>0?!1:this.subscribed}handleClick(e){if(!this.isActive){let r=this.frequencies&&this.frequencies.length>0?this.frequencies[0]:this.optinFrequency;this.optinProduct(Mt(this),r,this.offer)}e.preventDefault()}render(){return f`
919
919
  <slot name="default">
920
920
  <button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
921
921
  <label for="action-trigger">
@@ -924,7 +924,7 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
924
924
  </slot>
925
925
  </label>
926
926
  </slot>
927
- `}};n(to,"SubscriptionButton");var Ea=g(K,{optinProduct:J})(to);var $t=class extends x{static get styles(){return y`
927
+ `}};n(io,"SubscriptionButton");var _a=g(X,{optinProduct:Z})(io);var Ht=class extends x{static get styles(){return b`
928
928
  :host {
929
929
  position: fixed;
930
930
  top: 5em;
@@ -1003,14 +1003,14 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
1003
1003
  <br />
1004
1004
  <button @click=${this.toggleUpsellNextOrder(r)}>upsell product is in next order</button>
1005
1005
  <br />
1006
- `)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:i=["subscription","upsell"]}){return s=>{s.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(ye({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(Po({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return f`
1006
+ `)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:i=["subscription","upsell"]}){return s=>{s.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Se({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},{},c)),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(No({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return f`
1007
1007
  <div>
1008
1008
  ${this.testsRan?this.resultsCodeBlock():f`
1009
1009
  <div>Click the button to run tests</div>
1010
1010
  `}
1011
1011
  <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
1012
1012
  </div>
1013
- `}};n($t,"TestWizard");function xn(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,$t);let e=document.createElement(t);document.body.appendChild(e)}n(xn,"default");var vn=[79,71,68,69,86],xa=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===vn[t]){let o=vn[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=vn.length&&xn()}else t=0},!1)},"enable");var ro=class extends N(G){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object}}}static get styles(){return y`
1013
+ `}};n(Ht,"TestWizard");function an(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Ht);let e=document.createElement(t);document.body.appendChild(e)}n(an,"default");var cn=[79,71,68,69,86],Ea=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===cn[t]){let o=cn[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=cn.length&&an()}else t=0},!1)},"enable");var so=n((t=[],e)=>{switch(e.type){case me:return[];case ve:return e.newValue?e.newValue.optedin:t;case R:case k:{let[{prepaidShipments:r,...o},i]=et(t,e.payload.product);return i.concat({...o,...e.payload.product,frequency:e.payload.frequency})}case le:{let{payload:r}=e,[{prepaidShipments:o,...i},s]=et(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case N:return t.filter(r=>!A(e.payload.product,r));case St:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case tr:return t.filter(r=>!A(e.payload.product,r));case Be:return[];default:return t}},"optedin"),ln=n((t=[],e)=>{switch(e.type){case me:return[];case ve:return e.newValue?e.newValue.optedout:t;case R:case k:return t.filter(r=>!A(e.payload.product,r));case N:{let[r,o]=et(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case St:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Be:return[];default:return t}},"optedout"),pn=n((t={},{type:e,payload:r})=>{switch(e){case Qt:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case Zt:return{...t,products:(r.results||[]).map(o=>o.product)};case er:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),vp=n((t={},e)=>{switch(e.type){case w:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Tp=n((t={},e)=>{switch(e.type){case F:return{...t};case w:return{...t,...e.payload.in_stock};default:return t}},"inStock"),un=n((t={},e)=>{switch(e.type){case w:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),xa=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),dn=n((t={},e)=>{switch(e.type){case w:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([i])=>i===o).reduce((i,[,{initial:s,ongoing:a}])=>({...i,initial:[...i.initial||[],...xa(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...xa(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),wp=n((t={},e)=>{switch(e.type){case R:case k:return{...t,[S(e.payload.product)]:e.payload.frequency};case N:return{...t,[S(e.payload.product)]:void 0};default:return t}},"frequency"),fn=n((t=!1,e)=>{switch(e.type){case Jt:return{...e.payload};case Oe:return!1;default:return t}},"auth"),hn=n((t="",e)=>{switch(e.type){case Me:return e.payload;default:return t}},"merchantId"),mn=n((t=null,e)=>{switch(e.type){case Kt:return e.payload;default:return t}},"authUrl"),Cp=n((t={},e)=>{switch(e.type){case w:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),gn=n((t="",e)=>{switch(e.type){case w:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),yn=n((t=null,e)=>{switch(e.type){case me:return null;case $e:return e.payload;default:return t}},"sessionId"),Rp=n((t={},e)=>{switch(e.type){case w:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}),{})};case Be:return{};default:return t}},"productOffer"),bn=n((t={},e)=>{switch(e.type){case ir:return{...t,[S(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Sn=n((t={},e)=>{switch(e.type){case sr:return{...t,[S(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),_n=n((t={},e)=>{switch(e.type){case Ve:return{...t,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case je:return{...t,name:Te,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Ge:return{...t,name:ar,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case He:return{...t,name:we,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),En=n((t={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{1:"day",2:"week",3:"month"},prepaidOptInLabel:"Prepaid Subscription",prepaidShipmentsLabel:"Number of prepaid shipments"},e)=>{switch(e.type){case rr:return{...t,...e.payload};default:return t}},"locale"),Ap=n((t={offerType:"radio"},e)=>{switch(e.type){case ze:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?wt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(wt):t.frequencies};case pe:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),xn=n((t=!1,e)=>{switch(e.type){case he:return e.payload.isPreview;default:return t}},"previewStandardOffer"),Pn=n((t=!1,e)=>{switch(e.type){case Et:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var On=n((t={},e)=>{switch(e.type){case w:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),vn=n((t=[],e)=>{switch(e.type){case w:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Tn=n((t=[],e)=>{switch(e.type){case nr:return[...e.payload||[]];case or:return[e.payload,...t];default:return t}},"templates"),Ip=n((t={},e)=>{switch(e.type){case $:return ot(e.payload);default:return t}},"productPlans"),wn=n((t={},e)=>{switch(e.type){case _t:{let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r}}case le:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),ao=Bt({optedin:so,optedout:ln,nextUpcomingOrder:pn,autoshipEligible:vp,inStock:Tp,eligibilityGroups:un,incentives:dn,frequency:wp,auth:fn,merchantId:hn,authUrl:mn,offer:Cp,offerId:gn,experiments:Ar,sessionId:yn,productOffer:Rp,firstOrderPlaceDate:bn,productToSubscribe:Sn,environment:_n,locale:En,config:Ap,previewStandardOffer:xn,previewUpsellOffer:Pn,autoshipByDefault:On,defaultFrequencies:vn,templates:Tn,productPlans:Ip,prepaidShipmentsSelected:wn});var co=class extends I(z){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object}}}static get styles(){return b`
1014
1014
  :host::before {
1015
1015
  clip-path: inset(100%);
1016
1016
  clip: rect(1px, 1px, 1px, 1px);
@@ -1028,12 +1028,12 @@ var lib=(()=>{var Fa=Object.create;var dt=Object.defineProperty;var Ua=Object.ge
1028
1028
  :host([regular])::before {
1029
1029
  content: 'Regular price';
1030
1030
  }
1031
- `}get value(){var l;let e=O(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let p=o.find(d=>d.prepaidShipments===null||d.prepaidShipments===void 0);return p?p.subscriptionPrice:""}let i=o.find(p=>p.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return c===s?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?f`
1031
+ `}get value(){var l;let e=S(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let p=o.find(u=>u.prepaidShipments===null||u.prepaidShipments===void 0);return p?p.subscriptionPrice:""}let i=o.find(p=>p.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return c===s?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?f`
1032
1032
  <slot name="prepend"></slot>
1033
1033
  ${e}
1034
1034
  <slot name="append"></slot>
1035
1035
  `:f`
1036
1036
  <slot name="fallback"></slot>
1037
- `}};n(ro,"Price");var Jp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:te(e.product)(t)}},"mapStateToProps"),va=g(Jp)(ro);function Pn(t){xa(),ms(t);try{customElements.define("og-when",Ws),customElements.define("og-text",na),customElements.define("og-incentive-text",ca),customElements.define("og-offer",ga),customElements.define("og-select-frequency",la),customElements.define("og-optout-button",Zs),customElements.define("og-optin-toggle",oa),customElements.define("og-optin-status",Ks),customElements.define("og-optin-button",Qs),customElements.define("og-optin-select",ea),customElements.define("og-upsell-button",ta),customElements.define("og-frequency-status",Xs),customElements.define("og-modal",Ut),customElements.define("og-select",Lt),customElements.define("og-tooltip",Mt),customElements.define("og-upsell-modal",ra),customElements.define("og-next-upcoming-order",ua),customElements.define("og-price",va),customElements.define("og-prepaid-toggle",ya),customElements.define("og-prepaid-data",ba),customElements.define("og-prepaid-button",_a),customElements.define("og-prepaid-select",Sa),customElements.define("og-subscription-button",Ea)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(vi(o)),this},setMerchantId(o){return t.dispatch(Si(o)),this},setAuthUrl(o){return t.dispatch(Ei(o)),this},receiveMerchantSettings(o){return t.dispatch(ki(o)),this},getProductsForPurchasePost(o=[]){return Ro(t.getState(),o)},getOptins(o=[]){return Ro(t.getState(),o)},clear(){t.dispatch(Ti())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(Ci(o)),this},setLocale(o){return t.dispatch(wi(o)),this},addTemplate(o,i,s){return t.dispatch(Ri(o,i,s)),this},setTemplates(o){return t.dispatch(Ai(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let l=a.getState(),{sessionId:p}=l;p&&c.forEach(d=>a.dispatch(Oo(d))),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:Y,payload:s.product_discounts})}},initialize(o,i,s,a={}){var l;e&&console.warn("og.offers has been initialized already. Skipping.");let c=t.getState();return o&&o!==c.merchantId&&r.setMerchantId(o),i&&i!==((l=c.environment)==null?void 0:l.name)&&r.setEnvironment(i),r.receiveMerchantSettings(a),s&&r.setAuthUrl(s),e||r.resolveSettings(o,i,window.og_settings,t),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Xo(window.opener,r),r}n(Pn,"makeApi");var wa=se(_t()),Ca=se(Ht());function Pa(t,e,r){let o=`[name="id"][value="${t}"]`,i=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let s=document.querySelectorAll(o);s.length||(s=document.querySelectorAll(i)),[...s].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(Pa,"updateTrackingInputs");function On(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(On,"getTrackingKey");function Kp(t,e){var d,u,h,_;if(!((d=t.payload.offer)==null?void 0:d.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,i=On(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((_=t.payload.offer)==null?void 0:_.variationId)||"",c=oo(o,e),p=[o,R.toLowerCase(),s,c,a].join(",");Pa(o,i,p)}n(Kp,"addDefaultToSubTracking");function Tn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=wn(r);o&&!o.isCart&&Pa(o.product.id,i[0],i[1]);break}case T:Kp(r,t);break;default:}}}n(Tn,"shopifyTrackingMiddleware");var Oa,Ta,Cn=((Ta=(Oa=window.Shopify)==null?void 0:Oa.routes)==null?void 0:Ta.root)||"/",Qp="/cart",Zp=`${Cn}cart.js`,Xp=`${Cn}cart/change.js`,eu=`${Cn}products/`,tu='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',ru=n(t=>(0,Ca.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function ou(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await Rn()).currency}n(ou,"getCurrency");async function nu(t,e){let r=iu(e);if(r)try{let[i,s]=await Promise.all([Ra(r),ou()]),a={product:i,offer:e,currency:s};t.dispatch({type:F,payload:a})}catch(i){console.warn("OG: Unable to fetch product details for PDP",i)}let o=e.closest("form");if(!o){let i=e.parentElement;for(;i&&(o=i.querySelector('form[action$="/cart/add"]'),!(o||i.tagName.toLowerCase()==="body"));)i=i.parentElement}if(o){let i=ru(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(nu,"setupPdp");async function Rn(){return(await fetch(Zp)).json()}n(Rn,"getCart");function iu(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(iu,"guessProductHandle");var Ra=(0,wa.default)(async function(t){return(await fetch(`${eu}${t}.js`)).json()});async function su(t,e){let r=await Rn(),{items:o}=r,i=r;t.dispatch({type:fe,payload:i});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:c})=>c))).map(Ra))).forEach(c=>{let l={product:c,offer:e,currency:r.currency};t.dispatch({type:F,payload:l})})}n(su,"setupCart");async function au(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||oo(t.payload.product.id,e),i=wn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(tu)),l=t.payload.product.id,p=await Rn(),d=(s=p==null?void 0:p.items)==null?void 0:s.findIndex(C=>C.key===l),u=p.items[d],h=u.quantity,_=O(l),S=await fetch(Xp,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,attributes:Object.fromEntries([i]),properties:u.properties,selling_plan:o||null,sections:c.map(C=>C.id.replace(/^shopify-section-/,""))})});if(S.status!==200)throw new Error("Cart not updated");let m=await S.json(),b=p.items.length===m.items.length?m.items[d].key:(a=m.items.find(C=>C.quantity===h&&C.product_id===_&&(!o&&!C.selling_plan_allocation||(C==null?void 0:C.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;b&&(e.dispatch({type:mt,payload:{oldCartProductKey:l,newCartProductKey:b}}),r.setAttribute("product",b));let P=m;e.dispatch({type:fe,payload:P});let E=new CustomEvent(ei,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(E),E.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(C=>{let Nn=C.id.replace(/^shopify-section-/,"");if(!(Nn in w))return;let Da=w[Nn],In=new DOMParser().parseFromString(Da.toString()||"","text/html").getElementById(C.id);In&&(C.innerHTML=In.innerHTML)}):window.location.pathname.startsWith(Qp)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(au,"synchronizeCartOptin");function wn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=On(),o=((a=t.payload.offer)==null?void 0:a.location)||"",i=((c=t.payload.offer)==null?void 0:c.variationId)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case q:case I:s.push(""),s.push(i);break;case R:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(wn,"getTrackingEvent");function oo(t,e){var i;return(i=pr({id:t})(e.getState()))==null?void 0:i.frequency}n(oo,"getSubscribedFrequency");function cu(t,e){e!=null&&e.isCart||!(e!=null&&e.shouldEnableOffer)||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=oo(o,t);Eo(r.form,"selling_plan",i),Eo(r.form,"attributes[og__session]",t.getState().sessionId)})}n(cu,"synchronizeSellingPlan");function An(t){return e=>r=>{var o;switch(r.type){case R:case I:case k:break;case q:(o=r.payload.offer)!=null&&o.isCart?su(t,r.payload.offer):nu(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ae:au(r,t);case q:case T:case F:cu(t,r.payload.offer);break;default:}}}n(An,"shopifyMiddleware");var lu="/apps/subscriptions/auth/",Aa="og_auth_begin",pu="og_auth_end",uu=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function Na({store:t}){var i;let[e]=So(),r=Pt(),o=r!=null&&r.dataset.customer?uu(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await fu(o);if(s){let[a,c,l]=s.split("|");t.dispatch(wt(e,a,Number(c),l))}}else yi("og_auth")}n(Na,"authorizeShopifyCustomer");async function du(t){try{let r=await(await fetch(`${lu}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Aa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Aa.length,r.lastIndexOf(pu)))}catch(e){console.error(e)}}n(du,"fetchOGSignature");async function fu(t){let e=bi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await du(t);if(!r)return"";let s=new Date,a=btoa(i);s.setTime(s.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${s.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(fu,"getOrCreateAuthCookie");var Ia,qa=us(...(Ia=D)!=null&&Ia.shopify_selling_plans?[Zo,An]:[Er],D.shopify&&Tn),v=Pn(qa),hu=v.isReady,mu=v.addOptinChangedCallback,gu=v.addTemplate,yu=v.clear,bu=v.config,_u=v.disableOptinChangedCallbacks,Su=v.getOptins,Eu=v.getProductsForPurchasePost,xu=v.initialize,vu=v.previewMode,Pu=v.register,Ou=v.resolveSettings,Tu=v.setAuthUrl,wu=v.setEnvironment,Cu=v.setLocale,Ru=v.setMerchantId,Au=v.setPublicPath,Nu=v.setTemplates,Iu=v.setupCart,ku=v.setupProduct,qu=v.setupProducts,Du=n(()=>gi(v),"autoInit");var Fu=v.initialize,ka;(ka=D)!=null&&ka.shopify_selling_plans&&dr(()=>Na(v));return Va(Uu);})();
1037
+ `}};n(co,"Price");var Np=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:ne((r=e.product)==null?void 0:r.id)(t),frequency:oe(e.product)(t)}},"mapStateToProps"),Pa=g(Np)(co);function Cn(t){Ea(),hs(t);try{customElements.define("og-when",Ys),customElements.define("og-text",oa),customElements.define("og-incentive-text",aa),customElements.define("og-offer",ma),customElements.define("og-select-frequency",ca),customElements.define("og-optout-button",Qs),customElements.define("og-optin-toggle",ra),customElements.define("og-optin-status",Ks),customElements.define("og-optin-button",Js),customElements.define("og-optin-select",Xs),customElements.define("og-upsell-button",ea),customElements.define("og-frequency-status",Zs),customElements.define("og-modal",Vt),customElements.define("og-select",jt),customElements.define("og-tooltip",Gt),customElements.define("og-upsell-modal",ta),customElements.define("og-next-upcoming-order",pa),customElements.define("og-price",Pa),customElements.define("og-prepaid-toggle",ga),customElements.define("og-prepaid-data",ya),customElements.define("og-prepaid-button",ba),customElements.define("og-prepaid-select",Sa),customElements.define("og-subscription-button",_a)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Ii(o)),this},setMerchantId(o){return t.dispatch(Ci(o)),this},setAuthUrl(o){return t.dispatch(Ri(o)),this},receiveMerchantSettings(o){return t.dispatch(Vi(o)),this},getProductsForPurchasePost(o=[]){return Lo(t.getState(),o)},getOptins(o=[]){return Lo(t.getState(),o)},clear(){t.dispatch(Fi())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(Di(o)),this},setLocale(o){return t.dispatch(qi(o)),this},addTemplate(o,i,s){return t.dispatch(Ui(o,i,s)),this},setTemplates(o){return t.dispatch(Li(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let l=a.getState(),{sessionId:p}=l;p&&c.forEach(u=>a.dispatch(ko(u))),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:$,payload:s.product_discounts})}},initialize(o,i,s,a={}){var l;e&&console.warn("og.offers has been initialized already. Skipping.");let c=t.getState();return o&&o!==c.merchantId&&r.setMerchantId(o),i&&i!==((l=c.environment)==null?void 0:l.name)&&r.setEnvironment(i),r.receiveMerchantSettings(a),s&&r.setAuthUrl(s),e||r.resolveSettings(o,i,window.og_settings,t),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),Uo(window.opener,r),r}n(Cn,"makeApi");var lo=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),po=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),kp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Fp=n((t,e)=>de(t.compare_at_price,e),"getAllocationRegularPrice"),qp=n((t,e)=>{var r;if(lo(t)){let o=po((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return de(i,e)}return de(t.price,e)},"getAllocationSubscriptionPrice"),Oa=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Dp=n((t,e)=>{var o,i,s;if(lo(t)){let a=po((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,l=Oa(t,c);return Or(l)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=Or(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=de(t.price_adjustments[0].value,e):t.compare_at_price&&(r=de(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),Up=n(t=>{var e;return lo(t)?po((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),Lp=n((t,e,r,o)=>{var u,d;let i=po((u=t.selling_plan)==null?void 0:u.options),s=t.price/i,a=t.compare_at_price-s,c=Oa(t,s),l=(d=r==null?void 0:r.price_adjustments)==null?void 0:d[0],p=l&&l.value_type==="percentage"?l.value:null;return e.regularPrepaidPrice=de(t.price,o),e.prepaidSavingsPerShipment=de(Math.round(a),o),e.prepaidSavingsTotal=de(Math.round(a*i),o),p&&c&&(e.prepaidExtraSavingsPercentage=Or(c-p)),e},"addPrepaidPriceAndSavings"),Mp=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:kp(t),regularPrice:Fp(t,r),subscriptionPrice:qp(t,r),discountRate:Dp(t,r),prepaidShipments:Up(t)};if(lo(t)){let i=as(e);return Lp(t,o,i,r)}return o},"mapSellingPlanToDiscount"),Rn=n((t,e,r=[],o)=>[...t,Mp(e,r,o)],"sellingPlanAllocationsReducer"),va=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group:r}))],[]),"getSellingPlans");var $p=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[],productFrequencies:{}},e)=>{var r,o;if($===e.type){let i=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:i}}if(q===e.type){let{payload:{product:i,currency:s}}=e,a={},c=wa(i.selling_plan_groups,t);(r=c==null?void 0:c.frequencies)!=null&&r.length&&(a={...c,hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||vr(rt(i.selling_plan_groups))});let l=(o=i.variants)==null?void 0:o.reduce((u,d)=>Vp(u,d,i.selling_plan_groups,t),{});a={...a,productFrequencies:{...t.productFrequencies,...l}};let p=i==null?void 0:i.selling_plan_groups.filter(u=>/^Prepaid-.*/.test(u.name));return p.length&&(a={...a,prepaidSellingPlans:{...t.prepaidSellingPlans,...jp(p)}}),{...t,...a,storeCurrency:s}}if(w===e.type){let{payload:{offer:i}}=e,{defaultFrequency:s,product:a}=i||{},{frequencies:c,frequenciesEveryPeriod:l,prepaidSellingPlans:p={}}=t,u=S(a==null?void 0:a.id),d=t.productFrequencies[u];return{...t,defaultFrequency:Ta(u,s,p,c,l),productFrequencies:{...t.productFrequencies,[u]:{...d,defaultFrequency:Ta(u,s,p,d==null?void 0:d.frequencies,d==null?void 0:d.frequenciesEveryPeriod)}}}}return pe===e.type?{...t,merchantSettings:{...e.payload}}:t},"config");function wa(t,e){var i,s;let r=rt(t),o=wr(r);if(o!=null&&o.length){let a=Cr(r),c=((s=(i=r.options)==null?void 0:i[0])==null?void 0:s.values)||o,l=e==null?void 0:e.defaultFrequency;return l&&Ae(l)&&(l=Q(o,a,l)||ue(o)||l),{frequencies:o,frequenciesEveryPeriod:a,frequenciesText:c,...l?{defaultFrequency:l}:{}}}return null}n(wa,"getFrequencies");function Vp(t,e,r,o){let i=e.selling_plan_allocations.map(c=>c.selling_plan_group_id),s=r.filter(c=>i.includes(c.id)),a=wa(s,o.productFrequencies[e.id]);return a&&(t[e.id]=a),t}n(Vp,"reduceSellingPlansToFrequencies");function Ta(t,e,r,o=[],i=[]){var s;return(s=r[t])!=null&&s.some(({sellingPlan:a})=>a===e)?ue(o)||e:Ae(e)&&(Q(o,i,e)||ue(o))||e}n(Ta,"getUpdatedDefaultFrequency");function jp(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:Rr(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(jp,"getPrepaidSellingPlans");var Ca=$p;var Aa=n((t,e,r)=>{let o=Object.keys(t).filter(i=>i.startsWith(e.toString()));return o.length?{...t,...o.reduce((i,s)=>({...i,[s]:r}),{})}:t},"overrideLineKey"),Ra=n((t,e,r)=>{if(!r)return null;if(!Ae(r))return r;if(yr(t,e)){let o=Q(t,e,r);return o||ue(t)}return r},"getDefaultSellingPlan"),Gp=n((t,e,r)=>t.map(o=>Ae(o==null?void 0:o.frequency)?{...o,frequency:yr(r==null?void 0:r.frequencies,r==null?void 0:r.frequenciesEveryPeriod)?Q(r==null?void 0:r.frequencies,r==null?void 0:r.frequenciesEveryPeriod,o.frequency)||Q(r==null?void 0:r.frequencies,r==null?void 0:r.frequenciesEveryPeriod,e==null?void 0:e.defaultFrequency)||ue(r==null?void 0:r.frequencies):o.frequency}:o),"mapExistingOptinsFromOfferResponse"),Hp=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s,a)=>Object.keys(t).reduce((c,l)=>{if(!i.some(p=>p.id===l)){if(!(t[l]&&e[l]&&o[l]))return c;let{frequencies:p,frequenciesEveryPeriod:u}=a,{defaultFrequency:d}=s||{},h=r[l],_;return r[l]&&yr(p,u)?_=Q(p,u,`${h.every}_${h.every_period}`)||Ra(p,u,d)||ue(p):r[l]?_=`${h.every}_${h.every_period}`:_=Ra(p,u,d)||"_",c.concat({id:l,frequency:_})}return c},[]),"reduceNewOptinsFromOfferResponse"),Bp=n((t,e)=>({...Aa(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ia=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Na=n((t,e)=>{let r=S(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),zp=n((t={},e)=>{var r;if($===e.type)return Object.entries(e.payload).reduce(Ia,t);if(ge===e.type){let{payload:o}=e;return o.items.reduce(Na,t)}if(q===e.type){let{payload:{product:o}}=e,i=is(o==null?void 0:o.selling_plan_groups),s=new Set((r=i.flatMap(a=>a.selling_plans.map(c=>c.id)))!=null?r:[]);return[o,...(o==null?void 0:o.variants)||[]].reduce((a,c)=>{var u,d;let p=((d=(u=c==null?void 0:c.selling_plan_allocations)==null?void 0:u.filter(h=>s.has(h.selling_plan_id)))!=null?d:[]).length>0;return{...Aa(a,c.id,p),[c.id]:p}},t)}return he===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible"),Yp=n((t={},e)=>{var r;if($===e.type)return Object.entries(e.payload).reduce(Ia,t);if(ge===e.type)return e.payload.items.reduce(Na,t);if(q===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(Bp,t)||t}return F===e.type&&e.payload.product===null?{...t}:he===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),Wp=n((t={},e)=>t,"offer");function Kp(t){let e=Rr(t.selling_plan_allocation.selling_plan),r={id:t.key,frequency:`${t.selling_plan_allocation.selling_plan.id}`};return e&&(r.prepaidShipments=e),r}n(Kp,"getOptedInItem");var Jp=n((t=[],e)=>{if(ge===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,Kp(i)]:o,[]))}if(w===e.type){let r=e.payload,{offer:o={},frequencyConfig:i}=r,s=Gp(t,o,i),a=Hp(r,s,o,i);return[...s,...a]}if(q===e.type){let{product:r}=e.payload,o=rt(r==null?void 0:r.selling_plan_groups);if(!o)return t;let i=wr(o),s=Cr(o);return t.map(a=>Ae(a.frequency)?{...a,frequency:Q(i,s,a.frequency)||ue(i)}:a)}if(le===e.type){let{payload:r}=e,o=so(t,e),[i,s]=et(o,r.product);return s.concat({...i,...r.product,frequency:r.frequency})}return so(t,e)},"optedin"),Qp=n((t={},e)=>t,"productOffer"),Zp=n((t={},e)=>{var r;if(q===e.type){let{payload:{product:o,currency:i}}=e,s=va(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var l;return{...a,[c.id]:(l=c.selling_plan_allocations)==null?void 0:l.reduce((p,u)=>Rn(p,u,s,i),[])}},t)||t}if(ge===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:Rn([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return $===e.type?ot(e.payload):t},"productPlans"),Xp=Bt({auth:fn,authUrl:mn,autoshipByDefault:On,autoshipEligible:zp,config:Ca,defaultFrequencies:vn,eligibilityGroups:un,environment:_n,firstOrderPlaceDate:bn,incentives:dn,inStock:Yp,locale:En,merchantId:hn,nextUpcomingOrder:pn,offer:Wp,offerId:gn,experiments:Ar,optedin:Jp,optedout:ln,previewStandardOffer:xn,previewUpsellOffer:Pn,productOffer:Qp,productPlans:Zp,productToSubscribe:Sn,sessionId:yn,templates:Tn,prepaidShipmentsSelected:wn});function An(t,e){return window.og&&window.og.previewMode?ao(t,e):Xp(t,e)}n(An,"shopifyReducer");var Da=ce(Pt()),Ua=ce(Yt());function ka(t,e,r){let o=`[name="id"][value="${t}"]`,i=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let s=document.querySelectorAll(o);s.length||(s=document.querySelectorAll(i)),[...s].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(ka,"updateTrackingInputs");function In(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(In,"getTrackingKey");function eu(t,e){var u,d,h,_;if(!((u=t.payload.offer)==null?void 0:u.autoshipByDefault))return;let o=(d=t.payload.offer)==null?void 0:d.product.id,i=In(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((_=t.payload.offer)==null?void 0:_.variationId)||"",c=uo(o,e),p=[o,R.toLowerCase(),s,c,a].join(",");ka(o,i,p)}n(eu,"addDefaultToSubTracking");function Nn(t){return e=>r=>{switch(e(r),r.type){case R:case N:case k:{let o=r.payload.offer,i=kn(r);o&&!o.isCart&&ka(o.product.id,i[0],i[1]);break}case w:eu(r,t);break;default:}}}n(Nn,"shopifyTrackingMiddleware");var Fa,qa,Fn=((qa=(Fa=window.Shopify)==null?void 0:Fa.routes)==null?void 0:qa.root)||"/",tu="/cart",ru=`${Fn}cart.js`,ou=`${Fn}cart/change.js`,nu=`${Fn}products/`,iu='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',su=n(t=>(0,Ua.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function au(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await qn()).currency}n(au,"getCurrency");async function cu(t,e){let r=lu(e);if(r)try{let[i,s]=await Promise.all([La(r),au()]),a={product:i,offer:e,currency:s};t.dispatch({type:q,payload:a})}catch(i){console.warn("OG: Unable to fetch product details for PDP",i)}let o=e.closest("form");if(!o){let i=e.parentElement;for(;i&&(o=i.querySelector('form[action$="/cart/add"]'),!(o||i.tagName.toLowerCase()==="body"));)i=i.parentElement}if(o){let i=su(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(cu,"setupPdp");async function qn(){return(await fetch(ru)).json()}n(qn,"getCart");function lu(t){return[()=>t==null?void 0:t.dataset.shopifyProductHandle,()=>{var e,r;return(((r=(e=document.querySelector('[href$=".oembed"]'))==null?void 0:e.getAttribute("href"))==null?void 0:r.match(/\/([^/]+)\.oembed$/))||[])[1]},()=>{var e,r;return(document.querySelector('meta[property="og:type"][content="product"]')&&((r=(e=document.querySelector('meta[property="og:url"][content]'))==null?void 0:e.getAttribute("content"))==null?void 0:r.match(/\/([^/]+)$/))||[])[1]},()=>{var e;return(e=[...document.querySelectorAll("[type$=json]")].map(r=>JSON.parse(r.textContent||"{}")).find(r=>r.handle&&r.price))==null?void 0:e.handle}].reduce((e,r)=>e||r(),"")}n(lu,"guessProductHandle");var La=(0,Da.default)(async function(t){return(await fetch(`${nu}${t}.js`)).json()});async function pu(t,e){let r=await qn(),{items:o}=r,i=r;t.dispatch({type:ge,payload:i});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:c})=>c))).map(La))).forEach(c=>{let l={product:c,offer:e,currency:r.currency};t.dispatch({type:q,payload:l})})}n(pu,"setupCart");async function uu(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||uo(t.payload.product.id,e),i=kn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(iu)),l=t.payload.product.id,p=await qn(),u=(s=p==null?void 0:p.items)==null?void 0:s.findIndex(C=>C.key===l),d=p.items[u],h=d.quantity,_=S(l),P=await fetch(ou,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,attributes:Object.fromEntries([i]),properties:d.properties,selling_plan:o||null,sections:c.map(C=>C.id.replace(/^shopify-section-/,""))})});if(P.status!==200)throw new Error("Cart not updated");let m=await P.json(),E=p.items.length===m.items.length?m.items[u].key:(a=m.items.find(C=>C.quantity===h&&C.product_id===_&&(!o&&!C.selling_plan_allocation||(C==null?void 0:C.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;E&&(e.dispatch({type:_t,payload:{oldCartProductKey:l,newCartProductKey:E}}),r.setAttribute("product",E));let T=m;e.dispatch({type:ge,payload:T});let y=new CustomEvent(si,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(y),y.defaultPrevented)return;let v=m.sections;Object.values(v).length?c.forEach(C=>{let Un=C.id.replace(/^shopify-section-/,"");if(!(Un in v))return;let Ha=v[Un],Ln=new DOMParser().parseFromString(Ha.toString()||"","text/html").getElementById(C.id);Ln&&(C.innerHTML=Ln.innerHTML)}):window.location.pathname.startsWith(tu)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(uu,"synchronizeCartOptin");function kn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=In(),o=((a=t.payload.offer)==null?void 0:a.location)||"",i=((c=t.payload.offer)==null?void 0:c.variationId)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case F:case N:s.push(""),s.push(i);break;case R:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(kn,"getTrackingEvent");function uo(t,e){var i;return(i=hr({id:t})(e.getState()))==null?void 0:i.frequency}n(uo,"getSubscribedFrequency");function du(t,e){e!=null&&e.isCart||!(e!=null&&e.shouldEnableOffer)||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=uo(o,t);Ro(r.form,"selling_plan",i),Ro(r.form,"attributes[og__session]",t.getState().sessionId)})}n(du,"synchronizeSellingPlan");function Dn(t){return e=>r=>{var o;switch(r.type){case R:case N:case k:break;case F:(o=r.payload.offer)!=null&&o.isCart?pu(t,r.payload.offer):cu(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case N:case k:case le:uu(r,t);case F:case w:case q:du(t,r.payload.offer);break;default:}}}n(Dn,"shopifyMiddleware");var fu="/apps/subscriptions/auth/",Ma="og_auth_begin",hu="og_auth_end",mu=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function $a({store:t}){var i;let[e]=Co(),r=Ct(),o=r!=null&&r.dataset.customer?mu(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await yu(o);if(s){let[a,c,l]=s.split("|");t.dispatch(It(e,a,Number(c),l))}}else vi("og_auth")}n($a,"authorizeShopifyCustomer");async function gu(t){try{let r=await(await fetch(`${fu}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Ma);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Ma.length,r.lastIndexOf(hu)))}catch(e){console.error(e)}}n(gu,"fetchOGSignature");async function yu(t){let e=Ti("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await gu(t);if(!r)return"";let s=new Date,a=btoa(i);s.setTime(s.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${s.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(yu,"getOrCreateAuthCookie");var Va,Ga=ps(...(Va=D)!=null&&Va.shopify_selling_plans?[An,Dn]:[ao],D.shopify&&Nn),O=Cn(Ga),bu=O.isReady,Su=O.addOptinChangedCallback,_u=O.addTemplate,Eu=O.clear,xu=O.config,Pu=O.disableOptinChangedCallbacks,Ou=O.getOptins,vu=O.getProductsForPurchasePost,Tu=O.initialize,wu=O.previewMode,Cu=O.register,Ru=O.resolveSettings,Au=O.setAuthUrl,Iu=O.setEnvironment,Nu=O.setLocale,ku=O.setMerchantId,Fu=O.setPublicPath,qu=O.setTemplates,Du=O.setupCart,Uu=O.setupProduct,Lu=O.setupProducts,Mu=n(()=>Oi(O),"autoInit");var $u=O.initialize,ja;(ja=D)!=null&&ja.shopify_selling_plans&&gr(()=>$a(O));return Ja(Vu);})();
1038
1038
  ; return lib; });
1039
1039
  //# sourceMappingURL=offers.js.map