@ordergroove/offers 2.30.1-alpha-PR-714-9.8 → 2.30.1

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,8 +8,8 @@ else {
8
8
  window.og['offers'] = factory();
9
9
  }
10
10
  })(()=>{
11
- var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.getOwnPropertyDescriptor;var Da=Object.getOwnPropertyNames;var Fa=Object.getPrototypeOf,Ua=Object.prototype.hasOwnProperty;var In=t=>rt(t,"__esModule",{value:!0}),n=(t,e)=>rt(t,"name",{value:e,configurable:!0});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ur=(t,e)=>{In(t);for(var r in e)rt(t,r,{get:e[r],enumerable:!0})},La=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Da(e))!Ua.call(t,o)&&o!=="default"&&rt(t,o,{get:()=>e[o],enumerable:!(r=qa(e,o))||r.enumerable});return t},ce=t=>La(In(rt(t!=null?ka(Fa(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var qt=_e((kt,jn)=>{(function(t,e){typeof kt=="object"&&typeof jn!="undefined"?e(kt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(kt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,p=0;function h(){c&&clearTimeout(c)}n(h,"clearExistingTimeout");function u(){h(),l=!0}n(u,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function f(){for(var P=arguments.length,_=new Array(P),m=0;m<P;m++)_[m]=arguments[m];var x=this,C=Date.now()-p;if(l)return;function b(){p=Date.now(),i.apply(x,_)}n(b,"exec");function y(){c=void 0}n(y,"clear"),a&&!c&&b(),h(),a===void 0&&C>o?b():s!==!0&&(c=setTimeout(a?y:b,a===void 0?o-C:o))}return n(f,"wrapper"),f.cancel=u,f}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});function Vn(){return typeof window.og_auth!="undefined"?Dt(window.og_auth):null}async function Ya(t=100){return new Promise(e=>{setTimeout(()=>e(Vn()),t)})}async function Hn(t,e=Ba,r=za){let o;if(o=Dt(Vn())||Dt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(Wa(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ya());if(o=Dt(o),o)return o;throw new Error("Unauthorized")}var $n,Ba,Dt,za,Wa,Gn=S(()=>{$n=/^og_auth=/,Ba=n((t=$n)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace($n,""),"c"),Dt=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"),za=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"),Wa=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(Vn,"a");n(Ya,"f");n(Hn,"u")});var N,q,D,te,Ue,Y,R,nt,Le,Ft,Bn,Ut,Se,zn,Lt,Mt,Wn,Me,je,$e,Yn,Jn,jt,Qn,$t,Ve,Kn,Vt,He,st,it,Hr,Ht,Gt,Ee,le,Bt,zt,re,Wt,J,pe,xe,Yt,ve,Te,Jt,Qt,Zn,j=S(()=>{N="OPTIN_PRODUCT",q="OPTOUT_PRODUCT",D="PRODUCT_CHANGE_FREQUENCY",te="PRODUCT_CHANGE_PREPAID_SHIPMENTS",Ue="SET_MERCHANT_ID",Y="REQUEST_OFFER",R="RECEIVE_OFFER",nt="PRODUCT_HAS_CHANGED",Le="CREATED_SESSION_ID",Ft="SET_AUTH_URL",Bn="REQUEST_AUTH",Ut="AUTHORIZE",Se="UNAUTHORIZED",zn="REQUEST_ORDERS",Lt="RECEIVE_ORDERS",Mt="RECEIVE_ORDER_ITEMS",Wn="FETCH_RESPONSE_ERROR",Me="SET_ENVIRONMENT_STAGING",je="SET_ENVIRONMENT_DEV",$e="SET_ENVIRONMENT_PROD",Yn="CONCLUDE_UPSELL",Jn="REQUEST_CREATE_IU_ORDER",jt="CREATE_ONE_TIME",Qn="REQUEST_CONVERT_ONE_TIME",$t="CONVERT_ONE_TIME",Ve="CHECKOUT",Kn="RECEIVE_FETCH",Vt="SET_LOCALE",He="SET_CONFIG",st="SET_PREVIEW_STANDARD_OFFER",it="SET_PREVIEW_UPSELL_OFFER",Hr="SET_PREVIEW_PREPAID_OFFER",Ht="ADD_TEMPLATE",Gt="SET_TEMPLATES",Ee="LOCAL_STORAGE_CHANGE",le="LOCAL_STORAGE_CLEAR",Bt="SET_FIRST_ORDER_PLACE_DATE",zt="SET_PRODUCT_TO_SUBSCRIBE",re="RECEIVE_PRODUCT_PLANS",Wt="ADD_PRODUCT_PLANS",J="SETUP_PRODUCT",pe="SETUP_CART",xe="pdp",Yt="dev",ve="staging",Te="prod",Jt="static.ordergroove.com",Qt="staging.static.ordergroove.com",Zn="og-cart-updated"});var ct=_e((Pu,is)=>{var Ja="Expected a function",Xn="__lodash_hash_undefined__",Qa="[object Function]",Ka="[object GeneratorFunction]",Za=/[\\^$.*+?()[\]{}|]/g,Xa=/^\[object .+?Constructor\]$/,ec=typeof window=="object"&&window&&window.Object===Object&&window,tc=typeof self=="object"&&self&&self.Object===Object&&self,es=ec||tc||Function("return this")();function rc(t,e){return t==null?void 0:t[e]}n(rc,"getValue");function oc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(oc,"isHostObject");var nc=Array.prototype,sc=Function.prototype,ts=Object.prototype,Gr=es["__core-js_shared__"],rs=function(){var t=/[^.]+$/.exec(Gr&&Gr.keys&&Gr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),os=sc.toString,Br=ts.hasOwnProperty,ic=ts.toString,ac=RegExp("^"+os.call(Br).replace(Za,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cc=nc.splice,lc=ns(es,"Map"),at=ns(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 pc(){this.__data__=at?at(null):{}}n(pc,"hashClear");function uc(t){return this.has(t)&&delete this.__data__[t]}n(uc,"hashDelete");function dc(t){var e=this.__data__;if(at){var r=e[t];return r===Xn?void 0:r}return Br.call(e,t)?e[t]:void 0}n(dc,"hashGet");function fc(t){var e=this.__data__;return at?e[t]!==void 0:Br.call(e,t)}n(fc,"hashHas");function hc(t,e){var r=this.__data__;return r[t]=at&&e===void 0?Xn:e,this}n(hc,"hashSet");Oe.prototype.clear=pc;Oe.prototype.delete=uc;Oe.prototype.get=dc;Oe.prototype.has=fc;Oe.prototype.set=hc;function Ge(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(Ge,"ListCache");function mc(){this.__data__=[]}n(mc,"listCacheClear");function gc(t){var e=this.__data__,r=Kt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():cc.call(e,r,1),!0}n(gc,"listCacheDelete");function yc(t){var e=this.__data__,r=Kt(e,t);return r<0?void 0:e[r][1]}n(yc,"listCacheGet");function bc(t){return Kt(this.__data__,t)>-1}n(bc,"listCacheHas");function _c(t,e){var r=this.__data__,o=Kt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(_c,"listCacheSet");Ge.prototype.clear=mc;Ge.prototype.delete=gc;Ge.prototype.get=yc;Ge.prototype.has=bc;Ge.prototype.set=_c;function Pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Pe,"MapCache");function Sc(){this.__data__={hash:new Oe,map:new(lc||Ge),string:new Oe}}n(Sc,"mapCacheClear");function Ec(t){return Zt(this,t).delete(t)}n(Ec,"mapCacheDelete");function xc(t){return Zt(this,t).get(t)}n(xc,"mapCacheGet");function vc(t){return Zt(this,t).has(t)}n(vc,"mapCacheHas");function Tc(t,e){return Zt(this,t).set(t,e),this}n(Tc,"mapCacheSet");Pe.prototype.clear=Sc;Pe.prototype.delete=Ec;Pe.prototype.get=xc;Pe.prototype.has=vc;Pe.prototype.set=Tc;function Kt(t,e){for(var r=t.length;r--;)if(Rc(t[r][0],e))return r;return-1}n(Kt,"assocIndexOf");function Oc(t){if(!ss(t)||wc(t))return!1;var e=Ac(t)||oc(t)?ac:Xa;return e.test(Cc(t))}n(Oc,"baseIsNative");function Zt(t,e){var r=t.__data__;return Pc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Zt,"getMapData");function ns(t,e){var r=rc(t,e);return Oc(r)?r:void 0}n(ns,"getNative");function Pc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Pc,"isKeyable");function wc(t){return!!rs&&rs in t}n(wc,"isMasked");function Cc(t){if(t!=null){try{return os.call(t)}catch{}try{return t+""}catch{}}return""}n(Cc,"toSource");function zr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Ja);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(zr.Cache||Pe),r}n(zr,"memoize");zr.Cache=Pe;function Rc(t,e){return t===e||t!==t&&e!==e}n(Rc,"eq");function Ac(t){var e=ss(t)?ic.call(t):"";return e==Qa||e==Ka}n(Ac,"isFunction");function ss(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(ss,"isObject");is.exports=zr});var Xt,Wr,lt,pt,er,as,cs,Nc,Ic,kc,qc,Dc,ut,Yr,Fc,ls,dt,Uc,ue,de=S(()=>{Xt=ce(ct()),Wr=n((...t)=>JSON.stringify(t),"memoizeKey"),lt=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),pt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),er=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,{...s,headers:{Authorization:JSON.stringify(e),...s.headers}}]},"withAuth"),as=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"),cs=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Nc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Ic=(0,Xt.default)(lt(pt((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=cs([["session_id",e],["page_type",1],["p",Nc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Wr),kc=(0,Xt.default)(lt(pt(er((t=1,e="place")=>[`/orders/?${cs([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Wr),qc=(0,Xt.default)(lt(pt(er(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Wr),Dc=lt(pt(er(as((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}}]})))),ut=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"),Yr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Fc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),ls=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Yr).sort(Fc),"parseFrequenciesList"),dt=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"),Uc=lt(pt(er(as((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=ut(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),ue={fetchOffer:Ic,fetchOrders:kc,fetchItems:qc,createOneTime:Dc,convertOneTimeToSubscription:Uc}});var Jr,L,ft=S(()=>{F();Jr=ht(),L={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Jr==null?void 0:Jr.dataset.shopifySellingPlans)!="undefined"}});function Lc(t,e){return t===e}function Mc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function jc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lc,r=null,o=null;return function(){return Mc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function $c(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 Vc(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 s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),p=$c(i),h=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var f=[],P=p.length,_=0;_<P;_++)f.push(p[_].apply(null,arguments));return h.apply(null,f)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}var Q,ps=S(()=>{n(Lc,"defaultEqualityCheck");n(Mc,"areArgumentsShallowlyEqual");n(jc,"defaultMemoize");n($c,"getDependencies");n(Vc,"createSelectorCreator");Q=Vc(jc)});function Hc(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 Gc(t,e,r){let o=dt(r);return L.shopify_selling_plans?X(t,e,o):o}var B,I,mt,us,Qr,Bc,zc,Wc,Yc,Jc,K,tr,ds,rr,or,Z,nr,fs,Be,Kr,H,ze,U=S(()=>{ps();B=ce(ct());de();ft();F();B.default.Cache=Map;n(Hc,"arraysEqual");n(Gc,"resolveFrequency");I=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Hc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),mt=n(t=>t.optedin||[],"optedinSelector"),us=n(t=>t.optedout||[],"optedoutSelector"),Qr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Bc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),zc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Wc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Yc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),Jc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),K=(0,B.default)(t=>Q(mt,us,Qr,(e,r,o)=>{let s=e.find(i=>I(t,i));return s||(r.find(i=>I(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),tr=(0,B.default)(t=>Q(mt,e=>{let r=e.find(o=>I(t,o));return r||!1}),t=>JSON.stringify(t)),ds=(0,B.default)(t=>Q(mt,e=>e.some(r=>I(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),rr=(0,B.default)(t=>Q(Jc,e=>e[t.id]||null),t=>JSON.stringify(t)),or=(0,B.default)(t=>Q(us,e=>e.find(r=>I(t,r)))),Z=(0,B.default)(t=>Q(K(t),e=>e&&e.frequency||null)),nr=(0,B.default)(t=>Q(K(t),e=>e&&e.prepaidShipments||null)),fs=(0,B.default)(t=>Q(Yc,e=>{var r;return((r=e[t])==null?void 0:r.map(({numberShipments:o})=>o))||[]})),Be=(0,B.default)(t=>Q(Bc,zc,Wc,(e,r,o)=>e[w(t)]&&Gc(r,o,e[w(t)])||null)),Kr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Kr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),ze=n(t=>({templates:t.templates||[]}),"templatesSelector")});function sr(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function ht(){return document.querySelector([`script[src^="https://${Jt}"]`,`script[src^="https://${Qt}"]`,`script[src^="http://${Jt}"]`,`script[src^="http://${Qt}"]`].join(","))}function Zr(){let t=ht();if(!t)return[];let e=new URL(t.src),r=e.host.startsWith(ve)?ve:Te,o=e.pathname.split("/")[1];return!r&&!o?[]:[o,r,t]}function ms(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Zr();if(!r&&!e)return;let o=document.createElement("script");o.onload=()=>console.info("OG pull initialization chunk for merchant",e,r),o.onerror=()=>t.initialize(e,r),o.src=`${window.location.protocol}//${r===Te?Jt:Qt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function ys(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function bs(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 Ye(t,e){let[[r],o]=t.reduce((s,i)=>s[I(e,i)?0:1].push(i)&&s,[[],[]]);return[r||{},o||[]]}var w,hs,Xr,gs,We,we,ir,X,F=S(()=>{ft();j();U();n(sr,"onReady");n(ht,"getMainJs");n(Zr,"resolveEnvAndMerchant");w=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=L)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),hs=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"),Xr=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(ms,"autoInitializeOffers");gs=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(ys,"getCookieValue");We=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),we=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),ir=n((t=[],e=[])=>{var r;return!!(((r=L)==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(s=>s===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");n(bs,"getOrCreateHidden");n(Ye,"getMatchingProductIfExists")});var oe,Je,_s,ar,Ss,Es,xs,eo,Qc,gt,fe,vs,cr,Ts,Kc,to,ro,lr,oo,Os,Ce,no,Zc,Ps,ws,Xc,el,tl,rl,Cs,Rs,As,Ns,Is,ks,qs,k=S(()=>{Gn();j();de();F();oe=n((t,e,r)=>({type:N,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),Je=n((t,e)=>({type:q,payload:{product:t,offer:e}}),"optoutProduct"),_s=n((t,e)=>({type:nt,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),ar=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),Ss=n((t,e,r)=>({type:te,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments"),Es=n(t=>({type:Yn,payload:{product:t}}),"concludeUpsell"),xs=n(t=>({type:Ue,payload:t}),"setMerchantId"),eo=n(t=>({type:Le,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Qc=n(t=>({type:Bn,payload:t}),"requestAuth"),gt=n((t,e,r,o)=>({type:Ut,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),fe=n(t=>({type:Se,payload:t}),"unauthorized"),vs=n(t=>({type:Ft,payload:t}),"setAuthUrl"),cr=n(t=>({type:Kn,payload:t}),"fetchDone"),Ts=n((t=Hn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(fe({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=Qc(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:p})=>r(gt(s,c,l,p)),c=>r(fe(c))).finally(()=>r(cr(a)))},"fetchAuthThunk"),"fetchAuth"),Kc=n((t,e)=>({type:zn,payload:{status:t,ordering:e}}),"requestOrders"),to=n(t=>({type:Lt,payload:t}),"receiveOrders"),ro=n(t=>({type:Mt,payload:t}),"receiveItems"),lr=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(fe("No auth set."));let c=Kc(t,e);return o(c),ue.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(to(l));let p=(l.results[0]||{}).public_id;if(p)return ue.fetchItems(i,a,p).then(h=>o(ro(h)))}return o(fe(l.detail)),null},l=>o(fe(l))).finally(()=>o(cr(c)))},"fetchOrdersThunk"),"fetchOrders"),oo=n(t=>{switch(t){case Yt:return{type:je,payload:t};case ve:return{type:Me,payload:t};case Te:return{type:$e,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Os=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(eo(r)),o},"requestSessionId"),Ce=n((t,e)=>({type:R,payload:{...t,offer:e}}),"receiveOffer"),no=n(t=>({type:Wn,payload:t}),"fetchResponseError"),Zc=n((t,e=xe,r)=>({type:Y,payload:{product:t,module:e,offer:r}}),"requestOffer"),Ps=n((t,e=xe,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),p=Zc(t,e,r);s(p);let h=w(t);return h?ue.fetchOffer(l,a,c,h,e).then(u=>s(Ce(u,r)),u=>s(no(u))).finally(()=>s(cr(p))):null},"fetchOfferThunk"),"fetchOffer"),ws=n(()=>({type:Ve}),"checkout"),Xc=n((t,e,r,o)=>({type:Jn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),el=n(t=>({type:jt,payload:t}),"receiveCreateOneTime"),tl=n((t,e)=>({type:Qn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),rl=n((t,e)=>({type:$t,payload:{response:t,product:e}}),"receiveConvertOneTime"),Cs=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:h},previewUpsellOffer:u,offerId:f}=c();if(!l)return a(fe("No auth set."));let P=hs(s,p),_=Xc(t,e,r,f);return a(_),(u?Promise.resolve({legoUrl:h,product:t,order:e,quantity:r,offer:f}):ue.createOneTime(h,l,t.id,e,r,f)).then(m=>(a(el(m)),o?(a(tl(m,P)),(u?Promise.resolve({item:m,frequency:P}):ue.convertOneTimeToSubscription(h,l,m,P,f)).then(x=>a(rl(x,t)),x=>a(no(x)))):m),m=>a(no(m))).finally(()=>a(cr(_)))},"createIuThunk"),"createIu"),Rs=n(t=>({type:Vt,payload:t}),"setLocale"),As=n(t=>({type:He,payload:t}),"setConfig"),Ns=n((t,e,r)=>({type:Ht,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Is=n(t=>({type:Gt,payload:t}),"setTemplates"),ks=n((t,e)=>({type:Bt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),qs=n((t,e)=>({type:zt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var lo,Re,Ae=S(()=>{lo=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Re=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var G,po,Zs,Qe,Ne,Xs,_t,ee,dr,he=S(()=>{G=`{{lit-${String(Math.random()).slice(2)}}}`,po=`<!--${G}-->`,Zs=new RegExp(`${G}|${po}`),Qe="$lit$",Ne=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:p,values:{length:h}}=e;for(;l<h;){let u=i.nextNode();if(u===null){i.currentNode=s.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let f=u.attributes,{length:P}=f,_=0;for(let m=0;m<P;m++)Xs(f[m].name,Qe)&&_++;for(;_-- >0;){let m=p[l],x=dr.exec(m)[2],C=x.toLowerCase()+Qe,b=u.getAttribute(C);u.removeAttribute(C);let y=b.split(Zs);this.parts.push({type:"attribute",index:c,name:x,strings:y}),l+=y.length-1}}u.tagName==="TEMPLATE"&&(s.push(u),i.currentNode=u.content)}else if(u.nodeType===3){let f=u.data;if(f.indexOf(G)>=0){let P=u.parentNode,_=f.split(Zs),m=_.length-1;for(let x=0;x<m;x++){let C,b=_[x];if(b==="")C=ee();else{let y=dr.exec(b);y!==null&&Xs(y[2],Qe)&&(b=b.slice(0,y.index)+y[1]+y[2].slice(0,-Qe.length)+y[3]),C=document.createTextNode(b)}P.insertBefore(C,u),this.parts.push({type:"node",index:++c})}_[m]===""?(P.insertBefore(ee(),u),o.push(u)):u.data=_[m],l+=m}}else if(u.nodeType===8)if(u.data===G){let f=u.parentNode;(u.previousSibling===null||c===a)&&(c++,f.insertBefore(ee(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let f=-1;for(;(f=u.data.indexOf(G,f+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(Ne,"Template");Xs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),_t=n(t=>t.index!==-1,"isTemplatePartActive"),ee=n(()=>document.createComment(""),"createMarker"),dr=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function fo(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,uo,null,!1),i=St(o),a=o[i],c=-1,l=0,p=[],h=null;for(;s.nextNode();){c++;let u=s.currentNode;for(u.previousSibling===h&&(h=null),e.has(u)&&(p.push(u),h===null&&(h=u)),h!==null&&l++;a!==void 0&&a.index===c;)a.index=h!==null?-1:a.index-l,i=St(o,i),a=o[i]}p.forEach(u=>u.parentNode.removeChild(u))}function ei(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,uo,null,!1),a=St(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=pl(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=St(s,a);return}a=St(s,a)}}var uo,pl,St,ti=S(()=>{he();uo=133;n(fo,"removeNodesFromTemplate");pl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,uo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),St=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(_t(o))return r}return-1},"nextActiveIndexInTemplateParts");n(ei,"insertNodeIntoTemplate")});var ul,Ie,ho=S(()=>{ul=new WeakMap,Ie=n(t=>typeof t=="function"&&ul.has(t),"isDirective")});var $,fr,mo=S(()=>{$={},fr={}});var me,hr=S(()=>{Ae();he();me=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=lo?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!_t(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let p=this.processor.handleTextExpression(this.options);p.insertAfterNode(l.previousSibling),this.__parts.push(p)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return lo&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(me,"TemplateInstance")});var ri,fl,ne,mr=S(()=>{Ae();he();ri=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),fl=` ${G} `,ne=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=dr.exec(i);c===null?r+=i+(o?fl:po):r+=i.substr(0,c.index)+c[1]+c[2]+Qe+c[3]+G}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return ri!==void 0&&(r=ri.createHTML(r)),e.innerHTML=r,e}};n(ne,"TemplateResult")});var gr,yr,Ke,Et,se,xt,vt,br,oi,Tt,hl,_r=S(()=>{ho();Ae();mo();hr();mr();he();gr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),yr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ke=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new Et(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!yr(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(gr(c)||!yr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ke,"AttributeCommitter");Et=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==$&&(!gr(e)||e!==this.value)&&(this.value=e,Ie(e)||(this.committer.dirty=!0))}commit(){for(;Ie(this.value);){let e=this.value;this.value=$,e(this)}this.value!==$&&this.committer.commit()}};n(Et,"AttributePart");se=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(;Ie(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}let e=this.__pendingValue;e!==$&&(gr(e)?e!==this.value&&this.__commitText(e):e instanceof ne?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):yr(e)?this.__commitIterable(e):e===fr?(this.value=fr,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e??"";let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof me&&this.value.template===r)this.value.update(e.values);else{let o=new me(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new se(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){Re(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(se,"NodePart");xt=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(;Ie(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}if(this.__pendingValue===$)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=$}};n(xt,"BooleanAttributePart");vt=class extends Ke{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new br(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(vt,"PropertyCommitter");br=class extends Et{};n(br,"PropertyPart");oi=!1;(()=>{try{let t={get capture(){return oi=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();Tt=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;Ie(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=$,i(this)}if(this.__pendingValue===$)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=hl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=$}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Tt,"EventPart");hl=n(t=>t&&(oi?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function go(t){let e=ke.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},ke.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(G);return r=e.keyString.get(o),r===void 0&&(r=new Ne(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var ke,Sr=S(()=>{he();n(go,"templateFactory");ke=new Map});var ge,yo,bo=S(()=>{Ae();_r();Sr();ge=new WeakMap,yo=n((t,e,r)=>{let o=ge.get(e);o===void 0&&(Re(e,e.firstChild),ge.set(e,o=new se(Object.assign({templateFactory:go},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Er,_o,So=S(()=>{_r();Er=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new vt(e,r.slice(1),o).parts:i==="@"?[new Tt(e,r.slice(1),s.eventContext)]:i==="?"?[new xt(e,r.slice(1),o)]:new Ke(e,r,o).parts}handleTextExpression(e){return new se(e)}};n(Er,"DefaultTemplateProcessor");_o=new Er});var d,Eo=S(()=>{So();mr();So();ho();Ae();mo();_r();bo();Sr();hr();mr();he();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new ne(t,e,"html",_o),"html")});var si,xr,gl,yl,bl,ii,_l,ai,ci=S(()=>{Ae();ti();bo();Sr();hr();he();Eo();si=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),xr=!0;typeof window.ShadyCSS=="undefined"?xr=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),xr=!1);gl=n(t=>e=>{let r=si(e.type,t),o=ke.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},ke.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(G);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();xr&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Ne(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),yl=["html","svg"],bl=n(t=>{yl.forEach(e=>{let r=ke.get(si(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),fo(o,i)})})},"removeStylesFromLitTemplates"),ii=new Set,_l=n((t,e,r)=>{ii.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let p=0;p<i;p++){let h=s[p];h.parentNode.removeChild(h),a.textContent+=h.textContent}bl(t);let c=o.content;r?ei(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let p=new Set;p.add(a),fo(r,p)}},"prepareTemplateStyles"),ai=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ge.has(e),i=xr&&e.nodeType===11&&!!e.host,a=i&&!ii.has(o),c=a?document.createDocumentFragment():e;if(yo(t,c,Object.assign({templateFactory:gl(o)},r)),a){let l=ge.get(c);ge.delete(c);let p=l.value instanceof me?l.value.template:void 0;_l(o,c,p),Re(e,e.firstChild),e.appendChild(c),ge.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var li,xo,pi,vo,To,Oo,Po,wo,Co,Ot,Ro=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;xo={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}},pi=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),vo={attribute:!0,type:String,converter:xo,reflect:!1,hasChanged:pi},To=1,Oo=1<<2,Po=1<<3,wo=1<<4,Co="finalized",Ot=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),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=vo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||vo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Co)||e.finalize(),this[Co]=!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 s of o)this.createProperty(s,r[s])}}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=pi){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||xo,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||xo.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=vo){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Po,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Po}}_attributeToProperty(e,r){if(this._updateState&Po)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|wo,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~wo}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&wo)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|Oo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Oo}get hasUpdated(){return this._updateState&To}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&To||(this._updateState=this._updateState|To,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Oo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(Ot,"UpdatingElement");li=Co;Ot[li]=!0});var ui,df,di=S(()=>{ui=Element.prototype,df=ui.msMatchesSelector||ui.webkitMatchesSelector});var vr,Ao,Pt,fi,Sl,E,No=S(()=>{vr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ao=Symbol(),Pt=class{constructor(e,r){if(r!==Ao)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(vr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Pt,"CSSResult");fi=n(t=>new Pt(String(t),Ao),"unsafeCSS"),Sl=n(t=>{if(t instanceof Pt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
12
- take care to ensure page security.`)},"textFromCSSResult"),E=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+Sl(s)+t[i+1],t[0]);return new Pt(r,Ao)},"css")});var hi,v,O=S(()=>{ci();Ro();Ro();di();Eo();No();No();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");hi={},v=class extends Ot{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((i,a)=>i.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!vr){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return fi(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):vr?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!==hi&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return hi}};n(v,"LitElement");v.finalized=!0;v.render=ai});var Tr=_e((vf,mi)=>{var El={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"};mi.exports=El});var yi=_e((Tf,gi)=>{var qe=Tr(),xl=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case qe.PAR_OPEN:case qe.PAR_CLOSE:case qe.OP_NOT:case qe.BINARY_AND:case qe.BINARY_OR:e&&(r.push({type:qe.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:qe.LITERAL,value:e}),r},"Tokenizer");gi.exports=xl});var _i=_e((Of,bi)=>{var ye=Tr(),vl=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case ye.LITERAL:e.unshift(s);break;case ye.BINARY_AND:case ye.BINARY_OR:case ye.OP_NOT:case ye.PAR_OPEN:r.push(s);break;case ye.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ye.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ye.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),Tl=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");bi.exports={PolishNotation:vl,PolishGenerator:Tl}});var Ei=_e((Pf,Si)=>{var V=Tr(),z=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}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 Ze=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(Ze(t));case V.BINARY_AND:{let r=Ze(t),o=Ze(t);return z.CreateAnd(r,o)}case V.BINARY_OR:{let r=Ze(t),o=Ze(t);return z.CreateOr(r,o)}}return null},"make"),Xe=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===V.OP_NOT)return!Xe(t.left,e);if(t.op===V.BINARY_OR)return Xe(t.left,e)||Xe(t.right,e);if(t.op===V.BINARY_AND)return Xe(t.left,e)&&Xe(t.right,e)},"nodeEvaluator");Si.exports={make:Ze,nodeEvaluator:Xe}});var Oi=_e((wf,Ti)=>{var Ol=yi(),xi=_i(),vi=Ei(),Pl=n((t,e)=>{let r=Ol(t),o=xi.PolishNotation(r),s=xi.PolishGenerator(o),i=vi.make(s);return vi.nodeEvaluator(i,e)},"parse");Ti.exports={parse:Pl}});var oa={};Ur(oa,{TestWizard:()=>Nr,default:()=>ep});var Nr,ep,na=S(()=>{O();k();Nr=class extends v{static get styles(){return E`
11
+ var lib=(()=>{var Aa=Object.create;var tt=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Ia=Object.getOwnPropertyNames;var ka=Object.getPrototypeOf,qa=Object.prototype.hasOwnProperty;var An=t=>tt(t,"__esModule",{value:!0}),n=(t,e)=>tt(t,"name",{value:e,configurable:!0});var S=(t,e)=>()=>(t&&(e=t(t=0)),e);var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ur=(t,e)=>{An(t);for(var r in e)tt(t,r,{get:e[r],enumerable:!0})},Da=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ia(e))!qa.call(t,o)&&o!=="default"&&tt(t,o,{get:()=>e[o],enumerable:!(r=Na(e,o))||r.enumerable});return t},ae=t=>Da(An(tt(t!=null?Aa(ka(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var It=_e((Nt,Ln)=>{(function(t,e){typeof Nt=="object"&&typeof Ln!="undefined"?e(Nt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Nt,function(t){"use strict";function e(o,s,i,a){var c,l=!1,p=0;function h(){c&&clearTimeout(c)}n(h,"clearExistingTimeout");function u(){h(),l=!0}n(u,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function f(){for(var w=arguments.length,_=new Array(w),m=0;m<w;m++)_[m]=arguments[m];var x=this,C=Date.now()-p;if(l)return;function b(){p=Date.now(),i.apply(x,_)}n(b,"exec");function y(){c=void 0}n(y,"clear"),a&&!c&&b(),h(),a===void 0&&C>o?b():s!==!0&&(c=setTimeout(a?y:b,a===void 0?o-C:o))}return n(f,"wrapper"),f.cancel=u,f}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});function jn(){return typeof window.og_auth!="undefined"?kt(window.og_auth):null}async function Ba(t=100){return new Promise(e=>{setTimeout(()=>e(jn()),t)})}async function $n(t,e=Va,r=Ha){let o;if(o=kt(jn())||kt(e()),o)return o;if(t&&typeof t=="string"){let s=await fetch(t);s.status>=200&&s.status<300&&(o=e()||await(Ga(s)?s.json():Promise.resolve(r(t)).then(e)))}else o||(o=await Ba());if(o=kt(o),o)return o;throw new Error("Unauthorized")}var Mn,Va,kt,Ha,Ga,Vn=S(()=>{Mn=/^og_auth=/,Va=n((t=Mn)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(Mn,""),"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"),Ha=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"),Ga=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"d");n(jn,"a");n(Ba,"f");n($n,"u")});var N,q,D,te,De,Y,R,ot,Ue,qt,Hn,Dt,Fe,Gn,Ut,Ft,Bn,Le,Me,je,zn,Wn,Lt,Yn,Mt,$e,Jn,jt,$t,nt,st,Vt,Ht,Se,ce,Gt,Bt,re,J,le,Ee,zt,xe,ve,Wt,Yt,Qn,j=S(()=>{N="OPTIN_PRODUCT",q="OPTOUT_PRODUCT",D="PRODUCT_CHANGE_FREQUENCY",te="PRODUCT_CHANGE_PREPAID_SHIPMENTS",De="SET_MERCHANT_ID",Y="REQUEST_OFFER",R="RECEIVE_OFFER",ot="PRODUCT_HAS_CHANGED",Ue="CREATED_SESSION_ID",qt="SET_AUTH_URL",Hn="REQUEST_AUTH",Dt="AUTHORIZE",Fe="UNAUTHORIZED",Gn="REQUEST_ORDERS",Ut="RECEIVE_ORDERS",Ft="RECEIVE_ORDER_ITEMS",Bn="FETCH_RESPONSE_ERROR",Le="SET_ENVIRONMENT_STAGING",Me="SET_ENVIRONMENT_DEV",je="SET_ENVIRONMENT_PROD",zn="CONCLUDE_UPSELL",Wn="REQUEST_CREATE_IU_ORDER",Lt="CREATE_ONE_TIME",Yn="REQUEST_CONVERT_ONE_TIME",Mt="CONVERT_ONE_TIME",$e="CHECKOUT",Jn="RECEIVE_FETCH",jt="SET_LOCALE",$t="SET_CONFIG",nt="SET_PREVIEW_STANDARD_OFFER",st="SET_PREVIEW_UPSELL_OFFER",Vt="ADD_TEMPLATE",Ht="SET_TEMPLATES",Se="LOCAL_STORAGE_CHANGE",ce="LOCAL_STORAGE_CLEAR",Gt="SET_FIRST_ORDER_PLACE_DATE",Bt="SET_PRODUCT_TO_SUBSCRIBE",re="RECEIVE_PRODUCT_PLANS",J="SETUP_PRODUCT",le="SETUP_CART",Ee="pdp",zt="dev",xe="staging",ve="prod",Wt="static.ordergroove.com",Yt="staging.static.ordergroove.com",Qn="og-cart-updated"});var at=_e((xu,ns)=>{var za="Expected a function",Kn="__lodash_hash_undefined__",Wa="[object Function]",Ya="[object GeneratorFunction]",Ja=/[\\^$.*+?()[\]{}|]/g,Qa=/^\[object .+?Constructor\]$/,Ka=typeof window=="object"&&window&&window.Object===Object&&window,Za=typeof self=="object"&&self&&self.Object===Object&&self,Zn=Ka||Za||Function("return this")();function Xa(t,e){return t==null?void 0:t[e]}n(Xa,"getValue");function ec(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ec,"isHostObject");var tc=Array.prototype,rc=Function.prototype,Xn=Object.prototype,Vr=Zn["__core-js_shared__"],es=function(){var t=/[^.]+$/.exec(Vr&&Vr.keys&&Vr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),ts=rc.toString,Hr=Xn.hasOwnProperty,oc=Xn.toString,nc=RegExp("^"+ts.call(Hr).replace(Ja,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sc=tc.splice,ic=rs(Zn,"Map"),it=rs(Object,"create");function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"Hash");function ac(){this.__data__=it?it(null):{}}n(ac,"hashClear");function cc(t){return this.has(t)&&delete this.__data__[t]}n(cc,"hashDelete");function lc(t){var e=this.__data__;if(it){var r=e[t];return r===Kn?void 0:r}return Hr.call(e,t)?e[t]:void 0}n(lc,"hashGet");function pc(t){var e=this.__data__;return it?e[t]!==void 0:Hr.call(e,t)}n(pc,"hashHas");function uc(t,e){var r=this.__data__;return r[t]=it&&e===void 0?Kn:e,this}n(uc,"hashSet");Te.prototype.clear=ac;Te.prototype.delete=cc;Te.prototype.get=lc;Te.prototype.has=pc;Te.prototype.set=uc;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 dc(){this.__data__=[]}n(dc,"listCacheClear");function fc(t){var e=this.__data__,r=Jt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():sc.call(e,r,1),!0}n(fc,"listCacheDelete");function hc(t){var e=this.__data__,r=Jt(e,t);return r<0?void 0:e[r][1]}n(hc,"listCacheGet");function mc(t){return Jt(this.__data__,t)>-1}n(mc,"listCacheHas");function gc(t,e){var r=this.__data__,o=Jt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(gc,"listCacheSet");Ve.prototype.clear=dc;Ve.prototype.delete=fc;Ve.prototype.get=hc;Ve.prototype.has=mc;Ve.prototype.set=gc;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,"MapCache");function yc(){this.__data__={hash:new Te,map:new(ic||Ve),string:new Te}}n(yc,"mapCacheClear");function bc(t){return Qt(this,t).delete(t)}n(bc,"mapCacheDelete");function _c(t){return Qt(this,t).get(t)}n(_c,"mapCacheGet");function Sc(t){return Qt(this,t).has(t)}n(Sc,"mapCacheHas");function Ec(t,e){return Qt(this,t).set(t,e),this}n(Ec,"mapCacheSet");Oe.prototype.clear=yc;Oe.prototype.delete=bc;Oe.prototype.get=_c;Oe.prototype.has=Sc;Oe.prototype.set=Ec;function Jt(t,e){for(var r=t.length;r--;)if(wc(t[r][0],e))return r;return-1}n(Jt,"assocIndexOf");function xc(t){if(!os(t)||Tc(t))return!1;var e=Pc(t)||ec(t)?nc:Qa;return e.test(Oc(t))}n(xc,"baseIsNative");function Qt(t,e){var r=t.__data__;return vc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Qt,"getMapData");function rs(t,e){var r=Xa(t,e);return xc(r)?r:void 0}n(rs,"getNative");function vc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(vc,"isKeyable");function Tc(t){return!!es&&es in t}n(Tc,"isMasked");function Oc(t){if(t!=null){try{return ts.call(t)}catch{}try{return t+""}catch{}}return""}n(Oc,"toSource");function Gr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(za);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(Gr.Cache||Oe),r}n(Gr,"memoize");Gr.Cache=Oe;function wc(t,e){return t===e||t!==t&&e!==e}n(wc,"eq");function Pc(t){var e=os(t)?oc.call(t):"";return e==Wa||e==Ya}n(Pc,"isFunction");function os(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(os,"isObject");ns.exports=Gr});var Kt,Br,ct,lt,Zt,ss,is,Cc,Rc,Ac,Nc,Ic,pt,zr,kc,as,ut,qc,pe,ue=S(()=>{Kt=ae(at()),Br=n((...t)=>JSON.stringify(t),"memoizeKey"),ct=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),lt=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Zt=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,{...s,headers:{Authorization:JSON.stringify(e),...s.headers}}]},"withAuth"),ss=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"),is=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Cc=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Rc=(0,Kt.default)(ct(lt((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=is([["session_id",e],["page_type",1],["p",Cc(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Br),Ac=(0,Kt.default)(ct(lt(Zt((t=1,e="place")=>[`/orders/?${is([["status",t],["ordering",e],["exclude_prepaid_orders","true"]])}`]))),Br),Nc=(0,Kt.default)(ct(lt(Zt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Br),Ic=ct(lt(Zt(ss((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}}]})))),pt=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"),zr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),kc=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),as=n(t=>[...new Set(t&&t.split(/\s+/))].filter(zr).sort(kc),"parseFrequenciesList"),ut=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"),qc=ct(lt(Zt(ss((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=pt(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),pe={fetchOffer:Rc,fetchOrders:Ac,fetchItems:Nc,createOneTime:Ic,convertOneTimeToSubscription:qc}});var Wr,L,dt=S(()=>{U();Wr=ft(),L={shopify:typeof window.Shopify!="undefined",shopify_selling_plans:typeof(Wr==null?void 0:Wr.dataset.shopifySellingPlans)!="undefined"}});function Dc(t,e){return t===e}function Uc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function Fc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dc,r=null,o=null;return function(){return Uc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Lc(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 Mc(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 s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,l=i.pop(),p=Lc(i),h=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),u=t(function(){for(var f=[],w=p.length,_=0;_<w;_++)f.push(p[_].apply(null,arguments));return h.apply(null,f)});return u.resultFunc=l,u.dependencies=p,u.recomputations=function(){return c},u.resetRecomputations=function(){return c=0},u}}var Q,cs=S(()=>{n(Dc,"defaultEqualityCheck");n(Uc,"areArgumentsShallowlyEqual");n(Fc,"defaultMemoize");n(Lc,"getDependencies");n(Mc,"createSelectorCreator");Q=Mc(Fc)});function jc(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 $c(t,e,r){let o=ut(r);return L.shopify_selling_plans?X(t,e,o):o}var B,I,ht,ls,Yr,Vc,Hc,Gc,Bc,zc,K,Xt,ps,er,tr,Z,rr,us,He,Jr,H,Ge,F=S(()=>{cs();B=ae(at());ue();dt();U();B.default.Cache=Map;n(jc,"arraysEqual");n($c,"resolveFrequency");I=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||jc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),ht=n(t=>t.optedin||[],"optedinSelector"),ls=n(t=>t.optedout||[],"optedoutSelector"),Yr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Vc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),Hc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequencies)||[]},"sellingPlansSelector"),Gc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.frequenciesEveryPeriod)||[]},"frequenciesEveryPeriodSelector"),Bc=n(t=>{var e;return((e=t==null?void 0:t.config)==null?void 0:e.prepaidSellingPlans)||[]},"prepaidSellingPlansSelector"),zc=n(t=>(t==null?void 0:t.prepaidShipmentsSelected)||{},"prepaidShipmentsSelectedSelector"),K=(0,B.default)(t=>Q(ht,ls,Yr,(e,r,o)=>{let s=e.find(i=>I(t,i));return s||(r.find(i=>I(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Xt=(0,B.default)(t=>Q(ht,e=>{let r=e.find(o=>I(t,o));return r||!1}),t=>JSON.stringify(t)),ps=(0,B.default)(t=>Q(ht,e=>e.some(r=>I(t,r)&&r.prepaidShipments)),t=>JSON.stringify(t)),er=(0,B.default)(t=>Q(zc,e=>e[t.id]||null),t=>JSON.stringify(t)),tr=(0,B.default)(t=>Q(ls,e=>e.find(r=>I(t,r)))),Z=(0,B.default)(t=>Q(K(t),e=>e&&e.frequency||null)),rr=(0,B.default)(t=>Q(K(t),e=>e&&e.prepaidShipments||null)),us=(0,B.default)(t=>Q(Bc,e=>{var r;return((r=e[t])==null?void 0:r.map(({numberShipments:o})=>o))||[]})),He=(0,B.default)(t=>Q(Vc,Hc,Gc,(e,r,o)=>e[P(t)]&&$c(r,o,e[P(t)])||null)),Jr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r,o)=>({[r]:t.config&&t.config[r]||e&&e.hasAttribute&&e.hasAttribute(Jr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||o}),"configSelector"),Ge=n(t=>({templates:t.templates||[]}),"templatesSelector")});function or(t){document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t()}function ft(){return document.querySelector([`script[src^="https://${Wt}"]`,`script[src^="https://${Yt}"]`,`script[src^="http://${Wt}"]`,`script[src^="http://${Yt}"]`].join(","))}function Qr(){let t=ft();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]}function fs(t){if(t.isReady())return;console.info("OG offers are auto initializing");let[e,r]=Qr();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?Wt:Yt}/${e}/main.js?initOnly=true`,document.head.appendChild(o)}function ms(t){let e=document.cookie.match(`(^|;) ?${t}=([^;]*)(;|$)`);return e?e[2]:null}function gs(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 ze(t,e){let[[r],o]=t.reduce((s,i)=>s[I(e,i)?0:1].push(i)&&s,[[],[]]);return[r||{},o||[]]}var P,ds,Kr,hs,Be,we,nr,X,U=S(()=>{dt();j();F();n(or,"onReady");n(ft,"getMainJs");n(Qr,"resolveEnvAndMerchant");P=n(t=>{var r;if(!t)return"";let e=`${t.id||t}`;return((r=L)==null?void 0:r.shopify_selling_plans)&&(e=e.split(":")[0]),e},"safeProductId"),ds=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"),Kr=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(fs,"autoInitializeOffers");hs=n(t=>{document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`},"clearCookie");n(ms,"getCookieValue");Be=n(t=>!!(t&&(t==null?void 0:t.includes("_"))),"isOgFrequency"),we=n((t=[])=>(t==null?void 0:t[0])||null,"getFirstSellingPlan"),nr=n((t=[],e=[])=>{var r;return!!(((r=L)==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(s=>s===r);return o>=0?t[o]:null},"mapFrequencyToSellingPlan");n(gs,"getOrCreateHidden");n(ze,"getMatchingProductIfExists")});var de,We,ys,sr,bs,_s,Ss,Zr,Wc,mt,fe,Es,ir,xs,Yc,Xr,eo,ar,to,vs,Ye,ro,Jc,Ts,Os,Qc,Kc,Zc,Xc,ws,Ps,Cs,Rs,As,Ns,Is,k=S(()=>{Vn();j();ue();U();de=n((t,e,r)=>({type:N,payload:{product:t,frequency:e,offer:r}}),"optinProduct"),We=n((t,e)=>({type:q,payload:{product:t,offer:e}}),"optoutProduct"),ys=n((t,e)=>({type:ot,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),sr=n((t,e,r)=>({type:D,payload:{product:t,frequency:e,offer:r}}),"productChangeFrequency"),bs=n((t,e,r)=>({type:te,payload:{product:t,prepaidShipments:e,offer:r}}),"productChangePrepaidShipments"),_s=n(t=>({type:zn,payload:{product:t}}),"concludeUpsell"),Ss=n(t=>({type:De,payload:t}),"setMerchantId"),Zr=n(t=>({type:Ue,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),Wc=n(t=>({type:Hn,payload:t}),"requestAuth"),mt=n((t,e,r,o)=>({type:Dt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),fe=n(t=>({type:Fe,payload:t}),"unauthorized"),Es=n(t=>({type:qt,payload:t}),"setAuthUrl"),ir=n(t=>({type:Jn,payload:t}),"fetchDone"),xs=n((t=$n)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(fe({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=Wc(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:p})=>r(mt(s,c,l,p)),c=>r(fe(c))).finally(()=>r(ir(a)))},"fetchAuthThunk"),"fetchAuth"),Yc=n((t,e)=>({type:Gn,payload:{status:t,ordering:e}}),"requestOrders"),Xr=n(t=>({type:Ut,payload:t}),"receiveOrders"),eo=n(t=>({type:Ft,payload:t}),"receiveItems"),ar=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(fe("No auth set."));let c=Yc(t,e);return o(c),pe.fetchOrders(i,a,t,e).then(l=>{if(l.results){o(Xr(l));let p=(l.results[0]||{}).public_id;if(p)return pe.fetchItems(i,a,p).then(h=>o(eo(h)))}return o(fe(l.detail)),null},l=>o(fe(l))).finally(()=>o(ir(c)))},"fetchOrdersThunk"),"fetchOrders"),to=n(t=>{switch(t){case zt:return{type:Me,payload:t};case xe:return{type:Le,payload:t};case ve:return{type:je,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),vs=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(Zr(r)),o},"requestSessionId"),Ye=n((t,e)=>({type:R,payload:{...t,offer:e}}),"receiveOffer"),ro=n(t=>({type:Bn,payload:t}),"fetchResponseError"),Jc=n((t,e=Ee,r)=>({type:Y,payload:{product:t,module:e,offer:r}}),"requestOffer"),Ts=n((t,e=Ee,r)=>n(function(s,i){let{merchantId:a,sessionId:c,environment:{apiUrl:l}}=i(),p=Jc(t,e,r);s(p);let h=P(t);return h?pe.fetchOffer(l,a,c,h,e).then(u=>s(Ye(u,r)),u=>s(ro(u))).finally(()=>s(ir(p))):null},"fetchOfferThunk"),"fetchOffer"),Os=n(()=>({type:$e}),"checkout"),Qc=n((t,e,r,o)=>({type:Wn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),Kc=n(t=>({type:Lt,payload:t}),"receiveCreateOneTime"),Zc=n((t,e)=>({type:Yn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),Xc=n((t,e)=>({type:Mt,payload:{response:t,product:e}}),"receiveConvertOneTime"),ws=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,config:p,environment:{legoUrl:h},previewUpsellOffer:u,offerId:f}=c();if(!l)return a(fe("No auth set."));let w=ds(s,p),_=Qc(t,e,r,f);return a(_),(u?Promise.resolve({legoUrl:h,product:t,order:e,quantity:r,offer:f}):pe.createOneTime(h,l,t.id,e,r,f)).then(m=>(a(Kc(m)),o?(a(Zc(m,w)),(u?Promise.resolve({item:m,frequency:w}):pe.convertOneTimeToSubscription(h,l,m,w,f)).then(x=>a(Xc(x,t)),x=>a(ro(x)))):m),m=>a(ro(m))).finally(()=>a(ir(_)))},"createIuThunk"),"createIu"),Ps=n(t=>({type:jt,payload:t}),"setLocale"),Cs=n(t=>({type:$t,payload:t}),"setConfig"),Rs=n((t,e,r)=>({type:Vt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),As=n(t=>({type:Ht,payload:t}),"setTemplates"),Ns=n((t,e)=>({type:Gt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Is=n((t,e)=>({type:Bt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var ao,Pe,Ce=S(()=>{ao=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Pe=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var G,co,Js,Je,Re,Qs,yt,ee,ur,he=S(()=>{G=`{{lit-${String(Math.random()).slice(2)}}}`,co=`<!--${G}-->`,Js=new RegExp(`${G}|${co}`),Je="$lit$",Re=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,l=0,{strings:p,values:{length:h}}=e;for(;l<h;){let u=i.nextNode();if(u===null){i.currentNode=s.pop();continue}if(c++,u.nodeType===1){if(u.hasAttributes()){let f=u.attributes,{length:w}=f,_=0;for(let m=0;m<w;m++)Qs(f[m].name,Je)&&_++;for(;_-- >0;){let m=p[l],x=ur.exec(m)[2],C=x.toLowerCase()+Je,b=u.getAttribute(C);u.removeAttribute(C);let y=b.split(Js);this.parts.push({type:"attribute",index:c,name:x,strings:y}),l+=y.length-1}}u.tagName==="TEMPLATE"&&(s.push(u),i.currentNode=u.content)}else if(u.nodeType===3){let f=u.data;if(f.indexOf(G)>=0){let w=u.parentNode,_=f.split(Js),m=_.length-1;for(let x=0;x<m;x++){let C,b=_[x];if(b==="")C=ee();else{let y=ur.exec(b);y!==null&&Qs(y[2],Je)&&(b=b.slice(0,y.index)+y[1]+y[2].slice(0,-Je.length)+y[3]),C=document.createTextNode(b)}w.insertBefore(C,u),this.parts.push({type:"node",index:++c})}_[m]===""?(w.insertBefore(ee(),u),o.push(u)):u.data=_[m],l+=m}}else if(u.nodeType===8)if(u.data===G){let f=u.parentNode;(u.previousSibling===null||c===a)&&(c++,f.insertBefore(ee(),u)),a=c,this.parts.push({type:"node",index:c}),u.nextSibling===null?u.data="":(o.push(u),c--),l++}else{let f=-1;for(;(f=u.data.indexOf(G,f+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let u of o)u.parentNode.removeChild(u)}};n(Re,"Template");Qs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),yt=n(t=>t.index!==-1,"isTemplatePartActive"),ee=n(()=>document.createComment(""),"createMarker"),ur=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function po(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,lo,null,!1),i=bt(o),a=o[i],c=-1,l=0,p=[],h=null;for(;s.nextNode();){c++;let u=s.currentNode;for(u.previousSibling===h&&(h=null),e.has(u)&&(p.push(u),h===null&&(h=u)),h!==null&&l++;a!==void 0&&a.index===c;)a.index=h!==null?-1:a.index-l,i=bt(o,i),a=o[i]}p.forEach(u=>u.parentNode.removeChild(u))}function Ks(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,lo,null,!1),a=bt(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=al(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=bt(s,a);return}a=bt(s,a)}}var lo,al,bt,Zs=S(()=>{he();lo=133;n(po,"removeNodesFromTemplate");al=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,lo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),bt=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(yt(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Ks,"insertNodeIntoTemplate")});var cl,Ae,uo=S(()=>{cl=new WeakMap,Ae=n(t=>typeof t=="function"&&cl.has(t),"isDirective")});var $,dr,fo=S(()=>{$={},dr={}});var me,fr=S(()=>{Ce();he();me=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=ao?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,l=s.nextNode();for(;i<o.length;){if(c=o[i],!yt(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,l.nodeName==="TEMPLATE"&&(r.push(l),s.currentNode=l.content),(l=s.nextNode())===null&&(s.currentNode=r.pop(),l=s.nextNode());if(c.type==="node"){let p=this.processor.handleTextExpression(this.options);p.insertAfterNode(l.previousSibling),this.__parts.push(p)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return ao&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(me,"TemplateInstance")});var Xs,pl,oe,hr=S(()=>{Ce();he();Xs=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),pl=` ${G} `,oe=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=ur.exec(i);c===null?r+=i+(o?pl:co):r+=i.substr(0,c.index)+c[1]+c[2]+Je+c[3]+G}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Xs!==void 0&&(r=Xs.createHTML(r)),e.innerHTML=r,e}};n(oe,"TemplateResult")});var mr,gr,Qe,_t,ne,St,Et,yr,ei,xt,ul,br=S(()=>{uo();Ce();fo();fr();hr();he();mr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),gr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Qe=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new _t(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!gr(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(mr(c)||!gr(c))s+=typeof c=="string"?c:String(c);else for(let l of c)s+=typeof l=="string"?l:String(l)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Qe,"AttributeCommitter");_t=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==$&&(!mr(e)||e!==this.value)&&(this.value=e,Ae(e)||(this.committer.dirty=!0))}commit(){for(;Ae(this.value);){let e=this.value;this.value=$,e(this)}this.value!==$&&this.committer.commit()}};n(_t,"AttributePart");ne=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(;Ae(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}let e=this.__pendingValue;e!==$&&(mr(e)?e!==this.value&&this.__commitText(e):e instanceof oe?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):gr(e)?this.__commitIterable(e):e===dr?(this.value=dr,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 me&&this.value.template===r)this.value.update(e.values);else{let o=new me(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new ne(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){Pe(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(ne,"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(;Ae(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=$,r(this)}if(this.__pendingValue===$)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=$}};n(St,"BooleanAttributePart");Et=class extends Qe{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new yr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(Et,"PropertyCommitter");yr=class extends _t{};n(yr,"PropertyPart");ei=!1;(()=>{try{let t={get capture(){return ei=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();xt=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;Ae(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=$,i(this)}if(this.__pendingValue===$)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=ul(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=$}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(xt,"EventPart");ul=n(t=>t&&(ei?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function ho(t){let e=Ne.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Ne.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(G);return r=e.keyString.get(o),r===void 0&&(r=new Re(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Ne,_r=S(()=>{he();n(ho,"templateFactory");Ne=new Map});var ge,mo,go=S(()=>{Ce();br();_r();ge=new WeakMap,mo=n((t,e,r)=>{let o=ge.get(e);o===void 0&&(Pe(e,e.firstChild),ge.set(e,o=new ne(Object.assign({templateFactory:ho},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Sr,yo,bo=S(()=>{br();Sr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new Et(e,r.slice(1),o).parts:i==="@"?[new xt(e,r.slice(1),s.eventContext)]:i==="?"?[new St(e,r.slice(1),o)]:new Qe(e,r,o).parts}handleTextExpression(e){return new ne(e)}};n(Sr,"DefaultTemplateProcessor");yo=new Sr});var d,_o=S(()=>{bo();hr();bo();uo();Ce();fo();br();go();_r();fr();hr();he();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new oe(t,e,"html",yo),"html")});var ri,Er,fl,hl,ml,oi,gl,ni,si=S(()=>{Ce();Zs();go();_r();fr();he();_o();ri=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Er=!0;typeof window.ShadyCSS=="undefined"?Er=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Er=!1);fl=n(t=>e=>{let r=ri(e.type,t),o=Ne.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Ne.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(G);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();Er&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Re(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),hl=["html","svg"],ml=n(t=>{hl.forEach(e=>{let r=Ne.get(ri(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),po(o,i)})})},"removeStylesFromLitTemplates"),oi=new Set,gl=n((t,e,r)=>{oi.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let p=0;p<i;p++){let h=s[p];h.parentNode.removeChild(h),a.textContent+=h.textContent}ml(t);let c=o.content;r?Ks(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let l=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&l!==null)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let p=new Set;p.add(a),po(r,p)}},"prepareTemplateStyles"),ni=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ge.has(e),i=Er&&e.nodeType===11&&!!e.host,a=i&&!oi.has(o),c=a?document.createDocumentFragment():e;if(mo(t,c,Object.assign({templateFactory:fl(o)},r)),a){let l=ge.get(c);ge.delete(c);let p=l.value instanceof me?l.value.template:void 0;gl(o,c,p),Pe(e,e.firstChild),e.appendChild(c),ge.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var ii,So,ai,Eo,xo,vo,To,Oo,wo,vt,Po=S(()=>{window.JSCompiler_renameProperty=(t,e)=>t;So={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}},ai=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Eo={attribute:!0,type:String,converter:So,reflect:!1,hasChanged:ai},xo=1,vo=1<<2,To=1<<3,Oo=1<<4,wo="finalized",vt=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),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=Eo){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Eo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(wo)||e.finalize(),this[wo]=!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 s of o)this.createProperty(s,r[s])}}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=ai){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||So,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||So.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=Eo){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|To,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~To}}_attributeToProperty(e,r){if(this._updateState&To)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|Oo,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~Oo}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&Oo)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|vo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&vo}get hasUpdated(){return this._updateState&xo}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&xo||(this._updateState=this._updateState|xo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~vo}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(vt,"UpdatingElement");ii=wo;vt[ii]=!0});var ci,cf,li=S(()=>{ci=Element.prototype,cf=ci.msMatchesSelector||ci.webkitMatchesSelector});var xr,Co,Tt,pi,yl,E,Ro=S(()=>{xr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Co=Symbol(),Tt=class{constructor(e,r){if(r!==Co)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(xr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(Tt,"CSSResult");pi=n(t=>new Tt(String(t),Co),"unsafeCSS"),yl=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"),E=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+yl(s)+t[i+1],t[0]);return new Tt(r,Co)},"css")});var ui,v,O=S(()=>{si();Po();Po();li();_o();Ro();Ro();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");ui={},v=class extends vt{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((i,a)=>i.reduceRight((c,l)=>Array.isArray(l)?r(l,c):(c.add(l),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!xr){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return pi(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):xr?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==ui&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return ui}};n(v,"LitElement");v.finalized=!0;v.render=ni});var vr=_e((_f,di)=>{var bl={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};di.exports=bl});var hi=_e((Sf,fi)=>{var Ie=vr(),_l=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case Ie.PAR_OPEN:case Ie.PAR_CLOSE:case Ie.OP_NOT:case Ie.BINARY_AND:case Ie.BINARY_OR:e&&(r.push({type:Ie.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:Ie.LITERAL,value:e}),r},"Tokenizer");fi.exports=_l});var gi=_e((Ef,mi)=>{var ye=vr(),Sl=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case ye.LITERAL:e.unshift(s);break;case ye.BINARY_AND:case ye.BINARY_OR:case ye.OP_NOT:case ye.PAR_OPEN:r.push(s);break;case ye.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==ye.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===ye.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),El=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");mi.exports={PolishNotation:Sl,PolishGenerator:El}});var bi=_e((xf,yi)=>{var V=vr(),z=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}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 Ke=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(Ke(t));case V.BINARY_AND:{let r=Ke(t),o=Ke(t);return z.CreateAnd(r,o)}case V.BINARY_OR:{let r=Ke(t),o=Ke(t);return z.CreateOr(r,o)}}return null},"make"),Ze=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===V.OP_NOT)return!Ze(t.left,e);if(t.op===V.BINARY_OR)return Ze(t.left,e)||Ze(t.right,e);if(t.op===V.BINARY_AND)return Ze(t.left,e)&&Ze(t.right,e)},"nodeEvaluator");yi.exports={make:Ke,nodeEvaluator:Ze}});var xi=_e((vf,Ei)=>{var xl=hi(),_i=gi(),Si=bi(),vl=n((t,e)=>{let r=xl(t),o=_i.PolishNotation(r),s=_i.PolishGenerator(o),i=Si.make(s);return Si.nodeEvaluator(i,e)},"parse");Ei.exports={parse:vl}});var ea={};Ur(ea,{TestWizard:()=>Ar,default:()=>Ql});var Ar,Ql,ta=S(()=>{O();k();Ar=class extends v{static get styles(){return E`
13
13
  :host {
14
14
  position: fixed;
15
15
  top: 5em;
@@ -100,16 +100,16 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
100
100
  upsell product is in next order
101
101
  </button>
102
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:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Ce({in_stock:{[c]:r},eligibility_groups:{[c]:s},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],s=o.product.id;r.preventDefault(),o.store.dispatch(ro({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return d`
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:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Ye({in_stock:{[c]:r},eligibility_groups:{[c]:s},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],s=o.product.id;r.preventDefault(),o.store.dispatch(eo({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return d`
104
104
  <div>
105
105
  ${this.testsRan?this.resultsCodeBlock():d`
106
106
  <div>Click the button to run tests</div>
107
107
  `}
108
108
  <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
109
109
  </div>
110
- `}};n(Nr,"TestWizard");ep=Nr});var gu={};Ur(gu,{addOptinChangedCallback:()=>Yp,addTemplate:()=>Jp,autoInit:()=>hu,clear:()=>Qp,config:()=>Kp,default:()=>mu,disableOptinChangedCallbacks:()=>Zp,getOptins:()=>Xp,getProductsForPurchasePost:()=>eu,initialize:()=>tu,isReady:()=>Wp,offers:()=>T,platform:()=>L,previewMode:()=>ru,register:()=>ou,resolveSettings:()=>nu,setAuthUrl:()=>su,setEnvironment:()=>iu,setLocale:()=>au,setMerchantId:()=>cu,setPublicPath:()=>lu,setTemplates:()=>pu,setupCart:()=>uu,setupProduct:()=>du,setupProducts:()=>fu,store:()=>Ra});function Lr(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(Lr,"symbolObservablePonyfill");var Fe;typeof self!="undefined"?Fe=self:typeof window!="undefined"||typeof window!="undefined"?Fe=window:typeof module!="undefined"?Fe=module:Fe=Function("return this")();var Ma=Lr(Fe),Mr=Ma;var jr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),ot={INIT:"@@redux/INIT"+jr(),REPLACE:"@@redux/REPLACE"+jr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+jr()},"PROBE_UNKNOWN_ACTION")};function ja(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(ja,"isPlainObject");function $r(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=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r($r)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function p(){c===a&&(c=a.slice())}n(p,"ensureCanMutateNextListeners");function h(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(h,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var x=!0;return p(),c.push(m),n(function(){if(!!x){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");x=!1,p();var b=c.indexOf(m);c.splice(b,1),a=null}},"unsubscribe")}n(u,"subscribe");function f(m){if(!ja(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,i=s(i,m)}finally{l=!1}for(var x=a=c,C=0;C<x.length;C++){var b=x[C];b()}return m}n(f,"dispatch");function P(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");s=m,f({type:ot.REPLACE})}n(P,"replaceReducer");function _(){var m,x=u;return m={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function y(){b.next&&b.next(h())}n(y,"observeState"),y();var Nt=x(y);return{unsubscribe:Nt}},"subscribe")},m[Mr]=function(){return this},m}return n(_,"observable"),f({type:ot.INIT}),o={dispatch:f,subscribe:u,getState:h,replaceReducer:P},o[Mr]=_,o}n($r,"createStore");function $a(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($a,"getUndefinedStateErrorMessage");function Va(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:ot.INIT});if(typeof o=="undefined")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:ot.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+ot.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(Va,"assertReducerShape");function It(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{Va(r)}catch(l){c=l}return n(function(p,h){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var f=!1,P={},_=0;_<i.length;_++){var m=i[_],x=r[m],C=p[m],b=x(C,h);if(typeof b=="undefined"){var y=$a(m,h);throw new Error(y)}P[m]=b,f=f||b!==C}return f=f||i.length!==Object.keys(p).length,f?P:p},"combination")}n(It,"combineReducers");function kn(t,e){return function(){return e(t.apply(this,arguments))}}n(kn,"bindActionCreator");function qn(t,e){if(typeof t=="function")return kn(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 s=t[o];typeof s=="function"&&(r[o]=kn(s,e))}return r}n(qn,"bindActionCreators");function Ha(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ha,"_defineProperty");function Dn(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(Dn,"ownKeys");function Ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dn(r,!0).forEach(function(o){Ha(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(Ga,"_objectSpread2");function Vr(){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,s){return function(){return o(s.apply(void 0,arguments))}})}n(Vr,"compose");function Fn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=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:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=Vr.apply(void 0,c)(s.dispatch),Ga({},s,{dispatch:i})}}}n(Fn,"applyMiddleware");function Un(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}n(Un,"createThunkMiddleware");var Ln=Un();Ln.withExtraArgument=Un;var Mn=Ln;var Ds=ce(qt());k();j();var yt="OG_STATE",Fs=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),so=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Us=n(()=>so()?{}:Fs(localStorage.getItem(yt)),"loadState"),ol=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),Ls=n(t=>{if(so())return;let e=ol(t);e&&localStorage.getItem(yt)!==e&&localStorage.setItem(yt,e)},"saveState"),Ms=n(t=>(0,Ds.throttle)(500,e=>{if(so())return;let{key:r,newValue:o}=e;r===yt&&o===null?(t.dispatch({type:le}),setTimeout(()=>t.dispatch(Os()),0)):r===yt&&t.dispatch({type:Ee,newValue:Fs(o)})}),"listenLocalStorageChanges");var js=ce(qt());j();U();var nl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),$s=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>nl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),sl=[{expressions:[({type:t}={})=>t===N,({type:t}={})=>t===D],fn:$s(!0)},{expressions:[({type:t}={})=>t===q],fn:$s(!1)}],Vs=n(t=>e=>r=>{let o=t.getState();sl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Hs=n(t=>e=>r=>{var s;let o;switch(r.type){case R:case q:case N:case D:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((s=r.payload)==null?void 0:s.offer)||document).dispatchEvent(o);break;default:}(o==null?void 0:o.defaultPrevented)||e(r)},"offerEvents"),Gs=n(t=>e=>r=>{e(r);let o=(0,js.throttle)(500,()=>{Ls({...t.getState()})});r.type!==Ee&&o()},"localStorageMiddleware");k();j();var io=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Bs(t){let[e,r]=io(),[o,s]=io(),[i,a]=io();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(eo(l)):a(p)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",Ms(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(Ts())}),l=>async p=>{je===p.type||Me===p.type||$e===p.type?r(p.payload):Ue===p.type?s(p.payload):Le===p.type?a(p.payload):await c,l(p)}}n(Bs,"waitUntilOffersReady");function zs(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"}):Vr,s=[Bs,Mn,Vs,Hs],i={};if(!r)try{i=Us(),s.push(Gs)}catch{}let a=o(Fn(...s,...e.filter(l=>l))),c=$r(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(zs,"makeStore");var il=Object.defineProperty,pr=n((t,e)=>il(t,"name",{value:e,configurable:!0}),"i"),al=pr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Ws=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Ys=pr(t=>(e,r)=>{Ws.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function ao(t=window.opener,e=window.og){let r=pr(o=>{let s=al(Ws),i=Ys(o.source),a=o.data.options||{};if(s(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.1/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:s,broadcastMessage:i,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),Ys(t)("READY"))}n(ao,"f");pr(ao,"offersLiveEditor");var ur=null,cl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Js=n(t=>{if(!ur)throw new Error("Missing redux store.");return ur},"resolveStore"),ll=n((t,e)=>r=>{let{getState:o,dispatch:s}=Js(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=cl)=>r=>{let s=ll(t,typeof e=="function"?e:i=>qn(e,i));return class extends r{get store(){return ur}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Js(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),Qs=n(t=>{ur=t},"setStore");de();var co=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],...ut(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"),bt=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([s,i])=>{let a={};i&&!Array.isArray(i)?a=i:a={frequency:s,prepaidShipments:null,regularPrice:i[0],subscriptionPrice:i[2],discountRate:i[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans"),Ks=n((t,e)=>(Object.entries(e).forEach(([r,o])=>{if(Object.prototype.hasOwnProperty.call(t,r)){let s=t[r].concat(o),i=[...new Set(s.map(a=>JSON.stringify(a)))];t[r]=i.map(a=>JSON.parse(a))}else t[r]=o}),t),"mergeProductPlansToState");k();O();var Ii=ce(Oi());O();var wl=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"),Pi=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Io=n(t=>{let e=Pi(t);if(!e){let r=t.offer;r&&(e=Pi(r))}return e},"resolveProduct"),Cl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),ko=n(t=>class extends t{get offer(){return Cl(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"),A=n(t=>class extends ko(t){get product(){return Io(this)}},"withProduct"),Or=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=wl(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Pr={};Ur(Pr,{autoshipByDefault:()=>Rl,eligibilityGroups:()=>Do,eligible:()=>wi,hasUpcomingOrder:()=>Ai,hasUpsellGroup:()=>Ri,inStock:()=>qo,optedout:()=>Il,prepaidEligible:()=>Al,prepaidSubscribed:()=>kl,regularEligible:()=>Dl,subscribed:()=>Nl,subscriptionEligible:()=>Ci,upcomingOrderContainsProduct:()=>ql,upsellEligible:()=>Ni});U();var qo=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),wi=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),Rl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),Ci=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&wi(t,e)&&qo(t,e),"subscriptionEligible"),Do=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),Ri=n((t,e)=>{let r=Do(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Al=n((t,e)=>{let r=Do(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Nl=n((t,e)=>tr(e.product)(t),"subscribed"),Il=n((t,e)=>or(e.product)(t),"optedout"),kl=n((t,e)=>ds(e.product)(t),"prepaidSubscribed"),Ai=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),ql=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Ni=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&qo(t,e)&&Ai(t)&&Ri(t,e)},"upsellEligible"),Dl=n((t,e)=>Ci(t,e)&&!Ni(t,e),"regularEligible");var Fl=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Fo=class extends A(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&Ii.default.parse(Fl(this.test),r=>Pr[r]&&Pr[r](this.state,this))?d`
110
+ `}};n(Ar,"TestWizard");Ql=Ar});var du={};Ur(du,{addOptinChangedCallback:()=>Gp,addTemplate:()=>Bp,autoInit:()=>pu,clear:()=>zp,config:()=>Wp,default:()=>uu,disableOptinChangedCallbacks:()=>Yp,getOptins:()=>Jp,getProductsForPurchasePost:()=>Qp,initialize:()=>Kp,isReady:()=>Hp,offers:()=>T,platform:()=>L,previewMode:()=>Zp,register:()=>Xp,resolveSettings:()=>eu,setAuthUrl:()=>tu,setEnvironment:()=>ru,setLocale:()=>ou,setMerchantId:()=>nu,setPublicPath:()=>su,setTemplates:()=>iu,setupCart:()=>au,setupProduct:()=>cu,setupProducts:()=>lu,store:()=>wa});function Fr(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(Fr,"symbolObservablePonyfill");var qe;typeof self!="undefined"?qe=self:typeof window!="undefined"||typeof window!="undefined"?qe=window:typeof module!="undefined"?qe=module:qe=Function("return this")();var Ua=Fr(qe),Lr=Ua;var Mr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),rt={INIT:"@@redux/INIT"+Mr(),REPLACE:"@@redux/REPLACE"+Mr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Mr()},"PROBE_UNKNOWN_ACTION")};function Fa(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(Fa,"isPlainObject");function jr(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=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(jr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,l=!1;function p(){c===a&&(c=a.slice())}n(p,"ensureCanMutateNextListeners");function h(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(h,"getState");function u(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var x=!0;return p(),c.push(m),n(function(){if(!!x){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");x=!1,p();var b=c.indexOf(m);c.splice(b,1),a=null}},"unsubscribe")}n(u,"subscribe");function f(m){if(!Fa(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,i=s(i,m)}finally{l=!1}for(var x=a=c,C=0;C<x.length;C++){var b=x[C];b()}return m}n(f,"dispatch");function w(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");s=m,f({type:rt.REPLACE})}n(w,"replaceReducer");function _(){var m,x=u;return m={subscribe:n(function(b){if(typeof b!="object"||b===null)throw new TypeError("Expected the observer to be an object.");function y(){b.next&&b.next(h())}n(y,"observeState"),y();var Rt=x(y);return{unsubscribe:Rt}},"subscribe")},m[Lr]=function(){return this},m}return n(_,"observable"),f({type:rt.INIT}),o={dispatch:f,subscribe:u,getState:h,replaceReducer:w},o[Lr]=_,o}n(jr,"createStore");function La(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(La,"getUndefinedStateErrorMessage");function Ma(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:rt.INIT});if(typeof o=="undefined")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:rt.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+rt.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(Ma,"assertReducerShape");function At(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{Ma(r)}catch(l){c=l}return n(function(p,h){if(p===void 0&&(p={}),c)throw c;if(!1)var u;for(var f=!1,w={},_=0;_<i.length;_++){var m=i[_],x=r[m],C=p[m],b=x(C,h);if(typeof b=="undefined"){var y=La(m,h);throw new Error(y)}w[m]=b,f=f||b!==C}return f=f||i.length!==Object.keys(p).length,f?w:p},"combination")}n(At,"combineReducers");function Nn(t,e){return function(){return e(t.apply(this,arguments))}}n(Nn,"bindActionCreator");function In(t,e){if(typeof t=="function")return Nn(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 s=t[o];typeof s=="function"&&(r[o]=Nn(s,e))}return r}n(In,"bindActionCreators");function ja(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(ja,"_defineProperty");function kn(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(kn,"ownKeys");function $a(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kn(r,!0).forEach(function(o){ja(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kn(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n($a,"_objectSpread2");function $r(){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,s){return function(){return o(s.apply(void 0,arguments))}})}n($r,"compose");function qn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=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:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(l){return l(a)});return i=$r.apply(void 0,c)(s.dispatch),$a({},s,{dispatch:i})}}}n(qn,"applyMiddleware");function Dn(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}n(Dn,"createThunkMiddleware");var Un=Dn();Un.withExtraArgument=Dn;var Fn=Un;var ks=ae(It());k();j();var gt="OG_STATE",qs=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),oo=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Ds=n(()=>oo()?{}:qs(localStorage.getItem(gt)),"loadState"),el=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"),Us=n(t=>{if(oo())return;let e=el(t);e&&localStorage.getItem(gt)!==e&&localStorage.setItem(gt,e)},"saveState"),Fs=n(t=>(0,ks.throttle)(500,e=>{if(oo())return;let{key:r,newValue:o}=e;r===gt&&o===null?(t.dispatch({type:ce}),setTimeout(()=>t.dispatch(vs()),0)):r===gt&&t.dispatch({type:Se,newValue:qs(o)})}),"listenLocalStorageChanges");var Ls=ae(It());j();F();var tl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ms=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>tl("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),rl=[{expressions:[({type:t}={})=>t===N,({type:t}={})=>t===D],fn:Ms(!0)},{expressions:[({type:t}={})=>t===q],fn:Ms(!1)}],js=n(t=>e=>r=>{let o=t.getState();rl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),$s=n(t=>e=>r=>{var s;let o;switch(r.type){case R:case q:case N:case D:o=new CustomEvent(`og-${r.type.toLowerCase().replace(/_/g,"-")}`,{bubbles:!0,cancelable:!0,detail:r.payload}),(((s=r.payload)==null?void 0:s.offer)||document).dispatchEvent(o);break;default:}(o==null?void 0:o.defaultPrevented)||e(r)},"offerEvents"),Vs=n(t=>e=>r=>{e(r);let o=(0,Ls.throttle)(500,()=>{Us({...t.getState()})});r.type!==Se&&o()},"localStorageMiddleware");k();j();var no=n(()=>{let t,e;return[new Promise((r,o)=>{t=r,e=o}),t,e]},"waitFor");function Hs(t){let[e,r]=no(),[o,s]=no(),[i,a]=no();o.then(l=>{let{sessionId:p}=t.getState();!p||l&&!p.startsWith(l)?t.dispatch(Zr(l)):a(p)});let c=Promise.all([o,e,i]);return c.then(()=>{var l;window.addEventListener("storage",Fs(t)),((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(xs())}),l=>async p=>{Me===p.type||Le===p.type||je===p.type?r(p.payload):De===p.type?s(p.payload):Ue===p.type?a(p.payload):await c,l(p)}}n(Hs,"waitUntilOffersReady");function Gs(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"}):$r,s=[Hs,Fn,js,$s],i={};if(!r)try{i=Ds(),s.push(Vs)}catch{}let a=o(qn(...s,...e.filter(l=>l))),c=jr(t,i,a);return window.og=window.og||{},window.og.store=c,c}n(Gs,"makeStore");var ol=Object.defineProperty,cr=n((t,e)=>ol(t,"name",{value:e,configurable:!0}),"i"),nl=cr(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Bs=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],zs=cr(t=>(e,r)=>{Bs.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");function so(t=window.opener,e=window.og){let r=cr(o=>{let s=nl(Bs),i=zs(o.source),a=o.data.options||{};if(s(o)&&o.data.ogType==="READY"){let c="//static.ordergroove.com/@ordergroove/offers-live-editor/0.6.1/dist/";c.startsWith("//")&&(c=window.location.protocol+c),c.endsWith("/")||(c+="/"),import(`${c}client.js`).then(({initializeClient:l})=>{l({isMessageAllowed:s,broadcastMessage:i,options:a,og:e}),window.removeEventListener("message",r)})}},"handleReady");t&&t!==window&&(window.addEventListener("message",r),zs(t)("READY"))}n(so,"f");cr(so,"offersLiveEditor");var lr=null,sl=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ws=n(t=>{if(!lr)throw new Error("Missing redux store.");return lr},"resolveStore"),il=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ws(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=sl)=>r=>{let s=il(t,typeof e=="function"?e:i=>In(e,i));return class extends r{get store(){return lr}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ws(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),Ys=n(t=>{lr=t},"setStore");ue();var io=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],...pt(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"),pr=n((t={})=>{let e={};return Object.entries(t).forEach(([r,o])=>{Object.entries(o).forEach(([s,i])=>{let a={};i&&!Array.isArray(i)?a=i:a={frequency:s,prepaidShipments:null,regularPrice:i[0],subscriptionPrice:i[2],discountRate:i[1]},e[r]?e[r].push(a):e[r]=[a]})}),e},"getObjectStructuredProductPlans");k();O();var Ri=ae(xi());O();var Tl=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"),vi=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct");var Ao=n(t=>{let e=vi(t);if(!e){let r=t.offer;r&&(e=vi(r))}return e},"resolveProduct"),Ol=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),No=n(t=>class extends t{get offer(){return Ol(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"),A=n(t=>class extends No(t){get product(){return Ao(this)}},"withProduct"),Tr=n(t=>class extends t{get childOptions(){let e=[],r=null;return this.querySelectorAll("option").forEach(o=>{let s=Tl(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),{options:e,isSelected:r}}},"withChildOptions");var Or={};Ur(Or,{autoshipByDefault:()=>wl,eligibilityGroups:()=>ko,eligible:()=>Ti,hasUpcomingOrder:()=>Pi,hasUpsellGroup:()=>wi,inStock:()=>Io,optedout:()=>Rl,prepaidEligible:()=>Pl,prepaidSubscribed:()=>Al,regularEligible:()=>Il,subscribed:()=>Cl,subscriptionEligible:()=>Oi,upcomingOrderContainsProduct:()=>Nl,upsellEligible:()=>Ci});F();var Io=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),Ti=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),wl=n((t,e)=>(t.autoshipByDefault||{})[(e.product||{}).id]||!1,"autoshipByDefault"),Oi=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&Ti(t,e)&&Io(t,e),"subscriptionEligible"),ko=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),wi=n((t,e)=>{let r=ko(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Pl=n((t,e)=>{let r=ko(t,e);return(r==null?void 0:r.some(o=>o==="prepaid"))||!1},"prepaidEligible"),Cl=n((t,e)=>Xt(e.product)(t),"subscribed"),Rl=n((t,e)=>tr(e.product)(t),"optedout"),Al=n((t,e)=>ps(e.product)(t),"prepaidSubscribed"),Pi=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Nl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),Ci=n((t,e)=>{var r;return!((r=e.offer)==null?void 0:r.isCart)&&t.offerId&&t.offerId!=="0"&&t.auth&&Io(t,e)&&Pi(t)&&wi(t,e)},"upsellEligible"),Il=n((t,e)=>Oi(t,e)&&!Ci(t,e),"regularEligible");var kl=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),qo=class extends A(v){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&Ri.default.parse(kl(this.test),r=>Or[r]&&Or[r](this.state,this))?d`
111
111
  <slot></slot>
112
- `:d``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(Fo,"When");var Ul=n(t=>({state:t}),"mapStateToProps"),ki=g(Ul)(Fo);O();k();O();U();de();var qi={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},be={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Yr(t)?t:null}}},wr={type:Boolean,attribute:!0,reflect:!0},et={type:Object,attribute:!1};O();U();var Ll=n(t=>class extends t{getOption(e,r=e){let o=Kr(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}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=Ll(v);var W=class extends A(M){static get properties(){return{subscribed:wr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return E`
112
+ `:d``}shouldUpdate(e){return e.size&&(this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock||!this.product.id)}};n(qo,"When");var ql=n(t=>({state:t}),"mapStateToProps"),Ai=g(ql)(qo);O();k();O();F();ue();var Ni={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},be={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&zr(t)?t:null}}},wr={type:Boolean,attribute:!0,reflect:!0},Xe={type:Object,attribute:!1};O();F();var Dl=n(t=>class extends t{getOption(e,r=e){let o=Jr(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}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=Dl(v);var W=class extends A(M){static get properties(){return{subscribed:wr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"},productDefaultFrequency:{type:String},defaultFrequency:{type:String},frequencies:{type:Array}}}static get styles(){return E`
113
113
  :host {
114
114
  cursor: default;
115
115
  display: inline-block;
@@ -183,7 +183,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
183
183
  <slot name="frequency-mismatch"></slot>
184
184
  `:d`
185
185
  <slot name="not-subscribed"></slot>
186
- `}};n(W,"OptinStatus");var ie=n((t,e={})=>({subscribed:K(e.product)(t),frequency:Z(e.product)(t),productDefaultFrequency:Be((e.product||{}).id)(t),...H(t,e,"defaultFrequency"),...H(t,e,"frequencies"),...ze(t,e)}),"mapStateToProps"),Di=g(ie)(W);F();ft();var Uo=class extends W{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:be,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=Xr(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=Xr(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(Io(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
186
+ `}};n(W,"OptinStatus");var se=n((t,e={})=>({subscribed:K(e.product)(t),frequency:Z(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),...H(t,e,"defaultFrequency"),...H(t,e,"frequencies"),...Ge(t,e)}),"mapStateToProps"),Ii=g(se)(W);U();dt();var Do=class extends W{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:be,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=Kr(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=Kr(e,this.store.getState().config)),e}handleClick(e){this.optinProduct(Ao(this),this.optinFrequency,this.offer),e.preventDefault()}render(){return d`
187
187
  <slot name="default">
188
188
  <button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
189
189
  <label for="action-trigger">
@@ -192,7 +192,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
192
192
  </slot>
193
193
  </label>
194
194
  </slot>
195
- `}};n(Uo,"OptinButton");var Fi=g(ie,{optinProduct:oe})(Uo);O();k();var Lo=class extends W{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
195
+ `}};n(Do,"OptinButton");var ki=g(se,{optinProduct:de})(Do);O();k();var Uo=class extends W{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product,this.offer),e.preventDefault()}render(){return d`
196
196
  <slot name="default">
197
197
  <button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
198
198
  <label for="action-trigger">
@@ -201,13 +201,13 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
201
201
  </slot>
202
202
  </label>
203
203
  </slot>
204
- `}};n(Lo,"OptoutButton");var Ui=g(ie,{optoutProduct:Je})(Lo);O();k();O();U();de();var De=n((t,e)=>{let{every:r,every_period:o}=ut(t);return r&&o?d`
204
+ `}};n(Uo,"OptoutButton");var qi=g(se,{optoutProduct:We})(Uo);O();k();O();F();ue();var ke=n((t,e)=>{let{every:r,every_period:o}=pt(t);return r&&o?d`
205
205
  ${r}
206
206
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
207
207
  ${e&&e===t?d`
208
208
  <og-text key="defaultFrequencyCopy"></og-text>
209
209
  `:""}
210
- `:t},"frequencyText"),wt=class extends A(M){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:wr,frequency:{type:String},defaultFrequency:be,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:ls}}}}static get styles(){return E`
210
+ `:t},"frequencyText"),Ot=class extends A(M){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:wr,frequency:{type:String},defaultFrequency:be,productDefaultFrequency:{type:String},config:{type:Object},frequencies:{converter:{fromAttribute:as}}}}static get styles(){return E`
211
211
  :host[hidden] {
212
212
  display: none;
213
213
  }
@@ -217,7 +217,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
217
217
  `}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return d`
218
218
  <span>
219
219
  ${this.subscribed&&d`
220
- <slot name="subscribed">${De(e)} </slot>
220
+ <slot name="subscribed">${ke(e)} </slot>
221
221
  `||""}
222
222
  ${!this.subscribed&&d`
223
223
  <slot name="not-subscribed"></slot>
@@ -226,7 +226,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
226
226
  <slot name="frequency-mismatch"></slot>
227
227
  `||""}
228
228
  </span>
229
- `}};n(wt,"FrequencyStatus");var Ct=n((t,e)=>{var r,o;return{subscribed:K(e.product)(t),frequency:Z(e.product)(t),productDefaultFrequency:Be((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,...H(t,e,"frequencies"),...H(t,e,"defaultFrequency"),...ze(t,e)}},"mapStateToProps"),Li=g(Ct)(wt);U();var Mo=class extends Or(W){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:be}}static get styles(){return E`
229
+ `}};n(Ot,"FrequencyStatus");var wt=n((t,e)=>{var r,o;return{subscribed:K(e.product)(t),frequency:Z(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,...H(t,e,"frequencies"),...H(t,e,"defaultFrequency"),...Ge(t,e)}},"mapStateToProps"),Di=g(wt)(Ot);F();var Fo=class extends Tr(W){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:be}}static get styles(){return E`
230
230
  :host {
231
231
  display: inline-block;
232
232
  cursor: pointer;
@@ -236,24 +236,24 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
236
236
  border-width: var(--og-select-border-width, 1px);
237
237
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
238
238
  }
239
- `}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?void 0:o.length)?r=[e.find(s=>s.value==="optedOut"),...this.frequencies.map((s,i)=>({value:s,text:this.frequenciesText&&i in this.frequenciesText?this.frequenciesText[i]:De(s,this.defaultFrequency)}))]:r=e,d`
239
+ `}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?void 0:o.length)?r=[e.find(s=>s.value==="optedOut"),...this.frequencies.map((s,i)=>({value:s,text:this.frequenciesText&&i in this.frequenciesText?this.frequenciesText[i]:ke(s,this.defaultFrequency)}))]:r=e,d`
240
240
  <og-select
241
241
  .options="${r}"
242
242
  .selected="${this.currentFrequency}"
243
243
  .onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
244
244
  ></og-select>
245
- `}};n(Mo,"OptinSelect");var Mi=g((t,e)=>({...ie(t,e),...Ct(t,e),...H(t,e,"frequencies")}),{productChangeFrequency:ar,optoutProduct:Je})(Mo);O();k();var jo=class extends A(M){static get styles(){return E`
245
+ `}};n(Fo,"OptinSelect");var Ui=g((t,e)=>({...se(t,e),...wt(t,e),...H(t,e,"frequencies")}),{productChangeFrequency:sr,optoutProduct:We})(Fo);O();k();var Lo=class extends A(M){static get styles(){return E`
246
246
  :host[hidden] {
247
247
  display: none;
248
248
  }
249
249
  :host {
250
250
  display: inline-block;
251
251
  }
252
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:et,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return d`
252
+ `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:Xe,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return d`
253
253
  <slot>
254
254
  <og-next-upcoming-order></og-next-upcoming-order>
255
255
  </slot>
256
- `}};n(jo,"UpsellButton");var Ml=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),ji=g(Ml,{fetchOrders:lr})(jo);O();k();U();var $o=class extends A(M){static get properties(){return{...super.properties,defaultFrequency:be,auth:et,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super();this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return d`
256
+ `}};n(Lo,"UpsellButton");var Ul=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Fi=g(Ul,{fetchOrders:ar})(Lo);O();k();F();var Mo=class extends A(M){static get properties(){return{...super.properties,defaultFrequency:be,auth:Xe,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}}}constructor(){super();this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return d`
257
257
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
258
258
  <div slot="content">
259
259
  <slot>
@@ -291,7 +291,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
291
291
  </slot>
292
292
  </span>
293
293
  </og-modal>
294
- `}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($o,"UpsellModal");var jl=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:K(e.product)(t),frequency:Z(e.product)(t),...H(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),$i=g(jl,{concludeUpsell:Es,createIu:Cs})($o);O();k();var Vo=class extends W{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return E`
294
+ `}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(Mo,"UpsellModal");var Fl=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:K(e.product)(t),frequency:Z(e.product)(t),...H(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Li=g(Fl,{concludeUpsell:_s,createIu:ws})(Mo);O();k();var jo=class extends W{static get properties(){return{...super.properties,frequency:{type:String}}}static get styles(){return E`
295
295
  :host {
296
296
  cursor: default;
297
297
  display: inline-block;
@@ -332,13 +332,13 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
332
332
  ></slot>
333
333
  </label>
334
334
  </slot>
335
- `}};n(Vo,"OptinToggle");var Vi=g(ie,{optoutProduct:Je,optinProduct:oe})(Vo);O();var $l=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),Ho=class extends ko(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&&$l(e,this.pluralize)}render(){return d`
335
+ `}};n(jo,"OptinToggle");var Mi=g(se,{optoutProduct:We,optinProduct:de})(jo);O();var Ll=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),$o=class extends No(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&&Ll(e,this.pluralize)}render(){return d`
336
336
  ${this.getText()}
337
- `}};n(Ho,"Text");var Vl=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Hi=g(Vl)(Ho);O();F();var tt=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(tt,"DiscountAmount");var Rt=class extends tt{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(Rt,"DiscountPercent");var Go=class extends Rt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Go,"ShippingDiscountPercent");var Bo="Discount Percent",zo="Discount Amount",Gi="total_price",Bi="shipping_total",zi="sub_total",Wo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new Rt(o),{field:Gi,object:"item",type:Bo}],[new tt(o),{field:Gi,object:"item",type:zo}],[new Go(o),{field:Bi,object:"order",type:Bo}],[new tt(o),{field:Bi,object:"order",type:zo}],[new Rt(o),{field:zi,object:"order",type:Bo}],[new tt(o),{field:zi,object:"order",type:zo}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function Hl(t){return!(Wo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(Hl,"filterIncentives");var Yo=class extends A(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",s=(this.incentives[o]||[]).find(Hl.bind({incentiveClass:e,incentiveValue:r}));return d`
338
- ${this.label} ${s?Wo(s):this.renderFallback()}
337
+ `}};n($o,"Text");var Ml=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),ji=g(Ml)($o);O();U();var et=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(et,"DiscountAmount");var Pt=class extends et{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(Pt,"DiscountPercent");var Vo=class extends Pt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Vo,"ShippingDiscountPercent");var Ho="Discount Percent",Go="Discount Amount",$i="total_price",Vi="shipping_total",Hi="sub_total",Bo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new Pt(o),{field:$i,object:"item",type:Ho}],[new et(o),{field:$i,object:"item",type:Go}],[new Vo(o),{field:Vi,object:"order",type:Ho}],[new et(o),{field:Vi,object:"order",type:Go}],[new Pt(o),{field:Hi,object:"order",type:Ho}],[new et(o),{field:Hi,object:"order",type:Go}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function jl(t){return!(Bo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(jl,"filterIncentives");var zo=class extends A(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",s=(this.incentives[o]||[]).find(jl.bind({incentiveClass:e,incentiveValue:r}));return d`
338
+ ${this.label} ${s?Bo(s):this.renderFallback()}
339
339
  `}renderFallback(){return d`
340
- ${Wo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
341
- `}};n(Yo,"IncentiveText");var Gl=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&w((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Wi=g(Gl)(Yo);O();k();var Jo=class extends Or(wt){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return E`
340
+ ${Bo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
341
+ `}};n(zo,"IncentiveText");var $l=n((t,e)=>{var r;return{incentives:(t.incentives||{})[e&&(e==null?void 0:e.product)&&P((r=e==null?void 0:e.product)==null?void 0:r.id)]||{}}},"mapStateToProps"),Gi=g($l)(zo);O();k();var Wo=class extends Tr(Ot){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return E`
342
342
  :host {
343
343
  display: inline-block;
344
344
  cursor: pointer;
@@ -349,7 +349,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
349
349
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
350
350
  z-index: 1;
351
351
  }
352
- `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var s,i;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,((s=this.frequencies)==null?void 0:s.length)&&o&&((i=this.config)==null?void 0:i.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?void 0:o.length)?e=this.frequencies.map((s,i)=>{let a;return this.config.frequenciesEveryPeriod&&i in this.config.frequenciesEveryPeriod?a=De(this.config.frequenciesEveryPeriod[i],r):this.frequenciesText&&i in this.frequenciesText?a=this.frequenciesText[i]:a=De(s,this.defaultFrequency),{value:s,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(s=>({value:s,text:De(s,r)}))),e=e.map(({text:s,value:i})=>({text:i===r?d`
352
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){var s,i;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,((s=this.frequencies)==null?void 0:s.length)&&o&&((i=this.config)==null?void 0:i.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?void 0:o.length)?e=this.frequencies.map((s,i)=>{let a;return this.config.frequenciesEveryPeriod&&i in this.config.frequenciesEveryPeriod?a=ke(this.config.frequenciesEveryPeriod[i],r):this.frequenciesText&&i in this.frequenciesText?a=this.frequenciesText[i]:a=ke(s,this.defaultFrequency),{value:s,text:a}}):{options:e}=this.childOptions,e.length||(e=(this.frequencies||[]).map(s=>({value:s,text:ke(s,r)}))),e=e.map(({text:s,value:i})=>({text:i===r?d`
353
353
  ${s} ${this.defaultText||""}
354
354
  `:s,value:i})),d`
355
355
  <og-select
@@ -357,9 +357,9 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
357
357
  .selected="${this.currentFrequency}"
358
358
  .onChange="${({target:{value:s}})=>{this.productChangeFrequency(this.product,s,this.offer)}}"
359
359
  ></og-select>
360
- `}};n(Jo,"SelectFrequency");var Yi=g(Ct,{productChangeFrequency:ar})(Jo);O();var Bl={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 Ji=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Bl[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Qo=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
361
- ${Ji(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
362
- `}};n(Qo,"FormattedDate");var zl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Qi=g(zl)(Qo);O();var Xi=ce(ct());k();j();var Ki=n((t,e,r)=>n(async function(s){await s({type:st,payload:t}),await s({type:Se}),await s(Ce({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Wl=n((t,e,r)=>n(async function(s,i){await s({type:it,payload:t});let{merchantId:a}=i();t?(await s(Ce({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await s(to({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 s(gt(a,"sig_field","ts","sig"))):await s(fe())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Yl=n((t,e,r)=>n(async function(s,i){await s({type:Hr,payload:t}),await s({type:Se}),await s(Ce({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell","prepaid"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r)),await s({type:Wt,payload:{[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 s({type:He,payload:{prepaidSellingPlans:{[e]:[{numberShipments:3,sellingPlan:"1_3"},{numberShipments:6,sellingPlan:"1_3"},{numberShipments:12,sellingPlan:"1_3"}]}}})},"setPreviewPrepaidThunk"),"setPreviewPrepaid"),Zi=n((t,e,r)=>async function(o,s){switch(await o({type:le}),await o({type:st,payload:!1}),await o({type:it,payload:!1}),t){case"regular":o(Ki(!0,r.product.id,r));break;case"upsell":o(Wl(!0,r.product.id,r));break;case"subscribed":o(Ki(!0,r.product.id,r)),o(oe(r.product,"2_2"));break;case"prepaid":o(Yl(!0,r.product.id,r)),o(oe(r.product,"1_3"));break;default:}},"setPreview");k();U();F();j();var Jl=n((...t)=>JSON.stringify(t),"memoizeKey"),Ql=(0,Xi.default)((t,e)=>Object.assign({components:e},t),Jl),Ko=class extends M{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:qi,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:et,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 E`
360
+ `}};n(Wo,"SelectFrequency");var Bi=g(wt,{productChangeFrequency:sr})(Wo);O();var Vl={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 zi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Vl[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Yo=class extends v{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return d`
361
+ ${zi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
362
+ `}};n(Yo,"FormattedDate");var Hl=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Wi=g(Hl)(Yo);O();var Qi=ae(at());k();j();var Yi=n((t,e,r)=>n(async function(s){await s({type:nt,payload:t}),await s({type:Fe}),await s(Ye({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Gl=n((t,e,r)=>n(async function(s,i){await s({type:st,payload:t});let{merchantId:a}=i();t?(await s(Ye({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await s(Xr({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 s(mt(a,"sig_field","ts","sig"))):await s(fe())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Ji=n((t,e,r)=>async function(o,s){switch(await o({type:ce}),await o({type:nt,payload:!1}),await o({type:st,payload:!1}),t){case"regular":o(Yi(!0,r.product.id,r));break;case"upsell":o(Gl(!0,r.product.id,r));break;case"subscribed":o(Yi(!0,r.product.id,r)),o(de(r.product,"2_2"));break;default:}},"setPreview");k();F();U();j();var Bl=n((...t)=>JSON.stringify(t),"memoizeKey"),zl=(0,Qi.default)((t,e)=>Object.assign({components:e},t),Bl),Jo=class extends M{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Ni,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Xe,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")}static get styles(){return E`
363
363
  :host[hidden] {
364
364
  display: none;
365
365
  }
@@ -508,9 +508,9 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
508
508
  </og-when>
509
509
  </og-when>
510
510
 
511
- `}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 s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&sr(()=>this.fetchOffer(this.product.id,xe,this)),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=Ql(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});I(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>I(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}render(){return d`
511
+ `}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 s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&!this.isPreview&&or(()=>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=zl(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});I(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>I(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}render(){return d`
512
512
  <slot></slot>
513
- `}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(Ko,"Offer");var Kl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:Z(e.product)(t),productDefaultFrequency:Be((e.product||{}).id)(t),...H(t,e,"autoshipByDefault",Qr(t)[(e.product||{}).id]),...or(e.product)(t)&&{autoshipByDefault:!1},optedin:mt(t),subscribed:K(e.product)(t),...ze(t)}),"mapStateToProps"),ea=g(Kl,{fetchOffer:Ps,fetchOrders:lr,productHasChangedComponents:_s,optinProduct:oe,setFirstOrderPlaceDate:ks,setProductToSubscribe:qs,setPreview:Zi})(Ko);O();var Cr=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 E`
513
+ `}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(Jo,"Offer");var Wl=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:Z(e.product)(t),productDefaultFrequency:He((e.product||{}).id)(t),...H(t,e,"autoshipByDefault",Yr(t)[(e.product||{}).id]),...tr(e.product)(t)&&{autoshipByDefault:!1},optedin:ht(t),subscribed:K(e.product)(t),...Ge(t)}),"mapStateToProps"),Ki=g(Wl,{fetchOffer:Ts,fetchOrders:ar,productHasChangedComponents:ys,optinProduct:de,setFirstOrderPlaceDate:Ns,setProductToSubscribe:Is,setPreview:Ji})(Jo);O();var Pr=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 E`
514
514
  :host[hidden] {
515
515
  display: none;
516
516
  }
@@ -657,7 +657,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
657
657
  </div>
658
658
  </div>
659
659
  </div>
660
- `:d``}};n(Cr,"Modal");O();var Rr=class extends v{static get styles(){return E`
660
+ `:d``}};n(Pr,"Modal");O();var Cr=class extends v{static get styles(){return E`
661
661
  :host {
662
662
  display: inline-block;
663
663
  color: inherit;
@@ -721,7 +721,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
721
721
  `)}
722
722
  </select>
723
723
  <span>&#9660;</span>
724
- `}};n(Rr,"Select");O();var Ar=class extends v{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return E`
724
+ `}};n(Cr,"Select");O();var Rr=class extends v{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return E`
725
725
  :host[hidden] {
726
726
  display: none;
727
727
  }
@@ -884,7 +884,7 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
884
884
  </slot>
885
885
  </div>
886
886
  </span>
887
- `}};n(Ar,"Tooltip");O();U();k();var Zo=class extends A(v){constructor(){super();this.options=[],this.text="shipments"}static get properties(){return{options:{type:Array},text:{type:String},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number}}}static get styles(){return E`
887
+ `}};n(Rr,"Tooltip");O();F();k();var Qo=class extends A(v){constructor(){super();this.options=[],this.text="shipments"}static get properties(){return{options:{type:Array},text:{type:String},shipmentsOptedIn:{type:Number},prepaidShipmentsSelected:{type:Number}}}static get styles(){return E`
888
888
  og-select {
889
889
  display: inline-block;
890
890
  cursor: pointer;
@@ -918,23 +918,23 @@ var lib=(()=>{var ka=Object.create;var rt=Object.defineProperty;var qa=Object.ge
918
918
  <slot name="append"></slot>
919
919
  </label>
920
920
  </div>
921
- `}};n(Zo,"PrepaidToggle");var Zl=n((t,e)=>({options:fs(e.product.id)(t),shipmentsOptedIn:nr(e.product)(t),prepaidShipmentsSelected:rr(e.product)(t)}),"mapStateToProps"),ta=g(Zl,{productChangePrepaidShipments:Ss})(Zo);O();U();F();var Xo=class extends A(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 E`
921
+ `}};n(Qo,"PrepaidToggle");var Yl=n((t,e)=>({options:us(e.product.id)(t),shipmentsOptedIn:rr(e.product)(t),prepaidShipmentsSelected:er(e.product)(t)}),"mapStateToProps"),Zi=g(Yl,{productChangePrepaidShipments:bs})(Qo);O();F();U();var Ko=class extends A(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 E`
922
922
  :host {
923
923
  display: inline-block;
924
924
  text-indent: initial;
925
925
  }
926
- `}get value(){let e=w(this.product),r=this.productPlans[e]||[],o=this.prepaidShipmentsSelected?this.prepaidShipmentsSelected:this.shipmentsOptedIn,s=r.find(f=>f.prepaidShipments>1&&f.prepaidShipments===o);if(!s&&(s=r.find(f=>f.prepaidShipments>1),!s))return"";let{discountRate:i,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:l,prepaidSavingsPerShipment:p,prepaidSavingsTotal:h,prepaidExtraSavingsPercentage:u}=s;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?h:this.perDeliverySavings?p:this.percentageSavings?i:this.extraPercentageSavings?u:this.numberOfShipments?c:""}render(){let e=this.value;return e?d`
926
+ `}get value(){let e=P(this.product),r=this.productPlans[e]||[],o=this.prepaidShipmentsSelected?this.prepaidShipmentsSelected:this.shipmentsOptedIn,s=r.find(f=>f.prepaidShipments>1&&f.prepaidShipments===o);if(!s&&(s=r.find(f=>f.prepaidShipments>1),!s))return"";let{discountRate:i,subscriptionPrice:a,prepaidShipments:c,regularPrepaidPrice:l,prepaidSavingsPerShipment:p,prepaidSavingsTotal:h,prepaidExtraSavingsPercentage:u}=s;return this.totalPrice?l:this.perDeliveryPrice?a:this.totalSavings?h:this.perDeliverySavings?p:this.percentageSavings?i:this.extraPercentageSavings?u:this.numberOfShipments?c:""}render(){let e=this.value;return e?d`
927
927
  <slot name="prepend"></slot>
928
928
  ${e}
929
929
  <slot name="append"></slot>
930
930
  `:d`
931
931
  <slot name="fallback"></slot>
932
- `}};n(Xo,"PrepaidData");var Xl=n((t,e)=>({shipmentsOptedIn:nr(e.product)(t),prepaidShipmentsSelected:rr(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),ra=g(Xl)(Xo);var{TestWizard:tp}=(na(),oa);function en(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,tp);let e=document.createElement(t);document.body.appendChild(e)}n(en,"default");var tn=[79,71,68,69,86],sa=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===tn[t]){let o=tn[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=tn.length&&en()}else t=0},!1)},"enable");de();j();U();de();F();var Ir=n((t=[],e)=>{switch(e.type){case le:return[];case Ee:return e.newValue?e.newValue.optedin:t;case N:case D:{let[{prepaidShipments:c,...l},p]=Ye(t,e.payload.product);return p.concat({...l,...e.payload.product,frequency:e.payload.frequency})}case te:let{payload:r}=e,[{prepaidShipments:o,...s},i]=Ye(t,r.product),a={...s,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),i.concat(a);case q:return t.filter(c=>!I(e.payload.product,c));case nt:return t.map(c=>I(e.payload.product,c)?{...c,...e.payload.newProduct}:c);case $t:return t.filter(c=>!I(e.payload.product,c));case Ve:return[];default:return t}},"optedin"),rn=n((t=[],e)=>{switch(e.type){case le:return[];case Ee:return e.newValue?e.newValue.optedout:t;case N:case D:return t.filter(s=>!I(e.payload.product,s));case q:let[r,o]=Ye(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency});case nt:return t.map(s=>I(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Ve:return[];default:return t}},"optedout"),on=n((t={},{type:e,payload:r})=>{switch(e){case Lt: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 Mt:return{...t,products:(r.results||[]).map(o=>o.product)};case jt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),rp=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),op=n((t={},e)=>{switch(e.type){case Y:return{...t};case R:return{...t,...e.payload.in_stock};default:return t}},"inStock"),nn=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),ia=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),sn=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(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...ia(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...ia(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),np=n((t={},e)=>{switch(e.type){case N:case D:return{...t,[w(e.payload.product)]:e.payload.frequency};case q:return{...t,[w(e.payload.product)]:void 0};default:return t}},"frequency"),an=n((t=!1,e)=>{switch(e.type){case Ut:return{...e.payload};case Se:return!1;default:return t}},"auth"),cn=n((t="",e)=>{switch(e.type){case Ue:return e.payload;default:return t}},"merchantId"),ln=n((t=null,e)=>{switch(e.type){case Ft:return e.payload;default:return t}},"authUrl"),sp=n((t={},e)=>{switch(e.type){case R:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),pn=n((t="",e)=>{switch(e.type){case R:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),un=n((t=null,e)=>{switch(e.type){case le:return null;case Le:return e.payload;default:return t}},"sessionId"),ip=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 Ve:return{};default:return t}},"productOffer"),dn=n((t={},e)=>{switch(e.type){case Bt:return{...t,[w(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),fn=n((t={},e)=>{switch(e.type){case zt:return{...t,[w(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),At=n((t={},e)=>{switch(e.type){case Me:return{...t,name:ve,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case je:return{...t,name:Yt,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case $e:return{...t,name:Te,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),hn=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"}},e)=>{switch(e.type){case Vt:return{...t,...e.payload};default:return t}},"locale"),ap=n((t={offerType:"radio"},e)=>{switch(e.type){case He:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?dt(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(dt):t.frequencies};default:return t}},"config"),mn=n((t=!1,e)=>{switch(e.type){case st:return e.payload;default:return t}},"previewStandardOffer"),gn=n((t=!1,e)=>{switch(e.type){case it:return e.payload;default:return t}},"previewUpsellOffer");var yn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),bn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),_n=n((t=[],e)=>{switch(e.type){case Gt:return[...e.payload||[]];case Ht:return[e.payload,...t];default:return t}},"templates"),cp=n((t={},e)=>{switch(e.type){case re:return bt(e.payload);case Wt:return Ks(t,bt(e.payload));default:return t}},"productPlans"),Sn=n((t={},e)=>{switch(e.type){case te:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),kr=It({optedin:Ir,optedout:rn,nextUpcomingOrder:on,autoshipEligible:rp,inStock:op,eligibilityGroups:nn,incentives:sn,frequency:np,auth:an,merchantId:cn,authUrl:ln,offer:sp,offerId:pn,sessionId:un,productOffer:ip,firstOrderPlaceDate:dn,productToSubscribe:fn,environment:At,locale:hn,config:ap,previewStandardOffer:mn,previewUpsellOffer:gn,autoshipByDefault:yn,defaultFrequencies:bn,templates:_n,productPlans:cp,prepaidShipmentsSelected:Sn});j();O();U();F();var En=class extends A(M){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},frequency:{type:Object},productPlans:{type:Object}}}get value(){var l;let e=w(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),s=(this.productPlans[e]||[]).find(p=>p.frequency===r);if(!s)return"";let{regularPrice:i,discountRate:a,subscriptionPrice:c}=s;return c===i?"":this.regular?i:this.discount?a:c}render(){let e=this.value;return e?d`
932
+ `}};n(Ko,"PrepaidData");var Jl=n((t,e)=>({shipmentsOptedIn:rr(e.product)(t),prepaidShipmentsSelected:er(e.product)(t),productPlans:t.productPlans}),"mapStateToProps"),Xi=g(Jl)(Ko);var{TestWizard:Kl}=(ta(),ea);function Zo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Kl);let e=document.createElement(t);document.body.appendChild(e)}n(Zo,"default");var Xo=[79,71,68,69,86],ra=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===Xo[t]){let o=Xo[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Xo.length&&Zo()}else t=0},!1)},"enable");ue();j();F();ue();U();var Nr=n((t=[],e)=>{switch(e.type){case ce:return[];case Se:return e.newValue?e.newValue.optedin:t;case N:case D:{let[{prepaidShipments:c,...l},p]=ze(t,e.payload.product);return p.concat({...l,...e.payload.product,frequency:e.payload.frequency})}case te:let{payload:r}=e,[{prepaidShipments:o,...s},i]=ze(t,r.product),a={...s,...r.product};return r.prepaidShipments&&(a.prepaidShipments=r.prepaidShipments),i.concat(a);case q:return t.filter(c=>!I(e.payload.product,c));case ot:return t.map(c=>I(e.payload.product,c)?{...c,...e.payload.newProduct}:c);case Mt:return t.filter(c=>!I(e.payload.product,c));case $e:return[];default:return t}},"optedin"),en=n((t=[],e)=>{switch(e.type){case ce:return[];case Se:return e.newValue?e.newValue.optedout:t;case N:case D:return t.filter(s=>!I(e.payload.product,s));case q:let[r,o]=ze(t,e.payload.product);return o.concat({...r,...e.payload.product,frequency:e.payload.frequency});case ot:return t.map(s=>I(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case $e:return[];default:return t}},"optedout"),tn=n((t={},{type:e,payload:r})=>{switch(e){case Ut: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 Ft:return{...t,products:(r.results||[]).map(o=>o.product)};case Lt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),Zl=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Xl=n((t={},e)=>{switch(e.type){case Y:return{...t};case R:return{...t,...e.payload.in_stock};default:return t}},"inStock"),rn=n((t={},e)=>{switch(e.type){case R:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),oa=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),on=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(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>({...s,initial:[...s.initial||[],...oa(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...oa(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),ep=n((t={},e)=>{switch(e.type){case N:case D:return{...t,[P(e.payload.product)]:e.payload.frequency};case q:return{...t,[P(e.payload.product)]:void 0};default:return t}},"frequency"),nn=n((t=!1,e)=>{switch(e.type){case Dt:return{...e.payload};case Fe:return!1;default:return t}},"auth"),sn=n((t="",e)=>{switch(e.type){case De:return e.payload;default:return t}},"merchantId"),an=n((t=null,e)=>{switch(e.type){case qt:return e.payload;default:return t}},"authUrl"),tp=n((t={},e)=>{switch(e.type){case R:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),cn=n((t="",e)=>{switch(e.type){case R:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),ln=n((t=null,e)=>{switch(e.type){case ce:return null;case Ue:return e.payload;default:return t}},"sessionId"),rp=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 $e:return{};default:return t}},"productOffer"),pn=n((t={},e)=>{switch(e.type){case Gt:return{...t,[P(e.payload.product)]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),un=n((t={},e)=>{switch(e.type){case Bt:return{...t,[P(e.payload.product)]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Ct=n((t={},e)=>{switch(e.type){case Le:return{...t,name:xe,apiUrl:"https://staging.offers.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Me:return{...t,name:zt,apiUrl:"https://dev.offers.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case je:return{...t,name:ve,apiUrl:"https://offers.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),dn=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"}},e)=>{switch(e.type){case jt:return{...t,...e.payload};default:return t}},"locale"),op=n((t={offerType:"radio"},e)=>{switch(e.type){case $t:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?ut(e.payload.defaultFrequency):t.defaultFrequency,frequenciesEveryPeriod:[],frequencies:e.payload.frequencies?e.payload.frequencies.map(ut):t.frequencies};default:return t}},"config"),fn=n((t=!1,e)=>{switch(e.type){case nt:return e.payload;default:return t}},"previewStandardOffer"),hn=n((t=!1,e)=>{switch(e.type){case st:return e.payload;default:return t}},"previewUpsellOffer"),mn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),gn=n((t=[],e)=>{switch(e.type){case R:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),yn=n((t=[],e)=>{switch(e.type){case Ht:return[...e.payload||[]];case Vt:return[e.payload,...t];default:return t}},"templates"),np=n((t={},e)=>{switch(e.type){case re:return pr(e.payload);default:return t}},"productPlans"),bn=n((t={},e)=>{switch(e.type){case te:return e.payload.prepaidShipments?{...t,[e.payload.product.id]:e.payload.prepaidShipments}:t;default:return t}},"prepaidShipmentsSelected"),Ir=At({optedin:Nr,optedout:en,nextUpcomingOrder:tn,autoshipEligible:Zl,inStock:Xl,eligibilityGroups:rn,incentives:on,frequency:ep,auth:nn,merchantId:sn,authUrl:an,offer:tp,offerId:cn,sessionId:ln,productOffer:rp,firstOrderPlaceDate:pn,productToSubscribe:un,environment:Ct,locale:dn,config:op,previewStandardOffer:fn,previewUpsellOffer:hn,autoshipByDefault:mn,defaultFrequencies:gn,templates:yn,productPlans:np,prepaidShipmentsSelected:bn});j();O();F();U();var _n=class extends A(M){static get properties(){return{...super.properties,regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},frequency:{type:Object},productPlans:{type:Object}}}get value(){var l;let e=P(this.product),r=this.frequency||this.configDefaultFrequency||((l=this.offer)==null?void 0:l.defaultFrequency),s=(this.productPlans[e]||[]).find(p=>p.frequency===r);if(!s)return"";let{regularPrice:i,discountRate:a,subscriptionPrice:c}=s;return c===i?"":this.regular?i:this.discount?a:c}render(){let e=this.value;return e?d`
933
933
  <slot name="prepend"></slot>
934
934
  ${e}
935
935
  <slot name="append"></slot>
936
936
  `:d`
937
937
  <slot name="fallback"></slot>
938
- `}};n(En,"Price");var lp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:Z(e.product)(t)}},"mapStateToProps"),aa=g(lp)(En);F();function xn(t){sa(),Qs(t);try{customElements.define("og-when",ki),customElements.define("og-text",Hi),customElements.define("og-incentive-text",Wi),customElements.define("og-offer",ea),customElements.define("og-select-frequency",Yi),customElements.define("og-optout-button",Ui),customElements.define("og-optin-toggle",Vi),customElements.define("og-optin-status",Di),customElements.define("og-optin-button",Fi),customElements.define("og-optin-select",Mi),customElements.define("og-upsell-button",ji),customElements.define("og-frequency-status",Li),customElements.define("og-modal",Cr),customElements.define("og-select",Rr),customElements.define("og-tooltip",Ar),customElements.define("og-upsell-modal",$i),customElements.define("og-next-upcoming-order",Qi),customElements.define("og-price",aa),customElements.define("og-prepaid-toggle",ta),customElements.define("og-prepaid-data",ra)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(oo(o)),this},setMerchantId(o){return t.dispatch(xs(o)),this},setAuthUrl(o){return t.dispatch(vs(o)),this},getProductsForPurchasePost(o=[]){return co(t.getState(),o)},getOptins(o=[]){return co(t.getState(),o)},clear(){t.dispatch(ws())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",s=>o(s.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(As(o)),this},setLocale(o){return t.dispatch(Rs(o)),this},addTemplate(o,s,i){return t.dispatch(Ns(o,s,i)),this},setTemplates(o){return t.dispatch(Is(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=At({},oo(s)),{sessionId:p}=a.getState();p&&c.forEach(h=>{let u=w(h);ue.fetchOffer(l,o,p,`${u}`,xe)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:re,payload:i.product_discounts})}},initialize(o,s,i){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),ao(window.opener,r),r}n(xn,"makeApi");j();F();var ae=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),qr=n(t=>`${t}%`,"percentage");var Dr=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"),Fr=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"),pp=n(t=>{var e;return(t.selling_plan_id||((e=t.selling_plan)==null?void 0:e.id)).toString()},"getAllocationFrequency"),up=n(t=>ae(t.compare_at_price),"getAllocationRegularPrice"),dp=n(t=>{var e;if(Dr(t)){let r=Fr((e=t.selling_plan)==null?void 0:e.options),o=t.price/r;return ae(o)}return ae(t.price)},"getAllocationSubscriptionPrice"),ca=n((t,e)=>(t.compare_at_price-e)*100/t.compare_at_price,"getPrepaidPercentage"),fp=n(t=>{var r,o,s;if(Dr(t)){let i=Fr((r=t.selling_plan)==null?void 0:r.options),a=t.price/i,c=ca(t,a);return qr(c)}let e="";return((o=t.price_adjustments[0])==null?void 0:o.value_type)==="percentage"?e=qr(t.price_adjustments[0].value):((s=t.price_adjustments[0])==null?void 0:s.value)?e=ae(t.price_adjustments[0].value):t.compare_at_price&&(e=ae(t.compare_at_price-t.price)),e},"getAllocationDiscountRate"),hp=n(t=>{var e;return Dr(t)?Fr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),mp=n((t,e,r)=>{var p,h;let o=Fr((p=t.selling_plan)==null?void 0:p.options),s=t.price/o,i=t.compare_at_price-s,a=ca(t,s),c=(h=r==null?void 0:r.price_adjustments)==null?void 0:h[0],l=c&&c.value_type==="percentage"?c.value:null;return e.regularPrepaidPrice=ae(t.price),e.prepaidSavingsPerShipment=ae(i),e.prepaidSavingsTotal=ae(i*o),l&&a&&(e.prepaidExtraSavingsPercentage=qr(a-l)),e},"addPrepaidPriceAndSavings"),vn="Subscribe and Save",gp=n((t,e=[])=>{t.selling_plan||(t.selling_plan=e.find(o=>o.id===t.selling_plan_id));let r={frequency:pp(t),regularPrice:up(t),subscriptionPrice:dp(t),discountRate:fp(t),prepaidShipments:hp(t)};if(Dr(t)){let o=e.find(s=>s.group_name===vn&&s.options.length===1);return mp(t,r,o)}return r},"mapSellingPlanToDiscount"),Tn=n((t,e,r=[])=>[...t,gp(e,r)],"sellingPlanAllocationsReducer"),la=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var pa=n((t,e,r)=>{let o=Object.keys(t).filter(s=>s.startsWith(e.toString()));return o.length?{...t,...o.reduce((s,i)=>({...s,[i]:r}),{})}:t},"overrideLineKey"),ua=n((t,e,r)=>{if(!r)return null;if(!We(r))return r;if(ir(t,e)){let o=X(t,e,r);return o||we(t)}return r},"getDefaultSellingPlan"),yp=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,p;return We(r==null?void 0:r.frequency)?{...r,frequency:ir((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?X((i=e==null?void 0:e.config)==null?void 0:i.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,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||we((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),bp=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},s,i)=>Object.keys(t).reduce((a,c)=>{if(!s.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:h}=i,u=r[c],f;return r[c]&&ir(l,p)?f=X(l,p,`${u.every}_${u.every_period}`)||ua(l,p,h)||we(l):r[c]?f=`${u.every}_${u.every_period}`:f=ua(l,p,h)||"_",a.concat({id:c,frequency:f})}return a},[]),"reduceNewOptinsFromOfferResponse"),da=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===vn),"getOGSellingPlanGroup"),_p=n((t,e)=>({...pa(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),fa=n((t,[e])=>({...t,[e]:!0}),"productTrue"),ha=n((t,e)=>{let r=w(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),Sp=n((t={},e)=>{if(re===e.type)return Object.entries(e.payload).reduce(fa,t);if(pe===e.type){let{payload:r}=e;return r.items.reduce(ha,t)}if(J===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...pa(o,s.id,((i=s.selling_plan_allocations)==null?void 0:i.length)>0),[s.id]:((a=s.selling_plan_allocations)==null?void 0:a.length)>0}},t)}return t},"autoshipEligible");function Ep(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(Ep,"textToFreq");function ma(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>Ep(r))}n(ma,"sellingPlansToEveryPeriod");function ga(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(ga,"sellingPlansToFrequencies");function ya(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(ya,"getPrepaidShipments");function xp(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],s=r.selling_plans.map(i=>({numberShipments:ya(i),sellingPlan:String(i.id)}));return{...e,[o]:s}},{})}n(xp,"getPrepaidSellingPlans");var vp=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o;if(re===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(J===e.type){let{payload:{offer:s,product:i}}=e,a={},c=da(i),l=ga(c);if(l==null?void 0:l.length){let h=ma(c),u=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||l,f=t.defaultFrequency;f&&We(f)&&(f=X(l,h,f)||we(l)||f),a={frequencies:l,frequenciesEveryPeriod:h,frequenciesText:u,...f?{defaultFrequency:f}:{}}}let p=i==null?void 0:i.selling_plan_groups.filter(h=>/^Prepaid-.*/.test(h.name));return p.length&&(a={...a,prepaidSellingPlans:xp(p)}),{...t,...a}}if(R===e.type){let{payload:{offer:s}}=e,{defaultFrequency:i,config:{frequencies:a,frequenciesEveryPeriod:c}={}}=s;return We(i)?{...t,defaultFrequency:X(a,c,i)||we(a)||i}:{...t,defaultFrequency:i}}return t},"config"),Tp=n((t={},e)=>{if(re===e.type)return Object.entries(e.payload).reduce(fa,t);if(pe===e.type)return e.payload.items.reduce(ha,t);if(J===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(_p,t)||t}return Y===e.type&&e.payload.product===null?{...t}:t},"inStock"),Op=n((t={},e)=>t,"offer");function Pp({prepaidShipments:t,offer:e,product:r}){var o;if(t){let s=r.id,i=(o=e.config.prepaidSellingPlans[s])==null?void 0:o.find(a=>a.numberShipments===t);return i?i.sellingPlan:null}return e.config.frequencies[0]}n(Pp,"getFrequencyForPrepaidShipments");function wp(t){let e=ya(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(wp,"getOptedInItem");var Cp=n((t=[],e)=>{if(pe===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,s)=>s.selling_plan_allocation?[...o,wp(s)]:o,[]))}if(R===e.type){let{offer:r={},...o}=e.payload,s=yp(t,r),i=bp(o,s,r);return[...s,...i]}if(J===e.type){let{product:r}=e.payload,o=da(r),s=ga(o),i=ma(o);return t.map(a=>We(a.frequency)?{...a,frequency:X(s,i,a.frequency)||we(s)}:a)}if(te===e.type){let{payload:r}=e,o=Ir(t,e),[s,i]=Ye(o,r.product);return i.concat({...s,...r.product,frequency:Pp(r)})}return Ir(t,e)},"optedin"),Rp=n((t={},e)=>t,"productOffer"),Ap=n((t={},e)=>{if(J===e.type){let{payload:{product:r}}=e,o=la(r);return[r,...r==null?void 0:r.variants].reduce((s,i)=>{var a;return{...s,[i.id]:(a=i.selling_plan_allocations)==null?void 0:a.reduce((c,l)=>Tn(c,l,o),[])}},t)||t}return pe===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:Tn([],s.selling_plan_allocation)}:o,t)||t:re===e.type?bt(e.payload):t},"productPlans"),Np=It({auth:an,authUrl:ln,autoshipByDefault:yn,autoshipEligible:Sp,config:vp,defaultFrequencies:bn,eligibilityGroups:nn,environment:At,firstOrderPlaceDate:dn,incentives:sn,inStock:Tp,locale:hn,merchantId:cn,nextUpcomingOrder:on,offer:Op,offerId:pn,optedin:Cp,optedout:rn,previewStandardOffer:mn,previewUpsellOffer:gn,productOffer:Rp,productPlans:Ap,productToSubscribe:fn,sessionId:un,templates:_n,prepaidShipmentsSelected:Sn});function On(t,e){return window.og&&window.og.previewMode?kr(t,e):Np(t,e)}n(On,"shopifyReducer");var _a=ce(ct()),Sa=ce(qt());j();U();F();j();function ba(t,e,r){let o=`[name="id"][value="${t}"]`,s=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let i=document.querySelectorAll(o);i.length||(i=document.querySelectorAll(s)),[...i].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(ba,"updateTrackingInputs");function Pn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(Pn,"getTrackingKey");function Ip(t,e){var h,u,f,P;if(!((h=t.payload.offer)==null?void 0:h.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,s=Pn(),i=((f=t.payload.offer)==null?void 0:f.location)||"",a=((P=t.payload.offer)==null?void 0:P.variationId)||"",c=Rn(o,e),p=[o,N.toLowerCase(),i,c,a].join(",");ba(o,s,p)}n(Ip,"addDefaultToSubTracking");function wn(t){return e=>r=>{switch(e(r),r.type){case N:case q:case D:let o=r.payload.offer,s=Cn(r);o&&!o.isCart&&ba(o.product.id,s[0],s[1]);break;case R:Ip(r,t);break;default:}}}n(wn,"shopifyTrackingMiddleware");var Oa,Pa,Ea=((Pa=(Oa=window.Shopify)==null?void 0:Oa.routes)==null?void 0:Pa.root)||"/",kp="/cart",qp=`${Ea}cart.js`,Dp=`${Ea}products/`,Fp='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',xa=(0,Sa.debounce)(100,!1,function(t,e){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")});async function Up(t,e){let r=Lp(e);if(r)try{let s=await Ta(r);t.dispatch({type:J,payload:{product:s,offer:e}})}catch(s){console.warn("OG: Unable to fetch product details for PDP",s)}let o=e.closest("form");if(!o){let s=e.parentElement;for(;s&&(o=s.querySelector('form[action$="/cart/add"]'),!(o||s.tagName.toLowerCase()==="body"));)s=s.parentElement}o?(o.addEventListener("change",i=>xa(o,e)),new MutationObserver(()=>xa(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(Up,"setupPdp");var va=n(async()=>await(await fetch(qp)).json(),"getCart");function Lp(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(Lp,"guessProductHandle");var Ta=(0,_a.default)(async t=>(await fetch(`${Dp}${t}.js`)).json());async function Mp(t,e){let r=await va(),{items:o}=r;t.dispatch({type:pe,payload:r});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(Ta))).forEach(a=>t.dispatch({type:J,payload:{product:a,offer:e}}))}n(Mp,"setupCart");async function jp(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=Cn(t);if(!!(r==null?void 0:r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Fp)),l=t.payload.product.id,p=await va(),h=(i=p==null?void 0:p.items)==null?void 0:i.findIndex(y=>y.key===l),u=p.items[h],f=u.quantity,P=w(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:f,attributes:Object.fromEntries([s]),properties:u.properties,selling_plan:o||null,sections:c.map(y=>y.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let m=await _.json(),x=p.items.length===m.items.length?m.items[h].key:(a=m.items.find(y=>y.quantity===f&&y.product_id===P&&(!o&&!y.selling_plan_allocation||(y==null?void 0:y.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;x&&r.setAttribute("product",x),e.dispatch({type:pe,payload:m});let C=new CustomEvent(Zn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let b=m.sections;Object.values(b).length?c.forEach(y=>{let Nt=y.id.replace(/^shopify-section-/,"");if(!(Nt in b))return;let Ia=b[Nt],Nn=new DOMParser().parseFromString(Ia.toString()||"","text/html").getElementById(y.id);Nn&&(y.innerHTML=Nn.innerHTML)}):window.location.pathname.startsWith(kp)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(jp,"synchronizeCartOptin");function Cn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=Pn(),o=((a=t.payload.offer)==null?void 0:a.location)||"",s=((c=t.payload.offer)==null?void 0:c.variationId)||"",i=[e,t.type.toLowerCase(),o];switch(t.type){case Y:case q:i.push(""),i.push(s);break;case N:case D:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(Cn,"getTrackingEvent");function Rn(t,e){var s;return(s=tr({id:t})(e.getState()))==null?void 0:s.frequency}n(Rn,"getSubscribedFrequency");function $p(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,s=Rn(o,t);bs(r.form,"selling_plan",s)})}n($p,"synchronizeSellingPlan");function An(t){return e=>r=>{var o;switch(r.type){case N:case q:case D:break;case Y:((o=r.payload.offer)==null?void 0:o.isCart)?Mp(t,r.payload.offer):Up(t,r.payload.offer);break;default:}switch(e(r),r.type){case N:case q:case D:jp(r,t);case te:case Y:case R:case J:$p(t,r.payload.offer);break;default:}}}n(An,"shopifyMiddleware");ft();F();k();F();var Vp="/apps/subscriptions/auth/",wa="og_auth_begin",Hp="og_auth_end",Gp=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Ca({store:t}){var s;let[e]=Zr(),r=ht(),o=(r==null?void 0:r.dataset.customer)?Gp(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await zp(o);if(i){let[a,c,l]=i.split("|");t.dispatch(gt(e,a,Number(c),l))}}else gs("og_auth")}n(Ca,"authorizeShopifyCustomer");async function Bp(t){try{let r=await(await fetch(`${Vp}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(wa);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+wa.length,r.lastIndexOf(Hp)))}catch(e){console.error(e)}}n(Bp,"fetchOGSignature");async function zp(t){let e=ys("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await Bp(t);if(!r)return"";let i=new Date,a=btoa(s);i.setTime(i.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${i.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(zp,"getOrCreateAuthCookie");var Aa,Ra=zs(...((Aa=L)==null?void 0:Aa.shopify_selling_plans)?[On,An]:[kr],L.shopify&&wn),T=xn(Ra),Wp=T.isReady,Yp=T.addOptinChangedCallback,Jp=T.addTemplate,Qp=T.clear,Kp=T.config,Zp=T.disableOptinChangedCallbacks,Xp=T.getOptins,eu=T.getProductsForPurchasePost,tu=T.initialize,ru=T.previewMode,ou=T.register,nu=T.resolveSettings,su=T.setAuthUrl,iu=T.setEnvironment,au=T.setLocale,cu=T.setMerchantId,lu=T.setPublicPath,pu=T.setTemplates,uu=T.setupCart,du=T.setupProduct,fu=T.setupProducts,hu=n(()=>ms(T),"autoInit");var mu=T.initialize,Na;((Na=L)==null?void 0:Na.shopify_selling_plans)&&sr(()=>Ca(T));return gu;})();
938
+ `}};n(_n,"Price");var sp=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:Z(e.product)(t)}},"mapStateToProps"),na=g(sp)(_n);U();function Sn(t){ra(),Ys(t);try{customElements.define("og-when",Ai),customElements.define("og-text",ji),customElements.define("og-incentive-text",Gi),customElements.define("og-offer",Ki),customElements.define("og-select-frequency",Bi),customElements.define("og-optout-button",qi),customElements.define("og-optin-toggle",Mi),customElements.define("og-optin-status",Ii),customElements.define("og-optin-button",ki),customElements.define("og-optin-select",Ui),customElements.define("og-upsell-button",Fi),customElements.define("og-frequency-status",Di),customElements.define("og-modal",Pr),customElements.define("og-select",Cr),customElements.define("og-tooltip",Rr),customElements.define("og-upsell-modal",Li),customElements.define("og-next-upcoming-order",Wi),customElements.define("og-price",na),customElements.define("og-prepaid-toggle",Zi),customElements.define("og-prepaid-data",Xi)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(to(o)),this},setMerchantId(o){return t.dispatch(Ss(o)),this},setAuthUrl(o){return t.dispatch(Es(o)),this},getProductsForPurchasePost(o=[]){return io(t.getState(),o)},getOptins(o=[]){return io(t.getState(),o)},clear(){t.dispatch(Os())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",s=>o(s.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(Cs(o)),this},setLocale(o){return t.dispatch(Ps(o)),this},addTemplate(o,s,i){return t.dispatch(Rs(o,s,i)),this},setTemplates(o){return t.dispatch(As(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=Ct({},to(s)),{sessionId:p}=a.getState();p&&c.forEach(h=>{let u=P(h);pe.fetchOffer(l,o,p,`${u}`,Ee)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:re,payload:i.product_discounts})}},initialize(o,s,i){var c;e?console.warn("og.offers has been initialized already. Skipping."):r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),so(window.opener,r),r}n(Sn,"makeApi");j();U();var ie=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),kr=n(t=>`${t}%`,"percentage");var qr=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"),Dr=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"),ip=n(t=>{var e;return(t.selling_plan_id||((e=t.selling_plan)==null?void 0:e.id)).toString()},"getAllocationFrequency"),ap=n(t=>ie(t.compare_at_price),"getAllocationRegularPrice"),cp=n(t=>{var e;if(qr(t)){let r=Dr((e=t.selling_plan)==null?void 0:e.options),o=t.price/r;return ie(o)}return ie(t.price)},"getAllocationSubscriptionPrice"),sa=n((t,e)=>(t.compare_at_price-e)*100/t.compare_at_price,"getPrepaidPercentage"),lp=n(t=>{var r,o,s;if(qr(t)){let i=Dr((r=t.selling_plan)==null?void 0:r.options),a=t.price/i,c=sa(t,a);return kr(c)}let e="";return((o=t.price_adjustments[0])==null?void 0:o.value_type)==="percentage"?e=kr(t.price_adjustments[0].value):((s=t.price_adjustments[0])==null?void 0:s.value)?e=ie(t.price_adjustments[0].value):t.compare_at_price&&(e=ie(t.compare_at_price-t.price)),e},"getAllocationDiscountRate"),pp=n(t=>{var e;return qr(t)?Dr((e=t.selling_plan)==null?void 0:e.options):null},"getAllocationNumberOfShipments"),up=n((t,e,r)=>{var p,h;let o=Dr((p=t.selling_plan)==null?void 0:p.options),s=t.price/o,i=t.compare_at_price-s,a=sa(t,s),c=(h=r==null?void 0:r.price_adjustments)==null?void 0:h[0],l=c&&c.value_type==="percentage"?c.value:null;return e.regularPrepaidPrice=ie(t.price),e.prepaidSavingsPerShipment=ie(i),e.prepaidSavingsTotal=ie(i*o),l&&a&&(e.prepaidExtraSavingsPercentage=kr(a-l)),e},"addPrepaidPriceAndSavings"),En="Subscribe and Save",dp=n((t,e=[])=>{t.selling_plan||(t.selling_plan=e.find(o=>o.id===t.selling_plan_id));let r={frequency:ip(t),regularPrice:ap(t),subscriptionPrice:cp(t),discountRate:lp(t),prepaidShipments:pp(t)};if(qr(t)){let o=e.find(s=>s.group_name===En&&s.options.length===1);return up(t,r,o)}return r},"mapSellingPlanToDiscount"),xn=n((t,e,r=[])=>[...t,dp(e,r)],"sellingPlanAllocationsReducer"),ia=n(t=>t.selling_plan_groups.reduce((e,r)=>[...e,...r.selling_plans.map(o=>({...o,group_name:r.name}))],[]),"getSellingPlans");var aa=n((t,e,r)=>{let o=Object.keys(t).filter(s=>s.startsWith(e.toString()));return o.length?{...t,...o.reduce((s,i)=>({...s,[i]:r}),{})}:t},"overrideLineKey"),ca=n((t,e,r)=>{if(!r)return null;if(!Be(r))return r;if(nr(t,e)){let o=X(t,e,r);return o||we(t)}return r},"getDefaultSellingPlan"),fp=n((t,e)=>t.map(r=>{var o,s,i,a,c,l,p;return Be(r==null?void 0:r.frequency)?{...r,frequency:nr((o=e==null?void 0:e.config)==null?void 0:o.frequencies,(s=e==null?void 0:e.config)==null?void 0:s.frequenciesEveryPeriod)?X((i=e==null?void 0:e.config)==null?void 0:i.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,(l=e==null?void 0:e.config)==null?void 0:l.frequenciesEveryPeriod,e.defaultFrequency)||we((p=e==null?void 0:e.config)==null?void 0:p.frequencies):r.frequency}:r}),"mapExistingOptinsFromOfferResponse"),hp=n(({autoship:t={},autoship_by_default:e={},default_frequencies:r={},in_stock:o={}},s,i)=>Object.keys(t).reduce((a,c)=>{if(!s.some(l=>l.id===c)){if(!(t[c]&&e[c]&&o[c]))return a;let{config:{frequencies:l,frequenciesEveryPeriod:p}={},defaultFrequency:h}=i,u=r[c],f;return r[c]&&nr(l,p)?f=X(l,p,`${u.every}_${u.every_period}`)||ca(l,p,h)||we(l):r[c]?f=`${u.every}_${u.every_period}`:f=ca(l,p,h)||"_",a.concat({id:c,frequency:f})}return a},[]),"reduceNewOptinsFromOfferResponse"),la=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name===En),"getOGSellingPlanGroup"),mp=n((t,e)=>({...aa(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),pa=n((t,[e])=>({...t,[e]:!0}),"productTrue"),ua=n((t,e)=>{let r=P(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),gp=n((t={},e)=>{if(re===e.type)return Object.entries(e.payload).reduce(pa,t);if(le===e.type){let{payload:r}=e;return r.items.reduce(ua,t)}if(J===e.type){let{payload:{product:r}}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...aa(o,s.id,((i=s.selling_plan_allocations)==null?void 0:i.length)>0),[s.id]:((a=s.selling_plan_allocations)==null?void 0:a.length)>0}},t)}return t},"autoshipEligible");function yp(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(yp,"textToFreq");function da(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({options:r})=>r||[]).flat().map(({value:r})=>yp(r))}n(da,"sellingPlansToEveryPeriod");function fa(t){var e;return(e=t==null?void 0:t.selling_plans)==null?void 0:e.map(({id:r})=>`${r}`)}n(fa,"sellingPlansToFrequencies");function ha(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(ha,"getPrepaidShipments");function bp(t){return t.reduce((e,r)=>{let o=r.name.split("-")[1],s=r.selling_plans.map(i=>({numberShipments:ha(i),sellingPlan:String(i.id)}));return{...e,[o]:s}},{})}n(bp,"getPrepaidSellingPlans");var _p=n((t={frequencies:[],offerType:"radio",frequenciesEveryPeriod:[]},e)=>{var r,o;if(re===e.type){let s=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:s}}if(J===e.type){let{payload:{offer:s,product:i}}=e,a={},c=la(i),l=fa(c);if(l==null?void 0:l.length){let h=da(c),u=((o=(r=c.options)==null?void 0:r[0])==null?void 0:o.values)||l,f=t.defaultFrequency;f&&Be(f)&&(f=X(l,h,f)||we(l)||f),a={frequencies:l,frequenciesEveryPeriod:h,frequenciesText:u,...f?{defaultFrequency:f}:{}}}let p=i==null?void 0:i.selling_plan_groups.filter(h=>/^Prepaid-.*/.test(h.name));return p.length&&(a={...a,prepaidSellingPlans:bp(p)}),{...t,...a}}if(R===e.type){let{payload:{offer:s}}=e,{defaultFrequency:i,config:{frequencies:a,frequenciesEveryPeriod:c}={}}=s;return Be(i)?{...t,defaultFrequency:X(a,c,i)||we(a)||i}:{...t,defaultFrequency:i}}return t},"config"),Sp=n((t={},e)=>{if(re===e.type)return Object.entries(e.payload).reduce(pa,t);if(le===e.type)return e.payload.items.reduce(ua,t);if(J===e.type){let{payload:{product:r}}=e;return[r,...r==null?void 0:r.variants].reduce(mp,t)||t}return Y===e.type&&e.payload.product===null?{...t}:t},"inStock"),Ep=n((t={},e)=>t,"offer");function xp({prepaidShipments:t,offer:e,product:r}){var o;if(t){let s=r.id,i=(o=e.config.prepaidSellingPlans[s])==null?void 0:o.find(a=>a.numberShipments===t);return i?i.sellingPlan:null}return e.config.frequencies[0]}n(xp,"getFrequencyForPrepaidShipments");function vp(t){let e=ha(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(vp,"getOptedInItem");var Tp=n((t=[],e)=>{if(le===e.type){let r=e.payload;return t.filter(o=>!o.id.includes(":")).concat(r.items.reduce((o,s)=>s.selling_plan_allocation?[...o,vp(s)]:o,[]))}if(R===e.type){let{offer:r={},...o}=e.payload,s=fp(t,r),i=hp(o,s,r);return[...s,...i]}if(J===e.type){let{product:r}=e.payload,o=la(r),s=fa(o),i=da(o);return t.map(a=>Be(a.frequency)?{...a,frequency:X(s,i,a.frequency)||we(s)}:a)}if(te===e.type){let{payload:r}=e,o=Nr(t,e),[s,i]=ze(o,r.product);return i.concat({...s,...r.product,frequency:xp(r)})}return Nr(t,e)},"optedin"),Op=n((t={},e)=>t,"productOffer"),wp=n((t={},e)=>{if(J===e.type){let{payload:{product:r}}=e,o=ia(r);return[r,...r==null?void 0:r.variants].reduce((s,i)=>{var a;return{...s,[i.id]:(a=i.selling_plan_allocations)==null?void 0:a.reduce((c,l)=>xn(c,l,o),[])}},t)||t}return le===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:xn([],s.selling_plan_allocation)}:o,t)||t:re===e.type?pr(e.payload):t},"productPlans"),Pp=At({auth:nn,authUrl:an,autoshipByDefault:mn,autoshipEligible:gp,config:_p,defaultFrequencies:gn,eligibilityGroups:rn,environment:Ct,firstOrderPlaceDate:pn,incentives:on,inStock:Sp,locale:dn,merchantId:sn,nextUpcomingOrder:tn,offer:Ep,offerId:cn,optedin:Tp,optedout:en,previewStandardOffer:fn,previewUpsellOffer:hn,productOffer:Op,productPlans:wp,productToSubscribe:un,sessionId:ln,templates:yn,prepaidShipmentsSelected:bn});function vn(t,e){return window.og&&window.og.previewMode?Ir(t,e):Pp(t,e)}n(vn,"shopifyReducer");var ga=ae(at()),ya=ae(It());j();F();U();j();function ma(t,e,r){let o=`[name="id"][value="${t}"]`,s=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let i=document.querySelectorAll(o);i.length||(i=document.querySelectorAll(s)),[...i].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(ma,"updateTrackingInputs");function Tn(){return`og__${Math.ceil(new Date().getTime()/1e3)}`}n(Tn,"getTrackingKey");function Cp(t,e){var h,u,f,w;if(!((h=t.payload.offer)==null?void 0:h.autoshipByDefault))return;let o=(u=t.payload.offer)==null?void 0:u.product.id,s=Tn(),i=((f=t.payload.offer)==null?void 0:f.location)||"",a=((w=t.payload.offer)==null?void 0:w.variationId)||"",c=Pn(o,e),p=[o,N.toLowerCase(),i,c,a].join(",");ma(o,s,p)}n(Cp,"addDefaultToSubTracking");function On(t){return e=>r=>{switch(e(r),r.type){case N:case q:case D:let o=r.payload.offer,s=wn(r);o&&!o.isCart&&ma(o.product.id,s[0],s[1]);break;case R:Cp(r,t);break;default:}}}n(On,"shopifyTrackingMiddleware");var xa,va,ba=((va=(xa=window.Shopify)==null?void 0:xa.routes)==null?void 0:va.root)||"/",Rp="/cart",Ap=`${ba}cart.js`,Np=`${ba}products/`,Ip='[id^="shopify-section-"][id$=__cart-items], [id^="shopify-section-"][id$="__cart-footer"],#cart-live-region-text,#cart-icon-bubble',_a=(0,ya.debounce)(100,!1,function(t,e){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")});async function kp(t,e){let r=qp(e);if(r)try{let s=await Ea(r);t.dispatch({type:J,payload:{product:s,offer:e}})}catch(s){console.warn("OG: Unable to fetch product details for PDP",s)}let o=e.closest("form");if(!o){let s=e.parentElement;for(;s&&(o=s.querySelector('form[action$="/cart/add"]'),!(o||s.tagName.toLowerCase()==="body"));)s=s.parentElement}o?(o.addEventListener("change",i=>_a(o,e)),new MutationObserver(()=>_a(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(kp,"setupPdp");var Sa=n(async()=>await(await fetch(Ap)).json(),"getCart");function qp(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(qp,"guessProductHandle");var Ea=(0,ga.default)(async t=>(await fetch(`${Np}${t}.js`)).json());async function Dp(t,e){let r=await Sa(),{items:o}=r;t.dispatch({type:le,payload:r});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(Ea))).forEach(a=>t.dispatch({type:J,payload:{product:a,offer:e}}))}n(Dp,"setupCart");async function Up(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=wn(t);if(!!(r==null?void 0:r.isCart))try{r.style.pointerEvents="none",r.style.opacity=".7";let c=Array.from(document.querySelectorAll(Ip)),l=t.payload.product.id,p=await Sa(),h=(i=p==null?void 0:p.items)==null?void 0:i.findIndex(y=>y.key===l),u=p.items[h],f=u.quantity,w=P(l),_=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:f,attributes:Object.fromEntries([s]),properties:u.properties,selling_plan:o||null,sections:c.map(y=>y.id.replace(/^shopify-section-/,""))})});if(_.status!==200)throw new Error("Cart not updated");let m=await _.json(),x=p.items.length===m.items.length?m.items[h].key:(a=m.items.find(y=>y.quantity===f&&y.product_id===w&&(!o&&!y.selling_plan_allocation||(y==null?void 0:y.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;x&&r.setAttribute("product",x),e.dispatch({type:le,payload:m});let C=new CustomEvent(Qn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(C),C.defaultPrevented)return;let b=m.sections;Object.values(b).length?c.forEach(y=>{let Rt=y.id.replace(/^shopify-section-/,"");if(!(Rt in b))return;let Ra=b[Rt],Rn=new DOMParser().parseFromString(Ra.toString()||"","text/html").getElementById(y.id);Rn&&(y.innerHTML=Rn.innerHTML)}):window.location.pathname.startsWith(Rp)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Up,"synchronizeCartOptin");function wn(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=Tn(),o=((a=t.payload.offer)==null?void 0:a.location)||"",s=((c=t.payload.offer)==null?void 0:c.variationId)||"",i=[e,t.type.toLowerCase(),o];switch(t.type){case Y:case q:i.push(""),i.push(s);break;case N:case D:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(wn,"getTrackingEvent");function Pn(t,e){var s;return(s=Xt({id:t})(e.getState()))==null?void 0:s.frequency}n(Pn,"getSubscribedFrequency");function Fp(t,e){e.isCart||[...document.querySelectorAll('form[action$="/cart/add"] [name=id]')].forEach(r=>{let o=r.value,s=Pn(o,t);gs(r.form,"selling_plan",s)})}n(Fp,"synchronizeSellingPlan");function Cn(t){return e=>r=>{var o;switch(r.type){case N:case q:case D:break;case Y:((o=r.payload.offer)==null?void 0:o.isCart)?Dp(t,r.payload.offer):kp(t,r.payload.offer);break;default:}switch(e(r),r.type){case N:case q:case D:Up(r,t);case te:case Y:case R:case J:Fp(t,r.payload.offer);break;default:}}}n(Cn,"shopifyMiddleware");dt();U();k();U();var Lp="/apps/subscriptions/auth/",Ta="og_auth_begin",Mp="og_auth_end",jp=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Oa({store:t}){var s;let[e]=Qr(),r=ft(),o=(r==null?void 0:r.dataset.customer)?jp(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await Vp(o);if(i){let[a,c,l]=i.split("|");t.dispatch(mt(e,a,Number(c),l))}}else hs("og_auth")}n(Oa,"authorizeShopifyCustomer");async function $p(t){try{let r=await(await fetch(`${Lp}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Ta);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Ta.length,r.lastIndexOf(Mp)))}catch(e){console.error(e)}}n($p,"fetchOGSignature");async function Vp(t){let e=ms("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await $p(t);if(!r)return"";let i=new Date,a=btoa(s);i.setTime(i.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${i.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(Vp,"getOrCreateAuthCookie");var Pa,wa=Gs(...((Pa=L)==null?void 0:Pa.shopify_selling_plans)?[vn,Cn]:[Ir],L.shopify&&On),T=Sn(wa),Hp=T.isReady,Gp=T.addOptinChangedCallback,Bp=T.addTemplate,zp=T.clear,Wp=T.config,Yp=T.disableOptinChangedCallbacks,Jp=T.getOptins,Qp=T.getProductsForPurchasePost,Kp=T.initialize,Zp=T.previewMode,Xp=T.register,eu=T.resolveSettings,tu=T.setAuthUrl,ru=T.setEnvironment,ou=T.setLocale,nu=T.setMerchantId,su=T.setPublicPath,iu=T.setTemplates,au=T.setupCart,cu=T.setupProduct,lu=T.setupProducts,pu=n(()=>fs(T),"autoInit");var uu=T.initialize,Ca;((Ca=L)==null?void 0:Ca.shopify_selling_plans)&&or(()=>Oa(T));return du;})();
939
939
  ; return lib; });
940
940
  //# sourceMappingURL=offers.js.map