@ordergroove/offers 2.48.6 → 2.48.7-alpha-PR-1482-2.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.
package/dist/offers.js CHANGED
@@ -6,10 +6,10 @@ else {
6
6
  window.og['offers'] = factory();
7
7
  }
8
8
  })(()=>{
9
- var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.getOwnPropertyDescriptor;var ac=Object.getOwnPropertyNames;var cc=Object.getPrototypeOf,lc=Object.prototype.hasOwnProperty;var n=(t,e)=>bt(t,"name",{value:e,configurable:!0});var ee=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Kn=(t,e)=>{for(var r in e)bt(t,r,{get:e[r],enumerable:!0})},Qn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ac(e))!lc.call(t,i)&&i!==r&&bt(t,i,{get:()=>e[i],enumerable:!(o=sc(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?ic(cc(t)):{},Qn(e||!t||!t.__esModule?bt(r,"default",{value:t,enumerable:!0}):r,t)),pc=t=>Qn(bt({},"__esModule",{value:!0}),t);var Zt=ee((Qt,ii)=>{(function(t,e){typeof Qt=="object"&&typeof ii<"u"?e(Qt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Qt,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 f(){u(),l=!0}n(f,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var w=arguments.length,x=new Array(w),g=0;g<w;g++)x[g]=arguments[g];var P=this,_=Date.now()-p;if(l)return;function y(){p=Date.now(),s.apply(P,x)}n(y,"exec");function v(){c=void 0}n(v,"clear"),a&&!c&&y(),u(),a===void 0&&_>o?y():i!==!0&&(c=setTimeout(a?v:y,a===void 0?o-_:o))}return n(h,"wrapper"),h.cancel=f,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 Ot=ee((yd,vi)=>{var Ec="Expected a function",Si="__lodash_hash_undefined__",xc="[object Function]",Pc="[object GeneratorFunction]",Oc=/[\\^$.*+?()[\]{}|]/g,vc=/^\[object .+?Constructor\]$/,Tc=typeof window=="object"&&window&&window.Object===Object&&window,wc=typeof self=="object"&&self&&self.Object===Object&&self,_i=Tc||wc||Function("return this")();function Cc(t,e){return t?.[e]}n(Cc,"getValue");function Rc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Rc,"isHostObject");var Ac=Array.prototype,Ic=Function.prototype,Ei=Object.prototype,Co=_i["__core-js_shared__"],bi=function(){var t=/[^.]+$/.exec(Co&&Co.keys&&Co.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),xi=Ic.toString,Ro=Ei.hasOwnProperty,Nc=Ei.toString,kc=RegExp("^"+xi.call(Ro).replace(Oc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fc=Ac.splice,Dc=Pi(_i,"Map"),Pt=Pi(Object,"create");function Ae(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(Ae,"Hash");function qc(){this.__data__=Pt?Pt(null):{}}n(qc,"hashClear");function Uc(t){return this.has(t)&&delete this.__data__[t]}n(Uc,"hashDelete");function Lc(t){var e=this.__data__;if(Pt){var r=e[t];return r===Si?void 0:r}return Ro.call(e,t)?e[t]:void 0}n(Lc,"hashGet");function Mc(t){var e=this.__data__;return Pt?e[t]!==void 0:Ro.call(e,t)}n(Mc,"hashHas");function $c(t,e){var r=this.__data__;return r[t]=Pt&&e===void 0?Si:e,this}n($c,"hashSet");Ae.prototype.clear=qc;Ae.prototype.delete=Uc;Ae.prototype.get=Lc;Ae.prototype.has=Mc;Ae.prototype.set=$c;function Ze(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(Ze,"ListCache");function Vc(){this.__data__=[]}n(Vc,"listCacheClear");function jc(t){var e=this.__data__,r=gr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Fc.call(e,r,1),!0}n(jc,"listCacheDelete");function Gc(t){var e=this.__data__,r=gr(e,t);return r<0?void 0:e[r][1]}n(Gc,"listCacheGet");function Hc(t){return gr(this.__data__,t)>-1}n(Hc,"listCacheHas");function Bc(t,e){var r=this.__data__,o=gr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Bc,"listCacheSet");Ze.prototype.clear=Vc;Ze.prototype.delete=jc;Ze.prototype.get=Gc;Ze.prototype.has=Hc;Ze.prototype.set=Bc;function Ie(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(Ie,"MapCache");function zc(){this.__data__={hash:new Ae,map:new(Dc||Ze),string:new Ae}}n(zc,"mapCacheClear");function Yc(t){return yr(this,t).delete(t)}n(Yc,"mapCacheDelete");function Wc(t){return yr(this,t).get(t)}n(Wc,"mapCacheGet");function Jc(t){return yr(this,t).has(t)}n(Jc,"mapCacheHas");function Kc(t,e){return yr(this,t).set(t,e),this}n(Kc,"mapCacheSet");Ie.prototype.clear=zc;Ie.prototype.delete=Yc;Ie.prototype.get=Wc;Ie.prototype.has=Jc;Ie.prototype.set=Kc;function gr(t,e){for(var r=t.length;r--;)if(tl(t[r][0],e))return r;return-1}n(gr,"assocIndexOf");function Qc(t){if(!Oi(t)||Xc(t))return!1;var e=rl(t)||Rc(t)?kc:vc;return e.test(el(t))}n(Qc,"baseIsNative");function yr(t,e){var r=t.__data__;return Zc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(yr,"getMapData");function Pi(t,e){var r=Cc(t,e);return Qc(r)?r:void 0}n(Pi,"getNative");function Zc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Zc,"isKeyable");function Xc(t){return!!bi&&bi in t}n(Xc,"isMasked");function el(t){if(t!=null){try{return xi.call(t)}catch{}try{return t+""}catch{}}return""}n(el,"toSource");function Ao(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ec);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(Ao.Cache||Ie),r}n(Ao,"memoize");Ao.Cache=Ie;function tl(t,e){return t===e||t!==t&&e!==e}n(tl,"eq");function rl(t){var e=Oi(t)?Nc.call(t):"";return e==xc||e==Pc}n(rl,"isFunction");function Oi(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Oi,"isObject");vi.exports=Ao});var bs=ee((Zd,Go)=>{function kl(t,e){var r,o,i,s,a,c,l,p,u,f;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,l=461845907,f=0;f<o;)u=t.charCodeAt(f)&255|(t.charCodeAt(++f)&255)<<8|(t.charCodeAt(++f)&255)<<16|(t.charCodeAt(++f)&255)<<24,++f,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(f+2)&255)<<16;case 2:u^=(t.charCodeAt(f+1)&255)<<8;case 1:u^=t.charCodeAt(f)&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(kl,"murmurhash3_32_gc");typeof Go<"u"&&(Go.exports=kl)});var Ss=ee((Xd,Ho)=>{function Fl(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(Fl,"murmurhash2_32_gc");typeof Ho!==void 0&&(Ho.exports=Fl)});var Es=ee((ef,Fr)=>{var _s=bs(),Dl=Ss();Fr.exports=_s;Fr.exports.murmur3=_s;Fr.exports.murmur2=Dl});var Br=ee((vh,Hs)=>{var ep={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"};Hs.exports=ep});var zs=ee((Th,Bs)=>{var Ue=Br(),tp=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ue.PAR_OPEN:case Ue.PAR_CLOSE:case Ue.OP_NOT:case Ue.BINARY_AND:case Ue.BINARY_OR:e&&(r.push({type:Ue.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ue.LITERAL,value:e}),r},"Tokenizer");Bs.exports=tp});var Ws=ee((wh,Ys)=>{var Pe=Br(),rp=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Pe.LITERAL:e.unshift(i);break;case Pe.BINARY_AND:case Pe.BINARY_OR:case Pe.OP_NOT:case Pe.PAR_OPEN:r.push(i);break;case Pe.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Pe.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Pe.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),op=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Ys.exports={PolishNotation:rp,PolishGenerator:op}});var Ks=ee((Ch,Js)=>{var V=Br(),z=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===V.LEAF}isAtomic(){return this.isLeaf()||this.op===V.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new z(V.BINARY_AND,e,r)}static CreateNot(e){return new z(V.OP_NOT,e)}static CreateOr(e,r){return new z(V.BINARY_OR,e,r)}static CreateLiteral(e){return new z(V.LEAF,null,null,e)}};n(z,"ExpNode");var dt=n(t=>{let e=t.next().value;switch(e.type){case V.LITERAL:return z.CreateLiteral(e.value);case V.OP_NOT:return z.CreateNot(dt(t));case V.BINARY_AND:{let r=dt(t),o=dt(t);return z.CreateAnd(r,o)}case V.BINARY_OR:{let r=dt(t),o=dt(t);return z.CreateOr(r,o)}}return null},"make"),ft=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===V.OP_NOT)return!ft(t.left,e);if(t.op===V.BINARY_OR)return ft(t.left,e)||ft(t.right,e);if(t.op===V.BINARY_AND)return ft(t.left,e)&&ft(t.right,e)},"nodeEvaluator");Js.exports={make:dt,nodeEvaluator:ft}});var ea=ee((Rh,Xs)=>{var np=zs(),Qs=Ws(),Zs=Ks(),ip=n((t,e)=>{let r=np(t),o=Qs.PolishNotation(r),i=Qs.PolishGenerator(o),s=Zs.make(i);return Zs.nodeEvaluator(s,e)},"parse");Xs.exports={parse:ip}});var cd={};Kn(cd,{addOptinChangedCallback:()=>$u,addTemplate:()=>Vu,autoInit:()=>sd,clear:()=>ju,config:()=>Gu,default:()=>ad,disableOptinChangedCallbacks:()=>Hu,getOptins:()=>Bu,getProductsForPurchasePost:()=>zu,initialize:()=>Yu,isReady:()=>Mu,offers:()=>O,platform:()=>R,previewMode:()=>Wu,register:()=>Ju,resolveSettings:()=>Ku,setAuthUrl:()=>Qu,setEnvironment:()=>Zu,setLocale:()=>Xu,setMerchantId:()=>ed,setPublicPath:()=>td,setTemplates:()=>rd,setupCart:()=>od,setupProduct:()=>nd,setupProducts:()=>id,store:()=>oc});function Eo(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(Eo,"symbolObservablePonyfill");var $e;typeof self<"u"?$e=self:typeof window<"u"||typeof window<"u"?$e=window:typeof module<"u"?$e=module:$e=Function("return this")();var uc=Eo($e),xo=uc;var Po=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),St={INIT:"@@redux/INIT"+Po(),REPLACE:"@@redux/REPLACE"+Po(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Po()},"PROBE_UNKNOWN_ACTION")};function dc(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(dc,"isPlainObject");function Oo(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(Oo)(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 f(g){if(typeof g!="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 P=!0;return p(),c.push(g),n(function(){if(!!P){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.");P=!1,p();var y=c.indexOf(g);c.splice(y,1),a=null}},"unsubscribe")}n(f,"subscribe");function h(g){if(!dc(g))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof g.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,g)}finally{l=!1}for(var P=a=c,_=0;_<P.length;_++){var y=P[_];y()}return g}n(h,"dispatch");function w(g){if(typeof g!="function")throw new Error("Expected the nextReducer to be a function.");i=g,h({type:St.REPLACE})}n(w,"replaceReducer");function x(){var g,P=f;return g={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 Jt=P(v);return{unsubscribe:Jt}},"subscribe")},g[xo]=function(){return this},g}return n(x,"observable"),h({type:St.INIT}),o={dispatch:h,subscribe:f,getState:u,replaceReducer:w},o[xo]=x,o}n(Oo,"createStore");function fc(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(fc,"getUndefinedStateErrorMessage");function hc(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:St.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:St.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+St.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(hc,"assertReducerShape");function Kt(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{hc(r)}catch(l){c=l}return n(function(p,u){if(p===void 0&&(p={}),c)throw c;if(!1)var f;for(var h=!1,w={},x=0;x<s.length;x++){var g=s[x],P=r[g],_=p[g],y=P(_,u);if(typeof y>"u"){var v=fc(g,u);throw new Error(v)}w[g]=y,h=h||y!==_}return h=h||s.length!==Object.keys(p).length,h?w:p},"combination")}n(Kt,"combineReducers");function Zn(t,e){return function(){return e(t.apply(this,arguments))}}n(Zn,"bindActionCreator");function ei(t,e){if(typeof t=="function")return Zn(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]=Zn(i,e))}return r}n(ei,"bindActionCreators");function mc(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(mc,"_defineProperty");function Xn(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(Xn,"ownKeys");function gc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Xn(r,!0).forEach(function(o){mc(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Xn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(gc,"_objectSpread2");function vo(){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(vo,"compose");function ti(){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=vo.apply(void 0,c)(i.dispatch),gc({},i,{dispatch:s})}}}n(ti,"applyMiddleware");function ri(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(ri,"createThunkMiddleware");var oi=ri();oi.withExtraArgument=ri;var ni=oi;var ss=ce(Zt());var si=/^og_auth=/,yc=n((t=si)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(si,""),"c"),Xt=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"),bc=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"),Sc=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function ai(){return typeof window.og_auth<"u"?Xt(window.og_auth):null}n(ai,"a");async function _c(t=100){return new Promise(e=>{setTimeout(()=>e(ai()),t)})}n(_c,"f");async function ci(t,e=yc,r=bc){let o;if(o=Xt(ai())||Xt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Sc(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await _c());if(o=Xt(o),o)return o;throw new Error("Unauthorized")}n(ci,"u");var C="OPTIN_PRODUCT",F="OPTOUT_PRODUCT",D="PRODUCT_CHANGE_FREQUENCY",le="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ve="SET_MERCHANT_ID",L="REQUEST_OFFER",T="RECEIVE_OFFER",_t="PRODUCT_HAS_CHANGED",je="CREATED_SESSION_ID",er="SET_AUTH_URL",li="REQUEST_AUTH",tr="AUTHORIZE",Te="UNAUTHORIZED",pi="REQUEST_ORDERS",rr="RECEIVE_ORDERS",Et="CART_PRODUCT_KEY_HAS_CHANGED",or="RECEIVE_ORDER_ITEMS",ui="FETCH_RESPONSE_ERROR",Ge="SET_ENVIRONMENT_LOCAL",He="SET_ENVIRONMENT_STAGING",Be="SET_ENVIRONMENT_DEV",ze="SET_ENVIRONMENT_PROD",nr="READY",di="CONCLUDE_UPSELL",fi="REQUEST_CREATE_IU_ORDER",ir="CREATE_ONE_TIME",hi="REQUEST_CONVERT_ONE_TIME",sr="CONVERT_ONE_TIME";var Ye="CHECKOUT",mi="RECEIVE_FETCH",ar="SET_LOCALE",We="SET_CONFIG",fe="SET_PREVIEW_STANDARD_OFFER",xt="SET_PREVIEW_UPSELL_OFFER",To="SET_PREVIEW_PREPAID_OFFER",cr="ADD_TEMPLATE",lr="SET_TEMPLATES",we="LOCAL_STORAGE_CHANGE",he="LOCAL_STORAGE_CLEAR",pr="SET_FIRST_ORDER_PLACE_DATE",ur="SET_PRODUCT_TO_SUBSCRIBE",Je="RECEIVE_PRODUCT_PLANS",q="SETUP_PRODUCT",me="SETUP_CART",pe="RECEIVE_MERCHANT_SETTINGS",wo="SET_EXPERIMENT_VARIANT",Ke="pdp",gi="local",dr="dev",Ce="staging",Re="prod",fr="static.ordergroove.com",hr="staging.static.ordergroove.com",ge={PSI:"PSI",PROGRAM_WIDE:"PROGRAM_WIDE"},mr={PREPAID:"prepaid"},yi="og-cart-updated";var br=ce(Ot());var Io=n((...t)=>JSON.stringify(t),"memoizeKey"),vt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Tt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),Sr=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"),Ti=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"),wi=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),ol=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),nl=(0,br.default)(vt(Tt((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",ol(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(i)];return[`/offer/${t}/${o}?${wi(s)}`]})),Io),il=(0,br.default)(vt(Tt(Sr((t=1,e="place")=>[`/orders/?${wi([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Io),sl=(0,br.default)(vt(Tt(Sr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Io),al=vt(Tt(Sr(Ti((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}}]})))),wt=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"),No=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),cl=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Ci=n(t=>[...new Set(t&&t.split(/\s+/))].filter(No).sort(cl),"parseFrequenciesList");var Ct=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"),ll=vt(Tt(Sr(Ti((t,e,r,o)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let i=wt(e);if(!i)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,session_id:o,...i}}]})))),Xe={fetchOffer:nl,fetchOrders:il,fetchItems:sl,createOneTime:al,convertOneTimeToSubscription:ll},Ri=Xe;var ko=Rt(),R={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(ko==null?void 0:ko.dataset.shopifySellingPlans)!="undefined"};function pl(t,e){return t===e}n(pl,"defaultEqualityCheck");function ul(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(ul,"areArgumentsShallowlyEqual");function dl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pl,r=null,o=null;return function(){return ul(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(dl,"defaultMemoize");function fl(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(fl,"getDependencies");function hl(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=fl(s),u=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),f=t(function(){for(var h=[],w=p.length,x=0;x<w;x++)h.push(p[x].apply(null,arguments));return u.apply(null,h)});return f.resultFunc=l,f.dependencies=p,f.recomputations=function(){return c},f.resetRecomputations=function(){return c=0},f}}n(hl,"createSelectorCreator");var A=hl(dl);var U=ce(Ot());var M=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),et=n(t=>`${t}%`,"percentage"),ml="Subscribe and Save",gl="ordergroove-subscribe-and-save-",At=n((t=[])=>t.find(Ni)||t.find(Ii)||t.find(_r),"getPayAsYouGoSellingPlanGroup"),Ai=n((t=[])=>t.filter(e=>Ii(e)||Ni(e)||_r(e)),"getPayAsYouGoSellingPlanGroups"),Ii=n(t=>t.name===ml||t.app_id==="ordergroove-subscribe-and-save","isDefaultSellingPlanGroup"),Ni=n(t=>t.name.startsWith("og_psfl")||t.app_id==="ordergroove-product-specific-frequency-list","isProductSpecificFrequencySellingPlanGroup"),_r=n(t=>{var e;return(e=t.app_id)==null?void 0:e.startsWith(gl)},"isExperimentSellingPlanGroup"),ki=n(t=>{let e=At(t.map(r=>r.group));return t.find(r=>r.group===e)},"getPayAsYouGoSellingPlan");function Er(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Er,"sellingPlansToFrequencies");function xr(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>yl(r))}n(xr,"sellingPlansToEveryPeriod");function yl(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(yl,"textToFreq");function Pr(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(Pr,"getPrepaidShipments");function It(t){return t[1]||t[0]}n(It,"getDefaultPrepaidOption");U.default.Cache=Map;function bl(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(bl,"arraysEqual");function Sl(t,e,r){let o=Ct(r);return R.shopify_selling_plans?Q(t,e,o):o}n(Sl,"resolveFrequency");var I=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))||bl((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Nt=n(t=>t.optedin||[],"optedinSelector"),Fi=n(t=>t.optedout||[],"optedoutSelector"),Fo=n(t=>t.autoshipByDefault||{},"autoshipSelector"),_l=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Do=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),El=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),te=(0,U.default)(t=>A(Nt,Fi,Fo,(e,r,o)=>{let i=e.find(s=>I(t,s));return i||(r.find(s=>I(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Or=(0,U.default)(t=>A(Nt,e=>{let r=e.find(o=>I(t,o));return r||!1}),t=>JSON.stringify(t)),Di=(0,U.default)(t=>A(Nt,e=>e.some(r=>I(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),re=(0,U.default)(t=>A(El,e=>e[t.id]||null),t=>JSON.stringify(t)),vr=(0,U.default)(t=>A(Fi,e=>e.find(r=>I(t,r)))),oe=(0,U.default)(t=>A(te(t),e=>e&&"frequency"in e&&e.frequency||null),t=>JSON.stringify(t)),j=(0,U.default)(t=>A(te(t),e=>e&&"prepaidShipments"in e&&e.prepaidShipments||null),t=>JSON.stringify(t)),G=(0,U.default)(t=>A(Do,e=>{var o;return(((o=e[S(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),tt=(0,U.default)(t=>A(_l,K(t),(e,{frequencies:r=[],frequenciesEveryPeriod:o=[]})=>e[S(t)]&&Sl(r,o,e[S(t)])||null)),rt=(0,U.default)(t=>A(K(t),e=>e.frequencies)),ne=(0,U.default)(t=>A(K(t),e=>e.defaultFrequency)),K=(0,U.default)(t=>A(e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.productFrequencies},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.frequencies},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.frequenciesEveryPeriod},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.frequenciesText},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.defaultFrequency},(e,r,o,i,s)=>e?e[S(t)]||{}:{frequencies:r,frequenciesEveryPeriod:o,frequenciesText:i,defaultFrequency:s})),qi=n((t,e)=>A(Do,K(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"),Ui=n(t=>A(Do,e=>{let r=S(t);return e[r]||[]}),"makePrepaidSellingPlansSelector"),Li=(0,U.default)(t=>A(e=>e.price||{},e=>e.incentives||{},e=>e.config.storeCurrency,(e,r,o)=>{let i=e[S(t)];if(i==null||!o)return{};let s=i.value,a=s,c=s,l=r[S(t)],p=l==null?void 0:l.initial.find(Pl),u="";return p&&(p.type==="Discount Percent"?(c=Math.round(s*(100-p.value)/100),u=et(p.value)):p.type==="Discount Amount"&&o==="USD"&&(c=Math.max(0,s-Math.round(p.value*100)))),{regularPrice:M(a,o),subscriptionPrice:M(c,o),discountRate:u||M(a-c,o)}})),xl=[ge.PROGRAM_WIDE,ge.PSI];function Pl(t){return t.object==="item"&&(t.type==="Discount Percent"||t.type==="Discount Amount")&&t.criteria&&t.criteria.node_type==="PREMISE"&&xl.includes(t.criteria.standard)}n(Pl,"findRelevantIncentive");var qo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r)=>t&&t.hasAttribute&&t.hasAttribute(qo(e))&&t[e]||t.offer&&typeof(t.offer[e]!=="undefined")&&t.offer[e]||r,"getFallbackValue"),ot=n(t=>({templates:t.templates||[]}),"templatesSelector"),Mi=n(t=>{let e=Object.values(t.productPlans).flat();return e.length>0&&e.every(r=>r.hasPriceAdjustments===!1||r.prepaidShipments)},"isShopifyDiscountFunctionInUseSelector");function Tr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(Tr,"onReady");function Rt(){return document.querySelector([`script[src^="https://${fr}"]`,`script[src^="https://${hr}"]`,`script[src^="http://${fr}"]`,`script[src^="http://${hr}"]`].join(","))}n(Rt,"getMainJs");function Uo(){let t=Rt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Ce)?Ce:Re,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(Uo,"resolveEnvAndMerchant");var S=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=R)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),$i=n((t,e,r)=>{if(R.shopify_selling_plans){let o=e==null?void 0:e.indexOf(t);if(o>=0&&r[o])return r[o]}return t},"safeOgFrequency"),kt=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 Vi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Uo();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===Re?fr:hr}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(Vi,"autoInitializeOffers");var ji=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function Gi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(Gi,"getCookieValue");var Ne=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),ue=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),wr=n((t=[],e=[])=>{var r;return!!(((r=R)==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 Cr(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(Cr,"getOrCreateHidden");function nt(t,e){let[[r],o]=t.reduce((i,s)=>i[I(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(nt,"getMatchingProductIfExists");var Z=n((t,e,r)=>({type:C,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),it=n((t,e)=>({type:F,payload:{product:t,offer:e}}),"optoutProduct"),Hi=n((t,e)=>({type:_t,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Ar=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),be=n((t,e,r)=>(o,i)=>{let s=qi(t,e)(i());o({type:le,payload:{product:t,prepaidShipments:e,offer:r,frequency:s}})},"productChangePrepaidShipments");var Ir=n(t=>({type:di,payload:{product:t}}),"concludeUpsell"),Bi=n(t=>({type:Ve,payload:t}),"setMerchantId"),Lo=n(t=>({type:je,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Ol=n(t=>({type:li,payload:t}),"requestAuth"),Ft=n((t,e,r,o)=>({type:tr,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ye=n(t=>({type:Te,payload:t}),"unauthorized"),zi=n(t=>({type:er,payload:t}),"setAuthUrl"),Dt=n(t=>({type:mi,payload:t}),"fetchDone"),Yi=n((t=ci)=>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=Ol(s);return r(a),t(s).then(({sig_field:c,ts:l,sig:p})=>r(Ft(i,c,l,p)),c=>r(ye(c))).finally(()=>r(Dt(a)))},"fetchAuthThunk"),"fetchAuth"),vl=n((t,e)=>({type:pi,payload:{status:t,ordering:e}}),"requestOrders"),Mo=n(t=>({type:rr,payload:t}),"receiveOrders"),$o=n(t=>({type:or,payload:t}),"receiveItems"),Nr=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=vl(t,e);return o(c),Xe.fetchOrders(s,a,t,e).then(l=>{if(l.results){o(Mo(l));let p=(l.results[0]||{}).public_id;if(p)return Xe.fetchItems(s,a,p).then(u=>o($o(u)))}return o(ye(l.detail)),null},l=>o(ye(l))).finally(()=>o(Dt(c)))},"fetchOrdersThunk"),"fetchOrders"),Wi=n(t=>{switch(t){case gi:return{type:Ge,payload:t};case dr:return{type:Be,payload:t};case Ce:return{type:He,payload:t};case Re:return{type:ze,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Ji=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Lo(r)),o},"requestSessionId"),Se=n((t,e,r)=>(o,i)=>{let s=i(),a=K(r)(s),c=Ui(r)(s);o({type:T,payload:{...t,offer:e,frequencyConfig:a,prepaidSellingPlans:c}})},"receiveOffer"),Rr=n(t=>({type:ui,payload:t}),"fetchResponseError"),Vo=n((t,e=Ke,r)=>({type:L,payload:{product:t,module:e,offer:r}}),"requestOffer"),Ki=Vo,Qi=n(()=>({type:Ye}),"checkout"),Tl=n((t,e,r,o)=>({type:fi,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),wl=n(t=>({type:ir,payload:t}),"receiveCreateOneTime"),Cl=n((t,e)=>({type:hi,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Rl=n((t,e)=>({type:sr,payload:{response:t,product:e}}),"receiveConvertOneTime"),kr=n((t,e,r,o=!1,i=null)=>n(function(a,c){let l=c(),{auth:p,environment:{legoUrl:u},previewUpsellOffer:f,offerId:h,sessionId:w}=l;if(!p)return a(ye("No auth set."));let{frequencies:x,frequenciesEveryPeriod:g}=K(t.id)(l),P=$i(i,x,g),_=Tl(t,e,r,h);return a(_),(f?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:h}):Xe.createOneTime(u,p,t.id,e,r,h)).then(y=>(a(wl(y)),o?(a(Cl(y,P)),(f?Promise.resolve({item:y,frequency:P}):Xe.convertOneTimeToSubscription(u,p,y,P,h,w)).then(v=>a(Rl(v,t)),v=>a(Rr(v)))):y),y=>a(Rr(y))).finally(()=>a(Dt(_)))},"createIuThunk"),"createIu"),Zi=n(t=>({type:ar,payload:t}),"setLocale"),Xi=n(t=>({type:We,payload:t}),"setConfig"),es=n((t,e,r)=>({type:cr,payload:{selector:t,markup:e,config:r}}),"addTemplate"),ts=n(t=>({type:lr,payload:t}),"setTemplates"),rs=n((t,e)=>({type:pr,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),os=n((t,e)=>({type:ur,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),ns=n(t=>({type:pe,payload:t}),"receiveMerchantSettings");var qt="OG_STATE",as=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),jo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),cs=n(()=>jo()?{}:as(localStorage.getItem(qt)),"loadState"),Al=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"),ls=n(t=>{if(jo())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=Al(t);e&&localStorage.getItem(qt)!==e&&localStorage.setItem(qt,e)},"saveState"),ps=n(t=>(0,ss.throttle)(500,e=>{if(jo())return;let{key:r,newValue:o}=e;r===qt&&o===null?(t.dispatch({type:he}),setTimeout(()=>t.dispatch(Ji()),0)):r===qt&&t.dispatch({type:we,newValue:as(o)})}),"listenLocalStorageChanges");var ds=ce(Zt());var Il=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),us=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Il("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Nl=[{expressions:[({type:t}={})=>t===C,({type:t}={})=>t===D],fn:us(!0)},{expressions:[({type:t}={})=>t===F],fn:us(!1)}],fs=n(t=>e=>r=>{let o=t.getState();Nl.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),hs=n(t=>e=>r=>{var i;let o;switch(r.type){case T:case F:case C:case D: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"),ms=n(t=>e=>r=>{e(r);let o=(0,ds.throttle)(500,()=>{ls({...t.getState()})});r.type!==we&&o()},"localStorageMiddleware");var Ut=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function gs(t){let[e,r]=Ut(),[o,i]=Ut(),[s,a]=Ut();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(Lo(l)):a(p)});let c=Promise.all([o,e,s]);return c.then(()=>{var l;t.dispatch({type:nr,payload:{}}),window.addEventListener("storage",ps(t)),(l=t.getState().auth)!=null&&l.ts||t.dispatch(Yi())}),l=>async p=>{Ge===p.type||Be===p.type||He===p.type||ze===p.type?r(p.payload):Ve===p.type?i(p.payload):je===p.type?a(p.payload):await c,l(p)}}n(gs,"waitUntilOffersReady");function ys(t){return e=>r=>{if(r.type===L){let{merchantId:o,sessionId:i,environment:{apiUrl:s}}=t.getState(),a=S(r.payload.product);a&&Ri.fetchOffer(s,o,i,a,r.payload.module||Ke,r.payload.searchParams).then(c=>t.dispatch(Se(c,r.payload.offer,a)),c=>t.dispatch(Rr(c))).finally(()=>t.dispatch(Dt(r)))}return e(r)}}n(ys,"offerRequestMiddleware");var xs=ce(Es());function ql(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=xs.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(ql,"getVariantIx");function Dr(t={},e){var r;switch(e.type){case pe:return{...t,...e.payload.experiments};case wo:return{...t,currentVariant:e.payload.index,offerProfileId:(r=e.payload.parameters)==null?void 0:r.offer_profile_public_id};default:return t}}n(Dr,"experimentsReducer");function Ul(t,e,r){if(!t||r.variants.length===0)return;let o=e.selling_plan_groups.filter(_r);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(Ul,"resolveShopifySetupProductWhenExperiment");function Ll(t,e){let r=t==null?void 0:t.public_id;if(!r)return null;let o=t.variants,i=ql(`${r}|${e}`,o);return{...o[i],index:i}}n(Ll,"getAssignedExperimentVariant");function Ps(t){let[e,r]=Ut(),o,i;return s=>async a=>{if(a.type===nr)r();else if(a.type===pe){await e,i=a.payload.experiments;let{sessionId:c}=t.getState();o=Ll(i,c),o&&t.dispatch({type:wo,payload:o})}else if(a.type===L)await e,o&&(a.payload.searchParams={...a.payload.searchParams,variant:o.public_id});else if(a.type===q){await e;let c=Ul(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(Ps,"experimentsMiddleware");function Os(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"}):vo,i=[gs,ni,Ps,ys,fs,hs],s={};if(!r)try{s=cs(),i.push(ms)}catch{}let a=o(ti(...i,...e.filter(l=>l))),c=Oo(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Os,"makeStore");var Ml=Object.defineProperty,qr=n((t,e)=>Ml(t,"name",{value:e,configurable:!0}),"i"),$l=qr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Ts=["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],vs=qr(t=>(e,r)=>{Ts.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Bo(t=window.opener,e=window.og){let r=qr(o=>{let i=$l(Ts),s=vs(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.9/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),vs(t)("READY"))}n(Bo,"h");qr(Bo,"offersLiveEditor");var Ur=null,Vl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),ws=n(t=>{if(!Ur)throw new Error("Missing redux store.");return Ur},"resolveStore"),jl=n((t,e)=>r=>{let{getState:o,dispatch:i}=ws(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),m=n((t,e=Vl)=>r=>{let i=jl(t,typeof e=="function"?e:s=>ei(e,s));return class extends r{get store(){return Ur}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=ws(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"),Cs=n(t=>{Ur=t},"setStore");var zo=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},...wt(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"),Lr=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 Yo=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var ke=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var B=`{{lit-${String(Math.random()).slice(2)}}}`,Wo=`<!--${B}-->`,Rs=new RegExp(`${B}|${Wo}`),st="$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 f=s.nextNode();if(f===null){s.currentNode=i.pop();continue}if(c++,f.nodeType===1){if(f.hasAttributes()){let h=f.attributes,{length:w}=h,x=0;for(let g=0;g<w;g++)As(h[g].name,st)&&x++;for(;x-- >0;){let g=p[l],P=Mr.exec(g)[2],_=P.toLowerCase()+st,y=f.getAttribute(_);f.removeAttribute(_);let v=y.split(Rs);this.parts.push({type:"attribute",index:c,name:P,strings:v}),l+=v.length-1}}f.tagName==="TEMPLATE"&&(i.push(f),s.currentNode=f.content)}else if(f.nodeType===3){let h=f.data;if(h.indexOf(B)>=0){let w=f.parentNode,x=h.split(Rs),g=x.length-1;for(let P=0;P<g;P++){let _,y=x[P];if(y==="")_=ie();else{let v=Mr.exec(y);v!==null&&As(v[2],st)&&(y=y.slice(0,v.index)+v[1]+v[2].slice(0,-st.length)+v[3]),_=document.createTextNode(y)}w.insertBefore(_,f),this.parts.push({type:"node",index:++c})}x[g]===""?(w.insertBefore(ie(),f),o.push(f)):f.data=x[g],l+=g}}else if(f.nodeType===8)if(f.data===B){let h=f.parentNode;(f.previousSibling===null||c===a)&&(c++,h.insertBefore(ie(),f)),a=c,this.parts.push({type:"node",index:c}),f.nextSibling===null?f.data="":(o.push(f),c--),l++}else{let h=-1;for(;(h=f.data.indexOf(B,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let f of o)f.parentNode.removeChild(f)}};n(_e,"Template");var As=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Lt=n(t=>t.index!==-1,"isTemplatePartActive"),ie=n(()=>document.createComment(""),"createMarker"),Mr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Jo=133;function Ko(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Jo,null,!1),s=Mt(o),a=o[s],c=-1,l=0,p=[],u=null;for(;i.nextNode();){c++;let f=i.currentNode;for(f.previousSibling===u&&(u=null),e.has(f)&&(p.push(f),u===null&&(u=f)),u!==null&&l++;a!==void 0&&a.index===c;)a.index=u!==null?-1:a.index-l,s=Mt(o,s),a=o[s]}p.forEach(f=>f.parentNode.removeChild(f))}n(Ko,"removeNodesFromTemplate");var Hl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Jo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Mt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Lt(o))return r}return-1},"nextActiveIndexInTemplateParts");function Is(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Jo,null,!1),a=Mt(i),c=0,l=-1;for(;s.nextNode();)for(l++,s.currentNode===r&&(c=Hl(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===l;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Mt(i,a);return}a=Mt(i,a)}}n(Is,"insertNodeIntoTemplate");var Ns=new WeakMap,Qo=n(t=>(...e)=>{let r=t(...e);return Ns.set(r,!0),r},"directive"),Fe=n(t=>typeof t=="function"&&Ns.has(t),"isDirective");var $={},$r={};var de=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=Yo?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],!Lt(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 Yo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(de,"TemplateInstance");var ks=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),zl=` ${B} `,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=Mr.exec(s);c===null?r+=s+(o?zl:Wo):r+=s.substr(0,c.index)+c[1]+c[2]+st+c[3]+B}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ks!==void 0&&(r=ks.createHTML(r)),e.innerHTML=r,e}};n(se,"TemplateResult");var jr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Vr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),De=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 Ee(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"||!Vr(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(jr(c)||!Vr(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(De,"AttributeCommitter");var Ee=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==$&&(!jr(e)||e!==this.value)&&(this.value=e,Fe(e)||(this.committer.dirty=!0))}commit(){for(;Fe(this.value);){let e=this.value;this.value=$,e(this)}this.value!==$&&this.committer.commit()}};n(Ee,"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(;Fe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}let e=this.__pendingValue;e!==$&&(jr(e)?e!==this.value&&this.__commitText(e):e instanceof se?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Vr(e)?this.__commitIterable(e):e===$r?(this.value=$r,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 de&&this.value.template===r)this.value.update(e.values);else{let o=new de(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){ke(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ae,"NodePart");var at=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(;Fe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}if(this.__pendingValue===$)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=$}};n(at,"BooleanAttributePart");var ct=class extends De{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new $t(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(ct,"PropertyCommitter");var $t=class extends Ee{};n($t,"PropertyPart");var Fs=!1;(()=>{try{let t={get capture(){return Fs=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var lt=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(;Fe(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=$,s(this)}if(this.__pendingValue===$)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=Yl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=$}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(lt,"EventPart");var Yl=n(t=>t&&(Fs?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Zo(t){let e=qe.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},qe.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(B);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(Zo,"templateFactory");var qe=new Map;var xe=new WeakMap,Xo=n((t,e,r)=>{let o=xe.get(e);o===void 0&&(ke(e,e.firstChild),xe.set(e,o=new ae(Object.assign({templateFactory:Zo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Vt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new ct(e,r.slice(1),o).parts:s==="@"?[new lt(e,r.slice(1),i.eventContext)]:s==="?"?[new at(e,r.slice(1),o)]:new De(e,r,o).parts}handleTextExpression(e){return new ae(e)}};n(Vt,"DefaultTemplateProcessor");var en=new Vt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var d=n((t,...e)=>new se(t,e,"html",en),"html");var qs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Gr=!0;typeof window.ShadyCSS>"u"?Gr=!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."),Gr=!1);var Jl=n(t=>e=>{let r=qs(e.type,t),o=qe.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},qe.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(B);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Gr&&window.ShadyCSS.prepareTemplateDom(a,t),i=new _e(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Kl=["html","svg"],Ql=n(t=>{Kl.forEach(e=>{let r=qe.get(qs(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)}),Ko(o,s)})})},"removeStylesFromLitTemplates"),Us=new Set,Zl=n((t,e,r)=>{Us.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}Ql(t);let c=o.content;r?Is(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),Ko(r,p)}},"prepareTemplateStyles"),Ls=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=xe.has(e),s=Gr&&e.nodeType===11&&!!e.host,a=s&&!Us.has(o),c=a?document.createDocumentFragment():e;if(Xo(t,c,Object.assign({templateFactory:Jl(o)},r)),a){let l=xe.get(c);xe.delete(c);let p=l.value instanceof de?l.value.template:void 0;Zl(o,c,p),ke(e,e.firstChild),e.appendChild(c),xe.set(e,l)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Ms;window.JSCompiler_renameProperty=(t,e)=>t;var an={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}},$s=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),tn={attribute:!0,type:String,converter:an,reflect:!1,hasChanged:$s},rn=1,on=1<<2,nn=1<<3,sn=1<<4,cn="finalized",pt=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=tn){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)||tn}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(cn)||e.finalize(),this[cn]=!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=$s){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||an,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||an.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=tn){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|nn,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~nn}}_attributeToProperty(e,r){if(this._updateState&nn)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|sn,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~sn}}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&sn)&&(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|on;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&on}get hasUpdated(){return this._updateState&rn}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&rn||(this._updateState=this._updateState|rn,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~on}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(pt,"UpdatingElement");Ms=cn;pt[Ms]=!0;var Vs=Element.prototype,hh=Vs.msMatchesSelector||Vs.webkitMatchesSelector;var Hr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ln=Symbol(),ut=class{constructor(e,r){if(r!==ln)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Hr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(ut,"CSSResult");var js=n(t=>new ut(String(t),ln),"unsafeCSS"),Xl=n(t=>{if(t instanceof ut)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
10
- take care to ensure page security.`)},"textFromCSSResult"),b=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+Xl(i)+t[s+1],t[0]);return new ut(r,ln)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Gs={},E=class extends pt{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&&!Hr){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return js(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):Hr?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!==Gs&&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 Gs}};n(E,"LitElement");E.finalized=!0;E.render=Ls;var aa=ce(ea());var sp=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"),ta=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var jt=n(t=>{let e=ta(t);if(!e){let r=t.offer;r&&(e=ta(r))}return e},"resolveProduct"),ap=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),pn=n(t=>class extends t{get offer(){return ap(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 pn(t){get product(){return jt(this)}},"withProduct"),zr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=sp(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Yr={};Kn(Yr,{autoshipByDefault:()=>cp,eligibilityGroups:()=>dn,eligible:()=>ra,hasPrepaidOptions:()=>fp,hasUpcomingOrder:()=>ia,hasUpsellGroup:()=>na,inStock:()=>un,optedout:()=>up,prepaidEligible:()=>lp,prepaidSubscribed:()=>dp,regularEligible:()=>mp,subscribed:()=>pp,subscriptionEligible:()=>oa,upcomingOrderContainsProduct:()=>hp,upsellEligible:()=>sa});var un=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ra=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),cp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),oa=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ra(t,e)&&un(t,e),"subscriptionEligible"),dn=n((t,e)=>{let r=S((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),na=n((t,e)=>{let r=dn(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),lp=n((t,e)=>{let r=dn(t,e);return(r==null?void 0:r.some(o=>o===mr.PREPAID))||!1},"prepaidEligible"),pp=n((t,e)=>Or(e.product)(t),"subscribed"),up=n((t,e)=>vr(e.product)(t),"optedout"),dp=n((t,e)=>Di(e.product)(t),"prepaidSubscribed"),fp=n((t,e)=>G(e.product.id)(t).length>0,"hasPrepaidOptions"),ia=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),hp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),sa=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&un(t,e)&&ia(t)&&na(t,e)},"upsellEligible"),mp=n((t,e)=>oa(t,e)&&!sa(t,e),"regularEligible");var gp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Wr=class extends N(E){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return d``;let e=gp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),aa.default.parse(e,o=>Yr[o]&&Yr[o](this.state,this))?d`
9
+ var lib=(()=>{var pc=Object.create;var bt=Object.defineProperty;var uc=Object.getOwnPropertyDescriptor;var dc=Object.getOwnPropertyNames;var fc=Object.getPrototypeOf,hc=Object.prototype.hasOwnProperty;var n=(t,e)=>bt(t,"name",{value:e,configurable:!0});var ee=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xn=(t,e)=>{for(var r in e)bt(t,r,{get:e[r],enumerable:!0})},ei=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of dc(e))!hc.call(t,i)&&i!==r&&bt(t,i,{get:()=>e[i],enumerable:!(o=uc(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?pc(fc(t)):{},ei(e||!t||!t.__esModule?bt(r,"default",{value:t,enumerable:!0}):r,t)),mc=t=>ei(bt({},"__esModule",{value:!0}),t);var Zt=ee((Qt,ci)=>{(function(t,e){typeof Qt=="object"&&typeof ci<"u"?e(Qt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Qt,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 f(){u(),l=!0}n(f,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var w=arguments.length,P=new Array(w),g=0;g<w;g++)P[g]=arguments[g];var O=this,E=Date.now()-p;if(l)return;function y(){p=Date.now(),s.apply(O,P)}n(y,"exec");function v(){c=void 0}n(v,"clear"),a&&!c&&y(),u(),a===void 0&&E>o?y():i!==!0&&(c=setTimeout(a?v:y,a===void 0?o-E:o))}return n(h,"wrapper"),h.cancel=f,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 Ot=ee((Od,Ci)=>{var Tc="Expected a function",xi="__lodash_hash_undefined__",wc="[object Function]",Cc="[object GeneratorFunction]",Rc=/[\\^$.*+?()[\]{}|]/g,Ac=/^\[object .+?Constructor\]$/,Ic=typeof window=="object"&&window&&window.Object===Object&&window,Nc=typeof self=="object"&&self&&self.Object===Object&&self,Pi=Ic||Nc||Function("return this")();function kc(t,e){return t?.[e]}n(kc,"getValue");function Fc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Fc,"isHostObject");var Dc=Array.prototype,qc=Function.prototype,Oi=Object.prototype,Ao=Pi["__core-js_shared__"],Ei=function(){var t=/[^.]+$/.exec(Ao&&Ao.keys&&Ao.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),vi=qc.toString,Io=Oi.hasOwnProperty,Uc=Oi.toString,Lc=RegExp("^"+vi.call(Io).replace(Rc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mc=Dc.splice,$c=Ti(Pi,"Map"),Pt=Ti(Object,"create");function Ae(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(Ae,"Hash");function Vc(){this.__data__=Pt?Pt(null):{}}n(Vc,"hashClear");function jc(t){return this.has(t)&&delete this.__data__[t]}n(jc,"hashDelete");function Gc(t){var e=this.__data__;if(Pt){var r=e[t];return r===xi?void 0:r}return Io.call(e,t)?e[t]:void 0}n(Gc,"hashGet");function Hc(t){var e=this.__data__;return Pt?e[t]!==void 0:Io.call(e,t)}n(Hc,"hashHas");function Bc(t,e){var r=this.__data__;return r[t]=Pt&&e===void 0?xi:e,this}n(Bc,"hashSet");Ae.prototype.clear=Vc;Ae.prototype.delete=jc;Ae.prototype.get=Gc;Ae.prototype.has=Hc;Ae.prototype.set=Bc;function Ze(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(Ze,"ListCache");function zc(){this.__data__=[]}n(zc,"listCacheClear");function Yc(t){var e=this.__data__,r=yr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Mc.call(e,r,1),!0}n(Yc,"listCacheDelete");function Wc(t){var e=this.__data__,r=yr(e,t);return r<0?void 0:e[r][1]}n(Wc,"listCacheGet");function Jc(t){return yr(this.__data__,t)>-1}n(Jc,"listCacheHas");function Kc(t,e){var r=this.__data__,o=yr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Kc,"listCacheSet");Ze.prototype.clear=zc;Ze.prototype.delete=Yc;Ze.prototype.get=Wc;Ze.prototype.has=Jc;Ze.prototype.set=Kc;function Ie(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(Ie,"MapCache");function Qc(){this.__data__={hash:new Ae,map:new($c||Ze),string:new Ae}}n(Qc,"mapCacheClear");function Zc(t){return br(this,t).delete(t)}n(Zc,"mapCacheDelete");function Xc(t){return br(this,t).get(t)}n(Xc,"mapCacheGet");function el(t){return br(this,t).has(t)}n(el,"mapCacheHas");function tl(t,e){return br(this,t).set(t,e),this}n(tl,"mapCacheSet");Ie.prototype.clear=Qc;Ie.prototype.delete=Zc;Ie.prototype.get=Xc;Ie.prototype.has=el;Ie.prototype.set=tl;function yr(t,e){for(var r=t.length;r--;)if(sl(t[r][0],e))return r;return-1}n(yr,"assocIndexOf");function rl(t){if(!wi(t)||nl(t))return!1;var e=al(t)||Fc(t)?Lc:Ac;return e.test(il(t))}n(rl,"baseIsNative");function br(t,e){var r=t.__data__;return ol(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(br,"getMapData");function Ti(t,e){var r=kc(t,e);return rl(r)?r:void 0}n(Ti,"getNative");function ol(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(ol,"isKeyable");function nl(t){return!!Ei&&Ei in t}n(nl,"isMasked");function il(t){if(t!=null){try{return vi.call(t)}catch{}try{return t+""}catch{}}return""}n(il,"toSource");function No(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Tc);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(No.Cache||Ie),r}n(No,"memoize");No.Cache=Ie;function sl(t,e){return t===e||t!==t&&e!==e}n(sl,"eq");function al(t){var e=wi(t)?Uc.call(t):"";return e==wc||e==Cc}n(al,"isFunction");function wi(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(wi,"isObject");Ci.exports=No});var xs=ee((sf,Bo)=>{function Ll(t,e){var r,o,i,s,a,c,l,p,u,f;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,l=461845907,f=0;f<o;)u=t.charCodeAt(f)&255|(t.charCodeAt(++f)&255)<<8|(t.charCodeAt(++f)&255)<<16|(t.charCodeAt(++f)&255)<<24,++f,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(f+2)&255)<<16;case 2:u^=(t.charCodeAt(f+1)&255)<<8;case 1:u^=t.charCodeAt(f)&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(Ll,"murmurhash3_32_gc");typeof Bo<"u"&&(Bo.exports=Ll)});var Ps=ee((af,zo)=>{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 zo!==void 0&&(zo.exports=Ml)});var vs=ee((cf,Dr)=>{var Os=xs(),$l=Ps();Dr.exports=Os;Dr.exports.murmur3=Os;Dr.exports.murmur2=$l});var zr=ee((Nh,Ws)=>{var ip={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"};Ws.exports=ip});var Ks=ee((kh,Js)=>{var Ue=zr(),sp=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ue.PAR_OPEN:case Ue.PAR_CLOSE:case Ue.OP_NOT:case Ue.BINARY_AND:case Ue.BINARY_OR:e&&(r.push({type:Ue.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ue.LITERAL,value:e}),r},"Tokenizer");Js.exports=sp});var Zs=ee((Fh,Qs)=>{var Pe=zr(),ap=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Pe.LITERAL:e.unshift(i);break;case Pe.BINARY_AND:case Pe.BINARY_OR:case Pe.OP_NOT:case Pe.PAR_OPEN:r.push(i);break;case Pe.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Pe.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Pe.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),cp=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Qs.exports={PolishNotation:ap,PolishGenerator:cp}});var ea=ee((Dh,Xs)=>{var V=zr(),z=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===V.LEAF}isAtomic(){return this.isLeaf()||this.op===V.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new z(V.BINARY_AND,e,r)}static CreateNot(e){return new z(V.OP_NOT,e)}static CreateOr(e,r){return new z(V.BINARY_OR,e,r)}static CreateLiteral(e){return new z(V.LEAF,null,null,e)}};n(z,"ExpNode");var dt=n(t=>{let e=t.next().value;switch(e.type){case V.LITERAL:return z.CreateLiteral(e.value);case V.OP_NOT:return z.CreateNot(dt(t));case V.BINARY_AND:{let r=dt(t),o=dt(t);return z.CreateAnd(r,o)}case V.BINARY_OR:{let r=dt(t),o=dt(t);return z.CreateOr(r,o)}}return null},"make"),ft=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===V.OP_NOT)return!ft(t.left,e);if(t.op===V.BINARY_OR)return ft(t.left,e)||ft(t.right,e);if(t.op===V.BINARY_AND)return ft(t.left,e)&&ft(t.right,e)},"nodeEvaluator");Xs.exports={make:dt,nodeEvaluator:ft}});var na=ee((qh,oa)=>{var lp=Ks(),ta=Zs(),ra=ea(),pp=n((t,e)=>{let r=lp(t),o=ta.PolishNotation(r),i=ta.PolishGenerator(o),s=ra.make(i);return ra.nodeEvaluator(s,e)},"parse");oa.exports={parse:pp}});var md={};Xn(md,{addOptinChangedCallback:()=>zu,addTemplate:()=>Yu,autoInit:()=>fd,clear:()=>Wu,config:()=>Ju,default:()=>hd,disableOptinChangedCallbacks:()=>Ku,getOptins:()=>Qu,getProductsForPurchasePost:()=>Zu,initialize:()=>Xu,isReady:()=>Bu,offers:()=>x,platform:()=>A,previewMode:()=>ed,register:()=>td,resolveSettings:()=>rd,setAuthUrl:()=>od,setBenefitMessages:()=>nd,setEnvironment:()=>id,setLocale:()=>sd,setMerchantId:()=>ad,setPublicPath:()=>cd,setTemplates:()=>ld,setupCart:()=>pd,setupProduct:()=>ud,setupProducts:()=>dd,store:()=>cc});function Po(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(Po,"symbolObservablePonyfill");var $e;typeof self<"u"?$e=self:typeof window<"u"||typeof window<"u"?$e=window:typeof module<"u"?$e=module:$e=Function("return this")();var gc=Po($e),Oo=gc;var vo=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),St={INIT:"@@redux/INIT"+vo(),REPLACE:"@@redux/REPLACE"+vo(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+vo()},"PROBE_UNKNOWN_ACTION")};function yc(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(yc,"isPlainObject");function To(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(To)(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 f(g){if(typeof g!="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 O=!0;return p(),c.push(g),n(function(){if(!!O){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.");O=!1,p();var y=c.indexOf(g);c.splice(y,1),a=null}},"unsubscribe")}n(f,"subscribe");function h(g){if(!yc(g))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof g.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,g)}finally{l=!1}for(var O=a=c,E=0;E<O.length;E++){var y=O[E];y()}return g}n(h,"dispatch");function w(g){if(typeof g!="function")throw new Error("Expected the nextReducer to be a function.");i=g,h({type:St.REPLACE})}n(w,"replaceReducer");function P(){var g,O=f;return g={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 Jt=O(v);return{unsubscribe:Jt}},"subscribe")},g[Oo]=function(){return this},g}return n(P,"observable"),h({type:St.INIT}),o={dispatch:h,subscribe:f,getState:u,replaceReducer:w},o[Oo]=P,o}n(To,"createStore");function bc(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(bc,"getUndefinedStateErrorMessage");function Sc(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:St.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:St.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+St.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(Sc,"assertReducerShape");function Kt(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{Sc(r)}catch(l){c=l}return n(function(p,u){if(p===void 0&&(p={}),c)throw c;if(!1)var f;for(var h=!1,w={},P=0;P<s.length;P++){var g=s[P],O=r[g],E=p[g],y=O(E,u);if(typeof y>"u"){var v=bc(g,u);throw new Error(v)}w[g]=y,h=h||y!==E}return h=h||s.length!==Object.keys(p).length,h?w:p},"combination")}n(Kt,"combineReducers");function ti(t,e){return function(){return e(t.apply(this,arguments))}}n(ti,"bindActionCreator");function oi(t,e){if(typeof t=="function")return ti(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]=ti(i,e))}return r}n(oi,"bindActionCreators");function _c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(_c,"_defineProperty");function ri(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(ri,"ownKeys");function Ec(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ri(r,!0).forEach(function(o){_c(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ri(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Ec,"_objectSpread2");function wo(){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(wo,"compose");function ni(){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=wo.apply(void 0,c)(i.dispatch),Ec({},i,{dispatch:s})}}}n(ni,"applyMiddleware");function ii(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(ii,"createThunkMiddleware");var si=ii();si.withExtraArgument=ii;var ai=si;var ps=ce(Zt());var li=/^og_auth=/,xc=n((t=li)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(li,""),"c"),Xt=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"),Pc=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"),Oc=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function pi(){return typeof window.og_auth<"u"?Xt(window.og_auth):null}n(pi,"a");async function vc(t=100){return new Promise(e=>{setTimeout(()=>e(pi()),t)})}n(vc,"f");async function ui(t,e=xc,r=Pc){let o;if(o=Xt(pi())||Xt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Oc(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await vc());if(o=Xt(o),o)return o;throw new Error("Unauthorized")}n(ui,"u");var R="OPTIN_PRODUCT",F="OPTOUT_PRODUCT",D="PRODUCT_CHANGE_FREQUENCY",le="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ve="SET_MERCHANT_ID",L="REQUEST_OFFER",T="RECEIVE_OFFER",_t="PRODUCT_HAS_CHANGED",je="CREATED_SESSION_ID",er="SET_AUTH_URL",di="REQUEST_AUTH",tr="AUTHORIZE",Te="UNAUTHORIZED",fi="REQUEST_ORDERS",rr="RECEIVE_ORDERS",Et="CART_PRODUCT_KEY_HAS_CHANGED",or="RECEIVE_ORDER_ITEMS",hi="FETCH_RESPONSE_ERROR",Ge="SET_ENVIRONMENT_LOCAL",He="SET_ENVIRONMENT_STAGING",Be="SET_ENVIRONMENT_DEV",ze="SET_ENVIRONMENT_PROD",nr="READY",mi="CONCLUDE_UPSELL",gi="REQUEST_CREATE_IU_ORDER",ir="CREATE_ONE_TIME",yi="REQUEST_CONVERT_ONE_TIME",sr="CONVERT_ONE_TIME";var Ye="CHECKOUT",bi="RECEIVE_FETCH",ar="SET_LOCALE",We="SET_CONFIG",cr="SET_BENEFIT_MESSAGES",fe="SET_PREVIEW_STANDARD_OFFER",xt="SET_PREVIEW_UPSELL_OFFER",Co="SET_PREVIEW_PREPAID_OFFER",lr="ADD_TEMPLATE",pr="SET_TEMPLATES",we="LOCAL_STORAGE_CHANGE",he="LOCAL_STORAGE_CLEAR",ur="SET_FIRST_ORDER_PLACE_DATE",dr="SET_PRODUCT_TO_SUBSCRIBE",Je="RECEIVE_PRODUCT_PLANS",q="SETUP_PRODUCT",me="SETUP_CART",pe="RECEIVE_MERCHANT_SETTINGS",Ro="SET_EXPERIMENT_VARIANT",Ke="pdp",Si="local",fr="dev",Ce="staging",Re="prod",hr="static.ordergroove.com",mr="staging.static.ordergroove.com",ge={PSI:"PSI",PROGRAM_WIDE:"PROGRAM_WIDE"},gr={PREPAID:"prepaid"},_i="og-cart-updated";var Sr=ce(Ot());var ko=n((...t)=>JSON.stringify(t),"memoizeKey"),vt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Tt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),_r=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"),Ri=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"),Ai=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),cl=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),ll=(0,Sr.default)(vt(Tt((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",cl(r)],["module_view",JSON.stringify(["regular"])],...Object.entries(i)];return[`/offer/${t}/${o}?${Ai(s)}`]})),ko),pl=(0,Sr.default)(vt(Tt(_r((t=1,e="place")=>[`/orders/?${Ai([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),ko),ul=(0,Sr.default)(vt(Tt(_r(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),ko),dl=vt(Tt(_r(Ri((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}}]})))),wt=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"),Fo=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),fl=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Ii=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Fo).sort(fl),"parseFrequenciesList");var Ct=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"),hl=vt(Tt(_r(Ri((t,e,r,o)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let i=wt(e);if(!i)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,session_id:o,...i}}]})))),Xe={fetchOffer:ll,fetchOrders:pl,fetchItems:ul,createOneTime:dl,convertOneTimeToSubscription:hl},Ni=Xe;var Do=Rt(),A={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Do==null?void 0:Do.dataset.shopifySellingPlans)!="undefined"};function ml(t,e){return t===e}n(ml,"defaultEqualityCheck");function gl(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(gl,"areArgumentsShallowlyEqual");function yl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ml,r=null,o=null;return function(){return gl(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(yl,"defaultMemoize");function bl(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(bl,"getDependencies");function Sl(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=bl(s),u=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),f=t(function(){for(var h=[],w=p.length,P=0;P<w;P++)h.push(p[P].apply(null,arguments));return u.apply(null,h)});return f.resultFunc=l,f.dependencies=p,f.recomputations=function(){return c},f.resetRecomputations=function(){return c=0},f}}n(Sl,"createSelectorCreator");var I=Sl(yl);var U=ce(Ot());var M=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),et=n(t=>`${t}%`,"percentage"),_l="Subscribe and Save",El="ordergroove-subscribe-and-save-",At=n((t=[])=>t.find(Di)||t.find(Fi)||t.find(Er),"getPayAsYouGoSellingPlanGroup"),ki=n((t=[])=>t.filter(e=>Fi(e)||Di(e)||Er(e)),"getPayAsYouGoSellingPlanGroups"),Fi=n(t=>t.name===_l||t.app_id==="ordergroove-subscribe-and-save","isDefaultSellingPlanGroup"),Di=n(t=>t.name.startsWith("og_psfl")||t.app_id==="ordergroove-product-specific-frequency-list","isProductSpecificFrequencySellingPlanGroup"),Er=n(t=>{var e;return(e=t.app_id)==null?void 0:e.startsWith(El)},"isExperimentSellingPlanGroup"),qi=n(t=>{let e=At(t.map(r=>r.group));return t.find(r=>r.group===e)},"getPayAsYouGoSellingPlan");function xr(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(xr,"sellingPlansToFrequencies");function Pr(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>xl(r))}n(Pr,"sellingPlansToEveryPeriod");function xl(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(xl,"textToFreq");function Or(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(Or,"getPrepaidShipments");function It(t){return t[1]||t[0]}n(It,"getDefaultPrepaidOption");U.default.Cache=Map;function Pl(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(Pl,"arraysEqual");function Ol(t,e,r){let o=Ct(r);return A.shopify_selling_plans?Q(t,e,o):o}n(Ol,"resolveFrequency");var N=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))||Pl((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Nt=n(t=>t.optedin||[],"optedinSelector"),Ui=n(t=>t.optedout||[],"optedoutSelector"),qo=n(t=>t.autoshipByDefault||{},"autoshipSelector"),vl=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Uo=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Tl=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),te=(0,U.default)(t=>I(Nt,Ui,qo,(e,r,o)=>{let i=e.find(s=>N(t,s));return i||(r.find(s=>N(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),vr=(0,U.default)(t=>I(Nt,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),Li=(0,U.default)(t=>I(Nt,e=>e.some(r=>N(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),re=(0,U.default)(t=>I(Tl,e=>e[t.id]||null),t=>JSON.stringify(t)),Tr=(0,U.default)(t=>I(Ui,e=>e.find(r=>N(t,r)))),oe=(0,U.default)(t=>I(te(t),e=>e&&"frequency"in e&&e.frequency||null),t=>JSON.stringify(t)),j=(0,U.default)(t=>I(te(t),e=>e&&"prepaidShipments"in e&&e.prepaidShipments||null),t=>JSON.stringify(t)),G=(0,U.default)(t=>I(Uo,e=>{var o;return(((o=e[b(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),tt=(0,U.default)(t=>I(vl,K(t),(e,{frequencies:r=[],frequenciesEveryPeriod:o=[]})=>e[b(t)]&&Ol(r,o,e[b(t)])||null)),rt=(0,U.default)(t=>I(K(t),e=>e.frequencies)),ne=(0,U.default)(t=>I(K(t),e=>e.defaultFrequency)),K=(0,U.default)(t=>I(e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.productFrequencies},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.frequencies},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.frequenciesEveryPeriod},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.frequenciesText},e=>{var r;return(r=e==null?void 0:e.config)==null?void 0:r.defaultFrequency},(e,r,o,i,s)=>e?e[b(t)]||{}:{frequencies:r,frequenciesEveryPeriod:o,frequenciesText:i,defaultFrequency:s})),Mi=n((t,e)=>I(Uo,K(t.id),(r,{frequencies:o})=>{var i;if(e){let s=b(t.id),a=(i=r[s])==null?void 0:i.find(c=>c.numberShipments===e);return a?a.sellingPlan:null}return o[0]}),"makeFrequencyForPrepaidShipmentsSelector"),$i=n(t=>I(Uo,e=>{let r=b(t);return e[r]||[]}),"makePrepaidSellingPlansSelector"),Vi=(0,U.default)(t=>I(e=>e.price||{},e=>e.incentives||{},e=>e.config.storeCurrency,(e,r,o)=>{let i=e[b(t)];if(i==null||!o)return{};let s=i.value,a=s,c=s,l=r[b(t)],p=l==null?void 0:l.initial.find(Cl),u="";return p&&(p.type==="Discount Percent"?(c=Math.round(s*(100-p.value)/100),u=et(p.value)):p.type==="Discount Amount"&&o==="USD"&&(c=Math.max(0,s-Math.round(p.value*100)))),{regularPrice:M(a,o),subscriptionPrice:M(c,o),discountRate:u||M(a-c,o)}})),wl=[ge.PROGRAM_WIDE,ge.PSI];function Cl(t){return t.object==="item"&&(t.type==="Discount Percent"||t.type==="Discount Amount")&&t.criteria&&t.criteria.node_type==="PREMISE"&&wl.includes(t.criteria.standard)}n(Cl,"findRelevantIncentive");var Lo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r)=>t&&t.hasAttribute&&t.hasAttribute(Lo(e))&&t[e]||t.offer&&typeof(t.offer[e]!=="undefined")&&t.offer[e]||r,"getFallbackValue"),ot=n(t=>({templates:t.templates||[]}),"templatesSelector"),ji=n(t=>{let e=Object.values(t.productPlans).flat();return e.length>0&&e.every(r=>r.hasPriceAdjustments===!1||r.prepaidShipments)},"isShopifyDiscountFunctionInUseSelector");function wr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(wr,"onReady");function Rt(){return document.querySelector([`script[src^="https://${hr}"]`,`script[src^="https://${mr}"]`,`script[src^="http://${hr}"]`,`script[src^="http://${mr}"]`].join(","))}n(Rt,"getMainJs");function Mo(){let t=Rt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Ce)?Ce:Re,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(Mo,"resolveEnvAndMerchant");var b=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=A)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),Gi=n((t,e,r)=>{if(A.shopify_selling_plans){let o=e==null?void 0:e.indexOf(t);if(o>=0&&r[o])return r[o]}return t},"safeOgFrequency"),kt=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 Hi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Mo();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===Re?hr:mr}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(Hi,"autoInitializeOffers");var Bi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function zi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(zi,"getCookieValue");var Ne=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),ue=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),Cr=n((t=[],e=[])=>{var r;return!!(((r=A)==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 Rr(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(Rr,"getOrCreateHidden");function nt(t,e){let[[r],o]=t.reduce((i,s)=>i[N(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(nt,"getMatchingProductIfExists");var Z=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),it=n((t,e)=>({type:F,payload:{product:t,offer:e}}),"optoutProduct"),Yi=n((t,e)=>({type:_t,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),Ir=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),be=n((t,e,r)=>(o,i)=>{let s=Mi(t,e)(i());o({type:le,payload:{product:t,prepaidShipments:e,offer:r,frequency:s}})},"productChangePrepaidShipments");var Nr=n(t=>({type:mi,payload:{product:t}}),"concludeUpsell"),Wi=n(t=>({type:Ve,payload:t}),"setMerchantId"),$o=n(t=>({type:je,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Rl=n(t=>({type:di,payload:t}),"requestAuth"),Ft=n((t,e,r,o)=>({type:tr,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ye=n(t=>({type:Te,payload:t}),"unauthorized"),Ji=n(t=>({type:er,payload:t}),"setAuthUrl"),Dt=n(t=>({type:bi,payload:t}),"fetchDone"),Ki=n((t=ui)=>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=Rl(s);return r(a),t(s).then(({sig_field:c,ts:l,sig:p})=>r(Ft(i,c,l,p)),c=>r(ye(c))).finally(()=>r(Dt(a)))},"fetchAuthThunk"),"fetchAuth"),Al=n((t,e)=>({type:fi,payload:{status:t,ordering:e}}),"requestOrders"),Vo=n(t=>({type:rr,payload:t}),"receiveOrders"),jo=n(t=>({type:or,payload:t}),"receiveItems"),kr=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=Al(t,e);return o(c),Xe.fetchOrders(s,a,t,e).then(l=>{if(l.results){o(Vo(l));let p=(l.results[0]||{}).public_id;if(p)return Xe.fetchItems(s,a,p).then(u=>o(jo(u)))}return o(ye(l.detail)),null},l=>o(ye(l))).finally(()=>o(Dt(c)))},"fetchOrdersThunk"),"fetchOrders"),Qi=n(t=>{switch(t){case Si:return{type:Ge,payload:t};case fr:return{type:Be,payload:t};case Ce:return{type:He,payload:t};case Re:return{type:ze,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Zi=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t($o(r)),o},"requestSessionId"),Se=n((t,e,r)=>(o,i)=>{let s=i(),a=K(r)(s),c=$i(r)(s);o({type:T,payload:{...t,offer:e,frequencyConfig:a,prepaidSellingPlans:c}})},"receiveOffer"),Ar=n(t=>({type:hi,payload:t}),"fetchResponseError"),Go=n((t,e=Ke,r)=>({type:L,payload:{product:t,module:e,offer:r}}),"requestOffer"),Xi=Go,es=n(()=>({type:Ye}),"checkout"),Il=n((t,e,r,o)=>({type:gi,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Nl=n(t=>({type:ir,payload:t}),"receiveCreateOneTime"),kl=n((t,e)=>({type:yi,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Fl=n((t,e)=>({type:sr,payload:{response:t,product:e}}),"receiveConvertOneTime"),Fr=n((t,e,r,o=!1,i=null)=>n(function(a,c){let l=c(),{auth:p,environment:{legoUrl:u},previewUpsellOffer:f,offerId:h,sessionId:w}=l;if(!p)return a(ye("No auth set."));let{frequencies:P,frequenciesEveryPeriod:g}=K(t.id)(l),O=Gi(i,P,g),E=Il(t,e,r,h);return a(E),(f?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:h}):Xe.createOneTime(u,p,t.id,e,r,h)).then(y=>(a(Nl(y)),o?(a(kl(y,O)),(f?Promise.resolve({item:y,frequency:O}):Xe.convertOneTimeToSubscription(u,p,y,O,h,w)).then(v=>a(Fl(v,t)),v=>a(Ar(v)))):y),y=>a(Ar(y))).finally(()=>a(Dt(E)))},"createIuThunk"),"createIu"),ts=n(t=>({type:ar,payload:t}),"setLocale"),rs=n(t=>({type:We,payload:t}),"setConfig"),os=n(t=>({type:cr,payload:t}),"setBenefitMessages"),ns=n((t,e,r)=>({type:lr,payload:{selector:t,markup:e,config:r}}),"addTemplate"),is=n(t=>({type:pr,payload:t}),"setTemplates"),ss=n((t,e)=>({type:ur,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),as=n((t,e)=>({type:dr,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),cs=n(t=>({type:pe,payload:t}),"receiveMerchantSettings");var qt="OG_STATE",us=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),Ho=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),ds=n(()=>Ho()?{}:us(localStorage.getItem(qt)),"loadState"),Dl=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"),fs=n(t=>{if(Ho())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=Dl(t);e&&localStorage.getItem(qt)!==e&&localStorage.setItem(qt,e)},"saveState"),hs=n(t=>(0,ps.throttle)(500,e=>{if(Ho())return;let{key:r,newValue:o}=e;r===qt&&o===null?(t.dispatch({type:he}),setTimeout(()=>t.dispatch(Zi()),0)):r===qt&&t.dispatch({type:we,newValue:us(o)})}),"listenLocalStorageChanges");var gs=ce(Zt());var ql=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),ms=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>ql("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Ul=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===D],fn:ms(!0)},{expressions:[({type:t}={})=>t===F],fn:ms(!1)}],ys=n(t=>e=>r=>{let o=t.getState();Ul.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),bs=n(t=>e=>r=>{var i;let o;switch(r.type){case T:case F:case R:case D: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"),Ss=n(t=>e=>r=>{e(r);let o=(0,gs.throttle)(500,()=>{fs({...t.getState()})});r.type!==we&&o()},"localStorageMiddleware");var Ut=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function _s(t){let[e,r]=Ut(),[o,i]=Ut(),[s,a]=Ut();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch($o(l)):a(p)});let c=Promise.all([o,e,s]);return c.then(()=>{var l;t.dispatch({type:nr,payload:{}}),window.addEventListener("storage",hs(t)),(l=t.getState().auth)!=null&&l.ts||t.dispatch(Ki())}),l=>async p=>{Ge===p.type||Be===p.type||He===p.type||ze===p.type?r(p.payload):Ve===p.type?i(p.payload):je===p.type?a(p.payload):await c,l(p)}}n(_s,"waitUntilOffersReady");function Es(t){return e=>r=>{if(r.type===L){let{merchantId:o,sessionId:i,environment:{apiUrl:s}}=t.getState(),a=b(r.payload.product);a&&Ni.fetchOffer(s,o,i,a,r.payload.module||Ke,r.payload.searchParams).then(c=>t.dispatch(Se(c,r.payload.offer,a)),c=>t.dispatch(Ar(c))).finally(()=>t.dispatch(Dt(r)))}return e(r)}}n(Es,"offerRequestMiddleware");var Ts=ce(vs());function Vl(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=Ts.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(Vl,"getVariantIx");function qr(t={},e){var r;switch(e.type){case pe:return{...t,...e.payload.experiments};case Ro:return{...t,currentVariant:e.payload.index,offerProfileId:(r=e.payload.parameters)==null?void 0:r.offer_profile_public_id};default:return t}}n(qr,"experimentsReducer");function jl(t,e,r){if(!t||r.variants.length===0)return;let o=e.selling_plan_groups.filter(Er);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(jl,"resolveShopifySetupProductWhenExperiment");function Gl(t,e){let r=t==null?void 0:t.public_id;if(!r)return null;let o=t.variants,i=Vl(`${r}|${e}`,o);return{...o[i],index:i}}n(Gl,"getAssignedExperimentVariant");function ws(t){let[e,r]=Ut(),o,i;return s=>async a=>{if(a.type===nr)r();else if(a.type===pe){await e,i=a.payload.experiments;let{sessionId:c}=t.getState();o=Gl(i,c),o&&t.dispatch({type:Ro,payload:o})}else if(a.type===L)await e,o&&(a.payload.searchParams={...a.payload.searchParams,variant:o.public_id});else if(a.type===q){await e;let c=jl(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(ws,"experimentsMiddleware");function Cs(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"}):wo,i=[_s,ai,ws,Es,ys,bs],s={};if(!r)try{s=ds(),i.push(Ss)}catch{}let a=o(ni(...i,...e.filter(l=>l))),c=To(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Cs,"makeStore");var Hl=Object.defineProperty,Ur=n((t,e)=>Hl(t,"name",{value:e,configurable:!0}),"i"),Bl=Ur(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),As=["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],Rs=Ur(t=>(e,r)=>{As.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function Yo(t=window.opener,e=window.og){let r=Ur(o=>{let i=Bl(As),s=Rs(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.9/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),Rs(t)("READY"))}n(Yo,"h");Ur(Yo,"offersLiveEditor");var Lr=null,zl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Is=n(t=>{if(!Lr)throw new Error("Missing redux store.");return Lr},"resolveStore"),Yl=n((t,e)=>r=>{let{getState:o,dispatch:i}=Is(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),m=n((t,e=zl)=>r=>{let i=Yl(t,typeof e=="function"?e:s=>oi(e,s));return class extends r{get store(){return Lr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Is(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"),Ns=n(t=>{Lr=t},"setStore");var Wo=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},...wt(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"),Mr=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 Jo=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var ke=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var B=`{{lit-${String(Math.random()).slice(2)}}}`,Ko=`<!--${B}-->`,ks=new RegExp(`${B}|${Ko}`),st="$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 f=s.nextNode();if(f===null){s.currentNode=i.pop();continue}if(c++,f.nodeType===1){if(f.hasAttributes()){let h=f.attributes,{length:w}=h,P=0;for(let g=0;g<w;g++)Fs(h[g].name,st)&&P++;for(;P-- >0;){let g=p[l],O=$r.exec(g)[2],E=O.toLowerCase()+st,y=f.getAttribute(E);f.removeAttribute(E);let v=y.split(ks);this.parts.push({type:"attribute",index:c,name:O,strings:v}),l+=v.length-1}}f.tagName==="TEMPLATE"&&(i.push(f),s.currentNode=f.content)}else if(f.nodeType===3){let h=f.data;if(h.indexOf(B)>=0){let w=f.parentNode,P=h.split(ks),g=P.length-1;for(let O=0;O<g;O++){let E,y=P[O];if(y==="")E=ie();else{let v=$r.exec(y);v!==null&&Fs(v[2],st)&&(y=y.slice(0,v.index)+v[1]+v[2].slice(0,-st.length)+v[3]),E=document.createTextNode(y)}w.insertBefore(E,f),this.parts.push({type:"node",index:++c})}P[g]===""?(w.insertBefore(ie(),f),o.push(f)):f.data=P[g],l+=g}}else if(f.nodeType===8)if(f.data===B){let h=f.parentNode;(f.previousSibling===null||c===a)&&(c++,h.insertBefore(ie(),f)),a=c,this.parts.push({type:"node",index:c}),f.nextSibling===null?f.data="":(o.push(f),c--),l++}else{let h=-1;for(;(h=f.data.indexOf(B,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let f of o)f.parentNode.removeChild(f)}};n(_e,"Template");var Fs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Lt=n(t=>t.index!==-1,"isTemplatePartActive"),ie=n(()=>document.createComment(""),"createMarker"),$r=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Qo=133;function Zo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Qo,null,!1),s=Mt(o),a=o[s],c=-1,l=0,p=[],u=null;for(;i.nextNode();){c++;let f=i.currentNode;for(f.previousSibling===u&&(u=null),e.has(f)&&(p.push(f),u===null&&(u=f)),u!==null&&l++;a!==void 0&&a.index===c;)a.index=u!==null?-1:a.index-l,s=Mt(o,s),a=o[s]}p.forEach(f=>f.parentNode.removeChild(f))}n(Zo,"removeNodesFromTemplate");var Jl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Qo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Mt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Lt(o))return r}return-1},"nextActiveIndexInTemplateParts");function Ds(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Qo,null,!1),a=Mt(i),c=0,l=-1;for(;s.nextNode();)for(l++,s.currentNode===r&&(c=Jl(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===l;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Mt(i,a);return}a=Mt(i,a)}}n(Ds,"insertNodeIntoTemplate");var qs=new WeakMap,Xo=n(t=>(...e)=>{let r=t(...e);return qs.set(r,!0),r},"directive"),Fe=n(t=>typeof t=="function"&&qs.has(t),"isDirective");var $={},Vr={};var de=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=Jo?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],!Lt(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 Jo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(de,"TemplateInstance");var Us=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Ql=` ${B} `,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=$r.exec(s);c===null?r+=s+(o?Ql:Ko):r+=s.substr(0,c.index)+c[1]+c[2]+st+c[3]+B}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Us!==void 0&&(r=Us.createHTML(r)),e.innerHTML=r,e}};n(se,"TemplateResult");var Gr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),jr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),De=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 Ee(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"||!jr(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(Gr(c)||!jr(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(De,"AttributeCommitter");var Ee=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==$&&(!Gr(e)||e!==this.value)&&(this.value=e,Fe(e)||(this.committer.dirty=!0))}commit(){for(;Fe(this.value);){let e=this.value;this.value=$,e(this)}this.value!==$&&this.committer.commit()}};n(Ee,"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(;Fe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}let e=this.__pendingValue;e!==$&&(Gr(e)?e!==this.value&&this.__commitText(e):e instanceof se?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):jr(e)?this.__commitIterable(e):e===Vr?(this.value=Vr,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 de&&this.value.template===r)this.value.update(e.values);else{let o=new de(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){ke(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ae,"NodePart");var at=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(;Fe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}if(this.__pendingValue===$)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=$}};n(at,"BooleanAttributePart");var ct=class extends De{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new $t(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(ct,"PropertyCommitter");var $t=class extends Ee{};n($t,"PropertyPart");var Ls=!1;(()=>{try{let t={get capture(){return Ls=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var lt=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(;Fe(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=$,s(this)}if(this.__pendingValue===$)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=Zl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=$}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(lt,"EventPart");var Zl=n(t=>t&&(Ls?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function en(t){let e=qe.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},qe.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(B);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(en,"templateFactory");var qe=new Map;var xe=new WeakMap,tn=n((t,e,r)=>{let o=xe.get(e);o===void 0&&(ke(e,e.firstChild),xe.set(e,o=new ae(Object.assign({templateFactory:en},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Vt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new ct(e,r.slice(1),o).parts:s==="@"?[new lt(e,r.slice(1),i.eventContext)]:s==="?"?[new at(e,r.slice(1),o)]:new De(e,r,o).parts}handleTextExpression(e){return new ae(e)}};n(Vt,"DefaultTemplateProcessor");var rn=new Vt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var d=n((t,...e)=>new se(t,e,"html",rn),"html");var $s=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Hr=!0;typeof window.ShadyCSS>"u"?Hr=!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."),Hr=!1);var ep=n(t=>e=>{let r=$s(e.type,t),o=qe.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},qe.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(B);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Hr&&window.ShadyCSS.prepareTemplateDom(a,t),i=new _e(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),tp=["html","svg"],rp=n(t=>{tp.forEach(e=>{let r=qe.get($s(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)}),Zo(o,s)})})},"removeStylesFromLitTemplates"),Vs=new Set,op=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 u=i[p];u.parentNode.removeChild(u),a.textContent+=u.textContent}rp(t);let c=o.content;r?Ds(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),Zo(r,p)}},"prepareTemplateStyles"),js=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=xe.has(e),s=Hr&&e.nodeType===11&&!!e.host,a=s&&!Vs.has(o),c=a?document.createDocumentFragment():e;if(tn(t,c,Object.assign({templateFactory:ep(o)},r)),a){let l=xe.get(c);xe.delete(c);let p=l.value instanceof de?l.value.template:void 0;op(o,c,p),ke(e,e.firstChild),e.appendChild(c),xe.set(e,l)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Gs;window.JSCompiler_renameProperty=(t,e)=>t;var ln={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}},Hs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),on={attribute:!0,type:String,converter:ln,reflect:!1,hasChanged:Hs},nn=1,sn=1<<2,an=1<<3,cn=1<<4,pn="finalized",pt=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=on){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)||on}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(pn)||e.finalize(),this[pn]=!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=Hs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||ln,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||ln.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=on){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|an,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~an}}_attributeToProperty(e,r){if(this._updateState&an)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|cn,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~cn}}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&cn)&&(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|sn;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&sn}get hasUpdated(){return this._updateState&nn}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&nn||(this._updateState=this._updateState|nn,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~sn}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(pt,"UpdatingElement");Gs=pn;pt[Gs]=!0;var Bs=Element.prototype,Eh=Bs.msMatchesSelector||Bs.webkitMatchesSelector;var Br=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,un=Symbol(),ut=class{constructor(e,r){if(r!==un)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Br?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(ut,"CSSResult");var zs=n(t=>new ut(String(t),un),"unsafeCSS"),np=n(t=>{if(t instanceof ut)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
10
+ take care to ensure page security.`)},"textFromCSSResult"),S=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+np(i)+t[s+1],t[0]);return new ut(r,un)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Ys={},_=class extends pt{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&&!Br){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return zs(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):Br?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!==Ys&&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 Ys}};n(_,"LitElement");_.finalized=!0;_.render=js;var ua=ce(na());var up=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"),ia=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var jt=n(t=>{let e=ia(t);if(!e){let r=t.offer;r&&(e=ia(r))}return e},"resolveProduct"),dp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),dn=n(t=>class extends t{get offer(){return dp(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"),C=n(t=>class extends dn(t){get product(){return jt(this)}},"withProduct"),Yr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=up(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Wr={};Xn(Wr,{autoshipByDefault:()=>fp,eligibilityGroups:()=>hn,eligible:()=>sa,hasPrepaidOptions:()=>bp,hasUpcomingOrder:()=>la,hasUpsellGroup:()=>ca,inStock:()=>fn,optedout:()=>gp,prepaidEligible:()=>hp,prepaidSubscribed:()=>yp,regularEligible:()=>_p,subscribed:()=>mp,subscriptionEligible:()=>aa,upcomingOrderContainsProduct:()=>Sp,upsellEligible:()=>pa});var fn=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),sa=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),fp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),aa=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&sa(t,e)&&fn(t,e),"subscriptionEligible"),hn=n((t,e)=>{let r=b((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),ca=n((t,e)=>{let r=hn(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),hp=n((t,e)=>{let r=hn(t,e);return(r==null?void 0:r.some(o=>o===gr.PREPAID))||!1},"prepaidEligible"),mp=n((t,e)=>vr(e.product)(t),"subscribed"),gp=n((t,e)=>Tr(e.product)(t),"optedout"),yp=n((t,e)=>Li(e.product)(t),"prepaidSubscribed"),bp=n((t,e)=>G(e.product.id)(t).length>0,"hasPrepaidOptions"),la=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Sp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),pa=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&fn(t,e)&&la(t)&&ca(t,e)},"upsellEligible"),_p=n((t,e)=>aa(t,e)&&!pa(t,e),"regularEligible");var Ep=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Jr=class extends C(_){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return d``;let e=Ep(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),ua.default.parse(e,o=>Wr[o]&&Wr[o](this.state,this))?d`
11
11
  <slot></slot>
12
- `:d``}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(Wr,"When");var yp=n(t=>({state:t}),"mapStateToProps"),ca=m(yp)(Wr);var la={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Oe={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&No(t)?t:null}}},Jr={type:Boolean,attribute:!0,reflect:!0},ht={type:Object,attribute:!1};var bp=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"),Y=bp(E);var W=class extends N(Y){static get properties(){return{subscribed:Jr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return b`
12
+ `:d``}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 xp=n(t=>({state:t}),"mapStateToProps"),da=m(xp)(Jr);var fa={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Oe={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Fo(t)?t:null}}},Kr={type:Boolean,attribute:!0,reflect:!0},ht={type:Object,attribute:!1};var Pp=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"),Y=Pp(_);var W=class extends C(Y){static get properties(){return{subscribed:Kr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return S`
13
13
  :host {
14
14
  cursor: default;
15
15
  display: inline-block;
@@ -83,7 +83,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
83
83
  <slot name="frequency-mismatch"></slot>
84
84
  `:d`
85
85
  <slot name="not-subscribed"></slot>
86
- `}};n(W,"OptinStatus");var X=n((t,e={})=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:tt((e.product||{}).id)(t),prepaidShipmentsOptedIn:j(e.product)(t),defaultFrequency:ne((r=e.product)==null?void 0:r.id)(t)||H(e,"defaultFrequency"),frequencies:rt((o=e.product)==null?void 0:o.id)(t)||H(e,"frequencies"),...ot(t,e),productFrequencies:K(e.product)(t)}},"mapStateToProps"),pa=m(X)(W);var mt=class extends W{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:Oe,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(R.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=kt(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,R.shopify_selling_plans&&this.store&&(e=kt(e,this.productFrequencies)),e}handleClick(e){this.optinProduct(jt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
86
+ `}};n(W,"OptinStatus");var X=n((t,e={})=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:tt((e.product||{}).id)(t),prepaidShipmentsOptedIn:j(e.product)(t),defaultFrequency:ne((r=e.product)==null?void 0:r.id)(t)||H(e,"defaultFrequency"),frequencies:rt((o=e.product)==null?void 0:o.id)(t)||H(e,"frequencies"),...ot(t,e),productFrequencies:K(e.product)(t)}},"mapStateToProps"),ha=m(X)(W);var mt=class extends W{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:Oe,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(A.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=kt(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,A.shopify_selling_plans&&this.store&&(e=kt(e,this.productFrequencies)),e}handleClick(e){this.optinProduct(jt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
87
87
  <slot name="default">
88
88
  <button
89
89
  aria-labelledby="ogOfferOptInLabel"
@@ -97,7 +97,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
97
97
  </slot>
98
98
  </label>
99
99
  </slot>
100
- `}};n(mt,"OptinButton");var ua=m(X,{optinProduct:Z})(mt);var Kr=class extends W{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
100
+ `}};n(mt,"OptinButton");var ma=m(X,{optinProduct:Z})(mt);var Qr=class extends W{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
101
101
  <slot name="default">
102
102
  <button
103
103
  aria-labelledby="ogOfferOptOutLabel"
@@ -111,13 +111,13 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
111
111
  </slot>
112
112
  </label>
113
113
  </slot>
114
- `}};n(Kr,"OptoutButton");var da=m(X,{optoutProduct:it})(Kr);var Le=n((t,e)=>{let{every:r,every_period:o}=wt(t);return r&&o?d`
114
+ `}};n(Qr,"OptoutButton");var ga=m(X,{optoutProduct:it})(Qr);var Le=n((t,e)=>{let{every:r,every_period:o}=wt(t);return r&&o?d`
115
115
  ${r}
116
116
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
117
117
  ${e&&e===t?d`
118
118
  <og-text key="defaultFrequencyCopy"></og-text>
119
119
  `:""}
120
- `:t},"frequencyText"),gt=class extends N(Y){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Jr,frequency:{type:String},defaultFrequency:Oe,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:Ci}}}}static get styles(){return b`
120
+ `:t},"frequencyText"),gt=class extends C(Y){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Kr,frequency:{type:String},defaultFrequency:Oe,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:Ii}}}}static get styles(){return S`
121
121
  :host[hidden] {
122
122
  display: none;
123
123
  }
@@ -136,7 +136,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
136
136
  <slot name="frequency-mismatch"></slot>
137
137
  `||""}
138
138
  </span>
139
- `}};n(gt,"FrequencyStatus");var Gt=n((t,e)=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:tt((e.product||{}).id)(t),frequencies:rt((r=e.product)==null?void 0:r.id)(t)||H(e,"frequencies"),defaultFrequency:ne((o=e.product)==null?void 0:o.id)(t)||H(e,"defaultFrequency"),...ot(t,e),productFrequencies:K(e.product)(t)}},"mapStateToProps"),fa=m(Gt)(gt);var Qr=class extends zr(W){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Oe,selectLabel:{type:String,attribute:"select-label"}}}static get styles(){return b`
139
+ `}};n(gt,"FrequencyStatus");var Gt=n((t,e)=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:tt((e.product||{}).id)(t),frequencies:rt((r=e.product)==null?void 0:r.id)(t)||H(e,"frequencies"),defaultFrequency:ne((o=e.product)==null?void 0:o.id)(t)||H(e,"defaultFrequency"),...ot(t,e),productFrequencies:K(e.product)(t)}},"mapStateToProps"),ya=m(Gt)(gt);var Zr=class extends Yr(W){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Oe,selectLabel:{type:String,attribute:"select-label"}}}static get styles(){return S`
140
140
  :host {
141
141
  display: inline-block;
142
142
  cursor: pointer;
@@ -153,7 +153,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
153
153
  .onChange="${({target:{value:i}})=>this.onOptinChange(i)}"
154
154
  .ariaLabel="${this.selectLabel}"
155
155
  ></og-select>
156
- `}};n(Qr,"OptinSelect");var ha=m((t,e)=>{var r;return{...X(t,e),...Gt(t,e),frequencies:rt((r=e.product)==null?void 0:r.id)(t)||H(e,"frequencies")}},{productChangeFrequency:Ar,optoutProduct:it})(Qr);var Zr=class extends N(Y){static get styles(){return b`
156
+ `}};n(Zr,"OptinSelect");var ba=m((t,e)=>{var r;return{...X(t,e),...Gt(t,e),frequencies:rt((r=e.product)==null?void 0:r.id)(t)||H(e,"frequencies")}},{productChangeFrequency:Ir,optoutProduct:it})(Zr);var Xr=class extends C(Y){static get styles(){return S`
157
157
  :host[hidden] {
158
158
  display: none;
159
159
  }
@@ -164,7 +164,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
164
164
  <slot>
165
165
  <og-next-upcoming-order></og-next-upcoming-order>
166
166
  </slot>
167
- `}};n(Zr,"UpsellButton");var Sp=n(t=>({isPreview:t.previewUpsellOffer,nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder}),"mapStateToProps"),ma=m(Sp,{fetchOrders:Nr,createIu:kr,concludeUpsell:Ir})(Zr);var Xr=class extends N(Y){static get properties(){return{...super.properties,defaultFrequency:Oe,auth:ht,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 d`
167
+ `}};n(Xr,"UpsellButton");var Op=n(t=>({isPreview:t.previewUpsellOffer,nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder}),"mapStateToProps"),Sa=m(Op,{fetchOrders:kr,createIu:Fr,concludeUpsell:Nr})(Xr);var eo=class extends C(Y){static get properties(){return{...super.properties,defaultFrequency:Oe,auth:ht,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 d`
168
168
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
169
169
  <div slot="content">
170
170
  <slot>
@@ -202,7 +202,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
202
202
  </slot>
203
203
  </span>
204
204
  </og-modal>
205
- `}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(Xr,"UpsellModal");var _p=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)||H(e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}},"mapStateToProps"),ga=m(_p,{concludeUpsell:Ir,createIu:kr})(Xr);var eo=class extends W{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return b`
205
+ `}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(eo,"UpsellModal");var vp=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)||H(e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}},"mapStateToProps"),_a=m(vp,{concludeUpsell:Nr,createIu:Fr})(eo);var to=class extends W{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return S`
206
206
  :host {
207
207
  cursor: default;
208
208
  display: inline-block;
@@ -243,13 +243,19 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
243
243
  </slot>
244
244
  </label>
245
245
  </slot>
246
- `}};n(eo,"OptinToggle");var ya=m(X,{optoutProduct:it,optinProduct:Z})(eo);var Ep=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),to=class extends pn(E){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&&Ep(e,this.pluralize)}render(){return d`
246
+ `}};n(to,"OptinToggle");var Ea=m(X,{optoutProduct:it,optinProduct:Z})(to);var Tp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),ro=class extends dn(_){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&&Tp(e,this.pluralize)}render(){return d`
247
247
  ${this.getText()}
248
- `}};n(to,"Text");var xp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),ba=m(xp)(to);var Me=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Me,"DiscountAmount");var yt=class extends Me{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(yt,"DiscountPercent");var ro=class extends yt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(ro,"ShippingDiscountPercent");var fn="Discount Percent",hn="Discount Amount",Sa="total_price",_a="shipping_total",Ea="sub_total",mn=n(({field:t,object:e,type:r,value:o})=>{let s=[[new yt(o),{field:Sa,object:"item",type:fn}],[new Me(o),{field:Sa,object:"item",type:hn}],[new ro(o),{field:_a,object:"order",type:fn}],[new Me(o),{field:_a,object:"order",type:hn}],[new yt(o),{field:Ea,object:"order",type:fn}],[new Me(o),{field:Ea,object:"order",type:hn}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Pp(t,{incentiveValue:e,incentiveClass:r}){return!(mn(t).className!==r||e&&e.toString()!==t.value.toString())}n(Pp,"isMatchingIncentive");var Op=[ge.PSI,ge.PROGRAM_WIDE],oo=class extends N(E){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]||[],s=i.filter(c=>c.criteria&&c.criteria.node_type==="PREMISE"&&!c.threshold_field&&Op.includes(c.criteria.standard)),a=[...s,...i.filter(c=>!s.includes(c))].find(c=>Pp(c,{incentiveClass:e,incentiveValue:r}));return d`
249
- ${this.label} ${a?mn(a):this.renderFallback()}
248
+ `}};n(ro,"Text");var wp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),xa=m(wp)(ro);var Me=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Me,"DiscountAmount");var yt=class extends Me{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(yt,"DiscountPercent");var oo=class extends yt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(oo,"ShippingDiscountPercent");var mn="Discount Percent",gn="Discount Amount",Pa="total_price",Oa="shipping_total",va="sub_total",yn=n(({field:t,object:e,type:r,value:o})=>{let s=[[new yt(o),{field:Pa,object:"item",type:mn}],[new Me(o),{field:Pa,object:"item",type:gn}],[new oo(o),{field:Oa,object:"order",type:mn}],[new Me(o),{field:Oa,object:"order",type:gn}],[new yt(o),{field:va,object:"order",type:mn}],[new Me(o),{field:va,object:"order",type:gn}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Cp(t,{incentiveValue:e,incentiveClass:r}){return!(yn(t).className!==r||e&&e.toString()!==t.value.toString())}n(Cp,"isMatchingIncentive");var Rp=[ge.PSI,ge.PROGRAM_WIDE],no=class extends C(_){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]||[],s=i.filter(c=>c.criteria&&c.criteria.node_type==="PREMISE"&&!c.threshold_field&&Rp.includes(c.criteria.standard)),a=[...s,...i.filter(c=>!s.includes(c))].find(c=>Cp(c,{incentiveClass:e,incentiveValue:r}));return d`
249
+ ${this.label} ${a?yn(a):this.renderFallback()}
250
250
  `}renderFallback(){return d`
251
- ${mn({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
252
- `}};n(oo,"IncentiveText");var vp=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"),xa=m(vp)(oo);var no=class extends zr(gt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return b`
251
+ ${yn({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
252
+ `}};n(no,"IncentiveText");var Ap=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&b((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Ta=m(Ap)(no);var io=class extends C(_){static get properties(){return{...super.properties,messages:{type:Array,attribute:!1}}}createRenderRoot(){return this}render(){var e;return(e=this.messages)!=null&&e.length?d`
253
+ <ul class="og-benefit-messages">
254
+ ${this.messages.map(r=>d`
255
+ <li>${r}</li>
256
+ `)}
257
+ </ul>
258
+ `:d``}};n(io,"BenefitMessages");var Ip=n((t,e)=>{var c;let r=b((c=e==null?void 0:e.product)==null?void 0:c.id),o=(t.incentives||{})[r],i=t.benefitMessages||{};if(!o)return{messages:[]};let s=new Set,a=[];return[o.initial,o.ongoing].forEach(l=>{(l||[]).forEach(p=>{let u=p==null?void 0:p.id;if(!u||s.has(u))return;s.add(u);let f=i[u];f&&a.push(f)})}),{messages:a}},"mapStateToProps"),wa=m(Ip)(io);var so=class extends Yr(gt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return S`
253
259
  :host {
254
260
  display: inline-block;
255
261
  cursor: pointer;
@@ -269,9 +275,9 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
269
275
  .selected="${this.currentFrequency}"
270
276
  .onChange="${({target:{value:i}})=>{this.productChangeFrequency(this.product,i,this.offer)}}"
271
277
  ></og-select>
272
- `}};n(no,"SelectFrequency");var Pa=m(Gt,{productChangeFrequency:Ar})(no);var Tp={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 Oa=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Tp[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 io=class extends E{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
273
- ${Oa(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
274
- `}};n(io,"FormattedDate");var wp=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),va=m(wp)(io);var Ca=ce(Ot());var Ta=n((t,e,r)=>n(async function(i){await i({type:fe,payload:{isPreview:t,productId:e}}),await i({type:Te}),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"),Cp=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"),Rp=n((t,e,r)=>n(async function(i,s){await i({type:xt,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(Mo({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(Ft(a,"sig_field","ts","sig"))):await i(ye())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Ap=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:To,payload:{isPreview:t,productId:e}}),await i({type:Te}),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:Je,payload:Cp(a,Lr({[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:We,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),wa=n((t,e,r)=>async function(o,i){switch(await o({type:he}),await o({type:fe,payload:{isPreview:!1,productId:r.product.id}}),await o({type:xt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(Ta(!0,r.product.id,r));break;case"upsell":o(Rp(!0,r.product.id,r));break;case"subscribed":o(Ta(!0,r.product.id,r)),o(Z(r.product,"2_2"));break;case"prepaid":o(Ap(!0,r.product.id,r)),o(Z(r.product,"1_3"));break;default:}},"setPreview");var Ip=n((...t)=>JSON.stringify(t),"memoizeKey"),Ra=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),Np=Ra((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.`),Ig=Ra(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),kp=(0,Ca.default)((t,e)=>Object.assign({components:e},t),Ip),so=class extends Y{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:la,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ht,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},overrideSellingPlanPrice:{type:Boolean,attribute:"dev-override-selling-plan-price"}}}firstUpdated(){try{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")}catch(e){console.warn("Unable to set preview property",e)}}static get styles(){return b`
278
+ `}};n(so,"SelectFrequency");var Ca=m(Gt,{productChangeFrequency:Ir})(so);var Np={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 Ra=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Np[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 ao=class extends _{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
279
+ ${Ra(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
280
+ `}};n(ao,"FormattedDate");var kp=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Aa=m(kp)(ao);var ka=ce(Ot());var Ia=n((t,e,r)=>n(async function(i){await i({type:fe,payload:{isPreview:t,productId:e}}),await i({type:Te}),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"),Fp=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"),Dp=n((t,e,r)=>n(async function(i,s){await i({type:xt,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(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(Ft(a,"sig_field","ts","sig"))):await i(ye())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),qp=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:Co,payload:{isPreview:t,productId:e}}),await i({type:Te}),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:Je,payload:Fp(a,Mr({[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:We,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),Na=n((t,e,r)=>async function(o,i){switch(await o({type:he}),await o({type:fe,payload:{isPreview:!1,productId:r.product.id}}),await o({type:xt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(Ia(!0,r.product.id,r));break;case"upsell":o(Dp(!0,r.product.id,r));break;case"subscribed":o(Ia(!0,r.product.id,r)),o(Z(r.product,"2_2"));break;case"prepaid":o(qp(!0,r.product.id,r)),o(Z(r.product,"1_3"));break;default:}},"setPreview");var Up=n((...t)=>JSON.stringify(t),"memoizeKey"),Fa=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),Lp=Fa((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.`),Gg=Fa(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),Mp=(0,ka.default)((t,e)=>Object.assign({components:e},t),Up),co=class extends Y{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:fa,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ht,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},overrideSellingPlanPrice:{type:Boolean,attribute:"dev-override-selling-plan-price"}}}firstUpdated(){try{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")}catch(e){console.warn("Unable to set preview property",e)}}static get styles(){return S`
275
281
  :host[hidden] {
276
282
  display: none;
277
283
  }
@@ -422,9 +428,9 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
422
428
  </og-when>
423
429
  </og-when>
424
430
 
425
- `}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&&Tr(()=>this.fetchOffer(this.product.id,Ke,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=kp(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});I(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=>I(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)?(Np(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):!0}render(){return this.shouldEnableOffer?d`
431
+ `}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&&wr(()=>this.fetchOffer(this.product.id,Ke,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=Mp(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});N(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=>N(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)?(Lp(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):!0}render(){return this.shouldEnableOffer?d`
426
432
  <slot></slot>
427
- `: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=qo(e);if(this.hasAttribute(r)){let o=this.getAttribute(r);return o.toString().toLowerCase()==="true"?!0:o.toString().toLowerCase()==="false"?!1:o}}};n(so,"Offer");var Fp=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:tt((e.product||{}).id)(t),autoshipByDefault:t.config&&t.config.autoshipByDefault||H(e,"autoshipByDefault",Fo(t)[(e.product||{}).id]),...vr(e.product)(t)&&{autoshipByDefault:!1},optedin:Nt(t),subscribed:te(e.product)(t),...ot(t)}},"mapStateToProps"),Aa=m(Fp,{fetchOffer:Ki,fetchOrders:Nr,productHasChangedComponents:Hi,optinProduct:Z,setFirstOrderPlaceDate:rs,setProductToSubscribe:os,setPreview:wa})(so);var Ht=class extends E{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`
433
+ `: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=Lo(e);if(this.hasAttribute(r)){let o=this.getAttribute(r);return o.toString().toLowerCase()==="true"?!0:o.toString().toLowerCase()==="false"?!1:o}}};n(co,"Offer");var $p=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:tt((e.product||{}).id)(t),autoshipByDefault:t.config&&t.config.autoshipByDefault||H(e,"autoshipByDefault",qo(t)[(e.product||{}).id]),...Tr(e.product)(t)&&{autoshipByDefault:!1},optedin:Nt(t),subscribed:te(e.product)(t),...ot(t)}},"mapStateToProps"),Da=m($p,{fetchOffer:Xi,fetchOrders:kr,productHasChangedComponents:Yi,optinProduct:Z,setFirstOrderPlaceDate:ss,setProductToSubscribe:as,setPreview:Na})(co);var Ht=class extends _{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 S`
428
434
  :host[hidden] {
429
435
  display: none;
430
436
  }
@@ -569,7 +575,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
569
575
  </div>
570
576
  </div>
571
577
  </div>
572
- `:d``}};n(Ht,"Modal");var gn=new WeakMap,Bt=Qo(t=>e=>{let r=gn.get(e);if(t===void 0&&e instanceof Ee){if(r!==void 0||!gn.has(e)){let o=e.committer.name;e.committer.element.removeAttribute(o)}}else t!==r&&e.setValue(t);gn.set(e,t)});var zt=class extends E{static get styles(){return b`
578
+ `:d``}};n(Ht,"Modal");var bn=new WeakMap,Bt=Xo(t=>e=>{let r=bn.get(e);if(t===void 0&&e instanceof Ee){if(r!==void 0||!bn.has(e)){let o=e.committer.name;e.committer.element.removeAttribute(o)}}else t!==r&&e.setValue(t);bn.set(e,t)});var zt=class extends _{static get styles(){return S`
573
579
  :host {
574
580
  display: inline-block;
575
581
  color: inherit;
@@ -634,7 +640,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
634
640
  `)}
635
641
  </select>
636
642
  <span>&#9660;</span>
637
- `}};n(zt,"Select");var ve={AUTOMATIC:"automatic",MANUAL:"manual"},Yt=class extends E{constructor(){super(),this.triggerLabel="Show tooltip",this.open=!1,this.activationType=ve.AUTOMATIC}static get properties(){return{placement:{type:String,default:"bottom"},triggerLabel:{type:String,attribute:"trigger-label"},activationType:{type:String,attribute:"activation-type"},open:{type:Boolean,attribute:!1}}}static get styles(){return b`
643
+ `}};n(zt,"Select");var ve={AUTOMATIC:"automatic",MANUAL:"manual"},Yt=class extends _{constructor(){super(),this.triggerLabel="Show tooltip",this.open=!1,this.activationType=ve.AUTOMATIC}static get properties(){return{placement:{type:String,default:"bottom"},triggerLabel:{type:String,attribute:"trigger-label"},activationType:{type:String,attribute:"activation-type"},open:{type:Boolean,attribute:!1}}}static get styles(){return S`
638
644
  :host[hidden] {
639
645
  display: none;
640
646
  }
@@ -822,7 +828,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
822
828
  <slot name="content">${this.content}</slot>
823
829
  </div>
824
830
  </span>
825
- `}};n(Yt,"Tooltip");var J=class extends N(E){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:It(this.options)}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return d``}};n(J,"PrepaidStatus");var Dp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),Jg=m(Dp,{productChangePrepaidShipments:be})(J);var ao=class extends J{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return b`
831
+ `}};n(Yt,"Tooltip");var J=class extends C(_){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:It(this.options)}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return d``}};n(J,"PrepaidStatus");var Vp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),ay=m(Vp,{productChangePrepaidShipments:be})(J);var lo=class extends J{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return S`
826
832
  og-select {
827
833
  display: inline-block;
828
834
  cursor: pointer;
@@ -856,18 +862,18 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
856
862
  <slot name="append"></slot>
857
863
  </label>
858
864
  </div>
859
- `}};n(ao,"PrepaidToggle");var qp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),Ia=m(qp,{productChangePrepaidShipments:be})(ao);var co=class extends J{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`
865
+ `}};n(lo,"PrepaidToggle");var jp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),qa=m(jp,{productChangePrepaidShipments:be})(lo);var po=class extends J{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 S`
860
866
  :host {
861
867
  display: inline-block;
862
868
  text-indent: initial;
863
869
  }
864
- `}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:f}=i;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?u:this.perDeliverySavings?p:this.percentageSavings?s:this.extraPercentageSavings?f:this.numberOfShipments?c:""}render(){let e=this.value;return e?d`
870
+ `}get value(){let e=b(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:f}=i;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?u:this.perDeliverySavings?p:this.percentageSavings?s:this.extraPercentageSavings?f:this.numberOfShipments?c:""}render(){let e=this.value;return e?d`
865
871
  <slot name="prepend"></slot>
866
872
  ${e}
867
873
  <slot name="append"></slot>
868
874
  `:d`
869
875
  <slot name="fallback"></slot>
870
- `}};n(co,"PrepaidData");var Up=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Na=m(Up)(co);var lo=class extends J{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return b`
876
+ `}};n(po,"PrepaidData");var Gp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Ua=m(Gp)(po);var uo=class extends J{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return S`
871
877
  :host {
872
878
  cursor: pointer;
873
879
  display: inline-block;
@@ -921,7 +927,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
921
927
  <slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
922
928
  </label>
923
929
  </slot>
924
- `}};n(lo,"PrepaidButton");var Lp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),ka=m(Lp,{productChangePrepaidShipments:be})(lo);var po=class extends J{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String},selectLabel:{type:String,attribute:"select-label"}}}static get styles(){return b`
930
+ `}};n(uo,"PrepaidButton");var Hp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),La=m(Hp,{productChangePrepaidShipments:be})(uo);var fo=class extends J{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String},selectLabel:{type:String,attribute:"select-label"}}}static get styles(){return S`
925
931
  og-select {
926
932
  display: inline-block;
927
933
  cursor: pointer;
@@ -943,7 +949,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
943
949
  <span>${e[0].text}</span>
944
950
  `}
945
951
  <slot name="append"></slot>
946
- `}};n(po,"PrepaidSelect");var Mp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),Fa=m(Mp,{productChangePrepaidShipments:be})(po);var uo=class extends mt{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(jt(this),r,this.offer)}e.preventDefault()}render(){return d`
952
+ `}};n(fo,"PrepaidSelect");var Bp=n((t,e)=>({options:G(e.product.id)(t),shipmentsOptedIn:j(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),Ma=m(Bp,{productChangePrepaidShipments:be})(fo);var ho=class extends mt{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(jt(this),r,this.offer)}e.preventDefault()}render(){return d`
947
953
  <slot name="default">
948
954
  <button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
949
955
  <label for="action-trigger">
@@ -952,7 +958,7 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
952
958
  </slot>
953
959
  </label>
954
960
  </slot>
955
- `}};n(uo,"SubscriptionButton");var Da=m(X,{optinProduct:Z})(uo);var Wt=class extends E{static get styles(){return b`
961
+ `}};n(ho,"SubscriptionButton");var $a=m(X,{optinProduct:Z})(ho);var Wt=class extends _{static get styles(){return S`
956
962
  :host {
957
963
  position: fixed;
958
964
  top: 5em;
@@ -1031,14 +1037,14 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
1031
1037
  <br />
1032
1038
  <button @click=${this.toggleUpsellNextOrder(r)}>upsell product is in next order</button>
1033
1039
  <br />
1034
- `)}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($o({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 d`
1040
+ `)}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(jo({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 d`
1035
1041
  <div>
1036
1042
  ${this.testsRan?this.resultsCodeBlock():d`
1037
1043
  <div>Click the button to run tests</div>
1038
1044
  `}
1039
1045
  <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
1040
1046
  </div>
1041
- `}};n(Wt,"TestWizard");function yn(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Wt);let e=document.createElement(t);document.body.appendChild(e)}n(yn,"default");var bn=[79,71,68,69,86],qa=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===bn[t]){let o=bn[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=bn.length&&yn()}else t=0},!1)},"enable");var fo=class extends N(Y){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},discountedProductPriceFromOffers:{type:Object}}}static get styles(){return b`
1047
+ `}};n(Wt,"TestWizard");function Sn(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Wt);let e=document.createElement(t);document.body.appendChild(e)}n(Sn,"default");var _n=[79,71,68,69,86],Va=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===_n[t]){let o=_n[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=_n.length&&Sn()}else t=0},!1)},"enable");var mo=class extends C(Y){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},discountedProductPriceFromOffers:{type:Object}}}static get styles(){return S`
1042
1048
  :host::before {
1043
1049
  clip-path: inset(100%);
1044
1050
  clip: rect(1px, 1px, 1px, 1px);
@@ -1056,12 +1062,12 @@ var lib=(()=>{var ic=Object.create;var bt=Object.defineProperty;var sc=Object.ge
1056
1062
  :host([regular])::before {
1057
1063
  content: 'Regular price';
1058
1064
  }
1059
- `}get value(){var l,p;let e=S(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[],i=this.payAsYouGo?o.find(u=>u.prepaidShipments===null||u.prepaidShipments===void 0):o.find(u=>u.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return(i.hasPriceAdjustments===!1||((p=this.offer)==null?void 0:p.overrideSellingPlanPrice))&&!i.prepaidShipments&&({regularPrice:s,discountRate:a,subscriptionPrice:c}=this.discountedProductPriceFromOffers),c===s&&!this.payAsYouGo?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?d`
1065
+ `}get value(){var l,p;let e=b(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[],i=this.payAsYouGo?o.find(u=>u.prepaidShipments===null||u.prepaidShipments===void 0):o.find(u=>u.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return(i.hasPriceAdjustments===!1||((p=this.offer)==null?void 0:p.overrideSellingPlanPrice))&&!i.prepaidShipments&&({regularPrice:s,discountRate:a,subscriptionPrice:c}=this.discountedProductPriceFromOffers),c===s&&!this.payAsYouGo?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?d`
1060
1066
  <slot name="prepend"></slot>
1061
1067
  ${e}
1062
1068
  <slot name="append"></slot>
1063
1069
  `:d`
1064
1070
  <slot name="fallback"></slot>
1065
- `}};n(fo,"Price");var Vp=n((t,e)=>{var r,o;return{productPlans:t.productPlans,configDefaultFrequency:ne((r=e.product)==null?void 0:r.id)(t),frequency:oe(e.product)(t),discountedProductPriceFromOffers:Li((o=e.product)==null?void 0:o.id)(t)}},"mapStateToProps"),Ua=m(Vp)(fo);function Sn(t){qa(),Cs(t);try{customElements.define("og-when",ca),customElements.define("og-text",ba),customElements.define("og-incentive-text",xa),customElements.define("og-offer",Aa),customElements.define("og-select-frequency",Pa),customElements.define("og-optout-button",da),customElements.define("og-optin-toggle",ya),customElements.define("og-optin-status",pa),customElements.define("og-optin-button",ua),customElements.define("og-optin-select",ha),customElements.define("og-upsell-button",ma),customElements.define("og-frequency-status",fa),customElements.define("og-modal",Ht),customElements.define("og-select",zt),customElements.define("og-tooltip",Yt),customElements.define("og-upsell-modal",ga),customElements.define("og-next-upcoming-order",va),customElements.define("og-price",Ua),customElements.define("og-prepaid-toggle",Ia),customElements.define("og-prepaid-data",Na),customElements.define("og-prepaid-button",ka),customElements.define("og-prepaid-select",Fa),customElements.define("og-subscription-button",Da)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Wi(o)),this},setMerchantId(o){return t.dispatch(Bi(o)),this},setAuthUrl(o){return t.dispatch(zi(o)),this},receiveMerchantSettings(o){return t.dispatch(ns(o)),this},getProductsForPurchasePost(o=[]){return zo(t.getState(),o)},getOptins(o=[]){return zo(t.getState(),o)},clear(){t.dispatch(Qi())},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,console.log("OG Offers preview mode enabled")),this},config(o){return t.dispatch(Xi(o)),this},setLocale(o){return t.dispatch(Zi(o)),this},addTemplate(o,i,s){return t.dispatch(es(o,i,s)),this},setTemplates(o){return t.dispatch(ts(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(!R.shopify_selling_plans&&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(Vo(u))),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:Je,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),Bo(window.opener,r),r}n(Sn,"makeApi");var ho=n((t=[],e)=>{switch(e.type){case he:return[];case we:return e.newValue?e.newValue.optedin:t;case C:case D:{let[{prepaidShipments:r,...o},i]=nt(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]=nt(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case F:return t.filter(r=>!I(e.payload.product,r));case _t:return t.map(r=>I(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case sr:return t.filter(r=>!I(e.payload.product,r));case Ye:return[];default:return t}},"optedin"),_n=n((t=[],e)=>{switch(e.type){case he:return[];case we:return e.newValue?e.newValue.optedout:t;case C:case D:return t.filter(r=>!I(e.payload.product,r));case F:{let[r,o]=nt(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case _t:return t.map(r=>I(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Ye:return[];default:return t}},"optedout"),En=n((t={},{type:e,payload:r})=>{switch(e){case rr: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 or:return{...t,products:(r.results||[]).map(o=>o.product)};case ir:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),jp=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Gp=n((t={},e)=>{switch(e.type){case L:return{...t};case T:return{...t,...e.payload.in_stock};default:return t}},"inStock"),xn=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),La=n((t,e,r)=>t.map(o=>{let i=r==null?void 0:r[o];return{...e[o],...i?{criteria:i.criteria?i.criteria:{node_type:"PREMISE",standard:ge.PROGRAM_WIDE,premise_value:null},threshold_field:i.threshold_field,threshold_value:i.threshold_value}:{},id:[o][0]}}),"mapIncentive"),Pn=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||[],...La(s,e.payload.incentives_display,e.payload.incentives_display_enhanced)],ongoing:[...i.ongoing||[],...La(a,e.payload.incentives_display,e.payload.incentives_display_enhanced)]}),{})}),{})};default:return t}},"incentives"),Hp=n((t={},e)=>{switch(e.type){case C:case D:return{...t,[S(e.payload.product)]:e.payload.frequency};case F:return{...t,[S(e.payload.product)]:void 0};default:return t}},"frequency"),On=n((t=!1,e)=>{switch(e.type){case tr:return{...e.payload};case Te:return!1;default:return t}},"auth"),vn=n((t="",e)=>{switch(e.type){case Ve:return e.payload;default:return t}},"merchantId"),Tn=n((t=null,e)=>{switch(e.type){case er:return e.payload;default:return t}},"authUrl"),Bp=n((t={},e)=>{switch(e.type){case T:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),wn=n((t="",e)=>{switch(e.type){case T:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Cn=n((t=null,e)=>{switch(e.type){case he:return null;case je:return e.payload;default:return t}},"sessionId"),zp=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 Ye:return{};default:return t}},"productOffer"),Rn=n((t={},e)=>{switch(e.type){case pr:return{...t,[S(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),An=n((t={},e)=>{switch(e.type){case ur:return{...t,[S(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),In=n((t={},e)=>{switch(e.type){case Ge:return{...t,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case He:return{...t,name:Ce,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Be:return{...t,name:dr,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case ze:return{...t,name:Re,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),Nn=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 ar:return{...t,...e.payload};default:return t}},"locale"),Yp=n((t={offerType:"radio"},e)=>{switch(e.type){case We:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Ct(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(Ct):t.frequencies};case pe:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),kn=n((t=!1,e)=>{switch(e.type){case fe:return e.payload.isPreview;default:return t}},"previewStandardOffer"),Fn=n((t=!1,e)=>{switch(e.type){case xt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var Dn=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),qn=n((t=[],e)=>{switch(e.type){case T:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Un=n((t=[],e)=>{switch(e.type){case lr:return[...e.payload||[]];case cr:return[e.payload,...t];default:return t}},"templates"),Wp=n((t={},e)=>{switch(e.type){case Je:return Lr(e.payload);default:return t}},"productPlans"),Ln=n((t={},e)=>{switch(e.type){case Et:{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"),Jp=n((t={},e)=>t,"price"),mo=Kt({optedin:ho,optedout:_n,nextUpcomingOrder:En,autoshipEligible:jp,inStock:Gp,eligibilityGroups:xn,incentives:Pn,frequency:Hp,auth:On,merchantId:vn,authUrl:Tn,offer:Bp,offerId:wn,experiments:Dr,sessionId:Cn,productOffer:zp,firstOrderPlaceDate:Rn,productToSubscribe:An,environment:In,locale:Nn,config:Yp,previewStandardOffer:kn,previewUpsellOffer:Fn,autoshipByDefault:Dn,defaultFrequencies:qn,templates:Un,productPlans:Wp,prepaidShipmentsSelected:Ln,price:Jp});var go=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"),yo=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"),Qp=n((t,e)=>M(t.compare_at_price,e),"getAllocationRegularPrice"),Zp=n((t,e)=>{var r;if(go(t)){let o=yo((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return M(i,e)}return M(t.price,e)},"getAllocationSubscriptionPrice"),Ma=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Xp=n((t,e)=>{var o,i,s;if(go(t)){let a=yo((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,l=Ma(t,c);return et(l)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=et(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=M(t.price_adjustments[0].value,e):t.compare_at_price&&(r=M(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),eu=n(t=>{var e;return go(t)?yo((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),tu=n((t,e,r,o)=>{var u,f;let i=yo((u=t.selling_plan)==null?void 0:u.options),s=t.price/i,a=t.compare_at_price-s,c=Ma(t,s),l=(f=r==null?void 0:r.price_adjustments)==null?void 0:f[0],p=l&&l.value_type==="percentage"?l.value:null;return e.regularPrepaidPrice=M(t.price,o),e.prepaidSavingsPerShipment=M(Math.round(a),o),e.prepaidSavingsTotal=M(Math.round(a*i),o),p&&c&&(e.prepaidExtraSavingsPercentage=et(c-p)),e},"addPrepaidPriceAndSavings"),ru=n((t,e,r)=>{var i;t.selling_plan||(t.selling_plan=e.find(s=>s.id===t.selling_plan_id));let o={frequency:Kp(t),regularPrice:Qp(t,r),subscriptionPrice:Zp(t,r),discountRate:Xp(t,r),prepaidShipments:eu(t),hasPriceAdjustments:((i=t.price_adjustments)==null?void 0:i.length)>0};if(go(t)){let s=ki(e);return tu(t,o,s,r)}return o},"mapSellingPlanToDiscount"),Mn=n((t,e,r=[],o)=>[...t,ru(e,r,o)],"sellingPlanAllocationsReducer"),$a=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group:r}))],[]),"getSellingPlans");var ou=n((t={offerType:"radio",productFrequencies:{},frequencies:[],frequenciesEveryPeriod:[]},e)=>{var r;if(q===e.type){let{payload:{product:o,currency:i}}=e,s={},a=(r=o.variants)==null?void 0:r.reduce((p,u)=>iu(p,u,o.selling_plan_groups,t),{}),c={...t.productFrequencies,...a};s={...s,productFrequencies:c,...Object.values(c)[0]};let l=$n(o);return Object.keys(l).length&&(s={...s,prepaidSellingPlans:{...t.prepaidSellingPlans,...l}}),{...t,...s,storeCurrency:i}}if(T===e.type){let{payload:{offer:o}}=e,{defaultFrequency:i,product:s}=o||{},{prepaidSellingPlans:a={}}=t,c=S(s==null?void 0:s.id),l=t.productFrequencies[c],p={...t.productFrequencies,[c]:{...l,defaultFrequency:su(c,i,a,l==null?void 0:l.frequencies,l==null?void 0:l.frequenciesEveryPeriod)}};return{...t,productFrequencies:p,...Object.values(p)[0]}}return pe===e.type?{...t,merchantSettings:{...e.payload}}:t},"config");function nu(t,e){var i,s;let r=At(t),o=Er(r);if(o!=null&&o.length){let a=xr(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&&Ne(l)&&(l=Q(o,a,l)||ue(o)||l),{frequencies:o,frequenciesEveryPeriod:a,frequenciesText:c,...l?{defaultFrequency:l}:{}}}return null}n(nu,"getFrequencies");function iu(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=nu(s,o.productFrequencies[e.id]);return a&&(t[e.id]=a),t}n(iu,"reduceSellingPlansToFrequencies");function su(t,e,r,o=[],i=[]){var s;return(s=r[t])!=null&&s.some(({sellingPlan:a})=>a===e)?ue(o)||e:Ne(e)&&(Q(o,i,e)||ue(o))||e}n(su,"getUpdatedDefaultFrequency");function $n(t){let e=t==null?void 0:t.selling_plan_groups.filter(r=>/^Prepaid-.*/.test(r.name));return e.length?e.reduce((r,o)=>{let i=o.name.split("-")[1],s=o.selling_plans.map(a=>({numberShipments:Pr(a),sellingPlan:String(a.id)}));return{...r,[i]:s}},{}):{}}n($n,"getPrepaidSellingPlans");var Va=ou;var Ga=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"),ja=n((t,e,r)=>{if(!r)return null;if(!Ne(r))return r;if(wr(t,e)){let o=Q(t,e,r);return o||ue(t)}return r},"getDefaultSellingPlan"),au=n((t,e,r)=>t.map(o=>Ne(o==null?void 0:o.frequency)?{...o,frequency:wr(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"),cu=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={},eligibility_groups:i={}},s,a,c,l)=>Object.keys(t).reduce((p,u)=>{var f;if(!s.some(h=>h.id===u)&&e[u]&&o[u]){if(t[u])return p.concat({id:u,frequency:lu({frequencyConfig:c,offerEl:a,default_frequencies:r,id:u})});if((f=i[u])!=null&&f.includes(mr.PREPAID)){let h=l?It(l):null;return p.concat({id:u,frequency:(h==null?void 0:h.sellingPlan)||Vn,prepaidShipments:(h==null?void 0:h.numberShipments)||null})}}return p},[]),"reduceNewOptinsFromOfferResponse"),lu=n(({frequencyConfig:t,offerEl:e,default_frequencies:r,id:o})=>{let{frequencies:i,frequenciesEveryPeriod:s}=t,{defaultFrequency:a}=e||{},c=r[o],l;return r[o]&&wr(i,s)?l=Q(i,s,`${c.every}_${c.every_period}`)||ja(i,s,a)||ue(i):r[o]?l=`${c.every}_${c.every_period}`:l=ja(i,s,a)||"_",l},"getOptInDefaultFrequency"),pu=n((t,e)=>({...Ga(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ha=n((t,e)=>{let r=S(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),uu=n((t={},e)=>{var r;if(me===e.type){let{payload:o}=e;return o.items.reduce(Ha,t)}if(q===e.type){let{payload:{product:o}}=e,i=Ai(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.variants.reduce((a,c)=>{var u,f;let p=((f=(u=c==null?void 0:c.selling_plan_allocations)==null?void 0:u.filter(h=>s.has(h.selling_plan_id)))!=null?f:[]).length>0;return{...Ga(a,c.id,p),[c.id]:p}},t)}return fe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible"),du=n((t={},e)=>{var r;if(me===e.type)return e.payload.items.reduce(Ha,t);if(q===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(pu,t)||t}return L===e.type&&e.payload.product===null?{...t}:fe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),fu=n((t={},e)=>t,"offer");function hu(t){let e=Pr(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(hu,"getOptedInItem");var Vn="prepaid-replace-me",mu=n((t=[],e)=>{if(me===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,hu(i)]:o,[]))}if(T===e.type){let r=e.payload,{offer:o={},frequencyConfig:i,prepaidSellingPlans:s}=r,a=au(t,o,i),c=cu(r,a,o,i,s);return[...a,...c]}if(q===e.type){let{product:r}=e.payload,o=At(r==null?void 0:r.selling_plan_groups),i=$n(r),s=o?Er(o):[],a=o?xr(o):[];return t.map(c=>{let l=i[c.id];if(o&&Ne(c.frequency))return{...c,frequency:Q(s,a,c.frequency)||ue(s)};if(c.frequency===Vn&&(l==null?void 0:l.length)>0){let{sellingPlan:p,numberShipments:u}=It(l);return{...c,frequency:p,prepaidShipments:u}}return c}).filter(c=>c.frequency!==Vn)}if(le===e.type){let{payload:r}=e,o=ho(t,e),[i,s]=nt(o,r.product);return s.concat({...i,...r.product,frequency:r.frequency})}return ho(t,e)},"optedin"),gu=n((t={},e)=>{var r;if(q===e.type){let{payload:{product:o}}=e;return((r=o.variants)==null?void 0:r.reduce((i,s)=>({...i,[s.id]:{value:s.price}}),t))||t}return t},"price"),yu=n((t={},e)=>t,"productOffer"),bu=n((t={},e)=>{if(q===e.type){let{payload:{product:r,currency:o}}=e,i=$a(r);return r.variants.reduce((s,a)=>{var c;return{...s,[a.id]:(c=a.selling_plan_allocations)==null?void 0:c.reduce((l,p)=>Mn(l,p,i,o),[])}},t)||t}if(me===e.type){let r=e.payload;return r.items.reduce((o,i)=>i.selling_plan_allocation?{...o,[i.key]:Mn([],i.selling_plan_allocation,[],r.currency)}:o,t)||t}return t},"productPlans"),Su=Kt({auth:On,authUrl:Tn,autoshipByDefault:Dn,autoshipEligible:uu,config:Va,defaultFrequencies:qn,eligibilityGroups:xn,environment:In,firstOrderPlaceDate:Rn,incentives:Pn,inStock:du,locale:Nn,merchantId:vn,nextUpcomingOrder:En,offer:fu,offerId:wn,experiments:Dr,optedin:mu,optedout:_n,previewStandardOffer:kn,previewUpsellOffer:Fn,price:gu,productOffer:yu,productPlans:bu,productToSubscribe:An,sessionId:Cn,templates:Un,prepaidShipmentsSelected:Ln});function jn(t,e){return window.og&&window.og.previewMode?mo(t,e):Su(t,e)}n(jn,"shopifyReducer");var Wa=ce(Ot()),Ja=ce(Zt());function Ba(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(Ba,"updateTrackingInputs");function Gn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(Gn,"getTrackingKey");function _u(t,e){var u,f,h,w;if(!((u=t.payload.offer)==null?void 0:u.autoshipByDefault))return;let o=(f=t.payload.offer)==null?void 0:f.product.id,i=Gn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((w=t.payload.offer)==null?void 0:w.variationId)||"",c=bo(o,e),p=[o,C.toLowerCase(),s,c,a].join(",");Ba(o,i,p)}n(_u,"addDefaultToSubTracking");function Hn(t){return e=>r=>{switch(e(r),r.type){case C:case F:case D:{let o=r.payload.offer,i=Bn(r);o&&!o.isCart&&Ba(o.product.id,i[0],i[1]);break}case T:_u(r,t);break;default:}}}n(Hn,"shopifyTrackingMiddleware");var za,Ya,So=((Ya=(za=window.Shopify)==null?void 0:za.routes)==null?void 0:Ya.root)||"/",Eu="/cart",xu=`${So}cart.js`,Pu=`${So}cart/change.js`,Ou=`${So}cart/update.js`,vu=`${So}products/`,Ka="__ordergroove_offer_id",Tu='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',wu=n(t=>(0,Ja.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 Cu(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await zn()).currency}n(Cu,"getCurrency");async function Ru(t,e){let r=Au(e);if(r)try{let[i,s]=await Promise.all([Qa(r),Cu()]),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=wu(e);o.addEventListener("change",()=>i(o)),new MutationObserver(a=>{a.every(c=>c.type==="attributes")?a.some(c=>c.target.name==="id")&&i(o):i(o)}).observe(o,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["value"]})}else console.info("no /cart/add form found for og-offer",e)}n(Ru,"setupPdp");async function zn(){return(await fetch(xu)).json()}n(zn,"getCart");function Au(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(Au,"guessProductHandle");var Qa=(0,Wa.default)(async function(t){return(await fetch(`${vu}${t}.js`)).json()});async function Iu(t,e){let r=await zn(),{items:o}=r,i=r;t.dispatch({type:me,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(Qa))).forEach(c=>{let l={product:c,offer:e,currency:r.currency};t.dispatch({type:q,payload:l})})}n(Iu,"setupCart");async function Nu(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||bo(t.payload.product.id,e),i=Bn(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 zn(),u=(s=p==null?void 0:p.items)==null?void 0:s.findIndex(k=>k.key===l),f=p.items[u],h=f.quantity,w=S(l),x=Za(e),g={...Object.fromEntries([i]),...x?{[Ka]:x}:{}};if(Object.keys(g).length>0&&(await fetch(Ou,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:g})})).status!==200)throw new Error("Cart attributes not updated");let P=await fetch(Pu,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,properties:f.properties,selling_plan:o||null,sections:c.map(k=>k.id.replace(/^shopify-section-/,""))})});if(P.status!==200)throw new Error("Cart not updated");let _=await P.json(),y=p.items.length===_.items.length?_.items[u].key:(a=_.items.find(k=>k.quantity===h&&k.product_id===w&&(!o&&!k.selling_plan_allocation||(k==null?void 0:k.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;y&&(e.dispatch({type:Et,payload:{oldCartProductKey:l,newCartProductKey:y}}),r.setAttribute("product",y));let v=_;e.dispatch({type:me,payload:v});let Jt=new CustomEvent(yi,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(Jt),Jt.defaultPrevented)return;let _o=_.sections;Object.values(_o).length?c.forEach(k=>{let Wn=k.id.replace(/^shopify-section-/,"");if(!(Wn in _o))return;let nc=_o[Wn],Jn=new DOMParser().parseFromString(nc.toString()||"","text/html").getElementById(k.id);Jn&&(k.innerHTML=Jn.innerHTML)}):window.location.pathname.startsWith(Eu)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Nu,"synchronizeCartOptin");function Bn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=Gn(),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 L:case F:s.push(""),s.push(i);break;case C:case D:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(Bn,"getTrackingEvent");function bo(t,e){let o=Or({id:t})(e.getState());return o?o.frequency:void 0}n(bo,"getSubscribedFrequency");function Za(t){let e=t.getState();return Mi(e)?e.offerId:null}n(Za,"getOfferIdAttribute");function ku(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=bo(o,t);Cr(r.form,"selling_plan",i),Cr(r.form,"attributes[og__session]",t.getState().sessionId);let s=Za(t);s&&Cr(r.form,`attributes[${Ka}]`,s)})}n(ku,"synchronizeSellingPlan");function Yn(t){return e=>r=>{var o;switch(r.type){case C:case F:case D:break;case L:(o=r.payload.offer)!=null&&o.isCart?Iu(t,r.payload.offer):Ru(t,r.payload.offer);break;default:}switch(e(r),r.type){case C:case F:case D:case le:Nu(r,t);case L:case T:case q:ku(t,r.payload.offer);break;default:}}}n(Yn,"shopifyMiddleware");var Fu="/apps/subscriptions/auth/",Xa="og_auth_begin",Du="og_auth_end",qu=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function ec({store:t}){var i;let[e]=Uo(),r=Rt(),o=r!=null&&r.dataset.customer?qu(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await Lu(o);if(s){let[a,c,l]=s.split("|");t.dispatch(Ft(e,a,Number(c),l))}}else ji("og_auth")}n(ec,"authorizeShopifyCustomer");async function Uu(t){try{let r=await(await fetch(`${Fu}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Xa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Xa.length,r.lastIndexOf(Du)))}catch(e){console.error(e)}}n(Uu,"fetchOGSignature");async function Lu(t){let e=Gi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await Uu(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(Lu,"getOrCreateAuthCookie");var tc,oc=Os(...(tc=R)!=null&&tc.shopify_selling_plans?[jn,Yn]:[mo],R.shopify&&Hn),O=Sn(oc),Mu=O.isReady,$u=O.addOptinChangedCallback,Vu=O.addTemplate,ju=O.clear,Gu=O.config,Hu=O.disableOptinChangedCallbacks,Bu=O.getOptins,zu=O.getProductsForPurchasePost,Yu=O.initialize,Wu=O.previewMode,Ju=O.register,Ku=O.resolveSettings,Qu=O.setAuthUrl,Zu=O.setEnvironment,Xu=O.setLocale,ed=O.setMerchantId,td=O.setPublicPath,rd=O.setTemplates,od=O.setupCart,nd=O.setupProduct,id=O.setupProducts,sd=n(()=>Vi(O),"autoInit");var ad=O.initialize,rc;(rc=R)!=null&&rc.shopify_selling_plans&&Tr(()=>ec(O));return pc(cd);})();
1071
+ `}};n(mo,"Price");var Yp=n((t,e)=>{var r,o;return{productPlans:t.productPlans,configDefaultFrequency:ne((r=e.product)==null?void 0:r.id)(t),frequency:oe(e.product)(t),discountedProductPriceFromOffers:Vi((o=e.product)==null?void 0:o.id)(t)}},"mapStateToProps"),ja=m(Yp)(mo);function En(t){Va(),Ns(t);try{customElements.define("og-when",da),customElements.define("og-text",xa),customElements.define("og-incentive-text",Ta),customElements.define("og-benefit-messages",wa),customElements.define("og-offer",Da),customElements.define("og-select-frequency",Ca),customElements.define("og-optout-button",ga),customElements.define("og-optin-toggle",Ea),customElements.define("og-optin-status",ha),customElements.define("og-optin-button",ma),customElements.define("og-optin-select",ba),customElements.define("og-upsell-button",Sa),customElements.define("og-frequency-status",ya),customElements.define("og-modal",Ht),customElements.define("og-select",zt),customElements.define("og-tooltip",Yt),customElements.define("og-upsell-modal",_a),customElements.define("og-next-upcoming-order",Aa),customElements.define("og-price",ja),customElements.define("og-prepaid-toggle",qa),customElements.define("og-prepaid-data",Ua),customElements.define("og-prepaid-button",La),customElements.define("og-prepaid-select",Ma),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(Qi(o)),this},setMerchantId(o){return t.dispatch(Wi(o)),this},setAuthUrl(o){return t.dispatch(Ji(o)),this},receiveMerchantSettings(o){return t.dispatch(cs(o)),this},getProductsForPurchasePost(o=[]){return Wo(t.getState(),o)},getOptins(o=[]){return Wo(t.getState(),o)},clear(){t.dispatch(es())},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,console.log("OG Offers preview mode enabled")),this},config(o){return t.dispatch(rs(o)),this},setLocale(o){return t.dispatch(ts(o)),this},setBenefitMessages(o){return t.dispatch(os(o)),this},addTemplate(o,i,s){return t.dispatch(ns(o,i,s)),this},setTemplates(o){return t.dispatch(is(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(!A.shopify_selling_plans&&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(Go(u))),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:Je,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),Yo(window.opener,r),r}n(En,"makeApi");var go=n((t=[],e)=>{switch(e.type){case he:return[];case we:return e.newValue?e.newValue.optedin:t;case R:case D:{let[{prepaidShipments:r,...o},i]=nt(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]=nt(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case F:return t.filter(r=>!N(e.payload.product,r));case _t:return t.map(r=>N(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case sr:return t.filter(r=>!N(e.payload.product,r));case Ye:return[];default:return t}},"optedin"),xn=n((t=[],e)=>{switch(e.type){case he:return[];case we:return e.newValue?e.newValue.optedout:t;case R:case D:return t.filter(r=>!N(e.payload.product,r));case F:{let[r,o]=nt(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case _t:return t.map(r=>N(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Ye:return[];default:return t}},"optedout"),Pn=n((t={},{type:e,payload:r})=>{switch(e){case rr: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 or:return{...t,products:(r.results||[]).map(o=>o.product)};case ir:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),Wp=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Jp=n((t={},e)=>{switch(e.type){case L:return{...t};case T:return{...t,...e.payload.in_stock};default:return t}},"inStock"),On=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Ga=n((t,e,r)=>t.map(o=>{let i=r==null?void 0:r[o];return{...e[o],...i?{criteria:i.criteria?i.criteria:{node_type:"PREMISE",standard:ge.PROGRAM_WIDE,premise_value:null},threshold_field:i.threshold_field,threshold_value:i.threshold_value}:{},id:[o][0]}}),"mapIncentive"),vn=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||[],...Ga(s,e.payload.incentives_display,e.payload.incentives_display_enhanced)],ongoing:[...i.ongoing||[],...Ga(a,e.payload.incentives_display,e.payload.incentives_display_enhanced)]}),{})}),{})};default:return t}},"incentives"),Kp=n((t={},e)=>{switch(e.type){case R:case D:return{...t,[b(e.payload.product)]:e.payload.frequency};case F:return{...t,[b(e.payload.product)]:void 0};default:return t}},"frequency"),Tn=n((t=!1,e)=>{switch(e.type){case tr:return{...e.payload};case Te:return!1;default:return t}},"auth"),wn=n((t="",e)=>{switch(e.type){case Ve:return e.payload;default:return t}},"merchantId"),Cn=n((t=null,e)=>{switch(e.type){case er:return e.payload;default:return t}},"authUrl"),Qp=n((t={},e)=>{switch(e.type){case T:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Rn=n((t="",e)=>{switch(e.type){case T:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),An=n((t=null,e)=>{switch(e.type){case he:return null;case je:return e.payload;default:return t}},"sessionId"),Zp=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 Ye:return{};default:return t}},"productOffer"),In=n((t={},e)=>{switch(e.type){case ur:return{...t,[b(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Nn=n((t={},e)=>{switch(e.type){case dr:return{...t,[b(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),kn=n((t={},e)=>{switch(e.type){case Ge:return{...t,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case He:return{...t,name:Ce,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Be:return{...t,name:fr,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case ze:return{...t,name:Re,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),Fn=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 ar:return{...t,...e.payload};default:return t}},"locale"),Xp=n((t={offerType:"radio"},e)=>{switch(e.type){case We:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Ct(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(Ct):t.frequencies};case pe:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),Dn=n((t=!1,e)=>{switch(e.type){case fe:return e.payload.isPreview;default:return t}},"previewStandardOffer"),qn=n((t=!1,e)=>{switch(e.type){case xt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var Un=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),Ln=n((t=[],e)=>{switch(e.type){case T:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Mn=n((t=[],e)=>{switch(e.type){case pr:return[...e.payload||[]];case lr:return[e.payload,...t];default:return t}},"templates"),eu=n((t={},e)=>{switch(e.type){case Je:return Mr(e.payload);default:return t}},"productPlans"),$n=n((t={},e)=>{switch(e.type){case Et:{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"),tu=n((t={},e)=>t,"price"),Vn=n((t={},e)=>{switch(e.type){case cr:return{...e.payload||{}};default:return t}},"benefitMessages"),yo=Kt({optedin:go,optedout:xn,nextUpcomingOrder:Pn,autoshipEligible:Wp,inStock:Jp,eligibilityGroups:On,incentives:vn,frequency:Kp,auth:Tn,merchantId:wn,authUrl:Cn,offer:Qp,offerId:Rn,experiments:qr,sessionId:An,productOffer:Zp,firstOrderPlaceDate:In,productToSubscribe:Nn,environment:kn,locale:Fn,config:Xp,previewStandardOffer:Dn,previewUpsellOffer:qn,autoshipByDefault:Un,defaultFrequencies:Ln,templates:Mn,productPlans:eu,prepaidShipmentsSelected:$n,price:tu,benefitMessages:Vn});var bo=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"),So=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"),ru=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),ou=n((t,e)=>M(t.compare_at_price,e),"getAllocationRegularPrice"),nu=n((t,e)=>{var r;if(bo(t)){let o=So((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return M(i,e)}return M(t.price,e)},"getAllocationSubscriptionPrice"),Ha=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),iu=n((t,e)=>{var o,i,s;if(bo(t)){let a=So((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,l=Ha(t,c);return et(l)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=et(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=M(t.price_adjustments[0].value,e):t.compare_at_price&&(r=M(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),su=n(t=>{var e;return bo(t)?So((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),au=n((t,e,r,o)=>{var u,f;let i=So((u=t.selling_plan)==null?void 0:u.options),s=t.price/i,a=t.compare_at_price-s,c=Ha(t,s),l=(f=r==null?void 0:r.price_adjustments)==null?void 0:f[0],p=l&&l.value_type==="percentage"?l.value:null;return e.regularPrepaidPrice=M(t.price,o),e.prepaidSavingsPerShipment=M(Math.round(a),o),e.prepaidSavingsTotal=M(Math.round(a*i),o),p&&c&&(e.prepaidExtraSavingsPercentage=et(c-p)),e},"addPrepaidPriceAndSavings"),cu=n((t,e,r)=>{var i;t.selling_plan||(t.selling_plan=e.find(s=>s.id===t.selling_plan_id));let o={frequency:ru(t),regularPrice:ou(t,r),subscriptionPrice:nu(t,r),discountRate:iu(t,r),prepaidShipments:su(t),hasPriceAdjustments:((i=t.price_adjustments)==null?void 0:i.length)>0};if(bo(t)){let s=qi(e);return au(t,o,s,r)}return o},"mapSellingPlanToDiscount"),jn=n((t,e,r=[],o)=>[...t,cu(e,r,o)],"sellingPlanAllocationsReducer"),Ba=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group:r}))],[]),"getSellingPlans");var lu=n((t={offerType:"radio",productFrequencies:{},frequencies:[],frequenciesEveryPeriod:[]},e)=>{var r;if(q===e.type){let{payload:{product:o,currency:i}}=e,s={},a=(r=o.variants)==null?void 0:r.reduce((p,u)=>uu(p,u,o.selling_plan_groups,t),{}),c={...t.productFrequencies,...a};s={...s,productFrequencies:c,...Object.values(c)[0]};let l=Gn(o);return Object.keys(l).length&&(s={...s,prepaidSellingPlans:{...t.prepaidSellingPlans,...l}}),{...t,...s,storeCurrency:i}}if(T===e.type){let{payload:{offer:o}}=e,{defaultFrequency:i,product:s}=o||{},{prepaidSellingPlans:a={}}=t,c=b(s==null?void 0:s.id),l=t.productFrequencies[c],p={...t.productFrequencies,[c]:{...l,defaultFrequency:du(c,i,a,l==null?void 0:l.frequencies,l==null?void 0:l.frequenciesEveryPeriod)}};return{...t,productFrequencies:p,...Object.values(p)[0]}}return pe===e.type?{...t,merchantSettings:{...e.payload}}:t},"config");function pu(t,e){var i,s;let r=At(t),o=xr(r);if(o!=null&&o.length){let a=Pr(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&&Ne(l)&&(l=Q(o,a,l)||ue(o)||l),{frequencies:o,frequenciesEveryPeriod:a,frequenciesText:c,...l?{defaultFrequency:l}:{}}}return null}n(pu,"getFrequencies");function uu(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=pu(s,o.productFrequencies[e.id]);return a&&(t[e.id]=a),t}n(uu,"reduceSellingPlansToFrequencies");function du(t,e,r,o=[],i=[]){var s;return(s=r[t])!=null&&s.some(({sellingPlan:a})=>a===e)?ue(o)||e:Ne(e)&&(Q(o,i,e)||ue(o))||e}n(du,"getUpdatedDefaultFrequency");function Gn(t){let e=t==null?void 0:t.selling_plan_groups.filter(r=>/^Prepaid-.*/.test(r.name));return e.length?e.reduce((r,o)=>{let i=o.name.split("-")[1],s=o.selling_plans.map(a=>({numberShipments:Or(a),sellingPlan:String(a.id)}));return{...r,[i]:s}},{}):{}}n(Gn,"getPrepaidSellingPlans");var za=lu;var Wa=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"),Ya=n((t,e,r)=>{if(!r)return null;if(!Ne(r))return r;if(Cr(t,e)){let o=Q(t,e,r);return o||ue(t)}return r},"getDefaultSellingPlan"),fu=n((t,e,r)=>t.map(o=>Ne(o==null?void 0:o.frequency)?{...o,frequency:Cr(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"),hu=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={},eligibility_groups:i={}},s,a,c,l)=>Object.keys(t).reduce((p,u)=>{var f;if(!s.some(h=>h.id===u)&&e[u]&&o[u]){if(t[u])return p.concat({id:u,frequency:mu({frequencyConfig:c,offerEl:a,default_frequencies:r,id:u})});if((f=i[u])!=null&&f.includes(gr.PREPAID)){let h=l?It(l):null;return p.concat({id:u,frequency:(h==null?void 0:h.sellingPlan)||Hn,prepaidShipments:(h==null?void 0:h.numberShipments)||null})}}return p},[]),"reduceNewOptinsFromOfferResponse"),mu=n(({frequencyConfig:t,offerEl:e,default_frequencies:r,id:o})=>{let{frequencies:i,frequenciesEveryPeriod:s}=t,{defaultFrequency:a}=e||{},c=r[o],l;return r[o]&&Cr(i,s)?l=Q(i,s,`${c.every}_${c.every_period}`)||Ya(i,s,a)||ue(i):r[o]?l=`${c.every}_${c.every_period}`:l=Ya(i,s,a)||"_",l},"getOptInDefaultFrequency"),gu=n((t,e)=>({...Wa(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ja=n((t,e)=>{let r=b(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),yu=n((t={},e)=>{var r;if(me===e.type){let{payload:o}=e;return o.items.reduce(Ja,t)}if(q===e.type){let{payload:{product:o}}=e,i=ki(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.variants.reduce((a,c)=>{var u,f;let p=((f=(u=c==null?void 0:c.selling_plan_allocations)==null?void 0:u.filter(h=>s.has(h.selling_plan_id)))!=null?f:[]).length>0;return{...Wa(a,c.id,p),[c.id]:p}},t)}return fe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible"),bu=n((t={},e)=>{var r;if(me===e.type)return e.payload.items.reduce(Ja,t);if(q===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(gu,t)||t}return L===e.type&&e.payload.product===null?{...t}:fe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),Su=n((t={},e)=>t,"offer");function _u(t){let e=Or(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(_u,"getOptedInItem");var Hn="prepaid-replace-me",Eu=n((t=[],e)=>{if(me===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,_u(i)]:o,[]))}if(T===e.type){let r=e.payload,{offer:o={},frequencyConfig:i,prepaidSellingPlans:s}=r,a=fu(t,o,i),c=hu(r,a,o,i,s);return[...a,...c]}if(q===e.type){let{product:r}=e.payload,o=At(r==null?void 0:r.selling_plan_groups),i=Gn(r),s=o?xr(o):[],a=o?Pr(o):[];return t.map(c=>{let l=i[c.id];if(o&&Ne(c.frequency))return{...c,frequency:Q(s,a,c.frequency)||ue(s)};if(c.frequency===Hn&&(l==null?void 0:l.length)>0){let{sellingPlan:p,numberShipments:u}=It(l);return{...c,frequency:p,prepaidShipments:u}}return c}).filter(c=>c.frequency!==Hn)}if(le===e.type){let{payload:r}=e,o=go(t,e),[i,s]=nt(o,r.product);return s.concat({...i,...r.product,frequency:r.frequency})}return go(t,e)},"optedin"),xu=n((t={},e)=>{var r;if(q===e.type){let{payload:{product:o}}=e;return((r=o.variants)==null?void 0:r.reduce((i,s)=>({...i,[s.id]:{value:s.price}}),t))||t}return t},"price"),Pu=n((t={},e)=>t,"productOffer"),Ou=n((t={},e)=>{if(q===e.type){let{payload:{product:r,currency:o}}=e,i=Ba(r);return r.variants.reduce((s,a)=>{var c;return{...s,[a.id]:(c=a.selling_plan_allocations)==null?void 0:c.reduce((l,p)=>jn(l,p,i,o),[])}},t)||t}if(me===e.type){let r=e.payload;return r.items.reduce((o,i)=>i.selling_plan_allocation?{...o,[i.key]:jn([],i.selling_plan_allocation,[],r.currency)}:o,t)||t}return t},"productPlans"),vu=Kt({auth:Tn,authUrl:Cn,autoshipByDefault:Un,autoshipEligible:yu,config:za,defaultFrequencies:Ln,eligibilityGroups:On,environment:kn,firstOrderPlaceDate:In,incentives:vn,inStock:bu,locale:Fn,merchantId:wn,nextUpcomingOrder:Pn,offer:Su,offerId:Rn,experiments:qr,optedin:Eu,optedout:xn,previewStandardOffer:Dn,previewUpsellOffer:qn,price:xu,productOffer:Pu,productPlans:Ou,productToSubscribe:Nn,sessionId:An,templates:Mn,prepaidShipmentsSelected:$n,benefitMessages:Vn});function Bn(t,e){return window.og&&window.og.previewMode?yo(t,e):vu(t,e)}n(Bn,"shopifyReducer");var Xa=ce(Ot()),ec=ce(Zt());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 zn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(zn,"getTrackingKey");function Tu(t,e){var u,f,h,w;if(!((u=t.payload.offer)==null?void 0:u.autoshipByDefault))return;let o=(f=t.payload.offer)==null?void 0:f.product.id,i=zn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((w=t.payload.offer)==null?void 0:w.variationId)||"",c=_o(o,e),p=[o,R.toLowerCase(),s,c,a].join(",");Ka(o,i,p)}n(Tu,"addDefaultToSubTracking");function Yn(t){return e=>r=>{switch(e(r),r.type){case R:case F:case D:{let o=r.payload.offer,i=Wn(r);o&&!o.isCart&&Ka(o.product.id,i[0],i[1]);break}case T:Tu(r,t);break;default:}}}n(Yn,"shopifyTrackingMiddleware");var Qa,Za,Eo=((Za=(Qa=window.Shopify)==null?void 0:Qa.routes)==null?void 0:Za.root)||"/",wu="/cart",Cu=`${Eo}cart.js`,Ru=`${Eo}cart/change.js`,Au=`${Eo}cart/update.js`,Iu=`${Eo}products/`,tc="__ordergroove_offer_id",Nu='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',ku=n(t=>(0,ec.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 Fu(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await Jn()).currency}n(Fu,"getCurrency");async function Du(t,e){let r=qu(e);if(r)try{let[i,s]=await Promise.all([rc(r),Fu()]),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=ku(e);o.addEventListener("change",()=>i(o)),new MutationObserver(a=>{a.every(c=>c.type==="attributes")?a.some(c=>c.target.name==="id")&&i(o):i(o)}).observe(o,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["value"]})}else console.info("no /cart/add form found for og-offer",e)}n(Du,"setupPdp");async function Jn(){return(await fetch(Cu)).json()}n(Jn,"getCart");function qu(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(qu,"guessProductHandle");var rc=(0,Xa.default)(async function(t){return(await fetch(`${Iu}${t}.js`)).json()});async function Uu(t,e){let r=await Jn(),{items:o}=r,i=r;t.dispatch({type:me,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(rc))).forEach(c=>{let l={product:c,offer:e,currency:r.currency};t.dispatch({type:q,payload:l})})}n(Uu,"setupCart");async function Lu(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||_o(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(Nu)),l=t.payload.product.id,p=await Jn(),u=(s=p==null?void 0:p.items)==null?void 0:s.findIndex(k=>k.key===l),f=p.items[u],h=f.quantity,w=b(l),P=oc(e),g={...Object.fromEntries([i]),...P?{[tc]:P}:{}};if(Object.keys(g).length>0&&(await fetch(Au,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:g})})).status!==200)throw new Error("Cart attributes not updated");let O=await fetch(Ru,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,properties:f.properties,selling_plan:o||null,sections:c.map(k=>k.id.replace(/^shopify-section-/,""))})});if(O.status!==200)throw new Error("Cart not updated");let E=await O.json(),y=p.items.length===E.items.length?E.items[u].key:(a=E.items.find(k=>k.quantity===h&&k.product_id===w&&(!o&&!k.selling_plan_allocation||(k==null?void 0:k.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;y&&(e.dispatch({type:Et,payload:{oldCartProductKey:l,newCartProductKey:y}}),r.setAttribute("product",y));let v=E;e.dispatch({type:me,payload:v});let Jt=new CustomEvent(_i,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(Jt),Jt.defaultPrevented)return;let xo=E.sections;Object.values(xo).length?c.forEach(k=>{let Qn=k.id.replace(/^shopify-section-/,"");if(!(Qn in xo))return;let lc=xo[Qn],Zn=new DOMParser().parseFromString(lc.toString()||"","text/html").getElementById(k.id);Zn&&(k.innerHTML=Zn.innerHTML)}):window.location.pathname.startsWith(wu)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Lu,"synchronizeCartOptin");function Wn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=zn(),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 L:case F:s.push(""),s.push(i);break;case R:case D:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(Wn,"getTrackingEvent");function _o(t,e){let o=vr({id:t})(e.getState());return o?o.frequency:void 0}n(_o,"getSubscribedFrequency");function oc(t){let e=t.getState();return ji(e)?e.offerId:null}n(oc,"getOfferIdAttribute");function Mu(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=_o(o,t);Rr(r.form,"selling_plan",i),Rr(r.form,"attributes[og__session]",t.getState().sessionId);let s=oc(t);s&&Rr(r.form,`attributes[${tc}]`,s)})}n(Mu,"synchronizeSellingPlan");function Kn(t){return e=>r=>{var o;switch(r.type){case R:case F:case D:break;case L:(o=r.payload.offer)!=null&&o.isCart?Uu(t,r.payload.offer):Du(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case F:case D:case le:Lu(r,t);case L:case T:case q:Mu(t,r.payload.offer);break;default:}}}n(Kn,"shopifyMiddleware");var $u="/apps/subscriptions/auth/",nc="og_auth_begin",Vu="og_auth_end",ju=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function ic({store:t}){var i;let[e]=Mo(),r=Rt(),o=r!=null&&r.dataset.customer?ju(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await Hu(o);if(s){let[a,c,l]=s.split("|");t.dispatch(Ft(e,a,Number(c),l))}}else Bi("og_auth")}n(ic,"authorizeShopifyCustomer");async function Gu(t){try{let r=await(await fetch(`${$u}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(nc);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+nc.length,r.lastIndexOf(Vu)))}catch(e){console.error(e)}}n(Gu,"fetchOGSignature");async function Hu(t){let e=zi("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(Hu,"getOrCreateAuthCookie");var sc,cc=Cs(...(sc=A)!=null&&sc.shopify_selling_plans?[Bn,Kn]:[yo],A.shopify&&Yn),x=En(cc),Bu=x.isReady,zu=x.addOptinChangedCallback,Yu=x.addTemplate,Wu=x.clear,Ju=x.config,Ku=x.disableOptinChangedCallbacks,Qu=x.getOptins,Zu=x.getProductsForPurchasePost,Xu=x.initialize,ed=x.previewMode,td=x.register,rd=x.resolveSettings,od=x.setAuthUrl,nd=x.setBenefitMessages,id=x.setEnvironment,sd=x.setLocale,ad=x.setMerchantId,cd=x.setPublicPath,ld=x.setTemplates,pd=x.setupCart,ud=x.setupProduct,dd=x.setupProducts,fd=n(()=>Hi(x),"autoInit");var hd=x.initialize,ac;(ac=A)!=null&&ac.shopify_selling_plans&&wr(()=>ic(x));return mc(md);})();
1066
1072
  ; return lib; });
1067
1073
  //# sourceMappingURL=offers.js.map