@ordergroove/offers 2.38.0 → 2.38.1-alpha-PR-987-2.17

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
@@ -8,10 +8,10 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.getOwnPropertyDescriptor;var Sa=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var n=(t,e)=>ut(t,"name",{value:e,configurable:!0});var Se=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vn=(t,e)=>{for(var r in e)ut(t,r,{get:e[r],enumerable:!0})},On=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Sa(e))!xa.call(t,i)&&i!==r&&ut(t,i,{get:()=>e[i],enumerable:!(o=_a(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?ba(Ea(t)):{},On(e||!t||!t.__esModule?ut(r,"default",{value:t,enumerable:!0}):r,t)),va=t=>On(ut({},"__esModule",{value:!0}),t);var Vt=Se(($t,In)=>{(function(t,e){typeof $t=="object"&&typeof In<"u"?e($t):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})($t,function(t){"use strict";function e(o,i,s,a){var c,l=!1,p=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function u(){f(),l=!0}n(u,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var b=arguments.length,S=new Array(b),m=0;m<b;m++)S[m]=arguments[m];var E=this,T=Date.now()-p;if(l)return;function _(){p=Date.now(),s.apply(E,S)}n(_,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&_(),f(),a===void 0&&T>o?_():i!==!0&&(c=setTimeout(a?w:_,a===void 0?o-T:o))}return n(h,"wrapper"),h.cancel=u,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var bt=Se((xu,Qn)=>{var qa="Expected a function",Bn="__lodash_hash_undefined__",Da="[object Function]",Fa="[object GeneratorFunction]",Ua=/[\\^$.*+?()[\]{}|]/g,La=/^\[object .+?Constructor\]$/,Ma=typeof window=="object"&&window&&window.Object===Object&&window,$a=typeof self=="object"&&self&&self.Object===Object&&self,zn=Ma||$a||Function("return this")();function Va(t,e){return t?.[e]}n(Va,"getValue");function ja(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ja,"isHostObject");var Ha=Array.prototype,Ga=Function.prototype,Yn=Object.prototype,ro=zn["__core-js_shared__"],Gn=function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Wn=Ga.toString,oo=Yn.hasOwnProperty,Ba=Yn.toString,za=RegExp("^"+Wn.call(oo).replace(Ua,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ya=Ha.splice,Wa=Jn(zn,"Map"),yt=Jn(Object,"create");function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"Hash");function Ja(){this.__data__=yt?yt(null):{}}n(Ja,"hashClear");function Ka(t){return this.has(t)&&delete this.__data__[t]}n(Ka,"hashDelete");function Qa(t){var e=this.__data__;if(yt){var r=e[t];return r===Bn?void 0:r}return oo.call(e,t)?e[t]:void 0}n(Qa,"hashGet");function Za(t){var e=this.__data__;return yt?e[t]!==void 0:oo.call(e,t)}n(Za,"hashHas");function Xa(t,e){var r=this.__data__;return r[t]=yt&&e===void 0?Bn:e,this}n(Xa,"hashSet");Te.prototype.clear=Ja;Te.prototype.delete=Ka;Te.prototype.get=Qa;Te.prototype.has=Za;Te.prototype.set=Xa;function Be(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Be,"ListCache");function ec(){this.__data__=[]}n(ec,"listCacheClear");function tc(t){var e=this.__data__,r=or(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ya.call(e,r,1),!0}n(tc,"listCacheDelete");function rc(t){var e=this.__data__,r=or(e,t);return r<0?void 0:e[r][1]}n(rc,"listCacheGet");function oc(t){return or(this.__data__,t)>-1}n(oc,"listCacheHas");function nc(t,e){var r=this.__data__,o=or(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(nc,"listCacheSet");Be.prototype.clear=ec;Be.prototype.delete=tc;Be.prototype.get=rc;Be.prototype.has=oc;Be.prototype.set=nc;function we(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(we,"MapCache");function ic(){this.__data__={hash:new Te,map:new(Wa||Be),string:new Te}}n(ic,"mapCacheClear");function sc(t){return nr(this,t).delete(t)}n(sc,"mapCacheDelete");function ac(t){return nr(this,t).get(t)}n(ac,"mapCacheGet");function cc(t){return nr(this,t).has(t)}n(cc,"mapCacheHas");function lc(t,e){return nr(this,t).set(t,e),this}n(lc,"mapCacheSet");we.prototype.clear=ic;we.prototype.delete=sc;we.prototype.get=ac;we.prototype.has=cc;we.prototype.set=lc;function or(t,e){for(var r=t.length;r--;)if(hc(t[r][0],e))return r;return-1}n(or,"assocIndexOf");function pc(t){if(!Kn(t)||dc(t))return!1;var e=mc(t)||ja(t)?za:La;return e.test(fc(t))}n(pc,"baseIsNative");function nr(t,e){var r=t.__data__;return uc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(nr,"getMapData");function Jn(t,e){var r=Va(t,e);return pc(r)?r:void 0}n(Jn,"getNative");function uc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(uc,"isKeyable");function dc(t){return!!Gn&&Gn in t}n(dc,"isMasked");function fc(t){if(t!=null){try{return Wn.call(t)}catch{}try{return t+""}catch{}}return""}n(fc,"toSource");function no(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(qa);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||we),r}n(no,"memoize");no.Cache=we;function hc(t,e){return t===e||t!==t&&e!==e}n(hc,"eq");function mc(t){var e=Kn(t)?Ba.call(t):"";return e==Da||e==Fa}n(mc,"isFunction");function Kn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Kn,"isObject");Qn.exports=no});var xr=Se((ff,es)=>{var al={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"};es.exports=al});var rs=Se((hf,ts)=>{var ke=xr(),cl=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case ke.PAR_OPEN:case ke.PAR_CLOSE:case ke.OP_NOT:case ke.BINARY_AND:case ke.BINARY_OR:e&&(r.push({type:ke.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:ke.LITERAL,value:e}),r},"Tokenizer");ts.exports=cl});var ns=Se((mf,os)=>{var be=xr(),ll=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case be.LITERAL:e.unshift(i);break;case be.BINARY_AND:case be.BINARY_OR:case be.OP_NOT:case be.PAR_OPEN:r.push(i);break;case be.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==be.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===be.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),pl=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");os.exports={PolishNotation:ll,PolishGenerator:pl}});var ss=Se((gf,is)=>{var F=xr(),V=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===F.LEAF}isAtomic(){return this.isLeaf()||this.op===F.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new V(F.BINARY_AND,e,r)}static CreateNot(e){return new V(F.OP_NOT,e)}static CreateOr(e,r){return new V(F.BINARY_OR,e,r)}static CreateLiteral(e){return new V(F.LEAF,null,null,e)}};n(V,"ExpNode");var it=n(t=>{let e=t.next().value;switch(e.type){case F.LITERAL:return V.CreateLiteral(e.value);case F.OP_NOT:return V.CreateNot(it(t));case F.BINARY_AND:{let r=it(t),o=it(t);return V.CreateAnd(r,o)}case F.BINARY_OR:{let r=it(t),o=it(t);return V.CreateOr(r,o)}}return null},"make"),st=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===F.OP_NOT)return!st(t.left,e);if(t.op===F.BINARY_OR)return st(t.left,e)||st(t.right,e);if(t.op===F.BINARY_AND)return st(t.left,e)&&st(t.right,e)},"nodeEvaluator");is.exports={make:it,nodeEvaluator:st}});var ps=Se((yf,ls)=>{var ul=rs(),as=ns(),cs=ss(),dl=n((t,e)=>{let r=ul(t),o=as.PolishNotation(r),i=as.PolishGenerator(o),s=cs.make(i);return cs.nodeEvaluator(s,e)},"parse");ls.exports={parse:dl}});var fu={};vn(fu,{addOptinChangedCallback:()=>Bp,addTemplate:()=>zp,autoInit:()=>uu,clear:()=>Yp,config:()=>Wp,default:()=>du,disableOptinChangedCallbacks:()=>Jp,getOptins:()=>Kp,getProductsForPurchasePost:()=>Qp,initialize:()=>Zp,isReady:()=>Gp,offers:()=>O,platform:()=>q,previewMode:()=>Xp,register:()=>eu,resolveSettings:()=>tu,setAuthUrl:()=>ru,setEnvironment:()=>ou,setLocale:()=>nu,setMerchantId:()=>iu,setPublicPath:()=>su,setTemplates:()=>au,setupCart:()=>cu,setupProduct:()=>lu,setupProducts:()=>pu,store:()=>ga});function Kr(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(Kr,"symbolObservablePonyfill");var Fe;typeof self<"u"?Fe=self:typeof window<"u"||typeof window<"u"?Fe=window:typeof module<"u"?Fe=module:Fe=Function("return this")();var Oa=Kr(Fe),Qr=Oa;var Zr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),dt={INIT:"@@redux/INIT"+Zr(),REPLACE:"@@redux/REPLACE"+Zr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Zr()},"PROBE_UNKNOWN_ACTION")};function Pa(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(Pa,"isPlainObject");function Xr(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(Xr)(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 f(){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(f,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var E=!0;return p(),c.push(m),n(function(){if(!!E){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");E=!1,p();var _=c.indexOf(m);c.splice(_,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!Pa(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,s=i(s,m)}finally{l=!1}for(var E=a=c,T=0;T<E.length;T++){var _=E[T];_()}return m}n(h,"dispatch");function b(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:dt.REPLACE})}n(b,"replaceReducer");function S(){var m,E=u;return m={subscribe:n(function(_){if(typeof _!="object"||_===null)throw new TypeError("Expected the observer to be an object.");function w(){_.next&&_.next(f())}n(w,"observeState"),w();var C=E(w);return{unsubscribe:C}},"subscribe")},m[Qr]=function(){return this},m}return n(S,"observable"),h({type:dt.INIT}),o={dispatch:h,subscribe:u,getState:f,replaceReducer:b},o[Qr]=S,o}n(Xr,"createStore");function Ta(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(Ta,"getUndefinedStateErrorMessage");function wa(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:dt.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:dt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+dt.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(wa,"assertReducerShape");function Mt(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{wa(r)}catch(l){c=l}return n(function(p,f){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var h=!1,b={},S=0;S<s.length;S++){var m=s[S],E=r[m],T=p[m],_=E(T,f);if(typeof _>"u"){var w=Ta(m,f);throw new Error(w)}b[m]=_,h=h||_!==T}return h=h||s.length!==Object.keys(p).length,h?b:p},"combination")}n(Mt,"combineReducers");function Pn(t,e){return function(){return e(t.apply(this,arguments))}}n(Pn,"bindActionCreator");function wn(t,e){if(typeof t=="function")return Pn(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]=Pn(i,e))}return r}n(wn,"bindActionCreators");function Ca(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ca,"_defineProperty");function Tn(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(Tn,"ownKeys");function Ra(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tn(r,!0).forEach(function(o){Ca(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Ra,"_objectSpread2");function eo(){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(eo,"compose");function Cn(){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=eo.apply(void 0,c)(i.dispatch),Ra({},i,{dispatch:s})}}}n(Cn,"applyMiddleware");function Rn(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(Rn,"createThunkMiddleware");var An=Rn();An.withExtraArgument=Rn;var Nn=An;var Oi=ce(Vt());var kn=/^og_auth=/,Aa=n((t=kn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(kn,""),"c"),jt=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"),Na=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"),Ia=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function qn(){return typeof window.og_auth<"u"?jt(window.og_auth):null}n(qn,"a");async function ka(t=100){return new Promise(e=>{setTimeout(()=>e(qn()),t)})}n(ka,"f");async function Dn(t,e=Aa,r=Na){let o;if(o=jt(qn())||jt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Ia(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await ka());if(o=jt(o),o)return o;throw new Error("Unauthorized")}n(Dn,"u");var R="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ie="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ue="SET_MERCHANT_ID",J="REQUEST_OFFER",P="RECEIVE_OFFER",ft="PRODUCT_HAS_CHANGED",Le="CREATED_SESSION_ID",Ht="SET_AUTH_URL",Fn="REQUEST_AUTH",Gt="AUTHORIZE",Ee="UNAUTHORIZED",Un="REQUEST_ORDERS",Bt="RECEIVE_ORDERS",ht="CART_PRODUCT_KEY_HAS_CHANGED",zt="RECEIVE_ORDER_ITEMS",Ln="FETCH_RESPONSE_ERROR",Me="SET_ENVIRONMENT_STAGING",$e="SET_ENVIRONMENT_DEV",Ve="SET_ENVIRONMENT_PROD",Mn="CONCLUDE_UPSELL",$n="REQUEST_CREATE_IU_ORDER",Yt="CREATE_ONE_TIME",Vn="REQUEST_CONVERT_ONE_TIME",Wt="CONVERT_ONE_TIME";var je="CHECKOUT",jn="RECEIVE_FETCH",Jt="SET_LOCALE",He="SET_CONFIG",le="SET_PREVIEW_STANDARD_OFFER",mt="SET_PREVIEW_UPSELL_OFFER",to="SET_PREVIEW_PREPAID_OFFER",Kt="ADD_TEMPLATE",Qt="SET_TEMPLATES",xe="LOCAL_STORAGE_CHANGE",pe="LOCAL_STORAGE_CLEAR",Zt="SET_FIRST_ORDER_PLACE_DATE",Xt="SET_PRODUCT_TO_SUBSCRIBE",B="RECEIVE_PRODUCT_PLANS",K="SETUP_PRODUCT",ue="SETUP_CART",Ge="RECEIVE_MERCHANT_SETTINGS",ve="pdp",er="dev",Oe="staging",Pe="prod",tr="static.ordergroove.com",rr="staging.static.ordergroove.com",Hn="og-cart-updated";var ir=ce(bt());var io=n((...t)=>JSON.stringify(t),"memoizeKey"),_t=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),St=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"),Zn=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"),Xn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),gc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),yc=(0,ir.default)(_t(St((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let i=Xn([["session_id",e],["page_type",1],["p",gc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),io),bc=(0,ir.default)(_t(St(sr((t=1,e="place")=>[`/orders/?${Xn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),io),_c=(0,ir.default)(_t(St(sr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),io),Sc=_t(St(sr(Zn((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}}]})))),Et=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"),so=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Ec=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),ei=n(t=>[...new Set(t&&t.split(/\s+/))].filter(so).sort(Ec),"parseFrequenciesList");var xt=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"),xc=_t(St(sr(Zn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Et(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),de={fetchOffer:yc,fetchOrders:bc,fetchItems:_c,createOneTime:Sc,convertOneTimeToSubscription:xc};var ao=vt(),q={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(ao==null?void 0:ao.dataset.shopifySellingPlans)!="undefined"};function vc(t,e){return t===e}n(vc,"defaultEqualityCheck");function Oc(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(Oc,"areArgumentsShallowlyEqual");function Pc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vc,r=null,o=null;return function(){return Oc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Pc,"defaultMemoize");function Tc(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(Tc,"getDependencies");function wc(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=Tc(s),f=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],b=p.length,S=0;S<b;S++)h.push(p[S].apply(null,arguments));return f.apply(null,h)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}n(wc,"createSelectorCreator");var Q=wc(Pc);var z=ce(bt());z.default.Cache=Map;function Cc(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(Cc,"arraysEqual");function Rc(t,e,r){let o=xt(r);return q.shopify_selling_plans?te(t,e,o):o}n(Rc,"resolveFrequency");var A=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Cc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Ot=n(t=>t.optedin||[],"optedinSelector"),ti=n(t=>t.optedout||[],"optedoutSelector"),co=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Ac=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Nc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Ic=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),kc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),qc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),Z=(0,z.default)(t=>Q(Ot,ti,co,(e,r,o)=>{let i=e.find(s=>A(t,s));return i||(r.find(s=>A(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),ar=(0,z.default)(t=>Q(Ot,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),ri=(0,z.default)(t=>Q(Ot,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),X=(0,z.default)(t=>Q(qc,e=>e[t.id]||null),t=>JSON.stringify(t)),cr=(0,z.default)(t=>Q(ti,e=>e.find(r=>A(t,r))));var ee=(0,z.default)(t=>Q(Z(t),e=>e&&e.frequency||null)),U=(0,z.default)(t=>Q(Z(t),e=>e&&e.prepaidShipments||null)),L=(0,z.default)(t=>Q(kc,e=>{var o;return(((o=e[x(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),ze=(0,z.default)(t=>Q(Ac,Nc,Ic,(e,r,o)=>e[x(t)]&&Rc(r,o,e[x(t)])||null)),lo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),M=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(lo(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ye=n(t=>({templates:t.templates||[]}),"templatesSelector");function lr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(lr,"onReady");function vt(){return document.querySelector([`script[src^="https://${tr}"]`,`script[src^="https://${rr}"]`,`script[src^="http://${tr}"]`,`script[src^="http://${rr}"]`].join(","))}n(vt,"getMainJs");function po(){let t=vt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Oe)?Oe:Pe,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(po,"resolveEnvAndMerchant");var x=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=q)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),oi=n((t,e)=>{var r;if(q.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Pt=n((t,e)=>{var o,i,s;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:((i=e.frequencies)==null?void 0:i.length)>0&&((s=e.frequenciesEveryPeriod)==null?void 0:s.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),e.frequencies[0]):t},"frequencyToSellingPlan");function ni(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=po();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===Pe?tr:rr}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(ni,"autoInitializeOffers");var ii=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function si(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(si,"getCookieValue");var We=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),fe=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),pr=n((t=[],e=[])=>{var r;return!!(((r=q)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),te=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 uo(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(uo,"getOrCreateHidden");function Je(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Je,"getMatchingProductIfExists");var Y=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Ke=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),ai=n((t,e)=>({type:ft,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),ur=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),me=n((t,e,r)=>({type:ie,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var ci=n(t=>({type:Mn,payload:{product:t}}),"concludeUpsell"),li=n(t=>({type:Ue,payload:t}),"setMerchantId"),ho=n(t=>({type:Le,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Dc=n(t=>({type:Fn,payload:t}),"requestAuth"),Tt=n((t,e,r,o)=>({type:Gt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),he=n(t=>({type:Ee,payload:t}),"unauthorized"),pi=n(t=>({type:Ht,payload:t}),"setAuthUrl"),dr=n(t=>({type:jn,payload:t}),"fetchDone"),ui=n((t=Dn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(he({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Dc(s);return r(a),t(s).then(({sig_field:c,ts:l,sig:p})=>r(Tt(i,c,l,p)),c=>r(he(c))).finally(()=>r(dr(a)))},"fetchAuthThunk"),"fetchAuth"),Fc=n((t,e)=>({type:Un,payload:{status:t,ordering:e}}),"requestOrders"),mo=n(t=>({type:Bt,payload:t}),"receiveOrders"),go=n(t=>({type:zt,payload:t}),"receiveItems"),fr=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(he("No auth set."));let c=Fc(t,e);return o(c),de.fetchOrders(s,a,t,e).then(l=>{if(l.results){o(mo(l));let p=(l.results[0]||{}).public_id;if(p)return de.fetchItems(s,a,p).then(f=>o(go(f)))}return o(he(l.detail)),null},l=>o(he(l))).finally(()=>o(dr(c)))},"fetchOrdersThunk"),"fetchOrders"),yo=n(t=>{switch(t){case er:return{type:$e,payload:t};case Oe:return{type:Me,payload:t};case Pe:return{type:Ve,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),di=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(ho(r)),o},"requestSessionId"),Ce=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),fo=n(t=>({type:Ln,payload:t}),"fetchResponseError"),Uc=n((t,e=ve,r)=>({type:J,payload:{product:t,module:e,offer:r}}),"requestOffer"),fi=n((t,e=ve,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=s(),p=Uc(t,e,r);i(p);let f=x(t);return f?de.fetchOffer(l,a,c,f,e).then(u=>i(Ce(u,r)),u=>i(fo(u))).finally(()=>i(dr(p))):null},"fetchOfferThunk"),"fetchOffer"),hi=n(()=>({type:je}),"checkout"),Lc=n((t,e,r,o)=>({type:$n,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Mc=n(t=>({type:Yt,payload:t}),"receiveCreateOneTime"),$c=n((t,e)=>({type:Vn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Vc=n((t,e)=>({type:Wt,payload:{response:t,product:e}}),"receiveConvertOneTime"),mi=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:f},previewUpsellOffer:u,offerId:h}=c();if(!l)return a(he("No auth set."));let b=oi(i,p),S=Lc(t,e,r,h);return a(S),(u?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:h}):de.createOneTime(f,l,t.id,e,r,h)).then(m=>(a(Mc(m)),o?(a($c(m,b)),(u?Promise.resolve({item:m,frequency:b}):de.convertOneTimeToSubscription(f,l,m,b,h)).then(E=>a(Vc(E,t)),E=>a(fo(E)))):m),m=>a(fo(m))).finally(()=>a(dr(S)))},"createIuThunk"),"createIu"),gi=n(t=>({type:Jt,payload:t}),"setLocale"),yi=n(t=>({type:He,payload:t}),"setConfig"),bi=n((t,e,r)=>({type:Kt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),_i=n(t=>({type:Qt,payload:t}),"setTemplates"),Si=n((t,e)=>({type:Zt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Ei=n((t,e)=>({type:Xt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),xi=n(t=>({type:Ge,payload:t}),"receiveMerchantSettings");var wt="OG_STATE",Pi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),bo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Ti=n(()=>bo()?{}:Pi(localStorage.getItem(wt)),"loadState"),jc=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"),wi=n(t=>{if(bo())return;let e=jc(t);e&&localStorage.getItem(wt)!==e&&localStorage.setItem(wt,e)},"saveState"),Ci=n(t=>(0,Oi.throttle)(500,e=>{if(bo())return;let{key:r,newValue:o}=e;r===wt&&o===null?(t.dispatch({type:pe}),setTimeout(()=>t.dispatch(di()),0)):r===wt&&t.dispatch({type:xe,newValue:Pi(o)})}),"listenLocalStorageChanges");var Ai=ce(Vt());var Hc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ri=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Hc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Gc=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Ri(!0)},{expressions:[({type:t}={})=>t===I],fn:Ri(!1)}],Ni=n(t=>e=>r=>{let o=t.getState();Gc.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Ii=n(t=>e=>r=>{var i;let o;switch(r.type){case P:case I:case R:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),ki=n(t=>e=>r=>{e(r);let o=(0,Ai.throttle)(500,()=>{wi({...t.getState()})});r.type!==xe&&o()},"localStorageMiddleware");var _o=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function qi(t){let[e,r]=_o(),[o,i]=_o(),[s,a]=_o();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(ho(l)):a(p)});let c=Promise.all([o,e,s]);return c.then(()=>{var l;window.addEventListener("storage",Ci(t)),(l=t.getState().auth)!=null&&l.ts||t.dispatch(ui())}),l=>async p=>{$e===p.type||Me===p.type||Ve===p.type?r(p.payload):Ue===p.type?i(p.payload):Le===p.type?a(p.payload):await c,l(p)}}n(qi,"waitUntilOffersReady");function Di(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"}):eo,i=[qi,Nn,Ni,Ii],s={};if(!r)try{s=Ti(),i.push(ki)}catch{}let a=o(Cn(...i,...e.filter(l=>l))),c=Xr(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Di,"makeStore");var Bc=Object.defineProperty,hr=n((t,e)=>Bc(t,"name",{value:e,configurable:!0}),"i"),zc=hr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Ui=["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],Fi=hr(t=>(e,r)=>{Ui.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function So(t=window.opener,e=window.og){let r=hr(o=>{let i=zc(Ui),s=Fi(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.7/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Fi(t)("READY"))}n(So,"h");hr(So,"offersLiveEditor");var mr=null,Yc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Li=n(t=>{if(!mr)throw new Error("Missing redux store.");return mr},"resolveStore"),Wc=n((t,e)=>r=>{let{getState:o,dispatch:i}=Li(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=Yc)=>r=>{let i=Wc(t,typeof e=="function"?e:s=>wn(e,s));return class extends r{get store(){return mr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Li(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"),Mi=n(t=>{mr=t},"setStore");var Eo=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],...Et(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"),Qe=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 xo=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Re=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var $=`{{lit-${String(Math.random()).slice(2)}}}`,vo=`<!--${$}-->`,$i=new RegExp(`${$}|${vo}`),Ze="$lit$",ge=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:f}}=e;for(;l<f;){let u=s.nextNode();if(u===null){s.currentNode=i.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:b}=h,S=0;for(let m=0;m<b;m++)Vi(h[m].name,Ze)&&S++;for(;S-- >0;){let m=p[l],E=gr.exec(m)[2],T=E.toLowerCase()+Ze,_=u.getAttribute(T);u.removeAttribute(T);let w=_.split($i);this.parts.push({type:"attribute",index:c,name:E,strings:w}),l+=w.length-1}}u.tagName==="TEMPLATE"&&(i.push(u),s.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf($)>=0){let b=u.parentNode,S=h.split($i),m=S.length-1;for(let E=0;E<m;E++){let T,_=S[E];if(_==="")T=re();else{let w=gr.exec(_);w!==null&&Vi(w[2],Ze)&&(_=_.slice(0,w.index)+w[1]+w[2].slice(0,-Ze.length)+w[3]),T=document.createTextNode(_)}b.insertBefore(T,u),this.parts.push({type:"node",index:++c})}S[m]===""?(b.insertBefore(re(),u),o.push(u)):u.data=S[m],l+=m}}else if(u.nodeType===8)if(u.data===$){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(re(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let h=-1;for(;(h=u.data.indexOf($,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(ge,"Template");var Vi=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Ct=n(t=>t.index!==-1,"isTemplatePartActive"),re=n(()=>document.createComment(""),"createMarker"),gr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Oo=133;function Po(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Oo,null,!1),s=Rt(o),a=o[s],c=-1,l=0,p=[],f=null;for(;i.nextNode();){c++;let u=i.currentNode;for(u.previousSibling===f&&(f=null),e.has(u)&&(p.push(u),f===null&&(f=u)),f!==null&&l++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-l,s=Rt(o,s),a=o[s]}p.forEach(u=>u.parentNode.removeChild(u))}n(Po,"removeNodesFromTemplate");var Kc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Oo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Rt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Ct(o))return r}return-1},"nextActiveIndexInTemplateParts");function ji(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Oo,null,!1),a=Rt(i),c=0,l=-1;for(;s.nextNode();)for(l++,s.currentNode===r&&(c=Kc(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===l;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Rt(i,a);return}a=Rt(i,a)}}n(ji,"insertNodeIntoTemplate");var Qc=new WeakMap;var Ae=n(t=>typeof t=="function"&&Qc.has(t),"isDirective");var D={},yr={};var se=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=xo?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],!Ct(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 xo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(se,"TemplateInstance");var Hi=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Xc=` ${$} `,oe=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=gr.exec(s);c===null?r+=s+(o?Xc:vo):r+=s.substr(0,c.index)+c[1]+c[2]+Ze+c[3]+$}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Hi!==void 0&&(r=Hi.createHTML(r)),e.innerHTML=r,e}};n(oe,"TemplateResult");var _r=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),br=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ne=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 Xe(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"||!br(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(_r(c)||!br(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(Ne,"AttributeCommitter");var Xe=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==D&&(!_r(e)||e!==this.value)&&(this.value=e,Ae(e)||(this.committer.dirty=!0))}commit(){for(;Ae(this.value);){let e=this.value;this.value=D,e(this)}this.value!==D&&this.committer.commit()}};n(Xe,"AttributePart");var ne=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(re()),this.endNode=e.appendChild(re())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=re()),e.__insert(this.endNode=re())}insertAfterPart(e){e.__insert(this.startNode=re()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ae(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}let e=this.__pendingValue;e!==D&&(_r(e)?e!==this.value&&this.__commitText(e):e instanceof oe?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):br(e)?this.__commitIterable(e):e===yr?(this.value=yr,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 se&&this.value.template===r)this.value.update(e.values);else{let o=new se(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 ne(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){Re(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ne,"NodePart");var et=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(;Ae(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}if(this.__pendingValue===D)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=D}};n(et,"BooleanAttributePart");var tt=class extends Ne{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new At(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(tt,"PropertyCommitter");var At=class extends Xe{};n(At,"PropertyPart");var Gi=!1;(()=>{try{let t={get capture(){return Gi=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var rt=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(;Ae(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=D,s(this)}if(this.__pendingValue===D)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=el(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=D}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(rt,"EventPart");var el=n(t=>t&&(Gi?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function To(t){let e=Ie.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ie.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join($);return r=e.keyString.get(o),r===void 0&&(r=new ge(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(To,"templateFactory");var Ie=new Map;var ye=new WeakMap,wo=n((t,e,r)=>{let o=ye.get(e);o===void 0&&(Re(e,e.firstChild),ye.set(e,o=new ne(Object.assign({templateFactory:To},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Nt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new tt(e,r.slice(1),o).parts:s==="@"?[new rt(e,r.slice(1),i.eventContext)]:s==="?"?[new et(e,r.slice(1),o)]:new Ne(e,r,o).parts}handleTextExpression(e){return new ne(e)}};n(Nt,"DefaultTemplateProcessor");var Co=new Nt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var d=n((t,...e)=>new oe(t,e,"html",Co),"html");var zi=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Sr=!0;typeof window.ShadyCSS>"u"?Sr=!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."),Sr=!1);var rl=n(t=>e=>{let r=zi(e.type,t),o=Ie.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ie.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join($);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Sr&&window.ShadyCSS.prepareTemplateDom(a,t),i=new ge(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),ol=["html","svg"],nl=n(t=>{ol.forEach(e=>{let r=Ie.get(zi(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)}),Po(o,s)})})},"removeStylesFromLitTemplates"),Yi=new Set,il=n((t,e,r)=>{Yi.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 f=i[p];f.parentNode.removeChild(f),a.textContent+=f.textContent}nl(t);let c=o.content;r?ji(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),Po(r,p)}},"prepareTemplateStyles"),Wi=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=ye.has(e),s=Sr&&e.nodeType===11&&!!e.host,a=s&&!Yi.has(o),c=a?document.createDocumentFragment():e;if(wo(t,c,Object.assign({templateFactory:rl(o)},r)),a){let l=ye.get(c);ye.delete(c);let p=l.value instanceof se?l.value.template:void 0;il(o,c,p),Re(e,e.firstChild),e.appendChild(c),ye.set(e,l)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Ji;window.JSCompiler_renameProperty=(t,e)=>t;var qo={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Ki=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Ro={attribute:!0,type:String,converter:qo,reflect:!1,hasChanged:Ki},Ao=1,No=1<<2,Io=1<<3,ko=1<<4,Do="finalized",ot=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=Ro){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)||Ro}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Do)||e.finalize(),this[Do]=!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=Ki){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||qo,s=typeof i=="function"?i:i.fromAttribute;return s?s(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,i=r.converter;return(i&&i.toAttribute||qo.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=Ro){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|Io,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Io}}_attributeToProperty(e,r){if(this._updateState&Io)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|ko,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~ko}}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&ko)&&(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|No;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&No}get hasUpdated(){return this._updateState&Ao}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&Ao||(this._updateState=this._updateState|Ao,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~No}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(ot,"UpdatingElement");Ji=Do;ot[Ji]=!0;var Qi=Element.prototype,tf=Qi.msMatchesSelector||Qi.webkitMatchesSelector;var Er=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Fo=Symbol(),nt=class{constructor(e,r){if(r!==Fo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Er?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(nt,"CSSResult");var Zi=n(t=>new nt(String(t),Fo),"unsafeCSS"),sl=n(t=>{if(t instanceof nt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
12
- take care to ensure page security.`)},"textFromCSSResult"),y=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+sl(i)+t[s+1],t[0]);return new nt(r,Fo)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Xi={},v=class extends ot{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&&!Er){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return Zi(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):Er?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!==Xi&&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 Xi}};n(v,"LitElement");v.finalized=!0;v.render=Wi;var ys=ce(ps());var fl=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"),us=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var It=n(t=>{let e=us(t);if(!e){let r=t.offer;r&&(e=us(r))}return e},"resolveProduct"),hl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Uo=n(t=>class extends t{get offer(){return hl(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 Uo(t){get product(){return It(this)}},"withProduct"),vr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=fl(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Or={};vn(Or,{autoshipByDefault:()=>ml,eligibilityGroups:()=>Mo,eligible:()=>ds,hasPrepaidOptions:()=>Sl,hasUpcomingOrder:()=>ms,hasUpsellGroup:()=>hs,inStock:()=>Lo,optedout:()=>bl,prepaidEligible:()=>gl,prepaidSubscribed:()=>_l,regularEligible:()=>xl,subscribed:()=>yl,subscriptionEligible:()=>fs,upcomingOrderContainsProduct:()=>El,upsellEligible:()=>gs});var Lo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ds=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),ml=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),fs=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ds(t,e)&&Lo(t,e),"subscriptionEligible"),Mo=n((t,e)=>{let r=x((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),hs=n((t,e)=>{let r=Mo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),gl=n((t,e)=>{let r=Mo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),yl=n((t,e)=>ar(e.product)(t),"subscribed"),bl=n((t,e)=>cr(e.product)(t),"optedout"),_l=n((t,e)=>ri(e.product)(t),"prepaidSubscribed"),Sl=n((t,e)=>L(e.product.id)(t).length>0,"hasPrepaidOptions"),ms=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),El=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),gs=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&Lo(t,e)&&ms(t)&&hs(t,e)},"upsellEligible"),xl=n((t,e)=>fs(t,e)&&!gs(t,e),"regularEligible");var vl=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Pr=class extends N(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return d``;let e=vl(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),ys.default.parse(e,o=>Or[o]&&Or[o](this.state,this))?d`
11
+ var lib=(()=>{var Ra=Object.create;var dt=Object.defineProperty;var Aa=Object.getOwnPropertyDescriptor;var Na=Object.getOwnPropertyNames;var Ia=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var n=(t,e)=>dt(t,"name",{value:e,configurable:!0});var J=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cn=(t,e)=>{for(var r in e)dt(t,r,{get:e[r],enumerable:!0})},Rn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Na(e))!ka.call(t,i)&&i!==r&&dt(t,i,{get:()=>e[i],enumerable:!(o=Aa(e,i))||o.enumerable});return t};var se=(t,e,r)=>(r=t!=null?Ra(Ia(t)):{},Rn(e||!t||!t.__esModule?dt(r,"default",{value:t,enumerable:!0}):r,t)),qa=t=>Rn(dt({},"__esModule",{value:!0}),t);var jt=J((Vt,Un)=>{(function(t,e){typeof Vt=="object"&&typeof Un<"u"?e(Vt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Vt,function(t){"use strict";function e(o,i,s,a){var c,l=!1,p=0;function d(){c&&clearTimeout(c)}n(d,"clearExistingTimeout");function u(){d(),l=!0}n(u,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function h(){for(var b=arguments.length,S=new Array(b),m=0;m<b;m++)S[m]=arguments[m];var E=this,P=Date.now()-p;if(l)return;function _(){p=Date.now(),s.apply(E,S)}n(_,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&_(),d(),a===void 0&&P>o?_():i!==!0&&(c=setTimeout(a?w:_,a===void 0?o-P:o))}return n(h,"wrapper"),h.cancel=u,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var _t=J((Lu,oi)=>{var Ba="Expected a function",Qn="__lodash_hash_undefined__",za="[object Function]",Ya="[object GeneratorFunction]",Wa=/[\\^$.*+?()[\]{}|]/g,Ja=/^\[object .+?Constructor\]$/,Ka=typeof window=="object"&&window&&window.Object===Object&&window,Qa=typeof self=="object"&&self&&self.Object===Object&&self,Zn=Ka||Qa||Function("return this")();function Za(t,e){return t?.[e]}n(Za,"getValue");function Xa(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Xa,"isHostObject");var ec=Array.prototype,tc=Function.prototype,Xn=Object.prototype,no=Zn["__core-js_shared__"],Kn=function(){var t=/[^.]+$/.exec(no&&no.keys&&no.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ei=tc.toString,io=Xn.hasOwnProperty,rc=Xn.toString,oc=RegExp("^"+ei.call(io).replace(Wa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nc=ec.splice,ic=ti(Zn,"Map"),bt=ti(Object,"create");function we(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(we,"Hash");function sc(){this.__data__=bt?bt(null):{}}n(sc,"hashClear");function ac(t){return this.has(t)&&delete this.__data__[t]}n(ac,"hashDelete");function cc(t){var e=this.__data__;if(bt){var r=e[t];return r===Qn?void 0:r}return io.call(e,t)?e[t]:void 0}n(cc,"hashGet");function lc(t){var e=this.__data__;return bt?e[t]!==void 0:io.call(e,t)}n(lc,"hashHas");function pc(t,e){var r=this.__data__;return r[t]=bt&&e===void 0?Qn:e,this}n(pc,"hashSet");we.prototype.clear=sc;we.prototype.delete=ac;we.prototype.get=cc;we.prototype.has=lc;we.prototype.set=pc;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 uc(){this.__data__=[]}n(uc,"listCacheClear");function dc(t){var e=this.__data__,r=nr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():nc.call(e,r,1),!0}n(dc,"listCacheDelete");function fc(t){var e=this.__data__,r=nr(e,t);return r<0?void 0:e[r][1]}n(fc,"listCacheGet");function hc(t){return nr(this.__data__,t)>-1}n(hc,"listCacheHas");function mc(t,e){var r=this.__data__,o=nr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(mc,"listCacheSet");ze.prototype.clear=uc;ze.prototype.delete=dc;ze.prototype.get=fc;ze.prototype.has=hc;ze.prototype.set=mc;function Ce(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Ce,"MapCache");function gc(){this.__data__={hash:new we,map:new(ic||ze),string:new we}}n(gc,"mapCacheClear");function yc(t){return ir(this,t).delete(t)}n(yc,"mapCacheDelete");function bc(t){return ir(this,t).get(t)}n(bc,"mapCacheGet");function _c(t){return ir(this,t).has(t)}n(_c,"mapCacheHas");function Sc(t,e){return ir(this,t).set(t,e),this}n(Sc,"mapCacheSet");Ce.prototype.clear=gc;Ce.prototype.delete=yc;Ce.prototype.get=bc;Ce.prototype.has=_c;Ce.prototype.set=Sc;function nr(t,e){for(var r=t.length;r--;)if(Tc(t[r][0],e))return r;return-1}n(nr,"assocIndexOf");function Ec(t){if(!ri(t)||vc(t))return!1;var e=Pc(t)||Xa(t)?oc:Ja;return e.test(Oc(t))}n(Ec,"baseIsNative");function ir(t,e){var r=t.__data__;return xc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(ir,"getMapData");function ti(t,e){var r=Za(t,e);return Ec(r)?r:void 0}n(ti,"getNative");function xc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(xc,"isKeyable");function vc(t){return!!Kn&&Kn in t}n(vc,"isMasked");function Oc(t){if(t!=null){try{return ei.call(t)}catch{}try{return t+""}catch{}}return""}n(Oc,"toSource");function so(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ba);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(so.Cache||Ce),r}n(so,"memoize");so.Cache=Ce;function Tc(t,e){return t===e||t!==t&&e!==e}n(Tc,"eq");function Pc(t){var e=ri(t)?rc.call(t):"";return e==za||e==Ya}n(Pc,"isFunction");function ri(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(ri,"isObject");oi.exports=so});var vr=J((Rf,ss)=>{var bl={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"};ss.exports=bl});var cs=J((Af,as)=>{var qe=vr(),_l=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case qe.PAR_OPEN:case qe.PAR_CLOSE:case qe.OP_NOT:case qe.BINARY_AND:case qe.BINARY_OR:e&&(r.push({type:qe.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:qe.LITERAL,value:e}),r},"Tokenizer");as.exports=_l});var ps=J((Nf,ls)=>{var Se=vr(),Sl=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Se.LITERAL:e.unshift(i);break;case Se.BINARY_AND:case Se.BINARY_OR:case Se.OP_NOT:case Se.PAR_OPEN:r.push(i);break;case Se.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Se.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Se.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),El=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");ls.exports={PolishNotation:Sl,PolishGenerator:El}});var ds=J((If,us)=>{var F=vr(),V=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===F.LEAF}isAtomic(){return this.isLeaf()||this.op===F.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new V(F.BINARY_AND,e,r)}static CreateNot(e){return new V(F.OP_NOT,e)}static CreateOr(e,r){return new V(F.BINARY_OR,e,r)}static CreateLiteral(e){return new V(F.LEAF,null,null,e)}};n(V,"ExpNode");var st=n(t=>{let e=t.next().value;switch(e.type){case F.LITERAL:return V.CreateLiteral(e.value);case F.OP_NOT:return V.CreateNot(st(t));case F.BINARY_AND:{let r=st(t),o=st(t);return V.CreateAnd(r,o)}case F.BINARY_OR:{let r=st(t),o=st(t);return V.CreateOr(r,o)}}return null},"make"),at=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===F.OP_NOT)return!at(t.left,e);if(t.op===F.BINARY_OR)return at(t.left,e)||at(t.right,e);if(t.op===F.BINARY_AND)return at(t.left,e)&&at(t.right,e)},"nodeEvaluator");us.exports={make:st,nodeEvaluator:at}});var gs=J((kf,ms)=>{var xl=cs(),fs=ps(),hs=ds(),vl=n((t,e)=>{let r=xl(t),o=fs.PolishNotation(r),i=fs.PolishGenerator(o),s=hs.make(i);return hs.nodeEvaluator(s,e)},"parse");ms.exports={parse:vl}});var Sa=J((My,vn)=>{function tu(t,e){var r,o,i,s,a,c,l,p,d,u;for(r=t.length&3,o=t.length-r,i=e,a=3432918353,l=461845907,u=0;u<o;)d=t.charCodeAt(u)&255|(t.charCodeAt(++u)&255)<<8|(t.charCodeAt(++u)&255)<<16|(t.charCodeAt(++u)&255)<<24,++u,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*l+(((d>>>16)*l&65535)<<16)&4294967295,i^=d,i=i<<13|i>>>19,s=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(s&65535)+27492+(((s>>>16)+58964&65535)<<16);switch(d=0,r){case 3:d^=(t.charCodeAt(u+2)&255)<<16;case 2:d^=(t.charCodeAt(u+1)&255)<<8;case 1:d^=t.charCodeAt(u)&255,d=(d&65535)*a+(((d>>>16)*a&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*l+(((d>>>16)*l&65535)<<16)&4294967295,i^=d}return i^=t.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}n(tu,"murmurhash3_32_gc");typeof vn<"u"&&(vn.exports=tu)});var Ea=J(($y,On)=>{function ru(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(ru,"murmurhash2_32_gc");typeof On!==void 0&&(On.exports=ru)});var va=J((Vy,Qr)=>{var xa=Sa(),ou=Ea();Qr.exports=xa;Qr.exports.murmur3=xa;Qr.exports.murmur2=ou});var Ru={};Cn(Ru,{addOptinChangedCallback:()=>au,addTemplate:()=>cu,autoInit:()=>wu,clear:()=>lu,config:()=>pu,default:()=>Cu,disableOptinChangedCallbacks:()=>uu,getOptins:()=>du,getProductsForPurchasePost:()=>fu,initialize:()=>hu,isReady:()=>su,offers:()=>O,platform:()=>q,previewMode:()=>mu,register:()=>gu,resolveSettings:()=>yu,setAuthUrl:()=>bu,setEnvironment:()=>_u,setLocale:()=>Su,setMerchantId:()=>Eu,setPublicPath:()=>xu,setTemplates:()=>vu,setupCart:()=>Ou,setupProduct:()=>Tu,setupProducts:()=>Pu,store:()=>wa});function Zr(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(Zr,"symbolObservablePonyfill");var Ue;typeof self<"u"?Ue=self:typeof window<"u"||typeof window<"u"?Ue=window:typeof module<"u"?Ue=module:Ue=Function("return this")();var Da=Zr(Ue),Xr=Da;var eo=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),ft={INIT:"@@redux/INIT"+eo(),REPLACE:"@@redux/REPLACE"+eo(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+eo()},"PROBE_UNKNOWN_ACTION")};function Fa(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(Fa,"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 d(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}n(d,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var E=!0;return p(),c.push(m),n(function(){if(!!E){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");E=!1,p();var _=c.indexOf(m);c.splice(_,1),a=null}},"unsubscribe")}n(u,"subscribe");function h(m){if(!Fa(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,s=i(s,m)}finally{l=!1}for(var E=a=c,P=0;P<E.length;P++){var _=E[P];_()}return m}n(h,"dispatch");function b(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:ft.REPLACE})}n(b,"replaceReducer");function S(){var m,E=u;return m={subscribe:n(function(_){if(typeof _!="object"||_===null)throw new TypeError("Expected the observer to be an object.");function w(){_.next&&_.next(d())}n(w,"observeState"),w();var C=E(w);return{unsubscribe:C}},"subscribe")},m[Xr]=function(){return this},m}return n(S,"observable"),h({type:ft.INIT}),o={dispatch:h,subscribe:u,getState:d,replaceReducer:b},o[Xr]=S,o}n(to,"createStore");function Ua(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(Ua,"getUndefinedStateErrorMessage");function La(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:ft.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:ft.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+ft.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(La,"assertReducerShape");function $t(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{La(r)}catch(l){c=l}return n(function(p,d){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var h=!1,b={},S=0;S<s.length;S++){var m=s[S],E=r[m],P=p[m],_=E(P,d);if(typeof _>"u"){var w=Ua(m,d);throw new Error(w)}b[m]=_,h=h||_!==P}return h=h||s.length!==Object.keys(p).length,h?b:p},"combination")}n($t,"combineReducers");function An(t,e){return function(){return e(t.apply(this,arguments))}}n(An,"bindActionCreator");function In(t,e){if(typeof t=="function")return An(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]=An(i,e))}return r}n(In,"bindActionCreators");function Ma(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ma,"_defineProperty");function Nn(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(Nn,"ownKeys");function $a(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nn(r,!0).forEach(function(o){Ma(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n($a,"_objectSpread2");function ro(){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(ro,"compose");function kn(){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=ro.apply(void 0,c)(i.dispatch),$a({},i,{dispatch:s})}}}n(kn,"applyMiddleware");function qn(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(qn,"createThunkMiddleware");var Dn=qn();Dn.withExtraArgument=qn;var Fn=Dn;var Ai=se(jt());var Ln=/^og_auth=/,Va=n((t=Ln)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Ln,""),"c"),Ht=n(t=>{if(typeof t=="object")return t;let e=String(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"r"),ja=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),Ha=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Mn(){return typeof window.og_auth<"u"?Ht(window.og_auth):null}n(Mn,"a");async function Ga(t=100){return new Promise(e=>{setTimeout(()=>e(Mn()),t)})}n(Ga,"f");async function $n(t,e=Va,r=ja){let o;if(o=Ht(Mn())||Ht(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Ha(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ga());if(o=Ht(o),o)return o;throw new Error("Unauthorized")}n($n,"u");var R="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ae="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Le="SET_MERCHANT_ID",K="REQUEST_OFFER",T="RECEIVE_OFFER",ht="PRODUCT_HAS_CHANGED",Me="CREATED_SESSION_ID",Gt="SET_AUTH_URL",Vn="REQUEST_AUTH",Bt="AUTHORIZE",xe="UNAUTHORIZED",jn="REQUEST_ORDERS",zt="RECEIVE_ORDERS",mt="CART_PRODUCT_KEY_HAS_CHANGED",Yt="RECEIVE_ORDER_ITEMS",Hn="FETCH_RESPONSE_ERROR",$e="SET_ENVIRONMENT_LOCAL",Ve="SET_ENVIRONMENT_STAGING",je="SET_ENVIRONMENT_DEV",He="SET_ENVIRONMENT_PROD",Gn="CONCLUDE_UPSELL",Bn="REQUEST_CREATE_IU_ORDER",Wt="CREATE_ONE_TIME",zn="REQUEST_CONVERT_ONE_TIME",Jt="CONVERT_ONE_TIME";var Ge="CHECKOUT",Yn="RECEIVE_FETCH",Kt="SET_LOCALE",Be="SET_CONFIG",pe="SET_PREVIEW_STANDARD_OFFER",gt="SET_PREVIEW_UPSELL_OFFER",oo="SET_PREVIEW_PREPAID_OFFER",Qt="ADD_TEMPLATE",Zt="SET_TEMPLATES",ve="LOCAL_STORAGE_CHANGE",ue="LOCAL_STORAGE_CLEAR",Xt="SET_FIRST_ORDER_PLACE_DATE",er="SET_PRODUCT_TO_SUBSCRIBE",B="RECEIVE_PRODUCT_PLANS",Q="SETUP_PRODUCT",de="SETUP_CART",fe="RECEIVE_MERCHANT_SETTINGS",Oe="pdp",Wn="local",tr="dev",Te="staging",Pe="prod",rr="static.ordergroove.com",or="staging.static.ordergroove.com",Jn="og-cart-updated";var sr=se(_t());var ao=n((...t)=>JSON.stringify(t),"memoizeKey"),St=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Et=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),ar=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"),ni=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"),ii=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),wc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Cc=(0,sr.default)(St(Et((t,e,r,o="pdp",i={})=>{var l;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",wc(r)],["module_view",JSON.stringify(["regular"])]],{experiments:a}=i,c=(l=a==null?void 0:a.variants)==null?void 0:l.at(a.currentVariant);return c&&s.push(["variant",c.public_id]),[`/offer/${t}/${o}?${ii(s)}`]})),ao),Rc=(0,sr.default)(St(Et(ar((t=1,e="place")=>[`/orders/?${ii([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),ao),Ac=(0,sr.default)(St(Et(ar(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),ao),Nc=St(Et(ar(ni((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),xt=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),co=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Ic=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),si=n(t=>[...new Set(t&&t.split(/\s+/))].filter(co).sort(Ic),"parseFrequenciesList");var vt=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),kc=St(Et(ar(ni((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=xt(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),he={fetchOffer:Cc,fetchOrders:Rc,fetchItems:Ac,createOneTime:Nc,convertOneTimeToSubscription:kc};var lo=Ot(),q={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(lo==null?void 0:lo.dataset.shopifySellingPlans)!="undefined"};function qc(t,e){return t===e}n(qc,"defaultEqualityCheck");function Dc(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(Dc,"areArgumentsShallowlyEqual");function Fc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qc,r=null,o=null;return function(){return Dc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Fc,"defaultMemoize");function Uc(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(Uc,"getDependencies");function Lc(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=Uc(s),d=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var h=[],b=p.length,S=0;S<b;S++)h.push(p[S].apply(null,arguments));return d.apply(null,h)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}n(Lc,"createSelectorCreator");var Z=Lc(Fc);var z=se(_t());z.default.Cache=Map;function Mc(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(Mc,"arraysEqual");function $c(t,e,r){let o=vt(r);return q.shopify_selling_plans?re(t,e,o):o}n($c,"resolveFrequency");var A=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Mc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Tt=n(t=>t.optedin||[],"optedinSelector"),ai=n(t=>t.optedout||[],"optedoutSelector"),po=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Vc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),jc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Hc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Gc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Bc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),X=(0,z.default)(t=>Z(Tt,ai,po,(e,r,o)=>{let i=e.find(s=>A(t,s));return i||(r.find(s=>A(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),cr=(0,z.default)(t=>Z(Tt,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),ci=(0,z.default)(t=>Z(Tt,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),ee=(0,z.default)(t=>Z(Bc,e=>e[t.id]||null),t=>JSON.stringify(t)),lr=(0,z.default)(t=>Z(ai,e=>e.find(r=>A(t,r))));var te=(0,z.default)(t=>Z(X(t),e=>e&&e.frequency||null)),U=(0,z.default)(t=>Z(X(t),e=>e&&e.prepaidShipments||null)),L=(0,z.default)(t=>Z(Gc,e=>{var o;return(((o=e[x(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ye=(0,z.default)(t=>Z(Vc,jc,Hc,(e,r,o)=>e[x(t)]&&$c(r,o,e[x(t)])||null)),uo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),M=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(uo(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),We=n(t=>({templates:t.templates||[]}),"templatesSelector");function pr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(pr,"onReady");function Ot(){return document.querySelector([`script[src^="https://${rr}"]`,`script[src^="https://${or}"]`,`script[src^="http://${rr}"]`,`script[src^="http://${or}"]`].join(","))}n(Ot,"getMainJs");function fo(){let t=Ot();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Te)?Te:Pe,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(fo,"resolveEnvAndMerchant");var x=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=q)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),li=n((t,e)=>{var r;if(q.shopify_selling_plans){let o=(r=e.frequencies)==null?void 0:r.indexOf(t);if(o>=0&&e.frequenciesEveryPeriod[o])return e.frequenciesEveryPeriod[o]}return t},"safeOgFrequency"),Pt=n((t,e)=>{var o,i,s;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:((i=e.frequencies)==null?void 0:i.length)>0&&((s=e.frequenciesEveryPeriod)==null?void 0:s.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),e.frequencies[0]):t},"frequencyToSellingPlan");function pi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=fo();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===Pe?rr:or}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(pi,"autoInitializeOffers");var ui=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function di(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(di,"getCookieValue");var Je=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),me=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),ur=n((t=[],e=[])=>{var r;return!!(((r=q)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),re=n((t,e,r)=>{if(t.length!==e.length)return null;let o=e.findIndex(i=>i===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");function ho(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(ho,"getOrCreateHidden");function Ke(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(Ke,"getMatchingProductIfExists");var Y=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Qe=n((t,e)=>({type:I,payload:{product:t,offer:e}}),"optoutProduct"),fi=n((t,e)=>({type:ht,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),dr=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),ye=n((t,e,r)=>({type:ae,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var hi=n(t=>({type:Gn,payload:{product:t}}),"concludeUpsell"),mi=n(t=>({type:Le,payload:t}),"setMerchantId"),go=n(t=>({type:Me,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),zc=n(t=>({type:Vn,payload:t}),"requestAuth"),wt=n((t,e,r,o)=>({type:Bt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ge=n(t=>({type:xe,payload:t}),"unauthorized"),gi=n(t=>({type:Gt,payload:t}),"setAuthUrl"),fr=n(t=>({type:Yn,payload:t}),"fetchDone"),yi=n((t=$n)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(ge({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=zc(s);return r(a),t(s).then(({sig_field:c,ts:l,sig:p})=>r(wt(i,c,l,p)),c=>r(ge(c))).finally(()=>r(fr(a)))},"fetchAuthThunk"),"fetchAuth"),Yc=n((t,e)=>({type:jn,payload:{status:t,ordering:e}}),"requestOrders"),yo=n(t=>({type:zt,payload:t}),"receiveOrders"),bo=n(t=>({type:Yt,payload:t}),"receiveItems"),hr=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(ge("No auth set."));let c=Yc(t,e);return o(c),he.fetchOrders(s,a,t,e).then(l=>{if(l.results){o(yo(l));let p=(l.results[0]||{}).public_id;if(p)return he.fetchItems(s,a,p).then(d=>o(bo(d)))}return o(ge(l.detail)),null},l=>o(ge(l))).finally(()=>o(fr(c)))},"fetchOrdersThunk"),"fetchOrders"),_o=n(t=>{switch(t){case Wn:return{type:$e,payload:t};case tr:return{type:je,payload:t};case Te:return{type:Ve,payload:t};case Pe:return{type:He,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),bi=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(go(r)),o},"requestSessionId"),Re=n((t,e)=>({type:T,payload:{...t,offer:e}}),"receiveOffer"),mo=n(t=>({type:Hn,payload:t}),"fetchResponseError"),Wc=n((t,e=Oe,r)=>({type:K,payload:{product:t,module:e,offer:r}}),"requestOffer"),_i=n((t,e=Oe,r)=>n(function(i,s){let a=s(),{merchantId:c,sessionId:l,environment:{apiUrl:p}}=a,d=Wc(t,e,r);i(d);let u=x(t);return u?he.fetchOffer(p,c,l,u,e,a).then(h=>i(Re(h,r)),h=>i(mo(h))).finally(()=>i(fr(d))):null},"fetchOfferThunk"),"fetchOffer"),Si=n(()=>({type:Ge}),"checkout"),Jc=n((t,e,r,o)=>({type:Bn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Kc=n(t=>({type:Wt,payload:t}),"receiveCreateOneTime"),Qc=n((t,e)=>({type:zn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Zc=n((t,e)=>({type:Jt,payload:{response:t,product:e}}),"receiveConvertOneTime"),Ei=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:d},previewUpsellOffer:u,offerId:h}=c();if(!l)return a(ge("No auth set."));let b=li(i,p),S=Jc(t,e,r,h);return a(S),(u?Promise.resolve({legoUrl:d,product:t,order:e,quantity:r,offer:h}):he.createOneTime(d,l,t.id,e,r,h)).then(m=>(a(Kc(m)),o?(a(Qc(m,b)),(u?Promise.resolve({item:m,frequency:b}):he.convertOneTimeToSubscription(d,l,m,b,h)).then(E=>a(Zc(E,t)),E=>a(mo(E)))):m),m=>a(mo(m))).finally(()=>a(fr(S)))},"createIuThunk"),"createIu"),xi=n(t=>({type:Kt,payload:t}),"setLocale"),vi=n(t=>({type:Be,payload:t}),"setConfig"),Oi=n((t,e,r)=>({type:Qt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Ti=n(t=>({type:Zt,payload:t}),"setTemplates"),Pi=n((t,e)=>({type:Xt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),wi=n((t,e)=>({type:er,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),Ci=n(t=>({type:fe,payload:t}),"receiveMerchantSettings");var Ct="OG_STATE",Ni=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),So=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Ii=n(()=>So()?{}:Ni(localStorage.getItem(Ct)),"loadState"),Xc=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"),ki=n(t=>{if(So())return;let e=Xc(t);e&&localStorage.getItem(Ct)!==e&&localStorage.setItem(Ct,e)},"saveState"),qi=n(t=>(0,Ai.throttle)(500,e=>{if(So())return;let{key:r,newValue:o}=e;r===Ct&&o===null?(t.dispatch({type:ue}),setTimeout(()=>t.dispatch(bi()),0)):r===Ct&&t.dispatch({type:ve,newValue:Ni(o)})}),"listenLocalStorageChanges");var Fi=se(jt());var el=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Di=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>el("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),tl=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Di(!0)},{expressions:[({type:t}={})=>t===I],fn:Di(!1)}],Ui=n(t=>e=>r=>{let o=t.getState();tl.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Li=n(t=>e=>r=>{var i;let o;switch(r.type){case T:case I:case R:case k:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((i=r.payload)==null?void 0:i.offer)||document).dispatchEvent(o);break;default:}o!=null&&o.defaultPrevented||e(r)},"offerEvents"),Mi=n(t=>e=>r=>{e(r);let o=(0,Fi.throttle)(500,()=>{ki({...t.getState()})});r.type!==ve&&o()},"localStorageMiddleware");var Eo=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function $i(t){let[e,r]=Eo(),[o,i]=Eo(),[s,a]=Eo();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(go(l)):a(p)});let c=Promise.all([o,e,s]);return c.then(()=>{var l;window.addEventListener("storage",qi(t)),(l=t.getState().auth)!=null&&l.ts||t.dispatch(yi())}),l=>async p=>{$e===p.type||je===p.type||Ve===p.type||He===p.type?r(p.payload):Le===p.type?i(p.payload):Me===p.type?a(p.payload):await c,l(p)}}n($i,"waitUntilOffersReady");function Vi(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"}):ro,i=[$i,Fn,Ui,Li],s={};if(!r)try{s=Ii(),i.push(Mi)}catch{}let a=o(kn(...i,...e.filter(l=>l))),c=to(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Vi,"makeStore");var rl=Object.defineProperty,mr=n((t,e)=>rl(t,"name",{value:e,configurable:!0}),"i"),ol=mr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Hi=["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],ji=mr(t=>(e,r)=>{Hi.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function xo(t=window.opener,e=window.og){let r=mr(o=>{let i=ol(Hi),s=ji(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.7/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),ji(t)("READY"))}n(xo,"h");mr(xo,"offersLiveEditor");var gr=null,nl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Gi=n(t=>{if(!gr)throw new Error("Missing redux store.");return gr},"resolveStore"),il=n((t,e)=>r=>{let{getState:o,dispatch:i}=Gi(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=nl)=>r=>{let i=il(t,typeof e=="function"?e:s=>In(e,s));return class extends r{get store(){return gr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Gi(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"),Bi=n(t=>{gr=t},"setStore");var vo=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],...xt(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),Ze=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");var Oo=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var Ae=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var $=`{{lit-${String(Math.random()).slice(2)}}}`,To=`<!--${$}-->`,zi=new RegExp(`${$}|${To}`),Xe="$lit$",be=class{constructor(e,r){this.parts=[],this.element=r;let o=[],i=[],s=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:p,values:{length:d}}=e;for(;l<d;){let u=s.nextNode();if(u===null){s.currentNode=i.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let h=u.attributes,{length:b}=h,S=0;for(let m=0;m<b;m++)Yi(h[m].name,Xe)&&S++;for(;S-- >0;){let m=p[l],E=yr.exec(m)[2],P=E.toLowerCase()+Xe,_=u.getAttribute(P);u.removeAttribute(P);let w=_.split(zi);this.parts.push({type:"attribute",index:c,name:E,strings:w}),l+=w.length-1}}u.tagName==="TEMPLATE"&&(i.push(u),s.currentNode=u.content)}else if(u.nodeType===3){let h=u.data;if(h.indexOf($)>=0){let b=u.parentNode,S=h.split(zi),m=S.length-1;for(let E=0;E<m;E++){let P,_=S[E];if(_==="")P=oe();else{let w=yr.exec(_);w!==null&&Yi(w[2],Xe)&&(_=_.slice(0,w.index)+w[1]+w[2].slice(0,-Xe.length)+w[3]),P=document.createTextNode(_)}b.insertBefore(P,u),this.parts.push({type:"node",index:++c})}S[m]===""?(b.insertBefore(oe(),u),o.push(u)):u.data=S[m],l+=m}}else if(u.nodeType===8)if(u.data===$){let h=u.parentNode;(u.previousSibling===null||c===a)&&(c++,h.insertBefore(oe(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let h=-1;for(;(h=u.data.indexOf($,h+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(be,"Template");var Yi=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Rt=n(t=>t.index!==-1,"isTemplatePartActive"),oe=n(()=>document.createComment(""),"createMarker"),yr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var Po=133;function wo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Po,null,!1),s=At(o),a=o[s],c=-1,l=0,p=[],d=null;for(;i.nextNode();){c++;let u=i.currentNode;for(u.previousSibling===d&&(d=null),e.has(u)&&(p.push(u),d===null&&(d=u)),d!==null&&l++;a!==void 0&&a.index===c;)a.index=d!==null?-1:a.index-l,s=At(o,s),a=o[s]}p.forEach(u=>u.parentNode.removeChild(u))}n(wo,"removeNodesFromTemplate");var al=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Po,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),At=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Rt(o))return r}return-1},"nextActiveIndexInTemplateParts");function Wi(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Po,null,!1),a=At(i),c=0,l=-1;for(;s.nextNode();)for(l++,s.currentNode===r&&(c=al(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===l;){if(c>0){for(;a!==-1;)i[a].index+=c,a=At(i,a);return}a=At(i,a)}}n(Wi,"insertNodeIntoTemplate");var cl=new WeakMap;var Ne=n(t=>typeof t=="function"&&cl.has(t),"isDirective");var D={},br={};var ce=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=Oo?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],!Rt(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 Oo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ce,"TemplateInstance");var Ji=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),pl=` ${$} `,ne=class{constructor(e,r,o,i){this.strings=e,this.values=r,this.type=o,this.processor=i}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let i=0;i<e;i++){let s=this.strings[i],a=s.lastIndexOf("<!--");o=(a>-1||o)&&s.indexOf("-->",a+1)===-1;let c=yr.exec(s);c===null?r+=s+(o?pl:To):r+=s.substr(0,c.index)+c[1]+c[2]+Xe+c[3]+$}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Ji!==void 0&&(r=Ji.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult");var Sr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),_r=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ie=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new et(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!_r(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(Sr(c)||!_r(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(Ie,"AttributeCommitter");var et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==D&&(!Sr(e)||e!==this.value)&&(this.value=e,Ne(e)||(this.committer.dirty=!0))}commit(){for(;Ne(this.value);){let e=this.value;this.value=D,e(this)}this.value!==D&&this.committer.commit()}};n(et,"AttributePart");var ie=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(oe()),this.endNode=e.appendChild(oe())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=oe()),e.__insert(this.endNode=oe())}insertAfterPart(e){e.__insert(this.startNode=oe()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ne(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}let e=this.__pendingValue;e!==D&&(Sr(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):_r(e)?this.__commitIterable(e):e===br?(this.value=br,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 ce&&this.value.template===r)this.value.update(e.values);else{let o=new ce(r,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,i;for(let s of e)i=r[o],i===void 0&&(i=new ie(this.options),r.push(i),o===0?i.appendIntoPart(this):i.insertAfterPart(r[o-1])),i.setValue(s),i.commit(),o++;o<r.length&&(r.length=o,this.clear(i&&i.endNode))}clear(e=this.startNode){Ae(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ie,"NodePart");var tt=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Ne(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}if(this.__pendingValue===D)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=D}};n(tt,"BooleanAttributePart");var rt=class extends Ie{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Nt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(rt,"PropertyCommitter");var Nt=class extends et{};n(Nt,"PropertyPart");var Ki=!1;(()=>{try{let t={get capture(){return Ki=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var ot=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Ne(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=D,s(this)}if(this.__pendingValue===D)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=ul(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=D}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ot,"EventPart");var ul=n(t=>t&&(Ki?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Co(t){let e=ke.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},ke.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join($);return r=e.keyString.get(o),r===void 0&&(r=new be(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(Co,"templateFactory");var ke=new Map;var _e=new WeakMap,Ro=n((t,e,r)=>{let o=_e.get(e);o===void 0&&(Ae(e,e.firstChild),_e.set(e,o=new ie(Object.assign({templateFactory:Co},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var It=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new rt(e,r.slice(1),o).parts:s==="@"?[new ot(e,r.slice(1),i.eventContext)]:s==="?"?[new tt(e,r.slice(1),o)]:new Ie(e,r,o).parts}handleTextExpression(e){return new ie(e)}};n(It,"DefaultTemplateProcessor");var Ao=new It;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var f=n((t,...e)=>new ne(t,e,"html",Ao),"html");var Zi=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Er=!0;typeof window.ShadyCSS>"u"?Er=!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."),Er=!1);var fl=n(t=>e=>{let r=Zi(e.type,t),o=ke.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},ke.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join($);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Er&&window.ShadyCSS.prepareTemplateDom(a,t),i=new be(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),hl=["html","svg"],ml=n(t=>{hl.forEach(e=>{let r=ke.get(Zi(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)}),wo(o,s)})})},"removeStylesFromLitTemplates"),Xi=new Set,gl=n((t,e,r)=>{Xi.add(t);let o=r?r.element:document.createElement("template"),i=e.querySelectorAll("style"),{length:s}=i;if(s===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let p=0;p<s;p++){let d=i[p];d.parentNode.removeChild(d),a.textContent+=d.textContent}ml(t);let c=o.content;r?Wi(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),wo(r,p)}},"prepareTemplateStyles"),es=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=_e.has(e),s=Er&&e.nodeType===11&&!!e.host,a=s&&!Xi.has(o),c=a?document.createDocumentFragment():e;if(Ro(t,c,Object.assign({templateFactory:fl(o)},r)),a){let l=_e.get(c);_e.delete(c);let p=l.value instanceof ce?l.value.template:void 0;gl(o,c,p),Ae(e,e.firstChild),e.appendChild(c),_e.set(e,l)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var ts;window.JSCompiler_renameProperty=(t,e)=>t;var Fo={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}},rs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),No={attribute:!0,type:String,converter:Fo,reflect:!1,hasChanged:rs},Io=1,ko=1<<2,qo=1<<3,Do=1<<4,Uo="finalized",nt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=No){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)||No}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Uo)||e.finalize(),this[Uo]=!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=rs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||Fo,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||Fo.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=No){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|qo,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~qo}}_attributeToProperty(e,r){if(this._updateState&qo)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Do,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Do}}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&Do)&&(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|ko;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&ko}get hasUpdated(){return this._updateState&Io}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&Io||(this._updateState=this._updateState|Io,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~ko}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(nt,"UpdatingElement");ts=Uo;nt[ts]=!0;var os=Element.prototype,bf=os.msMatchesSelector||os.webkitMatchesSelector;var xr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Lo=Symbol(),it=class{constructor(e,r){if(r!==Lo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(xr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(it,"CSSResult");var ns=n(t=>new it(String(t),Lo),"unsafeCSS"),yl=n(t=>{if(t instanceof it)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
12
+ take care to ensure page security.`)},"textFromCSSResult"),y=n((t,...e)=>{let r=e.reduce((o,i,s)=>o+yl(i)+t[s+1],t[0]);return new it(r,Lo)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var is={},v=class extends nt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((s,a)=>s.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),i=[];o.forEach(s=>i.unshift(s)),this._styles=i}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!xr){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return ns(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):xr?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!==is&&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 is}};n(v,"LitElement");v.finalized=!0;v.render=es;var vs=se(gs());var Ol=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"),ys=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var kt=n(t=>{let e=ys(t);if(!e){let r=t.offer;r&&(e=ys(r))}return e},"resolveProduct"),Tl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Mo=n(t=>class extends t{get offer(){return Tl(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 Mo(t){get product(){return kt(this)}},"withProduct"),Or=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=Ol(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Tr={};Cn(Tr,{autoshipByDefault:()=>Pl,eligibilityGroups:()=>Vo,eligible:()=>bs,hasPrepaidOptions:()=>Nl,hasUpcomingOrder:()=>Es,hasUpsellGroup:()=>Ss,inStock:()=>$o,optedout:()=>Rl,prepaidEligible:()=>wl,prepaidSubscribed:()=>Al,regularEligible:()=>kl,subscribed:()=>Cl,subscriptionEligible:()=>_s,upcomingOrderContainsProduct:()=>Il,upsellEligible:()=>xs});var $o=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),bs=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Pl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),_s=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&bs(t,e)&&$o(t,e),"subscriptionEligible"),Vo=n((t,e)=>{let r=x((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),Ss=n((t,e)=>{let r=Vo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),wl=n((t,e)=>{let r=Vo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Cl=n((t,e)=>cr(e.product)(t),"subscribed"),Rl=n((t,e)=>lr(e.product)(t),"optedout"),Al=n((t,e)=>ci(e.product)(t),"prepaidSubscribed"),Nl=n((t,e)=>L(e.product.id)(t).length>0,"hasPrepaidOptions"),Es=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Il=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),xs=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&$o(t,e)&&Es(t)&&Ss(t,e)},"upsellEligible"),kl=n((t,e)=>_s(t,e)&&!xs(t,e),"regularEligible");var ql=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Pr=class extends N(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return f``;let e=ql(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),vs.default.parse(e,o=>Tr[o]&&Tr[o](this.state,this))?f`
13
13
  <slot></slot>
14
- `: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(Pr,"When");var Ol=n(t=>({state:t}),"mapStateToProps"),bs=g(Ol)(Pr);var _s={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},_e={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&so(t)?t:null}}},Tr={type:Boolean,attribute:!0,reflect:!0},at={type:Object,attribute:!1};var Pl=n(t=>class extends t{getOption(e,r=e){let o=lo(e);if(this.hasAttribute(o)){let i=this.getAttribute(o);return i.toString().toLowerCase()==="true"?!0:i.toString().toLowerCase()==="false"?!1:i}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),j=Pl(v);var H=class extends N(j){static get properties(){return{subscribed:Tr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
14
+ `:f``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(Pr,"When");var Dl=n(t=>({state:t}),"mapStateToProps"),Os=g(Dl)(Pr);var Ts={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Ee={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&co(t)?t:null}}},wr={type:Boolean,attribute:!0,reflect:!0},ct={type:Object,attribute:!1};var Fl=n(t=>class extends t{getOption(e,r=e){let o=uo(e);if(this.hasAttribute(o)){let i=this.getAttribute(o);return i.toString().toLowerCase()==="true"?!0:i.toString().toLowerCase()==="false"?!1:i}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch{return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),j=Fl(v);var H=class extends N(j){static get properties(){return{subscribed:wr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
15
15
  :host {
16
16
  cursor: default;
17
17
  display: inline-block;
@@ -74,18 +74,18 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
74
74
  text-align: center;
75
75
  overflow: visible;
76
76
  }
77
- `}constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?d`
77
+ `}constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?f`
78
78
  <slot name="subscribed"></slot>
79
79
  <slot name="frequency-mismatch"></slot>
80
- `:this.subscribed&&this.defaultFrequency===this.frequency?d`
80
+ `:this.subscribed&&this.defaultFrequency===this.frequency?f`
81
81
  <slot name="subscribed"></slot>
82
82
  <slot name="frequency-match"></slot>
83
- `:this.subscribed&&this.defaultFrequency!==this.frequency?d`
83
+ `:this.subscribed&&this.defaultFrequency!==this.frequency?f`
84
84
  <slot name="subscribed"></slot>
85
85
  <slot name="frequency-mismatch"></slot>
86
- `:d`
86
+ `:f`
87
87
  <slot name="not-subscribed"></slot>
88
- `}};n(H,"OptinStatus");var W=n((t,e={})=>({subscribed:Z(e.product)(t),frequency:ee(e.product)(t),productDefaultFrequency:ze((e.product||{}).id)(t),prepaidShipmentsOptedIn:U(e.product)(t),...M(t,e,"defaultFrequency"),...M(t,e,"frequencies"),...Ye(t,e)}),"mapStateToProps"),Ss=g(W)(H);var ct=class extends H{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:_e,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(q.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=Pt(r,this.store.getState().config),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,q.shopify_selling_plans&&this.store&&(e=Pt(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(It(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
88
+ `}};n(H,"OptinStatus");var W=n((t,e={})=>({subscribed:X(e.product)(t),frequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),prepaidShipmentsOptedIn:U(e.product)(t),...M(t,e,"defaultFrequency"),...M(t,e,"frequencies"),...We(t,e)}),"mapStateToProps"),Ps=g(W)(H);var lt=class extends H{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:Ee,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(q.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=Pt(r,this.store.getState().config),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,q.shopify_selling_plans&&this.store&&(e=Pt(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(kt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return f`
89
89
  <slot name="default">
90
90
  <button
91
91
  aria-labelledby="ogOfferOptInLabel"
@@ -99,7 +99,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
99
99
  </slot>
100
100
  </label>
101
101
  </slot>
102
- `}};n(ct,"OptinButton");var Es=g(W,{optinProduct:Y})(ct);var wr=class extends H{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
102
+ `}};n(lt,"OptinButton");var ws=g(W,{optinProduct:Y})(lt);var Cr=class extends H{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return f`
103
103
  <slot name="default">
104
104
  <button
105
105
  aria-labelledby="ogOfferOptOutLabel"
@@ -113,32 +113,32 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
113
113
  </slot>
114
114
  </label>
115
115
  </slot>
116
- `}};n(wr,"OptoutButton");var xs=g(W,{optoutProduct:Ke})(wr);var qe=n((t,e)=>{let{every:r,every_period:o}=Et(t);return r&&o?d`
116
+ `}};n(Cr,"OptoutButton");var Cs=g(W,{optoutProduct:Qe})(Cr);var De=n((t,e)=>{let{every:r,every_period:o}=xt(t);return r&&o?f`
117
117
  ${r}
118
118
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
119
- ${e&&e===t?d`
119
+ ${e&&e===t?f`
120
120
  <og-text key="defaultFrequencyCopy"></og-text>
121
121
  `:""}
122
- `:t},"frequencyText"),lt=class extends N(j){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Tr,frequency:{type:String},defaultFrequency:_e,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:ei}}}}static get styles(){return y`
122
+ `:t},"frequencyText"),pt=class extends N(j){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:wr,frequency:{type:String},defaultFrequency:Ee,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:si}}}}static get styles(){return y`
123
123
  :host[hidden] {
124
124
  display: none;
125
125
  }
126
126
  :host {
127
127
  display: inline-block;
128
128
  }
129
- `}constructor(){super(),this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return d`
129
+ `}constructor(){super(),this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return f`
130
130
  <span>
131
- ${this.subscribed&&d`
132
- <slot name="subscribed">${qe(e)}</slot>
131
+ ${this.subscribed&&f`
132
+ <slot name="subscribed">${De(e)}</slot>
133
133
  `||""}
134
- ${!this.subscribed&&d`
134
+ ${!this.subscribed&&f`
135
135
  <slot name="not-subscribed"></slot>
136
136
  `||""}
137
- ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&d`
137
+ ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&f`
138
138
  <slot name="frequency-mismatch"></slot>
139
139
  `||""}
140
140
  </span>
141
- `}};n(lt,"FrequencyStatus");var kt=n((t,e)=>{var r,o;return{subscribed:Z(e.product)(t),frequency:ee(e.product)(t),productDefaultFrequency:ze((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...M(t,e,"frequencies"),...M(t,e,"defaultFrequency"),...Ye(t,e)}},"mapStateToProps"),vs=g(kt)(lt);var Cr=class extends vr(H){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:_e}}static get styles(){return y`
141
+ `}};n(pt,"FrequencyStatus");var qt=n((t,e)=>{var r,o;return{subscribed:X(e.product)(t),frequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...M(t,e,"frequencies"),...M(t,e,"defaultFrequency"),...We(t,e)}},"mapStateToProps"),Rs=g(qt)(pt);var Rr=class extends Or(H){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Ee}}static get styles(){return y`
142
142
  :host {
143
143
  display: inline-block;
144
144
  cursor: pointer;
@@ -148,24 +148,24 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
148
148
  border-width: var(--og-select-border-width, 1px);
149
149
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
150
150
  }
151
- `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return(o=this.frequencies)!=null&&o.length?r=[e.find(i=>i.value==="optedOut"),...this.frequencies.map((i,s)=>({value:i,text:this.frequenciesText&&s in this.frequenciesText?this.frequenciesText[s]:qe(i,this.defaultFrequency)}))]:r=e,d`
151
+ `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return(o=this.frequencies)!=null&&o.length?r=[e.find(i=>i.value==="optedOut"),...this.frequencies.map((i,s)=>({value:i,text:this.frequenciesText&&s in this.frequenciesText?this.frequenciesText[s]:De(i,this.defaultFrequency)}))]:r=e,f`
152
152
  <og-select
153
153
  .options="${r}"
154
154
  .selected="${this.currentFrequency}"
155
155
  .onChange="${({target:{value:i}})=>this.onOptinChange(i)}"
156
156
  ></og-select>
157
- `}};n(Cr,"OptinSelect");var Os=g((t,e)=>({...W(t,e),...kt(t,e),...M(t,e,"frequencies")}),{productChangeFrequency:ur,optoutProduct:Ke})(Cr);var Rr=class extends N(j){static get styles(){return y`
157
+ `}};n(Rr,"OptinSelect");var As=g((t,e)=>({...W(t,e),...qt(t,e),...M(t,e,"frequencies")}),{productChangeFrequency:dr,optoutProduct:Qe})(Rr);var Ar=class extends N(j){static get styles(){return y`
158
158
  :host[hidden] {
159
159
  display: none;
160
160
  }
161
161
  :host {
162
162
  display: inline-block;
163
163
  }
164
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:at,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super(),this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return d`
164
+ `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ct,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super(),this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return f`
165
165
  <slot>
166
166
  <og-next-upcoming-order></og-next-upcoming-order>
167
167
  </slot>
168
- `}};n(Rr,"UpsellButton");var Tl=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ps=g(Tl,{fetchOrders:fr})(Rr);var Ar=class extends N(j){static get properties(){return{...super.properties,defaultFrequency:_e,auth:at,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
+ `}};n(Ar,"UpsellButton");var Ul=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ns=g(Ul,{fetchOrders:hr})(Ar);var Nr=class extends N(j){static get properties(){return{...super.properties,defaultFrequency:Ee,auth:ct,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super(),this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return f`
169
169
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
170
170
  <div slot="content">
171
171
  <slot>
@@ -203,7 +203,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
203
203
  </slot>
204
204
  </span>
205
205
  </og-modal>
206
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(Ar,"UpsellModal");var wl=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:Z(e.product)(t),frequency:ee(e.product)(t),...M(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ts=g(wl,{concludeUpsell:ci,createIu:mi})(Ar);var Nr=class extends H{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return y`
206
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(Nr,"UpsellModal");var Ll=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:X(e.product)(t),frequency:te(e.product)(t),...M(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Is=g(Ll,{concludeUpsell:hi,createIu:Ei})(Nr);var Ir=class extends H{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return y`
207
207
  :host {
208
208
  cursor: default;
209
209
  display: inline-block;
@@ -235,7 +235,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
235
235
  transform: scale(1.6);
236
236
  margin-left: 2px;
237
237
  }
238
- `}handleClick(e){this.subscribed?this.optoutProduct(this.product,this.offer):this.optinProduct(this.product,this.frequency||this.productDefaultFrequency||this.defaultFrequency,this.offer),e.preventDefault()}render(){return d`
238
+ `}handleClick(e){this.subscribed?this.optoutProduct(this.product,this.offer):this.optinProduct(this.product,this.frequency||this.productDefaultFrequency||this.defaultFrequency,this.offer),e.preventDefault()}render(){return f`
239
239
  <slot name="default">
240
240
  <button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
241
241
  <label for="action-trigger">
@@ -244,13 +244,13 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
244
244
  </slot>
245
245
  </label>
246
246
  </slot>
247
- `}};n(Nr,"OptinToggle");var ws=g(W,{optoutProduct:Ke,optinProduct:Y})(Nr);var Cl=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ir=class extends Uo(v){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&&Cl(e,this.pluralize)}render(){return d`
247
+ `}};n(Ir,"OptinToggle");var ks=g(W,{optoutProduct:Qe,optinProduct:Y})(Ir);var Ml=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),kr=class extends Mo(v){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&&Ml(e,this.pluralize)}render(){return f`
248
248
  ${this.getText()}
249
- `}};n(Ir,"Text");var Rl=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Cs=g(Rl)(Ir);var De=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(De,"DiscountAmount");var pt=class extends De{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(pt,"DiscountPercent");var kr=class extends pt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(kr,"ShippingDiscountPercent");var $o="Discount Percent",Vo="Discount Amount",Rs="total_price",As="shipping_total",Ns="sub_total",jo=n(({field:t,object:e,type:r,value:o})=>{let s=[[new pt(o),{field:Rs,object:"item",type:$o}],[new De(o),{field:Rs,object:"item",type:Vo}],[new kr(o),{field:As,object:"order",type:$o}],[new De(o),{field:As,object:"order",type:Vo}],[new pt(o),{field:Ns,object:"order",type:$o}],[new De(o),{field:Ns,object:"order",type:Vo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Al(t){return!(jo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Al,"filterIncentives");var qr=class extends N(v){static get properties(){return{...super.properties,incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}}}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",i=(this.incentives[o]||[]).find(Al.bind({incentiveClass:e,incentiveValue:r}));return d`
250
- ${this.label} ${i?jo(i):this.renderFallback()}
251
- `}renderFallback(){return d`
252
- ${jo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
253
- `}};n(qr,"IncentiveText");var Nl=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&x((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Is=g(Nl)(qr);var Dr=class extends vr(lt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
249
+ `}};n(kr,"Text");var $l=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),qs=g($l)(kr);var Fe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Fe,"DiscountAmount");var ut=class extends Fe{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(ut,"DiscountPercent");var qr=class extends ut{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(qr,"ShippingDiscountPercent");var jo="Discount Percent",Ho="Discount Amount",Ds="total_price",Fs="shipping_total",Us="sub_total",Go=n(({field:t,object:e,type:r,value:o})=>{let s=[[new ut(o),{field:Ds,object:"item",type:jo}],[new Fe(o),{field:Ds,object:"item",type:Ho}],[new qr(o),{field:Fs,object:"order",type:jo}],[new Fe(o),{field:Fs,object:"order",type:Ho}],[new ut(o),{field:Us,object:"order",type:jo}],[new Fe(o),{field:Us,object:"order",type:Ho}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Vl(t){return!(Go(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Vl,"filterIncentives");var Dr=class extends N(v){static get properties(){return{...super.properties,incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}}}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",i=(this.incentives[o]||[]).find(Vl.bind({incentiveClass:e,incentiveValue:r}));return f`
250
+ ${this.label} ${i?Go(i):this.renderFallback()}
251
+ `}renderFallback(){return f`
252
+ ${Go({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
253
+ `}};n(Dr,"IncentiveText");var jl=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&x((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Ls=g(jl)(Dr);var Fr=class extends Or(pt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
254
254
  :host {
255
255
  display: inline-block;
256
256
  cursor: pointer;
@@ -261,18 +261,18 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
261
261
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
262
262
  z-index: 1;
263
263
  }
264
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var i,s,a,c;let{options:e,isSelected:r}=this.childOptions,o;return this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=(i=this.config)==null?void 0:i.frequencies)==null?void 0:s.length)&&o&&((c=(a=this.config)==null?void 0:a.frequenciesEveryPeriod)==null?void 0:c.length)?Pt(o,this.config):o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return(o=this.frequencies)!=null&&o.length?e=this.frequencies.map((i,s)=>{let a;return this.config.frequenciesEveryPeriod&&s in this.config.frequenciesEveryPeriod?a=qe(this.config.frequenciesEveryPeriod[s],r):this.frequenciesText&&s in this.frequenciesText?a=this.frequenciesText[s]:a=qe(i,this.defaultFrequency),{value:i,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(i=>({value:i,text:qe(i,r)}))),e=e.map(({text:i,value:s})=>({text:s===r?d`
264
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var i,s,a,c;let{options:e,isSelected:r}=this.childOptions,o;return this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=(i=this.config)==null?void 0:i.frequencies)==null?void 0:s.length)&&o&&((c=(a=this.config)==null?void 0:a.frequenciesEveryPeriod)==null?void 0:c.length)?Pt(o,this.config):o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return(o=this.frequencies)!=null&&o.length?e=this.frequencies.map((i,s)=>{let a;return this.config.frequenciesEveryPeriod&&s in this.config.frequenciesEveryPeriod?a=De(this.config.frequenciesEveryPeriod[s],r):this.frequenciesText&&s in this.frequenciesText?a=this.frequenciesText[s]:a=De(i,this.defaultFrequency),{value:i,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(i=>({value:i,text:De(i,r)}))),e=e.map(({text:i,value:s})=>({text:s===r?f`
265
265
  ${i} ${this.defaultText||""}
266
- `:i,value:s})),d`
266
+ `:i,value:s})),f`
267
267
  <og-select
268
268
  ariaLabel="Delivery frequency"
269
269
  .options="${e}"
270
270
  .selected="${this.currentFrequency}"
271
271
  .onChange="${({target:{value:i}})=>{this.productChangeFrequency(this.product,i,this.offer)}}"
272
272
  ></og-select>
273
- `}};n(Dr,"SelectFrequency");var ks=g(kt,{productChangeFrequency:ur})(Dr);var Il={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 qs=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Il[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 Fr=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
274
- ${qs(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
275
- `}};n(Fr,"FormattedDate");var kl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Ds=g(kl)(Fr);var Ls=ce(bt());var Fs=n((t,e,r)=>n(async function(i){await i({type:le,payload:{isPreview:t,productId:e}}),await i({type:Ee}),await i(Ce({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),ql=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"),Dl=n((t,e,r)=>n(async function(i,s){await i({type:mt,payload:{isPreview:t,productId:e}});let{merchantId:a}=s();t?(await i(Ce({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await i(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(Tt(a,"sig_field","ts","sig"))):await i(he())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Fl=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:Ee}),await i(Ce({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r)),await i({type:B,payload:ql(a,Qe({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:He,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),Us=n((t,e,r)=>async function(o,i){switch(await o({type:pe}),await o({type:le,payload:{isPreview:!1,productId:r.product.id}}),await o({type:mt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(Fs(!0,r.product.id,r));break;case"upsell":o(Dl(!0,r.product.id,r));break;case"subscribed":o(Fs(!0,r.product.id,r)),o(Y(r.product,"2_2"));break;case"prepaid":o(Fl(!0,r.product.id,r)),o(Y(r.product,"1_3"));break;default:}},"setPreview");var Ul=n((...t)=>JSON.stringify(t),"memoizeKey"),Ms=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),Ll=Ms((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.`),Ml=Ms(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),$l=(0,Ls.default)((t,e)=>Object.assign({components:e},t),Ul),Ur=class extends j{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:_s,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:at,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"?this.preview="subscribed":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return y`
273
+ `}};n(Fr,"SelectFrequency");var Ms=g(qt,{productChangeFrequency:dr})(Fr);var Hl={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 $s=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Hl[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 Ur=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return f`
274
+ ${$s(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
275
+ `}};n(Ur,"FormattedDate");var Gl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Vs=g(Gl)(Ur);var Gs=se(_t());var js=n((t,e,r)=>n(async function(i){await i({type:pe,payload:{isPreview:t,productId:e}}),await i({type:xe}),await i(Re({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Bl=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"),zl=n((t,e,r)=>n(async function(i,s){await i({type:gt,payload:{isPreview:t,productId:e}});let{merchantId:a}=s();t?(await i(Re({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await i(yo({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await i(wt(a,"sig_field","ts","sig"))):await i(ge())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Yl=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:oo,payload:{isPreview:t,productId:e}}),await i({type:xe}),await i(Re({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r)),await i({type:B,payload:Bl(a,Ze({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:Be,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),Hs=n((t,e,r)=>async function(o,i){switch(await o({type:ue}),await o({type:pe,payload:{isPreview:!1,productId:r.product.id}}),await o({type:gt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(js(!0,r.product.id,r));break;case"upsell":o(zl(!0,r.product.id,r));break;case"subscribed":o(js(!0,r.product.id,r)),o(Y(r.product,"2_2"));break;case"prepaid":o(Yl(!0,r.product.id,r)),o(Y(r.product,"1_3"));break;default:}},"setPreview");var Wl=n((...t)=>JSON.stringify(t),"memoizeKey"),Bs=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),Jl=Bs((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.`),Kl=Bs(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),Ql=(0,Gs.default)((t,e)=>Object.assign({components:e},t),Wl),Lr=class extends j{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Ts,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ct,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"?this.preview="subscribed":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return y`
276
276
  :host[hidden] {
277
277
  display: none;
278
278
  }
@@ -423,9 +423,9 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
423
423
  </og-when>
424
424
  </og-when>
425
425
 
426
- `}constructor(){super(),this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let i=new CustomEvent("template-changed");this.dispatchEvent(i)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&lr(()=>this.fetchOffer(this.product.id,ve,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=$l(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});A(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>A(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}get shouldEnableOffer(){var e;return this.config&&this.config.storeCurrency&&this.config.merchantSettings&&!(this.config.merchantSettings.multicurrency_enabled||this.config.storeCurrency===this.config.merchantSettings.currency_code)?(Ll(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):this.isCart&&((e=this.config)==null?void 0:e.hasProductSpecificFrequencies)?(Ml(),!1):!0}render(){return this.shouldEnableOffer?d`
426
+ `}constructor(){super(),this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let i=new CustomEvent("template-changed");this.dispatchEvent(i)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&pr(()=>this.fetchOffer(this.product.id,Oe,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=Ql(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});A(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>A(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}get shouldEnableOffer(){var e;return this.config&&this.config.storeCurrency&&this.config.merchantSettings&&!(this.config.merchantSettings.multicurrency_enabled||this.config.storeCurrency===this.config.merchantSettings.currency_code)?(Jl(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):this.isCart&&((e=this.config)==null?void 0:e.hasProductSpecificFrequencies)?(Kl(),!1):!0}render(){return this.shouldEnableOffer?f`
427
427
  <slot></slot>
428
- `:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Ur,"Offer");var Vl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:ee(e.product)(t),productDefaultFrequency:ze((e.product||{}).id)(t),...M(t,e,"autoshipByDefault",co(t)[(e.product||{}).id]),...cr(e.product)(t)&&{autoshipByDefault:!1},optedin:Ot(t),subscribed:Z(e.product)(t),...Ye(t)}),"mapStateToProps"),$s=g(Vl,{fetchOffer:fi,fetchOrders:fr,productHasChangedComponents:ai,optinProduct:Y,setFirstOrderPlaceDate:Si,setProductToSubscribe:Ei,setPreview:Us})(Ur);var qt=class extends v{constructor(){super(),this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return y`
428
+ `:null}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(Lr,"Offer");var Zl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:te(e.product)(t),productDefaultFrequency:Ye((e.product||{}).id)(t),...M(t,e,"autoshipByDefault",po(t)[(e.product||{}).id]),...lr(e.product)(t)&&{autoshipByDefault:!1},optedin:Tt(t),subscribed:X(e.product)(t),...We(t)}),"mapStateToProps"),zs=g(Zl,{fetchOffer:_i,fetchOrders:hr,productHasChangedComponents:fi,optinProduct:Y,setFirstOrderPlaceDate:Pi,setProductToSubscribe:wi,setPreview:Hs})(Lr);var Dt=class extends v{constructor(){super(),this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return y`
429
429
  :host[hidden] {
430
430
  display: none;
431
431
  }
@@ -539,7 +539,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
539
539
  .btn {
540
540
  cursor: pointer;
541
541
  }
542
- `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?d`
542
+ `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?f`
543
543
  <span @click="${()=>this.confirm()}">
544
544
  <slot name="confirm" class="btn">
545
545
  <button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
@@ -547,13 +547,13 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
547
547
  </button>
548
548
  </slot>
549
549
  </span>
550
- `:d``}get cancelButton(){return this.showCancelButton?d`
550
+ `:f``}get cancelButton(){return this.showCancelButton?f`
551
551
  <span @click="${()=>this.close()}" class="btn">
552
552
  <slot name="cancel">
553
553
  <button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">${this.cancelText}</button>
554
554
  </slot>
555
555
  </span>
556
- `:d``}render(){return this.show?d`
556
+ `:f``}render(){return this.show?f`
557
557
  <div class="og-modal is-open" aria-hidden="true">
558
558
  <div class="og-modal__overlay" tabindex="-1">
559
559
  <div class="og-modal__container" role="dialog" aria-modal="true">
@@ -570,7 +570,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
570
570
  </div>
571
571
  </div>
572
572
  </div>
573
- `:d``}};n(qt,"Modal");var Dt=class extends v{static get styles(){return y`
573
+ `:f``}};n(Dt,"Modal");var Ft=class extends v{static get styles(){return y`
574
574
  :host {
575
575
  display: inline-block;
576
576
  color: inherit;
@@ -622,9 +622,9 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
622
622
  line-height: 0.2em;
623
623
  transform: scaleY(0.5);
624
624
  }
625
- `}static get properties(){return{options:{type:Array},selected:{type:String},ariaLabel:{type:String}}}render(){return d`
625
+ `}static get properties(){return{options:{type:Array},selected:{type:String},ariaLabel:{type:String}}}render(){return f`
626
626
  <select @change="${n(r=>this.onChange(r),"handleOnChange")}" aria-label="${this.ariaLabel}">
627
- ${this.options.map(r=>d`
627
+ ${this.options.map(r=>f`
628
628
  <option
629
629
  value="${r.value}"
630
630
  ?selected=${r.value===this.selected}
@@ -635,7 +635,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
635
635
  `)}
636
636
  </select>
637
637
  <span>&#9660;</span>
638
- `}};n(Dt,"Select");var Ft=class extends v{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return y`
638
+ `}};n(Ft,"Select");var Ut=class extends v{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return y`
639
639
  :host[hidden] {
640
640
  display: none;
641
641
  }
@@ -785,7 +785,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
785
785
  pointer-events: auto;
786
786
  transform: translateY(0px);
787
787
  }
788
- `}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),i=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*i.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*i.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return d`
788
+ `}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),i=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*i.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*i.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return f`
789
789
  <span class="tooltip">
790
790
  <span class="trigger">
791
791
  <slot name="trigger">${this.trigger}</slot>
@@ -794,7 +794,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
794
794
  <slot name="content">${this.content}</slot>
795
795
  </div>
796
796
  </span>
797
- `}};n(Ft,"Tooltip");var G=class extends N(v){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return d``}};n(G,"PrepaidStatus");var jl=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Am=g(jl,{productChangePrepaidShipments:me})(G);var Lr=class extends G{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
797
+ `}};n(Ut,"Tooltip");var G=class extends N(v){static get properties(){return{options:{type:Array},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number},defaultPrepaidShipments:{type:Number,attribute:"default-prepaid-shipments"}}}get prepaidOptedIn(){return this.shipmentsOptedIn>1}get selectedNumberOfShipments(){return this.prepaidShipmentsSelected||this.shipmentsOptedIn||this.getDefaultPrepaidShipments()}getDefaultPrepaidShipments(){return this.options.includes(this.defaultPrepaidShipments)?this.defaultPrepaidShipments:this.options[1]||this.options[0]}handleSelect({target:{value:e}}){let r=+e;this.productChangePrepaidShipments(this.product,r,this.offer)}render(){return f``}};n(G,"PrepaidStatus");var Xl=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),zm=g(Xl,{productChangePrepaidShipments:ye})(G);var Mr=class extends G{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
798
798
  og-select {
799
799
  display: inline-block;
800
800
  cursor: pointer;
@@ -811,35 +811,35 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
811
811
  accent-color: var(--og-prepaid-checkbox-color, black);
812
812
  border-radius: 4px;
813
813
  }
814
- `}handleChange(e){e.target.checked?this.productChangePrepaidShipments(this.product,this.selectedNumberOfShipments,this.offer):this.productChangePrepaidShipments(this.product,null,this.offer)}render(){if(this.options.length===0)return d``;let e=this.options.map(r=>({value:r,text:`${r} ${this.text}`}));return d`
814
+ `}handleChange(e){e.target.checked?this.productChangePrepaidShipments(this.product,this.selectedNumberOfShipments,this.offer):this.productChangePrepaidShipments(this.product,null,this.offer)}render(){if(this.options.length===0)return f``;let e=this.options.map(r=>({value:r,text:`${r} ${this.text}`}));return f`
815
815
  <div>
816
816
  <input id="cbx" type="checkbox" .checked=${this.prepaidOptedIn} @change=${this.handleChange} />
817
817
  <label for="cbx">
818
818
  <slot name="label">Prepay for</slot>
819
- ${this.options.length>1?d`
819
+ ${this.options.length>1?f`
820
820
  <og-select
821
821
  .options=${e}
822
822
  .selected=${this.selectedNumberOfShipments}
823
823
  .onChange="${r=>this.handleSelect(r)}"
824
824
  ></og-select>
825
- `:d`
825
+ `:f`
826
826
  <span>${e[0].text}</span>
827
827
  `}
828
828
  <slot name="append"></slot>
829
829
  </label>
830
830
  </div>
831
- `}};n(Lr,"PrepaidToggle");var Hl=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Vs=g(Hl,{productChangePrepaidShipments:me})(Lr);var Mr=class extends G{static get properties(){return{...super.properties,productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return y`
831
+ `}};n(Mr,"PrepaidToggle");var ep=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),Ys=g(ep,{productChangePrepaidShipments:ye})(Mr);var $r=class extends G{static get properties(){return{...super.properties,productPlans:{type:Object},prepaidShipmentsSelected:{type:Number},totalPrice:{type:Boolean,reflect:!0,attribute:"total-price"},perDeliveryPrice:{type:Boolean,reflect:!0,attribute:"per-delivery-price"},totalSavings:{type:Boolean,reflect:!0,attribute:"total-savings"},perDeliverySavings:{type:Boolean,reflect:!0,attribute:"per-delivery-savings"},percentageSavings:{type:Boolean,reflect:!0,attribute:"percentage-savings"},extraPercentageSavings:{type:Boolean,reflect:!0,attribute:"extra-percentage-savings"},numberOfShipments:{type:Boolean,reflect:!0,attribute:"number-of-shipments"}}}static get styles(){return y`
832
832
  :host {
833
833
  display: inline-block;
834
834
  text-indent: initial;
835
835
  }
836
- `}get value(){let e=x(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:f,prepaidExtraSavingsPercentage:u}=i;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?f:this.perDeliverySavings?p:this.percentageSavings?s:this.extraPercentageSavings?u:this.numberOfShipments?c:""}render(){let e=this.value;return e?d`
836
+ `}get value(){let e=x(this.product),r=this.productPlans[e]||[],o=this.selectedNumberOfShipments,i=r.find(h=>h.prepaidShipments>1&&h.prepaidShipments===o);if(!i&&(i=r.find(h=>h.prepaidShipments>1),!i))return"";let{discountRate:s,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:l,prepaidSavingsPerShipment:p,prepaidSavingsTotal:d,prepaidExtraSavingsPercentage:u}=i;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?d:this.perDeliverySavings?p:this.percentageSavings?s:this.extraPercentageSavings?u:this.numberOfShipments?c:""}render(){let e=this.value;return e?f`
837
837
  <slot name="prepend"></slot>
838
838
  ${e}
839
839
  <slot name="append"></slot>
840
- `:d`
840
+ `:f`
841
841
  <slot name="fallback"></slot>
842
- `}};n(Mr,"PrepaidData");var Gl=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),js=g(Gl)(Mr);var $r=class extends G{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
842
+ `}};n($r,"PrepaidData");var tp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Ws=g(tp)($r);var Vr=class extends G{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
843
843
  :host {
844
844
  cursor: pointer;
845
845
  display: inline-block;
@@ -886,14 +886,14 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
886
886
  border-radius: 100%;
887
887
  border: 2px solid #fff;
888
888
  }
889
- `}handleClick(e){this.prepaidOptedIn||this.productChangePrepaidShipments(this.product,this.selectedNumberOfShipments,this.offer),e.preventDefault()}render(){return d`
889
+ `}handleClick(e){this.prepaidOptedIn||this.productChangePrepaidShipments(this.product,this.selectedNumberOfShipments,this.offer),e.preventDefault()}render(){return f`
890
890
  <slot name="default">
891
891
  <button id="action-trigger" class="btn radio ${this.prepaidOptedIn?"active":""}"></button>
892
892
  <label for="action-trigger">
893
893
  <slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
894
894
  </label>
895
895
  </slot>
896
- `}};n($r,"PrepaidButton");var Bl=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Hs=g(Bl,{productChangePrepaidShipments:me})($r);var Vr=class extends G{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
896
+ `}};n(Vr,"PrepaidButton");var rp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),Js=g(rp,{productChangePrepaidShipments:ye})(Vr);var jr=class extends G{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
897
897
  og-select {
898
898
  display: inline-block;
899
899
  cursor: pointer;
@@ -903,18 +903,18 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
903
903
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
904
904
  z-index: 1;
905
905
  }
906
- `}render(){if(this.options.length===0)return d``;let e=this.options.map(r=>({value:r,text:`${r} ${this.text}`}));return d`
907
- ${this.options.length>1?d`
906
+ `}render(){if(this.options.length===0)return f``;let e=this.options.map(r=>({value:r,text:`${r} ${this.text}`}));return f`
907
+ ${this.options.length>1?f`
908
908
  <og-select
909
909
  .options=${e}
910
910
  .selected=${this.selectedNumberOfShipments}
911
911
  .onChange="${r=>this.handleSelect(r)}"
912
912
  ></og-select>
913
- `:d`
913
+ `:f`
914
914
  <span>${e[0].text}</span>
915
915
  `}
916
916
  <slot name="append"></slot>
917
- `}};n(Vr,"PrepaidSelect");var zl=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Gs=g(zl,{productChangePrepaidShipments:me})(Vr);var jr=class extends ct{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(It(this),r,this.offer)}e.preventDefault()}render(){return d`
917
+ `}};n(jr,"PrepaidSelect");var op=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:ee(e.product)(t)}),"mapStateToProps"),Ks=g(op,{productChangePrepaidShipments:ye})(jr);var Hr=class extends lt{static get properties(){return{...super.properties,prepaidShipmentsOptedIn:{type:Number}}}get isActive(){return this.prepaidShipmentsOptedIn>0?!1:this.subscribed}handleClick(e){if(!this.isActive){let r=this.frequencies&&this.frequencies.length>0?this.frequencies[0]:this.optinFrequency;this.optinProduct(kt(this),r,this.offer)}e.preventDefault()}render(){return f`
918
918
  <slot name="default">
919
919
  <button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
920
920
  <label for="action-trigger">
@@ -923,7 +923,7 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
923
923
  </slot>
924
924
  </label>
925
925
  </slot>
926
- `}};n(jr,"SubscriptionButton");var Bs=g(W,{optinProduct:Y})(jr);var Ut=class extends v{static get styles(){return y`
926
+ `}};n(Hr,"SubscriptionButton");var Qs=g(W,{optinProduct:Y})(Hr);var Lt=class extends v{static get styles(){return y`
927
927
  :host {
928
928
  position: fixed;
929
929
  top: 5em;
@@ -981,11 +981,11 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
981
981
  a {
982
982
  color: white;
983
983
  }
984
- `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),i=r.getAttribute("product"),s=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(i,s).concat(this.getOfferRequestMessages(i,o)),product:i};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],i=r.autoshipEligible[e],s=[];return e&&o===!1&&s.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&i===!1&&s.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&i===null&&s.push({name:"This product does not exist in our database",type:"error"}),s}resultsCodeBlock(){return this.results.length===0?d`
984
+ `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),i=r.getAttribute("product"),s=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(i,s).concat(this.getOfferRequestMessages(i,o)),product:i};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],i=r.autoshipEligible[e],s=[];return e&&o===!1&&s.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&i===!1&&s.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&i===null&&s.push({name:"This product does not exist in our database",type:"error"}),s}resultsCodeBlock(){return this.results.length===0?f`
985
985
  <div class="message error">No offer element found on the page</div>
986
- `:this.results.map((e,r)=>d`
986
+ `:this.results.map((e,r)=>f`
987
987
  <div>For offer tag with product = "${e.product}"</div>
988
- ${e.messages.map(o=>d`
988
+ ${e.messages.map(o=>f`
989
989
  <div class="message ${o.type}">${o.name}</div>
990
990
  `)}
991
991
  <button @click=${this.toggleProductFlags(r,{})}>Set inStock and eligible</button>
@@ -1002,14 +1002,14 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
1002
1002
  <br />
1003
1003
  <button @click=${this.toggleUpsellNextOrder(r)}>upsell product is in next order</button>
1004
1004
  <br />
1005
- `)}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(Ce({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(go({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`
1005
+ `)}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(Re({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(bo({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return f`
1006
1006
  <div>
1007
- ${this.testsRan?this.resultsCodeBlock():d`
1007
+ ${this.testsRan?this.resultsCodeBlock():f`
1008
1008
  <div>Click the button to run tests</div>
1009
1009
  `}
1010
1010
  <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
1011
1011
  </div>
1012
- `}};n(Ut,"TestWizard");function Ho(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Ut);let e=document.createElement(t);document.body.appendChild(e)}n(Ho,"default");var Go=[79,71,68,69,86],zs=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===Go[t]){let o=Go[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Go.length&&Ho()}else t=0},!1)},"enable");var Hr=n((t=[],e)=>{switch(e.type){case pe:return[];case xe:return e.newValue?e.newValue.optedin:t;case R:case k:{let[{prepaidShipments:r,...o},i]=Je(t,e.payload.product);return i.concat({...o,...e.payload.product,frequency:e.payload.frequency})}case ie:{let{payload:r}=e,[{prepaidShipments:o,...i},s]=Je(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case I:return t.filter(r=>!A(e.payload.product,r));case ft:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Wt:return t.filter(r=>!A(e.payload.product,r));case je:return[];default:return t}},"optedin"),Bo=n((t=[],e)=>{switch(e.type){case pe:return[];case xe:return e.newValue?e.newValue.optedout:t;case R:case k:return t.filter(r=>!A(e.payload.product,r));case I:{let[r,o]=Je(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case ft:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case je:return[];default:return t}},"optedout"),zo=n((t={},{type:e,payload:r})=>{switch(e){case Bt:return r&&r.count>0?{...t,...r.results[0]&&{...r.results[0],place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))}}:t;case zt:return{...t,products:(r.results||[]).map(o=>o.product)};case Yt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),Wl=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Jl=n((t={},e)=>{switch(e.type){case J:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Yo=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Ys=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Wo=n((t={},e)=>{switch(e.type){case P: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||[],...Ys(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...Ys(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Kl=n((t={},e)=>{switch(e.type){case R:case k:return{...t,[x(e.payload.product)]:e.payload.frequency};case I:return{...t,[x(e.payload.product)]:void 0};default:return t}},"frequency"),Jo=n((t=!1,e)=>{switch(e.type){case Gt:return{...e.payload};case Ee:return!1;default:return t}},"auth"),Ko=n((t="",e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"merchantId"),Qo=n((t=null,e)=>{switch(e.type){case Ht:return e.payload;default:return t}},"authUrl"),Ql=n((t={},e)=>{switch(e.type){case P:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Zo=n((t="",e)=>{switch(e.type){case P:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Xo=n((t=null,e)=>{switch(e.type){case pe:return null;case Le:return e.payload;default:return t}},"sessionId"),Zl=n((t={},e)=>{switch(e.type){case P:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case je:return{};default:return t}},"productOffer"),en=n((t={},e)=>{switch(e.type){case Zt:return{...t,[x(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),tn=n((t={},e)=>{switch(e.type){case Xt:return{...t,[x(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Lt=n((t={},e)=>{switch(e.type){case Me:return{...t,name:Oe,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case $e:return{...t,name:er,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Ve:return{...t,name:Pe,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),rn=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 Jt:return{...t,...e.payload};default:return t}},"locale"),Xl=n((t={offerType:"radio"},e)=>{switch(e.type){case He:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?xt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(xt):t.frequencies};case Ge:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),on=n((t=!1,e)=>{switch(e.type){case le:return e.payload.isPreview;default:return t}},"previewStandardOffer"),nn=n((t=!1,e)=>{switch(e.type){case mt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var sn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),an=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),cn=n((t=[],e)=>{switch(e.type){case Qt:return[...e.payload||[]];case Kt:return[e.payload,...t];default:return t}},"templates"),ep=n((t={},e)=>{switch(e.type){case B:return Qe(e.payload);default:return t}},"productPlans"),ln=n((t={},e)=>{switch(e.type){case ht:{let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r}}case ie:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Gr=Mt({optedin:Hr,optedout:Bo,nextUpcomingOrder:zo,autoshipEligible:Wl,inStock:Jl,eligibilityGroups:Yo,incentives:Wo,frequency:Kl,auth:Jo,merchantId:Ko,authUrl:Qo,offer:Ql,offerId:Zo,sessionId:Xo,productOffer:Zl,firstOrderPlaceDate:en,productToSubscribe:tn,environment:Lt,locale:rn,config:Xl,previewStandardOffer:on,previewUpsellOffer:nn,autoshipByDefault:sn,defaultFrequencies:an,templates:cn,productPlans:ep,prepaidShipmentsSelected:ln});var Br=class extends N(j){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object}}}static get styles(){return y`
1012
+ `}};n(Lt,"TestWizard");function Bo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Lt);let e=document.createElement(t);document.body.appendChild(e)}n(Bo,"default");var zo=[79,71,68,69,86],Zs=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===zo[t]){let o=zo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=zo.length&&Bo()}else t=0},!1)},"enable");var Gr=n((t=[],e)=>{switch(e.type){case ue:return[];case ve:return e.newValue?e.newValue.optedin:t;case R:case k:{let[{prepaidShipments:r,...o},i]=Ke(t,e.payload.product);return i.concat({...o,...e.payload.product,frequency:e.payload.frequency})}case ae:{let{payload:r}=e,[{prepaidShipments:o,...i},s]=Ke(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case I:return t.filter(r=>!A(e.payload.product,r));case ht:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Jt:return t.filter(r=>!A(e.payload.product,r));case Ge:return[];default:return t}},"optedin"),Yo=n((t=[],e)=>{switch(e.type){case ue:return[];case ve:return e.newValue?e.newValue.optedout:t;case R:case k:return t.filter(r=>!A(e.payload.product,r));case I:{let[r,o]=Ke(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case ht:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case Ge:return[];default:return t}},"optedout"),Wo=n((t={},{type:e,payload:r})=>{switch(e){case zt: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 Yt:return{...t,products:(r.results||[]).map(o=>o.product)};case Wt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),ip=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),sp=n((t={},e)=>{switch(e.type){case K:return{...t};case T:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Jo=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),Xs=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Ko=n((t={},e)=>{switch(e.type){case T:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([i])=>i===o).reduce((i,[,{initial:s,ongoing:a}])=>({...i,initial:[...i.initial||[],...Xs(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...Xs(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),ap=n((t={},e)=>{switch(e.type){case R:case k:return{...t,[x(e.payload.product)]:e.payload.frequency};case I:return{...t,[x(e.payload.product)]:void 0};default:return t}},"frequency"),Qo=n((t=!1,e)=>{switch(e.type){case Bt:return{...e.payload};case xe:return!1;default:return t}},"auth"),Zo=n((t="",e)=>{switch(e.type){case Le:return e.payload;default:return t}},"merchantId"),Xo=n((t=null,e)=>{switch(e.type){case Gt:return e.payload;default:return t}},"authUrl"),cp=n((t={},e)=>{switch(e.type){case T:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),en=n((t="",e)=>{switch(e.type){case T:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),tn=n((t=null,e)=>{switch(e.type){case ue:return null;case Me:return e.payload;default:return t}},"sessionId"),lp=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 Ge:return{};default:return t}},"productOffer"),rn=n((t={},e)=>{switch(e.type){case Xt:return{...t,[x(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),on=n((t={},e)=>{switch(e.type){case er:return{...t,[x(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Mt=n((t={},e)=>{switch(e.type){case $e:return{...t,name:"local",apiUrl:"http://py3web.ordergroove.localhost",legoUrl:"http://py3lego.ordergroove.localhost"};case Ve:return{...t,name:Te,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case je:return{...t,name:tr,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case He:return{...t,name:Pe,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 Kt:return{...t,...e.payload};default:return t}},"locale"),pp=n((t={offerType:"radio"},e)=>{switch(e.type){case Be:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?vt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(vt):t.frequencies};case fe:return{...t,merchantSettings:{...e.payload}};default:return t}},"config"),sn=n((t=!1,e)=>{switch(e.type){case pe:return e.payload.isPreview;default:return t}},"previewStandardOffer"),an=n((t=!1,e)=>{switch(e.type){case gt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var cn=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"),pn=n((t=[],e)=>{switch(e.type){case Zt:return[...e.payload||[]];case Qt:return[e.payload,...t];default:return t}},"templates"),up=n((t={},e)=>{switch(e.type){case B:return Ze(e.payload);default:return t}},"productPlans"),un=n((t={},e)=>{switch(e.type){case mt:{let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r}}case ae:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Br=$t({optedin:Gr,optedout:Yo,nextUpcomingOrder:Wo,autoshipEligible:ip,inStock:sp,eligibilityGroups:Jo,incentives:Ko,frequency:ap,auth:Qo,merchantId:Zo,authUrl:Xo,offer:cp,offerId:en,experiments:(t={})=>t,sessionId:tn,productOffer:lp,firstOrderPlaceDate:rn,productToSubscribe:on,environment:Mt,locale:nn,config:pp,previewStandardOffer:sn,previewUpsellOffer:an,autoshipByDefault:cn,defaultFrequencies:ln,templates:pn,productPlans:up,prepaidShipmentsSelected:un});var zr=class extends N(j){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},payAsYouGo:{type:Boolean,reflect:!0,attribute:"pay-as-you-go"},frequency:{type:Object},productPlans:{type:Object}}}static get styles(){return y`
1013
1013
  :host::before {
1014
1014
  clip-path: inset(100%);
1015
1015
  clip: rect(1px, 1px, 1px, 1px);
@@ -1027,12 +1027,12 @@ var lib=(()=>{var ba=Object.create;var ut=Object.defineProperty;var _a=Object.ge
1027
1027
  :host([regular])::before {
1028
1028
  content: 'Regular price';
1029
1029
  }
1030
- `}get value(){var l;let e=x(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let p=o.find(f=>f.prepaidShipments===null||f.prepaidShipments===void 0);return p?p.subscriptionPrice:""}let i=o.find(p=>p.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return c===s?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?d`
1030
+ `}get value(){var l;let e=x(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let p=o.find(d=>d.prepaidShipments===null||d.prepaidShipments===void 0);return p?p.subscriptionPrice:""}let i=o.find(p=>p.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return c===s?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?f`
1031
1031
  <slot name="prepend"></slot>
1032
1032
  ${e}
1033
1033
  <slot name="append"></slot>
1034
- `:d`
1034
+ `:f`
1035
1035
  <slot name="fallback"></slot>
1036
- `}};n(Br,"Price");var tp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:ee(e.product)(t)}},"mapStateToProps"),Ws=g(tp)(Br);function pn(t){zs(),Mi(t);try{customElements.define("og-when",bs),customElements.define("og-text",Cs),customElements.define("og-incentive-text",Is),customElements.define("og-offer",$s),customElements.define("og-select-frequency",ks),customElements.define("og-optout-button",xs),customElements.define("og-optin-toggle",ws),customElements.define("og-optin-status",Ss),customElements.define("og-optin-button",Es),customElements.define("og-optin-select",Os),customElements.define("og-upsell-button",Ps),customElements.define("og-frequency-status",vs),customElements.define("og-modal",qt),customElements.define("og-select",Dt),customElements.define("og-tooltip",Ft),customElements.define("og-upsell-modal",Ts),customElements.define("og-next-upcoming-order",Ds),customElements.define("og-price",Ws),customElements.define("og-prepaid-toggle",Vs),customElements.define("og-prepaid-data",js),customElements.define("og-prepaid-button",Hs),customElements.define("og-prepaid-select",Gs),customElements.define("og-subscription-button",Bs)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(yo(o)),this},setMerchantId(o){return t.dispatch(li(o)),this},setAuthUrl(o){return t.dispatch(pi(o)),this},receiveMerchantSettings(o){return t.dispatch(xi(o)),this},getProductsForPurchasePost(o=[]){return Eo(t.getState(),o)},getOptins(o=[]){return Eo(t.getState(),o)},clear(){t.dispatch(hi())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(yi(o)),this},setLocale(o){return t.dispatch(gi(o)),this},addTemplate(o,i,s){return t.dispatch(bi(o,i,s)),this},setTemplates(o){return t.dispatch(_i(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let{apiUrl:l}=Lt({},yo(i)),{sessionId:p}=a.getState();p&&c.forEach(f=>{let u=x(f);de.fetchOffer(l,o,p,`${u}`,ve)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:B,payload:s.product_discounts})}},initialize(o,i,s,a){var l;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);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),a&&r.receiveMerchantSettings(a),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),So(window.opener,r),r}n(pn,"makeApi");var ae=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),zr=n(t=>`${t}%`,"percentage");var Yr=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"),Wr=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"),rp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),op=n((t,e)=>ae(t.compare_at_price,e),"getAllocationRegularPrice"),np=n((t,e)=>{var r;if(Yr(t)){let o=Wr((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return ae(i,e)}return ae(t.price,e)},"getAllocationSubscriptionPrice"),Js=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),ip=n((t,e)=>{var o,i,s;if(Yr(t)){let a=Wr((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,l=Js(t,c);return zr(l)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=zr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=ae(t.price_adjustments[0].value,e):t.compare_at_price&&(r=ae(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),sp=n(t=>{var e;return Yr(t)?Wr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),ap=n((t,e,r,o)=>{var f,u;let i=Wr((f=t.selling_plan)==null?void 0:f.options),s=t.price/i,a=t.compare_at_price-s,c=Js(t,s),l=(u=r==null?void 0:r.price_adjustments)==null?void 0:u[0],p=l&&l.value_type==="percentage"?l.value:null;return e.regularPrepaidPrice=ae(t.price,o),e.prepaidSavingsPerShipment=ae(Math.round(a),o),e.prepaidSavingsTotal=ae(Math.round(a*i),o),p&&c&&(e.prepaidExtraSavingsPercentage=zr(c-p)),e},"addPrepaidPriceAndSavings"),un="Subscribe and Save",cp=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:rp(t),regularPrice:op(t,r),subscriptionPrice:np(t,r),discountRate:ip(t,r),prepaidShipments:sp(t)};if(Yr(t)){let i=e.find(s=>s.group_name===un&&s.options.length===1);return ap(t,o,i,r)}return o},"mapSellingPlanToDiscount"),dn=n((t,e,r=[],o)=>[...t,cp(e,r,o)],"sellingPlanAllocationsReducer"),Ks=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Zs=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"),Qs=n((t,e,r)=>{if(!r)return null;if(!We(r))return r;if(pr(t,e)){let o=te(t,e,r);return o||fe(t)}return r},"getDefaultSellingPlan"),lp=n((t,e)=>t.map(r=>{var o,i,s,a,c,l,p;return We(r==null?void 0:r.frequency)?{...r,frequency:pr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?te((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||te((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||fe((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),pp=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:f}=s,u=r[c],h;return r[c]&&pr(l,p)?h=te(l,p,`${u.every}_${u.every_period}`)||Qs(l,p,f)||fe(l):r[c]?h=`${u.every}_${u.every_period}`:h=Qs(l,p,f)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),Xs=n(t=>(t==null?void 0:t.selling_plan_groups.find(fn))||dp(t),"getOGSellingPlanGroup"),up=n(t=>((t==null?void 0:t.selling_plan_groups)||[]).filter(r=>ea(r)||fn(r)),"getOGSellingPlanGroups"),dp=n(t=>t==null?void 0:t.selling_plan_groups.find(ea),"getDefaultSubscriptionSellingPlanGroup"),ea=n(t=>t.name===un,"isDefaultSellingPlanGroup"),fn=n(t=>t.name.startsWith("og_psfl"),"isProductSpecificFrequencySellingPlanGroup"),fp=n((t,e)=>({...Zs(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ta=n((t,[e])=>({...t,[e]:!0}),"productTrue"),ra=n((t,e)=>{let r=x(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),hp=n((t={},e)=>{var r;if(B===e.type)return Object.entries(e.payload).reduce(ta,t);if(ue===e.type){let{payload:o}=e;return o.items.reduce(ra,t)}if(K===e.type){let{payload:{product:o}}=e,i=up(o),s=new Set((r=i.flatMap(a=>a.selling_plans.map(c=>c.id)))!=null?r:[]);return[o,...(o==null?void 0:o.variants)||[]].reduce((a,c)=>{var f,u;let p=((u=(f=c==null?void 0:c.selling_plan_allocations)==null?void 0:f.filter(h=>s.has(h.selling_plan_id)))!=null?u:[]).length>0;return{...Zs(a,c.id,p),[c.id]:p}},t)}return le===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function mp(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(mp,"textToFreq");function oa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>mp(r))}n(oa,"sellingPlansToEveryPeriod");function na(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(na,"sellingPlansToFrequencies");function ia(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(ia,"getPrepaidShipments");function gp(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:ia(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(gp,"getPrepaidSellingPlans");var yp=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(B===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(K===e.type){let{payload:{product:s,currency:a}}=e,c={},l=Xs(s),p=na(l);if(p!=null&&p.length){let u=oa(l),h=((o=(r=l.options)==null?void 0:r[0])==null?void 0:o.values)||p,b=t.defaultFrequency;b&&We(b)&&(b=te(p,u,b)||fe(p)||b),c={frequencies:p,frequenciesEveryPeriod:u,frequenciesText:h,...b?{defaultFrequency:b}:{},hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||fn(l)}}let f=s==null?void 0:s.selling_plan_groups.filter(u=>/^Prepaid-.*/.test(u.name));return f.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...gp(f)}}),{...t,...c,storeCurrency:a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:l,prepaidSellingPlans:p={}}={},product:f}=s;return(i=p[f==null?void 0:f.id])!=null&&i.some(({sellingPlan:u})=>u===a)?{...t,defaultFrequency:fe(c)||a}:We(a)?{...t,defaultFrequency:te(c,l,a)||fe(c)||a}:{...t,defaultFrequency:a}}return Ge===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),bp=n((t={},e)=>{var r;if(B===e.type)return Object.entries(e.payload).reduce(ta,t);if(ue===e.type)return e.payload.items.reduce(ra,t);if(K===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(fp,t)||t}return J===e.type&&e.payload.product===null?{...t}:le===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),_p=n((t={},e)=>t,"offer");function Sp({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=x(r.id),s=(o=e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e.config.frequencies[0]}n(Sp,"getFrequencyForPrepaidShipments");function Ep(t){let e=ia(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(Ep,"getOptedInItem");var xp=n((t=[],e)=>{if(ue===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,Ep(i)]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,i=lp(t,r),s=pp(o,i,r);return[...i,...s]}if(K===e.type){let{product:r}=e.payload,o=Xs(r);if(!o)return t;let i=na(o),s=oa(o);return t.map(a=>We(a.frequency)?{...a,frequency:te(i,s,a.frequency)||fe(i)}:a)}if(ie===e.type){let{payload:r}=e,o=Hr(t,e),[i,s]=Je(o,r.product);return s.concat({...i,...r.product,frequency:Sp(r)})}return Hr(t,e)},"optedin"),vp=n((t={},e)=>t,"productOffer"),Op=n((t={},e)=>{var r;if(K===e.type){let{payload:{product:o,currency:i}}=e,s=Ks(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var l;return{...a,[c.id]:(l=c.selling_plan_allocations)==null?void 0:l.reduce((p,f)=>dn(p,f,s,i),[])}},t)||t}if(ue===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:dn([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return B===e.type?Qe(e.payload):t},"productPlans"),Pp=Mt({auth:Jo,authUrl:Qo,autoshipByDefault:sn,autoshipEligible:hp,config:yp,defaultFrequencies:an,eligibilityGroups:Yo,environment:Lt,firstOrderPlaceDate:en,incentives:Wo,inStock:bp,locale:rn,merchantId:Ko,nextUpcomingOrder:zo,offer:_p,offerId:Zo,optedin:xp,optedout:Bo,previewStandardOffer:on,previewUpsellOffer:nn,productOffer:vp,productPlans:Op,productToSubscribe:tn,sessionId:Xo,templates:cn,prepaidShipmentsSelected:ln});function hn(t,e){return window.og&&window.og.previewMode?Gr(t,e):Pp(t,e)}n(hn,"shopifyReducer");var la=ce(bt()),pa=ce(Vt());function sa(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(sa,"updateTrackingInputs");function mn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(mn,"getTrackingKey");function Tp(t,e){var f,u,h,b;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,i=mn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((b=t.payload.offer)==null?void 0:b.variationId)||"",c=Jr(o,e),p=[o,R.toLowerCase(),s,c,a].join(",");sa(o,i,p)}n(Tp,"addDefaultToSubTracking");function gn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=yn(r);o&&!o.isCart&&sa(o.product.id,i[0],i[1]);break}case P:Tp(r,t);break;default:}}}n(gn,"shopifyTrackingMiddleware");var aa,ca,bn=((ca=(aa=window.Shopify)==null?void 0:aa.routes)==null?void 0:ca.root)||"/",wp="/cart",Cp=`${bn}cart.js`,Rp=`${bn}cart/change.js`,Ap=`${bn}products/`,Np='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Ip=n(t=>(0,pa.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 kp(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await _n()).currency}n(kp,"getCurrency");async function qp(t,e){let r=Dp(e);if(r)try{let[i,s]=await Promise.all([ua(r),kp()]),a={product:i,offer:e,currency:s};t.dispatch({type:K,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=Ip(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(qp,"setupPdp");async function _n(){return(await fetch(Cp)).json()}n(_n,"getCart");function Dp(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(Dp,"guessProductHandle");var ua=(0,la.default)(async function(t){return(await fetch(`${Ap}${t}.js`)).json()});async function Fp(t,e){let r=await _n(),{items:o}=r,i=r;t.dispatch({type:ue,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(ua))).forEach(c=>{let l={product:c,offer:e,currency:r.currency};t.dispatch({type:K,payload:l})})}n(Fp,"setupCart");async function Up(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Jr(t.payload.product.id,e),i=yn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Np)),l=t.payload.product.id,p=await _n(),f=(s=p==null?void 0:p.items)==null?void 0:s.findIndex(C=>C.key===l),u=p.items[f],h=u.quantity,b=x(l),S=await fetch(Rp,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,attributes:Object.fromEntries([i]),properties:u.properties,selling_plan:o||null,sections:c.map(C=>C.id.replace(/^shopify-section-/,""))})});if(S.status!==200)throw new Error("Cart not updated");let m=await S.json(),E=p.items.length===m.items.length?m.items[f].key:(a=m.items.find(C=>C.quantity===h&&C.product_id===b&&(!o&&!C.selling_plan_allocation||(C==null?void 0:C.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;E&&(e.dispatch({type:ht,payload:{oldCartProductKey:l,newCartProductKey:E}}),r.setAttribute("product",E));let T=m;e.dispatch({type:ue,payload:T});let _=new CustomEvent(Hn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(_),_.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(C=>{let En=C.id.replace(/^shopify-section-/,"");if(!(En in w))return;let ya=w[En],xn=new DOMParser().parseFromString(ya.toString()||"","text/html").getElementById(C.id);xn&&(C.innerHTML=xn.innerHTML)}):window.location.pathname.startsWith(wp)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Up,"synchronizeCartOptin");function yn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=mn(),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 J:case I:s.push(""),s.push(i);break;case R:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(yn,"getTrackingEvent");function Jr(t,e){var i;return(i=ar({id:t})(e.getState()))==null?void 0:i.frequency}n(Jr,"getSubscribedFrequency");function Lp(t,e){e.isCart||!e.shouldEnableOffer||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Jr(o,t);uo(r.form,"selling_plan",i),uo(r.form,"attributes[og__session]",t.getState().sessionId)})}n(Lp,"synchronizeSellingPlan");function Sn(t){return e=>r=>{var o;switch(r.type){case R:case I:case k:break;case J:(o=r.payload.offer)!=null&&o.isCart?Fp(t,r.payload.offer):qp(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ie:Up(r,t);case J:case P:case K:Lp(t,r.payload.offer);break;default:}}}n(Sn,"shopifyMiddleware");var Mp="/apps/subscriptions/auth/",da="og_auth_begin",$p="og_auth_end",Vp=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function fa({store:t}){var i;let[e]=po(),r=vt(),o=r!=null&&r.dataset.customer?Vp(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await Hp(o);if(s){let[a,c,l]=s.split("|");t.dispatch(Tt(e,a,Number(c),l))}}else ii("og_auth")}n(fa,"authorizeShopifyCustomer");async function jp(t){try{let r=await(await fetch(`${Mp}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(da);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+da.length,r.lastIndexOf($p)))}catch(e){console.error(e)}}n(jp,"fetchOGSignature");async function Hp(t){let e=si("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await jp(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(Hp,"getOrCreateAuthCookie");var ha,ga=Di(...(ha=q)!=null&&ha.shopify_selling_plans?[hn,Sn]:[Gr],q.shopify&&gn),O=pn(ga),Gp=O.isReady,Bp=O.addOptinChangedCallback,zp=O.addTemplate,Yp=O.clear,Wp=O.config,Jp=O.disableOptinChangedCallbacks,Kp=O.getOptins,Qp=O.getProductsForPurchasePost,Zp=O.initialize,Xp=O.previewMode,eu=O.register,tu=O.resolveSettings,ru=O.setAuthUrl,ou=O.setEnvironment,nu=O.setLocale,iu=O.setMerchantId,su=O.setPublicPath,au=O.setTemplates,cu=O.setupCart,lu=O.setupProduct,pu=O.setupProducts,uu=n(()=>ni(O),"autoInit");var du=O.initialize,ma;(ma=q)!=null&&ma.shopify_selling_plans&&lr(()=>fa(O));return va(fu);})();
1036
+ `}};n(zr,"Price");var dp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:te(e.product)(t)}},"mapStateToProps"),ea=g(dp)(zr);function dn(t){Zs(),Bi(t);try{customElements.define("og-when",Os),customElements.define("og-text",qs),customElements.define("og-incentive-text",Ls),customElements.define("og-offer",zs),customElements.define("og-select-frequency",Ms),customElements.define("og-optout-button",Cs),customElements.define("og-optin-toggle",ks),customElements.define("og-optin-status",Ps),customElements.define("og-optin-button",ws),customElements.define("og-optin-select",As),customElements.define("og-upsell-button",Ns),customElements.define("og-frequency-status",Rs),customElements.define("og-modal",Dt),customElements.define("og-select",Ft),customElements.define("og-tooltip",Ut),customElements.define("og-upsell-modal",Is),customElements.define("og-next-upcoming-order",Vs),customElements.define("og-price",ea),customElements.define("og-prepaid-toggle",Ys),customElements.define("og-prepaid-data",Ws),customElements.define("og-prepaid-button",Js),customElements.define("og-prepaid-select",Ks),customElements.define("og-subscription-button",Qs)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(_o(o)),this},setMerchantId(o){return t.dispatch(mi(o)),this},setAuthUrl(o){return t.dispatch(gi(o)),this},receiveMerchantSettings(o){return t.dispatch(Ci(o)),this},getProductsForPurchasePost(o=[]){return vo(t.getState(),o)},getOptins(o=[]){return vo(t.getState(),o)},clear(){t.dispatch(Si())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(vi(o)),this},setLocale(o){return t.dispatch(xi(o)),this},addTemplate(o,i,s){return t.dispatch(Oi(o,i,s)),this},setTemplates(o){return t.dispatch(Ti(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let{apiUrl:l}=Mt({},_o(i)),p=a.getState(),{sessionId:d}=p;d&&c.forEach(u=>{let h=x(u);he.fetchOffer(l,o,d,`${h}`,Oe,p)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:B,payload:s.product_discounts})}},initialize(o,i,s,a){var l;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);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),a&&r.receiveMerchantSettings(a),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),xo(window.opener,r),r}n(dn,"makeApi");var le=n((t,e)=>t===null?"":new Intl.NumberFormat(navigator.language,{style:"currency",currency:e}).format(t/100),"money"),Yr=n(t=>`${t}%`,"percentage");var Wr=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"),Jr=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"),fp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),hp=n((t,e)=>le(t.compare_at_price,e),"getAllocationRegularPrice"),mp=n((t,e)=>{var r;if(Wr(t)){let o=Jr((r=t.selling_plan)==null?void 0:r.options),i=Math.round(t.price/o);return le(i,e)}return le(t.price,e)},"getAllocationSubscriptionPrice"),ta=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),gp=n((t,e)=>{var o,i,s;if(Wr(t)){let a=Jr((o=t.selling_plan)==null?void 0:o.options),c=t.price/a,l=ta(t,c);return Yr(l)}let r="";return((i=t.price_adjustments[0])==null?void 0:i.value_type)==="percentage"?r=Yr(t.price_adjustments[0].value):(s=t.price_adjustments[0])!=null&&s.value?r=le(t.price_adjustments[0].value,e):t.compare_at_price&&(r=le(t.compare_at_price-t.price,e)),r},"getAllocationDiscountRate"),yp=n(t=>{var e;return Wr(t)?Jr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),bp=n((t,e,r,o)=>{var d,u;let i=Jr((d=t.selling_plan)==null?void 0:d.options),s=t.price/i,a=t.compare_at_price-s,c=ta(t,s),l=(u=r==null?void 0:r.price_adjustments)==null?void 0:u[0],p=l&&l.value_type==="percentage"?l.value:null;return e.regularPrepaidPrice=le(t.price,o),e.prepaidSavingsPerShipment=le(Math.round(a),o),e.prepaidSavingsTotal=le(Math.round(a*i),o),p&&c&&(e.prepaidExtraSavingsPercentage=Yr(c-p)),e},"addPrepaidPriceAndSavings"),fn="Subscribe and Save",_p=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:fp(t),regularPrice:hp(t,r),subscriptionPrice:mp(t,r),discountRate:gp(t,r),prepaidShipments:yp(t)};if(Wr(t)){let i=e.find(s=>s.group_name===fn&&s.options.length===1);return bp(t,o,i,r)}return o},"mapSellingPlanToDiscount"),hn=n((t,e,r=[],o)=>[...t,_p(e,r,o)],"sellingPlanAllocationsReducer"),ra=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var na=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"),oa=n((t,e,r)=>{if(!r)return null;if(!Je(r))return r;if(ur(t,e)){let o=re(t,e,r);return o||me(t)}return r},"getDefaultSellingPlan"),Sp=n((t,e)=>t.map(r=>{var o,i,s,a,c,l,p;return Je(r==null?void 0:r.frequency)?{...r,frequency:ur((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?re((s=e==null?void 0:e.config)==null?void 0:s.frequencies,(a=e==null?void 0:e.config)==null?void 0:a.frequenciesEveryPeriod,r.frequency)||re((c=e==null?void 0:e.config)==null?void 0:c.frequencies,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||me((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),Ep=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:d}=s,u=r[c],h;return r[c]&&ur(l,p)?h=re(l,p,`${u.every}_${u.every_period}`)||oa(l,p,d)||me(l):r[c]?h=`${u.every}_${u.every_period}`:h=oa(l,p,d)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),ia=n(t=>(t==null?void 0:t.selling_plan_groups.find(mn))||vp(t),"getOGSellingPlanGroup"),xp=n(t=>((t==null?void 0:t.selling_plan_groups)||[]).filter(r=>sa(r)||mn(r)),"getOGSellingPlanGroups"),vp=n(t=>t==null?void 0:t.selling_plan_groups.find(sa),"getDefaultSubscriptionSellingPlanGroup"),sa=n(t=>t.name===fn,"isDefaultSellingPlanGroup"),mn=n(t=>t.name.startsWith("og_psfl"),"isProductSpecificFrequencySellingPlanGroup"),Op=n((t,e)=>({...na(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),aa=n((t,[e])=>({...t,[e]:!0}),"productTrue"),ca=n((t,e)=>{let r=x(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Tp=n((t={},e)=>{var r;if(B===e.type)return Object.entries(e.payload).reduce(aa,t);if(de===e.type){let{payload:o}=e;return o.items.reduce(ca,t)}if(Q===e.type){let{payload:{product:o}}=e,i=xp(o),s=new Set((r=i.flatMap(a=>a.selling_plans.map(c=>c.id)))!=null?r:[]);return[o,...(o==null?void 0:o.variants)||[]].reduce((a,c)=>{var d,u;let p=((u=(d=c==null?void 0:c.selling_plan_allocations)==null?void 0:d.filter(h=>s.has(h.selling_plan_id)))!=null?u:[]).length>0;return{...na(a,c.id,p),[c.id]:p}},t)}return pe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function Pp(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(Pp,"textToFreq");function la(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Pp(r))}n(la,"sellingPlansToEveryPeriod");function pa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(pa,"sellingPlansToFrequencies");function ua(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(ua,"getPrepaidShipments");function wp(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:ua(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(wp,"getPrepaidSellingPlans");var Cp=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(B===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Q===e.type){let{payload:{product:s,currency:a}}=e,c={},l=ia(s),p=pa(l);if(p!=null&&p.length){let u=la(l),h=((o=(r=l.options)==null?void 0:r[0])==null?void 0:o.values)||p,b=t.defaultFrequency;b&&Je(b)&&(b=re(p,u,b)||me(p)||b),c={frequencies:p,frequenciesEveryPeriod:u,frequenciesText:h,...b?{defaultFrequency:b}:{},hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||mn(l)}}let d=s==null?void 0:s.selling_plan_groups.filter(u=>/^Prepaid-.*/.test(u.name));return d.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...wp(d)}}),{...t,...c,storeCurrency:a}}if(T===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:l,prepaidSellingPlans:p={}}={},product:d}=s;return(i=p[d==null?void 0:d.id])!=null&&i.some(({sellingPlan:u})=>u===a)?{...t,defaultFrequency:me(c)||a}:Je(a)?{...t,defaultFrequency:re(c,l,a)||me(c)||a}:{...t,defaultFrequency:a}}return fe===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),Rp=n((t={},e)=>{var r;if(B===e.type)return Object.entries(e.payload).reduce(aa,t);if(de===e.type)return e.payload.items.reduce(ca,t);if(Q===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(Op,t)||t}return K===e.type&&e.payload.product===null?{...t}:pe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),Ap=n((t={},e)=>t,"offer");function Np({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=x(r.id),s=(o=e.config.prepaidSellingPlans[i])==null?void 0:o.find(a=>a.numberShipments===t);return s?s.sellingPlan:null}return e.config.frequencies[0]}n(Np,"getFrequencyForPrepaidShipments");function Ip(t){let e=ua(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(Ip,"getOptedInItem");var kp=n((t=[],e)=>{if(de===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,Ip(i)]:o,[]))}if(T===e.type){let{offer:r={},...o}=e.payload,i=Sp(t,r),s=Ep(o,i,r);return[...i,...s]}if(Q===e.type){let{product:r}=e.payload,o=ia(r);if(!o)return t;let i=pa(o),s=la(o);return t.map(a=>Je(a.frequency)?{...a,frequency:re(i,s,a.frequency)||me(i)}:a)}if(ae===e.type){let{payload:r}=e,o=Gr(t,e),[i,s]=Ke(o,r.product);return s.concat({...i,...r.product,frequency:Np(r)})}return Gr(t,e)},"optedin"),qp=n((t={},e)=>t,"productOffer"),Dp=n((t={},e)=>{var r;if(Q===e.type){let{payload:{product:o,currency:i}}=e,s=ra(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var l;return{...a,[c.id]:(l=c.selling_plan_allocations)==null?void 0:l.reduce((p,d)=>hn(p,d,s,i),[])}},t)||t}if(de===e.type){let o=e.payload;return o.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:hn([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return B===e.type?Ze(e.payload):t},"productPlans"),Fp=$t({auth:Qo,authUrl:Xo,autoshipByDefault:cn,autoshipEligible:Tp,config:Cp,defaultFrequencies:ln,eligibilityGroups:Jo,environment:Mt,firstOrderPlaceDate:rn,incentives:Ko,inStock:Rp,locale:nn,merchantId:Zo,nextUpcomingOrder:Wo,offer:Ap,offerId:en,experiments:(t={})=>t,optedin:kp,optedout:Yo,previewStandardOffer:sn,previewUpsellOffer:an,productOffer:qp,productPlans:Dp,productToSubscribe:on,sessionId:tn,templates:pn,prepaidShipmentsSelected:un});function gn(t,e){return window.og&&window.og.previewMode?Br(t,e):Fp(t,e)}n(gn,"shopifyReducer");var ma=se(_t()),ga=se(jt());function da(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(da,"updateTrackingInputs");function yn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(yn,"getTrackingKey");function Up(t,e){var d,u,h,b;if(!((d=t.payload.offer)==null?void 0:d.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,i=yn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((b=t.payload.offer)==null?void 0:b.variationId)||"",c=Kr(o,e),p=[o,R.toLowerCase(),s,c,a].join(",");da(o,i,p)}n(Up,"addDefaultToSubTracking");function bn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=_n(r);o&&!o.isCart&&da(o.product.id,i[0],i[1]);break}case T:Up(r,t);break;default:}}}n(bn,"shopifyTrackingMiddleware");var fa,ha,Sn=((ha=(fa=window.Shopify)==null?void 0:fa.routes)==null?void 0:ha.root)||"/",Lp="/cart",Mp=`${Sn}cart.js`,$p=`${Sn}cart/change.js`,Vp=`${Sn}products/`,jp='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Hp=n(t=>(0,ga.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 Gp(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await En()).currency}n(Gp,"getCurrency");async function Bp(t,e){let r=zp(e);if(r)try{let[i,s]=await Promise.all([ya(r),Gp()]),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=Hp(e);o.addEventListener("change",()=>i(o)),new MutationObserver(()=>i(o)).observe(o,{subtree:!0,childList:!0})}else console.info("no /cart/add form found for og-offer",e)}n(Bp,"setupPdp");async function En(){return(await fetch(Mp)).json()}n(En,"getCart");function zp(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(zp,"guessProductHandle");var ya=(0,ma.default)(async function(t){return(await fetch(`${Vp}${t}.js`)).json()});async function Yp(t,e){let r=await En(),{items:o}=r,i=r;t.dispatch({type:de,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(ya))).forEach(c=>{let l={product:c,offer:e,currency:r.currency};t.dispatch({type:Q,payload:l})})}n(Yp,"setupCart");async function Wp(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Kr(t.payload.product.id,e),i=_n(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(jp)),l=t.payload.product.id,p=await En(),d=(s=p==null?void 0:p.items)==null?void 0:s.findIndex(C=>C.key===l),u=p.items[d],h=u.quantity,b=x(l),S=await fetch($p,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:h,attributes:Object.fromEntries([i]),properties:u.properties,selling_plan:o||null,sections:c.map(C=>C.id.replace(/^shopify-section-/,""))})});if(S.status!==200)throw new Error("Cart not updated");let m=await S.json(),E=p.items.length===m.items.length?m.items[d].key:(a=m.items.find(C=>C.quantity===h&&C.product_id===b&&(!o&&!C.selling_plan_allocation||(C==null?void 0:C.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;E&&(e.dispatch({type:mt,payload:{oldCartProductKey:l,newCartProductKey:E}}),r.setAttribute("product",E));let P=m;e.dispatch({type:de,payload:P});let _=new CustomEvent(Jn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(_),_.defaultPrevented)return;let w=m.sections;Object.values(w).length?c.forEach(C=>{let Pn=C.id.replace(/^shopify-section-/,"");if(!(Pn in w))return;let Ca=w[Pn],wn=new DOMParser().parseFromString(Ca.toString()||"","text/html").getElementById(C.id);wn&&(C.innerHTML=wn.innerHTML)}):window.location.pathname.startsWith(Lp)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Wp,"synchronizeCartOptin");function _n(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=yn(),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 K:case I:s.push(""),s.push(i);break;case R:case k:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(_n,"getTrackingEvent");function Kr(t,e){var i;return(i=cr({id:t})(e.getState()))==null?void 0:i.frequency}n(Kr,"getSubscribedFrequency");function Jp(t,e){e.isCart||!e.shouldEnableOffer||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Kr(o,t);ho(r.form,"selling_plan",i),ho(r.form,"attributes[og__session]",t.getState().sessionId)})}n(Jp,"synchronizeSellingPlan");function xn(t){return e=>r=>{var o;switch(r.type){case R:case I:case k:break;case K:(o=r.payload.offer)!=null&&o.isCart?Yp(t,r.payload.offer):Bp(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ae:Wp(r,t);case K:case T:case Q:Jp(t,r.payload.offer);break;default:}}}n(xn,"shopifyMiddleware");var Kp="/apps/subscriptions/auth/",ba="og_auth_begin",Qp="og_auth_end",Zp=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function _a({store:t}){var i;let[e]=fo(),r=Ot(),o=r!=null&&r.dataset.customer?Zp(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await eu(o);if(s){let[a,c,l]=s.split("|");t.dispatch(wt(e,a,Number(c),l))}}else ui("og_auth")}n(_a,"authorizeShopifyCustomer");async function Xp(t){try{let r=await(await fetch(`${Kp}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(ba);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+ba.length,r.lastIndexOf(Qp)))}catch(e){console.error(e)}}n(Xp,"fetchOGSignature");async function eu(t){let e=di("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await Xp(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(eu,"getOrCreateAuthCookie");var Oa=se(va());function nu(t,e){e.map(a=>a.weight).reduce((a,c)=>a+c,0)!==100&&console.error("Sum of weights for variants must be 100");let i=Oa.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(nu,"getVariantIx");function iu(t={},e){var r,o;if(e.type===fe&&(r=e.payload)!=null&&r.experiments){let i=e.payload.experiments,{sessionId:s}=t,a=i.variants,c=nu(s,a),l=a[c];return{...t,experiments:{...e.payload.experiments,currentVariant:c,offerProfileId:(o=l.parameters)==null?void 0:o.offer_profile_public_id}}}return t}n(iu,"experimentsReducer");var Tn=n(t=>(e={},r)=>{let o=t(e,r);return iu(o,r)},"addExperimentsReducer");var Ta,wa=Vi(...(Ta=q)!=null&&Ta.shopify_selling_plans?[Tn(gn),xn]:[Tn(Br)],q.shopify&&bn),O=dn(wa),su=O.isReady,au=O.addOptinChangedCallback,cu=O.addTemplate,lu=O.clear,pu=O.config,uu=O.disableOptinChangedCallbacks,du=O.getOptins,fu=O.getProductsForPurchasePost,hu=O.initialize,mu=O.previewMode,gu=O.register,yu=O.resolveSettings,bu=O.setAuthUrl,_u=O.setEnvironment,Su=O.setLocale,Eu=O.setMerchantId,xu=O.setPublicPath,vu=O.setTemplates,Ou=O.setupCart,Tu=O.setupProduct,Pu=O.setupProducts,wu=n(()=>pi(O),"autoInit");var Cu=O.initialize,Pa;(Pa=q)!=null&&Pa.shopify_selling_plans&&pr(()=>_a(O));return qa(Ru);})();
1037
1037
  ; return lib; });
1038
1038
  //# sourceMappingURL=offers.js.map