@ordergroove/offers 2.34.7-alpha-PR-789-9.10 → 2.34.7

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,108 +8,10 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.getOwnPropertyDescriptor;var Ha=Object.getOwnPropertyNames;var Ga=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var n=(t,e)=>yt(t,"name",{value:e,configurable:!0});var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var Pe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),co=(t,e)=>{for(var r in e)yt(t,r,{get:e[r],enumerable:!0})},Mn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ha(e))!Ba.call(t,i)&&i!==r&&yt(t,i,{get:()=>e[i],enumerable:!(o=Va(e,i))||o.enumerable});return t};var fe=(t,e,r)=>(r=t!=null?ja(Ga(t)):{},Mn(e||!t||!t.__esModule?yt(r,"default",{value:t,enumerable:!0}):r,t)),$n=t=>Mn(yt({},"__esModule",{value:!0}),t);var Jt=Pe((Wt,Wn)=>{(function(t,e){typeof Wt=="object"&&typeof Wn<"u"?e(Wt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Wt,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,x=new Array(b),h=0;h<b;h++)x[h]=arguments[h];var v=this,C=Date.now()-l;if(p)return;function S(){l=Date.now(),s.apply(v,x)}n(S,"exec");function _(){c=void 0}n(_,"clear"),a&&!c&&S(),f(),a===void 0&&C>o?S():i!==!0&&(c=setTimeout(a?_:S,a===void 0?o-C: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})})});function Kn(){return typeof window.og_auth<"u"?Kt(window.og_auth):null}async function tc(t=100){return new Promise(e=>{setTimeout(()=>e(Kn()),t)})}async function Qn(t,e=Za,r=Xa){let o;if(o=Kt(Kn())||Kt(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(ec(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await tc());if(o=Kt(o),o)return o;throw new Error("Unauthorized")}var Jn,Za,Kt,Xa,ec,Zn=O(()=>{Jn=/^og_auth=/,Za=n((t=Jn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Jn,""),"c"),Kt=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"),Xa=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"),ec=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(Kn,"a");n(tc,"f");n(Qn,"u")});var k,F,U,le,Ge,Z,R,_t,Be,Qt,Xn,Zt,we,ei,Xt,St,er,ti,ze,Ye,We,ri,oi,tr,ni,rr,Je,ii,or,Ke,Et,xt,mo,nr,ir,Ce,he,sr,ar,W,X,me,Re,cr,Ae,Ne,pr,lr,si,$=O(()=>{k="OPTIN_PRODUCT",F="OPTOUT_PRODUCT",U="PRODUCT_CHANGE_FREQUENCY",le="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ge="SET_MERCHANT_ID",Z="REQUEST_OFFER",R="RECEIVE_OFFER",_t="PRODUCT_HAS_CHANGED",Be="CREATED_SESSION_ID",Qt="SET_AUTH_URL",Xn="REQUEST_AUTH",Zt="AUTHORIZE",we="UNAUTHORIZED",ei="REQUEST_ORDERS",Xt="RECEIVE_ORDERS",St="CART_PRODUCT_KEY_HAS_CHANGED",er="RECEIVE_ORDER_ITEMS",ti="FETCH_RESPONSE_ERROR",ze="SET_ENVIRONMENT_STAGING",Ye="SET_ENVIRONMENT_DEV",We="SET_ENVIRONMENT_PROD",ri="CONCLUDE_UPSELL",oi="REQUEST_CREATE_IU_ORDER",tr="CREATE_ONE_TIME",ni="REQUEST_CONVERT_ONE_TIME",rr="CONVERT_ONE_TIME",Je="CHECKOUT",ii="RECEIVE_FETCH",or="SET_LOCALE",Ke="SET_CONFIG",Et="SET_PREVIEW_STANDARD_OFFER",xt="SET_PREVIEW_UPSELL_OFFER",mo="SET_PREVIEW_PREPAID_OFFER",nr="ADD_TEMPLATE",ir="SET_TEMPLATES",Ce="LOCAL_STORAGE_CHANGE",he="LOCAL_STORAGE_CLEAR",sr="SET_FIRST_ORDER_PLACE_DATE",ar="SET_PRODUCT_TO_SUBSCRIBE",W="RECEIVE_PRODUCT_PLANS",X="SETUP_PRODUCT",me="SETUP_CART",Re="pdp",cr="dev",Ae="staging",Ne="prod",pr="static.ordergroove.com",lr="staging.static.ordergroove.com",si="og-cart-updated"});var Tt=Pe((Vu,hi)=>{var rc="Expected a function",ci="__lodash_hash_undefined__",oc="[object Function]",nc="[object GeneratorFunction]",ic=/[\\^$.*+?()[\]{}|]/g,sc=/^\[object .+?Constructor\]$/,ac=typeof window=="object"&&window&&window.Object===Object&&window,cc=typeof self=="object"&&self&&self.Object===Object&&self,pi=ac||cc||Function("return this")();function pc(t,e){return t?.[e]}n(pc,"getValue");function lc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(lc,"isHostObject");var uc=Array.prototype,dc=Function.prototype,li=Object.prototype,go=pi["__core-js_shared__"],ai=function(){var t=/[^.]+$/.exec(go&&go.keys&&go.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ui=dc.toString,yo=li.hasOwnProperty,fc=li.toString,hc=RegExp("^"+ui.call(yo).replace(ic,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mc=uc.splice,gc=di(pi,"Map"),Ot=di(Object,"create");function Ie(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Ie,"Hash");function yc(){this.__data__=Ot?Ot(null):{}}n(yc,"hashClear");function bc(t){return this.has(t)&&delete this.__data__[t]}n(bc,"hashDelete");function _c(t){var e=this.__data__;if(Ot){var r=e[t];return r===ci?void 0:r}return yo.call(e,t)?e[t]:void 0}n(_c,"hashGet");function Sc(t){var e=this.__data__;return Ot?e[t]!==void 0:yo.call(e,t)}n(Sc,"hashHas");function Ec(t,e){var r=this.__data__;return r[t]=Ot&&e===void 0?ci:e,this}n(Ec,"hashSet");Ie.prototype.clear=yc;Ie.prototype.delete=bc;Ie.prototype.get=_c;Ie.prototype.has=Sc;Ie.prototype.set=Ec;function Qe(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(Qe,"ListCache");function xc(){this.__data__=[]}n(xc,"listCacheClear");function vc(t){var e=this.__data__,r=ur(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():mc.call(e,r,1),!0}n(vc,"listCacheDelete");function Oc(t){var e=this.__data__,r=ur(e,t);return r<0?void 0:e[r][1]}n(Oc,"listCacheGet");function Tc(t){return ur(this.__data__,t)>-1}n(Tc,"listCacheHas");function Pc(t,e){var r=this.__data__,o=ur(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Pc,"listCacheSet");Qe.prototype.clear=xc;Qe.prototype.delete=vc;Qe.prototype.get=Oc;Qe.prototype.has=Tc;Qe.prototype.set=Pc;function ke(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(ke,"MapCache");function wc(){this.__data__={hash:new Ie,map:new(gc||Qe),string:new Ie}}n(wc,"mapCacheClear");function Cc(t){return dr(this,t).delete(t)}n(Cc,"mapCacheDelete");function Rc(t){return dr(this,t).get(t)}n(Rc,"mapCacheGet");function Ac(t){return dr(this,t).has(t)}n(Ac,"mapCacheHas");function Nc(t,e){return dr(this,t).set(t,e),this}n(Nc,"mapCacheSet");ke.prototype.clear=wc;ke.prototype.delete=Cc;ke.prototype.get=Rc;ke.prototype.has=Ac;ke.prototype.set=Nc;function ur(t,e){for(var r=t.length;r--;)if(Fc(t[r][0],e))return r;return-1}n(ur,"assocIndexOf");function Ic(t){if(!fi(t)||qc(t))return!1;var e=Uc(t)||lc(t)?hc:sc;return e.test(Dc(t))}n(Ic,"baseIsNative");function dr(t,e){var r=t.__data__;return kc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(dr,"getMapData");function di(t,e){var r=pc(t,e);return Ic(r)?r:void 0}n(di,"getNative");function kc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(kc,"isKeyable");function qc(t){return!!ai&&ai in t}n(qc,"isMasked");function Dc(t){if(t!=null){try{return ui.call(t)}catch{}try{return t+""}catch{}}return""}n(Dc,"toSource");function bo(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(rc);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(bo.Cache||ke),r}n(bo,"memoize");bo.Cache=ke;function Fc(t,e){return t===e||t!==t&&e!==e}n(Fc,"eq");function Uc(t){var e=fi(t)?fc.call(t):"";return e==oc||e==nc}n(Uc,"isFunction");function fi(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(fi,"isObject");hi.exports=bo});var fr,_o,Pt,wt,hr,mi,gi,Lc,Mc,$c,jc,Vc,Ct,So,Hc,yi,Rt,Gc,ge,ye=O(()=>{fr=fe(Tt()),_o=n((...t)=>JSON.stringify(t),"memoizeKey"),Pt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),wt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),hr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),mi=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),gi=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Lc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Mc=(0,fr.default)(Pt(wt((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=gi([["session_id",e],["page_type",1],["p",Lc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),_o),$c=(0,fr.default)(Pt(wt(hr((t=1,e="place")=>[`/orders/?${gi([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),_o),jc=(0,fr.default)(Pt(wt(hr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),_o),Vc=Pt(wt(hr(mi((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),Ct=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"),Hc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),yi=n(t=>[...new Set(t&&t.split(/\s+/))].filter(So).sort(Hc),"parseFrequenciesList"),Rt=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"),Gc=Pt(wt(hr(mi((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Ct(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ge={fetchOffer:Mc,fetchOrders:$c,fetchItems:jc,createOneTime:Vc,convertOneTimeToSubscription:Gc}});var Eo,L,At=O(()=>{q();Eo=Nt(),L={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Eo==null?void 0:Eo.dataset.shopifySellingPlans)!="undefined"}});function Bc(t,e){return t===e}function zc(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}function Yc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bc,r=null,o=null;return function(){return zc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Wc(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}function Jc(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=Wc(s),f=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),d=t(function(){for(var m=[],b=l.length,x=0;x<b;x++)m.push(l[x].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}}var ee,bi=O(()=>{n(Bc,"defaultEqualityCheck");n(zc,"areArgumentsShallowlyEqual");n(Yc,"defaultMemoize");n(Wc,"getDependencies");n(Jc,"createSelectorCreator");ee=Jc(Yc)});function Kc(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}function Qc(t,e,r){let o=Rt(r);return L.shopify_selling_plans?ie(t,e,o):o}var J,D,It,_i,xo,Zc,Xc,ep,tp,rp,te,mr,Si,re,gr,oe,H,ne,Ze,vo,G,Xe,N=O(()=>{bi();J=fe(Tt());ye();At();q();J.default.Cache=Map;n(Kc,"arraysEqual");n(Qc,"resolveFrequency");D=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))||Kc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),It=n(t=>t.optedin||[],"optedinSelector"),_i=n(t=>t.optedout||[],"optedoutSelector"),xo=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Zc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Xc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),ep=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),tp=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),rp=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),te=(0,J.default)(t=>ee(It,_i,xo,(e,r,o)=>{let i=e.find(s=>D(t,s));return i||(r.find(s=>D(t,s))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),mr=(0,J.default)(t=>ee(It,e=>{let r=e.find(o=>D(t,o));return r||!1}),t=>JSON.stringify(t)),Si=(0,J.default)(t=>ee(It,e=>e.some(r=>D(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),re=(0,J.default)(t=>ee(rp,e=>e[t.id]||null),t=>JSON.stringify(t)),gr=(0,J.default)(t=>ee(_i,e=>e.find(r=>D(t,r)))),oe=(0,J.default)(t=>ee(te(t),e=>e&&e.frequency||null)),H=(0,J.default)(t=>ee(te(t),e=>e&&e.prepaidShipments||null)),ne=(0,J.default)(t=>ee(tp,e=>{var o;return(((o=e[T(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),Ze=(0,J.default)(t=>ee(Zc,Xc,ep,(e,r,o)=>e[T(t)]&&Qc(r,o,e[T(t)])||null)),vo=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),G=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(vo(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Xe=n(t=>({templates:t.templates||[]}),"templatesSelector")});function yr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function Nt(){return document.querySelector([`script[src^="https://${pr}"]`,`script[src^="https://${lr}"]`,`script[src^="http://${pr}"]`,`script[src^="http://${lr}"]`].join(","))}function Oo(){let t=Nt();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(Ae)?Ae:Ne,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function xi(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Oo();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===Ne?pr:lr}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function Oi(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function Ti(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)}function tt(t,e){let[[r],o]=t.reduce((i,s)=>i[D(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}var T,Ei,To,vi,et,be,br,ie,q=O(()=>{At();$();N();n(yr,"onReady");n(Nt,"getMainJs");n(Oo,"resolveEnvAndMerchant");T=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=L)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),Ei=n((t,e)=>{var r;if(L.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"),To=n((t,e)=>{var o;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]:t},"frequencyToSellingPlan");n(xi,"autoInitializeOffers");vi=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(Oi,"getCookieValue");et=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),be=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),br=n((t=[],e=[])=>{var r;return!!(((r=L)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),ie=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");n(Ti,"getOrCreateHidden");n(tt,"getMatchingProductIfExists")});var K,rt,Pi,_r,Se,wi,Ci,wo,op,kt,_e,Ri,Sr,Ai,np,Co,Ro,Er,Ao,Ni,qe,Po,ip,Ii,ki,sp,ap,cp,pp,qi,Di,Fi,Ui,Li,Mi,$i,A=O(()=>{Zn();$();ye();q();K=n((t,e,r)=>({type:k,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),rt=n((t,e)=>({type:F,payload:{product:t,offer:e}}),"optoutProduct"),Pi=n((t,e)=>({type:_t,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),_r=n((t,e,r)=>({type:U,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),Se=n((t,e,r)=>({type:le,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments"),wi=n(t=>({type:ri,payload:{product:t}}),"concludeUpsell"),Ci=n(t=>({type:Ge,payload:t}),"setMerchantId"),wo=n(t=>({type:Be,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),op=n(t=>({type:Xn,payload:t}),"requestAuth"),kt=n((t,e,r,o)=>({type:Zt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),_e=n(t=>({type:we,payload:t}),"unauthorized"),Ri=n(t=>({type:Qt,payload:t}),"setAuthUrl"),Sr=n(t=>({type:ii,payload:t}),"fetchDone"),Ai=n((t=Qn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(_e({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=op(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(kt(i,c,p,l)),c=>r(_e(c))).finally(()=>r(Sr(a)))},"fetchAuthThunk"),"fetchAuth"),np=n((t,e)=>({type:ei,payload:{status:t,ordering:e}}),"requestOrders"),Co=n(t=>({type:Xt,payload:t}),"receiveOrders"),Ro=n(t=>({type:er,payload:t}),"receiveItems"),Er=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(_e("No auth set."));let c=np(t,e);return o(c),ge.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(Co(p));let l=(p.results[0]||{}).public_id;if(l)return ge.fetchItems(s,a,l).then(f=>o(Ro(f)))}return o(_e(p.detail)),null},p=>o(_e(p))).finally(()=>o(Sr(c)))},"fetchOrdersThunk"),"fetchOrders"),Ao=n(t=>{switch(t){case cr:return{type:Ye,payload:t};case Ae:return{type:ze,payload:t};case Ne:return{type:We,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Ni=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(wo(r)),o},"requestSessionId"),qe=n((t,e)=>({type:R,payload:{...t,offer:e}}),"receiveOffer"),Po=n(t=>({type:ti,payload:t}),"fetchResponseError"),ip=n((t,e=Re,r)=>({type:Z,payload:{product:t,module:e,offer:r}}),"requestOffer"),Ii=n((t,e=Re,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:p}}=s(),l=ip(t,e,r);i(l);let f=T(t);return f?ge.fetchOffer(p,a,c,f,e).then(d=>i(qe(d,r)),d=>i(Po(d))).finally(()=>i(Sr(l))):null},"fetchOfferThunk"),"fetchOffer"),ki=n(()=>({type:Je}),"checkout"),sp=n((t,e,r,o)=>({type:oi,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),ap=n(t=>({type:tr,payload:t}),"receiveCreateOneTime"),cp=n((t,e)=>({type:ni,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),pp=n((t,e)=>({type:rr,payload:{response:t,product:e}}),"receiveConvertOneTime"),qi=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(_e("No auth set."));let b=Ei(i,l),x=sp(t,e,r,m);return a(x),(d?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:m}):ge.createOneTime(f,p,t.id,e,r,m)).then(h=>(a(ap(h)),o?(a(cp(h,b)),(d?Promise.resolve({item:h,frequency:b}):ge.convertOneTimeToSubscription(f,p,h,b,m)).then(v=>a(pp(v,t)),v=>a(Po(v)))):h),h=>a(Po(h))).finally(()=>a(Sr(x)))},"createIuThunk"),"createIu"),Di=n(t=>({type:or,payload:t}),"setLocale"),Fi=n(t=>({type:Ke,payload:t}),"setConfig"),Ui=n((t,e,r)=>({type:nr,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Li=n(t=>({type:ir,payload:t}),"setTemplates"),Mi=n((t,e)=>({type:sr,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),$i=n((t,e)=>({type:ar,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Do,De,Fe=O(()=>{Do=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,De=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var B,Fo,ns,nt,Ee,is,Dt,se,Or,xe=O(()=>{B=`{{lit-${String(Math.random()).slice(2)}}}`,Fo=`<!--${B}-->`,ns=new RegExp(`${B}|${Fo}`),nt="$lit$",Ee=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,x=0;for(let h=0;h<b;h++)is(m[h].name,nt)&&x++;for(;x-- >0;){let h=l[p],v=Or.exec(h)[2],C=v.toLowerCase()+nt,S=d.getAttribute(C);d.removeAttribute(C);let _=S.split(ns);this.parts.push({type:"attribute",index:c,name:v,strings:_}),p+=_.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let m=d.data;if(m.indexOf(B)>=0){let b=d.parentNode,x=m.split(ns),h=x.length-1;for(let v=0;v<h;v++){let C,S=x[v];if(S==="")C=se();else{let _=Or.exec(S);_!==null&&is(_[2],nt)&&(S=S.slice(0,_.index)+_[1]+_[2].slice(0,-nt.length)+_[3]),C=document.createTextNode(S)}b.insertBefore(C,d),this.parts.push({type:"node",index:++c})}x[h]===""?(b.insertBefore(se(),d),o.push(d)):d.data=x[h],p+=h}}else if(d.nodeType===8)if(d.data===B){let m=d.parentNode;(d.previousSibling===null||c===a)&&(c++,m.insertBefore(se(),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(B,m+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let d of o)d.parentNode.removeChild(d)}};n(Ee,"Template");is=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Dt=n(t=>t.index!==-1,"isTemplatePartActive"),se=n(()=>document.createComment(""),"createMarker"),Or=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Lo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,Uo,null,!1),s=Ft(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=Ft(o,s),a=o[s]}l.forEach(d=>d.parentNode.removeChild(d))}function ss(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,Uo,null,!1),a=Ft(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=bp(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Ft(i,a);return}a=Ft(i,a)}}var Uo,bp,Ft,as=O(()=>{xe();Uo=133;n(Lo,"removeNodesFromTemplate");bp=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Uo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Ft=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Dt(o))return r}return-1},"nextActiveIndexInTemplateParts");n(ss,"insertNodeIntoTemplate")});var _p,Ue,Mo=O(()=>{_p=new WeakMap,Ue=n(t=>typeof t=="function"&&_p.has(t),"isDirective")});var j,Tr,$o=O(()=>{j={},Tr={}});var ue,Pr=O(()=>{Fe();xe();ue=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=Do?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],!Dt(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 Do&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ue,"TemplateInstance")});var cs,Ep,ae,wr=O(()=>{Fe();xe();cs=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Ep=` ${B} `,ae=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=Or.exec(s);c===null?r+=s+(o?Ep:Fo):r+=s.substr(0,c.index)+c[1]+c[2]+nt+c[3]+B}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return cs!==void 0&&(r=cs.createHTML(r)),e.innerHTML=r,e}};n(ae,"TemplateResult")});var Rr,Cr,Le,it,ce,st,at,Ut,ps,ct,xp,Ar=O(()=>{Mo();Fe();$o();Pr();wr();xe();Rr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),Cr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Le=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let i=0;i<o.length-1;i++)this.parts[i]=this._createPart()}_createPart(){return new it(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let s=o[0].value;if(typeof s=="symbol")return String(s);if(typeof s=="string"||!Cr(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(Rr(c)||!Cr(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(Le,"AttributeCommitter");it=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==j&&(!Rr(e)||e!==this.value)&&(this.value=e,Ue(e)||(this.committer.dirty=!0))}commit(){for(;Ue(this.value);){let e=this.value;this.value=j,e(this)}this.value!==j&&this.committer.commit()}};n(it,"AttributePart");ce=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(se()),this.endNode=e.appendChild(se())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=se()),e.__insert(this.endNode=se())}insertAfterPart(e){e.__insert(this.startNode=se()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ue(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=j,r(this)}let e=this.__pendingValue;e!==j&&(Rr(e)?e!==this.value&&this.__commitText(e):e instanceof ae?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):Cr(e)?this.__commitIterable(e):e===Tr?(this.value=Tr,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 ue&&this.value.template===r)this.value.update(e.values);else{let o=new ue(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 ce(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){De(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ce,"NodePart");st=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Ue(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=j,r(this)}if(this.__pendingValue===j)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=j}};n(st,"BooleanAttributePart");at=class extends Le{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Ut(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(at,"PropertyCommitter");Ut=class extends it{};n(Ut,"PropertyPart");ps=!1;(()=>{try{let t={get capture(){return ps=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();ct=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=i=>this.handleEvent(i)}setValue(e){this.__pendingValue=e}commit(){for(;Ue(this.__pendingValue);){let s=this.__pendingValue;this.__pendingValue=j,s(this)}if(this.__pendingValue===j)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=xp(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=j}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ct,"EventPart");xp=n(t=>t&&(ps?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function jo(t){let e=Me.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Me.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(B);return r=e.keyString.get(o),r===void 0&&(r=new Ee(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Me,Nr=O(()=>{xe();n(jo,"templateFactory");Me=new Map});var ve,Vo,Ho=O(()=>{Fe();Ar();Nr();ve=new WeakMap,Vo=n((t,e,r)=>{let o=ve.get(e);o===void 0&&(De(e,e.firstChild),ve.set(e,o=new ce(Object.assign({templateFactory:jo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Lt,Go,Bo=O(()=>{Ar();Lt=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new at(e,r.slice(1),o).parts:s==="@"?[new ct(e,r.slice(1),i.eventContext)]:s==="?"?[new st(e,r.slice(1),o)]:new Le(e,r,o).parts}handleTextExpression(e){return new ce(e)}};n(Lt,"DefaultTemplateProcessor");Go=new Lt});var u,zo=O(()=>{Bo();wr();Bo();Mo();Fe();$o();Ar();Ho();Nr();Pr();wr();xe();typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");u=n((t,...e)=>new ae(t,e,"html",Go),"html")});var us,Ir,Op,Tp,Pp,ds,wp,fs,hs=O(()=>{Fe();as();Ho();Nr();Pr();xe();zo();us=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Ir=!0;typeof window.ShadyCSS>"u"?Ir=!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."),Ir=!1);Op=n(t=>e=>{let r=us(e.type,t),o=Me.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Me.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(B);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();Ir&&window.ShadyCSS.prepareTemplateDom(a,t),i=new Ee(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Tp=["html","svg"],Pp=n(t=>{Tp.forEach(e=>{let r=Me.get(us(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)}),Lo(o,s)})})},"removeStylesFromLitTemplates"),ds=new Set,wp=n((t,e,r)=>{ds.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}Pp(t);let c=o.content;r?ss(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),Lo(r,l)}},"prepareTemplateStyles"),fs=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=ve.has(e),s=Ir&&e.nodeType===11&&!!e.host,a=s&&!ds.has(o),c=a?document.createDocumentFragment():e;if(Vo(t,c,Object.assign({templateFactory:Op(o)},r)),a){let p=ve.get(c);ve.delete(c);let l=p.value instanceof ue?p.value.template:void 0;wp(o,c,l),De(e,e.firstChild),e.appendChild(c),ve.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render")});var ms,Zo,gs,Yo,Wo,Jo,Ko,Qo,Xo,pt,en=O(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Zo={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}},gs=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Yo={attribute:!0,type:String,converter:Zo,reflect:!1,hasChanged:gs},Wo=1,Jo=1<<2,Ko=1<<3,Qo=1<<4,Xo="finalized",pt=class extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let i=this._attributeNameForProperty(o,r);i!==void 0&&(this._attributeToPropertyMap.set(i,o),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=Yo){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)||Yo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Xo)||e.finalize(),this[Xo]=!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=gs){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||Zo,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||Zo.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=Yo){let i=this.constructor,s=i._attributeNameForProperty(e,o);if(s!==void 0){let a=i._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Ko,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Ko}}_attributeToProperty(e,r){if(this._updateState&Ko)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|Qo,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~Qo}}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&Qo)&&(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|Jo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Jo}get hasUpdated(){return this._updateState&Wo}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&Wo||(this._updateState=this._updateState|Wo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Jo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(pt,"UpdatingElement");ms=Xo;pt[ms]=!0});var ys,Tf,bs=O(()=>{ys=Element.prototype,Tf=ys.msMatchesSelector||ys.webkitMatchesSelector});var kr,tn,lt,_s,Cp,y,rn=O(()=>{kr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,tn=Symbol(),lt=class{constructor(e,r){if(r!==tn)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(kr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(lt,"CSSResult");_s=n(t=>new lt(String(t),tn),"unsafeCSS"),Cp=n(t=>{if(t instanceof lt)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+Cp(i)+t[s+1],t[0]);return new lt(r,tn)},"css")});var Ss,P,E=O(()=>{hs();en();en();bs();zo();rn();rn();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");Ss={},P=class extends pt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((s,a)=>s.reduceRight((c,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&&!kr){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return _s(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):kr?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!==Ss&&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 Ss}};n(P,"LitElement");P.finalized=!0;P.render=fs});var qr=Pe((Ff,Es)=>{var Rp={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};Es.exports=Rp});var vs=Pe((Uf,xs)=>{var $e=qr(),Ap=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case $e.PAR_OPEN:case $e.PAR_CLOSE:case $e.OP_NOT:case $e.BINARY_AND:case $e.BINARY_OR:e&&(r.push({type:$e.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:$e.LITERAL,value:e}),r},"Tokenizer");xs.exports=Ap});var Ts=Pe((Lf,Os)=>{var Oe=qr(),Np=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case Oe.LITERAL:e.unshift(i);break;case Oe.BINARY_AND:case Oe.BINARY_OR:case Oe.OP_NOT:case Oe.PAR_OPEN:r.push(i);break;case Oe.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==Oe.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===Oe.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),Ip=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Os.exports={PolishNotation:Np,PolishGenerator:Ip}});var ws=Pe((Mf,Ps)=>{var V=qr(),z=class{constructor(e,r,o,i){this.op=e,this.left=r,this.right=o,this.literal=i}isLeaf(){return this.op===V.LEAF}isAtomic(){return this.isLeaf()||this.op===V.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new z(V.BINARY_AND,e,r)}static CreateNot(e){return new z(V.OP_NOT,e)}static CreateOr(e,r){return new z(V.BINARY_OR,e,r)}static CreateLiteral(e){return new z(V.LEAF,null,null,e)}};n(z,"ExpNode");var ut=n(t=>{let e=t.next().value;switch(e.type){case V.LITERAL:return z.CreateLiteral(e.value);case V.OP_NOT:return z.CreateNot(ut(t));case V.BINARY_AND:{let r=ut(t),o=ut(t);return z.CreateAnd(r,o)}case V.BINARY_OR:{let r=ut(t),o=ut(t);return z.CreateOr(r,o)}}return null},"make"),dt=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===V.OP_NOT)return!dt(t.left,e);if(t.op===V.BINARY_OR)return dt(t.left,e)||dt(t.right,e);if(t.op===V.BINARY_AND)return dt(t.left,e)&&dt(t.right,e)},"nodeEvaluator");Ps.exports={make:ut,nodeEvaluator:dt}});var Ns=Pe(($f,As)=>{var kp=vs(),Cs=Ts(),Rs=ws(),qp=n((t,e)=>{let r=kp(t),o=Cs.PolishNotation(r),i=Cs.PolishGenerator(o),s=Rs.make(i);return Rs.nodeEvaluator(s,e)},"parse");As.exports={parse:qp}});var da={};co(da,{TestWizard:()=>Gt,default:()=>fl});var Gt,fl,fa=O(()=>{E();A();Gt=class extends P{static get styles(){return y`
13
- :host {
14
- position: fixed;
15
- top: 5em;
16
- righit: 5em;
17
- background-color: rgba(255, 255, 255, 0.7);
18
- width: 400px;
19
- padding: 1em;
20
- border-radius: 5px;
21
- border: 1px solid #ccc;
22
- box-shadow: 2px 2px 0 0 #000;
23
- }
24
-
25
- button {
26
- margin: 0 0.5em 0.5em;
27
- background-color: gray;
28
- color: white;
29
- border: 0;
30
- border-radius: 3px;
31
- cursor: pointer;
32
- padding: 0.5em;
33
- }
34
-
35
- button.primary {
36
- background-color: blue;
37
- padding: 1em;
38
- color: white;
39
- border: 0;
40
- border-radius: 3px;
41
- }
42
-
43
- button[disabled] {
44
- background-color: #777;
45
- }
46
-
47
- div {
48
- margin-bottom: 0.5em;
49
- }
50
-
51
- .message {
52
- margin-left: 0.5em;
53
- margin: 1em;
54
- }
55
-
56
- .success {
57
- color: green;
58
- }
59
-
60
- .error {
61
- color: red;
62
- }
63
-
64
- .warning {
65
- color: orange;
66
- }
67
- a {
68
- color: white;
69
- }
70
- `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),i=r.getAttribute("product"),s=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(i,s).concat(this.getOfferRequestMessages(i,o)),product:i};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],i=r.autoshipEligible[e],s=[];return e&&o===!1&&s.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&i===!1&&s.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&i===null&&s.push({name:"This product does not exist in our database",type:"error"}),s}resultsCodeBlock(){return this.results.length===0?u`
71
- <div class="message error">No offer element found on the page</div>
72
- `:this.results.map((e,r)=>u`
73
- <div>For offer tag with product = "${e.product}"</div>
74
- ${e.messages.map(o=>u`
75
- <div class="message ${o.type}">
76
- ${o.name}
77
- </div>
78
- `)}
79
- <button @click=${this.toggleProductFlags(r,{})}>
80
- Set inStock and eligible
81
- </button>
82
- <br />
83
- <button @click=${this.toggleProductFlags(r,{inStock:!1})}>
84
- Set to not inStock
85
- </button>
86
- <br />
87
- <button @click=${this.toggleProductFlags(r,{autoship:!1})}>
88
- Set to not eligible
89
- </button>
90
- <br />
91
- <button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
92
- Set to not eligible and not in stock
93
- </button>
94
- <br />
95
- <button @click=${this.toggleUpsellPreview(r)}>
96
- Toggle upsell/regular in this offer
97
- </button>
98
- <br />
99
- <button @click=${this.toggleUpsellNextOrder(r)}>
100
- upsell product is in next order
101
- </button>
102
- <br />
103
- `)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:i=["subscription","upsell"]}){return s=>{s.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(qe({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(Ro({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return u`
104
- <div>
105
- ${this.testsRan?this.resultsCodeBlock():u`
106
- <div>Click the button to run tests</div>
107
- `}
108
- <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
109
- </div>
110
- `}};n(Gt,"TestWizard");fl=Gt});var ku={};co(ku,{addOptinChangedCallback:()=>uu,addTemplate:()=>du,autoInit:()=>Nu,clear:()=>fu,config:()=>hu,default:()=>Iu,disableOptinChangedCallbacks:()=>mu,getOptins:()=>gu,getProductsForPurchasePost:()=>yu,initialize:()=>bu,isReady:()=>lu,offers:()=>w,platform:()=>L,previewMode:()=>_u,register:()=>Su,resolveSettings:()=>Eu,setAuthUrl:()=>xu,setEnvironment:()=>vu,setLocale:()=>Ou,setMerchantId:()=>Tu,setPublicPath:()=>Pu,setTemplates:()=>wu,setupCart:()=>Cu,setupProduct:()=>Ru,setupProducts:()=>Au,store:()=>Ma});function po(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(po,"symbolObservablePonyfill");var He;typeof self<"u"?He=self:typeof window<"u"||typeof window<"u"?He=window:typeof module<"u"?He=module:He=Function("return this")();var za=po(He),lo=za;var uo=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),bt={INIT:"@@redux/INIT"+uo(),REPLACE:"@@redux/REPLACE"+uo(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+uo()},"PROBE_UNKNOWN_ACTION")};function Ya(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(Ya,"isPlainObject");function fo(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(fo)(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 v=!0;return l(),c.push(h),n(function(){if(!!v){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.");v=!1,l();var S=c.indexOf(h);c.splice(S,1),a=null}},"unsubscribe")}n(d,"subscribe");function m(h){if(!Ya(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 v=a=c,C=0;C<v.length;C++){var S=v[C];S()}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:bt.REPLACE})}n(b,"replaceReducer");function x(){var h,v=d;return h={subscribe:n(function(S){if(typeof S!="object"||S===null)throw new TypeError("Expected the observer to be an object.");function _(){S.next&&S.next(f())}n(_,"observeState"),_();var zt=v(_);return{unsubscribe:zt}},"subscribe")},h[lo]=function(){return this},h}return n(x,"observable"),m({type:bt.INIT}),o={dispatch:m,subscribe:d,getState:f,replaceReducer:b},o[lo]=x,o}n(fo,"createStore");function Wa(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(Wa,"getUndefinedStateErrorMessage");function Ja(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:bt.INIT});if(typeof o>"u")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:bt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+bt.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(Ja,"assertReducerShape");function Yt(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{Ja(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={},x=0;x<s.length;x++){var h=s[x],v=r[h],C=l[h],S=v(C,f);if(typeof S>"u"){var _=Wa(h,f);throw new Error(_)}b[h]=S,m=m||S!==C}return m=m||s.length!==Object.keys(l).length,m?b:l},"combination")}n(Yt,"combineReducers");function jn(t,e){return function(){return e(t.apply(this,arguments))}}n(jn,"bindActionCreator");function Hn(t,e){if(typeof t=="function")return jn(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]=jn(i,e))}return r}n(Hn,"bindActionCreators");function Ka(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ka,"_defineProperty");function Vn(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(Vn,"ownKeys");function Qa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Vn(r,!0).forEach(function(o){Ka(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Vn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Qa,"_objectSpread2");function ho(){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(ho,"compose");function Gn(){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=ho.apply(void 0,c)(i.dispatch),Qa({},i,{dispatch:s})}}}n(Gn,"applyMiddleware");function Bn(t){var e=n(function(o){var i=o.dispatch,s=o.getState;return function(a){return function(c){return typeof c=="function"?c(i,s,t):a(c)}}},"middleware");return e}n(Bn,"createThunkMiddleware");var zn=Bn();zn.withExtraArgument=Bn;var Yn=zn;var Vi=fe(Jt());A();$();var qt="OG_STATE",Hi=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),No=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Gi=n(()=>No()?{}:Hi(localStorage.getItem(qt)),"loadState"),lp=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"),Bi=n(t=>{if(No())return;let e=lp(t);e&&localStorage.getItem(qt)!==e&&localStorage.setItem(qt,e)},"saveState"),zi=n(t=>(0,Vi.throttle)(500,e=>{if(No())return;let{key:r,newValue:o}=e;r===qt&&o===null?(t.dispatch({type:he}),setTimeout(()=>t.dispatch(Ni()),0)):r===qt&&t.dispatch({type:Ce,newValue:Hi(o)})}),"listenLocalStorageChanges");var Wi=fe(Jt());$();N();var up=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Yi=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>up("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),dp=[{expressions:[({type:t}={})=>t===k,({type:t}={})=>t===U],fn:Yi(!0)},{expressions:[({type:t}={})=>t===F],fn:Yi(!1)}],Ji=n(t=>e=>r=>{let o=t.getState();dp.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Ki=n(t=>e=>r=>{var i;let o;switch(r.type){case R:case F:case k:case U: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"),Qi=n(t=>e=>r=>{e(r);let o=(0,Wi.throttle)(500,()=>{Bi({...t.getState()})});r.type!==Ce&&o()},"localStorageMiddleware");A();$();var Io=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Zi(t){let[e,r]=Io(),[o,i]=Io(),[s,a]=Io();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(wo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;window.addEventListener("storage",zi(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(Ai())}),p=>async l=>{Ye===l.type||ze===l.type||We===l.type?r(l.payload):Ge===l.type?i(l.payload):Be===l.type?a(l.payload):await c,p(l)}}n(Zi,"waitUntilOffersReady");function Xi(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"}):ho,i=[Zi,Yn,Ji,Ki],s={};if(!r)try{s=Gi(),i.push(Qi)}catch{}let a=o(Gn(...i,...e.filter(p=>p))),c=fo(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Xi,"makeStore");var fp=Object.defineProperty,xr=n((t,e)=>fp(t,"name",{value:e,configurable:!0}),"i"),hp=xr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),ts=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000","http://localhost:3010","http://0.0.0.0:3010",window.location.origin],es=xr(t=>(e,r)=>{ts.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function ko(t=window.opener,e=window.og){let r=xr(o=>{let i=hp(ts),s=es(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.3-alpha-PR-789-7.14+204844d5/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),es(t)("READY"))}n(ko,"h");xr(ko,"offersLiveEditor");var vr=null,mp=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),rs=n(t=>{if(!vr)throw new Error("Missing redux store.");return vr},"resolveStore"),gp=n((t,e)=>r=>{let{getState:o,dispatch:i}=rs(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=mp)=>r=>{let i=gp(t,typeof e=="function"?e:s=>Hn(e,s));return class extends r{get store(){return vr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=rs(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"),os=n(t=>{vr=t},"setStore");ye();var qo=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],...Ct(r.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),ot=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([i,s])=>{let a={};s&&!Array.isArray(s)?a=s:a={frequency:i,prepaidShipments:null,regularPrice:s[0],subscriptionPrice:s[2],discountRate:s[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");A();E();var Ls=fe(Ns());E();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"),Is=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Mt=n(t=>{let e=Is(t);if(!e){let r=t.offer;r&&(e=Is(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"),on=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"),I=n(t=>class extends on(t){get product(){return Mt(this)}},"withProduct"),Dr=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 Fr={};co(Fr,{autoshipByDefault:()=>Up,eligibilityGroups:()=>sn,eligible:()=>ks,hasPrepaidOptions:()=>Vp,hasUpcomingOrder:()=>Fs,hasUpsellGroup:()=>Ds,inStock:()=>nn,optedout:()=>$p,prepaidEligible:()=>Lp,prepaidSubscribed:()=>jp,regularEligible:()=>Gp,subscribed:()=>Mp,subscriptionEligible:()=>qs,upcomingOrderContainsProduct:()=>Hp,upsellEligible:()=>Us});N();q();var nn=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ks=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Up=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),qs=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ks(t,e)&&nn(t,e),"subscriptionEligible"),sn=n((t,e)=>{let r=T((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),Ds=n((t,e)=>{let r=sn(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Lp=n((t,e)=>{let r=sn(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Mp=n((t,e)=>mr(e.product)(t),"subscribed"),$p=n((t,e)=>gr(e.product)(t),"optedout"),jp=n((t,e)=>Si(e.product)(t),"prepaidSubscribed"),Vp=n((t,e)=>ne(e.product.id)(t).length>0,"hasPrepaidOptions"),Fs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Hp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Us=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&nn(t,e)&&Fs(t)&&Ds(t,e)},"upsellEligible"),Gp=n((t,e)=>qs(t,e)&&!Us(t,e),"regularEligible");var Bp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Ur=class extends I(P){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return u``;let e=Bp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),Ls.default.parse(e,o=>Fr[o]&&Fr[o](this.state,this))?u`
11
+ var lib=(()=>{var da=Object.create;var ct=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var ha=Object.getOwnPropertyNames;var ma=Object.getPrototypeOf,ga=Object.prototype.hasOwnProperty;var n=(t,e)=>ct(t,"name",{value:e,configurable:!0});var be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),yn=(t,e)=>{for(var r in e)ct(t,r,{get:e[r],enumerable:!0})},bn=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ha(e))!ga.call(t,i)&&i!==r&&ct(t,i,{get:()=>e[i],enumerable:!(o=fa(e,i))||o.enumerable});return t};var ae=(t,e,r)=>(r=t!=null?da(ma(t)):{},bn(e||!t||!t.__esModule?ct(r,"default",{value:t,enumerable:!0}):r,t)),ya=t=>bn(ct({},"__esModule",{value:!0}),t);var Mt=be((Lt,Pn)=>{(function(t,e){typeof Lt=="object"&&typeof Pn<"u"?e(Lt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Lt,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 h(){for(var T=arguments.length,S=new Array(T),m=0;m<T;m++)S[m]=arguments[m];var E=this,P=Date.now()-l;if(p)return;function _(){l=Date.now(),s.apply(E,S)}n(_,"exec");function b(){c=void 0}n(b,"clear"),a&&!c&&_(),f(),a===void 0&&P>o?_():i!==!0&&(c=setTimeout(a?b:_,a===void 0?o-P:o))}return n(h,"wrapper"),h.cancel=d,h}n(e,"throttle");function r(o,i,s){return s===void 0?e(o,i,!1):e(o,s,i!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var gt=be((du,Bn)=>{var Ca="Expected a function",Mn="__lodash_hash_undefined__",Ra="[object Function]",Aa="[object GeneratorFunction]",Na=/[\\^$.*+?()[\]{}|]/g,Ia=/^\[object .+?Constructor\]$/,ka=typeof window=="object"&&window&&window.Object===Object&&window,qa=typeof self=="object"&&self&&self.Object===Object&&self,$n=ka||qa||Function("return this")();function Da(t,e){return t?.[e]}n(Da,"getValue");function Fa(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(Fa,"isHostObject");var Ua=Array.prototype,La=Function.prototype,jn=Object.prototype,eo=$n["__core-js_shared__"],Ln=function(){var t=/[^.]+$/.exec(eo&&eo.keys&&eo.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Vn=La.toString,to=jn.hasOwnProperty,Ma=jn.toString,$a=RegExp("^"+Vn.call(to).replace(Na,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ja=Ua.splice,Va=Hn($n,"Map"),mt=Hn(Object,"create");function Oe(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(Oe,"Hash");function Ha(){this.__data__=mt?mt(null):{}}n(Ha,"hashClear");function Ga(t){return this.has(t)&&delete this.__data__[t]}n(Ga,"hashDelete");function Ba(t){var e=this.__data__;if(mt){var r=e[t];return r===Mn?void 0:r}return to.call(e,t)?e[t]:void 0}n(Ba,"hashGet");function za(t){var e=this.__data__;return mt?e[t]!==void 0:to.call(e,t)}n(za,"hashHas");function Ya(t,e){var r=this.__data__;return r[t]=mt&&e===void 0?Mn:e,this}n(Ya,"hashSet");Oe.prototype.clear=Ha;Oe.prototype.delete=Ga;Oe.prototype.get=Ba;Oe.prototype.has=za;Oe.prototype.set=Ya;function Ve(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(Ve,"ListCache");function Wa(){this.__data__=[]}n(Wa,"listCacheClear");function Ja(t){var e=this.__data__,r=tr(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():ja.call(e,r,1),!0}n(Ja,"listCacheDelete");function Ka(t){var e=this.__data__,r=tr(e,t);return r<0?void 0:e[r][1]}n(Ka,"listCacheGet");function Qa(t){return tr(this.__data__,t)>-1}n(Qa,"listCacheHas");function Za(t,e){var r=this.__data__,o=tr(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Za,"listCacheSet");Ve.prototype.clear=Wa;Ve.prototype.delete=Ja;Ve.prototype.get=Ka;Ve.prototype.has=Qa;Ve.prototype.set=Za;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,"MapCache");function Xa(){this.__data__={hash:new Oe,map:new(Va||Ve),string:new Oe}}n(Xa,"mapCacheClear");function ec(t){return rr(this,t).delete(t)}n(ec,"mapCacheDelete");function tc(t){return rr(this,t).get(t)}n(tc,"mapCacheGet");function rc(t){return rr(this,t).has(t)}n(rc,"mapCacheHas");function oc(t,e){return rr(this,t).set(t,e),this}n(oc,"mapCacheSet");Te.prototype.clear=Xa;Te.prototype.delete=ec;Te.prototype.get=tc;Te.prototype.has=rc;Te.prototype.set=oc;function tr(t,e){for(var r=t.length;r--;)if(cc(t[r][0],e))return r;return-1}n(tr,"assocIndexOf");function nc(t){if(!Gn(t)||sc(t))return!1;var e=pc(t)||Fa(t)?$a:Ia;return e.test(ac(t))}n(nc,"baseIsNative");function rr(t,e){var r=t.__data__;return ic(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(rr,"getMapData");function Hn(t,e){var r=Da(t,e);return nc(r)?r:void 0}n(Hn,"getNative");function ic(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(ic,"isKeyable");function sc(t){return!!Ln&&Ln in t}n(sc,"isMasked");function ac(t){if(t!=null){try{return Vn.call(t)}catch{}try{return t+""}catch{}}return""}n(ac,"toSource");function ro(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ca);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(ro.Cache||Te),r}n(ro,"memoize");ro.Cache=Te;function cc(t,e){return t===e||t!==t&&e!==e}n(cc,"eq");function pc(t){var e=Gn(t)?Ma.call(t):"";return e==Ra||e==Aa}n(pc,"isFunction");function Gn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Gn,"isObject");Bn.exports=ro});var Sr=be((rf,Wi)=>{var tp={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"};Wi.exports=tp});var Ki=be((of,Ji)=>{var Ne=Sr(),rp=n(t=>{let e="",r=[];for(let o of t){let i=o.charCodeAt(0);switch(i){case Ne.PAR_OPEN:case Ne.PAR_CLOSE:case Ne.OP_NOT:case Ne.BINARY_AND:case Ne.BINARY_OR:e&&(r.push({type:Ne.LITERAL,value:e}),e=""),r.push({type:i,value:o});break;default:e+=o}}return e&&r.push({type:Ne.LITERAL,value:e}),r},"Tokenizer");Ji.exports=rp});var Zi=be((nf,Qi)=>{var ge=Sr(),op=n(t=>{let e=[],r=[];return t.forEach(i=>{switch(i.type){case ge.LITERAL:e.unshift(i);break;case ge.BINARY_AND:case ge.BINARY_OR:case ge.OP_NOT:case ge.PAR_OPEN:r.push(i);break;case ge.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ge.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ge.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),np=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Qi.exports={PolishNotation:op,PolishGenerator:np}});var es=be((sf,Xi)=>{var F=Sr(),$=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 $(F.BINARY_AND,e,r)}static CreateNot(e){return new $(F.OP_NOT,e)}static CreateOr(e,r){return new $(F.BINARY_OR,e,r)}static CreateLiteral(e){return new $(F.LEAF,null,null,e)}};n($,"ExpNode");var rt=n(t=>{let e=t.next().value;switch(e.type){case F.LITERAL:return $.CreateLiteral(e.value);case F.OP_NOT:return $.CreateNot(rt(t));case F.BINARY_AND:{let r=rt(t),o=rt(t);return $.CreateAnd(r,o)}case F.BINARY_OR:{let r=rt(t),o=rt(t);return $.CreateOr(r,o)}}return null},"make"),ot=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===F.OP_NOT)return!ot(t.left,e);if(t.op===F.BINARY_OR)return ot(t.left,e)||ot(t.right,e);if(t.op===F.BINARY_AND)return ot(t.left,e)&&ot(t.right,e)},"nodeEvaluator");Xi.exports={make:rt,nodeEvaluator:ot}});var ns=be((af,os)=>{var ip=Ki(),ts=Zi(),rs=es(),sp=n((t,e)=>{let r=ip(t),o=ts.PolishNotation(r),i=ts.PolishGenerator(o),s=rs.make(i);return rs.nodeEvaluator(s,e)},"parse");os.exports={parse:sp}});var ou={};yn(ou,{addOptinChangedCallback:()=>Dl,addTemplate:()=>Fl,autoInit:()=>tu,clear:()=>Ul,config:()=>Ll,default:()=>ru,disableOptinChangedCallbacks:()=>Ml,getOptins:()=>$l,getProductsForPurchasePost:()=>jl,initialize:()=>Vl,isReady:()=>ql,offers:()=>O,platform:()=>k,previewMode:()=>Hl,register:()=>Gl,resolveSettings:()=>Bl,setAuthUrl:()=>zl,setEnvironment:()=>Yl,setLocale:()=>Wl,setMerchantId:()=>Jl,setPublicPath:()=>Kl,setTemplates:()=>Ql,setupCart:()=>Zl,setupProduct:()=>Xl,setupProducts:()=>eu,store:()=>la});function Wr(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(Wr,"symbolObservablePonyfill");var qe;typeof self<"u"?qe=self:typeof window<"u"||typeof window<"u"?qe=window:typeof module<"u"?qe=module:qe=Function("return this")();var ba=Wr(qe),Jr=ba;var Kr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),pt={INIT:"@@redux/INIT"+Kr(),REPLACE:"@@redux/REPLACE"+Kr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Kr()},"PROBE_UNKNOWN_ACTION")};function _a(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(_a,"isPlainObject");function Qr(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(Qr)(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(m){if(typeof m!="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(m),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(m);c.splice(_,1),a=null}},"unsubscribe")}n(d,"subscribe");function h(m){if(!_a(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,s=i(s,m)}finally{p=!1}for(var E=a=c,P=0;P<E.length;P++){var _=E[P];_()}return m}n(h,"dispatch");function T(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");i=m,h({type:pt.REPLACE})}n(T,"replaceReducer");function S(){var m,E=d;return m={subscribe:n(function(_){if(typeof _!="object"||_===null)throw new TypeError("Expected the observer to be an object.");function b(){_.next&&_.next(f())}n(b,"observeState"),b();var Ft=E(b);return{unsubscribe:Ft}},"subscribe")},m[Jr]=function(){return this},m}return n(S,"observable"),h({type:pt.INIT}),o={dispatch:h,subscribe:d,getState:f,replaceReducer:T},o[Jr]=S,o}n(Qr,"createStore");function Sa(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(Sa,"getUndefinedStateErrorMessage");function Ea(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:pt.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:pt.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+pt.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(Ea,"assertReducerShape");function Ut(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{Ea(r)}catch(p){c=p}return n(function(l,f){if(l===void 0&&(l={}),c)throw c;if(!1)var d;for(var h=!1,T={},S=0;S<s.length;S++){var m=s[S],E=r[m],P=l[m],_=E(P,f);if(typeof _>"u"){var b=Sa(m,f);throw new Error(b)}T[m]=_,h=h||_!==P}return h=h||s.length!==Object.keys(l).length,h?T:l},"combination")}n(Ut,"combineReducers");function _n(t,e){return function(){return e(t.apply(this,arguments))}}n(_n,"bindActionCreator");function En(t,e){if(typeof t=="function")return _n(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]=_n(i,e))}return r}n(En,"bindActionCreators");function xa(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(xa,"_defineProperty");function Sn(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(Sn,"ownKeys");function va(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sn(r,!0).forEach(function(o){xa(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(va,"_objectSpread2");function Zr(){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(Zr,"compose");function xn(){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=Zr.apply(void 0,c)(i.dispatch),va({},i,{dispatch:s})}}}n(xn,"applyMiddleware");function vn(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(vn,"createThunkMiddleware");var On=vn();On.withExtraArgument=vn;var Tn=On;var bi=ae(Mt());var wn=/^og_auth=/,Oa=n((t=wn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(wn,""),"c"),$t=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"),Ta=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"),Pa=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");function Cn(){return typeof window.og_auth<"u"?$t(window.og_auth):null}n(Cn,"a");async function wa(t=100){return new Promise(e=>{setTimeout(()=>e(Cn()),t)})}n(wa,"f");async function Rn(t,e=Oa,r=Ta){let o;if(o=$t(Cn())||$t(e()),o)return o;if(t&&typeof t=="string"){let i=await fetch(t);i.status>=200&&i.status<300&&(o=e()||await(Pa(i)?i.json():Promise.resolve(r(t)).then(e)))}else o||(o=await wa());if(o=$t(o),o)return o;throw new Error("Unauthorized")}n(Rn,"u");var R="OPTIN_PRODUCT",N="OPTOUT_PRODUCT",I="PRODUCT_CHANGE_FREQUENCY",ne="PRODUCT_CHANGE_PREPAID_SHIPMENTS",De="SET_MERCHANT_ID",z="REQUEST_OFFER",w="RECEIVE_OFFER",lt="PRODUCT_HAS_CHANGED",Fe="CREATED_SESSION_ID",jt="SET_AUTH_URL",An="REQUEST_AUTH",Vt="AUTHORIZE",_e="UNAUTHORIZED",Nn="REQUEST_ORDERS",Ht="RECEIVE_ORDERS",ut="CART_PRODUCT_KEY_HAS_CHANGED",Gt="RECEIVE_ORDER_ITEMS",In="FETCH_RESPONSE_ERROR",Ue="SET_ENVIRONMENT_STAGING",Le="SET_ENVIRONMENT_DEV",Me="SET_ENVIRONMENT_PROD",kn="CONCLUDE_UPSELL",qn="REQUEST_CREATE_IU_ORDER",Bt="CREATE_ONE_TIME",Dn="REQUEST_CONVERT_ONE_TIME",zt="CONVERT_ONE_TIME";var $e="CHECKOUT",Fn="RECEIVE_FETCH",Yt="SET_LOCALE",je="SET_CONFIG",dt="SET_PREVIEW_STANDARD_OFFER",ft="SET_PREVIEW_UPSELL_OFFER",Xr="SET_PREVIEW_PREPAID_OFFER",Wt="ADD_TEMPLATE",Jt="SET_TEMPLATES",Se="LOCAL_STORAGE_CHANGE",ce="LOCAL_STORAGE_CLEAR",Kt="SET_FIRST_ORDER_PLACE_DATE",Qt="SET_PRODUCT_TO_SUBSCRIBE",V="RECEIVE_PRODUCT_PLANS",Y="SETUP_PRODUCT",pe="SETUP_CART",Ee="pdp",Zt="dev",xe="staging",ve="prod",Xt="static.ordergroove.com",er="staging.static.ordergroove.com",Un="og-cart-updated";var or=ae(gt());var oo=n((...t)=>JSON.stringify(t),"memoizeKey"),yt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),bt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,i={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,i]},"withHost"),nr=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,i={}]=t(...r);return[o,{...i,headers:{Authorization:JSON.stringify(e),...i.headers}}]},"withAuth"),zn=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,{method:"POST",...o,body:JSON.stringify(o.body),headers:{"Content-type":"application/json",...o.headers}}]},"withJsonBody"),Yn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),lc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),uc=(0,or.default)(yt(bt((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=Yn([["session_id",e],["page_type",1],["p",lc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${i}`]})),oo),dc=(0,or.default)(yt(bt(nr((t=1,e="place")=>[`/orders/?${Yn([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),oo),fc=(0,or.default)(yt(bt(nr(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),oo),hc=yt(bt(nr(zn((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),_t=n(t=>{if(typeof t=="object")return{...t};let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),no=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),mc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Wn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(no).sort(mc),"parseFrequenciesList");var St=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"),gc=yt(bt(nr(zn((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=_t(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),le={fetchOffer:uc,fetchOrders:dc,fetchItems:fc,createOneTime:hc,convertOneTimeToSubscription:gc};var io=Et(),k={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(io==null?void 0:io.dataset.shopifySellingPlans)!="undefined"};function yc(t,e){return t===e}n(yc,"defaultEqualityCheck");function bc(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(bc,"areArgumentsShallowlyEqual");function _c(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yc,r=null,o=null;return function(){return bc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(_c,"defaultMemoize");function Sc(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(Sc,"getDependencies");function Ec(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=Sc(s),f=t.apply(void 0,[function(){return c++,p.apply(null,arguments)}].concat(r)),d=t(function(){for(var h=[],T=l.length,S=0;S<T;S++)h.push(l[S].apply(null,arguments));return f.apply(null,h)});return d.resultFunc=p,d.dependencies=l,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(Ec,"createSelectorCreator");var W=Ec(_c);var H=ae(gt());H.default.Cache=Map;function xc(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(xc,"arraysEqual");function vc(t,e,r){let o=St(r);return k.shopify_selling_plans?X(t,e,o):o}n(vc,"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))||xc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),xt=n(t=>t.optedin||[],"optedinSelector"),Jn=n(t=>t.optedout||[],"optedoutSelector"),so=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Oc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Tc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Pc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),wc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Cc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),J=(0,H.default)(t=>W(xt,Jn,so,(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)),ir=(0,H.default)(t=>W(xt,e=>{let r=e.find(o=>A(t,o));return r||!1}),t=>JSON.stringify(t)),Kn=(0,H.default)(t=>W(xt,e=>e.some(r=>A(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),K=(0,H.default)(t=>W(Cc,e=>e[t.id]||null),t=>JSON.stringify(t)),sr=(0,H.default)(t=>W(Jn,e=>e.find(r=>A(t,r))));var Q=(0,H.default)(t=>W(J(t),e=>e&&e.frequency||null)),U=(0,H.default)(t=>W(J(t),e=>e&&e.prepaidShipments||null)),Z=(0,H.default)(t=>W(wc,e=>{var o;return(((o=e[x(t)])==null?void 0:o.map(({numberShipments:i})=>i))||[]).sort((i,s)=>i-s)})),He=(0,H.default)(t=>W(Oc,Tc,Pc,(e,r,o)=>e[x(t)]&&vc(r,o,e[x(t)])||null)),ao=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),L=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(ao(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ge=n(t=>({templates:t.templates||[]}),"templatesSelector");function ar(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}n(ar,"onReady");function Et(){return document.querySelector([`script[src^="https://${Xt}"]`,`script[src^="https://${er}"]`,`script[src^="http://${Xt}"]`,`script[src^="http://${er}"]`].join(","))}n(Et,"getMainJs");function co(){let t=Et();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(xe)?xe:ve,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}n(co,"resolveEnvAndMerchant");var x=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return(r=k)!=null&&r.shopify_selling_plans&&(e=e.split(":")[0]),e},"safeProductId"),Qn=n((t,e)=>{var r;if(k.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"),po=n((t,e)=>{var o;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]:t},"frequencyToSellingPlan");function Zn(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=co();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===ve?Xt:er}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}n(Zn,"autoInitializeOffers");var Xn=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");function ei(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}n(ei,"getCookieValue");var Be=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),ue=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),cr=n((t=[],e=[])=>{var r;return!!(((r=k)==null?void 0:r.shopify_selling_plans)&&t.length&&e.length)},"hasShopifySellingPlans"),X=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 ti(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(ti,"getOrCreateHidden");function ze(t,e){let[[r],o]=t.reduce((i,s)=>i[A(e,s)?0:1].push(s)&&i,[[],[]]);return[r||{},o||[]]}n(ze,"getMatchingProductIfExists");var G=n((t,e,r)=>({type:R,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Ye=n((t,e)=>({type:N,payload:{product:t,offer:e}}),"optoutProduct"),ri=n((t,e)=>({type:lt,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),pr=n((t,e,r)=>({type:I,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),fe=n((t,e,r)=>({type:ne,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments");var oi=n(t=>({type:kn,payload:{product:t}}),"concludeUpsell"),ni=n(t=>({type:De,payload:t}),"setMerchantId"),uo=n(t=>({type:Fe,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Rc=n(t=>({type:An,payload:t}),"requestAuth"),vt=n((t,e,r,o)=>({type:Vt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),de=n(t=>({type:_e,payload:t}),"unauthorized"),ii=n(t=>({type:jt,payload:t}),"setAuthUrl"),lr=n(t=>({type:Fn,payload:t}),"fetchDone"),si=n((t=Rn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(de({message:"Offers are running in preview mode"}));let{merchantId:i,authUrl:s}=o(),a=Rc(s);return r(a),t(s).then(({sig_field:c,ts:p,sig:l})=>r(vt(i,c,p,l)),c=>r(de(c))).finally(()=>r(lr(a)))},"fetchAuthThunk"),"fetchAuth"),Ac=n((t,e)=>({type:Nn,payload:{status:t,ordering:e}}),"requestOrders"),fo=n(t=>({type:Ht,payload:t}),"receiveOrders"),ho=n(t=>({type:Gt,payload:t}),"receiveItems"),ur=n((t=1,e="place")=>n(function(o,i){let{environment:{legoUrl:s},auth:a}=i();if(!a)return o(de("No auth set."));let c=Ac(t,e);return o(c),le.fetchOrders(s,a,t,e).then(p=>{if(p.results){o(fo(p));let l=(p.results[0]||{}).public_id;if(l)return le.fetchItems(s,a,l).then(f=>o(ho(f)))}return o(de(p.detail)),null},p=>o(de(p))).finally(()=>o(lr(c)))},"fetchOrdersThunk"),"fetchOrders"),mo=n(t=>{switch(t){case Zt:return{type:Le,payload:t};case xe:return{type:Ue,payload:t};case ve:return{type:Me,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),ai=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(uo(r)),o},"requestSessionId"),Pe=n((t,e)=>({type:w,payload:{...t,offer:e}}),"receiveOffer"),lo=n(t=>({type:In,payload:t}),"fetchResponseError"),Nc=n((t,e=Ee,r)=>({type:z,payload:{product:t,module:e,offer:r}}),"requestOffer"),ci=n((t,e=Ee,r)=>n(function(i,s){let{merchantId:a,sessionId:c,environment:{apiUrl:p}}=s(),l=Nc(t,e,r);i(l);let f=x(t);return f?le.fetchOffer(p,a,c,f,e).then(d=>i(Pe(d,r)),d=>i(lo(d))).finally(()=>i(lr(l))):null},"fetchOfferThunk"),"fetchOffer"),pi=n(()=>({type:$e}),"checkout"),Ic=n((t,e,r,o)=>({type:qn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),kc=n(t=>({type:Bt,payload:t}),"receiveCreateOneTime"),qc=n((t,e)=>({type:Dn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Dc=n((t,e)=>({type:zt,payload:{response:t,product:e}}),"receiveConvertOneTime"),li=n((t,e,r,o=!1,i=null)=>n(function(a,c){let{auth:p,config:l,environment:{legoUrl:f},previewUpsellOffer:d,offerId:h}=c();if(!p)return a(de("No auth set."));let T=Qn(i,l),S=Ic(t,e,r,h);return a(S),(d?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:h}):le.createOneTime(f,p,t.id,e,r,h)).then(m=>(a(kc(m)),o?(a(qc(m,T)),(d?Promise.resolve({item:m,frequency:T}):le.convertOneTimeToSubscription(f,p,m,T,h)).then(E=>a(Dc(E,t)),E=>a(lo(E)))):m),m=>a(lo(m))).finally(()=>a(lr(S)))},"createIuThunk"),"createIu"),ui=n(t=>({type:Yt,payload:t}),"setLocale"),di=n(t=>({type:je,payload:t}),"setConfig"),fi=n((t,e,r)=>({type:Wt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),hi=n(t=>({type:Jt,payload:t}),"setTemplates"),mi=n((t,e)=>({type:Kt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),gi=n((t,e)=>({type:Qt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe");var Ot="OG_STATE",_i=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),go=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Si=n(()=>go()?{}:_i(localStorage.getItem(Ot)),"loadState"),Fc=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"),Ei=n(t=>{if(go())return;let e=Fc(t);e&&localStorage.getItem(Ot)!==e&&localStorage.setItem(Ot,e)},"saveState"),xi=n(t=>(0,bi.throttle)(500,e=>{if(go())return;let{key:r,newValue:o}=e;r===Ot&&o===null?(t.dispatch({type:ce}),setTimeout(()=>t.dispatch(ai()),0)):r===Ot&&t.dispatch({type:Se,newValue:_i(o)})}),"listenLocalStorageChanges");var Oi=ae(Mt());var Uc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),vi=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>Uc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Lc=[{expressions:[({type:t}={})=>t===R,({type:t}={})=>t===I],fn:vi(!0)},{expressions:[({type:t}={})=>t===N],fn:vi(!1)}],Ti=n(t=>e=>r=>{let o=t.getState();Lc.forEach(i=>{i.expressions.some(s=>s(r,o))&&i.fn(r)}),e(r)},"dispatchMiddleware"),Pi=n(t=>e=>r=>{var i;let o;switch(r.type){case w:case N:case R:case I: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"),wi=n(t=>e=>r=>{e(r);let o=(0,Oi.throttle)(500,()=>{Ei({...t.getState()})});r.type!==Se&&o()},"localStorageMiddleware");var yo=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Ci(t){let[e,r]=yo(),[o,i]=yo(),[s,a]=yo();o.then(p=>{let{sessionId:l}=t.getState();!l||p&&!l.startsWith(p)?t.dispatch(uo(p)):a(l)});let c=Promise.all([o,e,s]);return c.then(()=>{var p;window.addEventListener("storage",xi(t)),(p=t.getState().auth)!=null&&p.ts||t.dispatch(si())}),p=>async l=>{Le===l.type||Ue===l.type||Me===l.type?r(l.payload):De===l.type?i(l.payload):Fe===l.type?a(l.payload):await c,p(l)}}n(Ci,"waitUntilOffersReady");function Ri(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"}):Zr,i=[Ci,Tn,Ti,Pi],s={};if(!r)try{s=Si(),i.push(wi)}catch{}let a=o(xn(...i,...e.filter(p=>p))),c=Qr(t,s,a);return window.og=window.og||{},window.og.store=c,c}n(Ri,"makeStore");var Mc=Object.defineProperty,dr=n((t,e)=>Mc(t,"name",{value:e,configurable:!0}),"i"),$c=dr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Ni=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","https://rc3-beta.stg.ordergroove.com","http://localhost:3000",window.location.origin],Ai=dr(t=>(e,r)=>{Ni.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function bo(t=window.opener,e=window.og){let r=dr(o=>{let i=$c(Ni),s=Ai(o.source),a=o.data.options||{};if(i(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.3/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),Ai(t)("READY"))}n(bo,"f");dr(bo,"offersLiveEditor");var fr=null,jc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ii=n(t=>{if(!fr)throw new Error("Missing redux store.");return fr},"resolveStore"),Vc=n((t,e)=>r=>{let{getState:o,dispatch:i}=Ii(r),s=t?t(o(),r):{},a=e(i,r);Object.assign(r,s,a)},"createRecalcProps"),g=n((t,e=jc)=>r=>{let i=Vc(t,typeof e=="function"?e:s=>En(e,s));return class extends r{get store(){return fr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ii(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"),ki=n(t=>{fr=t},"setStore");var _o=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:{offer:((t.productOffer||{})[r.id]||[])[0],..._t(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"),We=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 So=typeof window<"u"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0;var we=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes");var M=`{{lit-${String(Math.random()).slice(2)}}}`,Eo=`<!--${M}-->`,qi=new RegExp(`${M}|${Eo}`),Je="$lit$",he=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 h=d.attributes,{length:T}=h,S=0;for(let m=0;m<T;m++)Di(h[m].name,Je)&&S++;for(;S-- >0;){let m=l[p],E=hr.exec(m)[2],P=E.toLowerCase()+Je,_=d.getAttribute(P);d.removeAttribute(P);let b=_.split(qi);this.parts.push({type:"attribute",index:c,name:E,strings:b}),p+=b.length-1}}d.tagName==="TEMPLATE"&&(i.push(d),s.currentNode=d.content)}else if(d.nodeType===3){let h=d.data;if(h.indexOf(M)>=0){let T=d.parentNode,S=h.split(qi),m=S.length-1;for(let E=0;E<m;E++){let P,_=S[E];if(_==="")P=ee();else{let b=hr.exec(_);b!==null&&Di(b[2],Je)&&(_=_.slice(0,b.index)+b[1]+b[2].slice(0,-Je.length)+b[3]),P=document.createTextNode(_)}T.insertBefore(P,d),this.parts.push({type:"node",index:++c})}S[m]===""?(T.insertBefore(ee(),d),o.push(d)):d.data=S[m],p+=m}}else if(d.nodeType===8)if(d.data===M){let h=d.parentNode;(d.previousSibling===null||c===a)&&(c++,h.insertBefore(ee(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),p++}else{let h=-1;for(;(h=d.data.indexOf(M,h+1))!==-1;)this.parts.push({type:"node",index:-1}),p++}}for(let d of o)d.parentNode.removeChild(d)}};n(he,"Template");var Di=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),Tt=n(t=>t.index!==-1,"isTemplatePartActive"),ee=n(()=>document.createComment(""),"createMarker"),hr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;var xo=133;function vo(t,e){let{element:{content:r},parts:o}=t,i=document.createTreeWalker(r,xo,null,!1),s=Pt(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=Pt(o,s),a=o[s]}l.forEach(d=>d.parentNode.removeChild(d))}n(vo,"removeNodesFromTemplate");var Gc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,xo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Pt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(Tt(o))return r}return-1},"nextActiveIndexInTemplateParts");function Fi(t,e,r=null){let{element:{content:o},parts:i}=t;if(r==null){o.appendChild(e);return}let s=document.createTreeWalker(o,xo,null,!1),a=Pt(i),c=0,p=-1;for(;s.nextNode();)for(p++,s.currentNode===r&&(c=Gc(e),r.parentNode.insertBefore(e,r));a!==-1&&i[a].index===p;){if(c>0){for(;a!==-1;)i[a].index+=c,a=Pt(i,a);return}a=Pt(i,a)}}n(Fi,"insertNodeIntoTemplate");var Bc=new WeakMap;var Ce=n(t=>typeof t=="function"&&Bc.has(t),"isDirective");var D={},mr={};var ie=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=So?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],!Tt(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 So&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ie,"TemplateInstance");var Ui=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Yc=` ${M} `,te=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=hr.exec(s);c===null?r+=s+(o?Yc:Eo):r+=s.substr(0,c.index)+c[1]+c[2]+Je+c[3]+M}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Ui!==void 0&&(r=Ui.createHTML(r)),e.innerHTML=r,e}};n(te,"TemplateResult");var yr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),gr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Re=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 Ke(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"||!gr(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(yr(c)||!gr(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(Re,"AttributeCommitter");var Ke=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==D&&(!yr(e)||e!==this.value)&&(this.value=e,Ce(e)||(this.committer.dirty=!0))}commit(){for(;Ce(this.value);){let e=this.value;this.value=D,e(this)}this.value!==D&&this.committer.commit()}};n(Ke,"AttributePart");var re=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(ee()),this.endNode=e.appendChild(ee())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=ee()),e.__insert(this.endNode=ee())}insertAfterPart(e){e.__insert(this.startNode=ee()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Ce(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=D,r(this)}let e=this.__pendingValue;e!==D&&(yr(e)?e!==this.value&&this.__commitText(e):e instanceof te?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):gr(e)?this.__commitIterable(e):e===mr?(this.value=mr,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 ie&&this.value.template===r)this.value.update(e.values);else{let o=new ie(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 re(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){we(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(re,"NodePart");var Qe=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(;Ce(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(Qe,"BooleanAttributePart");var Ze=class extends Re{constructor(e,r,o){super(e,r,o),this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new wt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(Ze,"PropertyCommitter");var wt=class extends Ke{};n(wt,"PropertyPart");var Li=!1;(()=>{try{let t={get capture(){return Li=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();var Xe=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(;Ce(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=Wc(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(Xe,"EventPart");var Wc=n(t=>t&&(Li?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions");function Oo(t){let e=Ae.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ae.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(M);return r=e.keyString.get(o),r===void 0&&(r=new he(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}n(Oo,"templateFactory");var Ae=new Map;var me=new WeakMap,To=n((t,e,r)=>{let o=me.get(e);o===void 0&&(we(e,e.firstChild),me.set(e,o=new re(Object.assign({templateFactory:Oo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render");var Ct=class{handleAttributeExpressions(e,r,o,i){let s=r[0];return s==="."?new Ze(e,r.slice(1),o).parts:s==="@"?[new Xe(e,r.slice(1),i.eventContext)]:s==="?"?[new Qe(e,r.slice(1),o)]:new Re(e,r,o).parts}handleTextExpression(e){return new re(e)}};n(Ct,"DefaultTemplateProcessor");var Po=new Ct;typeof window<"u"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");var u=n((t,...e)=>new te(t,e,"html",Po),"html");var $i=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),br=!0;typeof window.ShadyCSS>"u"?br=!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."),br=!1);var Kc=n(t=>e=>{let r=$i(e.type,t),o=Ae.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ae.set(r,o));let i=o.stringsArray.get(e.strings);if(i!==void 0)return i;let s=e.strings.join(M);if(i=o.keyString.get(s),i===void 0){let a=e.getTemplateElement();br&&window.ShadyCSS.prepareTemplateDom(a,t),i=new he(e,a),o.keyString.set(s,i)}return o.stringsArray.set(e.strings,i),i},"shadyTemplateFactory"),Qc=["html","svg"],Zc=n(t=>{Qc.forEach(e=>{let r=Ae.get($i(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)}),vo(o,s)})})},"removeStylesFromLitTemplates"),ji=new Set,Xc=n((t,e,r)=>{ji.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}Zc(t);let c=o.content;r?Fi(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),vo(r,l)}},"prepareTemplateStyles"),Vi=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,i=me.has(e),s=br&&e.nodeType===11&&!!e.host,a=s&&!ji.has(o),c=a?document.createDocumentFragment():e;if(To(t,c,Object.assign({templateFactory:Kc(o)},r)),a){let p=me.get(c);me.delete(c);let l=p.value instanceof ie?p.value.template:void 0;Xc(o,c,l),we(e,e.firstChild),e.appendChild(c),me.set(e,p)}!i&&s&&window.ShadyCSS.styleElement(e.host)},"render");var Hi;window.JSCompiler_renameProperty=(t,e)=>t;var Io={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}},Gi=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),wo={attribute:!0,type:String,converter:Io,reflect:!1,hasChanged:Gi},Co=1,Ro=1<<2,Ao=1<<3,No=1<<4,ko="finalized",et=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=wo){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)||wo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(ko)||e.finalize(),this[ko]=!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=Gi){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,i=r.converter||Io,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||Io.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=wo){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|Ao,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._updateState=this._updateState&~Ao}}_attributeToProperty(e,r){if(this._updateState&Ao)return;let o=this.constructor,i=o._attributeToPropertyMap.get(e);if(i!==void 0){let s=o.getPropertyOptions(i);this._updateState=this._updateState|No,this[i]=o._propertyValueFromAttribute(r,s),this._updateState=this._updateState&~No}}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&No)&&(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|Ro;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Ro}get hasUpdated(){return this._updateState&Co}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&Co||(this._updateState=this._updateState|Co,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Ro}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(et,"UpdatingElement");Hi=ko;et[Hi]=!0;var Bi=Element.prototype,Bd=Bi.msMatchesSelector||Bi.webkitMatchesSelector;var _r=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qo=Symbol(),tt=class{constructor(e,r){if(r!==qo)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(_r?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(tt,"CSSResult");var zi=n(t=>new tt(String(t),qo),"unsafeCSS"),ep=n(t=>{if(t instanceof tt)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+ep(i)+t[s+1],t[0]);return new tt(r,qo)},"css");(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var Yi={},v=class extends et{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&&!_r){let o=Array.prototype.slice.call(r.cssRules).reduce((i,s)=>i+s.cssText,"");return zi(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):_r?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!==Yi&&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 Yi}};n(v,"LitElement");v.finalized=!0;v.render=Vi;var us=ae(ns());var ap=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"),is=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Rt=n(t=>{let e=is(t);if(!e){let r=t.offer;r&&(e=is(r))}return e},"resolveProduct"),cp=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Do=n(t=>class extends t{get offer(){return cp(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),C=n(t=>class extends Do(t){get product(){return Rt(this)}},"withProduct"),Er=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let i=ap(o.value),s=o.innerText.trim();e.push({value:i,text:s}),!r&&o.selected&&(r=i)}),{options:e,isSelected:r}}},"withChildOptions");var xr={};yn(xr,{autoshipByDefault:()=>pp,eligibilityGroups:()=>Uo,eligible:()=>ss,hasPrepaidOptions:()=>hp,hasUpcomingOrder:()=>ps,hasUpsellGroup:()=>cs,inStock:()=>Fo,optedout:()=>dp,prepaidEligible:()=>lp,prepaidSubscribed:()=>fp,regularEligible:()=>gp,subscribed:()=>up,subscriptionEligible:()=>as,upcomingOrderContainsProduct:()=>mp,upsellEligible:()=>ls});var Fo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ss=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),pp=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),as=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ss(t,e)&&Fo(t,e),"subscriptionEligible"),Uo=n((t,e)=>{let r=x((e.product||{}).id);return(t.eligibilityGroups||{})[r]||null},"eligibilityGroups"),cs=n((t,e)=>{let r=Uo(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),lp=n((t,e)=>{let r=Uo(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),up=n((t,e)=>ir(e.product)(t),"subscribed"),dp=n((t,e)=>sr(e.product)(t),"optedout"),fp=n((t,e)=>Kn(e.product)(t),"prepaidSubscribed"),hp=n((t,e)=>Z(e.product.id)(t).length>0,"hasPrepaidOptions"),ps=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),mp=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ls=n((t,e)=>{var r;return!((r=e.offer)!=null&&r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&Fo(t,e)&&ps(t)&&cs(t,e)},"upsellEligible"),gp=n((t,e)=>as(t,e)&&!ls(t,e),"regularEligible");var yp=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),vr=class extends C(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){if(!this.test)return u``;let e=yp(this.test);return e=e.replace(/(![a-zA-Z]+)/g,"($1)"),us.default.parse(e,o=>xr[o]&&xr[o](this.state,this))?u`
111
13
  <slot></slot>
112
- `: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(Ur,"When");var zp=n(t=>({state:t}),"mapStateToProps"),Ms=g(zp)(Ur);E();A();E();N();ye();var $s={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},Te={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&So(t)?t:null}}},Lr={type:Boolean,attribute:!0,reflect:!0},ft={type:Object,attribute:!1};E();N();var Yp=n(t=>class extends t{getOption(e,r=e){let o=vo(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"),M=Yp(P);var Y=class extends I(M){static get properties(){return{subscribed:Lr,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(vr,"When");var bp=n(t=>({state:t}),"mapStateToProps"),ds=g(bp)(vr);var fs={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},ye={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&no(t)?t:null}}},Or={type:Boolean,attribute:!0,reflect:!0},nt={type:Object,attribute:!1};var _p=n(t=>class extends t{getOption(e,r=e){let o=ao(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"),q=_p(v);var j=class extends C(q){static get properties(){return{subscribed:Or,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return y`
113
15
  :host {
114
16
  cursor: default;
115
17
  display: inline-block;
@@ -183,7 +85,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
183
85
  <slot name="frequency-mismatch"></slot>
184
86
  `:u`
185
87
  <slot name="not-subscribed"></slot>
186
- `}};n(Y,"OptinStatus");var Q=n((t,e={})=>({subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:Ze((e.product||{}).id)(t),prepaidShipmentsOptedIn:H(e.product)(t),...G(t,e,"defaultFrequency"),...G(t,e,"frequencies"),...Xe(t,e)}),"mapStateToProps"),js=g(Q)(Y);q();At();var ht=class extends Y{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:Te,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(L.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=To(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,L.shopify_selling_plans&&this.store&&(e=To(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(Mt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return u`
88
+ `}};n(j,"OptinStatus");var B=n((t,e={})=>({subscribed:J(e.product)(t),frequency:Q(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),prepaidShipmentsOptedIn:U(e.product)(t),...L(t,e,"defaultFrequency"),...L(t,e,"frequencies"),...Ge(t,e)}),"mapStateToProps"),hs=g(B)(j);var it=class extends j{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:ye,optinButtonLabel:{type:String}}}updated(e){if(e.has("subscribed")||e.has("frequencies")){if(k.shopify_selling_plans&&this.store){let r=this.getAttribute("default-frequency");r=po(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,k.shopify_selling_plans&&this.store&&(e=po(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(Rt(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return u`
187
89
  <slot name="default">
188
90
  <button
189
91
  aria-labelledby="ogOfferOptInLabel"
@@ -197,7 +99,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
197
99
  </slot>
198
100
  </label>
199
101
  </slot>
200
- `}};n(ht,"OptinButton");var Vs=g(Q,{optinProduct:K})(ht);E();A();var Mr=class extends Y{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return u`
102
+ `}};n(it,"OptinButton");var ms=g(B,{optinProduct:G})(it);var Tr=class extends j{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return u`
201
103
  <slot name="default">
202
104
  <button
203
105
  aria-labelledby="ogOfferOptOutLabel"
@@ -211,13 +113,13 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
211
113
  </slot>
212
114
  </label>
213
115
  </slot>
214
- `}};n(Mr,"OptoutButton");var Hs=g(Q,{optoutProduct:rt})(Mr);E();A();E();N();ye();var je=n((t,e)=>{let{every:r,every_period:o}=Ct(t);return r&&o?u`
116
+ `}};n(Tr,"OptoutButton");var gs=g(B,{optoutProduct:Ye})(Tr);var Ie=n((t,e)=>{let{every:r,every_period:o}=_t(t);return r&&o?u`
215
117
  ${r}
216
118
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
217
119
  ${e&&e===t?u`
218
120
  <og-text key="defaultFrequencyCopy"></og-text>
219
121
  `:""}
220
- `:t},"frequencyText"),mt=class extends I(M){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Lr,frequency:{type:String},defaultFrequency:Te,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:yi}}}}static get styles(){return y`
122
+ `:t},"frequencyText"),st=class extends C(q){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:Or,frequency:{type:String},defaultFrequency:ye,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:Wn}}}}static get styles(){return y`
221
123
  :host[hidden] {
222
124
  display: none;
223
125
  }
@@ -227,7 +129,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
227
129
  `}constructor(){super(),this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return u`
228
130
  <span>
229
131
  ${this.subscribed&&u`
230
- <slot name="subscribed">${je(e)} </slot>
132
+ <slot name="subscribed">${Ie(e)} </slot>
231
133
  `||""}
232
134
  ${!this.subscribed&&u`
233
135
  <slot name="not-subscribed"></slot>
@@ -236,7 +138,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
236
138
  <slot name="frequency-mismatch"></slot>
237
139
  `||""}
238
140
  </span>
239
- `}};n(mt,"FrequencyStatus");var $t=n((t,e)=>{var r,o;return{subscribed:te(e.product)(t),frequency:oe(e.product)(t),productDefaultFrequency:Ze((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...G(t,e,"frequencies"),...G(t,e,"defaultFrequency"),...Xe(t,e)}},"mapStateToProps"),Gs=g($t)(mt);N();var $r=class extends Dr(Y){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:Te}}static get styles(){return y`
141
+ `}};n(st,"FrequencyStatus");var At=n((t,e)=>{var r,o;return{subscribed:J(e.product)(t),frequency:Q(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequenciesText:(o=t.config)==null?void 0:o.frequenciesText,config:t.config,...L(t,e,"frequencies"),...L(t,e,"defaultFrequency"),...Ge(t,e)}},"mapStateToProps"),ys=g(At)(st);var Pr=class extends Er(j){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:ye}}static get styles(){return y`
240
142
  :host {
241
143
  display: inline-block;
242
144
  cursor: pointer;
@@ -246,24 +148,24 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
246
148
  border-width: var(--og-select-border-width, 1px);
247
149
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
248
150
  }
249
- `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return(o=this.frequencies)!=null&&o.length?r=[e.find(i=>i.value==="optedOut"),...this.frequencies.map((i,s)=>({value:i,text:this.frequenciesText&&s in this.frequenciesText?this.frequenciesText[s]:je(i,this.defaultFrequency)}))]:r=e,u`
151
+ `}get currentFrequency(){return this.subscribed?this.frequency||this.productDefaultFrequency||this.defaultFrequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product,this.offer):this.productChangeFrequency(this.product,e,this.offer)}render(){var o;let{options:e}=this.childOptions,r;return(o=this.frequencies)!=null&&o.length?r=[e.find(i=>i.value==="optedOut"),...this.frequencies.map((i,s)=>({value:i,text:this.frequenciesText&&s in this.frequenciesText?this.frequenciesText[s]:Ie(i,this.defaultFrequency)}))]:r=e,u`
250
152
  <og-select
251
153
  .options="${r}"
252
154
  .selected="${this.currentFrequency}"
253
155
  .onChange="${({target:{value:i}})=>this.onOptinChange(i)}"
254
156
  ></og-select>
255
- `}};n($r,"OptinSelect");var Bs=g((t,e)=>({...Q(t,e),...$t(t,e),...G(t,e,"frequencies")}),{productChangeFrequency:_r,optoutProduct:rt})($r);E();A();var jr=class extends I(M){static get styles(){return y`
157
+ `}};n(Pr,"OptinSelect");var bs=g((t,e)=>({...B(t,e),...At(t,e),...L(t,e,"frequencies")}),{productChangeFrequency:pr,optoutProduct:Ye})(Pr);var wr=class extends C(q){static get styles(){return y`
256
158
  :host[hidden] {
257
159
  display: none;
258
160
  }
259
161
  :host {
260
162
  display: inline-block;
261
163
  }
262
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:ft,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super(),this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return u`
164
+ `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:nt,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super(),this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return u`
263
165
  <slot>
264
166
  <og-next-upcoming-order></og-next-upcoming-order>
265
167
  </slot>
266
- `}};n(jr,"UpsellButton");var Wp=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),zs=g(Wp,{fetchOrders:Er})(jr);E();A();N();var Vr=class extends I(M){static get properties(){return{...super.properties,defaultFrequency:Te,auth:ft,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super(),this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return u`
168
+ `}};n(wr,"UpsellButton");var Sp=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),_s=g(Sp,{fetchOrders:ur})(wr);var Cr=class extends C(q){static get properties(){return{...super.properties,defaultFrequency:ye,auth:nt,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`
267
169
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
268
170
  <div slot="content">
269
171
  <slot>
@@ -301,7 +203,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
301
203
  </slot>
302
204
  </span>
303
205
  </og-modal>
304
- `}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(Vr,"UpsellModal");var Jp=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:te(e.product)(t),frequency:oe(e.product)(t),...G(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ys=g(Jp,{concludeUpsell:wi,createIu:qi})(Vr);E();A();var Hr=class extends Y{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(Cr,"UpsellModal");var Ep=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:J(e.product)(t),frequency:Q(e.product)(t),...L(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ss=g(Ep,{concludeUpsell:oi,createIu:li})(Cr);var Rr=class extends j{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return y`
305
207
  :host {
306
208
  cursor: default;
307
209
  display: inline-block;
@@ -342,13 +244,13 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
342
244
  ></slot>
343
245
  </label>
344
246
  </slot>
345
- `}};n(Hr,"OptinToggle");var Ws=g(Q,{optoutProduct:rt,optinProduct:K})(Hr);E();var Kp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Gr=class extends on(P){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&&Kp(e,this.pluralize)}render(){return u`
247
+ `}};n(Rr,"OptinToggle");var Es=g(B,{optoutProduct:Ye,optinProduct:G})(Rr);var xp=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ar=class extends Do(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&&xp(e,this.pluralize)}render(){return u`
346
248
  ${this.getText()}
347
- `}};n(Gr,"Text");var Qp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Js=g(Qp)(Gr);E();q();var Ve=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Ve,"DiscountAmount");var gt=class extends Ve{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(gt,"DiscountPercent");var Br=class extends gt{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Br,"ShippingDiscountPercent");var an="Discount Percent",cn="Discount Amount",Ks="total_price",Qs="shipping_total",Zs="sub_total",pn=n(({field:t,object:e,type:r,value:o})=>{let s=[[new gt(o),{field:Ks,object:"item",type:an}],[new Ve(o),{field:Ks,object:"item",type:cn}],[new Br(o),{field:Qs,object:"order",type:an}],[new Ve(o),{field:Qs,object:"order",type:cn}],[new gt(o),{field:Zs,object:"order",type:an}],[new Ve(o),{field:Zs,object:"order",type:cn}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Zp(t){return!(pn(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Zp,"filterIncentives");var zr=class extends I(P){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(Zp.bind({incentiveClass:e,incentiveValue:r}));return u`
348
- ${this.label} ${i?pn(i):this.renderFallback()}
249
+ `}};n(Ar,"Text");var vp=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),xs=g(vp)(Ar);var ke=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(ke,"DiscountAmount");var at=class extends ke{constructor(e){super(e),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(at,"DiscountPercent");var Nr=class extends at{constructor(e){super(e),this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Nr,"ShippingDiscountPercent");var Lo="Discount Percent",Mo="Discount Amount",vs="total_price",Os="shipping_total",Ts="sub_total",$o=n(({field:t,object:e,type:r,value:o})=>{let s=[[new at(o),{field:vs,object:"item",type:Lo}],[new ke(o),{field:vs,object:"item",type:Mo}],[new Nr(o),{field:Os,object:"order",type:Lo}],[new ke(o),{field:Os,object:"order",type:Mo}],[new at(o),{field:Ts,object:"order",type:Lo}],[new ke(o),{field:Ts,object:"order",type:Mo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return s&&s[0]},"discountBuilder");function Op(t){return!($o(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Op,"filterIncentives");var Ir=class extends C(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(Op.bind({incentiveClass:e,incentiveValue:r}));return u`
250
+ ${this.label} ${i?$o(i):this.renderFallback()}
349
251
  `}renderFallback(){return u`
350
- ${pn({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
351
- `}};n(zr,"IncentiveText");var Xp=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&T((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Xs=g(Xp)(zr);E();A();var Yr=class extends Dr(mt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
252
+ ${$o({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
253
+ `}};n(Ir,"IncentiveText");var Tp=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"),Ps=g(Tp)(Ir);var kr=class extends Er(st){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return y`
352
254
  :host {
353
255
  display: inline-block;
354
256
  cursor: pointer;
@@ -359,7 +261,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
359
261
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
360
262
  z-index: 1;
361
263
  }
362
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var i,s;let{options:e,isSelected:r}=this.childOptions,o;if(this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((i=this.frequencies)==null?void 0:i.length)&&o&&((s=this.config)==null?void 0:s.frequenciesEveryPeriod)){let a=this.config.frequenciesEveryPeriod.findIndex(c=>c===o);if(a>=0)return this.frequencies[a]}return 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=je(this.config.frequenciesEveryPeriod[s],r):this.frequenciesText&&s in this.frequenciesText?a=this.frequenciesText[s]:a=je(i,this.defaultFrequency),{value:i,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(i=>({value:i,text:je(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;let{options:e,isSelected:r}=this.childOptions,o;if(this.productDefaultFrequency?o=this.productDefaultFrequency:r?o=r:e.length?o=e[0].value:o=this._defaultFrequency,((i=this.frequencies)==null?void 0:i.length)&&o&&((s=this.config)==null?void 0:s.frequenciesEveryPeriod)){let a=this.config.frequenciesEveryPeriod.findIndex(c=>c===o);if(a>=0)return this.frequencies[a]}return 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=Ie(this.config.frequenciesEveryPeriod[s],r):this.frequenciesText&&s in this.frequenciesText?a=this.frequenciesText[s]:a=Ie(i,this.defaultFrequency),{value:i,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(i=>({value:i,text:Ie(i,r)}))),e=e.map(({text:i,value:s})=>({text:s===r?u`
363
265
  ${i} ${this.defaultText||""}
364
266
  `:i,value:s})),u`
365
267
  <og-select
@@ -368,9 +270,9 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
368
270
  .selected="${this.currentFrequency}"
369
271
  .onChange="${({target:{value:i}})=>{this.productChangeFrequency(this.product,i,this.offer)}}"
370
272
  ></og-select>
371
- `}};n(Yr,"SelectFrequency");var ea=g($t,{productChangeFrequency:_r})(Yr);E();var el={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 ta=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=el[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 Wr=class extends P{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return u`
372
- ${ta(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
373
- `}};n(Wr,"FormattedDate");var tl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),ra=g(tl)(Wr);E();var ia=fe(Tt());A();$();var oa=n((t,e,r)=>n(async function(i){await i({type:Et,payload:t}),await i({type:we}),await i(qe({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"),rl=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"),ol=n((t,e,r)=>n(async function(i,s){await i({type:xt,payload:t});let{merchantId:a}=s();t?(await i(qe({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(Co({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(kt(a,"sig_field","ts","sig"))):await i(_e())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),nl=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:mo,payload:t}),await i({type:we}),await i(qe({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:W,payload:rl(a,ot({[e]:[{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"25%",prepaidShipments:3,regularPrepaidPrice:"$36.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$9.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:6,regularPrepaidPrice:"$72.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$18.00",prepaidExtraSavingsPercentage:"10%"},{frequency:"1_3",regularPrice:"$15.00",subscriptionPrice:"$12.00",discountRate:"20%",prepaidShipments:12,regularPrepaidPrice:"$144.00",prepaidSavingsPerShipment:"$3.00",prepaidSavingsTotal:"$36.00",prepaidExtraSavingsPercentage:"10%"}]}))}),await i({type:Ke,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),na=n((t,e,r)=>async function(o,i){switch(await o({type:he}),await o({type:Et,payload:!1}),await o({type:xt,payload:!1}),t){case"regular":o(oa(!0,r.product.id,r));break;case"upsell":o(ol(!0,r.product.id,r));break;case"subscribed":o(oa(!0,r.product.id,r)),o(K(r.product,"2_2"));break;case"prepaid":o(nl(!0,r.product.id,r)),o(K(r.product,"1_3"));break;default:}},"setPreview");A();N();q();$();var il=n((...t)=>JSON.stringify(t),"memoizeKey"),sl=(0,ia.default)((t,e)=>Object.assign({components:e},t),il),Jr=class extends M{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:$s,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:ft,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"?this.preview="subscribed":e==="preview-prepaid-offer"&&(this.preview="prepaid")}static get styles(){return y`
273
+ `}};n(kr,"SelectFrequency");var ws=g(At,{productChangeFrequency:pr})(kr);var Pp={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var Cs=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),i=Pp[o];if(typeof i=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",i).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var qr=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return u`
274
+ ${Cs(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
275
+ `}};n(qr,"FormattedDate");var wp=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Rs=g(wp)(qr);var Is=ae(gt());var As=n((t,e,r)=>n(async function(i){await i({type:dt,payload:t}),await i({type:_e}),await i(Pe({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"),Cp=n((t,e)=>(Object.entries(e).forEach(([r,o])=>{if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r].concat(o),s=[...new Set(i.map(a=>JSON.stringify(a)))];t[r]=s.map(a=>JSON.parse(a))}else t[r]=o}),t),"mergeProductPlansToState"),Rp=n((t,e,r)=>n(async function(i,s){await i({type:ft,payload:t});let{merchantId:a}=s();t?(await i(Pe({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(fo({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(vt(a,"sig_field","ts","sig"))):await i(de())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Ap=n((t,e,r)=>n(async function(i,s){let a=s().productPlans;await i({type:Xr,payload:t}),await i({type:_e}),await i(Pe({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:V,payload:Cp(a,We({[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:je,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),Ns=n((t,e,r)=>async function(o,i){switch(await o({type:ce}),await o({type:dt,payload:!1}),await o({type:ft,payload:!1}),t){case"regular":o(As(!0,r.product.id,r));break;case"upsell":o(Rp(!0,r.product.id,r));break;case"subscribed":o(As(!0,r.product.id,r)),o(G(r.product,"2_2"));break;case"prepaid":o(Ap(!0,r.product.id,r)),o(G(r.product,"1_3"));break;default:}},"setPreview");var Np=n((...t)=>JSON.stringify(t),"memoizeKey"),Ip=(0,Is.default)((t,e)=>Object.assign({components:e},t),Np),Dr=class extends q{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:fs,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:nt,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`
374
276
  :host[hidden] {
375
277
  display: none;
376
278
  }
@@ -519,9 +421,9 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
519
421
  </og-when>
520
422
  </og-when>
521
423
 
522
- `}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&&yr(()=>this.fetchOffer(this.product.id,Re,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=sl(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});D(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=>D(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}render(){return u`
424
+ `}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&&ar(()=>this.fetchOffer(this.product.id,Ee,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=Ip(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}render(){return u`
523
425
  <slot></slot>
524
- `}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(Jr,"Offer");var al=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:oe(e.product)(t),productDefaultFrequency:Ze((e.product||{}).id)(t),...G(t,e,"autoshipByDefault",xo(t)[(e.product||{}).id]),...gr(e.product)(t)&&{autoshipByDefault:!1},optedin:It(t),subscribed:te(e.product)(t),...Xe(t)}),"mapStateToProps"),sa=g(al,{fetchOffer:Ii,fetchOrders:Er,productHasChangedComponents:Pi,optinProduct:K,setFirstOrderPlaceDate:Mi,setProductToSubscribe:$i,setPreview:na})(Jr);E();var jt=class extends P{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`
426
+ `}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(Dr,"Offer");var kp=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:Q(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),...L(t,e,"autoshipByDefault",so(t)[(e.product||{}).id]),...sr(e.product)(t)&&{autoshipByDefault:!1},optedin:xt(t),subscribed:J(e.product)(t),...Ge(t)}),"mapStateToProps"),ks=g(kp,{fetchOffer:ci,fetchOrders:ur,productHasChangedComponents:ri,optinProduct:G,setFirstOrderPlaceDate:mi,setProductToSubscribe:gi,setPreview:Ns})(Dr);var Nt=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`
525
427
  :host[hidden] {
526
428
  display: none;
527
429
  }
@@ -668,7 +570,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
668
570
  </div>
669
571
  </div>
670
572
  </div>
671
- `:u``}};n(jt,"Modal");E();var Vt=class extends P{static get styles(){return y`
573
+ `:u``}};n(Nt,"Modal");var It=class extends v{static get styles(){return y`
672
574
  :host {
673
575
  display: inline-block;
674
576
  color: inherit;
@@ -732,7 +634,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
732
634
  `)}
733
635
  </select>
734
636
  <span>&#9660;</span>
735
- `}};n(Vt,"Select");E();var Ht=class extends P{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return y`
637
+ `}};n(It,"Select");var kt=class extends v{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return y`
736
638
  :host[hidden] {
737
639
  display: none;
738
640
  }
@@ -895,7 +797,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
895
797
  </slot>
896
798
  </div>
897
799
  </span>
898
- `}};n(Ht,"Tooltip");E();N();A();E();N();A();var pe=class extends I(P){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(pe,"PrepaidStatus");var cl=n((t,e)=>({options:ne(e.product.id)(t),shipmentsOptedIn:H(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),Xm=g(cl,{productChangePrepaidShipments:Se})(pe);var Kr=class extends pe{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
800
+ `}};n(kt,"Tooltip");var oe=class extends C(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(oe,"PrepaidStatus");var qp=n((t,e)=>({options:Z(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:K(e.product)(t)}),"mapStateToProps"),_m=g(qp,{productChangePrepaidShipments:fe})(oe);var Fr=class extends oe{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
899
801
  og-select {
900
802
  display: inline-block;
901
803
  cursor: pointer;
@@ -929,18 +831,18 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
929
831
  <slot name="append"></slot>
930
832
  </label>
931
833
  </div>
932
- `}};n(Kr,"PrepaidToggle");var pl=n((t,e)=>({options:ne(e.product.id)(t),shipmentsOptedIn:H(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),aa=g(pl,{productChangePrepaidShipments:Se})(Kr);E();N();q();var Qr=class extends I(M){static get properties(){return{...super.properties,shipmentsOptedIn:{type:Number},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`
834
+ `}};n(Fr,"PrepaidToggle");var Dp=n((t,e)=>({options:Z(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:K(e.product)(t)}),"mapStateToProps"),qs=g(Dp,{productChangePrepaidShipments:fe})(Fr);var Ur=class extends C(q){static get properties(){return{...super.properties,shipmentsOptedIn:{type:Number},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`
933
835
  :host {
934
836
  display: inline-block;
935
837
  text-indent: initial;
936
838
  }
937
- `}get value(){let e=T(this.product),r=this.productPlans[e]||[],o=this.prepaidShipmentsSelected?this.prepaidShipmentsSelected:this.shipmentsOptedIn,i=r.find(m=>m.prepaidShipments>1&&m.prepaidShipments===o);if(!i&&(i=r.find(m=>m.prepaidShipments>1),!i))return"";let{discountRate:s,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:p,prepaidSavingsPerShipment:l,prepaidSavingsTotal:f,prepaidExtraSavingsPercentage:d}=i;return this.totalPrice?p:this.perDeliveryPrice?a:this.totalSavings?f:this.perDeliverySavings?l:this.percentageSavings?s:this.extraPercentageSavings?d:this.numberOfShipments?c:""}render(){let e=this.value;return e?u`
839
+ `}get value(){let e=x(this.product),r=this.productPlans[e]||[],o=this.prepaidShipmentsSelected?this.prepaidShipmentsSelected:this.shipmentsOptedIn,i=r.find(h=>h.prepaidShipments>1&&h.prepaidShipments===o);if(!i&&(i=r.find(h=>h.prepaidShipments>1),!i))return"";let{discountRate:s,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:p,prepaidSavingsPerShipment:l,prepaidSavingsTotal:f,prepaidExtraSavingsPercentage:d}=i;return this.totalPrice?p:this.perDeliveryPrice?a:this.totalSavings?f:this.perDeliverySavings?l:this.percentageSavings?s:this.extraPercentageSavings?d:this.numberOfShipments?c:""}render(){let e=this.value;return e?u`
938
840
  <slot name="prepend"></slot>
939
841
  ${e}
940
842
  <slot name="append"></slot>
941
843
  `:u`
942
844
  <slot name="fallback"></slot>
943
- `}};n(Qr,"PrepaidData");var ll=n((t,e)=>({shipmentsOptedIn:H(e.product)(t),prepaidShipmentsSelected:re(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),ca=g(ll)(Qr);E();N();A();var Zr=class extends pe{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
845
+ `}};n(Ur,"PrepaidData");var Fp=n((t,e)=>({shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:K(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Ds=g(Fp)(Ur);var Lr=class extends oe{constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}static get styles(){return y`
944
846
  :host {
945
847
  cursor: pointer;
946
848
  display: inline-block;
@@ -994,7 +896,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
994
896
  <slot name="label"><og-text key="prepaidOptInLabel"></og-text></slot>
995
897
  </label>
996
898
  </slot>
997
- `}};n(Zr,"PrepaidButton");var ul=n((t,e)=>({options:ne(e.product.id)(t),shipmentsOptedIn:H(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),pa=g(ul,{productChangePrepaidShipments:Se})(Zr);E();N();A();var Xr=class extends pe{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
899
+ `}};n(Lr,"PrepaidButton");var Up=n((t,e)=>({options:Z(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:K(e.product)(t)}),"mapStateToProps"),Fs=g(Up,{productChangePrepaidShipments:fe})(Lr);var Mr=class extends oe{constructor(){super(),this.options=[],this.text="shipments"}static get properties(){return{...super.properties,text:{type:String}}}static get styles(){return y`
998
900
  og-select {
999
901
  display: inline-block;
1000
902
  cursor: pointer;
@@ -1015,7 +917,7 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
1015
917
  <span>${e[0].text}</span>
1016
918
  `}
1017
919
  <slot name="append"></slot>
1018
- `}};n(Xr,"PrepaidSelect");var dl=n((t,e)=>({options:ne(e.product.id)(t),shipmentsOptedIn:H(e.product)(t),prepaidShipmentsSelected:re(e.product)(t)}),"mapStateToProps"),la=g(dl,{productChangePrepaidShipments:Se})(Xr);E();A();var eo=class extends ht{static get properties(){return{...super.properties,prepaidShipmentsOptedIn:{type:Number}}}get isActive(){return this.prepaidShipmentsOptedIn>0?!1:this.subscribed}handleClick(e){if(!this.isActive){let r=this.frequencies&&this.frequencies.length>0?this.frequencies[0]:this.optinFrequency;this.optinProduct(Mt(this),r,this.offer)}e.preventDefault()}render(){return u`
920
+ `}};n(Mr,"PrepaidSelect");var Lp=n((t,e)=>({options:Z(e.product.id)(t),shipmentsOptedIn:U(e.product)(t),prepaidShipmentsSelected:K(e.product)(t)}),"mapStateToProps"),Us=g(Lp,{productChangePrepaidShipments:fe})(Mr);var $r=class extends it{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(Rt(this),r,this.offer)}e.preventDefault()}render(){return u`
1019
921
  <slot name="default">
1020
922
  <button id="action-trigger" class="btn radio ${this.isActive?" active":""}"></button>
1021
923
  <label for="action-trigger">
@@ -1024,7 +926,105 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
1024
926
  </slot>
1025
927
  </label>
1026
928
  </slot>
1027
- `}};n(eo,"SubscriptionButton");var ua=g(Q,{optinProduct:K})(eo);var{TestWizard:hl}=(fa(),$n(da));function ln(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,hl);let e=document.createElement(t);document.body.appendChild(e)}n(ln,"default");var un=[79,71,68,69,86],ha=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===un[t]){let o=un[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=un.length&&ln()}else t=0},!1)},"enable");ye();$();N();ye();q();var to=n((t=[],e)=>{switch(e.type){case he:return[];case Ce:return e.newValue?e.newValue.optedin:t;case k:case U:{let[{prepaidShipments:c,...p},l]=tt(t,e.payload.product);return l.concat({...p,...e.payload.product,frequency:e.payload.frequency})}case le:let{payload:r}=e,[{prepaidShipments:o,...i},s]=tt(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a);case F:return t.filter(c=>!D(e.payload.product,c));case _t:return t.map(c=>D(e.payload.product,c)?{...c,...e.payload.newProduct}:c);case rr:return t.filter(c=>!D(e.payload.product,c));case Je:return[];default:return t}},"optedin"),dn=n((t=[],e)=>{switch(e.type){case he:return[];case Ce:return e.newValue?e.newValue.optedout:t;case k:case U:return t.filter(i=>!D(e.payload.product,i));case F:let[r,o]=tt(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency});case _t:return t.map(i=>D(e.payload.product,i)?{...i,...e.payload.newProduct}:i);case Je:return[];default:return t}},"optedout"),fn=n((t={},{type:e,payload:r})=>{switch(e){case Xt: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 er:return{...t,products:(r.results||[]).map(o=>o.product)};case tr:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),gl=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),yl=n((t={},e)=>{switch(e.type){case Z:return{...t};case R:return{...t,...e.payload.in_stock};default:return t}},"inStock"),hn=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),ma=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),mn=n((t={},e)=>{switch(e.type){case R: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||[],...ma(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...ma(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),bl=n((t={},e)=>{switch(e.type){case k:case U:return{...t,[T(e.payload.product)]:e.payload.frequency};case F:return{...t,[T(e.payload.product)]:void 0};default:return t}},"frequency"),gn=n((t=!1,e)=>{switch(e.type){case Zt:return{...e.payload};case we:return!1;default:return t}},"auth"),yn=n((t="",e)=>{switch(e.type){case Ge:return e.payload;default:return t}},"merchantId"),bn=n((t=null,e)=>{switch(e.type){case Qt:return e.payload;default:return t}},"authUrl"),_l=n((t={},e)=>{switch(e.type){case R:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),_n=n((t="",e)=>{switch(e.type){case R:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Sn=n((t=null,e)=>{switch(e.type){case he:return null;case Be:return e.payload;default:return t}},"sessionId"),Sl=n((t={},e)=>{switch(e.type){case R:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Je:return{};default:return t}},"productOffer"),En=n((t={},e)=>{switch(e.type){case sr:return{...t,[T(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),xn=n((t={},e)=>{switch(e.type){case ar:return{...t,[T(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Bt=n((t={},e)=>{switch(e.type){case ze:return{...t,name:Ae,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Ye:return{...t,name:cr,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case We:return{...t,name:Ne,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),vn=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 or:return{...t,...e.payload};default:return t}},"locale"),El=n((t={offerType:"radio"},e)=>{switch(e.type){case Ke:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Rt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(Rt):t.frequencies};default:return t}},"config"),On=n((t=!1,e)=>{switch(e.type){case Et:return e.payload;default:return t}},"previewStandardOffer"),Tn=n((t=!1,e)=>{switch(e.type){case xt:return e.payload;default:return t}},"previewUpsellOffer");var Pn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),wn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Cn=n((t=[],e)=>{switch(e.type){case ir:return[...e.payload||[]];case nr:return[e.payload,...t];default:return t}},"templates"),xl=n((t={},e)=>{switch(e.type){case W:return ot(e.payload);default:return t}},"productPlans"),Rn=n((t={},e)=>{switch(e.type){case St:let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r};case le:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),ro=Yt({optedin:to,optedout:dn,nextUpcomingOrder:fn,autoshipEligible:gl,inStock:yl,eligibilityGroups:hn,incentives:mn,frequency:bl,auth:gn,merchantId:yn,authUrl:bn,offer:_l,offerId:_n,sessionId:Sn,productOffer:Sl,firstOrderPlaceDate:En,productToSubscribe:xn,environment:Bt,locale:vn,config:El,previewStandardOffer:On,previewUpsellOffer:Tn,autoshipByDefault:Pn,defaultFrequencies:wn,templates:Cn,productPlans:xl,prepaidShipmentsSelected:Rn});$();E();N();q();var oo=class extends I(M){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`
929
+ `}};n($r,"SubscriptionButton");var Ls=g(B,{optinProduct:G})($r);var qt=class extends v{static get styles(){return y`
930
+ :host {
931
+ position: fixed;
932
+ top: 5em;
933
+ righit: 5em;
934
+ background-color: rgba(255, 255, 255, 0.7);
935
+ width: 400px;
936
+ padding: 1em;
937
+ border-radius: 5px;
938
+ border: 1px solid #ccc;
939
+ box-shadow: 2px 2px 0 0 #000;
940
+ }
941
+
942
+ button {
943
+ margin: 0 0.5em 0.5em;
944
+ background-color: gray;
945
+ color: white;
946
+ border: 0;
947
+ border-radius: 3px;
948
+ cursor: pointer;
949
+ padding: 0.5em;
950
+ }
951
+
952
+ button.primary {
953
+ background-color: blue;
954
+ padding: 1em;
955
+ color: white;
956
+ border: 0;
957
+ border-radius: 3px;
958
+ }
959
+
960
+ button[disabled] {
961
+ background-color: #777;
962
+ }
963
+
964
+ div {
965
+ margin-bottom: 0.5em;
966
+ }
967
+
968
+ .message {
969
+ margin-left: 0.5em;
970
+ margin: 1em;
971
+ }
972
+
973
+ .success {
974
+ color: green;
975
+ }
976
+
977
+ .error {
978
+ color: red;
979
+ }
980
+
981
+ .warning {
982
+ color: orange;
983
+ }
984
+ a {
985
+ color: white;
986
+ }
987
+ `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),i=r.getAttribute("product"),s=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(i,s).concat(this.getOfferRequestMessages(i,o)),product:i};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],i=r.autoshipEligible[e],s=[];return e&&o===!1&&s.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&i===!1&&s.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&i===null&&s.push({name:"This product does not exist in our database",type:"error"}),s}resultsCodeBlock(){return this.results.length===0?u`
988
+ <div class="message error">No offer element found on the page</div>
989
+ `:this.results.map((e,r)=>u`
990
+ <div>For offer tag with product = "${e.product}"</div>
991
+ ${e.messages.map(o=>u`
992
+ <div class="message ${o.type}">
993
+ ${o.name}
994
+ </div>
995
+ `)}
996
+ <button @click=${this.toggleProductFlags(r,{})}>
997
+ Set inStock and eligible
998
+ </button>
999
+ <br />
1000
+ <button @click=${this.toggleProductFlags(r,{inStock:!1})}>
1001
+ Set to not inStock
1002
+ </button>
1003
+ <br />
1004
+ <button @click=${this.toggleProductFlags(r,{autoship:!1})}>
1005
+ Set to not eligible
1006
+ </button>
1007
+ <br />
1008
+ <button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
1009
+ Set to not eligible and not in stock
1010
+ </button>
1011
+ <br />
1012
+ <button @click=${this.toggleUpsellPreview(r)}>
1013
+ Toggle upsell/regular in this offer
1014
+ </button>
1015
+ <br />
1016
+ <button @click=${this.toggleUpsellNextOrder(r)}>
1017
+ upsell product is in next order
1018
+ </button>
1019
+ <br />
1020
+ `)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:i=["subscription","upsell"]}){return s=>{s.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Pe({in_stock:{[c]:r},eligibility_groups:{[c]:i},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],i=o.product.id;r.preventDefault(),o.store.dispatch(ho({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:i,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return u`
1021
+ <div>
1022
+ ${this.testsRan?this.resultsCodeBlock():u`
1023
+ <div>Click the button to run tests</div>
1024
+ `}
1025
+ <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
1026
+ </div>
1027
+ `}};n(qt,"TestWizard");function jo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,qt);let e=document.createElement(t);document.body.appendChild(e)}n(jo,"default");var Vo=[79,71,68,69,86],Ms=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===Vo[t]){let o=Vo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Vo.length&&jo()}else t=0},!1)},"enable");var jr=n((t=[],e)=>{switch(e.type){case ce:return[];case Se:return e.newValue?e.newValue.optedin:t;case R:case I:{let[{prepaidShipments:r,...o},i]=ze(t,e.payload.product);return i.concat({...o,...e.payload.product,frequency:e.payload.frequency})}case ne:{let{payload:r}=e,[{prepaidShipments:o,...i},s]=ze(t,r.product),a={...i,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),s.concat(a)}case N:return t.filter(r=>!A(e.payload.product,r));case lt:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case zt:return t.filter(r=>!A(e.payload.product,r));case $e:return[];default:return t}},"optedin"),Ho=n((t=[],e)=>{switch(e.type){case ce:return[];case Se:return e.newValue?e.newValue.optedout:t;case R:case I:return t.filter(r=>!A(e.payload.product,r));case N:{let[r,o]=ze(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency})}case lt:return t.map(r=>A(e.payload.product,r)?{...r,...e.payload.newProduct}:r);case $e:return[];default:return t}},"optedout"),Go=n((t={},{type:e,payload:r})=>{switch(e){case Ht: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 Gt:return{...t,products:(r.results||[]).map(o=>o.product)};case Bt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),$p=n((t={},e)=>{switch(e.type){case w:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),jp=n((t={},e)=>{switch(e.type){case z:return{...t};case w:return{...t,...e.payload.in_stock};default:return t}},"inStock"),Bo=n((t={},e)=>{switch(e.type){case w:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),$s=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),zo=n((t={},e)=>{switch(e.type){case w:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>({...r,[o]:Object.entries(e.payload.incentives).filter(([i])=>i===o).reduce((i,[,{initial:s,ongoing:a}])=>({...i,initial:[...i.initial||[],...$s(s,e.payload.incentives_display)],ongoing:[...i.ongoing||[],...$s(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),Vp=n((t={},e)=>{switch(e.type){case R:case I:return{...t,[x(e.payload.product)]:e.payload.frequency};case N:return{...t,[x(e.payload.product)]:void 0};default:return t}},"frequency"),Yo=n((t=!1,e)=>{switch(e.type){case Vt:return{...e.payload};case _e:return!1;default:return t}},"auth"),Wo=n((t="",e)=>{switch(e.type){case De:return e.payload;default:return t}},"merchantId"),Jo=n((t=null,e)=>{switch(e.type){case jt:return e.payload;default:return t}},"authUrl"),Hp=n((t={},e)=>{switch(e.type){case w:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),Ko=n((t="",e)=>{switch(e.type){case w:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Qo=n((t=null,e)=>{switch(e.type){case ce:return null;case Fe:return e.payload;default:return t}},"sessionId"),Gp=n((t={},e)=>{switch(e.type){case w:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case $e:return{};default:return t}},"productOffer"),Zo=n((t={},e)=>{switch(e.type){case Kt:return{...t,[x(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Xo=n((t={},e)=>{switch(e.type){case Qt:return{...t,[x(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Dt=n((t={},e)=>{switch(e.type){case Ue:return{...t,name:xe,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Le:return{...t,name:Zt,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Me:return{...t,name:ve,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),en=n((t={offerOptInLabel:"Subscribe to save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{1:"day",2:"week",3:"month"},prepaidOptInLabel:"Prepaid Subscription",prepaidShipmentsLabel:"Number of prepaid shipments"},e)=>{switch(e.type){case Yt:return{...t,...e.payload};default:return t}},"locale"),Bp=n((t={offerType:"radio"},e)=>{switch(e.type){case je:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?St(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(St):t.frequencies};default:return t}},"config"),tn=n((t=!1,e)=>{switch(e.type){case dt:return e.payload;default:return t}},"previewStandardOffer"),rn=n((t=!1,e)=>{switch(e.type){case ft:return e.payload;default:return t}},"previewUpsellOffer");var on=n((t=[],e)=>{switch(e.type){case w:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),nn=n((t=[],e)=>{switch(e.type){case w:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),sn=n((t=[],e)=>{switch(e.type){case Jt:return[...e.payload||[]];case Wt:return[e.payload,...t];default:return t}},"templates"),zp=n((t={},e)=>{switch(e.type){case V:return We(e.payload);default:return t}},"productPlans"),an=n((t={},e)=>{switch(e.type){case ut:{let{[e.payload.oldCartProductKey]:r,...o}=t;return{...o,[e.payload.newCartProductKey]:r}}case ne:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Vr=Ut({optedin:jr,optedout:Ho,nextUpcomingOrder:Go,autoshipEligible:$p,inStock:jp,eligibilityGroups:Bo,incentives:zo,frequency:Vp,auth:Yo,merchantId:Wo,authUrl:Jo,offer:Hp,offerId:Ko,sessionId:Qo,productOffer:Gp,firstOrderPlaceDate:Zo,productToSubscribe:Xo,environment:Dt,locale:en,config:Bp,previewStandardOffer:tn,previewUpsellOffer:rn,autoshipByDefault:on,defaultFrequencies:nn,templates:sn,productPlans:zp,prepaidShipmentsSelected:an});var Hr=class extends C(q){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`
1028
1028
  :host::before {
1029
1029
  clip-path: inset(100%);
1030
1030
  clip: rect(1px, 1px, 1px, 1px);
@@ -1042,12 +1042,12 @@ var lib=(()=>{var ja=Object.create;var yt=Object.defineProperty;var Va=Object.ge
1042
1042
  :host([regular])::before {
1043
1043
  content: 'Regular price';
1044
1044
  }
1045
- `}get value(){var p;let e=T(this.product),r=this.frequency||this.configDefaultFrequency||((p=this.offer)==null?void 0:p.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let l=o.find(f=>f.prepaidShipments===null||f.prepaidShipments===void 0);return l?l.subscriptionPrice:""}let i=o.find(l=>l.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return c===s?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?u`
1045
+ `}get value(){var p;let e=x(this.product),r=this.frequency||this.configDefaultFrequency||((p=this.offer)==null?void 0:p.defaultFrequency),o=this.productPlans[e]||[];if(this.payAsYouGo){let l=o.find(f=>f.prepaidShipments===null||f.prepaidShipments===void 0);return l?l.subscriptionPrice:""}let i=o.find(l=>l.frequency===r);if(!i)return"";let{regularPrice:s,discountRate:a,subscriptionPrice:c}=i;return c===s?"":this.regular?s:this.discount?a:c}render(){let e=this.value;return e?u`
1046
1046
  <slot name="prepend"></slot>
1047
1047
  ${e}
1048
1048
  <slot name="append"></slot>
1049
1049
  `:u`
1050
1050
  <slot name="fallback"></slot>
1051
- `}};n(oo,"Price");var vl=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:oe(e.product)(t)}},"mapStateToProps"),ga=g(vl)(oo);q();function An(t){ha(),os(t);try{customElements.define("og-when",Ms),customElements.define("og-text",Js),customElements.define("og-incentive-text",Xs),customElements.define("og-offer",sa),customElements.define("og-select-frequency",ea),customElements.define("og-optout-button",Hs),customElements.define("og-optin-toggle",Ws),customElements.define("og-optin-status",js),customElements.define("og-optin-button",Vs),customElements.define("og-optin-select",Bs),customElements.define("og-upsell-button",zs),customElements.define("og-frequency-status",Gs),customElements.define("og-modal",jt),customElements.define("og-select",Vt),customElements.define("og-tooltip",Ht),customElements.define("og-upsell-modal",Ys),customElements.define("og-next-upcoming-order",ra),customElements.define("og-price",ga),customElements.define("og-prepaid-toggle",aa),customElements.define("og-prepaid-data",ca),customElements.define("og-prepaid-button",pa),customElements.define("og-prepaid-select",la),customElements.define("og-subscription-button",ua)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Ao(o)),this},setMerchantId(o){return t.dispatch(Ci(o)),this},setAuthUrl(o){return t.dispatch(Ri(o)),this},getProductsForPurchasePost(o=[]){return qo(t.getState(),o)},getOptins(o=[]){return qo(t.getState(),o)},clear(){t.dispatch(ki())},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(Fi(o)),this},setLocale(o){return t.dispatch(Di(o)),this},addTemplate(o,i,s){return t.dispatch(Ui(o,i,s)),this},setTemplates(o){return t.dispatch(Li(o)),this},setPublicPath(o){return this},resolveSettings(o,i,s,a=t){if(o&&i&&s){let c=[];s.product?c.push(s.product):s.cart&&Array.isArray(s.cart.products)&&(c=c.concat(s.cart.products));let{apiUrl:p}=Bt({},Ao(i)),{sessionId:l}=a.getState();l&&c.forEach(f=>{let d=T(f);ge.fetchOffer(p,o,l,`${d}`,Re)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:W,payload:s.product_discounts})}},initialize(o,i,s){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),i&&i!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(i),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),ko(window.opener,r),r}n(An,"makeApi");$();q();var de=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),no=n(t=>`${t}%`,"percentage");var io=n(t=>{var e,r;return Array.isArray((e=t.selling_plan)==null?void 0:e.options)&&((r=t.selling_plan)==null?void 0:r.options.some(o=>(o==null?void 0:o.name)==="Shipment amount"))},"isPrepaidAllocation"),so=n(t=>{if(t&&t.length>1){let e=t.find(r=>(r==null?void 0:r.name)==="Shipment amount").value.split(" ");return e.length>0?+e[0]:null}return null},"getPrepaidShipmentsNumberFromOptions"),Ol=n(t=>{var e;return(t.selling_plan_id||((e=t.selling_plan)==null?void 0:e.id)).toString()},"getAllocationFrequency"),Tl=n(t=>de(t.compare_at_price),"getAllocationRegularPrice"),Pl=n(t=>{var e;if(io(t)){let r=so((e=t.selling_plan)==null?void 0:e.options),o=Math.round(t.price/r);return de(o)}return de(t.price)},"getAllocationSubscriptionPrice"),ya=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),wl=n(t=>{var r,o,i;if(io(t)){let s=so((r=t.selling_plan)==null?void 0:r.options),a=t.price/s,c=ya(t,a);return no(c)}let e="";return((o=t.price_adjustments[0])==null?void 0:o.value_type)==="percentage"?e=no(t.price_adjustments[0].value):(i=t.price_adjustments[0])!=null&&i.value?e=de(t.price_adjustments[0].value):t.compare_at_price&&(e=de(t.compare_at_price-t.price)),e},"getAllocationDiscountRate"),Cl=n(t=>{var e;return io(t)?so((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),Rl=n((t,e,r)=>{var l,f;let o=so((l=t.selling_plan)==null?void 0:l.options),i=t.price/o,s=t.compare_at_price-i,a=ya(t,i),c=(f=r==null?void 0:r.price_adjustments)==null?void 0:f[0],p=c&&c.value_type==="percentage"?c.value:null;return e.regularPrepaidPrice=de(t.price),e.prepaidSavingsPerShipment=de(Math.round(s)),e.prepaidSavingsTotal=de(Math.round(s*o)),p&&a&&(e.prepaidExtraSavingsPercentage=no(a-p)),e},"addPrepaidPriceAndSavings"),Nn="Subscribe and Save",Al=n((t,e=[])=>{t.selling_plan||(t.selling_plan=e.find(o=>o.id===t.selling_plan_id));let r={frequency:Ol(t),regularPrice:Tl(t),subscriptionPrice:Pl(t),discountRate:wl(t),prepaidShipments:Cl(t)};if(io(t)){let o=e.find(i=>i.group_name===Nn&&i.options.length===1);return Rl(t,r,o)}return r},"mapSellingPlanToDiscount"),In=n((t,e,r=[])=>[...t,Al(e,r)],"sellingPlanAllocationsReducer"),ba=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Sa=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"),_a=n((t,e,r)=>{if(!r)return null;if(!et(r))return r;if(br(t,e)){let o=ie(t,e,r);return o||be(t)}return r},"getDefaultSellingPlan"),Nl=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return et(r==null?void 0:r.frequency)?{...r,frequency:br((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?ie((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)||ie((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)||be((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),Il=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]&&br(p,l)?m=ie(p,l,`${d.every}_${d.every_period}`)||_a(p,l,f)||be(p):r[c]?m=`${d.every}_${d.every_period}`:m=_a(p,l,f)||"_",a.concat({id:c,frequency:m})}return a},[]),"reduceNewOptinsFromOfferResponse"),Ea=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===Nn),"getOGSellingPlanGroup"),kl=n((t,e)=>({...Sa(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),xa=n((t,[e])=>({...t,[e]:!0}),"productTrue"),va=n((t,e)=>{let r=T(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),ql=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)=>(ql(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(W===e.type)return Object.entries(e.payload).reduce(xa,t);if(me===e.type){let{payload:r}=e;return r.items.reduce(va,t)}if(X===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{...Sa(o,i.id,(s==null?void 0:s.length)>0),[i.id]:(s==null?void 0:s.length)>0}},t)}return t},"autoshipEligible");function Ul(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(Ul,"textToFreq");function Oa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Ul(r))}n(Oa,"sellingPlansToEveryPeriod");function Ta(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Ta,"sellingPlansToFrequencies");function Pa(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(Pa,"getPrepaidShipments");function Ll(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:Pa(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(Ll,"getPrepaidSellingPlans");var Ml=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(W===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(X===e.type){let{payload:{offer:s,product:a}}=e,c={},p=Ea(a),l=Ta(p);if(l!=null&&l.length){let d=Oa(p),m=((o=(r=p.options)==null?void 0:r[0])==null?void 0:o.values)||l,b=t.defaultFrequency;b&&et(b)&&(b=ie(l,d,b)||be(l)||b),c={frequencies:l,frequenciesEveryPeriod:d,frequenciesText:m,...b?{defaultFrequency:b}:{}}}let f=a==null?void 0:a.selling_plan_groups.filter(d=>/^Prepaid-.*/.test(d.name));return f.length&&(c={...c,prepaidSellingPlans:{...t.prepaidSellingPlans,...Ll(f)}}),{...t,...c}}if(R===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:be(c)||a}:et(a)?{...t,defaultFrequency:ie(c,p,a)||be(c)||a}:{...t,defaultFrequency:a}}return t},"config"),$l=n((t={},e)=>{if(W===e.type)return Object.entries(e.payload).reduce(xa,t);if(me===e.type)return e.payload.items.reduce(va,t);if(X===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(kl,t)||t}return Z===e.type&&e.payload.product===null?{...t}:t},"inStock"),jl=n((t={},e)=>t,"offer");function Vl({prepaidShipments:t,offer:e,product:r}){var o;if(t){let i=T(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(Vl,"getFrequencyForPrepaidShipments");function Hl(t){let e=Pa(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(Hl,"getOptedInItem");var Gl=n((t=[],e)=>{if(me===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,Hl(i)]:o,[]))}if(R===e.type){let{offer:r={},...o}=e.payload,i=Nl(t,r),s=Il(o,i,r);return[...i,...s]}if(X===e.type){let{product:r}=e.payload,o=Ea(r);if(!o)return t;let i=Ta(o),s=Oa(o);return t.map(a=>et(a.frequency)?{...a,frequency:ie(i,s,a.frequency)||be(i)}:a)}if(le===e.type){let{payload:r}=e,o=to(t,e),[i,s]=tt(o,r.product);return s.concat({...i,...r.product,frequency:Vl(r)})}return to(t,e)},"optedin"),Bl=n((t={},e)=>t,"productOffer"),zl=n((t={},e)=>{if(X===e.type){let{payload:{product:r}}=e,o=ba(r);return[r,...r==null?void 0:r.variants].reduce((i,s)=>{var a;return{...i,[s.id]:(a=s.selling_plan_allocations)==null?void 0:a.reduce((c,p)=>In(c,p,o),[])}},t)||t}return me===e.type?e.payload.items.reduce((o,i)=>i.selling_plan_allocation?{...o,[i.key]:In([],i.selling_plan_allocation)}:o,t)||t:W===e.type?ot(e.payload):t},"productPlans"),Yl=Yt({auth:gn,authUrl:bn,autoshipByDefault:Pn,autoshipEligible:Fl,config:Ml,defaultFrequencies:wn,eligibilityGroups:hn,environment:Bt,firstOrderPlaceDate:En,incentives:mn,inStock:$l,locale:vn,merchantId:yn,nextUpcomingOrder:fn,offer:jl,offerId:_n,optedin:Gl,optedout:dn,previewStandardOffer:On,previewUpsellOffer:Tn,productOffer:Bl,productPlans:zl,productToSubscribe:xn,sessionId:Sn,templates:Cn,prepaidShipmentsSelected:Rn});function kn(t,e){return window.og&&window.og.previewMode?ro(t,e):Yl(t,e)}n(kn,"shopifyReducer");var Aa=fe(Tt()),Na=fe(Jt());$();N();q();$();function wa(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(wa,"updateTrackingInputs");function qn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(qn,"getTrackingKey");function Wl(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=qn(),s=((m=t.payload.offer)==null?void 0:m.location)||"",a=((b=t.payload.offer)==null?void 0:b.variationId)||"",c=ao(o,e),l=[o,k.toLowerCase(),s,c,a].join(",");wa(o,i,l)}n(Wl,"addDefaultToSubTracking");function Dn(t){return e=>r=>{switch(e(r),r.type){case k:case F:case U:let o=r.payload.offer,i=Fn(r);o&&!o.isCart&&wa(o.product.id,i[0],i[1]);break;case R:Wl(r,t);break;default:}}}n(Dn,"shopifyTrackingMiddleware");var Ca,Ra,Ia=((Ra=(Ca=window.Shopify)==null?void 0:Ca.routes)==null?void 0:Ra.root)||"/",Jl="/cart",Kl=`${Ia}cart.js`,Ql=`${Ia}products/`,Zl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',Xl=n(t=>(0,Na.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 eu(t,e){let r=tu(e);if(r)try{let i=await qa(r);t.dispatch({type:X,payload:{product:i,offer:e}})}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=Xl(e);o.addEventListener("change",a=>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(eu,"setupPdp");var ka=n(async()=>await(await fetch(Kl)).json(),"getCart");function tu(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(tu,"guessProductHandle");var qa=(0,Aa.default)(async t=>(await fetch(`${Ql}${t}.js`)).json());async function ru(t,e){let r=await ka(),{items:o}=r;t.dispatch({type:me,payload:r});let i=Number(e.product.id);i<=o.length&&e.setAttribute("product",o[i-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(qa))).forEach(a=>t.dispatch({type:X,payload:{product:a,offer:e}}))}n(ru,"setupCart");async function ou(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||ao(t.payload.product.id,e),i=Fn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Zl)),p=t.payload.product.id,l=await ka(),f=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(_=>_.key===p),d=l.items[f],m=d.quantity,b=T(p),x=await fetch("/cart/change.js",{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(_=>_.id.replace(/^shopify-section-/,""))})});if(x.status!==200)throw new Error("Cart not updated");let h=await x.json(),v=l.items.length===h.items.length?h.items[f].key:(a=h.items.find(_=>_.quantity===m&&_.product_id===b&&(!o&&!_.selling_plan_allocation||(_==null?void 0:_.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;v&&(e.dispatch({type:St,payload:{oldCartProductKey:p,newCartProductKey:v}}),r.setAttribute("product",v)),e.dispatch({type:me,payload:h});let C=new CustomEvent(si,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let S=h.sections;Object.values(S).length?c.forEach(_=>{let zt=_.id.replace(/^shopify-section-/,"");if(!(zt in S))return;let $a=S[zt],Ln=new DOMParser().parseFromString($a.toString()||"","text/html").getElementById(_.id);Ln&&(_.innerHTML=Ln.innerHTML)}):window.location.pathname.startsWith(Jl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(ou,"synchronizeCartOptin");function Fn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=qn(),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 Z:case F:s.push(""),s.push(i);break;case k:case U:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(Fn,"getTrackingEvent");function ao(t,e){var i;return(i=mr({id:t})(e.getState()))==null?void 0:i.frequency}n(ao,"getSubscribedFrequency");function nu(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=ao(o,t);Ti(r.form,"selling_plan",i)})}n(nu,"synchronizeSellingPlan");function Un(t){return e=>r=>{var o;switch(r.type){case k:case F:case U:break;case Z:(o=r.payload.offer)!=null&&o.isCart?ru(t,r.payload.offer):eu(t,r.payload.offer);break;default:}switch(e(r),r.type){case k:case F:case U:case le:ou(r,t);case Z:case R:case X:nu(t,r.payload.offer);break;default:}}}n(Un,"shopifyMiddleware");At();q();A();q();var iu="/apps/subscriptions/auth/",Da="og_auth_begin",su="og_auth_end",au=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function Fa({store:t}){var i;let[e]=Oo(),r=Nt(),o=r!=null&&r.dataset.customer?au(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await pu(o);if(s){let[a,c,p]=s.split("|");t.dispatch(kt(e,a,Number(c),p))}}else vi("og_auth")}n(Fa,"authorizeShopifyCustomer");async function cu(t){try{let r=await(await fetch(`${iu}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Da);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Da.length,r.lastIndexOf(su)))}catch(e){console.error(e)}}n(cu,"fetchOGSignature");async function pu(t){let e=Oi("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await cu(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(pu,"getOrCreateAuthCookie");var Ua,Ma=Xi(...(Ua=L)!=null&&Ua.shopify_selling_plans?[kn,Un]:[ro],L.shopify&&Dn),w=An(Ma),lu=w.isReady,uu=w.addOptinChangedCallback,du=w.addTemplate,fu=w.clear,hu=w.config,mu=w.disableOptinChangedCallbacks,gu=w.getOptins,yu=w.getProductsForPurchasePost,bu=w.initialize,_u=w.previewMode,Su=w.register,Eu=w.resolveSettings,xu=w.setAuthUrl,vu=w.setEnvironment,Ou=w.setLocale,Tu=w.setMerchantId,Pu=w.setPublicPath,wu=w.setTemplates,Cu=w.setupCart,Ru=w.setupProduct,Au=w.setupProducts,Nu=n(()=>xi(w),"autoInit");var Iu=w.initialize,La;(La=L)!=null&&La.shopify_selling_plans&&yr(()=>Fa(w));return $n(ku);})();
1051
+ `}};n(Hr,"Price");var Yp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:Q(e.product)(t)}},"mapStateToProps"),js=g(Yp)(Hr);function cn(t){Ms(),ki(t);try{customElements.define("og-when",ds),customElements.define("og-text",xs),customElements.define("og-incentive-text",Ps),customElements.define("og-offer",ks),customElements.define("og-select-frequency",ws),customElements.define("og-optout-button",gs),customElements.define("og-optin-toggle",Es),customElements.define("og-optin-status",hs),customElements.define("og-optin-button",ms),customElements.define("og-optin-select",bs),customElements.define("og-upsell-button",_s),customElements.define("og-frequency-status",ys),customElements.define("og-modal",Nt),customElements.define("og-select",It),customElements.define("og-tooltip",kt),customElements.define("og-upsell-modal",Ss),customElements.define("og-next-upcoming-order",Rs),customElements.define("og-price",js),customElements.define("og-prepaid-toggle",qs),customElements.define("og-prepaid-data",Ds),customElements.define("og-prepaid-button",Fs),customElements.define("og-prepaid-select",Us),customElements.define("og-subscription-button",Ls)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(mo(o)),this},setMerchantId(o){return t.dispatch(ni(o)),this},setAuthUrl(o){return t.dispatch(ii(o)),this},getProductsForPurchasePost(o=[]){return _o(t.getState(),o)},getOptins(o=[]){return _o(t.getState(),o)},clear(){t.dispatch(pi())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",i=>o(i.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(di(o)),this},setLocale(o){return t.dispatch(ui(o)),this},addTemplate(o,i,s){return t.dispatch(fi(o,i,s)),this},setTemplates(o){return t.dispatch(hi(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}=Dt({},mo(i)),{sessionId:l}=a.getState();l&&c.forEach(f=>{let d=x(f);le.fetchOffer(p,o,l,`${d}`,Ee)}),s.product_discounts&&typeof s.product_discounts=="object"&&a.dispatch({type:V,payload:s.product_discounts})}},initialize(o,i,s){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,i,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),i&&i!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(i),s&&r.setAuthUrl(s),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),bo(window.opener,r),r}n(cn,"makeApi");var se=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),Gr=n(t=>`${t}%`,"percentage");var Br=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"),zr=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"),Wp=n(t=>{var e,r;return(t.selling_plan_id||((r=(e=t.selling_plan)==null?void 0:e.id)!=null?r:"")).toString()},"getAllocationFrequency"),Jp=n(t=>se(t.compare_at_price),"getAllocationRegularPrice"),Kp=n(t=>{var e;if(Br(t)){let r=zr((e=t.selling_plan)==null?void 0:e.options),o=Math.round(t.price/r);return se(o)}return se(t.price)},"getAllocationSubscriptionPrice"),Vs=n((t,e)=>Math.round((t.compare_at_price-e)*100/t.compare_at_price),"getPrepaidPercentage"),Qp=n(t=>{var r,o,i;if(Br(t)){let s=zr((r=t.selling_plan)==null?void 0:r.options),a=t.price/s,c=Vs(t,a);return Gr(c)}let e="";return((o=t.price_adjustments[0])==null?void 0:o.value_type)==="percentage"?e=Gr(t.price_adjustments[0].value):(i=t.price_adjustments[0])!=null&&i.value?e=se(t.price_adjustments[0].value):t.compare_at_price&&(e=se(t.compare_at_price-t.price)),e},"getAllocationDiscountRate"),Zp=n(t=>{var e;return Br(t)?zr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),Xp=n((t,e,r)=>{var l,f;let o=zr((l=t.selling_plan)==null?void 0:l.options),i=t.price/o,s=t.compare_at_price-i,a=Vs(t,i),c=(f=r==null?void 0:r.price_adjustments)==null?void 0:f[0],p=c&&c.value_type==="percentage"?c.value:null;return e.regularPrepaidPrice=se(t.price),e.prepaidSavingsPerShipment=se(Math.round(s)),e.prepaidSavingsTotal=se(Math.round(s*o)),p&&a&&(e.prepaidExtraSavingsPercentage=Gr(a-p)),e},"addPrepaidPriceAndSavings"),pn="Subscribe and Save",el=n((t,e=[])=>{t.selling_plan||(t.selling_plan=e.find(o=>o.id===t.selling_plan_id));let r={frequency:Wp(t),regularPrice:Jp(t),subscriptionPrice:Kp(t),discountRate:Qp(t),prepaidShipments:Zp(t)};if(Br(t)){let o=e.find(i=>i.group_name===pn&&i.options.length===1);return Xp(t,r,o)}return r},"mapSellingPlanToDiscount"),ln=n((t,e,r=[])=>[...t,el(e,r)],"sellingPlanAllocationsReducer"),Hs=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var Bs=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"),Gs=n((t,e,r)=>{if(!r)return null;if(!Be(r))return r;if(cr(t,e)){let o=X(t,e,r);return o||ue(t)}return r},"getDefaultSellingPlan"),tl=n((t,e)=>t.map(r=>{var o,i,s,a,c,p,l;return Be(r==null?void 0:r.frequency)?{...r,frequency:cr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(i=e==null?void 0:e.config)==null?void 0:i.frequenciesEveryPeriod)?X((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)||X((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)||ue((l=e==null?void 0:e.config)==null?void 0:l.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),rl=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],h;return r[c]&&cr(p,l)?h=X(p,l,`${d.every}_${d.every_period}`)||Gs(p,l,f)||ue(p):r[c]?h=`${d.every}_${d.every_period}`:h=Gs(p,l,f)||"_",a.concat({id:c,frequency:h})}return a},[]),"reduceNewOptinsFromOfferResponse"),zs=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===pn),"getOGSellingPlanGroup"),ol=n((t,e)=>({...Bs(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Ys=n((t,[e])=>({...t,[e]:!0}),"productTrue"),Ws=n((t,e)=>{let r=x(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),nl=n(t=>t.name.toUpperCase().includes("PREPAID"),"isPrepaidSellingPlanGroup"),il=n((t,e)=>{if(!t||t.length===0)return[];if(!e||e.length===0)return t;let r=e.reduce((o,i)=>(nl(i)||o.push(...i.selling_plans.map(s=>s.id)),o),[]);return t.filter(o=>r.includes(o.selling_plan_id))},"filterNonPrepaidSellingPlans"),sl=n((t={},e)=>{if(V===e.type)return Object.entries(e.payload).reduce(Ys,t);if(pe===e.type){let{payload:r}=e;return r.items.reduce(Ws,t)}if(Y===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,i)=>{let s=il(i==null?void 0:i.selling_plan_allocations,r==null?void 0:r.selling_plan_groups);return{...Bs(o,i.id,(s==null?void 0:s.length)>0),[i.id]:(s==null?void 0:s.length)>0}},t)}return t},"autoshipEligible");function al(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(al,"textToFreq");function Js(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>al(r))}n(Js,"sellingPlansToEveryPeriod");function Ks(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(Ks,"sellingPlansToFrequencies");function Qs(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(Qs,"getPrepaidShipments");function cl(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],i=r.selling_plans.map(s=>({numberShipments:Qs(s),sellingPlan:String(s.id)}));return{...e,[o]:i}},{})}n(cl,"getPrepaidSellingPlans");var pl=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o,i;if(V===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(Y===e.type){let{payload:{product:s}}=e,a={},c=zs(s),p=Ks(c);if(p!=null&&p.length){let f=Js(c),d=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||p,h=t.defaultFrequency;h&&Be(h)&&(h=X(p,f,h)||ue(p)||h),a={frequencies:p,frequenciesEveryPeriod:f,frequenciesText:d,...h?{defaultFrequency:h}:{}}}let l=s==null?void 0:s.selling_plan_groups.filter(f=>/^Prepaid-.*/.test(f.name));return l.length&&(a={...a,prepaidSellingPlans:{...t.prepaidSellingPlans,...cl(l)}}),{...t,...a}}if(w===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:ue(c)||a}:Be(a)?{...t,defaultFrequency:X(c,p,a)||ue(c)||a}:{...t,defaultFrequency:a}}return t},"config"),ll=n((t={},e)=>{var r;if(V===e.type)return Object.entries(e.payload).reduce(Ys,t);if(pe===e.type)return e.payload.items.reduce(Ws,t);if(Y===e.type){let{payload:{product:o}}=e;return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce(ol,t)||t}return z===e.type&&e.payload.product===null?{...t}:t},"inStock"),ul=n((t={},e)=>t,"offer");function dl({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(dl,"getFrequencyForPrepaidShipments");function fl(t){let e=Qs(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(fl,"getOptedInItem");var hl=n((t=[],e)=>{if(pe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,i)=>i.selling_plan_allocation?[...o,fl(i)]:o,[]))}if(w===e.type){let{offer:r={},...o}=e.payload,i=tl(t,r),s=rl(o,i,r);return[...i,...s]}if(Y===e.type){let{product:r}=e.payload,o=zs(r);if(!o)return t;let i=Ks(o),s=Js(o);return t.map(a=>Be(a.frequency)?{...a,frequency:X(i,s,a.frequency)||ue(i)}:a)}if(ne===e.type){let{payload:r}=e,o=jr(t,e),[i,s]=ze(o,r.product);return s.concat({...i,...r.product,frequency:dl(r)})}return jr(t,e)},"optedin"),ml=n((t={},e)=>t,"productOffer"),gl=n((t={},e)=>{var r;if(Y===e.type){let{payload:{product:o}}=e,i=Hs(o);return[o,...(r=o==null?void 0:o.variants)!=null?r:[]].reduce((s,a)=>{var c;return{...s,[a.id]:(c=a.selling_plan_allocations)==null?void 0:c.reduce((p,l)=>ln(p,l,i),[])}},t)||t}return pe===e.type?e.payload.items.reduce((i,s)=>s.selling_plan_allocation?{...i,[s.key]:ln([],s.selling_plan_allocation)}:i,t)||t:V===e.type?We(e.payload):t},"productPlans"),yl=Ut({auth:Yo,authUrl:Jo,autoshipByDefault:on,autoshipEligible:sl,config:pl,defaultFrequencies:nn,eligibilityGroups:Bo,environment:Dt,firstOrderPlaceDate:Zo,incentives:zo,inStock:ll,locale:en,merchantId:Wo,nextUpcomingOrder:Go,offer:ul,offerId:Ko,optedin:hl,optedout:Ho,previewStandardOffer:tn,previewUpsellOffer:rn,productOffer:ml,productPlans:gl,productToSubscribe:Xo,sessionId:Qo,templates:sn,prepaidShipmentsSelected:an});function un(t,e){return window.og&&window.og.previewMode?Vr(t,e):yl(t,e)}n(un,"shopifyReducer");var ta=ae(gt()),ra=ae(Mt());function Zs(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(Zs,"updateTrackingInputs");function dn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(dn,"getTrackingKey");function bl(t,e){var f,d,h,T;if(!((f=t.payload.offer)==null?void 0:f.autoshipByDefault))return;let o=(d=t.payload.offer)==null?void 0:d.product.id,i=dn(),s=((h=t.payload.offer)==null?void 0:h.location)||"",a=((T=t.payload.offer)==null?void 0:T.variationId)||"",c=Yr(o,e),l=[o,R.toLowerCase(),s,c,a].join(",");Zs(o,i,l)}n(bl,"addDefaultToSubTracking");function fn(t){return e=>r=>{switch(e(r),r.type){case R:case N:case I:{let o=r.payload.offer,i=hn(r);o&&!o.isCart&&Zs(o.product.id,i[0],i[1]);break}case w:bl(r,t);break;default:}}}n(fn,"shopifyTrackingMiddleware");var Xs,ea,oa=((ea=(Xs=window.Shopify)==null?void 0:Xs.routes)==null?void 0:ea.root)||"/",_l="/cart",Sl=`${oa}cart.js`,El=`${oa}products/`,xl='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',vl=n(t=>(0,ra.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 Ol(t,e){let r=Tl(e);if(r)try{let i=await ia(r);t.dispatch({type:Y,payload:{product:i,offer:e}})}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=vl(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(Ol,"setupPdp");var na=n(async()=>await(await fetch(Sl)).json(),"getCart");function Tl(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(Tl,"guessProductHandle");var ia=(0,ta.default)(async t=>(await fetch(`${El}${t}.js`)).json());async function Pl(t,e){let r=await na(),{items:o}=r;t.dispatch({type:pe,payload:r});let i=Number(e.product.id);i<=o.length&&e.setAttribute("product",o[i-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(ia))).forEach(a=>t.dispatch({type:Y,payload:{product:a,offer:e}}))}n(Pl,"setupCart");async function wl(t,e){var s,a;let r=t.payload.offer,o=t.payload.frequency||Yr(t.payload.product.id,e),i=hn(t);if(!!(r!=null&&r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(xl)),p=t.payload.product.id,l=await na(),f=(s=l==null?void 0:l.items)==null?void 0:s.findIndex(b=>b.key===p),d=l.items[f],h=d.quantity,T=x(p),S=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p,quantity:h,attributes:Object.fromEntries([i]),properties:d.properties,selling_plan:o||null,sections:c.map(b=>b.id.replace(/^shopify-section-/,""))})});if(S.status!==200)throw new Error("Cart not updated");let m=await S.json(),E=l.items.length===m.items.length?m.items[f].key:(a=m.items.find(b=>b.quantity===h&&b.product_id===T&&(!o&&!b.selling_plan_allocation||(b==null?void 0:b.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;E&&(e.dispatch({type:ut,payload:{oldCartProductKey:p,newCartProductKey:E}}),r.setAttribute("product",E)),e.dispatch({type:pe,payload:m});let P=new CustomEvent(Un,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(P),P.defaultPrevented)return;let _=m.sections;Object.values(_).length?c.forEach(b=>{let Ft=b.id.replace(/^shopify-section-/,"");if(!(Ft in _))return;let ua=_[Ft],gn=new DOMParser().parseFromString(ua.toString()||"","text/html").getElementById(b.id);gn&&(b.innerHTML=gn.innerHTML)}):window.location.pathname.startsWith(_l)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(wl,"synchronizeCartOptin");function hn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=dn(),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 z:case N:s.push(""),s.push(i);break;case R:case I:s.push(t.payload.frequency),s.push(i);break;default:return[]}return[r,s.join(",")]}n(hn,"getTrackingEvent");function Yr(t,e){var i;return(i=ir({id:t})(e.getState()))==null?void 0:i.frequency}n(Yr,"getSubscribedFrequency");function Cl(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,i=Yr(o,t);ti(r.form,"selling_plan",i)})}n(Cl,"synchronizeSellingPlan");function mn(t){return e=>r=>{var o;switch(r.type){case R:case N:case I:break;case z:(o=r.payload.offer)!=null&&o.isCart?Pl(t,r.payload.offer):Ol(t,r.payload.offer);break;default:}switch(e(r),r.type){case R:case N:case I:case ne:wl(r,t);case z:case w:case Y:Cl(t,r.payload.offer);break;default:}}}n(mn,"shopifyMiddleware");var Rl="/apps/subscriptions/auth/",sa="og_auth_begin",Al="og_auth_end",Nl=n(t=>{let[e,r,o,i]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:i}},"parseIntegrationTempAuth");async function aa({store:t}){var i;let[e]=co(),r=Et(),o=r!=null&&r.dataset.customer?Nl(r.dataset.customer):(i=window.ogShopifyConfig)==null?void 0:i.customer;if(o){let s=await kl(o);if(s){let[a,c,p]=s.split("|");t.dispatch(vt(e,a,Number(c),p))}}else Xn("og_auth")}n(aa,"authorizeShopifyCustomer");async function Il(t){try{let r=await(await fetch(`${Rl}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(sa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+sa.length,r.lastIndexOf(Al)))}catch(e){console.error(e)}}n(Il,"fetchOGSignature");async function kl(t){let e=ei("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:i}=await Il(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(kl,"getOrCreateAuthCookie");var ca,la=Ri(...(ca=k)!=null&&ca.shopify_selling_plans?[un,mn]:[Vr],k.shopify&&fn),O=cn(la),ql=O.isReady,Dl=O.addOptinChangedCallback,Fl=O.addTemplate,Ul=O.clear,Ll=O.config,Ml=O.disableOptinChangedCallbacks,$l=O.getOptins,jl=O.getProductsForPurchasePost,Vl=O.initialize,Hl=O.previewMode,Gl=O.register,Bl=O.resolveSettings,zl=O.setAuthUrl,Yl=O.setEnvironment,Wl=O.setLocale,Jl=O.setMerchantId,Kl=O.setPublicPath,Ql=O.setTemplates,Zl=O.setupCart,Xl=O.setupProduct,eu=O.setupProducts,tu=n(()=>Zn(O),"autoInit");var ru=O.initialize,pa;(pa=k)!=null&&pa.shopify_selling_plans&&ar(()=>aa(O));return ya(ou);})();
1052
1052
  ; return lib; });
1053
1053
  //# sourceMappingURL=offers.js.map