@ordergroove/offers 2.36.2-alpha-PR-836-2.3 → 2.37.0

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 ga=Object.create;var ut=Object.defineProperty;var ya=Object.getOwnPropertyDescriptor;var ba=Object.getOwnPropertyNames;var _a=Object.getPrototypeOf,Sa=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),En=(t,e)=>{for(var r in e)ut(t,r,{get:e[r],enumerable:!0})},xn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ba(e))!Sa.call(t,i)&&i!==r&&ut(t,i,{get:()=>e[i],enumerable:!(o=ya(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?ga(_a(t)):{},xn(e||!t||!t.__esModule?ut(r,"default",{value:t,enumerable:!0}):r,t)),Ea=t=>xn(ut({},"__esModule",{value:!0}),t);var Vt=Se(($t,An)=>{(function(t,e){typeof $t=="object"&&typeof An<"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,p=!1,l=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function d(){f(),p=!0}n(d,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function m(){for(var b=arguments.length,S=new Array(b),h=0;h<b;h++)S[h]=arguments[h];var E=this,P=Date.now()-l;if(p)return;function _(){l=Date.now(),s.apply(E,S)}n(_,"exec");function w(){c=void 0}n(w,"clear"),a&&!c&&_(),f(),a===void 0&&P>o?_():i!==!0&&(c=setTimeout(a?w:_,a===void 0?o-P:o))}return n(m,"wrapper"),m.cancel=d,m}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((_u,Jn)=>{var Ia="Expected a function",Hn="__lodash_hash_undefined__",ka="[object Function]",qa="[object GeneratorFunction]",Da=/[\\^$.*+?()[\]{}|]/g,Fa=/^\[object .+?Constructor\]$/,Ua=typeof window=="object"&&window&&window.Object===Object&&window,La=typeof self=="object"&&self&&self.Object===Object&&self,Gn=Ua||La||Function("return this")();function Ma(t,e){return t?.[e]}n(Ma,"getValue");function $a(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n($a,"isHostObject");var Va=Array.prototype,ja=Function.prototype,Bn=Object.prototype,ro=Gn["__core-js_shared__"],jn=function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),zn=ja.toString,oo=Bn.hasOwnProperty,Ha=Bn.toString,Ga=RegExp("^"+zn.call(oo).replace(Da,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ba=Va.splice,za=Yn(Gn,"Map"),yt=Yn(Object,"create");function Pe(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(Pe,"Hash");function Ya(){this.__data__=yt?yt(null):{}}n(Ya,"hashClear");function Wa(t){return this.has(t)&&delete this.__data__[t]}n(Wa,"hashDelete");function Ja(t){var e=this.__data__;if(yt){var r=e[t];return r===Hn?void 0:r}return oo.call(e,t)?e[t]:void 0}n(Ja,"hashGet");function Ka(t){var e=this.__data__;return yt?e[t]!==void 0:oo.call(e,t)}n(Ka,"hashHas");function Qa(t,e){var r=this.__data__;return r[t]=yt&&e===void 0?Hn:e,this}n(Qa,"hashSet");Pe.prototype.clear=Ya;Pe.prototype.delete=Wa;Pe.prototype.get=Ja;Pe.prototype.has=Ka;Pe.prototype.set=Qa;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 Za(){this.__data__=[]}n(Za,"listCacheClear");function Xa(t){var e=this.__data__,r=or(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Ba.call(e,r,1),!0}n(Xa,"listCacheDelete");function ec(t){var e=this.__data__,r=or(e,t);return r<0?void 0:e[r][1]}n(ec,"listCacheGet");function tc(t){return or(this.__data__,t)>-1}n(tc,"listCacheHas");function rc(t,e){var r=this.__data__,o=or(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(rc,"listCacheSet");Be.prototype.clear=Za;Be.prototype.delete=Xa;Be.prototype.get=ec;Be.prototype.has=tc;Be.prototype.set=rc;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 oc(){this.__data__={hash:new Pe,map:new(za||Be),string:new Pe}}n(oc,"mapCacheClear");function nc(t){return nr(this,t).delete(t)}n(nc,"mapCacheDelete");function ic(t){return nr(this,t).get(t)}n(ic,"mapCacheGet");function sc(t){return nr(this,t).has(t)}n(sc,"mapCacheHas");function ac(t,e){return nr(this,t).set(t,e),this}n(ac,"mapCacheSet");we.prototype.clear=oc;we.prototype.delete=nc;we.prototype.get=ic;we.prototype.has=sc;we.prototype.set=ac;function or(t,e){for(var r=t.length;r--;)if(dc(t[r][0],e))return r;return-1}n(or,"assocIndexOf");function cc(t){if(!Wn(t)||lc(t))return!1;var e=fc(t)||$a(t)?Ga:Fa;return e.test(uc(t))}n(cc,"baseIsNative");function nr(t,e){var r=t.__data__;return pc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(nr,"getMapData");function Yn(t,e){var r=Ma(t,e);return cc(r)?r:void 0}n(Yn,"getNative");function pc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(pc,"isKeyable");function lc(t){return!!jn&&jn in t}n(lc,"isMasked");function uc(t){if(t!=null){try{return zn.call(t)}catch{}try{return t+""}catch{}}return""}n(uc,"toSource");function no(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ia);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 dc(t,e){return t===e||t!==t&&e!==e}n(dc,"eq");function fc(t){var e=Wn(t)?Ha.call(t):"";return e==ka||e==qa}n(fc,"isFunction");function Wn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Wn,"isObject");Jn.exports=no});var xr=Se((lf,Xi)=>{var ip={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};Xi.exports=ip});var ts=Se((uf,es)=>{var ke=xr(),sp=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");es.exports=sp});var os=Se((df,rs)=>{var be=xr(),ap=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"),cp=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");rs.exports={PolishNotation:ap,PolishGenerator:cp}});var is=Se((ff,ns)=>{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");ns.exports={make:it,nodeEvaluator:st}});var ps=Se((hf,cs)=>{var pp=ts(),ss=os(),as=is(),lp=n((t,e)=>{let r=pp(t),o=ss.PolishNotation(r),i=ss.PolishGenerator(o),s=as.make(i);return as.nodeEvaluator(s,e)},"parse");cs.exports={parse:lp}});var lu={};En(lu,{addOptinChangedCallback:()=>jl,addTemplate:()=>Hl,autoInit:()=>cu,clear:()=>Gl,config:()=>Bl,default:()=>pu,disableOptinChangedCallbacks:()=>zl,getOptins:()=>Yl,getProductsForPurchasePost:()=>Wl,initialize:()=>Jl,isReady:()=>Vl,offers:()=>O,platform:()=>q,previewMode:()=>Kl,register:()=>Ql,resolveSettings:()=>Zl,setAuthUrl:()=>Xl,setEnvironment:()=>eu,setLocale:()=>tu,setMerchantId:()=>ru,setPublicPath:()=>ou,setTemplates:()=>nu,setupCart:()=>iu,setupProduct:()=>su,setupProducts:()=>au,store:()=>ha});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 xa=Kr(Fe),Qr=xa;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 va(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(va,"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,p=!1;function l(){c===a&&(c=a.slice())}n(l,"ensureCanMutateNextListeners");function f(){if(p)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 d(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(p)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 l(),c.push(h),n(function(){if(!!E){if(p)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,l();var _=c.indexOf(h);c.splice(_,1),a=null}},"unsubscribe")}n(d,"subscribe");function m(h){if(!va(h))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof h.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,h)}finally{p=!1}for(var E=a=c,P=0;P<E.length;P++){var _=E[P];_()}return h}n(m,"dispatch");function b(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");i=h,m({type:dt.REPLACE})}n(b,"replaceReducer");function S(){var h,E=d;return h={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")},h[Qr]=function(){return this},h}return n(S,"observable"),m({type:dt.INIT}),o={dispatch:m,subscribe:d,getState:f,replaceReducer:b},o[Qr]=S,o}n(Xr,"createStore");function Oa(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(Oa,"getUndefinedStateErrorMessage");function Ta(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(Ta,"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{Ta(r)}catch(p){c=p}return n(function(l,f){if(l===void 0&&(l={}),c)throw c;if(!1)var d;for(var m=!1,b={},S=0;S<s.length;S++){var h=s[S],E=r[h],P=l[h],_=E(P,f);if(typeof _>"u"){var w=Oa(h,f);throw new Error(w)}b[h]=_,m=m||_!==P}return m=m||s.length!==Object.keys(l).length,m?b:l},"combination")}n(Mt,"combineReducers");function vn(t,e){return function(){return e(t.apply(this,arguments))}}n(vn,"bindActionCreator");function Tn(t,e){if(typeof t=="function")return vn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=vn(i,e))}return r}n(Tn,"bindActionCreators");function Pa(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Pa,"_defineProperty");function On(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(On,"ownKeys");function wa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?On(r,!0).forEach(function(o){Pa(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):On(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(wa,"_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 Pn(){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(p){return p(a)});return s=eo.apply(void 0,c)(i.dispatch),wa({},i,{dispatch:s})}}}n(Pn,"applyMiddleware");function wn(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(wn,"createThunkMiddleware");var Cn=wn();Cn.withExtraArgument=wn;var Rn=Cn;var vi=ce(Vt());var Nn=/^og_auth=/,Ca=n((t=Nn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Nn,""),"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"),Ra=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"),Aa=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function In(){return typeof window.og_auth<"u"?jt(window.og_auth):null}n(In,"a");async function Na(t=100){return new Promise(e=>{setTimeout(()=>e(In()),t)})}n(Na,"f");async function kn(t,e=Ca,r=Ra){let o;if(o=jt(In())||jt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Aa(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Na());if(o=jt(o),o)return o;throw new Error("Unauthorized")}n(kn,"u");var R="OPTIN_PRODUCT",I="OPTOUT_PRODUCT",k="PRODUCT_CHANGE_FREQUENCY",ie="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ue="SET_MERCHANT_ID",J="REQUEST_OFFER",T="RECEIVE_OFFER",ft="PRODUCT_HAS_CHANGED",Le="CREATED_SESSION_ID",Ht="SET_AUTH_URL",qn="REQUEST_AUTH",Gt="AUTHORIZE",Ee="UNAUTHORIZED",Dn="REQUEST_ORDERS",Bt="RECEIVE_ORDERS",ht="CART_PRODUCT_KEY_HAS_CHANGED",zt="RECEIVE_ORDER_ITEMS",Fn="FETCH_RESPONSE_ERROR",Me="SET_ENVIRONMENT_STAGING",$e="SET_ENVIRONMENT_DEV",Ve="SET_ENVIRONMENT_PROD",Un="CONCLUDE_UPSELL",Ln="REQUEST_CREATE_IU_ORDER",Yt="CREATE_ONE_TIME",Mn="REQUEST_CONVERT_ONE_TIME",Wt="CONVERT_ONE_TIME";var je="CHECKOUT",$n="RECEIVE_FETCH",Jt="SET_LOCALE",He="SET_CONFIG",pe="SET_PREVIEW_STANDARD_OFFER",mt="SET_PREVIEW_UPSELL_OFFER",to="SET_PREVIEW_PREPAID_OFFER",Kt="ADD_TEMPLATE",Qt="SET_TEMPLATES",xe="LOCAL_STORAGE_CHANGE",le="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",Te="prod",tr="static.ordergroove.com",rr="staging.static.ordergroove.com",Vn="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"),Kn=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"),Qn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),hc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),mc=(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=Qn([["session_id",e],["page_type",1],["p",hc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),io),gc=(0,ir.default)(_t(St(sr((t=1,e="place")=>[`/orders/?${Qn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),io),yc=(0,ir.default)(_t(St(sr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),io),bc=_t(St(sr(Kn((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"),_c=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Zn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(so).sort(_c),"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"),Sc=_t(St(sr(Kn((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:mc,fetchOrders:gc,fetchItems:yc,createOneTime:bc,convertOneTimeToSubscription:Sc};var ao=vt(),q={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(ao==null?void 0:ao.dataset.shopifySellingPlans)!="undefined"};function Ec(t,e){return t===e}n(Ec,"defaultEqualityCheck");function xc(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(xc,"areArgumentsShallowlyEqual");function vc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ec,r=null,o=null;return function(){return xc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(vc,"defaultMemoize");function Oc(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(Oc,"getDependencies");function Tc(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,p=s.pop(),l=Oc(s),f=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),d=t(function(){for(var m=[],b=l.length,S=0;S<b;S++)m.push(l[S].apply(null,arguments));return f.apply(null,m)});return d.resultFunc=p,d.dependencies=l,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(Tc,"createSelectorCreator");var Q=Tc(vc);var z=ce(bt());z.default.Cache=Map;function Pc(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(Pc,"arraysEqual");function wc(t,e,r){let o=xt(r);return q.shopify_selling_plans?te(t,e,o):o}n(wc,"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))||Pc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Ot=n(t=>t.optedin||[],"optedinSelector"),Xn=n(t=>t.optedout||[],"optedoutSelector"),co=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Cc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Rc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Ac=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Nc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Ic=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),Z=(0,z.default)(t=>Q(Ot,Xn,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)),ei=(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(Ic,e=>e[t.id]||null),t=>JSON.stringify(t)),cr=(0,z.default)(t=>Q(Xn,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(Nc,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(Cc,Rc,Ac,(e,r,o)=>e[x(t)]&&wc(r,o,e[x(t)])||null)),po=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(po(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ye=n(t=>({templates:t.templates||[]}),"templatesSelector");function pr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(pr,"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 lo(){let t=vt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Oe)?Oe:Te,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(lo,"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"),ti=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"),Tt=n((t,e)=>{var o,i,s;if(!`${t}`.includes("_"))return t;let r=(o=e.frequenciesEveryPeriod)==null?void 0:o.indexOf(t);return r>=0&&e.frequenciesEveryPeriod[r]?e.frequencies[r]:((i=e.frequencies)==null?void 0:i.length)>0&&((s=e.frequenciesEveryPeriod)==null?void 0:s.length)>0?(console.warn(`Unable to find selling plan match for frequency ${t}; falling back to first selling plan`),e.frequencies[0]):t},"frequencyToSellingPlan");function ri(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=lo();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===Te?tr:rr}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(ri,"autoInitializeOffers");var oi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function ni(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(ni,"getCookieValue");var We=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),fe=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),lr=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 ii(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(ii,"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"),si=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 ai=n(t=>({type:Un,payload:{product:t}}),"concludeUpsell"),ci=n(t=>({type:Ue,payload:t}),"setMerchantId"),fo=n(t=>({type:Le,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),kc=n(t=>({type:qn,payload:t}),"requestAuth"),Pt=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:$n,payload:t}),"fetchDone"),li=n((t=kn)=>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=kc(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(Pt(i,c,p,l)),c=>r(he(c))).finally(()=>r(dr(a)))},"fetchAuthThunk"),"fetchAuth"),qc=n((t,e)=>({type:Dn,payload:{status:t,ordering:e}}),"requestOrders"),ho=n(t=>({type:Bt,payload:t}),"receiveOrders"),mo=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=qc(t,e);return o(c),de.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(ho(p));let l=(p.results[0]||{}).public_id;if(l)return de.fetchItems(s,a,l).then(f=>o(mo(f)))}return o(he(p.detail)),null},p=>o(he(p))).finally(()=>o(dr(c)))},"fetchOrdersThunk"),"fetchOrders"),go=n(t=>{switch(t){case er:return{type:$e,payload:t};case Oe:return{type:Me,payload:t};case Te:return{type:Ve,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),ui=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(fo(r)),o},"requestSessionId"),Ce=n((t,e)=>({type:T,payload:{...t,offer:e}}),"receiveOffer"),uo=n(t=>({type:Fn,payload:t}),"fetchResponseError"),Dc=n((t,e=ve,r)=>({type:J,payload:{product:t,module:e,offer:r}}),"requestOffer"),di=n((t,e=ve,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:p}}=s(),l=Dc(t,e,r);i(l);let f=x(t);return f?de.fetchOffer(p,a,c,f,e).then(d=>i(Ce(d,r)),d=>i(uo(d))).finally(()=>i(dr(l))):null},"fetchOfferThunk"),"fetchOffer"),fi=n(()=>({type:je}),"checkout"),Fc=n((t,e,r,o)=>({type:Ln,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Uc=n(t=>({type:Yt,payload:t}),"receiveCreateOneTime"),Lc=n((t,e)=>({type:Mn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Mc=n((t,e)=>({type:Wt,payload:{response:t,product:e}}),"receiveConvertOneTime"),hi=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:f},previewUpsellOffer:d,offerId:m}=c();if(!p)return a(he("No auth set."));let b=ti(i,l),S=Fc(t,e,r,m);return a(S),(d?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:m}):de.createOneTime(f,p,t.id,e,r,m)).then(h=>(a(Uc(h)),o?(a(Lc(h,b)),(d?Promise.resolve({item:h,frequency:b}):de.convertOneTimeToSubscription(f,p,h,b,m)).then(E=>a(Mc(E,t)),E=>a(uo(E)))):h),h=>a(uo(h))).finally(()=>a(dr(S)))},"createIuThunk"),"createIu"),mi=n(t=>({type:Jt,payload:t}),"setLocale"),gi=n(t=>({type:He,payload:t}),"setConfig"),yi=n((t,e,r)=>({type:Kt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),bi=n(t=>({type:Qt,payload:t}),"setTemplates"),_i=n((t,e)=>({type:Zt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Si=n((t,e)=>({type:Xt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),Ei=n(t=>({type:Ge,payload:t}),"receiveMerchantSettings");var wt="OG_STATE",Oi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),yo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Ti=n(()=>yo()?{}:Oi(localStorage.getItem(wt)),"loadState"),$c=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"),Pi=n(t=>{if(yo())return;let e=$c(t);e&&localStorage.getItem(wt)!==e&&localStorage.setItem(wt,e)},"saveState"),wi=n(t=>(0,vi.throttle)(500,e=>{if(yo())return;let{key:r,newValue:o}=e;r===wt&&o===null?(t.dispatch({type:le}),setTimeout(()=>t.dispatch(ui()),0)):r===wt&&t.dispatch({type:xe,newValue:Oi(o)})}),"listenLocalStorageChanges");var Ri=ce(Vt());var Vc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ci=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Vc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),jc=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Ci(!0)},{expressions:[({type:t}={})=>t===I],fn:Ci(!1)}],Ai=n(t=>e=>r=>{let o=t.getState();jc.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Ni=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"),Ii=n(t=>e=>r=>{e(r);let o=(0,Ri.throttle)(500,()=>{Pi({...t.getState()})});r.type!==xe&&o()},"localStorageMiddleware");var bo=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function ki(t){let[e,r]=bo(),[o,i]=bo(),[s,a]=bo();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(fo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;window.addEventListener("storage",wi(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(li())}),p=>async l=>{$e===l.type||Me===l.type||Ve===l.type?r(l.payload):Ue===l.type?i(l.payload):Le===l.type?a(l.payload):await c,p(l)}}n(ki,"waitUntilOffersReady");function qi(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=[ki,Rn,Ai,Ni],s={};if(!r)try{s=Ti(),i.push(Ii)}catch{}let a=o(Pn(...i,...e.filter(p=>p))),c=Xr(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(qi,"makeStore");var Hc=Object.defineProperty,hr=n((t,e)=>Hc(t,"name",{value:e,configurable:!0}),"i"),Gc=hr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Fi=["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],Di=hr(t=>(e,r)=>{Fi.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function _o(t=window.opener,e=window.og){let r=hr(o=>{let i=Gc(Fi),s=Di(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:p})=>{p({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Di(t)("READY"))}n(_o,"h");hr(_o,"offersLiveEditor");var mr=null,Bc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ui=n(t=>{if(!mr)throw new Error("Missing redux store.");return mr},"resolveStore"),zc=n((t,e)=>r=>{let{getState:o,dispatch:i}=Ui(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=Bc)=>r=>{let i=zc(t,typeof e=="function"?e:s=>Tn(e,s));return class extends r{get store(){return mr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ui(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"),Li=n(t=>{mr=t},"setStore");var So=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 Eo=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)}}}`,xo=`<!--${$}-->`,Mi=new RegExp(`${$}|${xo}`),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,p=0,{strings:l,values:{length:f}}=e;for(;p<f;){let d=s.nextNode();if(d===null){s.currentNode=i.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let m=d.attributes,{length:b}=m,S=0;for(let h=0;h<b;h++)$i(m[h].name,Ze)&&S++;for(;S-- >0;){let h=l[p],E=gr.exec(h)[2],P=E.toLowerCase()+Ze,_=d.getAttribute(P);d.removeAttribute(P);let w=_.split(Mi);this.parts.push({type:"attribute",index:c,name:E,strings:w}),p+=w.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let m=d.data;if(m.indexOf($)>=0){let b=d.parentNode,S=m.split(Mi),h=S.length-1;for(let E=0;E<h;E++){let P,_=S[E];if(_==="")P=re();else{let w=gr.exec(_);w!==null&&$i(w[2],Ze)&&(_=_.slice(0,w.index)+w[1]+w[2].slice(0,-Ze.length)+w[3]),P=document.createTextNode(_)}b.insertBefore(P,d),this.parts.push({type:"node",index:++c})}S[h]===""?(b.insertBefore(re(),d),o.push(d)):d.data=S[h],p+=h}}else if(d.nodeType===8)if(d.data===$){let m=d.parentNode;(d.previousSibling===null||c===a)&&(c++,m.insertBefore(re(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),p++}else{let m=-1;for(;(m=d.data.indexOf($,m+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let d of o)d.parentNode.removeChild(d)}};n(ge,"Template");var $i=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 vo=133;function Oo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,vo,null,!1),s=Rt(o),a=o[s],c=-1,p=0,l=[],f=null;for(;i.nextNode();){c++;let d=i.currentNode;for(d.previousSibling===f&&(f=null),e.has(d)&&(l.push(d),f===null&&(f=d)),f!==null&&p++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-p,s=Rt(o,s),a=o[s]}l.forEach(d=>d.parentNode.removeChild(d))}n(Oo,"removeNodesFromTemplate");var Wc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,vo,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 Vi(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,vo,null,!1),a=Rt(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=Wc(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Rt(i,a);return}a=Rt(i,a)}}n(Vi,"insertNodeIntoTemplate");var Jc=new WeakMap;var Ae=n(t=>typeof t=="function"&&Jc.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=Eo?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,p=i.nextNode();for(;s<o.length;){if(c=o[s],!Ct(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,p.nodeName==="TEMPLATE"&&(r.push(p),i.currentNode=p.content),(p=i.nextNode())===null&&(i.currentNode=r.pop(),p=i.nextNode());if(c.type==="node"){let l=this.processor.handleTextExpression(this.options);l.insertAfterNode(p.previousSibling),this.__parts.push(l)}else this.__parts.push(...this.processor.handleAttributeExpressions(p,c.name,c.strings,this.options));s++}return Eo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(se,"TemplateInstance");var ji=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Qc=` ${$} `,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?Qc:xo):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 ji!==void 0&&(r=ji.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 p of c)i+=typeof p=="string"?p:String(p)}}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 Hi=!1;(()=>{try{let t={get capture(){return Hi=!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=Zc(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 Zc=n(t=>t&&(Hi?{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,Po=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 wo=new Nt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var u=n((t,...e)=>new oe(t,e,"html",wo),"html");var Bi=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 ep=n(t=>e=>{let r=Bi(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"),tp=["html","svg"],rp=n(t=>{tp.forEach(e=>{let r=Ie.get(Bi(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)}),Oo(o,s)})})},"removeStylesFromLitTemplates"),zi=new Set,op=n((t,e,r)=>{zi.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 l=0;l<s;l++){let f=i[l];f.parentNode.removeChild(f),a.textContent+=f.textContent}rp(t);let c=o.content;r?Vi(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let p=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&p!==null)e.insertBefore(p.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let l=new Set;l.add(a),Oo(r,l)}},"prepareTemplateStyles"),Yi=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&&!zi.has(o),c=a?document.createDocumentFragment():e;if(Po(t,c,Object.assign({templateFactory:ep(o)},r)),a){let p=ye.get(c);ye.delete(c);let l=p.value instanceof se?p.value.template:void 0;op(o,c,l),Re(e,e.firstChild),e.appendChild(c),ye.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Wi;window.JSCompiler_renameProperty=(t,e)=>t;var ko={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}},Ji=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Co={attribute:!0,type:String,converter:ko,reflect:!1,hasChanged:Ji},Ro=1,Ao=1<<2,No=1<<3,Io=1<<4,qo="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=Co){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)||Co}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(qo)||e.finalize(),this[qo]=!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=Ji){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||ko,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||ko.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=Co){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|No,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~No}}_attributeToProperty(e,r){if(this._updateState&No)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Io,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Io}}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&Io)&&(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|Ao;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Ao}get hasUpdated(){return this._updateState&Ro}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&Ro||(this._updateState=this._updateState|Ro,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Ao}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");Wi=qo;ot[Wi]=!0;var Ki=Element.prototype,Zd=Ki.msMatchesSelector||Ki.webkitMatchesSelector;var Er=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Do=Symbol(),nt=class{constructor(e,r){if(r!==Do)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 Qi=n(t=>new nt(String(t),Do),"unsafeCSS"),np=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+np(i)+t[s+1],t[0]);return new nt(r,Do)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Zi={},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,p)=>Array.isArray(p)?r(p,c):(c.add(p),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 Qi(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!==Zi&&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 Zi}};n(v,"LitElement");v.finalized=!0;v.render=Yi;var gs=ce(ps());var up=n(t=>{let e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t},"sanitizeFrequencyString"),ls=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=ls(t);if(!e){let r=t.offer;r&&(e=ls(r))}return e},"resolveProduct"),dp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Fo=n(t=>class extends t{get offer(){return dp(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),N=n(t=>class extends Fo(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=up(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Or={};En(Or,{autoshipByDefault:()=>fp,eligibilityGroups:()=>Lo,eligible:()=>us,hasPrepaidOptions:()=>bp,hasUpcomingOrder:()=>hs,hasUpsellGroup:()=>fs,inStock:()=>Uo,optedout:()=>gp,prepaidEligible:()=>hp,prepaidSubscribed:()=>yp,regularEligible:()=>Sp,subscribed:()=>mp,subscriptionEligible:()=>ds,upcomingOrderContainsProduct:()=>_p,upsellEligible:()=>ms});var Uo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),us=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),fp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ds=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&us(t,e)&&Uo(t,e),"subscriptionEligible"),Lo=n((t,e)=>{let r=x((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),fs=n((t,e)=>{let r=Lo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),hp=n((t,e)=>{let r=Lo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),mp=n((t,e)=>ar(e.product)(t),"subscribed"),gp=n((t,e)=>cr(e.product)(t),"optedout"),yp=n((t,e)=>ei(e.product)(t),"prepaidSubscribed"),bp=n((t,e)=>L(e.product.id)(t).length>0,"hasPrepaidOptions"),hs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),_p=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ms=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&Uo(t,e)&&hs(t)&&fs(t,e)},"upsellEligible"),Sp=n((t,e)=>ds(t,e)&&!ms(t,e),"regularEligible");var Ep=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Tr=class extends N(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return u``;let e=Ep(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),gs.default.parse(e,o=>Or[o]&&Or[o](this.state,this))?u`
11
+ var lib=(()=>{var ya=Object.create;var ut=Object.defineProperty;var ba=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Sa=Object.getPrototypeOf,Ea=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),En=(t,e)=>{for(var r in e)ut(t,r,{get:e[r],enumerable:!0})},xn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _a(e))!Ea.call(t,i)&&i!==r&&ut(t,i,{get:()=>e[i],enumerable:!(o=ba(e,i))||o.enumerable});return t};var ce=(t,e,r)=>(r=t!=null?ya(Sa(t)):{},xn(e||!t||!t.__esModule?ut(r,"default",{value:t,enumerable:!0}):r,t)),xa=t=>xn(ut({},"__esModule",{value:!0}),t);var Vt=Se(($t,An)=>{(function(t,e){typeof $t=="object"&&typeof An<"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,p=!1,l=0;function f(){c&&clearTimeout(c)}n(f,"clearExistingTimeout");function d(){f(),p=!0}n(d,"cancel"),typeof i!="boolean"&&(a=s,s=i,i=void 0);function m(){for(var b=arguments.length,S=new Array(b),h=0;h<b;h++)S[h]=arguments[h];var E=this,T=Date.now()-l;if(p)return;function _(){l=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(m,"wrapper"),m.cancel=d,m}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((Eu,Jn)=>{var ka="Expected a function",Hn="__lodash_hash_undefined__",qa="[object Function]",Da="[object GeneratorFunction]",Fa=/[\\^$.*+?()[\]{}|]/g,Ua=/^\[object .+?Constructor\]$/,La=typeof window=="object"&&window&&window.Object===Object&&window,Ma=typeof self=="object"&&self&&self.Object===Object&&self,Gn=La||Ma||Function("return this")();function $a(t,e){return t?.[e]}n($a,"getValue");function Va(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Va,"isHostObject");var ja=Array.prototype,Ha=Function.prototype,Bn=Object.prototype,ro=Gn["__core-js_shared__"],jn=function(){var t=/[^.]+$/.exec(ro&&ro.keys&&ro.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),zn=Ha.toString,oo=Bn.hasOwnProperty,Ga=Bn.toString,Ba=RegExp("^"+zn.call(oo).replace(Fa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),za=ja.splice,Ya=Yn(Gn,"Map"),yt=Yn(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 Wa(){this.__data__=yt?yt(null):{}}n(Wa,"hashClear");function Ja(t){return this.has(t)&&delete this.__data__[t]}n(Ja,"hashDelete");function Ka(t){var e=this.__data__;if(yt){var r=e[t];return r===Hn?void 0:r}return oo.call(e,t)?e[t]:void 0}n(Ka,"hashGet");function Qa(t){var e=this.__data__;return yt?e[t]!==void 0:oo.call(e,t)}n(Qa,"hashHas");function Za(t,e){var r=this.__data__;return r[t]=yt&&e===void 0?Hn:e,this}n(Za,"hashSet");Te.prototype.clear=Wa;Te.prototype.delete=Ja;Te.prototype.get=Ka;Te.prototype.has=Qa;Te.prototype.set=Za;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 Xa(){this.__data__=[]}n(Xa,"listCacheClear");function ec(t){var e=this.__data__,r=or(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():za.call(e,r,1),!0}n(ec,"listCacheDelete");function tc(t){var e=this.__data__,r=or(e,t);return r<0?void 0:e[r][1]}n(tc,"listCacheGet");function rc(t){return or(this.__data__,t)>-1}n(rc,"listCacheHas");function oc(t,e){var r=this.__data__,o=or(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(oc,"listCacheSet");Be.prototype.clear=Xa;Be.prototype.delete=ec;Be.prototype.get=tc;Be.prototype.has=rc;Be.prototype.set=oc;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 nc(){this.__data__={hash:new Te,map:new(Ya||Be),string:new Te}}n(nc,"mapCacheClear");function ic(t){return nr(this,t).delete(t)}n(ic,"mapCacheDelete");function sc(t){return nr(this,t).get(t)}n(sc,"mapCacheGet");function ac(t){return nr(this,t).has(t)}n(ac,"mapCacheHas");function cc(t,e){return nr(this,t).set(t,e),this}n(cc,"mapCacheSet");we.prototype.clear=nc;we.prototype.delete=ic;we.prototype.get=sc;we.prototype.has=ac;we.prototype.set=cc;function or(t,e){for(var r=t.length;r--;)if(fc(t[r][0],e))return r;return-1}n(or,"assocIndexOf");function pc(t){if(!Wn(t)||uc(t))return!1;var e=hc(t)||Va(t)?Ba:Ua;return e.test(dc(t))}n(pc,"baseIsNative");function nr(t,e){var r=t.__data__;return lc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(nr,"getMapData");function Yn(t,e){var r=$a(t,e);return pc(r)?r:void 0}n(Yn,"getNative");function lc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(lc,"isKeyable");function uc(t){return!!jn&&jn in t}n(uc,"isMasked");function dc(t){if(t!=null){try{return zn.call(t)}catch{}try{return t+""}catch{}}return""}n(dc,"toSource");function no(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(ka);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 fc(t,e){return t===e||t!==t&&e!==e}n(fc,"eq");function hc(t){var e=Wn(t)?Ga.call(t):"";return e==qa||e==Da}n(hc,"isFunction");function Wn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Wn,"isObject");Jn.exports=no});var xr=Se((df,Xi)=>{var sp={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"};Xi.exports=sp});var ts=Se((ff,es)=>{var ke=xr(),ap=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");es.exports=ap});var os=Se((hf,rs)=>{var be=xr(),cp=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"),pp=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");rs.exports={PolishNotation:cp,PolishGenerator:pp}});var is=Se((mf,ns)=>{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");ns.exports={make:it,nodeEvaluator:st}});var ps=Se((gf,cs)=>{var lp=ts(),ss=os(),as=is(),up=n((t,e)=>{let r=lp(t),o=ss.PolishNotation(r),i=ss.PolishGenerator(o),s=as.make(i);return as.nodeEvaluator(s,e)},"parse");cs.exports={parse:up}});var du={};En(du,{addOptinChangedCallback:()=>Gl,addTemplate:()=>Bl,autoInit:()=>lu,clear:()=>zl,config:()=>Yl,default:()=>uu,disableOptinChangedCallbacks:()=>Wl,getOptins:()=>Jl,getProductsForPurchasePost:()=>Kl,initialize:()=>Ql,isReady:()=>Hl,offers:()=>O,platform:()=>q,previewMode:()=>Zl,register:()=>Xl,resolveSettings:()=>eu,setAuthUrl:()=>tu,setEnvironment:()=>ru,setLocale:()=>ou,setMerchantId:()=>nu,setPublicPath:()=>iu,setTemplates:()=>su,setupCart:()=>au,setupProduct:()=>cu,setupProducts:()=>pu,store:()=>ma});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 va=Kr(Fe),Qr=va;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 Oa(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(Oa,"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,p=!1;function l(){c===a&&(c=a.slice())}n(l,"ensureCanMutateNextListeners");function f(){if(p)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 d(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(p)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 l(),c.push(h),n(function(){if(!!E){if(p)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,l();var _=c.indexOf(h);c.splice(_,1),a=null}},"unsubscribe")}n(d,"subscribe");function m(h){if(!Oa(h))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof h.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,h)}finally{p=!1}for(var E=a=c,T=0;T<E.length;T++){var _=E[T];_()}return h}n(m,"dispatch");function b(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");i=h,m({type:dt.REPLACE})}n(b,"replaceReducer");function S(){var h,E=d;return h={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")},h[Qr]=function(){return this},h}return n(S,"observable"),m({type:dt.INIT}),o={dispatch:m,subscribe:d,getState:f,replaceReducer:b},o[Qr]=S,o}n(Xr,"createStore");function Pa(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(Pa,"getUndefinedStateErrorMessage");function Ta(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(Ta,"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{Ta(r)}catch(p){c=p}return n(function(l,f){if(l===void 0&&(l={}),c)throw c;if(!1)var d;for(var m=!1,b={},S=0;S<s.length;S++){var h=s[S],E=r[h],T=l[h],_=E(T,f);if(typeof _>"u"){var w=Pa(h,f);throw new Error(w)}b[h]=_,m=m||_!==T}return m=m||s.length!==Object.keys(l).length,m?b:l},"combination")}n(Mt,"combineReducers");function vn(t,e){return function(){return e(t.apply(this,arguments))}}n(vn,"bindActionCreator");function Pn(t,e){if(typeof t=="function")return vn(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var i=t[o];typeof i=="function"&&(r[o]=vn(i,e))}return r}n(Pn,"bindActionCreators");function wa(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(wa,"_defineProperty");function On(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(On,"ownKeys");function Ca(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?On(r,!0).forEach(function(o){wa(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):On(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Ca,"_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 Tn(){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(p){return p(a)});return s=eo.apply(void 0,c)(i.dispatch),Ca({},i,{dispatch:s})}}}n(Tn,"applyMiddleware");function wn(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(wn,"createThunkMiddleware");var Cn=wn();Cn.withExtraArgument=wn;var Rn=Cn;var vi=ce(Vt());var Nn=/^og_auth=/,Ra=n((t=Nn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Nn,""),"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"),Aa=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"),Na=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function In(){return typeof window.og_auth<"u"?jt(window.og_auth):null}n(In,"a");async function Ia(t=100){return new Promise(e=>{setTimeout(()=>e(In()),t)})}n(Ia,"f");async function kn(t,e=Ra,r=Aa){let o;if(o=jt(In())||jt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Na(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ia());if(o=jt(o),o)return o;throw new Error("Unauthorized")}n(kn,"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",qn="REQUEST_AUTH",Gt="AUTHORIZE",Ee="UNAUTHORIZED",Dn="REQUEST_ORDERS",Bt="RECEIVE_ORDERS",ht="CART_PRODUCT_KEY_HAS_CHANGED",zt="RECEIVE_ORDER_ITEMS",Fn="FETCH_RESPONSE_ERROR",Me="SET_ENVIRONMENT_STAGING",$e="SET_ENVIRONMENT_DEV",Ve="SET_ENVIRONMENT_PROD",Un="CONCLUDE_UPSELL",Ln="REQUEST_CREATE_IU_ORDER",Yt="CREATE_ONE_TIME",Mn="REQUEST_CONVERT_ONE_TIME",Wt="CONVERT_ONE_TIME";var je="CHECKOUT",$n="RECEIVE_FETCH",Jt="SET_LOCALE",He="SET_CONFIG",pe="SET_PREVIEW_STANDARD_OFFER",mt="SET_PREVIEW_UPSELL_OFFER",to="SET_PREVIEW_PREPAID_OFFER",Kt="ADD_TEMPLATE",Qt="SET_TEMPLATES",xe="LOCAL_STORAGE_CHANGE",le="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",Vn="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"),Kn=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"),Qn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),mc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),gc=(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=Qn([["session_id",e],["page_type",1],["p",mc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),io),yc=(0,ir.default)(_t(St(sr((t=1,e="place")=>[`/orders/?${Qn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),io),bc=(0,ir.default)(_t(St(sr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),io),_c=_t(St(sr(Kn((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"),Sc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Zn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(so).sort(Sc),"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"),Ec=_t(St(sr(Kn((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:gc,fetchOrders:yc,fetchItems:bc,createOneTime:_c,convertOneTimeToSubscription:Ec};var ao=vt(),q={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(ao==null?void 0:ao.dataset.shopifySellingPlans)!="undefined"};function xc(t,e){return t===e}n(xc,"defaultEqualityCheck");function vc(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(vc,"areArgumentsShallowlyEqual");function Oc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:xc,r=null,o=null;return function(){return vc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Oc,"defaultMemoize");function Pc(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(Pc,"getDependencies");function Tc(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,p=s.pop(),l=Pc(s),f=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),d=t(function(){for(var m=[],b=l.length,S=0;S<b;S++)m.push(l[S].apply(null,arguments));return f.apply(null,m)});return d.resultFunc=p,d.dependencies=l,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(Tc,"createSelectorCreator");var Q=Tc(Oc);var z=ce(bt());z.default.Cache=Map;function wc(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(wc,"arraysEqual");function Cc(t,e,r){let o=xt(r);return q.shopify_selling_plans?te(t,e,o):o}n(Cc,"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))||wc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Ot=n(t=>t.optedin||[],"optedinSelector"),Xn=n(t=>t.optedout||[],"optedoutSelector"),co=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Rc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Ac=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Nc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Ic=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),kc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),Z=(0,z.default)(t=>Q(Ot,Xn,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)),ei=(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(kc,e=>e[t.id]||null),t=>JSON.stringify(t)),cr=(0,z.default)(t=>Q(Xn,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(Ic,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(Rc,Ac,Nc,(e,r,o)=>e[x(t)]&&Cc(r,o,e[x(t)])||null)),po=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(po(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ye=n(t=>({templates:t.templates||[]}),"templatesSelector");function pr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(pr,"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 lo(){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(lo,"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"),ti=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 ri(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=lo();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(ri,"autoInitializeOffers");var oi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function ni(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(ni,"getCookieValue");var We=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),fe=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),lr=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 ii(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(ii,"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"),si=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 ai=n(t=>({type:Un,payload:{product:t}}),"concludeUpsell"),ci=n(t=>({type:Ue,payload:t}),"setMerchantId"),fo=n(t=>({type:Le,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),qc=n(t=>({type:qn,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:$n,payload:t}),"fetchDone"),li=n((t=kn)=>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=qc(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(Tt(i,c,p,l)),c=>r(he(c))).finally(()=>r(dr(a)))},"fetchAuthThunk"),"fetchAuth"),Dc=n((t,e)=>({type:Dn,payload:{status:t,ordering:e}}),"requestOrders"),ho=n(t=>({type:Bt,payload:t}),"receiveOrders"),mo=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=Dc(t,e);return o(c),de.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(ho(p));let l=(p.results[0]||{}).public_id;if(l)return de.fetchItems(s,a,l).then(f=>o(mo(f)))}return o(he(p.detail)),null},p=>o(he(p))).finally(()=>o(dr(c)))},"fetchOrdersThunk"),"fetchOrders"),go=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"),ui=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(fo(r)),o},"requestSessionId"),Ce=n((t,e)=>({type:P,payload:{...t,offer:e}}),"receiveOffer"),uo=n(t=>({type:Fn,payload:t}),"fetchResponseError"),Fc=n((t,e=ve,r)=>({type:J,payload:{product:t,module:e,offer:r}}),"requestOffer"),di=n((t,e=ve,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:p}}=s(),l=Fc(t,e,r);i(l);let f=x(t);return f?de.fetchOffer(p,a,c,f,e).then(d=>i(Ce(d,r)),d=>i(uo(d))).finally(()=>i(dr(l))):null},"fetchOfferThunk"),"fetchOffer"),fi=n(()=>({type:je}),"checkout"),Uc=n((t,e,r,o)=>({type:Ln,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Lc=n(t=>({type:Yt,payload:t}),"receiveCreateOneTime"),Mc=n((t,e)=>({type:Mn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),$c=n((t,e)=>({type:Wt,payload:{response:t,product:e}}),"receiveConvertOneTime"),hi=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:f},previewUpsellOffer:d,offerId:m}=c();if(!p)return a(he("No auth set."));let b=ti(i,l),S=Uc(t,e,r,m);return a(S),(d?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:m}):de.createOneTime(f,p,t.id,e,r,m)).then(h=>(a(Lc(h)),o?(a(Mc(h,b)),(d?Promise.resolve({item:h,frequency:b}):de.convertOneTimeToSubscription(f,p,h,b,m)).then(E=>a($c(E,t)),E=>a(uo(E)))):h),h=>a(uo(h))).finally(()=>a(dr(S)))},"createIuThunk"),"createIu"),mi=n(t=>({type:Jt,payload:t}),"setLocale"),gi=n(t=>({type:He,payload:t}),"setConfig"),yi=n((t,e,r)=>({type:Kt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),bi=n(t=>({type:Qt,payload:t}),"setTemplates"),_i=n((t,e)=>({type:Zt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Si=n((t,e)=>({type:Xt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe"),Ei=n(t=>({type:Ge,payload:t}),"receiveMerchantSettings");var wt="OG_STATE",Oi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),yo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Pi=n(()=>yo()?{}:Oi(localStorage.getItem(wt)),"loadState"),Vc=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"),Ti=n(t=>{if(yo())return;let e=Vc(t);e&&localStorage.getItem(wt)!==e&&localStorage.setItem(wt,e)},"saveState"),wi=n(t=>(0,vi.throttle)(500,e=>{if(yo())return;let{key:r,newValue:o}=e;r===wt&&o===null?(t.dispatch({type:le}),setTimeout(()=>t.dispatch(ui()),0)):r===wt&&t.dispatch({type:xe,newValue:Oi(o)})}),"listenLocalStorageChanges");var Ri=ce(Vt());var jc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ci=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>jc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Hc=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===k],fn:Ci(!0)},{expressions:[({type:t}={})=>t===I],fn:Ci(!1)}],Ai=n(t=>e=>r=>{let o=t.getState();Hc.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Ni=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"),Ii=n(t=>e=>r=>{e(r);let o=(0,Ri.throttle)(500,()=>{Ti({...t.getState()})});r.type!==xe&&o()},"localStorageMiddleware");var bo=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function ki(t){let[e,r]=bo(),[o,i]=bo(),[s,a]=bo();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(fo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;window.addEventListener("storage",wi(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(li())}),p=>async l=>{$e===l.type||Me===l.type||Ve===l.type?r(l.payload):Ue===l.type?i(l.payload):Le===l.type?a(l.payload):await c,p(l)}}n(ki,"waitUntilOffersReady");function qi(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=[ki,Rn,Ai,Ni],s={};if(!r)try{s=Pi(),i.push(Ii)}catch{}let a=o(Tn(...i,...e.filter(p=>p))),c=Xr(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(qi,"makeStore");var Gc=Object.defineProperty,hr=n((t,e)=>Gc(t,"name",{value:e,configurable:!0}),"i"),Bc=hr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Fi=["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],Di=hr(t=>(e,r)=>{Fi.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function _o(t=window.opener,e=window.og){let r=hr(o=>{let i=Bc(Fi),s=Di(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:p})=>{p({isMessageAllowed:i,broadcastMessage:s,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Di(t)("READY"))}n(_o,"h");hr(_o,"offersLiveEditor");var mr=null,zc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ui=n(t=>{if(!mr)throw new Error("Missing redux store.");return mr},"resolveStore"),Yc=n((t,e)=>r=>{let{getState:o,dispatch:i}=Ui(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=zc)=>r=>{let i=Yc(t,typeof e=="function"?e:s=>Pn(e,s));return class extends r{get store(){return mr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ui(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"),Li=n(t=>{mr=t},"setStore");var So=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 Eo=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)}}}`,xo=`<!--${$}-->`,Mi=new RegExp(`${$}|${xo}`),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,p=0,{strings:l,values:{length:f}}=e;for(;p<f;){let d=s.nextNode();if(d===null){s.currentNode=i.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let m=d.attributes,{length:b}=m,S=0;for(let h=0;h<b;h++)$i(m[h].name,Ze)&&S++;for(;S-- >0;){let h=l[p],E=gr.exec(h)[2],T=E.toLowerCase()+Ze,_=d.getAttribute(T);d.removeAttribute(T);let w=_.split(Mi);this.parts.push({type:"attribute",index:c,name:E,strings:w}),p+=w.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let m=d.data;if(m.indexOf($)>=0){let b=d.parentNode,S=m.split(Mi),h=S.length-1;for(let E=0;E<h;E++){let T,_=S[E];if(_==="")T=re();else{let w=gr.exec(_);w!==null&&$i(w[2],Ze)&&(_=_.slice(0,w.index)+w[1]+w[2].slice(0,-Ze.length)+w[3]),T=document.createTextNode(_)}b.insertBefore(T,d),this.parts.push({type:"node",index:++c})}S[h]===""?(b.insertBefore(re(),d),o.push(d)):d.data=S[h],p+=h}}else if(d.nodeType===8)if(d.data===$){let m=d.parentNode;(d.previousSibling===null||c===a)&&(c++,m.insertBefore(re(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),p++}else{let m=-1;for(;(m=d.data.indexOf($,m+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let d of o)d.parentNode.removeChild(d)}};n(ge,"Template");var $i=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 vo=133;function Oo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,vo,null,!1),s=Rt(o),a=o[s],c=-1,p=0,l=[],f=null;for(;i.nextNode();){c++;let d=i.currentNode;for(d.previousSibling===f&&(f=null),e.has(d)&&(l.push(d),f===null&&(f=d)),f!==null&&p++;a!==void 0&&a.index===c;)a.index=f!==null?-1:a.index-p,s=Rt(o,s),a=o[s]}l.forEach(d=>d.parentNode.removeChild(d))}n(Oo,"removeNodesFromTemplate");var Jc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,vo,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 Vi(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,vo,null,!1),a=Rt(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=Jc(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Rt(i,a);return}a=Rt(i,a)}}n(Vi,"insertNodeIntoTemplate");var Kc=new WeakMap;var Ae=n(t=>typeof t=="function"&&Kc.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=Eo?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,p=i.nextNode();for(;s<o.length;){if(c=o[s],!Ct(c)){this.__parts.push(void 0),s++;continue}for(;a<c.index;)a++,p.nodeName==="TEMPLATE"&&(r.push(p),i.currentNode=p.content),(p=i.nextNode())===null&&(i.currentNode=r.pop(),p=i.nextNode());if(c.type==="node"){let l=this.processor.handleTextExpression(this.options);l.insertAfterNode(p.previousSibling),this.__parts.push(l)}else this.__parts.push(...this.processor.handleAttributeExpressions(p,c.name,c.strings,this.options));s++}return Eo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(se,"TemplateInstance");var ji=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Zc=` ${$} `,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?Zc:xo):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 ji!==void 0&&(r=ji.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 p of c)i+=typeof p=="string"?p:String(p)}}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 Hi=!1;(()=>{try{let t={get capture(){return Hi=!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=Xc(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 Xc=n(t=>t&&(Hi?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Po(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(Po,"templateFactory");var Ie=new Map;var ye=new WeakMap,To=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:Po},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 wo=new Nt;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var u=n((t,...e)=>new oe(t,e,"html",wo),"html");var Bi=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 tp=n(t=>e=>{let r=Bi(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"),rp=["html","svg"],op=n(t=>{rp.forEach(e=>{let r=Ie.get(Bi(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)}),Oo(o,s)})})},"removeStylesFromLitTemplates"),zi=new Set,np=n((t,e,r)=>{zi.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 l=0;l<s;l++){let f=i[l];f.parentNode.removeChild(f),a.textContent+=f.textContent}op(t);let c=o.content;r?Vi(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let p=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&p!==null)e.insertBefore(p.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let l=new Set;l.add(a),Oo(r,l)}},"prepareTemplateStyles"),Yi=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&&!zi.has(o),c=a?document.createDocumentFragment():e;if(To(t,c,Object.assign({templateFactory:tp(o)},r)),a){let p=ye.get(c);ye.delete(c);let l=p.value instanceof se?p.value.template:void 0;np(o,c,l),Re(e,e.firstChild),e.appendChild(c),ye.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Wi;window.JSCompiler_renameProperty=(t,e)=>t;var ko={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}},Ji=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Co={attribute:!0,type:String,converter:ko,reflect:!1,hasChanged:Ji},Ro=1,Ao=1<<2,No=1<<3,Io=1<<4,qo="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=Co){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)||Co}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(qo)||e.finalize(),this[qo]=!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=Ji){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||ko,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||ko.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=Co){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|No,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~No}}_attributeToProperty(e,r){if(this._updateState&No)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Io,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Io}}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&Io)&&(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|Ao;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Ao}get hasUpdated(){return this._updateState&Ro}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&Ro||(this._updateState=this._updateState|Ro,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Ao}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");Wi=qo;ot[Wi]=!0;var Ki=Element.prototype,ef=Ki.msMatchesSelector||Ki.webkitMatchesSelector;var Er=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Do=Symbol(),nt=class{constructor(e,r){if(r!==Do)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 Qi=n(t=>new nt(String(t),Do),"unsafeCSS"),ip=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+ip(i)+t[s+1],t[0]);return new nt(r,Do)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Zi={},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,p)=>Array.isArray(p)?r(p,c):(c.add(p),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 Qi(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!==Zi&&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 Zi}};n(v,"LitElement");v.finalized=!0;v.render=Yi;var gs=ce(ps());var dp=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"),ls=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=ls(t);if(!e){let r=t.offer;r&&(e=ls(r))}return e},"resolveProduct"),fp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Fo=n(t=>class extends t{get offer(){return fp(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 Fo(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=dp(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var Or={};En(Or,{autoshipByDefault:()=>hp,eligibilityGroups:()=>Lo,eligible:()=>us,hasPrepaidOptions:()=>_p,hasUpcomingOrder:()=>hs,hasUpsellGroup:()=>fs,inStock:()=>Uo,optedout:()=>yp,prepaidEligible:()=>mp,prepaidSubscribed:()=>bp,regularEligible:()=>Ep,subscribed:()=>gp,subscriptionEligible:()=>ds,upcomingOrderContainsProduct:()=>Sp,upsellEligible:()=>ms});var Uo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),us=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),hp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),ds=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&us(t,e)&&Uo(t,e),"subscriptionEligible"),Lo=n((t,e)=>{let r=x((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),fs=n((t,e)=>{let r=Lo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),mp=n((t,e)=>{let r=Lo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),gp=n((t,e)=>ar(e.product)(t),"subscribed"),yp=n((t,e)=>cr(e.product)(t),"optedout"),bp=n((t,e)=>ei(e.product)(t),"prepaidSubscribed"),_p=n((t,e)=>L(e.product.id)(t).length>0,"hasPrepaidOptions"),hs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Sp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ms=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&Uo(t,e)&&hs(t)&&fs(t,e)},"upsellEligible"),Ep=n((t,e)=>ds(t,e)&&!ms(t,e),"regularEligible");var xp=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 u``;let e=xp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),gs.default.parse(e,o=>Or[o]&&Or[o](this.state,this))?u`
13
13
  <slot></slot>
14
- `:u``}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(Tr,"When");var xp=n(t=>({state:t}),"mapStateToProps"),ys=g(xp)(Tr);var bs={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}}},Pr={type:Boolean,attribute:!0,reflect:!0},at={type:Object,attribute:!1};var vp=n(t=>class extends t{getOption(e,r=e){let o=po(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=vp(v);var H=class extends N(j){static get properties(){return{subscribed:Pr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
14
+ `:u``}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 vp=n(t=>({state:t}),"mapStateToProps"),ys=g(vp)(Pr);var bs={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 Op=n(t=>class extends t{getOption(e,r=e){let o=po(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=Op(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`
15
15
  :host {
16
16
  cursor: default;
17
17
  display: inline-block;
@@ -85,7 +85,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
85
85
  <slot name="frequency-mismatch"></slot>
86
86
  `:u`
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"),_s=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=Tt(r,this.store.getState().config),this.sellingPlanFreq=r}this.frequencyMatch=this.frequency===this.optinFrequency}}get optinFrequency(){let e;return this.sellingPlanFreq?e=this.sellingPlanFreq:this.hasAttribute("default-frequency")?e=this.getAttribute("default-frequency"):e=this.offer?this.offer.defaultFrequency:this.defaultFrequency,q.shopify_selling_plans&&this.store&&(e=Tt(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(It(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return u`
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"),_s=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 u`
89
89
  <slot name="default">
90
90
  <button
91
91
  aria-labelledby="ogOfferOptInLabel"
@@ -119,7 +119,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
119
119
  ${e&&e===t?u`
120
120
  <og-text key="defaultFrequencyCopy"></og-text>
121
121
  `:""}
122
- `:t},"frequencyText"),pt=class extends N(j){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Pr,frequency:{type:String},defaultFrequency:_e,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:Zn}}}}static get styles(){return y`
122
+ `:t},"frequencyText"),pt=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:Zn}}}}static get styles(){return y`
123
123
  :host[hidden] {
124
124
  display: none;
125
125
  }
@@ -165,7 +165,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
165
165
  <slot>
166
166
  <og-next-upcoming-order></og-next-upcoming-order>
167
167
  </slot>
168
- `}};n(Rr,"UpsellButton");var Op=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Os=g(Op,{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 u`
168
+ `}};n(Rr,"UpsellButton");var Pp=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Os=g(Pp,{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 u`
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 ga=Object.create;var ut=Object.defineProperty;var ya=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 Tp=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(Tp,{concludeUpsell:ai,createIu:hi})(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(Ar,"UpsellModal");var Tp=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"),Ps=g(Tp,{concludeUpsell:ai,createIu:hi})(Ar);var Nr=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;
@@ -244,13 +244,13 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
244
244
  </slot>
245
245
  </label>
246
246
  </slot>
247
- `}};n(Nr,"OptinToggle");var Ps=g(W,{optoutProduct:Ke,optinProduct:Y})(Nr);var Pp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ir=class extends Fo(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&&Pp(e,this.pluralize)}render(){return u`
247
+ `}};n(Nr,"OptinToggle");var Ts=g(W,{optoutProduct:Ke,optinProduct:Y})(Nr);var wp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ir=class extends Fo(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&&wp(e,this.pluralize)}render(){return u`
248
248
  ${this.getText()}
249
- `}};n(Ir,"Text");var wp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),ws=g(wp)(Ir);var De=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(De,"DiscountAmount");var lt=class extends De{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(lt,"DiscountPercent");var kr=class extends lt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(kr,"ShippingDiscountPercent");var Mo="Discount Percent",$o="Discount Amount",Cs="total_price",Rs="shipping_total",As="sub_total",Vo=n(({field:t,object:e,type:r,value:o})=>{let s=[[new lt(o),{field:Cs,object:"item",type:Mo}],[new De(o),{field:Cs,object:"item",type:$o}],[new kr(o),{field:Rs,object:"order",type:Mo}],[new De(o),{field:Rs,object:"order",type:$o}],[new lt(o),{field:As,object:"order",type:Mo}],[new De(o),{field:As,object:"order",type:$o}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Cp(t){return!(Vo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Cp,"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(Cp.bind({incentiveClass:e,incentiveValue:r}));return u`
249
+ `}};n(Ir,"Text");var Cp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),ws=g(Cp)(Ir);var De=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(De,"DiscountAmount");var lt=class extends De{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(lt,"DiscountPercent");var kr=class extends lt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(kr,"ShippingDiscountPercent");var Mo="Discount Percent",$o="Discount Amount",Cs="total_price",Rs="shipping_total",As="sub_total",Vo=n(({field:t,object:e,type:r,value:o})=>{let s=[[new lt(o),{field:Cs,object:"item",type:Mo}],[new De(o),{field:Cs,object:"item",type:$o}],[new kr(o),{field:Rs,object:"order",type:Mo}],[new De(o),{field:Rs,object:"order",type:$o}],[new lt(o),{field:As,object:"order",type:Mo}],[new De(o),{field:As,object:"order",type:$o}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Rp(t){return!(Vo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Rp,"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(Rp.bind({incentiveClass:e,incentiveValue:r}));return u`
250
250
  ${this.label} ${i?Vo(i):this.renderFallback()}
251
251
  `}renderFallback(){return u`
252
252
  ${Vo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
253
- `}};n(qr,"IncentiveText");var Rp=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"),Ns=g(Rp)(qr);var Dr=class extends vr(pt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
253
+ `}};n(qr,"IncentiveText");var Ap=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"),Ns=g(Ap)(qr);var Dr=class extends vr(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,7 +261,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
261
261
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
262
262
  z-index: 1;
263
263
  }
264
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var i,s,a,c;let{options:e,isSelected:r}=this.childOptions,o;return this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((s=(i=this.config)==null?void 0:i.frequencies)==null?void 0:s.length)&&o&&((c=(a=this.config)==null?void 0:a.frequenciesEveryPeriod)==null?void 0:c.length)?Tt(o,this.config):o}get currentFrequency(){return this.frequency?this.frequency:this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){var o;let e,r=this.defaultFrequency;return(o=this.frequencies)!=null&&o.length?e=this.frequencies.map((i,s)=>{let a;return this.config.frequenciesEveryPeriod&&s in this.config.frequenciesEveryPeriod?a=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?u`
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?u`
265
265
  ${i} ${this.defaultText||""}
266
266
  `:i,value:s})),u`
267
267
  <og-select
@@ -270,9 +270,9 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
270
270
  .selected="${this.currentFrequency}"
271
271
  .onChange="${({target:{value:i}})=>{this.productChangeFrequency(this.product,i,this.offer)}}"
272
272
  ></og-select>
273
- `}};n(Dr,"SelectFrequency");var Is=g(kt,{productChangeFrequency:ur})(Dr);var Ap={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 ks=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Ap[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 u`
273
+ `}};n(Dr,"SelectFrequency");var Is=g(kt,{productChangeFrequency:ur})(Dr);var Np={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var ks=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Np[o];if(typeof i=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",i).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Fr=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return u`
274
274
  ${ks(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
275
- `}};n(Fr,"FormattedDate");var Np=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),qs=g(Np)(Fr);var Ls=ce(bt());var Ds=n((t,e,r)=>n(async function(i){await i({type:pe,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"),Ip=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"),kp=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(ho({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(Pt(a,"sig_field","ts","sig"))):await i(he())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),qp=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:Ip(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"),Fs=n((t,e,r)=>async function(o,i){switch(await o({type:le}),await o({type:pe,payload:{isPreview:!1,productId:r.product.id}}),await o({type:mt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(Ds(!0,r.product.id,r));break;case"upsell":o(kp(!0,r.product.id,r));break;case"subscribed":o(Ds(!0,r.product.id,r)),o(Y(r.product,"2_2"));break;case"prepaid":o(qp(!0,r.product.id,r)),o(Y(r.product,"1_3"));break;default:}},"setPreview");var Dp=n((...t)=>JSON.stringify(t),"memoizeKey"),Us=!1;function Fp(t,e){Us||(console.warn(`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.`),Us=!0)}n(Fp,"logMulticurrencyWarning");var Up=(0,Ls.default)((t,e)=>Object.assign({components:e},t),Dp),Ur=class extends j{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:bs,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`
275
+ `}};n(Fr,"FormattedDate");var Ip=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),qs=g(Ip)(Fr);var Us=ce(bt());var Ds=n((t,e,r)=>n(async function(i){await i({type:pe,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"),kp=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"),qp=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(ho({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"),Dp=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:kp(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"),Fs=n((t,e,r)=>async function(o,i){switch(await o({type:le}),await o({type:pe,payload:{isPreview:!1,productId:r.product.id}}),await o({type:mt,payload:{isPreview:!1,productId:r.product.id}}),t){case"regular":o(Ds(!0,r.product.id,r));break;case"upsell":o(qp(!0,r.product.id,r));break;case"subscribed":o(Ds(!0,r.product.id,r)),o(Y(r.product,"2_2"));break;case"prepaid":o(Dp(!0,r.product.id,r)),o(Y(r.product,"1_3"));break;default:}},"setPreview");var Fp=n((...t)=>JSON.stringify(t),"memoizeKey"),Ls=n(t=>{let e=!1;return(...r)=>{e||(console.warn(t(...r)),e=!0)}},"logOnce"),Up=Ls((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.`),Lp=Ls(()=>"Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists."),Mp=(0,Us.default)((t,e)=>Object.assign({components:e},t),Fp),Ur=class extends j{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:bs,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`
276
276
  :host[hidden] {
277
277
  display: none;
278
278
  }
@@ -423,9 +423,9 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=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&&pr(()=>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=Up(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(){if(this.config&&this.config.storeCurrency&&this.config.merchantSettings){let e=this.config.merchantSettings.multicurrency_enabled||this.config.storeCurrency===this.config.merchantSettings.currency_code;return e||Fp(this.config.storeCurrency,this.config.merchantSettings.currency_code),e}return!0}render(){return this.shouldEnableOffer?u`
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,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=Mp(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)?(Up(this.config.storeCurrency,this.config.merchantSettings.currency_code),!1):this.isCart&&((e=this.config)==null?void 0:e.hasProductSpecificFrequencies)?(Lp(),!1):!0}render(){return this.shouldEnableOffer?u`
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 Lp=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"),Ms=g(Lp,{fetchOffer:di,fetchOrders:fr,productHasChangedComponents:si,optinProduct:Y,setFirstOrderPlaceDate:_i,setProductToSubscribe:Si,setPreview:Fs})(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(Ur,"Offer");var $p=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"),Ms=g($p,{fetchOffer:di,fetchOrders:fr,productHasChangedComponents:si,optinProduct:Y,setFirstOrderPlaceDate:_i,setProductToSubscribe:Si,setPreview:Fs})(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`
429
429
  :host[hidden] {
430
430
  display: none;
431
431
  }
@@ -794,7 +794,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=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 u``}};n(G,"PrepaidStatus");var Mp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),wm=g(Mp,{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(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 u``}};n(G,"PrepaidStatus");var Vp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Rm=g(Vp,{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`
798
798
  og-select {
799
799
  display: inline-block;
800
800
  cursor: pointer;
@@ -828,7 +828,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
828
828
  <slot name="append"></slot>
829
829
  </label>
830
830
  </div>
831
- `}};n(Lr,"PrepaidToggle");var $p=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),$s=g($p,{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(Lr,"PrepaidToggle");var jp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),$s=g(jp,{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`
832
832
  :host {
833
833
  display: inline-block;
834
834
  text-indent: initial;
@@ -839,7 +839,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
839
839
  <slot name="append"></slot>
840
840
  `:u`
841
841
  <slot name="fallback"></slot>
842
- `}};n(Mr,"PrepaidData");var Vp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Vs=g(Vp)(Mr);var $r=class extends G{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
842
+ `}};n(Mr,"PrepaidData");var Hp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Vs=g(Hp)(Mr);var $r=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;
@@ -893,7 +893,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
893
893
  <slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
894
894
  </label>
895
895
  </slot>
896
- `}};n($r,"PrepaidButton");var jp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),js=g(jp,{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($r,"PrepaidButton");var Gp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),js=g(Gp,{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`
897
897
  og-select {
898
898
  display: inline-block;
899
899
  cursor: pointer;
@@ -914,7 +914,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
914
914
  <span>${e[0].text}</span>
915
915
  `}
916
916
  <slot name="append"></slot>
917
- `}};n(Vr,"PrepaidSelect");var Hp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Hs=g(Hp,{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 u`
917
+ `}};n(Vr,"PrepaidSelect");var Bp=n((t,e)=>({options:L(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:X(e.product)(t)}),"mapStateToProps"),Hs=g(Bp,{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 u`
918
918
  <slot name="default">
919
919
  <button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
920
920
  <label for="action-trigger">
@@ -1009,7 +1009,7 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
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 jo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Ut);let e=document.createElement(t);document.body.appendChild(e)}n(jo,"default");var Ho=[79,71,68,69,86],Bs=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===Ho[t]){let o=Ho[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Ho.length&&jo()}else t=0},!1)},"enable");var Hr=n((t=[],e)=>{switch(e.type){case le: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"),Go=n((t=[],e)=>{switch(e.type){case le: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"),Bo=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"),Bp=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),zp=n((t={},e)=>{switch(e.type){case J:return{...t};case T:return{...t,...e.payload.in_stock};default:return t}},"inStock"),zo=n((t={},e)=>{switch(e.type){case T:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),zs=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Yo=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||[],...zs(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...zs(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Yp=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"),Wo=n((t=!1,e)=>{switch(e.type){case Gt:return{...e.payload};case Ee:return!1;default:return t}},"auth"),Jo=n((t="",e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"merchantId"),Ko=n((t=null,e)=>{switch(e.type){case Ht:return e.payload;default:return t}},"authUrl"),Wp=n((t={},e)=>{switch(e.type){case T:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Qo=n((t="",e)=>{switch(e.type){case T:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Zo=n((t=null,e)=>{switch(e.type){case le:return null;case Le:return e.payload;default:return t}},"sessionId"),Jp=n((t={},e)=>{switch(e.type){case T:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case je:return{};default:return t}},"productOffer"),Xo=n((t={},e)=>{switch(e.type){case Zt:return{...t,[x(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),en=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:Te,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),tn=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"),Kp=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"),rn=n((t=!1,e)=>{switch(e.type){case pe:return e.payload.isPreview;default:return t}},"previewStandardOffer"),on=n((t=!1,e)=>{switch(e.type){case mt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var nn=n((t=[],e)=>{switch(e.type){case T:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),sn=n((t=[],e)=>{switch(e.type){case T:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),an=n((t=[],e)=>{switch(e.type){case Qt:return[...e.payload||[]];case Kt:return[e.payload,...t];default:return t}},"templates"),Qp=n((t={},e)=>{switch(e.type){case B:return Qe(e.payload);default:return t}},"productPlans"),cn=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:Go,nextUpcomingOrder:Bo,autoshipEligible:Bp,inStock:zp,eligibilityGroups:zo,incentives:Yo,frequency:Yp,auth:Wo,merchantId:Jo,authUrl:Ko,offer:Wp,offerId:Qo,sessionId:Zo,productOffer:Jp,firstOrderPlaceDate:Xo,productToSubscribe:en,environment:Lt,locale:tn,config:Kp,previewStandardOffer:rn,previewUpsellOffer:on,autoshipByDefault:nn,defaultFrequencies:sn,templates:an,productPlans:Qp,prepaidShipmentsSelected:cn});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(Ut,"TestWizard");function jo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Ut);let e=document.createElement(t);document.body.appendChild(e)}n(jo,"default");var Ho=[79,71,68,69,86],Bs=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===Ho[t]){let o=Ho[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Ho.length&&jo()}else t=0},!1)},"enable");var Hr=n((t=[],e)=>{switch(e.type){case le: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"),Go=n((t=[],e)=>{switch(e.type){case le: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"),Bo=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"),Yp=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Wp=n((t={},e)=>{switch(e.type){case J:return{...t};case P:return{...t,...e.payload.in_stock};default:return t}},"inStock"),zo=n((t={},e)=>{switch(e.type){case P:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),zs=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),Yo=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||[],...zs(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...zs(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Jp=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"),Wo=n((t=!1,e)=>{switch(e.type){case Gt:return{...e.payload};case Ee:return!1;default:return t}},"auth"),Jo=n((t="",e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"merchantId"),Ko=n((t=null,e)=>{switch(e.type){case Ht:return e.payload;default:return t}},"authUrl"),Kp=n((t={},e)=>{switch(e.type){case P:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Qo=n((t="",e)=>{switch(e.type){case P:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Zo=n((t=null,e)=>{switch(e.type){case le:return null;case Le:return e.payload;default:return t}},"sessionId"),Qp=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"),Xo=n((t={},e)=>{switch(e.type){case Zt:return{...t,[x(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),en=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"),tn=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"),Zp=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"),rn=n((t=!1,e)=>{switch(e.type){case pe:return e.payload.isPreview;default:return t}},"previewStandardOffer"),on=n((t=!1,e)=>{switch(e.type){case mt:return e.payload.isPreview;default:return t}},"previewUpsellOffer");var nn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),sn=n((t=[],e)=>{switch(e.type){case P:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),an=n((t=[],e)=>{switch(e.type){case Qt:return[...e.payload||[]];case Kt:return[e.payload,...t];default:return t}},"templates"),Xp=n((t={},e)=>{switch(e.type){case B:return Qe(e.payload);default:return t}},"productPlans"),cn=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:Go,nextUpcomingOrder:Bo,autoshipEligible:Yp,inStock:Wp,eligibilityGroups:zo,incentives:Yo,frequency:Jp,auth:Wo,merchantId:Jo,authUrl:Ko,offer:Kp,offerId:Qo,sessionId:Zo,productOffer:Qp,firstOrderPlaceDate:Xo,productToSubscribe:en,environment:Lt,locale:tn,config:Zp,previewStandardOffer:rn,previewUpsellOffer:on,autoshipByDefault:nn,defaultFrequencies:sn,templates:an,productPlans:Xp,prepaidShipmentsSelected:cn});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`
1013
1013
  :host::before {
1014
1014
  clip-path: inset(100%);
1015
1015
  clip: rect(1px, 1px, 1px, 1px);
@@ -1033,6 +1033,6 @@ var lib=(()=>{var ga=Object.create;var ut=Object.defineProperty;var ya=Object.ge
1033
1033
  <slot name="append"></slot>
1034
1034
  `:u`
1035
1035
  <slot name="fallback"></slot>
1036
- `}};n(Br,"Price");var Zp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:ee(e.product)(t)}},"mapStateToProps"),Ys=g(Zp)(Br);function pn(t){Bs(),Li(t);try{customElements.define("og-when",ys),customElements.define("og-text",ws),customElements.define("og-incentive-text",Ns),customElements.define("og-offer",Ms),customElements.define("og-select-frequency",Is),customElements.define("og-optout-button",Es),customElements.define("og-optin-toggle",Ps),customElements.define("og-optin-status",_s),customElements.define("og-optin-button",Ss),customElements.define("og-optin-select",vs),customElements.define("og-upsell-button",Os),customElements.define("og-frequency-status",xs),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",qs),customElements.define("og-price",Ys),customElements.define("og-prepaid-toggle",$s),customElements.define("og-prepaid-data",Vs),customElements.define("og-prepaid-button",js),customElements.define("og-prepaid-select",Hs),customElements.define("og-subscription-button",Gs)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(go(o)),this},setMerchantId(o){return t.dispatch(ci(o)),this},setAuthUrl(o){return t.dispatch(pi(o)),this},receiveMerchantSettings(o){return t.dispatch(Ei(o)),this},getProductsForPurchasePost(o=[]){return So(t.getState(),o)},getOptins(o=[]){return So(t.getState(),o)},clear(){t.dispatch(fi())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(gi(o)),this},setLocale(o){return t.dispatch(mi(o)),this},addTemplate(o,i,s){return t.dispatch(yi(o,i,s)),this},setTemplates(o){return t.dispatch(bi(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:p}=Lt({},go(i)),{sessionId:l}=a.getState();l&&c.forEach(f=>{let d=x(f);de.fetchOffer(p,o,l,`${d}`,ve)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:B,payload:s.product_discounts})}},initialize(o,i,s,a){var p;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!==((p=c.environment)==null?void 0:p.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),_o(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"),Xp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),el=n((t,e)=>ae(t.compare_at_price,e),"getAllocationRegularPrice"),tl=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"),Ws=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),rl=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,p=Ws(t,c);return zr(p)}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"),ol=n(t=>{var e;return Yr(t)?Wr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),nl=n((t,e,r,o)=>{var f,d;let i=Wr((f=t.selling_plan)==null?void 0:f.options),s=t.price/i,a=t.compare_at_price-s,c=Ws(t,s),p=(d=r==null?void 0:r.price_adjustments)==null?void 0:d[0],l=p&&p.value_type==="percentage"?p.value:null;return e.regularPrepaidPrice=ae(t.price,o),e.prepaidSavingsPerShipment=ae(Math.round(a),o),e.prepaidSavingsTotal=ae(Math.round(a*i),o),l&&c&&(e.prepaidExtraSavingsPercentage=zr(c-l)),e},"addPrepaidPriceAndSavings"),ln="Subscribe and Save",il=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:Xp(t),regularPrice:el(t,r),subscriptionPrice:tl(t,r),discountRate:rl(t,r),prepaidShipments:ol(t)};if(Yr(t)){let i=e.find(s=>s.group_name===ln&&s.options.length===1);return nl(t,o,i,r)}return o},"mapSellingPlanToDiscount"),un=n((t,e,r=[],o)=>[...t,il(e,r,o)],"sellingPlanAllocationsReducer"),Js=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Qs=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"),Ks=n((t,e,r)=>{if(!r)return null;if(!We(r))return r;if(lr(t,e)){let o=te(t,e,r);return o||fe(t)}return r},"getDefaultSellingPlan"),sl=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return We(r==null?void 0:r.frequency)?{...r,frequency:lr((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,(p=e==null?void 0:e.config)==null?void 0:p.frequenciesEveryPeriod,e.defaultFrequency)||fe((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),al=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(p=>p.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:p,frequenciesEveryPeriod:l}={},defaultFrequency:f}=s,d=r[c],m;return r[c]&&lr(p,l)?m=te(p,l,`${d.every}_${d.every_period}`)||Ks(p,l,f)||fe(p):r[c]?m=`${d.every}_${d.every_period}`:m=Ks(p,l,f)||"_",a.concat({id:c,frequency:m})}return a},[]),"reduceNewOptinsFromOfferResponse"),Zs=n(t=>(t==null?void 0:t.selling_plan_groups.find(r=>r.name.startsWith("og_psfl")))||(t==null?void 0:t.selling_plan_groups.find(r=>r.name===ln)),"getOGSellingPlanGroup"),cl=n((t,e)=>({...Qs(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Xs=n((t,[e])=>({...t,[e]:!0}),"productTrue"),ea=n((t,e)=>{let r=x(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),pl=n(t=>t.name.toUpperCase().includes("PREPAID"),"isPrepaidSellingPlanGroup"),ll=n((t,e)=>{if(!t||t.length===0)return[];if(!e||e.length===0)return t;let r=e.reduce((o,i)=>(pl(i)||o.push(...i.selling_plans.map(s=>s.id)),o),[]);return t.filter(o=>r.includes(o.selling_plan_id))},"filterNonPrepaidSellingPlans"),ul=n((t={},e)=>{if(B===e.type)return Object.entries(e.payload).reduce(Xs,t);if(ue===e.type){let{payload:r}=e;return r.items.reduce(ea,t)}if(K===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,i)=>{let s=ll(i==null?void 0:i.selling_plan_allocations,r==null?void 0:r.selling_plan_groups);return{...Qs(o,i.id,(s==null?void 0:s.length)>0),[i.id]:(s==null?void 0:s.length)>0}},t)}return pe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function dl(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(dl,"textToFreq");function ta(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>dl(r))}n(ta,"sellingPlansToEveryPeriod");function ra(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(ra,"sellingPlansToFrequencies");function oa(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(oa,"getPrepaidShipments");function fl(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:oa(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(fl,"getPrepaidSellingPlans");var hl=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={},p=Zs(s),l=ra(p);if(l!=null&&l.length){let d=ta(p),m=((o=(r=p.options)==null?void 0:r[0])==null?void 0:o.values)||l,b=t.defaultFrequency;b&&We(b)&&(b=te(l,d,b)||fe(l)||b),c={frequencies:l,frequenciesEveryPeriod:d,frequenciesText:m,...b?{defaultFrequency:b}:{}}}let f=s==null?void 0:s.selling_plan_groups.filter(d=>/^Prepaid-.*/.test(d.name));return f.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...fl(f)}}),{...t,...c,storeCurrency:a}}if(T===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:p,prepaidSellingPlans:l={}}={},product:f}=s;return(i=l[f==null?void 0:f.id])!=null&&i.some(({sellingPlan:d})=>d===a)?{...t,defaultFrequency:fe(c)||a}:We(a)?{...t,defaultFrequency:te(c,p,a)||fe(c)||a}:{...t,defaultFrequency:a}}return Ge===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),ml=n((t={},e)=>{var r;if(B===e.type)return Object.entries(e.payload).reduce(Xs,t);if(ue===e.type)return e.payload.items.reduce(ea,t);if(K===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(cl,t)||t}return J===e.type&&e.payload.product===null?{...t}:pe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),gl=n((t={},e)=>t,"offer");function yl({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(yl,"getFrequencyForPrepaidShipments");function bl(t){let e=oa(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(bl,"getOptedInItem");var _l=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,bl(i)]:o,[]))}if(T===e.type){let{offer:r={},...o}=e.payload,i=sl(t,r),s=al(o,i,r);return[...i,...s]}if(K===e.type){let{product:r}=e.payload,o=Zs(r);if(!o)return t;let i=ra(o),s=ta(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:yl(r)})}return Hr(t,e)},"optedin"),Sl=n((t={},e)=>t,"productOffer"),El=n((t={},e)=>{var r;if(K===e.type){let{payload:{product:o,currency:i}}=e,s=Js(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var p;return{...a,[c.id]:(p=c.selling_plan_allocations)==null?void 0:p.reduce((l,f)=>un(l,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]:un([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return B===e.type?Qe(e.payload):t},"productPlans"),xl=Mt({auth:Wo,authUrl:Ko,autoshipByDefault:nn,autoshipEligible:ul,config:hl,defaultFrequencies:sn,eligibilityGroups:zo,environment:Lt,firstOrderPlaceDate:Xo,incentives:Yo,inStock:ml,locale:tn,merchantId:Jo,nextUpcomingOrder:Bo,offer:gl,offerId:Qo,optedin:_l,optedout:Go,previewStandardOffer:rn,previewUpsellOffer:on,productOffer:Sl,productPlans:El,productToSubscribe:en,sessionId:Zo,templates:an,prepaidShipmentsSelected:cn});function dn(t,e){return window.og&&window.og.previewMode?Gr(t,e):xl(t,e)}n(dn,"shopifyReducer");var aa=ce(bt()),ca=ce(Vt());function na(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,p=c==null?void 0:c.querySelector(`[name="${e}"]`);p||(p=document.createElement("input"),p.type="hidden",p.name=`attributes[${e}]`,c==null||c.appendChild(p)),p.value=r})}n(na,"updateTrackingInputs");function fn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(fn,"getTrackingKey");function vl(t,e){var f,d,m,b;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(d=t.payload.offer)==null?void 0:d.product.id,i=fn(),s=((m=t.payload.offer)==null?void 0:m.location)||"",a=((b=t.payload.offer)==null?void 0:b.variationId)||"",c=Jr(o,e),l=[o,R.toLowerCase(),s,c,a].join(",");na(o,i,l)}n(vl,"addDefaultToSubTracking");function hn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=mn(r);o&&!o.isCart&&na(o.product.id,i[0],i[1]);break}case T:vl(r,t);break;default:}}}n(hn,"shopifyTrackingMiddleware");var ia,sa,gn=((sa=(ia=window.Shopify)==null?void 0:ia.routes)==null?void 0:sa.root)||"/",Ol="/cart",Tl=`${gn}cart.js`,Pl=`${gn}cart/change.js`,wl=`${gn}products/`,Cl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Rl=n(t=>(0,ca.debounce)(100,!1,function(e){let{id:r}=Object.fromEntries([...new FormData(e).entries()]);r?t.setAttribute("product",r):t.removeAttribute("product")}),"makeSyncProductId");async function Al(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await yn()).currency}n(Al,"getCurrency");async function Nl(t,e){let r=Il(e);if(r)try{let[i,s]=await Promise.all([pa(r),Al()]),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=Rl(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(Nl,"setupPdp");async function yn(){return(await fetch(Tl)).json()}n(yn,"getCart");function Il(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(Il,"guessProductHandle");var pa=(0,aa.default)(async function(t){return(await fetch(`${wl}${t}.js`)).json()});async function kl(t,e){let r=await yn(),{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(pa))).forEach(c=>{let p={product:c,offer:e,currency:r.currency};t.dispatch({type:K,payload:p})})}n(kl,"setupCart");async function ql(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Jr(t.payload.product.id,e),i=mn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Cl)),p=t.payload.product.id,l=await yn(),f=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(C=>C.key===p),d=l.items[f],m=d.quantity,b=x(p),S=await fetch(Pl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:m,attributes:Object.fromEntries([i]),properties:d.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 h=await S.json(),E=l.items.length===h.items.length?h.items[f].key:(a=h.items.find(C=>C.quantity===m&&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:p,newCartProductKey:E}}),r.setAttribute("product",E));let P=h;e.dispatch({type:ue,payload:P});let _=new CustomEvent(Vn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(_),_.defaultPrevented)return;let w=h.sections;Object.values(w).length?c.forEach(C=>{let _n=C.id.replace(/^shopify-section-/,"");if(!(_n in w))return;let ma=w[_n],Sn=new DOMParser().parseFromString(ma.toString()||"","text/html").getElementById(C.id);Sn&&(C.innerHTML=Sn.innerHTML)}):window.location.pathname.startsWith(Ol)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(ql,"synchronizeCartOptin");function mn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=fn(),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(mn,"getTrackingEvent");function Jr(t,e){var i;return(i=ar({id:t})(e.getState()))==null?void 0:i.frequency}n(Jr,"getSubscribedFrequency");function Dl(t,e){e.isCart||!e.shouldEnableOffer||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Jr(o,t);ii(r.form,"selling_plan",i)})}n(Dl,"synchronizeSellingPlan");function bn(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?kl(t,r.payload.offer):Nl(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ie:ql(r,t);case J:case T:case K:Dl(t,r.payload.offer);break;default:}}}n(bn,"shopifyMiddleware");var Fl="/apps/subscriptions/auth/",la="og_auth_begin",Ul="og_auth_end",Ll=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function ua({store:t}){var i;let[e]=lo(),r=vt(),o=r!=null&&r.dataset.customer?Ll(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await $l(o);if(s){let[a,c,p]=s.split("|");t.dispatch(Pt(e,a,Number(c),p))}}else oi("og_auth")}n(ua,"authorizeShopifyCustomer");async function Ml(t){try{let r=await(await fetch(`${Fl}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(la);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+la.length,r.lastIndexOf(Ul)))}catch(e){console.error(e)}}n(Ml,"fetchOGSignature");async function $l(t){let e=ni("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await Ml(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($l,"getOrCreateAuthCookie");var da,ha=qi(...(da=q)!=null&&da.shopify_selling_plans?[dn,bn]:[Gr],q.shopify&&hn),O=pn(ha),Vl=O.isReady,jl=O.addOptinChangedCallback,Hl=O.addTemplate,Gl=O.clear,Bl=O.config,zl=O.disableOptinChangedCallbacks,Yl=O.getOptins,Wl=O.getProductsForPurchasePost,Jl=O.initialize,Kl=O.previewMode,Ql=O.register,Zl=O.resolveSettings,Xl=O.setAuthUrl,eu=O.setEnvironment,tu=O.setLocale,ru=O.setMerchantId,ou=O.setPublicPath,nu=O.setTemplates,iu=O.setupCart,su=O.setupProduct,au=O.setupProducts,cu=n(()=>ri(O),"autoInit");var pu=O.initialize,fa;(fa=q)!=null&&fa.shopify_selling_plans&&pr(()=>ua(O));return Ea(lu);})();
1036
+ `}};n(Br,"Price");var el=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:ee(e.product)(t)}},"mapStateToProps"),Ys=g(el)(Br);function pn(t){Bs(),Li(t);try{customElements.define("og-when",ys),customElements.define("og-text",ws),customElements.define("og-incentive-text",Ns),customElements.define("og-offer",Ms),customElements.define("og-select-frequency",Is),customElements.define("og-optout-button",Es),customElements.define("og-optin-toggle",Ts),customElements.define("og-optin-status",_s),customElements.define("og-optin-button",Ss),customElements.define("og-optin-select",vs),customElements.define("og-upsell-button",Os),customElements.define("og-frequency-status",xs),customElements.define("og-modal",qt),customElements.define("og-select",Dt),customElements.define("og-tooltip",Ft),customElements.define("og-upsell-modal",Ps),customElements.define("og-next-upcoming-order",qs),customElements.define("og-price",Ys),customElements.define("og-prepaid-toggle",$s),customElements.define("og-prepaid-data",Vs),customElements.define("og-prepaid-button",js),customElements.define("og-prepaid-select",Hs),customElements.define("og-subscription-button",Gs)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(go(o)),this},setMerchantId(o){return t.dispatch(ci(o)),this},setAuthUrl(o){return t.dispatch(pi(o)),this},receiveMerchantSettings(o){return t.dispatch(Ei(o)),this},getProductsForPurchasePost(o=[]){return So(t.getState(),o)},getOptins(o=[]){return So(t.getState(),o)},clear(){t.dispatch(fi())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(gi(o)),this},setLocale(o){return t.dispatch(mi(o)),this},addTemplate(o,i,s){return t.dispatch(yi(o,i,s)),this},setTemplates(o){return t.dispatch(bi(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:p}=Lt({},go(i)),{sessionId:l}=a.getState();l&&c.forEach(f=>{let d=x(f);de.fetchOffer(p,o,l,`${d}`,ve)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:B,payload:s.product_discounts})}},initialize(o,i,s,a){var p;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!==((p=c.environment)==null?void 0:p.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),_o(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"),tl=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),rl=n((t,e)=>ae(t.compare_at_price,e),"getAllocationRegularPrice"),ol=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"),Ws=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),nl=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,p=Ws(t,c);return zr(p)}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"),il=n(t=>{var e;return Yr(t)?Wr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),sl=n((t,e,r,o)=>{var f,d;let i=Wr((f=t.selling_plan)==null?void 0:f.options),s=t.price/i,a=t.compare_at_price-s,c=Ws(t,s),p=(d=r==null?void 0:r.price_adjustments)==null?void 0:d[0],l=p&&p.value_type==="percentage"?p.value:null;return e.regularPrepaidPrice=ae(t.price,o),e.prepaidSavingsPerShipment=ae(Math.round(a),o),e.prepaidSavingsTotal=ae(Math.round(a*i),o),l&&c&&(e.prepaidExtraSavingsPercentage=zr(c-l)),e},"addPrepaidPriceAndSavings"),ln="Subscribe and Save",al=n((t,e,r)=>{t.selling_plan||(t.selling_plan=e.find(i=>i.id===t.selling_plan_id));let o={frequency:tl(t),regularPrice:rl(t,r),subscriptionPrice:ol(t,r),discountRate:nl(t,r),prepaidShipments:il(t)};if(Yr(t)){let i=e.find(s=>s.group_name===ln&&s.options.length===1);return sl(t,o,i,r)}return o},"mapSellingPlanToDiscount"),un=n((t,e,r=[],o)=>[...t,al(e,r,o)],"sellingPlanAllocationsReducer"),Js=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Qs=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"),Ks=n((t,e,r)=>{if(!r)return null;if(!We(r))return r;if(lr(t,e)){let o=te(t,e,r);return o||fe(t)}return r},"getDefaultSellingPlan"),cl=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return We(r==null?void 0:r.frequency)?{...r,frequency:lr((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,(p=e==null?void 0:e.config)==null?void 0:p.frequenciesEveryPeriod,e.defaultFrequency)||fe((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),pl=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},i,s)=>Object.keys(t).reduce((a,c)=>{if(!i.some(p=>p.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:p,frequenciesEveryPeriod:l}={},defaultFrequency:f}=s,d=r[c],m;return r[c]&&lr(p,l)?m=te(p,l,`${d.every}_${d.every_period}`)||Ks(p,l,f)||fe(p):r[c]?m=`${d.every}_${d.every_period}`:m=Ks(p,l,f)||"_",a.concat({id:c,frequency:m})}return a},[]),"reduceNewOptinsFromOfferResponse"),Zs=n(t=>(t==null?void 0:t.selling_plan_groups.find(Xs))||(t==null?void 0:t.selling_plan_groups.find(r=>r.name===ln)),"getOGSellingPlanGroup"),Xs=n(t=>t.name.startsWith("og_psfl"),"isProductSpecificFrequencySellingPlanGroup"),ll=n((t,e)=>({...Qs(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),ea=n((t,[e])=>({...t,[e]:!0}),"productTrue"),ta=n((t,e)=>{let r=x(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),ul=n(t=>t.name.toUpperCase().includes("PREPAID"),"isPrepaidSellingPlanGroup"),dl=n((t,e)=>{if(!t||t.length===0)return[];if(!e||e.length===0)return t;let r=e.reduce((o,i)=>(ul(i)||o.push(...i.selling_plans.map(s=>s.id)),o),[]);return t.filter(o=>r.includes(o.selling_plan_id))},"filterNonPrepaidSellingPlans"),fl=n((t={},e)=>{if(B===e.type)return Object.entries(e.payload).reduce(ea,t);if(ue===e.type){let{payload:r}=e;return r.items.reduce(ta,t)}if(K===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,i)=>{let s=dl(i==null?void 0:i.selling_plan_allocations,r==null?void 0:r.selling_plan_groups);return{...Qs(o,i.id,(s==null?void 0:s.length)>0),[i.id]:(s==null?void 0:s.length)>0}},t)}return pe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"autoshipEligible");function hl(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(hl,"textToFreq");function ra(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>hl(r))}n(ra,"sellingPlansToEveryPeriod");function oa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(oa,"sellingPlansToFrequencies");function na(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(na,"getPrepaidShipments");function ml(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:na(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(ml,"getPrepaidSellingPlans");var gl=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={},p=Zs(s),l=oa(p);if(l!=null&&l.length){let d=ra(p),m=((o=(r=p.options)==null?void 0:r[0])==null?void 0:o.values)||l,b=t.defaultFrequency;b&&We(b)&&(b=te(l,d,b)||fe(l)||b),c={frequencies:l,frequenciesEveryPeriod:d,frequenciesText:m,...b?{defaultFrequency:b}:{},hasProductSpecificFrequencies:t.hasProductSpecificFrequencies||Xs(p)}}let f=s==null?void 0:s.selling_plan_groups.filter(d=>/^Prepaid-.*/.test(d.name));return f.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...ml(f)}}),{...t,...c,storeCurrency:a}}if(P===e.type){let{payload:{offer:s}}=e,{defaultFrequency:a,config:{frequencies:c,frequenciesEveryPeriod:p,prepaidSellingPlans:l={}}={},product:f}=s;return(i=l[f==null?void 0:f.id])!=null&&i.some(({sellingPlan:d})=>d===a)?{...t,defaultFrequency:fe(c)||a}:We(a)?{...t,defaultFrequency:te(c,p,a)||fe(c)||a}:{...t,defaultFrequency:a}}return Ge===e.type?{...t,merchantSettings:{...e.payload}}:t},"config"),yl=n((t={},e)=>{var r;if(B===e.type)return Object.entries(e.payload).reduce(ea,t);if(ue===e.type)return e.payload.items.reduce(ta,t);if(K===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(ll,t)||t}return J===e.type&&e.payload.product===null?{...t}:pe===e.type?e.payload.isPreview!==!0?t:{...t,[e.payload.productId]:!0}:t},"inStock"),bl=n((t={},e)=>t,"offer");function _l({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(_l,"getFrequencyForPrepaidShipments");function Sl(t){let e=na(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(Sl,"getOptedInItem");var El=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,Sl(i)]:o,[]))}if(P===e.type){let{offer:r={},...o}=e.payload,i=cl(t,r),s=pl(o,i,r);return[...i,...s]}if(K===e.type){let{product:r}=e.payload,o=Zs(r);if(!o)return t;let i=oa(o),s=ra(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:_l(r)})}return Hr(t,e)},"optedin"),xl=n((t={},e)=>t,"productOffer"),vl=n((t={},e)=>{var r;if(K===e.type){let{payload:{product:o,currency:i}}=e,s=Js(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((a,c)=>{var p;return{...a,[c.id]:(p=c.selling_plan_allocations)==null?void 0:p.reduce((l,f)=>un(l,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]:un([],s.selling_plan_allocation,[],o.currency)}:i,t)||t}return B===e.type?Qe(e.payload):t},"productPlans"),Ol=Mt({auth:Wo,authUrl:Ko,autoshipByDefault:nn,autoshipEligible:fl,config:gl,defaultFrequencies:sn,eligibilityGroups:zo,environment:Lt,firstOrderPlaceDate:Xo,incentives:Yo,inStock:yl,locale:tn,merchantId:Jo,nextUpcomingOrder:Bo,offer:bl,offerId:Qo,optedin:El,optedout:Go,previewStandardOffer:rn,previewUpsellOffer:on,productOffer:xl,productPlans:vl,productToSubscribe:en,sessionId:Zo,templates:an,prepaidShipmentsSelected:cn});function dn(t,e){return window.og&&window.og.previewMode?Gr(t,e):Ol(t,e)}n(dn,"shopifyReducer");var ca=ce(bt()),pa=ce(Vt());function ia(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,p=c==null?void 0:c.querySelector(`[name="${e}"]`);p||(p=document.createElement("input"),p.type="hidden",p.name=`attributes[${e}]`,c==null||c.appendChild(p)),p.value=r})}n(ia,"updateTrackingInputs");function fn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(fn,"getTrackingKey");function Pl(t,e){var f,d,m,b;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(d=t.payload.offer)==null?void 0:d.product.id,i=fn(),s=((m=t.payload.offer)==null?void 0:m.location)||"",a=((b=t.payload.offer)==null?void 0:b.variationId)||"",c=Jr(o,e),l=[o,R.toLowerCase(),s,c,a].join(",");ia(o,i,l)}n(Pl,"addDefaultToSubTracking");function hn(t){return e=>r=>{switch(e(r),r.type){case R:case I:case k:{let o=r.payload.offer,i=mn(r);o&&!o.isCart&&ia(o.product.id,i[0],i[1]);break}case P:Pl(r,t);break;default:}}}n(hn,"shopifyTrackingMiddleware");var sa,aa,gn=((aa=(sa=window.Shopify)==null?void 0:sa.routes)==null?void 0:aa.root)||"/",Tl="/cart",wl=`${gn}cart.js`,Cl=`${gn}cart/change.js`,Rl=`${gn}products/`,Al='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Nl=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 Il(){var r,o;let t=(o=(r=window.Shopify)==null?void 0:r.currency)==null?void 0:o.active;return t||(await yn()).currency}n(Il,"getCurrency");async function kl(t,e){let r=ql(e);if(r)try{let[i,s]=await Promise.all([la(r),Il()]),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=Nl(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(kl,"setupPdp");async function yn(){return(await fetch(wl)).json()}n(yn,"getCart");function ql(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(ql,"guessProductHandle");var la=(0,ca.default)(async function(t){return(await fetch(`${Rl}${t}.js`)).json()});async function Dl(t,e){let r=await yn(),{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(la))).forEach(c=>{let p={product:c,offer:e,currency:r.currency};t.dispatch({type:K,payload:p})})}n(Dl,"setupCart");async function Fl(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Jr(t.payload.product.id,e),i=mn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Al)),p=t.payload.product.id,l=await yn(),f=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(C=>C.key===p),d=l.items[f],m=d.quantity,b=x(p),S=await fetch(Cl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:m,attributes:Object.fromEntries([i]),properties:d.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 h=await S.json(),E=l.items.length===h.items.length?h.items[f].key:(a=h.items.find(C=>C.quantity===m&&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:p,newCartProductKey:E}}),r.setAttribute("product",E));let T=h;e.dispatch({type:ue,payload:T});let _=new CustomEvent(Vn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(_),_.defaultPrevented)return;let w=h.sections;Object.values(w).length?c.forEach(C=>{let _n=C.id.replace(/^shopify-section-/,"");if(!(_n in w))return;let ga=w[_n],Sn=new DOMParser().parseFromString(ga.toString()||"","text/html").getElementById(C.id);Sn&&(C.innerHTML=Sn.innerHTML)}):window.location.pathname.startsWith(Tl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Fl,"synchronizeCartOptin");function mn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=fn(),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(mn,"getTrackingEvent");function Jr(t,e){var i;return(i=ar({id:t})(e.getState()))==null?void 0:i.frequency}n(Jr,"getSubscribedFrequency");function Ul(t,e){e.isCart||!e.shouldEnableOffer||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Jr(o,t);ii(r.form,"selling_plan",i)})}n(Ul,"synchronizeSellingPlan");function bn(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?Dl(t,r.payload.offer):kl(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case I:case k:case ie:Fl(r,t);case J:case P:case K:Ul(t,r.payload.offer);break;default:}}}n(bn,"shopifyMiddleware");var Ll="/apps/subscriptions/auth/",ua="og_auth_begin",Ml="og_auth_end",$l=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function da({store:t}){var i;let[e]=lo(),r=vt(),o=r!=null&&r.dataset.customer?$l(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await jl(o);if(s){let[a,c,p]=s.split("|");t.dispatch(Tt(e,a,Number(c),p))}}else oi("og_auth")}n(da,"authorizeShopifyCustomer");async function Vl(t){try{let r=await(await fetch(`${Ll}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(ua);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+ua.length,r.lastIndexOf(Ml)))}catch(e){console.error(e)}}n(Vl,"fetchOGSignature");async function jl(t){let e=ni("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await Vl(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(jl,"getOrCreateAuthCookie");var fa,ma=qi(...(fa=q)!=null&&fa.shopify_selling_plans?[dn,bn]:[Gr],q.shopify&&hn),O=pn(ma),Hl=O.isReady,Gl=O.addOptinChangedCallback,Bl=O.addTemplate,zl=O.clear,Yl=O.config,Wl=O.disableOptinChangedCallbacks,Jl=O.getOptins,Kl=O.getProductsForPurchasePost,Ql=O.initialize,Zl=O.previewMode,Xl=O.register,eu=O.resolveSettings,tu=O.setAuthUrl,ru=O.setEnvironment,ou=O.setLocale,nu=O.setMerchantId,iu=O.setPublicPath,su=O.setTemplates,au=O.setupCart,cu=O.setupProduct,pu=O.setupProducts,lu=n(()=>ri(O),"autoInit");var uu=O.initialize,ha;(ha=q)!=null&&ha.shopify_selling_plans&&pr(()=>da(O));return xa(du);})();
1037
1037
  ; return lib; });
1038
1038
  //# sourceMappingURL=offers.js.map