@ordergroove/offers 2.23.1 → 2.24.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/build.js +5 -0
  3. package/dist/bundle-report.html +220 -63
  4. package/dist/examples.js +385 -1897
  5. package/dist/examples.js.map +7 -1
  6. package/dist/offers.js +251 -214
  7. package/dist/offers.js.map +7 -1
  8. package/examples/index.html +3 -0
  9. package/examples/index.js +4 -4
  10. package/karma-functional.conf.js +12 -10
  11. package/karma.conf.js +20 -10
  12. package/package.json +10 -15
  13. package/src/{_tests_ → __tests__}/offers.spec.js +3 -5
  14. package/src/__tests__/test-mode.spec.js +16 -0
  15. package/src/components/FrequencyStatus.js +2 -2
  16. package/src/components/IncentiveText.js +1 -1
  17. package/src/components/Offer.js +11 -14
  18. package/src/components/OptinButton.js +2 -5
  19. package/src/components/OptinSelect.js +2 -2
  20. package/src/components/OptinToggle.js +1 -4
  21. package/src/components/OptoutButton.js +1 -4
  22. package/src/components/SelectFrequency.js +4 -8
  23. package/src/components/UpsellButton.js +2 -5
  24. package/src/components/UpsellModal.js +6 -10
  25. package/src/components/__tests__/FrequencyStatus.spec.js +33 -38
  26. package/src/components/__tests__/IncentiveText.spec.js +1 -1
  27. package/src/components/__tests__/Modal.spec.js +1 -1
  28. package/src/components/__tests__/NextUpcomingOrder.spec.js +1 -1
  29. package/src/components/__tests__/Offer.spec.js +5 -7
  30. package/src/components/__tests__/OptinButton.spec.js +1 -1
  31. package/src/components/__tests__/OptinSelect.spec.js +1 -1
  32. package/src/components/__tests__/OptinStatus.spec.js +1 -1
  33. package/src/components/__tests__/Select.spec.js +1 -1
  34. package/src/components/__tests__/SelectFrequency.spec.js +17 -6
  35. package/src/components/__tests__/Text.spec.js +1 -1
  36. package/src/components/__tests__/Tooltip.spec.js +1 -1
  37. package/src/components/__tests__/UpsellButton.spec.js +4 -6
  38. package/src/components/__tests__/When.spec.js +1 -1
  39. package/src/core/__tests__/api.spec.js +10 -3
  40. package/src/core/__tests__/base.spec.js +8 -2
  41. package/src/core/__tests__/reducer.spec.js +1 -1
  42. package/src/core/actions.js +9 -6
  43. package/src/core/adapters.js +3 -3
  44. package/src/core/api.js +4 -1
  45. package/src/core/localStorage.js +1 -1
  46. package/src/core/middleware.js +9 -7
  47. package/src/core/selectors.js +19 -33
  48. package/src/index.js +1 -4
  49. package/src/init-func-tests.js +1 -2
  50. package/src/init-test.js +3 -0
  51. package/src/test-mode.js +5 -3
  52. package/dist/index.html +0 -125
  53. package/dist/offers-preview-mode.bundle.js +0 -2
  54. package/dist/offers-preview-mode.bundle.js.map +0 -1
  55. package/dist/offers-test-mode.bundle.js +0 -100
  56. package/dist/offers-test-mode.bundle.js.map +0 -1
  57. package/src/_tests_/test-mode.spec.js +0 -15
  58. package/webpack.config.js +0 -43
package/dist/offers.js CHANGED
@@ -1,150 +1,17 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.offers=e():(t.og=t.og||{},t.og.offers=e())}(window,(function(){return function(t){function e(e){for(var r,o,i=e[0],s=e[1],a=0,u=[];a<i.length;a++)o=i[a],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&u.push(n[o][0]),n[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r]);for(c&&c(e);u.length;)u.shift()()}var r={},n={1:0};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(t){var e=[],r=n[t];if(0!==r)if(r)e.push(r[2]);else{var i=new Promise((function(e,o){r=n[t]=[e,o]}));e.push(r[2]=i);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(t){return o.p+""+({2:"offers-preview-mode",3:"offers-test-mode"}[t]||t)+".bundle.js"}(t);var c=new Error;s=function(e){a.onerror=a.onload=null,clearTimeout(u);var r=n[t];if(0!==r){if(r){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",c.name="ChunkLoadError",c.type=o,c.request=i,r[1](c)}n[t]=void 0}};var u=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(e)},o.m=t,o.c=r,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonp=window.webpackJsonp||[],s=i.push.bind(i);i.push=e,i=i.slice();for(var a=0;a<i.length;a++)e(i[a]);var c=s;return o(o.s=29)}([function(t,e,r){"use strict";r.d(e,"k",(function(){return n})),r.d(e,"l",(function(){return o})),r.d(e,"m",(function(){return i})),r.d(e,"E",(function(){return s})),r.d(e,"v",(function(){return a})),r.d(e,"p",(function(){return c})),r.d(e,"n",(function(){return u})),r.d(e,"f",(function(){return l})),r.d(e,"x",(function(){return d})),r.d(e,"s",(function(){return p})),r.d(e,"b",(function(){return f})),r.d(e,"J",(function(){return h})),r.d(e,"w",(function(){return g})),r.d(e,"q",(function(){return y})),r.d(e,"r",(function(){return m})),r.d(e,"h",(function(){return b})),r.d(e,"B",(function(){return v})),r.d(e,"z",(function(){return _})),r.d(e,"A",(function(){return w})),r.d(e,"d",(function(){return O})),r.d(e,"u",(function(){return S})),r.d(e,"g",(function(){return x})),r.d(e,"t",(function(){return E})),r.d(e,"e",(function(){return T})),r.d(e,"c",(function(){return C})),r.d(e,"o",(function(){return P})),r.d(e,"D",(function(){return k})),r.d(e,"y",(function(){return j})),r.d(e,"F",(function(){return q})),r.d(e,"G",(function(){return A})),r.d(e,"a",(function(){return N})),r.d(e,"I",(function(){return I})),r.d(e,"i",(function(){return R})),r.d(e,"j",(function(){return F})),r.d(e,"C",(function(){return L})),r.d(e,"H",(function(){return U}));const n="OPTIN_PRODUCT",o="OPTOUT_PRODUCT",i="PRODUCT_CHANGE_FREQUENCY",s="SET_MERCHANT_ID",a="REQUEST_OFFER",c="RECEIVE_OFFER",u="PRODUCT_HAS_CHANGED",l="CREATED_SESSION_ID",d="SET_AUTH_URL",p="REQUEST_AUTH",f="AUTHORIZE",h="UNAUTHORIZED",g="REQUEST_ORDERS",y="RECEIVE_ORDERS",m="RECEIVE_ORDER_ITEMS",b="FETCH_RESPONSE_ERROR",v="SET_ENVIRONMENT_STAGING",_="SET_ENVIRONMENT_DEV",w="SET_ENVIRONMENT_PROD",O="CONCLUDE_UPSELL",S="REQUEST_CREATE_IU_ORDER",x="CREATE_ONE_TIME",E="REQUEST_CONVERT_ONE_TIME",T="CONVERT_ONE_TIME",C="CHECKOUT",P="RECEIVE_FETCH",k="SET_LOCALE",j="SET_CONFIG",q="SET_PREVIEW_STANDARD_OFFER",A="SET_PREVIEW_UPSELL_OFFER",N="ADD_TEMPLATE",I="SET_TEMPLATES",R="LOCAL_STORAGE_CHANGE",F="LOCAL_STORAGE_CLEAR",L="SET_FIRST_ORDER_PLACE_DATE",U="SET_PRODUCT_TO_SUBSCRIBE"},function(t,e,r){"use strict";
2
- /**
3
- * @license
4
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
5
- * This code may only be used under the BSD style license found at
6
- * http://polymer.github.io/LICENSE.txt
7
- * The complete set of authors may be found at
8
- * http://polymer.github.io/AUTHORS.txt
9
- * The complete set of contributors may be found at
10
- * http://polymer.github.io/CONTRIBUTORS.txt
11
- * Code distributed by Google as part of the polymer project is also
12
- * subject to an additional IP rights grant found at
13
- * http://polymer.github.io/PATENTS.txt
14
- */const n="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,o=(t,e,r=null)=>{for(;e!==r;){const r=e.nextSibling;t.removeChild(e),e=r}},i=`{{lit-${String(Math.random()).slice(2)}}}`,s=`\x3c!--${i}--\x3e`,a=new RegExp(`${i}|${s}`);class c{constructor(t,e){this.parts=[],this.element=e;const r=[],n=[],o=document.createTreeWalker(e.content,133,null,!1);let s=0,c=-1,l=0;const{strings:f,values:{length:h}}=t;for(;l<h;){const t=o.nextNode();if(null!==t){if(c++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:r}=e;let n=0;for(let t=0;t<r;t++)u(e[t].name,"$lit$")&&n++;for(;n-- >0;){const e=f[l],r=p.exec(e)[2],n=r.toLowerCase()+"$lit$",o=t.getAttribute(n);t.removeAttribute(n);const i=o.split(a);this.parts.push({type:"attribute",index:c,name:r,strings:i}),l+=i.length-1}}"TEMPLATE"===t.tagName&&(n.push(t),o.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(i)>=0){const n=t.parentNode,o=e.split(a),i=o.length-1;for(let e=0;e<i;e++){let r,i=o[e];if(""===i)r=d();else{const t=p.exec(i);null!==t&&u(t[2],"$lit$")&&(i=i.slice(0,t.index)+t[1]+t[2].slice(0,-"$lit$".length)+t[3]),r=document.createTextNode(i)}n.insertBefore(r,t),this.parts.push({type:"node",index:++c})}""===o[i]?(n.insertBefore(d(),t),r.push(t)):t.data=o[i],l+=i}}else if(8===t.nodeType)if(t.data===i){const e=t.parentNode;null!==t.previousSibling&&c!==s||(c++,e.insertBefore(d(),t)),s=c,this.parts.push({type:"node",index:c}),null===t.nextSibling?t.data="":(r.push(t),c--),l++}else{let e=-1;for(;-1!==(e=t.data.indexOf(i,e+1));)this.parts.push({type:"node",index:-1}),l++}}else o.currentNode=n.pop()}for(const t of r)t.parentNode.removeChild(t)}}const u=(t,e)=>{const r=t.length-e.length;return r>=0&&t.slice(r)===e},l=t=>-1!==t.index,d=()=>document.createComment(""),p=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function f(t,e){const{element:{content:r},parts:n}=t,o=document.createTreeWalker(r,133,null,!1);let i=g(n),s=n[i],a=-1,c=0;const u=[];let l=null;for(;o.nextNode();){a++;const t=o.currentNode;for(t.previousSibling===l&&(l=null),e.has(t)&&(u.push(t),null===l&&(l=t)),null!==l&&c++;void 0!==s&&s.index===a;)s.index=null!==l?-1:s.index-c,i=g(n,i),s=n[i]}u.forEach(t=>t.parentNode.removeChild(t))}const h=t=>{let e=11===t.nodeType?0:1;const r=document.createTreeWalker(t,133,null,!1);for(;r.nextNode();)e++;return e},g=(t,e=-1)=>{for(let r=e+1;r<t.length;r++){const e=t[r];if(l(e))return r}return-1};
15
- /**
16
- * @license
17
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
18
- * This code may only be used under the BSD style license found at
19
- * http://polymer.github.io/LICENSE.txt
20
- * The complete set of authors may be found at
21
- * http://polymer.github.io/AUTHORS.txt
22
- * The complete set of contributors may be found at
23
- * http://polymer.github.io/CONTRIBUTORS.txt
24
- * Code distributed by Google as part of the polymer project is also
25
- * subject to an additional IP rights grant found at
26
- * http://polymer.github.io/PATENTS.txt
27
- */
28
- const y=new WeakMap,m=t=>"function"==typeof t&&y.has(t),b={},v={};
29
- /**
30
- * @license
31
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
32
- * This code may only be used under the BSD style license found at
33
- * http://polymer.github.io/LICENSE.txt
34
- * The complete set of authors may be found at
35
- * http://polymer.github.io/AUTHORS.txt
36
- * The complete set of contributors may be found at
37
- * http://polymer.github.io/CONTRIBUTORS.txt
38
- * Code distributed by Google as part of the polymer project is also
39
- * subject to an additional IP rights grant found at
40
- * http://polymer.github.io/PATENTS.txt
41
- */
42
- class _{constructor(t,e,r){this.__parts=[],this.template=t,this.processor=e,this.options=r}update(t){let e=0;for(const r of this.__parts)void 0!==r&&r.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=n?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],r=this.template.parts,o=document.createTreeWalker(t,133,null,!1);let i,s=0,a=0,c=o.nextNode();for(;s<r.length;)if(i=r[s],l(i)){for(;a<i.index;)a++,"TEMPLATE"===c.nodeName&&(e.push(c),o.currentNode=c.content),null===(c=o.nextNode())&&(o.currentNode=e.pop(),c=o.nextNode());if("node"===i.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(c.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(c,i.name,i.strings,this.options));s++}else this.__parts.push(void 0),s++;return n&&(document.adoptNode(t),customElements.upgrade(t)),t}}
43
- /**
44
- * @license
45
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
46
- * This code may only be used under the BSD style license found at
47
- * http://polymer.github.io/LICENSE.txt
48
- * The complete set of authors may be found at
49
- * http://polymer.github.io/AUTHORS.txt
50
- * The complete set of contributors may be found at
51
- * http://polymer.github.io/CONTRIBUTORS.txt
52
- * Code distributed by Google as part of the polymer project is also
53
- * subject to an additional IP rights grant found at
54
- * http://polymer.github.io/PATENTS.txt
55
- */const w=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),O=` ${i} `;class S{constructor(t,e,r,n){this.strings=t,this.values=e,this.type=r,this.processor=n}getHTML(){const t=this.strings.length-1;let e="",r=!1;for(let n=0;n<t;n++){const t=this.strings[n],o=t.lastIndexOf("\x3c!--");r=(o>-1||r)&&-1===t.indexOf("--\x3e",o+1);const a=p.exec(t);e+=null===a?t+(r?O:s):t.substr(0,a.index)+a[1]+a[2]+"$lit$"+a[3]+i}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==w&&(e=w.createHTML(e)),t.innerHTML=e,t}}
56
- /**
57
- * @license
58
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
59
- * This code may only be used under the BSD style license found at
60
- * http://polymer.github.io/LICENSE.txt
61
- * The complete set of authors may be found at
62
- * http://polymer.github.io/AUTHORS.txt
63
- * The complete set of contributors may be found at
64
- * http://polymer.github.io/CONTRIBUTORS.txt
65
- * Code distributed by Google as part of the polymer project is also
66
- * subject to an additional IP rights grant found at
67
- * http://polymer.github.io/PATENTS.txt
68
- */
69
- const x=t=>null===t||!("object"==typeof t||"function"==typeof t),E=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class T{constructor(t,e,r){this.dirty=!0,this.element=t,this.name=e,this.strings=r,this.parts=[];for(let t=0;t<r.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new C(this)}_getValue(){const t=this.strings,e=t.length-1,r=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=r[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!E(t))return t}let n="";for(let o=0;o<e;o++){n+=t[o];const e=r[o];if(void 0!==e){const t=e.value;if(x(t)||!E(t))n+="string"==typeof t?t:String(t);else for(const e of t)n+="string"==typeof e?e:String(e)}}return n+=t[e],n}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class C{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===b||x(t)&&t===this.value||(this.value=t,m(t)||(this.committer.dirty=!0))}commit(){for(;m(this.value);){const t=this.value;this.value=b,t(this)}this.value!==b&&this.committer.commit()}}class P{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(d()),this.endNode=t.appendChild(d())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=d()),t.__insert(this.endNode=d())}insertAfterPart(t){t.__insert(this.startNode=d()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=b,t(this)}const t=this.__pendingValue;t!==b&&(x(t)?t!==this.value&&this.__commitText(t):t instanceof S?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):E(t)?this.__commitIterable(t):t===v?(this.value=v,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,r="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=r:this.__commitNode(document.createTextNode(r)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof _&&this.value.template===e)this.value.update(t.values);else{const r=new _(e,t.processor,this.options),n=r._clone();r.update(t.values),this.__commitNode(n),this.value=r}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let r,n=0;for(const o of t)r=e[n],void 0===r&&(r=new P(this.options),e.push(r),0===n?r.appendIntoPart(this):r.insertAfterPart(e[n-1])),r.setValue(o),r.commit(),n++;n<e.length&&(e.length=n,this.clear(r&&r.endNode))}clear(t=this.startNode){o(this.startNode.parentNode,t.nextSibling,this.endNode)}}class k{constructor(t,e,r){if(this.value=void 0,this.__pendingValue=void 0,2!==r.length||""!==r[0]||""!==r[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=r}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=b,t(this)}if(this.__pendingValue===b)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=b}}class j extends T{constructor(t,e,r){super(t,e,r),this.single=2===r.length&&""===r[0]&&""===r[1]}_createPart(){return new q(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class q extends C{}let A=!1;(()=>{try{const t={get capture(){return A=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class N{constructor(t,e,r){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=r,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;m(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=b,t(this)}if(this.__pendingValue===b)return;const t=this.__pendingValue,e=this.value,r=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),n=null!=t&&(null==e||r);r&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),n&&(this.__options=I(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=b}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const I=t=>t&&(A?{capture:t.capture,passive:t.passive,once:t.once}:t.capture)
70
- /**
71
- * @license
72
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
73
- * This code may only be used under the BSD style license found at
74
- * http://polymer.github.io/LICENSE.txt
75
- * The complete set of authors may be found at
76
- * http://polymer.github.io/AUTHORS.txt
77
- * The complete set of contributors may be found at
78
- * http://polymer.github.io/CONTRIBUTORS.txt
79
- * Code distributed by Google as part of the polymer project is also
80
- * subject to an additional IP rights grant found at
81
- * http://polymer.github.io/PATENTS.txt
82
- */;function R(t){let e=F.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},F.set(t.type,e));let r=e.stringsArray.get(t.strings);if(void 0!==r)return r;const n=t.strings.join(i);return r=e.keyString.get(n),void 0===r&&(r=new c(t,t.getTemplateElement()),e.keyString.set(n,r)),e.stringsArray.set(t.strings,r),r}const F=new Map,L=new WeakMap;
83
- /**
84
- * @license
85
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
86
- * This code may only be used under the BSD style license found at
87
- * http://polymer.github.io/LICENSE.txt
88
- * The complete set of authors may be found at
89
- * http://polymer.github.io/AUTHORS.txt
90
- * The complete set of contributors may be found at
91
- * http://polymer.github.io/CONTRIBUTORS.txt
92
- * Code distributed by Google as part of the polymer project is also
93
- * subject to an additional IP rights grant found at
94
- * http://polymer.github.io/PATENTS.txt
95
- */const U=new
96
- /**
97
- * @license
98
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
99
- * This code may only be used under the BSD style license found at
100
- * http://polymer.github.io/LICENSE.txt
101
- * The complete set of authors may be found at
102
- * http://polymer.github.io/AUTHORS.txt
103
- * The complete set of contributors may be found at
104
- * http://polymer.github.io/CONTRIBUTORS.txt
105
- * Code distributed by Google as part of the polymer project is also
106
- * subject to an additional IP rights grant found at
107
- * http://polymer.github.io/PATENTS.txt
108
- */
109
- class{handleAttributeExpressions(t,e,r,n){const o=e[0];if("."===o){return new j(t,e.slice(1),r).parts}return"@"===o?[new N(t,e.slice(1),n.eventContext)]:"?"===o?[new k(t,e.slice(1),r)]:new T(t,e,r).parts}handleTextExpression(t){return new P(t)}};
110
- /**
111
- * @license
112
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
113
- * This code may only be used under the BSD style license found at
114
- * http://polymer.github.io/LICENSE.txt
115
- * The complete set of authors may be found at
116
- * http://polymer.github.io/AUTHORS.txt
117
- * The complete set of contributors may be found at
118
- * http://polymer.github.io/CONTRIBUTORS.txt
119
- * Code distributed by Google as part of the polymer project is also
120
- * subject to an additional IP rights grant found at
121
- * http://polymer.github.io/PATENTS.txt
122
- */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");const D=(t,...e)=>new S(t,e,"html",U),M=(t,e)=>`${t}--${e}`;let $=!0;void 0===window.ShadyCSS?$=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),$=!1);const B=t=>e=>{const r=M(e.type,t);let n=F.get(r);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},F.set(r,n));let o=n.stringsArray.get(e.strings);if(void 0!==o)return o;const s=e.strings.join(i);if(o=n.keyString.get(s),void 0===o){const r=e.getTemplateElement();$&&window.ShadyCSS.prepareTemplateDom(r,t),o=new c(e,r),n.keyString.set(s,o)}return n.stringsArray.set(e.strings,o),o},V=["html","svg"],z=new Set,H=(t,e,r)=>{z.add(t);const n=r?r.element:document.createElement("template"),o=e.querySelectorAll("style"),{length:i}=o;if(0===i)return void window.ShadyCSS.prepareTemplateStyles(n,t);const s=document.createElement("style");for(let t=0;t<i;t++){const e=o[t];e.parentNode.removeChild(e),s.textContent+=e.textContent}(t=>{V.forEach(e=>{const r=F.get(M(e,t));void 0!==r&&r.keyString.forEach(t=>{const{element:{content:e}}=t,r=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{r.add(t)}),f(t,r)})})})(t);const a=n.content;r?function(t,e,r=null){const{element:{content:n},parts:o}=t;if(null==r)return void n.appendChild(e);const i=document.createTreeWalker(n,133,null,!1);let s=g(o),a=0,c=-1;for(;i.nextNode();){for(c++,i.currentNode===r&&(a=h(e),r.parentNode.insertBefore(e,r));-1!==s&&o[s].index===c;){if(a>0){for(;-1!==s;)o[s].index+=a,s=g(o,s);return}s=g(o,s)}}}(r,s,a.firstChild):a.insertBefore(s,a.firstChild),window.ShadyCSS.prepareTemplateStyles(n,t);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)e.insertBefore(c.cloneNode(!0),e.firstChild);else if(r){a.insertBefore(s,a.firstChild);const t=new Set;t.add(s),f(r,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const J={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},G=(t,e)=>e!==t&&(e==e||t==t),Y={attribute:!0,type:String,converter:J,reflect:!1,hasChanged:G};class W extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,r)=>{const n=this._attributeNameForProperty(r,e);void 0!==n&&(this._attributeToPropertyMap.set(n,r),t.push(n))}),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}}static createProperty(t,e=Y){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const r="symbol"==typeof t?Symbol():`__${t}`,n=this.getPropertyDescriptor(t,r,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}static getPropertyDescriptor(t,e,r){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdateInternal(t,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||Y}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const r of e)this.createProperty(r,t[r])}}static _attributeNameForProperty(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,r=G){return r(t,e)}static _propertyValueFromAttribute(t,e){const r=e.type,n=e.converter||J,o="function"==typeof n?n:n.fromAttribute;return o?o(t,r):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const r=e.type,n=e.converter;return(n&&n.toAttribute||J.toAttribute)(t,r)}initialize(){this._updateState=0,this._updatePromise=new Promise(t=>this._enableUpdatingResolver=t),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}})}_applyInstanceProperties(){this._instanceProperties.forEach((t,e)=>this[e]=t),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,r){e!==r&&this._attributeToProperty(t,r)}_propertyToAttribute(t,e,r=Y){const n=this.constructor,o=n._attributeNameForProperty(t,r);if(void 0!==o){const t=n._propertyValueToAttribute(e,r);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(o):this.setAttribute(o,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const r=this.constructor,n=r._attributeToPropertyMap.get(t);if(void 0!==n){const t=r.getPropertyOptions(n);this._updateState=16|this._updateState,this[n]=r._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,r){let n=!0;if(void 0!==t){const o=this.constructor;r=r||o.getPropertyOptions(t),o._valueHasChanged(this[t],e,r.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,r))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(t,e){return this.requestUpdateInternal(t,e),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(t){}const t=this.performUpdate();return null!=t&&await t,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{t=this.shouldUpdate(e),t?this.update(e):this._markUpdated()}catch(e){throw t=!1,this._markUpdated(),e}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((t,e)=>this._propertyToAttribute(e,this[e],t)),this._reflectingProperties=void 0),this._markUpdated()}updated(t){}firstUpdated(t){}}W.finalized=!0;const Z=Element.prototype;Z.msMatchesSelector||Z.webkitMatchesSelector;
123
- /**
124
- @license
125
- Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
126
- This code may only be used under the BSD style license found at
127
- http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
128
- http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
129
- found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
130
- part of the polymer project is also subject to an additional IP rights grant
131
- found at http://polymer.github.io/PATENTS.txt
132
- */
133
- const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol();class X{constructor(t,e){if(e!==K)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(Q?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const tt=(t,...e)=>{const r=e.reduce((e,r,n)=>e+(t=>{if(t instanceof X)return t.cssText;if("number"==typeof t)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\n take care to ensure page security.`)})(r)+t[n+1],t[0]);return new X(r,K)};r.d(e,"a",(function(){return rt})),r.d(e,"c",(function(){return D})),r.d(e,"b",(function(){return tt})),
134
- /**
135
- * @license
136
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
137
- * This code may only be used under the BSD style license found at
138
- * http://polymer.github.io/LICENSE.txt
139
- * The complete set of authors may be found at
140
- * http://polymer.github.io/AUTHORS.txt
141
- * The complete set of contributors may be found at
142
- * http://polymer.github.io/CONTRIBUTORS.txt
143
- * Code distributed by Google as part of the polymer project is also
144
- * subject to an additional IP rights grant found at
145
- * http://polymer.github.io/PATENTS.txt
146
- */
147
- (window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const et={};class rt extends W{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,r)=>t.reduceRight((t,r)=>Array.isArray(r)?e(r,t):(t.add(r),t),r),r=e(t,new Set),n=[];r.forEach(t=>n.unshift(t)),this._styles=n}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!Q){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return new X(String(e),K)}return t})}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(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Q?this.renderRoot.adoptedStyleSheets=t.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==et&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return et}}rt.finalized=!0,rt.render=(t,e,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const n=r.scopeName,i=L.has(e),s=$&&11===e.nodeType&&!!e.host,a=s&&!z.has(n),c=a?document.createDocumentFragment():e;if(((t,e,r)=>{let n=L.get(e);void 0===n&&(o(e,e.firstChild),L.set(e,n=new P(Object.assign({templateFactory:R},r))),n.appendInto(e)),n.setValue(t),n.commit()})(t,c,Object.assign({templateFactory:B(n)},r)),a){const t=L.get(c);L.delete(c);const r=t.value instanceof _?t.value.template:void 0;H(n,c,r),o(e,e.firstChild),e.appendChild(c),L.set(e,t)}!i&&s&&window.ShadyCSS.styleElement(e.host)}},function(t,e,r){"use strict";function n(t,e){return t===e}function o(t,e,r){if(null===e||null===r||e.length!==r.length)return!1;for(var n=e.length,o=0;o<n;o++)if(!t(e[o],r[o]))return!1;return!0}function i(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every((function(t){return"function"==typeof t}))){var r=e.map((function(t){return typeof t})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return e}var s=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];var s=0,a=n.pop(),c=i(n),u=t.apply(void 0,[function(){return s++,a.apply(null,arguments)}].concat(r)),l=t((function(){for(var t=[],e=c.length,r=0;r<e;r++)t.push(c[r].apply(null,arguments));return u.apply(null,t)}));return l.resultFunc=a,l.dependencies=c,l.recomputations=function(){return s},l.resetRecomputations=function(){return s=0},l}}((function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=null,i=null;return function(){return o(e,r,arguments)||(i=t.apply(null,arguments)),r=arguments,i}}));var a=r(7),c=r.n(a),u=r(5);r.d(e,"c",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"a",(function(){return f})),r.d(e,"e",(function(){return g})),r.d(e,"i",(function(){return y})),r.d(e,"f",(function(){return m})),r.d(e,"h",(function(){return b})),r.d(e,"g",(function(){return v})),r.d(e,"d",(function(){return _})),r.d(e,"b",(function(){return w})),r.d(e,"k",(function(){return O})),c.a.Cache=Map;const l=(t,e)=>{if(t===e)return!0;if("object"==typeof t&&"object"==typeof e&&t&&e&&t.id===e.id){if(!Array.isArray(t.components)||!Array.isArray(e.components))return!0;if(function(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}((t.components||[]).sort(),(e.components||[]).sort()))return!0}return!1},d=t=>t.optedin||[],p=t=>t.optedout||[],f=t=>t.autoshipByDefault||{},h=t=>t.defaultFrequencies||{},g=c()(t=>s(d,p,f,(e,r,n)=>{const o=e.find(e=>l(t,e));return o||!r.find(e=>l(t,e))&&(!(!t||!n[t.id])&&{id:t.id})}),t=>JSON.stringify(t)),y=c()(t=>s(d,e=>{const r=e.find(e=>l(t,e));return r||!1}),t=>JSON.stringify(t)),m=c()(t=>s(p,e=>e.find(e=>l(t,e)))),b=c()(t=>s(g(t),t=>t&&t.frequency||null)),v=c()(t=>s(h,e=>e[t]&&Object(u.stringifyFrequency)(e[t])||null)),_=t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),w=(t,e,r,n)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(_(r))&&e[r]||e.offer&&typeof("undefined"!==e.offer[r])&&e.offer[r]||t.config&&t.config[r]||n}),O=t=>({templates:t.templates||[]})},function(t,e,r){"use strict";r.r(e),r.d(e,"optinProduct",(function(){return s})),r.d(e,"optoutProduct",(function(){return a})),r.d(e,"productHasChangedComponents",(function(){return c})),r.d(e,"productChangeFrequency",(function(){return u})),r.d(e,"concludeUpsell",(function(){return l})),r.d(e,"setMerchantId",(function(){return d})),r.d(e,"createSessionId",(function(){return p})),r.d(e,"requestAuth",(function(){return f})),r.d(e,"authorize",(function(){return h})),r.d(e,"unauthorized",(function(){return g})),r.d(e,"setAuthUrl",(function(){return y})),r.d(e,"fetchDone",(function(){return m})),r.d(e,"fetchAuth",(function(){return b})),r.d(e,"requestOrders",(function(){return v})),r.d(e,"receiveOrders",(function(){return _})),r.d(e,"receiveItems",(function(){return w})),r.d(e,"fetchOrders",(function(){return O})),r.d(e,"setEnvironment",(function(){return S})),r.d(e,"requestSessionId",(function(){return x})),r.d(e,"receiveOffer",(function(){return E})),r.d(e,"fetchResponseError",(function(){return T})),r.d(e,"requestOffer",(function(){return C})),r.d(e,"fetchOffer",(function(){return P})),r.d(e,"checkout",(function(){return k})),r.d(e,"requestCreateOneTime",(function(){return j})),r.d(e,"receiveCreateOneTime",(function(){return q})),r.d(e,"requestConvertOneTimeToSubscription",(function(){return A})),r.d(e,"receiveConvertOneTime",(function(){return N})),r.d(e,"createIu",(function(){return I})),r.d(e,"setLocale",(function(){return R})),r.d(e,"setConfig",(function(){return F})),r.d(e,"addTemplate",(function(){return L})),r.d(e,"setTemplates",(function(){return U})),r.d(e,"setFirstOrderPlaceDate",(function(){return D})),r.d(e,"setProductToSubscribe",(function(){return M}));var n=r(15),o=r(0),i=r(5);const s=(t,e)=>({type:o.k,payload:{product:t,frequency:e}}),a=t=>({type:o.l,payload:{product:t}}),c=(t,e)=>({type:o.n,payload:{newProduct:t,product:e}}),u=(t,e)=>({type:o.m,payload:{product:t,frequency:e}}),l=t=>({type:o.d,payload:{product:t}}),d=t=>({type:o.E,payload:t}),p=t=>({type:o.f,payload:`${t}.${Math.floor(999999*Math.random())}.${Math.round((new Date).getTime()/1e3)}`}),f=t=>({type:o.s,payload:t}),h=(t,e,r,n)=>({type:o.b,payload:{public_id:t,sig_field:e,ts:r,sig:n}}),g=t=>({type:o.J,payload:t}),y=t=>({type:o.x,payload:t}),m=t=>({type:o.o,payload:t}),b=(t=n.resolveAuth)=>function(e,r){if(window.og&&window.og.previewMode)return e(g({message:"Offers are running in preview mode"}));const{merchantId:n,authUrl:o}=r(),i=f(o);return e(i),t(o).then(({sig_field:t,ts:r,sig:o})=>e(h(n,t,r,o)),t=>e(g(t))).finally(()=>e(m(i)))},v=(t,e)=>({type:o.w,payload:{status:t,ordering:e}}),_=t=>({type:o.q,payload:t}),w=t=>({type:o.r,payload:t}),O=(t=1,e="place")=>function(r,n){const{environment:{legoUrl:o},auth:s}=n();if(!s)return r(g("No auth set."));const a=v(t,e);return r(a),i.api.fetchOrders(o,s,t,e).then(t=>{r(_(t));const e=(t.results[0]||{}).public_id;return e?i.api.fetchItems(o,s,e).then(t=>r(w(t))):null},t=>r(g(t))).finally(()=>r(m(a)))},S=t=>{switch(t){case"dev":return{type:o.z,payload:t};case"staging":return{type:o.B,payload:t};case"prod":return{type:o.A,payload:t};default:throw new Error(`${t} is not a supported environment`)}},x=()=>(t,e)=>{const{merchantId:r,sessionId:n}=e();return(!n||r&&!n.startsWith(r))&&t(p(r)),n},E=t=>({type:o.p,payload:t}),T=t=>({type:o.h,payload:t}),C=(t,e="pdp")=>({type:o.v,payload:{product:t,module:e}}),P=(t,e="pdp")=>function(r,n){const{merchantId:o,sessionId:s,environment:{apiUrl:a}}=n(),c=C(t,e);return r(c),i.api.fetchOffer(a,o,s,t,e).then(t=>r(E(t)),t=>r(T(t))).finally(()=>r(m(c)))},k=()=>({type:o.c}),j=(t,e,r,n)=>({type:o.u,payload:{product:t,order:e,quantity:r,offerId:n}}),q=t=>({type:o.g,payload:t}),A=(t,e)=>({type:o.t,payload:{item:t,frequency:e}}),N=(t,e)=>({type:o.e,payload:{response:t,product:e}}),I=(t,e,r,n=!1,o=null)=>function(s,a){const{auth:c,environment:{legoUrl:u},previewUpsellOffer:l,offerId:d}=a();if(!c)return s(g("No auth set."));const p=j(t,e,r,d);return s(p),(l?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:d}):i.api.createOneTime(u,c,t.id,e,r,d)).then(e=>(s(q(e)),n?(s(A(e,o)),(l?Promise.resolve({item:e,frequency:o}):i.api.convertOneTimeToSubscription(u,c,e,o,d)).then(e=>s(N(e,t)),t=>s(T(t)))):e),t=>s(T(t))).finally(()=>s(m(p)))},R=t=>({type:o.D,payload:t}),F=t=>({type:o.y,payload:t}),L=(t,e,r)=>({type:o.a,payload:{selector:t,markup:e,config:r}}),U=t=>({type:o.I,payload:t}),D=(t,e)=>({type:o.C,payload:{product:t,firstOrderPlaceDate:e}}),M=(t,e)=>({type:o.H,payload:{product:t,productToSubscribe:e}})},function(t,e,r){"use strict";r.r(e),r.d(e,"resolveStore",(function(){return s})),r.d(e,"createRecalcProps",(function(){return a})),r.d(e,"connect",(function(){return c})),r.d(e,"setStore",(function(){return u})),r.d(e,"unsetStore",(function(){return l}));var n=r(12);let o=null;const i=t=>({dispatch:t}),s=t=>{if(!o)throw new Error("Missing redux store.");return o},a=(t,e)=>r=>{const{getState:n,dispatch:o}=s(r),i=t?t(n(),r):{},a=e(o,r);Object.assign(r,i,a)},c=(t,e=i)=>r=>{const i=a(t,"function"==typeof e?e:t=>Object(n.b)(e,t));return class extends r{get store(){return o}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=s(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(t,e,r){super.attributeChangedCallback&&super.attributeChangedCallback(t,e,r),this._storeUnsubscribe&&e!==r&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},u=t=>{o=t},l=()=>{o=void 0};e.default=c},function(t,e,r){"use strict";r.r(e),r.d(e,"withFetchJson",(function(){return s})),r.d(e,"withHost",(function(){return a})),r.d(e,"withAuth",(function(){return c})),r.d(e,"withJsonBody",(function(){return u})),r.d(e,"toQuery",(function(){return l})),r.d(e,"toProductId",(function(){return d})),r.d(e,"fetchOffer",(function(){return p})),r.d(e,"fetchOrders",(function(){return f})),r.d(e,"fetchItems",(function(){return h})),r.d(e,"createOneTime",(function(){return g})),r.d(e,"parseFrequency",(function(){return y})),r.d(e,"isFrequencyValid",(function(){return m})),r.d(e,"compareFrequencies",(function(){return b})),r.d(e,"parseFrequenciesList",(function(){return v})),r.d(e,"stringifyFrequencies",(function(){return _})),r.d(e,"stringifyFrequency",(function(){return w})),r.d(e,"convertOneTimeToSubscription",(function(){return O})),r.d(e,"api",(function(){return S}));var n=r(7),o=r.n(n);const i=(...t)=>JSON.stringify(t),s=t=>(...e)=>fetch(...t(...e)).then(t=>t.json()),a=t=>(e,...r)=>{if(!e)throw Error("host required");const[n,o={}]=t(...r);return[`${e.replace(/\/+$/,"")}${n}`,o]},c=t=>(e,...r)=>{if(!e)throw Error("auth required");const[n,o={}]=t(...r);return[n,{...o,headers:{Authorization:JSON.stringify(e),...o.headers}}]},u=t=>(...e)=>{const[r,n={}]=t(...e);return[r,{method:"POST",...n,body:JSON.stringify(n.body),headers:{"Content-type":"application/json",...n.headers}}]},l=(t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([t,e])=>[t,encodeURIComponent(e)].join("=")).join("&"),d=t=>JSON.stringify([].concat(t).map(t=>"object"==typeof t?t.id:t).filter(t=>t)),p=o()(s(a((t,e,r,n="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");return[`/offer/${t}/${n}?${l([["session_id",e],["page_type",1],["p",d(r)],["module_view",JSON.stringify(["regular"])]])}`]})),i),f=o()(s(a(c((t=1,e="place")=>[`/orders/?${l([["status",t],["ordering",e]])}`]))),i),h=o()(s(a(c(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),i),g=s(a(c(u((t,e,r,n)=>{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(!n)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:n}}]})))),y=t=>{if("object"==typeof t)return{...t};const[e,r]=(t||"").split(/_/).map(t=>parseInt(t,10));return e&&r&&{every:e,every_period:r}},m=t=>t.match(/^\d+_\d$/),b=(t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),v=t=>[...new Set(t&&t.split(/\s+/))].filter(m).sort(b),_=t=>null==t?t:t.join(" "),w=t=>{if("object"==typeof t){const{every:e,period:r,every_period:n}=t;return`${e}_${r||n}`}return"string"==typeof t?t:""},O=s(a(c(u((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");const n=y(e);if(!n)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...n}}]})))),S={fetchOffer:p,fetchOrders:f,fetchItems:h,createOneTime:g,convertOneTimeToSubscription:O};e.default=S},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"b",(function(){return a}));r(1);const n=t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},o=t=>{let e=n(t);if(!e){const r=t.offer;r&&(e=n(r))}return e},i=t=>class extends t{get offer(){return(t=>{let e=t;for(;e;){if("OG-OFFER"===e.tagName)return e;e=11===e.nodeType?e.host:e.parentNode}})(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()}},s=t=>class extends(i(t)){get product(){return o(this)}},a=t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){const t=[];let e=null;this.querySelectorAll("option").forEach(r=>{const n=(t=>{const e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t})(r.value),o=r.innerText.trim();t.push({value:n,text:o}),!e&&r.selected&&(e=n)}),this._childOptions={options:t,isSelected:e},super.connectedCallback&&super.connectedCallback()}}},function(t,e,r){(function(e){var r=/^\[object .+?Constructor\]$/,n="object"==typeof e&&e&&e.Object===Object&&e,o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();var s,a=Array.prototype,c=Function.prototype,u=Object.prototype,l=i["__core-js_shared__"],d=(s=/[^.]+$/.exec(l&&l.keys&&l.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"",p=c.toString,f=u.hasOwnProperty,h=u.toString,g=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),y=a.splice,m=E(i,"Map"),b=E(Object,"create");function v(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function _(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function w(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function O(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function S(t){return!(!C(t)||(e=t,d&&d in e))&&(function(t){var e=C(t)?h.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?g:r).test(function(t){if(null!=t){try{return p.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function x(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function E(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return S(r)?r:void 0}function T(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s),s};return r.cache=new(T.Cache||w),r}function C(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}v.prototype.clear=function(){this.__data__=b?b(null):{}},v.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},v.prototype.get=function(t){var e=this.__data__;if(b){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return f.call(e,t)?e[t]:void 0},v.prototype.has=function(t){var e=this.__data__;return b?void 0!==e[t]:f.call(e,t)},v.prototype.set=function(t,e){return this.__data__[t]=b&&void 0===e?"__lodash_hash_undefined__":e,this},_.prototype.clear=function(){this.__data__=[]},_.prototype.delete=function(t){var e=this.__data__,r=O(e,t);return!(r<0)&&(r==e.length-1?e.pop():y.call(e,r,1),!0)},_.prototype.get=function(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]},_.prototype.has=function(t){return O(this.__data__,t)>-1},_.prototype.set=function(t,e){var r=this.__data__,n=O(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},w.prototype.clear=function(){this.__data__={hash:new v,map:new(m||_),string:new v}},w.prototype.delete=function(t){return x(this,t).delete(t)},w.prototype.get=function(t){return x(this,t).get(t)},w.prototype.has=function(t){return x(this,t).has(t)},w.prototype.set=function(t,e){return x(this,t).set(t,e),this},T.Cache=w,t.exports=T}).call(this,r(11))},function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"a",(function(){return a}));var n=r(5);const o={type:Object,converter:{toAttribute:t=>null==t?t:JSON.stringify(t),fromAttribute:t=>t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}},i={type:String,attribute:"default-frequency",converter:{fromAttribute:t=>t&&Object(n.isFrequencyValid)(t)?t:null}},s={type:Boolean,attribute:!0,reflect:!0},a={type:Object,attribute:!1}},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinStatus",(function(){return u})),r.d(e,"mapStateToProps",(function(){return l})),r.d(e,"ConnectedOptinStatus",(function(){return d}));var n=r(1),o=r(2),i=r(4),s=r(8),a=r(6),c=r(10);class u extends(Object(a.d)(c.a)){static get properties(){return{subscribed:s.d,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return n.b`
1
+ (factory => {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else {
7
+ window.og = window.og || {};
8
+ window.og['offers'] = factory();
9
+ }
10
+ })(()=>{
11
+ var lib=(()=>{var Pa=Object.create;var Ye=Object.defineProperty;var Ra=Object.getOwnPropertyDescriptor;var Aa=Object.getOwnPropertyNames;var Na=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var Io=t=>Ye(t,"__esModule",{value:!0}),n=(t,e)=>Ye(t,"name",{value:e,configurable:!0}),qa=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var u=(t,e)=>()=>(t&&(e=t(t=0)),e);var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),b=(t,e)=>{Io(t);for(var r in e)Ye(t,r,{get:e[r],enumerable:!0})},Ia=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Aa(e))!ka.call(t,o)&&o!=="default"&&Ye(t,o,{get:()=>e[o],enumerable:!(r=Ra(e,o))||r.enumerable});return t},de=t=>Ia(Io(Ye(t!=null?Pa(Na(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Do={};b(Do,{default:()=>Da,offersLiveEditor:()=>Pr});function Cr(t){let e=Fa(Uo),r=Fo(t.source);e(t)&&t.data.ogType==="READY"&&import("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.0/dist/client.js").then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",Cr)})}function Pr(t=window.opener){t&&t!==window&&(window.addEventListener("message",Cr),Fo(t)("READY"))}var Ua,bt,Fa,Uo,Fo,Da,Lo=u(()=>{Ua=Object.defineProperty,bt=n((t,e)=>Ua(t,"name",{value:e,configurable:!0}),"s"),Fa=bt(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),Uo=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Fo=bt(t=>(e,r)=>{Uo.forEach(o=>t.postMessage({ogType:e,...r},o))},"createBroadcastMessage");n(Cr,"d");bt(Cr,"handleReady");n(Pr,"l");bt(Pr,"offersLiveEditor");Da=Pr});function Rr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var jo=u(()=>{n(Rr,"symbolObservablePonyfill")});var Ce,La,Ar,Mo=u(()=>{jo();typeof self!="undefined"?Ce=self:typeof window!="undefined"||typeof window!="undefined"?Ce=window:typeof module!="undefined"?Ce=module:Ce=Function("return this")();La=Rr(Ce),Ar=La});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}function kr(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(kr)(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 f(){c===a&&(c=a.slice())}n(f,"ensureCanMutateNextListeners");function y(){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(y,"getState");function d(h){if(typeof h!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var O=!0;return f(),c.push(h),n(function(){if(!!O){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");O=!1,f();var E=c.indexOf(h);c.splice(E,1),a=null}},"unsubscribe")}n(d,"subscribe");function g(h){if(!ja(h))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof h.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,h)}finally{l=!1}for(var O=a=c,C=0;C<O.length;C++){var E=O[C];E()}return h}n(g,"dispatch");function S(h){if(typeof h!="function")throw new Error("Expected the nextReducer to be a function.");s=h,g({type:Qe.REPLACE})}n(S,"replaceReducer");function _(){var h,O=d;return h={subscribe:n(function(E){if(typeof E!="object"||E===null)throw new TypeError("Expected the observer to be an object.");function P(){E.next&&E.next(y())}n(P,"observeState"),P();var Ca=O(P);return{unsubscribe:Ca}},"subscribe")},h[Ar]=function(){return this},h}return n(_,"observable"),g({type:Qe.INIT}),o={dispatch:g,subscribe:d,getState:y,replaceReducer:S},o[Ar]=_,o}function Ma(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.'}function Va(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Qe.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:Qe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Qe.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.")})}function Vo(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(f,y){if(f===void 0&&(f={}),c)throw c;if(!1)var d;for(var g=!1,S={},_=0;_<i.length;_++){var h=i[_],O=r[h],C=f[h],E=O(C,y);if(typeof E=="undefined"){var P=Ma(h,y);throw new Error(P)}S[h]=E,g=g||E!==C}return g=g||i.length!==Object.keys(f).length,g?S:f},"combination")}function $o(t,e){return function(){return e(t.apply(this,arguments))}}function Bo(t,e){if(typeof t=="function")return $o(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]=$o(s,e))}return r}function $a(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ho(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}function Ba(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ho(r,!0).forEach(function(o){$a(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ho(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}function qr(){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))}})}function zo(){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=qr.apply(void 0,c)(s.dispatch),Ba({},s,{dispatch:i})}}}var Nr,Qe,_t=u(()=>{Mo();Nr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Qe={INIT:"@@redux/INIT"+Nr(),REPLACE:"@@redux/REPLACE"+Nr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Nr()},"PROBE_UNKNOWN_ACTION")};n(ja,"isPlainObject");n(kr,"createStore");n(Ma,"getUndefinedStateErrorMessage");n(Va,"assertReducerShape");n(Vo,"combineReducers");n($o,"bindActionCreator");n(Bo,"bindActionCreators");n($a,"_defineProperty");n(Ho,"ownKeys");n(Ba,"_objectSpread2");n(qr,"compose");n(zo,"applyMiddleware")});var Wo={};b(Wo,{connect:()=>m,createRecalcProps:()=>Go,default:()=>Wa,resolveStore:()=>Ir,setStore:()=>za,unsetStore:()=>Ga});var Je,Ha,Ir,Go,m,za,Ga,Wa,R=u(()=>{_t();Je=null,Ha=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Ir=n(t=>{if(!Je)throw new Error("Missing redux store.");return Je},"resolveStore"),Go=n((t,e)=>r=>{let{getState:o,dispatch:s}=Ir(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),m=n((t,e=Ha)=>r=>{let s=Go(t,typeof e=="function"?e:i=>Bo(e,i));return class extends r{get store(){return Je}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Ir(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"),za=n(t=>{Je=t},"setStore"),Ga=n(()=>{Je=void 0},"unsetStore"),Wa=m});function Yo(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}var Qo,Jo,Ko=u(()=>{n(Yo,"createThunkMiddleware");Qo=Yo();Qo.withExtraArgument=Yo;Jo=Qo});var Z,X,ee,Et,Zo,U,Ke,xt,St,Xo,vt,Pe,en,wt,Tt,tn,Ot,Ct,Pt,rn,on,Rt,nn,At,Re,sn,Nt,kt,Ze,Xe,qt,It,fe,te,Ut,Ft,Ae=u(()=>{Z="OPTIN_PRODUCT",X="OPTOUT_PRODUCT",ee="PRODUCT_CHANGE_FREQUENCY",Et="SET_MERCHANT_ID",Zo="REQUEST_OFFER",U="RECEIVE_OFFER",Ke="PRODUCT_HAS_CHANGED",xt="CREATED_SESSION_ID",St="SET_AUTH_URL",Xo="REQUEST_AUTH",vt="AUTHORIZE",Pe="UNAUTHORIZED",en="REQUEST_ORDERS",wt="RECEIVE_ORDERS",Tt="RECEIVE_ORDER_ITEMS",tn="FETCH_RESPONSE_ERROR",Ot="SET_ENVIRONMENT_STAGING",Ct="SET_ENVIRONMENT_DEV",Pt="SET_ENVIRONMENT_PROD",rn="CONCLUDE_UPSELL",on="REQUEST_CREATE_IU_ORDER",Rt="CREATE_ONE_TIME",nn="REQUEST_CONVERT_ONE_TIME",At="CONVERT_ONE_TIME",Re="CHECKOUT",sn="RECEIVE_FETCH",Nt="SET_LOCALE",kt="SET_CONFIG",Ze="SET_PREVIEW_STANDARD_OFFER",Xe="SET_PREVIEW_UPSELL_OFFER",qt="ADD_TEMPLATE",It="SET_TEMPLATES",fe="LOCAL_STORAGE_CHANGE",te="LOCAL_STORAGE_CLEAR",Ut="SET_FIRST_ORDER_PLACE_DATE",Ft="SET_PRODUCT_TO_SUBSCRIBE"});function Ya(t,e){return t===e}function Qa(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 Ja(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ya,r=null,o=null;return function(){return Qa(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function Ka(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 Za(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(),f=Ka(i),y=t.apply(void 0,[function(){return c++,l.apply(null,arguments)}].concat(r)),d=t(function(){for(var g=[],S=f.length,_=0;_<S;_++)g.push(f[_].apply(null,arguments));return y.apply(null,g)});return d.resultFunc=l,d.dependencies=f,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}var Ne,an=u(()=>{n(Ya,"defaultEqualityCheck");n(Qa,"areArgumentsShallowlyEqual");n(Ja,"defaultMemoize");n(Ka,"getDependencies");n(Za,"createSelectorCreator");Ne=Za(Ja)});var jt=K((Lu,mn)=>{var Xa="Expected a function",cn="__lodash_hash_undefined__",ec="[object Function]",tc="[object GeneratorFunction]",rc=/[\\^$.*+?()[\]{}|]/g,oc=/^\[object .+?Constructor\]$/,nc=typeof window=="object"&&window&&window.Object===Object&&window,sc=typeof self=="object"&&self&&self.Object===Object&&self,ln=nc||sc||Function("return this")();function ic(t,e){return t==null?void 0:t[e]}n(ic,"getValue");function ac(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}n(ac,"isHostObject");var cc=Array.prototype,lc=Function.prototype,un=Object.prototype,Ur=ln["__core-js_shared__"],pn=function(){var t=/[^.]+$/.exec(Ur&&Ur.keys&&Ur.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),dn=lc.toString,Fr=un.hasOwnProperty,uc=un.toString,pc=RegExp("^"+dn.call(Fr).replace(rc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),dc=cc.splice,fc=fn(ln,"Map"),et=fn(Object,"create");function he(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(he,"Hash");function hc(){this.__data__=et?et(null):{}}n(hc,"hashClear");function mc(t){return this.has(t)&&delete this.__data__[t]}n(mc,"hashDelete");function gc(t){var e=this.__data__;if(et){var r=e[t];return r===cn?void 0:r}return Fr.call(e,t)?e[t]:void 0}n(gc,"hashGet");function yc(t){var e=this.__data__;return et?e[t]!==void 0:Fr.call(e,t)}n(yc,"hashHas");function bc(t,e){var r=this.__data__;return r[t]=et&&e===void 0?cn:e,this}n(bc,"hashSet");he.prototype.clear=hc;he.prototype.delete=mc;he.prototype.get=gc;he.prototype.has=yc;he.prototype.set=bc;function ke(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(ke,"ListCache");function _c(){this.__data__=[]}n(_c,"listCacheClear");function Ec(t){var e=this.__data__,r=Dt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():dc.call(e,r,1),!0}n(Ec,"listCacheDelete");function xc(t){var e=this.__data__,r=Dt(e,t);return r<0?void 0:e[r][1]}n(xc,"listCacheGet");function Sc(t){return Dt(this.__data__,t)>-1}n(Sc,"listCacheHas");function vc(t,e){var r=this.__data__,o=Dt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(vc,"listCacheSet");ke.prototype.clear=_c;ke.prototype.delete=Ec;ke.prototype.get=xc;ke.prototype.has=Sc;ke.prototype.set=vc;function me(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(me,"MapCache");function wc(){this.__data__={hash:new he,map:new(fc||ke),string:new he}}n(wc,"mapCacheClear");function Tc(t){return Lt(this,t).delete(t)}n(Tc,"mapCacheDelete");function Oc(t){return Lt(this,t).get(t)}n(Oc,"mapCacheGet");function Cc(t){return Lt(this,t).has(t)}n(Cc,"mapCacheHas");function Pc(t,e){return Lt(this,t).set(t,e),this}n(Pc,"mapCacheSet");me.prototype.clear=wc;me.prototype.delete=Tc;me.prototype.get=Oc;me.prototype.has=Cc;me.prototype.set=Pc;function Dt(t,e){for(var r=t.length;r--;)if(qc(t[r][0],e))return r;return-1}n(Dt,"assocIndexOf");function Rc(t){if(!hn(t)||Nc(t))return!1;var e=Ic(t)||ac(t)?pc:oc;return e.test(kc(t))}n(Rc,"baseIsNative");function Lt(t,e){var r=t.__data__;return Ac(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Lt,"getMapData");function fn(t,e){var r=ic(t,e);return Rc(r)?r:void 0}n(fn,"getNative");function Ac(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Ac,"isKeyable");function Nc(t){return!!pn&&pn in t}n(Nc,"isMasked");function kc(t){if(t!=null){try{return dn.call(t)}catch{}try{return t+""}catch{}}return""}n(kc,"toSource");function Dr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Xa);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(Dr.Cache||me),r}n(Dr,"memoize");Dr.Cache=me;function qc(t,e){return t===e||t!==t&&e!==e}n(qc,"eq");function Ic(t){var e=hn(t)?uc.call(t):"";return e==ec||e==tc}n(Ic,"isFunction");function hn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(hn,"isObject");mn.exports=Dr});var vn={};b(vn,{api:()=>re,compareFrequencies:()=>xn,convertOneTimeToSubscription:()=>Sn,createOneTime:()=>En,default:()=>Fc,fetchItems:()=>_n,fetchOffer:()=>yn,fetchOrders:()=>bn,isFrequencyValid:()=>Vt,parseFrequenciesList:()=>Vr,parseFrequency:()=>Ue,stringifyFrequencies:()=>Uc,stringifyFrequency:()=>Fe,toProductId:()=>gn,toQuery:()=>Mr,withAuth:()=>tt,withFetchJson:()=>qe,withHost:()=>Ie,withJsonBody:()=>jr});var Mt,Lr,qe,Ie,tt,jr,Mr,gn,yn,bn,_n,En,Ue,Vt,xn,Vr,Uc,Fe,Sn,re,Fc,oe=u(()=>{Mt=de(jt()),Lr=n((...t)=>JSON.stringify(t),"memoizeKey"),qe=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Ie=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),tt=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"),jr=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"),Mr=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),gn=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),yn=(0,Mt.default)(qe(Ie((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=Mr([["session_id",e],["page_type",1],["p",gn(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),Lr),bn=(0,Mt.default)(qe(Ie(tt((t=1,e="place")=>[`/orders/?${Mr([["status",t],["ordering",e]])}`]))),Lr),_n=(0,Mt.default)(qe(Ie(tt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),Lr),En=qe(Ie(tt(jr((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}}]})))),Ue=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"),Vt=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),xn=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),Vr=n(t=>[...new Set(t&&t.split(/\s+/))].filter(Vt).sort(xn),"parseFrequenciesList"),Uc=n(t=>t==null?t:t.join(" "),"stringifyFrequencies"),Fe=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"),Sn=qe(Ie(tt(jr((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=Ue(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...o}}]})))),re={fetchOffer:yn,fetchOrders:bn,fetchItems:_n,createOneTime:En,convertOneTimeToSubscription:Sn},Fc=re});function Dc(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}var ge,N,$t,wn,$r,Lc,z,Tn,On,ne,Bt,Br,G,De,W=u(()=>{an();ge=de(jt());oe();ge.default.Cache=Map;n(Dc,"arraysEqual");N=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Dc((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),$t=n(t=>t.optedin||[],"optedinSelector"),wn=n(t=>t.optedout||[],"optedoutSelector"),$r=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Lc=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),z=(0,ge.default)(t=>Ne($t,wn,$r,(e,r,o)=>{let s=e.find(i=>N(t,i));return s||(r.find(i=>N(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Tn=(0,ge.default)(t=>Ne($t,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),On=(0,ge.default)(t=>Ne(wn,e=>e.find(r=>N(t,r)))),ne=(0,ge.default)(t=>Ne(z(t),e=>e&&e.frequency||null)),Bt=(0,ge.default)(t=>Ne(Lc,e=>e[t]&&Fe(e[t])||null)),Br=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),G=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(Br(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),De=n(t=>({templates:t.templates||[]}),"templatesSelector")});var Zn={};b(Zn,{auth:()=>Un,authUrl:()=>Dn,autoshipByDefault:()=>Qn,autoshipEligible:()=>An,config:()=>Gn,default:()=>Hr,defaultFrequencies:()=>Jn,eligibilityGroups:()=>kn,environment:()=>Hn,firstOrderPlaceDate:()=>$n,frequency:()=>jc,inStock:()=>Nn,incentives:()=>In,locale:()=>zn,merchantId:()=>Fn,nextUpcomingOrder:()=>Rn,offer:()=>Ln,offerId:()=>jn,optedin:()=>Cn,optedout:()=>Pn,previewStandardOffer:()=>Wn,previewUpsellOffer:()=>Yn,productOffer:()=>Vn,productToSubscribe:()=>Bn,sessionId:()=>Mn,templates:()=>Kn});var Cn,Pn,Rn,An,Nn,kn,qn,In,jc,Un,Fn,Dn,Ln,jn,Mn,Vn,$n,Bn,Hn,zn,Gn,Wn,Yn,Qn,Jn,Kn,Hr,zr=u(()=>{_t();Ae();W();oe();Cn=n((t=[],e)=>{switch(e.type){case te:return[];case fe:return e.newValue?e.newValue.optedin:t;case Z:case ee:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case X:return t.filter(s=>!N(e.payload.product,s));case Ke:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case At:return t.filter(s=>!N(e.payload.product,s));case Re:return[];default:return t}},"optedin"),Pn=n((t=[],e)=>{switch(e.type){case te:return[];case fe:return e.newValue?e.newValue.optedout:t;case Z:case ee:return t.filter(s=>!N(e.payload.product,s));case X:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case Ke:return t.map(s=>N(e.payload.product,s)?{...s,...e.payload.newProduct}:s);case Re:return[];default:return t}},"optedout"),Rn=n((t={},{type:e,payload:r})=>{switch(e){case wt: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 Tt:return{...t,products:(r.results||[]).map(o=>o.product)};case Rt:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},"nextUpcomingOrder"),An=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.autoship};default:return t}},"autoshipEligible"),Nn=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.in_stock};default:return t}},"inStock"),kn=n((t={},e)=>{switch(e.type){case U:return{...t,...e.payload.eligibility_groups};default:return t}},"eligibilityGroups"),qn=n((t,e)=>t.map(r=>({...e[r],id:[r][0]})),"mapIncentive"),In=n((t={},e)=>{switch(e.type){case U: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||[],...qn(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...qn(a,e.payload.incentives_display)]}),{})}),{})};default:return t}},"incentives"),jc=n((t={},e)=>{switch(e.type){case Z:case ee:return{...t,[e.payload.product]:e.payload.frequency};case X:return{...t,[e.payload.product]:void 0};default:return t}},"frequency"),Un=n((t=!1,e)=>{switch(e.type){case vt:return{...e.payload};case Pe:return!1;default:return t}},"auth"),Fn=n((t="",e)=>{switch(e.type){case Et:return e.payload;default:return t}},"merchantId"),Dn=n((t=null,e)=>{switch(e.type){case St:return e.payload;default:return t}},"authUrl"),Ln=n((t={},e)=>{switch(e.type){case U:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},"offer"),jn=n((t="",e)=>{switch(e.type){case U:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Mn=n((t=null,e)=>{switch(e.type){case te:return null;case xt:return e.payload;default:return t}},"sessionId"),Vn=n((t={},e)=>{switch(e.type){case U:return{...t,...Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>({...r,...o}))};case Re:return{};default:return t}},"productOffer"),$n=n((t={},e)=>{switch(e.type){case Ut:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},"firstOrderPlaceDate"),Bn=n((t={},e)=>{switch(e.type){case Ft:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},"productToSubscribe"),Hn=n((t={},e)=>{switch(e.type){case Ot:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case Ct:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case Pt:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},"environment"),zn=n((t={offerOptInLabel:"Subscribe",offerOptOutLabel:"Purchase one time",offerEveryLabel:"Every",offerTooltipTrigger:"Hover for additional info",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:"(Recommended)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case Nt:return{...t,...e.payload};default:return t}},"locale"),Gn=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case kt:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Fe(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Fe):t.frequencies};default:return t}},"config"),Wn=n((t=!1,e)=>{switch(e.type){case Ze:return e.payload;default:return t}},"previewStandardOffer"),Yn=n((t=!1,e)=>{switch(e.type){case Xe:return e.payload;default:return t}},"previewUpsellOffer"),Qn=n((t=[],e)=>{switch(e.type){case U:return{...t,...e.payload.autoship_by_default};default:return t}},"autoshipByDefault"),Jn=n((t=[],e)=>{switch(e.type){case U:return{...t,...e.payload.default_frequencies};default:return t}},"defaultFrequencies"),Kn=n((t=[],e)=>{switch(e.type){case It:return[...e.payload||[]];case qt:return[e.payload,...t];default:return t}},"templates"),Hr=Vo({environment:Hn,optedin:Cn,optedout:Pn,merchantId:Fn,offer:Ln,offerId:jn,productOffer:Vn,sessionId:Mn,inStock:Nn,eligibilityGroups:kn,autoshipByDefault:Qn,autoshipEligible:An,incentives:In,nextUpcomingOrder:Rn,auth:Un,authUrl:Dn,locale:zn,config:Gn,previewStandardOffer:Wn,previewUpsellOffer:Yn,templates:Kn,defaultFrequencies:Jn,firstOrderPlaceDate:$n,productToSubscribe:Bn})});var Gr=K((Ht,Xn)=>{(function(t,e){typeof Ht=="object"&&typeof Xn!="undefined"?e(Ht):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Ht,function(t){"use strict";function e(o,s,i,a){var c,l=!1,f=0;function y(){c&&clearTimeout(c)}n(y,"clearExistingTimeout");function d(){y(),l=!0}n(d,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function g(){for(var S=arguments.length,_=new Array(S),h=0;h<S;h++)_[h]=arguments[h];var O=this,C=Date.now()-f;if(l)return;function E(){f=Date.now(),i.apply(O,_)}n(E,"exec");function P(){c=void 0}n(P,"clear"),a&&!c&&E(),y(),a===void 0&&C>o?E():s!==!0&&(c=setTimeout(a?P:E,a===void 0?o-C:o))}return n(g,"wrapper"),g.cancel=d,g}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})})});var es,Mc,Vc,$c,Bc,ts,rs=u(()=>{es=/^og_auth=/,Mc=n((t=es)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(es,""),"s"),Vc=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),$c=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"),Bc=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),ts=n((t,e=Mc,r=$c)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(Bc(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(Vc).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var ps={};b(ps,{addTemplate:()=>Kc,authorize:()=>zt,checkout:()=>Yc,concludeUpsell:()=>Yr,createIu:()=>Kr,createSessionId:()=>os,fetchAuth:()=>Gc,fetchDone:()=>ot,fetchOffer:()=>Jr,fetchOrders:()=>nt,fetchResponseError:()=>Yt,optinProduct:()=>Y,optoutProduct:()=>ye,productChangeFrequency:()=>rt,productHasChangedComponents:()=>Wr,receiveConvertOneTime:()=>us,receiveCreateOneTime:()=>cs,receiveItems:()=>Wt,receiveOffer:()=>be,receiveOrders:()=>Gt,requestAuth:()=>ns,requestConvertOneTimeToSubscription:()=>ls,requestCreateOneTime:()=>as,requestOffer:()=>is,requestOrders:()=>ss,requestSessionId:()=>Qr,setAuthUrl:()=>zc,setConfig:()=>Jc,setEnvironment:()=>Wc,setFirstOrderPlaceDate:()=>Zr,setLocale:()=>Qc,setMerchantId:()=>Hc,setProductToSubscribe:()=>Xr,setTemplates:()=>Zc,unauthorized:()=>se});var Y,ye,Wr,rt,Yr,Hc,os,ns,zt,se,zc,ot,Gc,ss,Gt,Wt,nt,Wc,Qr,be,Yt,is,Jr,Yc,as,cs,ls,us,Kr,Qc,Jc,Kc,Zc,Zr,Xr,k=u(()=>{rs();Ae();oe();Y=n((t,e)=>({type:Z,payload:{product:t,frequency:e}}),"optinProduct"),ye=n(t=>({type:X,payload:{product:t}}),"optoutProduct"),Wr=n((t,e)=>({type:Ke,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),rt=n((t,e)=>({type:ee,payload:{product:t,frequency:e}}),"productChangeFrequency"),Yr=n(t=>({type:rn,payload:{product:t}}),"concludeUpsell"),Hc=n(t=>({type:Et,payload:t}),"setMerchantId"),os=n(t=>({type:xt,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),ns=n(t=>({type:Xo,payload:t}),"requestAuth"),zt=n((t,e,r,o)=>({type:vt,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),se=n(t=>({type:Pe,payload:t}),"unauthorized"),zc=n(t=>({type:St,payload:t}),"setAuthUrl"),ot=n(t=>({type:sn,payload:t}),"fetchDone"),Gc=n((t=ts)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(se({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=ns(i);return r(a),t(i).then(({sig_field:c,ts:l,sig:f})=>r(zt(s,c,l,f)),c=>r(se(c))).finally(()=>r(ot(a)))},"fetchAuthThunk"),"fetchAuth"),ss=n((t,e)=>({type:en,payload:{status:t,ordering:e}}),"requestOrders"),Gt=n(t=>({type:wt,payload:t}),"receiveOrders"),Wt=n(t=>({type:Tt,payload:t}),"receiveItems"),nt=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(se("No auth set."));let c=ss(t,e);return o(c),re.fetchOrders(i,a,t,e).then(l=>{o(Gt(l));let f=(l.results[0]||{}).public_id;return f?re.fetchItems(i,a,f).then(y=>o(Wt(y))):null},l=>o(se(l))).finally(()=>o(ot(c)))},"fetchOrdersThunk"),"fetchOrders"),Wc=n(t=>{switch(t){case"dev":return{type:Ct,payload:t};case"staging":return{type:Ot,payload:t};case"prod":return{type:Pt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Qr=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(os(r)),o},"requestSessionId"),be=n(t=>({type:U,payload:t}),"receiveOffer"),Yt=n(t=>({type:tn,payload:t}),"fetchResponseError"),is=n((t,e="pdp")=>({type:Zo,payload:{product:t,module:e}}),"requestOffer"),Jr=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),l=is(t,e);return o(l),re.fetchOffer(c,i,a,t,e).then(f=>o(be(f)),f=>o(Yt(f))).finally(()=>o(ot(l)))},"fetchOfferThunk"),"fetchOffer"),Yc=n(()=>({type:Re}),"checkout"),as=n((t,e,r,o)=>({type:on,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),cs=n(t=>({type:Rt,payload:t}),"receiveCreateOneTime"),ls=n((t,e)=>({type:nn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),us=n((t,e)=>({type:At,payload:{response:t,product:e}}),"receiveConvertOneTime"),Kr=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:l,environment:{legoUrl:f},previewUpsellOffer:y,offerId:d}=c();if(!l)return a(se("No auth set."));let g=as(t,e,r,d);return a(g),(y?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:d}):re.createOneTime(f,l,t.id,e,r,d)).then(S=>(a(cs(S)),o?(a(ls(S,s)),(y?Promise.resolve({item:S,frequency:s}):re.convertOneTimeToSubscription(f,l,S,s,d)).then(_=>a(us(_,t)),_=>a(Yt(_)))):S),S=>a(Yt(S))).finally(()=>a(ot(g)))},"createIuThunk"),"createIu"),Qc=n(t=>({type:Nt,payload:t}),"setLocale"),Jc=n(t=>({type:kt,payload:t}),"setConfig"),Kc=n((t,e,r)=>({type:qt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),Zc=n(t=>({type:It,payload:t}),"setTemplates"),Zr=n((t,e)=>({type:Ut,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Xr=n((t,e)=>({type:Ft,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var hs={};b(hs,{STORE_ROOT:()=>_e,clearState:()=>el,listenLocalStorageChanges:()=>Xc,loadState:()=>ro,safeParseState:()=>eo,saveState:()=>oo,serializeState:()=>fs});var ds,_e,eo,to,ro,fs,oo,Xc,el,Qt=u(()=>{ds=de(Gr());k();Ae();_e="OG_STATE",eo=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch{return}},"safeParseState"),to=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),ro=n(()=>to()?{}:eo(localStorage.getItem(_e)),"loadState"),fs=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"),oo=n(t=>{if(to())return;let e=fs(t);e&&localStorage.getItem(_e)!==e&&localStorage.setItem(_e,e)},"saveState"),Xc=n(t=>(0,ds.throttle)(500,e=>{if(to())return;let{key:r,newValue:o}=e;r===_e&&o===null?(t.dispatch({type:te}),setTimeout(()=>t.dispatch(Qr()),0)):r===_e&&t.dispatch({type:fe,newValue:eo(o)})}),"listenLocalStorageChanges"),el=n(()=>localStorage.removeItem(_e),"clearState")});var ms,tl,gs,rl,ys,bs,_s=u(()=>{ms=de(Gr());Ae();W();Qt();tl=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),gs=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===Z,({type:t}={})=>t===ee],fn:gs(!0)},{expressions:[({type:t}={})=>t===X],fn:gs(!1)}],ys=n(t=>e=>r=>{let o=t.getState();rl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),bs=n(t=>e=>r=>{e(r);let o=(0,ms.throttle)(500,()=>{oo({...t.getState()})});r.type!==fe&&o()},"localStorageMiddleware")});var xs={};b(xs,{default:()=>ol,getStore:()=>Es});function Es(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):qr,r=[Jo,ys];t||r.push(bs);let o=e(zo(...r)),s=kr(Hr,t?{}:ro(),o);return window.og=window.og||{},window.og.store=s,s}var ol,Ss=u(()=>{_t();Ko();zr();Qt();_s();n(Es,"getStore");ol=Es});var ws={};b(ws,{default:()=>nl,getProductsForPurchasePost:()=>vs});var vs,nl,Ts=u(()=>{oe();vs=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],...Ue(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"),nl={getProductsForPurchasePost:vs}});var no,Ee,xe=u(()=>{no=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Ee=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var F,so,Os,Le,Se,Cs,st,$,Jt,ie=u(()=>{F=`{{lit-${String(Math.random()).slice(2)}}}`,so=`<!--${F}-->`,Os=new RegExp(`${F}|${so}`),Le="$lit$",Se=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:f,values:{length:y}}=e;for(;l<y;){let d=i.nextNode();if(d===null){i.currentNode=s.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let g=d.attributes,{length:S}=g,_=0;for(let h=0;h<S;h++)Cs(g[h].name,Le)&&_++;for(;_-- >0;){let h=f[l],O=Jt.exec(h)[2],C=O.toLowerCase()+Le,E=d.getAttribute(C);d.removeAttribute(C);let P=E.split(Os);this.parts.push({type:"attribute",index:c,name:O,strings:P}),l+=P.length-1}}d.tagName==="TEMPLATE"&&(s.push(d),i.currentNode=d.content)}else if(d.nodeType===3){let g=d.data;if(g.indexOf(F)>=0){let S=d.parentNode,_=g.split(Os),h=_.length-1;for(let O=0;O<h;O++){let C,E=_[O];if(E==="")C=$();else{let P=Jt.exec(E);P!==null&&Cs(P[2],Le)&&(E=E.slice(0,P.index)+P[1]+P[2].slice(0,-Le.length)+P[3]),C=document.createTextNode(E)}S.insertBefore(C,d),this.parts.push({type:"node",index:++c})}_[h]===""?(S.insertBefore($(),d),o.push(d)):d.data=_[h],l+=h}}else if(d.nodeType===8)if(d.data===F){let g=d.parentNode;(d.previousSibling===null||c===a)&&(c++,g.insertBefore($(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),l++}else{let g=-1;for(;(g=d.data.indexOf(F,g+1))!==-1;)this.parts.push({type:"node",index:-1}),l++}}for(let d of o)d.parentNode.removeChild(d)}};n(Se,"Template");Cs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),st=n(t=>t.index!==-1,"isTemplatePartActive"),$=n(()=>document.createComment(""),"createMarker"),Jt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function ao(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,io,null,!1),i=it(o),a=o[i],c=-1,l=0,f=[],y=null;for(;s.nextNode();){c++;let d=s.currentNode;for(d.previousSibling===y&&(y=null),e.has(d)&&(f.push(d),y===null&&(y=d)),y!==null&&l++;a!==void 0&&a.index===c;)a.index=y!==null?-1:a.index-l,i=it(o,i),a=o[i]}f.forEach(d=>d.parentNode.removeChild(d))}function Ps(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,io,null,!1),a=it(s),c=0,l=-1;for(;i.nextNode();)for(l++,i.currentNode===r&&(c=sl(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===l;){if(c>0){for(;a!==-1;)s[a].index+=c,a=it(s,a);return}a=it(s,a)}}var io,sl,it,Rs=u(()=>{ie();io=133;n(ao,"removeNodesFromTemplate");sl=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,io,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),it=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(st(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Ps,"insertNodeIntoTemplate")});var il,ve,co=u(()=>{il=new WeakMap,ve=n(t=>typeof t=="function"&&il.has(t),"isDirective")});var q,Kt,lo=u(()=>{q={},Kt={}});var ae,Zt=u(()=>{xe();ie();ae=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=no?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],!st(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 f=this.processor.handleTextExpression(this.options);f.insertAfterNode(l.previousSibling),this.__parts.push(f)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,c.name,c.strings,this.options));i++}return no&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ae,"TemplateInstance")});var As,cl,Q,Xt=u(()=>{xe();ie();As=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),cl=` ${F} `,Q=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=Jt.exec(i);c===null?r+=i+(o?cl:so):r+=i.substr(0,c.index)+c[1]+c[2]+Le+c[3]+F}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return As!==void 0&&(r=As.createHTML(r)),e.innerHTML=r,e}};n(Q,"TemplateResult")});var er,tr,je,at,J,ct,lt,rr,Ns,ut,ll,or=u(()=>{co();xe();lo();Zt();Xt();ie();er=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),tr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),je=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 at(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"||!tr(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(er(c)||!tr(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(je,"AttributeCommitter");at=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==q&&(!er(e)||e!==this.value)&&(this.value=e,ve(e)||(this.committer.dirty=!0))}commit(){for(;ve(this.value);){let e=this.value;this.value=q,e(this)}this.value!==q&&this.committer.commit()}};n(at,"AttributePart");J=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild($()),this.endNode=e.appendChild($())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=$()),e.__insert(this.endNode=$())}insertAfterPart(e){e.__insert(this.startNode=$()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;ve(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}let e=this.__pendingValue;e!==q&&(er(e)?e!==this.value&&this.__commitText(e):e instanceof Q?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):tr(e)?this.__commitIterable(e):e===Kt?(this.value=Kt,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 ae&&this.value.template===r)this.value.update(e.values);else{let o=new ae(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 J(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){Ee(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(J,"NodePart");ct=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(;ve(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}if(this.__pendingValue===q)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=q}};n(ct,"BooleanAttributePart");lt=class extends je{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new rr(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(lt,"PropertyCommitter");rr=class extends at{};n(rr,"PropertyPart");Ns=!1;(()=>{try{let t={get capture(){return Ns=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch{}})();ut=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(;ve(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=q,i(this)}if(this.__pendingValue===q)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=ll(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=q}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ut,"EventPart");ll=n(t=>t&&(Ns?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function uo(t){let e=we.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},we.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(F);return r=e.keyString.get(o),r===void 0&&(r=new Se(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var we,nr=u(()=>{ie();n(uo,"templateFactory");we=new Map});var ce,po,fo=u(()=>{xe();or();nr();ce=new WeakMap,po=n((t,e,r)=>{let o=ce.get(e);o===void 0&&(Ee(e,e.firstChild),ce.set(e,o=new J(Object.assign({templateFactory:uo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var sr,ho,mo=u(()=>{or();sr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new lt(e,r.slice(1),o).parts:i==="@"?[new ut(e,r.slice(1),s.eventContext)]:i==="?"?[new ct(e,r.slice(1),o)]:new je(e,r,o).parts}handleTextExpression(e){return new J(e)}};n(sr,"DefaultTemplateProcessor");ho=new sr});var p,go=u(()=>{mo();Xt();mo();co();xe();lo();or();fo();nr();Zt();Xt();ie();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");p=n((t,...e)=>new Q(t,e,"html",ho),"html")});var qs,ir,pl,dl,fl,Is,hl,Us,Fs=u(()=>{xe();Rs();fo();nr();Zt();ie();go();qs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),ir=!0;typeof window.ShadyCSS=="undefined"?ir=!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."),ir=!1);pl=n(t=>e=>{let r=qs(e.type,t),o=we.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},we.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(F);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();ir&&window.ShadyCSS.prepareTemplateDom(a,t),s=new Se(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),dl=["html","svg"],fl=n(t=>{dl.forEach(e=>{let r=we.get(qs(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)}),ao(o,i)})})},"removeStylesFromLitTemplates"),Is=new Set,hl=n((t,e,r)=>{Is.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 f=0;f<i;f++){let y=s[f];y.parentNode.removeChild(y),a.textContent+=y.textContent}fl(t);let c=o.content;r?Ps(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 f=new Set;f.add(a),ao(r,f)}},"prepareTemplateStyles"),Us=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ce.has(e),i=ir&&e.nodeType===11&&!!e.host,a=i&&!Is.has(o),c=a?document.createDocumentFragment():e;if(po(t,c,Object.assign({templateFactory:pl(o)},r)),a){let l=ce.get(c);ce.delete(c);let f=l.value instanceof ae?l.value.template:void 0;hl(o,c,f),Ee(e,e.firstChild),e.appendChild(c),ce.set(e,l)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ds,yo,Ls,bo,_o,Eo,xo,So,vo,pt,wo=u(()=>{window.JSCompiler_renameProperty=(t,e)=>t;yo={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}},Ls=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),bo={attribute:!0,type:String,converter:yo,reflect:!1,hasChanged:Ls},_o=1,Eo=1<<2,xo=1<<3,So=1<<4,vo="finalized",pt=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=bo){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)||bo}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(vo)||e.finalize(),this[vo]=!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=Ls){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||yo,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||yo.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=bo){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|xo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~xo}}_attributeToProperty(e,r){if(this._updateState&xo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|So,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~So}}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&So)&&(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|Eo;try{await this._updatePromise}catch{}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&Eo}get hasUpdated(){return this._updateState&_o}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&_o||(this._updateState=this._updateState|_o,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~Eo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(pt,"UpdatingElement");Ds=vo;pt[Ds]=!0});var js,id,Ms=u(()=>{js=Element.prototype,id=js.msMatchesSelector||js.webkitMatchesSelector});var ar,To,dt,Vs,ml,T,Oo=u(()=>{ar=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,To=Symbol(),dt=class{constructor(e,r){if(r!==To)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(ar?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(dt,"CSSResult");Vs=n(t=>new dt(String(t),To),"unsafeCSS"),ml=n(t=>{if(t instanceof dt)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"),T=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+ml(s)+t[i+1],t[0]);return new dt(r,To)},"css")});var $s,x,v=u(()=>{Fs();wo();wo();Ms();go();Oo();Oo();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");$s={},x=class extends pt{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((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&&!ar){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return Vs(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):ar?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!==$s&&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 $s}};n(x,"LitElement");x.finalized=!0;x.render=Us});var cr=K((yd,Bs)=>{var gl={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"};Bs.exports=gl});var zs=K((bd,Hs)=>{var Te=cr(),yl=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case Te.PAR_OPEN:case Te.PAR_CLOSE:case Te.OP_NOT:case Te.BINARY_AND:case Te.BINARY_OR:e&&(r.push({type:Te.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:Te.LITERAL,value:e}),r},"Tokenizer");Hs.exports=yl});var Ws=K((_d,Gs)=>{var le=cr(),bl=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case le.LITERAL:e.unshift(s);break;case le.BINARY_AND:case le.BINARY_OR:case le.OP_NOT:case le.PAR_OPEN:r.push(s);break;case le.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==le.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===le.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),_l=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");Gs.exports={PolishNotation:bl,PolishGenerator:_l}});var Qs=K((Ed,Ys)=>{var I=cr(),j=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===I.LEAF}isAtomic(){return this.isLeaf()||this.op===I.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(I.BINARY_AND,e,r)}static CreateNot(e){return new j(I.OP_NOT,e)}static CreateOr(e,r){return new j(I.BINARY_OR,e,r)}static CreateLiteral(e){return new j(I.LEAF,null,null,e)}};n(j,"ExpNode");var Me=n(t=>{let e=t.next().value;switch(e.type){case I.LITERAL:return j.CreateLiteral(e.value);case I.OP_NOT:return j.CreateNot(Me(t));case I.BINARY_AND:{let r=Me(t),o=Me(t);return j.CreateAnd(r,o)}case I.BINARY_OR:{let r=Me(t),o=Me(t);return j.CreateOr(r,o)}}return null},"make"),Ve=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===I.OP_NOT)return!Ve(t.left,e);if(t.op===I.BINARY_OR)return Ve(t.left,e)||Ve(t.right,e);if(t.op===I.BINARY_AND)return Ve(t.left,e)&&Ve(t.right,e)},"nodeEvaluator");Ys.exports={make:Me,nodeEvaluator:Ve}});var Xs=K((xd,Zs)=>{var El=zs(),Js=Ws(),Ks=Qs(),xl=n((t,e)=>{let r=El(t),o=Js.PolishNotation(r),s=Js.PolishGenerator(o),i=Ks.make(s);return Ks.nodeEvaluator(i,e)},"parse");Zs.exports={parse:xl}});var Sl,ei,Co,vl,Po,D,lr,M=u(()=>{v();Sl=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"),ei=n(t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},"buildProduct"),Co=n(t=>{let e=ei(t);if(!e){let r=t.offer;r&&(e=ei(r))}return e},"resolveProduct"),vl=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Po=n(t=>class extends t{get offer(){return vl(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"),D=n(t=>class extends Po(t){get product(){return Co(this)}},"withProduct"),lr=n(t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){let e=[],r=null;this.querySelectorAll("option").forEach(o=>{let s=Sl(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),this._childOptions={options:e,isSelected:r},super.connectedCallback&&super.connectedCallback()}},"withChildOptions")});var ur={};b(ur,{eligibilityGroups:()=>oi,eligible:()=>ti,hasUpcomingOrder:()=>si,hasUpsellGroup:()=>ni,inStock:()=>Ro,regularEligible:()=>Ol,subscribed:()=>wl,subscriptionEligible:()=>ri,upcomingOrderContainsProduct:()=>Tl,upsellEligible:()=>ii});var Ro,ti,ri,oi,ni,wl,si,Tl,ii,Ol,ai=u(()=>{W();Ro=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ti=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),ri=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ti(t,e)&&Ro(t,e),"subscriptionEligible"),oi=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),ni=n((t,e)=>{let r=oi(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),wl=n((t,e)=>Tn(e.product)(t),"subscribed"),si=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Tl=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ii=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&Ro(t,e)&&si(t)&&ni(t,e),"upsellEligible"),Ol=n((t,e)=>ri(t,e)&&!ii(t,e),"regularEligible")});var di={};b(di,{ConnectedWhen:()=>pi,When:()=>pr,default:()=>Cl,mapStateToProps:()=>ui,removeWhitespace:()=>li});var ci,li,pr,ui,pi,Cl,fi=u(()=>{v();ci=de(Xs());R();M();ai();li=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),pr=class extends D(x){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&ci.default.parse(li(this.test),r=>ur[r]&&ur[r](this.state,this))?p`
13
+ <slot></slot>
14
+ `:p``}shouldUpdate(e){return e.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}};n(pr,"When");ui=n(t=>({state:t}),"mapStateToProps"),pi=m(ui)(pr),Cl=pi});var hi,ue,dr,$e,pe=u(()=>{oe();hi={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},ue={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&Vt(t)?t:null}}},dr={type:Boolean,attribute:!0,reflect:!0},$e={type:Object,attribute:!1}});var Pl,B,Be=u(()=>{v();W();Pl=n(t=>class extends t{getOption(e,r=e){let o=Br(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"),B=Pl(x)});var gi={};b(gi,{ConnectedOptinStatus:()=>mi,OptinStatus:()=>L,default:()=>Rl,mapStateToProps:()=>H});var L,H,mi,Rl,He=u(()=>{v();W();R();pe();M();Be();L=class extends D(B){static get properties(){return{subscribed:dr,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return T`
148
15
  :host {
149
16
  cursor: default;
150
17
  display: inline-block;
@@ -197,61 +64,61 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
197
64
  text-align: center;
198
65
  overflow: visible;
199
66
  }
200
- `}constructor(){super(),this.addEventListener("click",this.handleClick.bind(this))}updated(t){t.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?n.c`
67
+ `}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?p`
201
68
  <slot name="subscribed"></slot>
202
69
  <slot name="frequency-mismatch"></slot>
203
- `:this.subscribed&&this.defaultFrequency===this.frequency?n.c`
70
+ `:this.subscribed&&this.defaultFrequency===this.frequency?p`
204
71
  <slot name="subscribed"></slot>
205
72
  <slot name="frequency-match"></slot>
206
- `:this.subscribed&&this.defaultFrequency!==this.frequency?n.c`
73
+ `:this.subscribed&&this.defaultFrequency!==this.frequency?p`
207
74
  <slot name="subscribed"></slot>
208
75
  <slot name="frequency-mismatch"></slot>
209
- `:n.c`
76
+ `:p`
210
77
  <slot name="not-subscribed"></slot>
211
- `}}const l=(t,e={})=>({subscribed:Object(o.e)(e.product)(t),frequency:Object(o.h)(e.product)(t),...Object(o.b)(t,e,"defaultFrequency"),...Object(o.k)(t,e)}),d=Object(i.connect)(l)(u);e.default=d},function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));var n=r(1),o=r(2);const i=(s=n.a,class extends s{getOption(t,e=t){const r=Object(o.d)(t);if(this.hasAttribute(r)){const t=this.getAttribute(r);return"true"===t.toString().toLowerCase()||"false"!==t.toString().toLowerCase()&&t}return this.template&&this.template.config&&void 0!==this.template.config[e]?this.template.config[e]:this.config&&void 0!==this.config[e]?this.config[e]:void 0}applyTemplate(t){this.template=t;const e=void 0===t.markup?this.constructor.initialTemplate:t.markup;e&&this._templateMarkup!==e&&(this._templateMarkup=e,this.innerHTML=e)}refreshTemplate(){if(this._templates&&this._templates.length){const t=this._templates.find(({selector:t})=>{try{return this.matches(t)}catch(t){return!1}});this.applyTemplate(t||{})}}set templates(t){this._templates=t,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}});var s},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";r.d(e,"a",(function(){return y})),r.d(e,"b",(function(){return d})),r.d(e,"c",(function(){return u})),r.d(e,"d",(function(){return g})),r.d(e,"e",(function(){return a}));var n=r(24),o=function(){return Math.random().toString(36).substring(7).split("").join(".")},i={INIT:"@@redux/INIT"+o(),REPLACE:"@@redux/REPLACE"+o(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+o()}};function s(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function a(t,e,r){var o;if("function"==typeof e&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])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("function"==typeof e&&void 0===r&&(r=e,e=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(a)(t,e)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var c=t,u=e,l=[],d=l,p=!1;function f(){d===l&&(d=l.slice())}function h(){if(p)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return u}function g(t){if("function"!=typeof t)throw new Error("Expected the listener to be a function.");if(p)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var e=!0;return f(),d.push(t),function(){if(e){if(p)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");e=!1,f();var r=d.indexOf(t);d.splice(r,1),l=null}}}function y(t){if(!s(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,u=c(u,t)}finally{p=!1}for(var e=l=d,r=0;r<e.length;r++){(0,e[r])()}return t}function m(t){if("function"!=typeof t)throw new Error("Expected the nextReducer to be a function.");c=t,y({type:i.REPLACE})}function b(){var t,e=g;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new TypeError("Expected the observer to be an object.");function r(){t.next&&t.next(h())}return r(),{unsubscribe:e(r)}}})[n.a]=function(){return this},t}return y({type:i.INIT}),(o={dispatch:y,subscribe:g,getState:h,replaceReducer:m})[n.a]=b,o}function c(t,e){var r=e&&e.type;return"Given "+(r&&'action "'+String(r)+'"'||"an action")+', 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.'}function u(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var o=e[n];0,"function"==typeof t[o]&&(r[o]=t[o])}var s,a=Object.keys(r);try{!function(t){Object.keys(t).forEach((function(e){var r=t[e];if(void 0===r(void 0,{type:i.INIT}))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(void 0===r(void 0,{type:i.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+e+"\" returned undefined when probed with a random type. Don't try to handle "+i.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.')}))}(r)}catch(t){s=t}return function(t,e){if(void 0===t&&(t={}),s)throw s;for(var n=!1,o={},i=0;i<a.length;i++){var u=a[i],l=r[u],d=t[u],p=l(d,e);if(void 0===p){var f=c(u,e);throw new Error(f)}o[u]=p,n=n||p!==d}return(n=n||a.length!==Object.keys(t).length)?o:t}}function l(t,e){return function(){return e(t.apply(this,arguments))}}function d(t,e){if("function"==typeof t)return l(t,e);if("object"!=typeof t||null===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var n in t){var o=t[n];"function"==typeof o&&(r[n]=l(o,e))}return r}function p(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?f(r,!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):f(r).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function g(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce((function(t,e){return function(){return t(e.apply(void 0,arguments))}}))}function y(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t){return function(){var r=t.apply(void 0,arguments),n=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},i=e.map((function(t){return t(o)}));return h({},r,{dispatch:n=g.apply(void 0,i)(r.dispatch)})}}}},function(t,e,r){"use strict";r.r(e),r.d(e,"frequencyText",(function(){return l})),r.d(e,"FrequencyStatus",(function(){return d})),r.d(e,"mapStateToProps",(function(){return p})),r.d(e,"ConnectedFrequencyStatus",(function(){return f}));var n=r(1),o=r(2),i=r(4),s=r(8),a=r(5),c=r(6),u=r(10);const l=(t,e)=>{const{every:r,every_period:o}=Object(a.parseFrequency)(t);return n.c`
78
+ `}};n(L,"OptinStatus");H=n((t,e={})=>({subscribed:z(e.product)(t),frequency:ne(e.product)(t),...G(t,e,"defaultFrequency"),...De(t,e)}),"mapStateToProps"),mi=m(H)(L),Rl=mi});var bi={};b(bi,{ConnectedOptinButton:()=>yi,OptinButton:()=>fr,default:()=>Al});var fr,yi,Al,_i=u(()=>{v();k();He();R();pe();M();fr=class extends L{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:ue,optinButtonLabel:{type:String}}}handleClick(e){this.optinProduct(Co(this),this.defaultFrequency),e.preventDefault()}render(){return p`
79
+ <slot name="default">
80
+ <button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
81
+ <label for="action-trigger">
82
+ <slot>
83
+ <slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
84
+ </slot>
85
+ </label>
86
+ </slot>
87
+ `}};n(fr,"OptinButton");yi=m(H,{optinProduct:Y})(fr),Al=yi});var xi={};b(xi,{ConnectedOptoutButton:()=>Ei,OptoutButton:()=>hr,default:()=>Nl});var hr,Ei,Nl,Si=u(()=>{v();k();He();R();hr=class extends L{static get properties(){return{...super.properties,label:{type:String}}}handleClick(e){this.optoutProduct(this.product),e.preventDefault()}render(){return p`
88
+ <slot name="default">
89
+ <button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
90
+ <label for="action-trigger">
91
+ <slot>
92
+ <og-text key="offerOptOutLabel"></og-text>
93
+ </slot>
94
+ </label>
95
+ </slot>
96
+ `}};n(hr,"OptoutButton");Ei=m(H,{optoutProduct:ye})(hr),Nl=Ei});var wi={};b(wi,{ConnectedFrequencyStatus:()=>vi,FrequencyStatus:()=>Ge,default:()=>kl,frequencyText:()=>ze,mapStateToProps:()=>We});var ze,Ge,We,vi,kl,mr=u(()=>{v();W();R();pe();oe();M();Be();ze=n((t,e)=>{let{every:r,every_period:o}=Ue(t);return p`
212
97
  ${r}
213
98
  <og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
214
- ${e&&e===t?n.c`
99
+ ${e&&e===t?p`
215
100
  <og-text key="defaultFrequencyCopy"></og-text>
216
101
  `:""}
217
- `};class d extends(Object(c.d)(u.a)){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:s.d,frequency:{type:String},defaultFrequency:s.b,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:a.parseFrequenciesList}}}}static get styles(){return n.b`
102
+ `},"frequencyText"),Ge=class extends D(B){static get properties(){return{...super.properties,disabled:{type:Boolean},subscribed:dr,frequency:{type:String},defaultFrequency:ue,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:Vr}}}}static get styles(){return T`
218
103
  :host[hidden] {
219
104
  display: none;
220
105
  }
221
106
  :host {
222
107
  display: inline-block;
223
108
  }
224
- `}constructor(){super(),this.frequencies=[]}render(){const t=this.frequency||this.defaultFrequency;return n.c`
109
+ `}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return p`
225
110
  <span>
226
- ${this.subscribed&&n.c`
227
- <slot name="subscribed">${l(t)} </slot>
111
+ ${this.subscribed&&p`
112
+ <slot name="subscribed">${ze(e)} </slot>
228
113
  `||""}
229
- ${!this.subscribed&&n.c`
114
+ ${!this.subscribed&&p`
230
115
  <slot name="not-subscribed"></slot>
231
116
  `||""}
232
- ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&n.c`
117
+ ${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&p`
233
118
  <slot name="frequency-mismatch"></slot>
234
119
  `||""}
235
120
  </span>
236
- `}}const p=(t,e)=>({subscribed:Object(o.e)(e.product)(t),frequency:Object(o.h)(e.product)(t),productDefaultFrequency:Object(o.g)((e.product||{}).id)(t),...Object(o.b)(t,e,"frequencies",[]),...Object(o.b)(t,e,"defaultFrequency"),...Object(o.k)(t,e)}),f=Object(i.connect)(p)(d);e.default=f},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"STORE_ROOT",(function(){return s})),r.d(e,"safeParseState",(function(){return a})),r.d(e,"loadState",(function(){return u})),r.d(e,"serializeState",(function(){return l})),r.d(e,"saveState",(function(){return d})),r.d(e,"listenLocalStorageChanges",(function(){return p})),r.d(e,"clearState",(function(){return f}));var n=r(17),o=r(3),i=r(0);const s="OG_STATE",a=t=>{try{if(null===t)return;return JSON.parse(t)}catch(t){return}},c=()=>window.og&&window.og.previewMode,u=()=>c()?{}:a(localStorage.getItem(s)),l=t=>!(!t||!t.sessionId)&&JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),d=t=>{if(c())return;const e=l(t);e&&localStorage.getItem(s)!==e&&localStorage.setItem(s,e)},p=e=>Object(n.throttle)(500,r=>{if(c())return;const{key:n,newValue:u}=r;n===s&&null===u?(e.dispatch({type:i.j}),t(()=>e.dispatch(Object(o.requestSessionId)()))):n===s&&e.dispatch({type:i.i,newValue:a(u)})}),f=()=>localStorage.removeItem(s)}.call(this,r(16).setImmediate)},function(t,e,r){window,t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"ogAuthRegExp",(function(){return n})),r.d(e,"readAuthCookie",(function(){return o})),r.d(e,"parseAuth",(function(){return i})),r.d(e,"iframeLoad",(function(){return s})),r.d(e,"isJsonResponse",(function(){return a})),r.d(e,"resolveAuth",(function(){return c}));const n=/^og_auth=/,o=(t=n)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(n,""),i=t=>{if("object"==typeof t)return t;const e=(t||"").split("|");return 3===e.length?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},s=t=>new Promise((e,r)=>{const n=document.createElement("iframe");n.style.setProperty("display","none","important"),document.body.appendChild(n),n.onload=e,n.onerror=r,n.src=t}),a=t=>-1!==(t.headers.get("content-type")||"").indexOf("application/json"),c=(t,e=o,r=s)=>Promise.resolve(e()||t&&"string"==typeof t&&fetch(t).then(n=>n.status>=200&&n.status<300?e()||(a(n)?n.json():Promise.resolve(r(t)).then(e)):null)).then(i).then(t=>null===t?Promise.reject(new Error("Unauthorized")):t);e.default=c}])},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(19),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(11))},function(t,e,r){!function(t){"use strict";function e(t,e,r,n){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function c(){for(var c=arguments.length,u=new Array(c),l=0;l<c;l++)u[l]=arguments[l];var d=this,p=Date.now()-s;function f(){s=Date.now(),r.apply(d,u)}function h(){o=void 0}i||(n&&!o&&f(),a(),void 0===n&&p>t?f():!0!==e&&(o=setTimeout(n?h:f,void 0===n?t-p:t)))}return"boolean"!=typeof e&&(n=r,r=e,e=void 0),c.cancel=function(){a(),i=!0},c}t.debounce=function(t,r,n){return void 0===n?e(t,r,!1):e(t,n,!1!==r)},t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})}(e)},,function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,o,i,s,a,c=1,u={},l=!1,d=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){h(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){h(t.data)},n=function(t){i.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(o=d.documentElement,n=function(t){var e=d.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):n=function(t){setTimeout(h,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&h(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var o={callback:t,args:e};return u[c]=o,n(c),c++},p.clearImmediate=f}function f(t){delete u[t]}function h(t){if(l)setTimeout(h,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{f(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(11),r(20))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!l){var t=a(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++d<e;)c&&c[d].run();d=-1,e=u.length}c=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new h(t,e)),1!==u.length||l||a(f)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){const r={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"};t.exports=r},,function(t,e,r){"use strict";r.r(e),r.d(e,"optedin",(function(){return a})),r.d(e,"optedout",(function(){return c})),r.d(e,"nextUpcomingOrder",(function(){return u})),r.d(e,"autoshipEligible",(function(){return l})),r.d(e,"inStock",(function(){return d})),r.d(e,"eligibilityGroups",(function(){return p})),r.d(e,"incentives",(function(){return h})),r.d(e,"frequency",(function(){return g})),r.d(e,"auth",(function(){return y})),r.d(e,"merchantId",(function(){return m})),r.d(e,"authUrl",(function(){return b})),r.d(e,"offer",(function(){return v})),r.d(e,"offerId",(function(){return _})),r.d(e,"sessionId",(function(){return w})),r.d(e,"productOffer",(function(){return O})),r.d(e,"firstOrderPlaceDate",(function(){return S})),r.d(e,"productToSubscribe",(function(){return x})),r.d(e,"environment",(function(){return E})),r.d(e,"locale",(function(){return T})),r.d(e,"config",(function(){return C})),r.d(e,"previewStandardOffer",(function(){return P})),r.d(e,"previewUpsellOffer",(function(){return k})),r.d(e,"autoshipByDefault",(function(){return j})),r.d(e,"defaultFrequencies",(function(){return q})),r.d(e,"templates",(function(){return A}));var n=r(12),o=r(0),i=r(2),s=r(5);const a=(t=[],e)=>{switch(e.type){case o.j:return[];case o.i:return e.newValue?e.newValue.optedin:t;case o.k:case o.m:const[[r],n]=t.reduce((t,r)=>t[Object(i.c)(e.payload.product,r)?0:1].push(r)&&t,[[],[]]);return(n||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case o.l:return t.filter(t=>!Object(i.c)(e.payload.product,t));case o.n:return t.map(t=>Object(i.c)(e.payload.product,t)?{...t,...e.payload.newProduct}:t);case o.e:return t.filter(t=>!Object(i.c)(e.payload.product,t));case o.c:return[];default:return t}},c=(t=[],e)=>{switch(e.type){case o.j:return[];case o.i:return e.newValue?e.newValue.optedout:t;case o.k:case o.m:return t.filter(t=>!Object(i.c)(e.payload.product,t));case o.l:const[[r],n]=t.reduce((t,r)=>t[Object(i.c)(e.payload.product,r)?0:1].push(r)&&t,[[],[]]);return(n||[]).concat({...r,...e.payload.product,frequency:e.payload.frequency});case o.n:return t.map(t=>Object(i.c)(e.payload.product,t)?{...t,...e.payload.newProduct}:t);case o.c:return[];default:return t}},u=(t={},{type:e,payload:r})=>{switch(e){case o.q: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 o.r:return{...t,products:(r.results||[]).map(t=>t.product)};case o.g:return{...t,...r,public_id:r.order,...r.product&&{products:(t.products||[]).concat(r.product)}};default:return t}},l=(t={},e)=>{switch(e.type){case o.p:return{...t,...e.payload.autoship};default:return t}},d=(t={},e)=>{switch(e.type){case o.p:return{...t,...e.payload.in_stock};default:return t}},p=(t={},e)=>{switch(e.type){case o.p:return{...t,...e.payload.eligibility_groups};default:return t}},f=(t,e)=>t.map(t=>({...e[t],id:[t][0]})),h=(t={},e)=>{switch(e.type){case o.p:return{...t,...[...new Set(Object.keys(e.payload.incentives||{}))].reduce((t,r)=>({...t,[r]:Object.entries(e.payload.incentives).filter(([t])=>t===r).reduce((t,[,{initial:r,ongoing:n}])=>({...t,initial:[...t.initial||[],...f(r,e.payload.incentives_display)],ongoing:[...t.ongoing||[],...f(n,e.payload.incentives_display)]}),{})}),{})};default:return t}},g=(t={},e)=>{switch(e.type){case o.k:case o.m:return{...t,[e.payload.product]:e.payload.frequency};case o.l:return{...t,[e.payload.product]:void 0};default:return t}},y=(t=!1,e)=>{switch(e.type){case o.b:return{...e.payload};case o.J:return!1;default:return t}},m=(t="",e)=>{switch(e.type){case o.E:return e.payload;default:return t}},b=(t=null,e)=>{switch(e.type){case o.x:return e.payload;default:return t}},v=(t={},e)=>{switch(e.type){case o.p:return{...t,offerId:(e.payload.module_view||{}).regular,...e.payload.modifiers};default:return t}},_=(t="",e)=>{switch(e.type){case o.p:return(e.payload.module_view||{}).regular||"";default:return t}},w=(t=null,e)=>{switch(e.type){case o.j:return null;case o.f:return e.payload;default:return t}},O=(t={},e)=>{switch(e.type){case o.p:return{...t,...Object.entries(e.payload.autoship).map(([t])=>({[t]:Object.keys(e.payload.modifiers)})).reduce((t,e)=>({...t,...e}))};case o.c:return{};default:return t}},S=(t={},e)=>{switch(e.type){case o.C:return{...t,[e.payload.product]:e.payload.firstOrderPlaceDate};default:return t}},x=(t={},e)=>{switch(e.type){case o.H:return{...t,[e.payload.product]:e.payload.productToSubscribe};default:return t}},E=(t={},e)=>{switch(e.type){case o.B:return{...t,name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"};case o.z:return{...t,name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"};case o.A:return{...t,name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"};default:return t}},T=(t={offerOptInLabel:"Subscribe",offerOptOutLabel:"Purchase one time",offerEveryLabel:"Every",offerTooltipTrigger:"Hover for additional info",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"•",optoutButtonLabel:"•",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"•",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:"(Recommended)",frequencyPeriods:{1:"day",2:"week",3:"month"}},e)=>{switch(e.type){case o.D:return{...t,...e.payload};default:return t}},C=(t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case o.y:return{...t,...e.payload,defaultFrequency:e.payload.defaultFrequency?Object(s.stringifyFrequency)(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(s.stringifyFrequency):t.frequencies};default:return t}},P=(t=!1,e)=>{switch(e.type){case o.F:return e.payload;default:return t}},k=(t=!1,e)=>{switch(e.type){case o.G:return e.payload;default:return t}},j=(t=[],e)=>{switch(e.type){case o.p:return{...t,...e.payload.autoship_by_default};default:return t}},q=(t=[],e)=>{switch(e.type){case o.p:return{...t,...e.payload.default_frequencies};default:return t}},A=(t=[],e)=>{switch(e.type){case o.I:return[...e.payload||[]];case o.a:return[e.payload,...t];default:return t}};e.default=Object(n.c)({environment:E,optedin:a,optedout:c,merchantId:m,offer:v,offerId:_,productOffer:O,sessionId:w,inStock:d,eligibilityGroups:p,autoshipByDefault:j,autoshipEligible:l,incentives:h,nextUpcomingOrder:u,auth:y,authUrl:b,locale:T,config:C,previewStandardOffer:P,previewUpsellOffer:k,templates:A,defaultFrequencies:q,firstOrderPlaceDate:S,productToSubscribe:x})},function(t,e,r){"use strict";(function(t,n){var o,i=r(26);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:n;var s=Object(i.a)(o);e.a=s}).call(this,r(11),r(31)(t))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return u}));var n=r(17),o=r(0),i=(r(2),r(14));const s=e=>({payload:{product:{id:r,components:n}={}}={}}={})=>t(()=>((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})))("optin-changed",{productId:r,components:n,optedIn:e})),a=[{expressions:[({type:t}={})=>t===o.k,({type:t}={})=>t===o.m],fn:s(!0)},{expressions:[({type:t}={})=>t===o.l],fn:s(!1)}],c=t=>e=>r=>{const n=t.getState();a.forEach(t=>{t.expressions.some(t=>t(r,n))&&t.fn(r)}),e(r)},u=t=>e=>r=>{e(r);const s=Object(n.throttle)(500,()=>{Object(i.saveState)({...t.getState()})});r.type!==o.i&&s()}}).call(this,r(16).setImmediate)},function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}r.d(e,"a",(function(){return n}))},function(t,e,r){const n=r(33),o=r(34),i=r(35);t.exports={parse:(t,e)=>{const r=n(t),s=o.PolishNotation(r),a=o.PolishGenerator(s),c=i.make(a);return i.nodeEvaluator(c,e)}}},,function(t,e,r){const{offersLiveEditor:n}=r(30),{setStore:o}=r(4),{getStore:i}=r(51),{listenLocalStorageChanges:s}=r(14),a=r(32),c=r(3),{ConnectedWhen:u}=r(52),{ConnectedOptinButton:l}=r(36),{ConnectedOptoutButton:d}=r(37),{ConnectedOptinSelect:p}=r(38),{ConnectedUpsellButton:f}=r(39),{ConnectedUpsellModal:h}=r(40),{ConnectedOptinToggle:g}=r(41),{ConnectedOptinStatus:y}=r(9),{ConnectedText:m}=r(42),{ConnectedIncentiveText:b}=r(43),{ConnectedSelectFrequency:v}=r(44),{ConnectedNextUpcomingOrder:_}=r(53),{ConnectedOffer:w}=r(45),{Modal:O}=r(46),{Select:S}=r(47),{Tooltip:x}=r(48),{ConnectedFrequencyStatus:E}=r(13),T=r(49),{default:C}=r(5),{environment:P}=r(23);let k;T.enable();const j={setEnvironment:t=>(k.dispatch(c.setEnvironment(t)),j),setMerchantId:t=>(k.dispatch(c.setMerchantId(t)),j),setAuthUrl:t=>(k.dispatch(c.setAuthUrl(t)),j),getProductsForPurchasePost:(t=[])=>a.getProductsForPurchasePost(k.getState(),t),getOptins:(t=[])=>a.getProductsForPurchasePost(k.getState(),t),clear(){k.dispatch(c.checkout())},addOptinChangedCallback(t){"function"==typeof t&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",u),customElements.define("og-text",m),customElements.define("og-incentive-text",b),customElements.define("og-offer",w),customElements.define("og-select-frequency",v),customElements.define("og-optout-button",d),customElements.define("og-optin-toggle",g),customElements.define("og-optin-status",y),customElements.define("og-optin-button",l),customElements.define("og-optin-select",p),customElements.define("og-upsell-button",f),customElements.define("og-frequency-status",E),customElements.define("og-modal",O),customElements.define("og-select",S),customElements.define("og-tooltip",x),customElements.define("og-upsell-modal",h),customElements.define("og-next-upcoming-order",_)}catch(t){console.error(t)}j.register=()=>0},previewMode(t){return window.og=window.og||{},!1===t?delete window.og:window.og.previewMode=!0,this},initialize(t,e,r){if(j.isReady)return console.warn("og.offers has been initialized already. Skipping."),j;k=i();const n=window.og_settings;if(t&&e&&n){let r=[];n.product?r.push(n.product):n.cart&&Array.isArray(n.cart.products)&&(r=r.concat(n.cart.products));const{apiUrl:o}=P({},c.setEnvironment(e)),{sessionId:i}=k.getState();i&&r.forEach(e=>C.fetchOffer(o,t,i,`${e}`,"pdp"))}return o(k),t&&j.setMerchantId(t),e&&j.setEnvironment(e),r&&j.setAuthUrl(r),window.addEventListener("storage",s(k)),t&&e&&(k.dispatch(c.requestSessionId()),k.dispatch(c.fetchAuth()),j.register()),j.isReady=!0,j},config:t=>(k.dispatch(c.setConfig(t)),j),setLocale:t=>(k.dispatch(c.setLocale(t)),j),addTemplate:(t,e,r)=>(k.dispatch(c.addTemplate(t,e,r)),j),setTemplates:t=>(k.dispatch(c.setTemplates(t)),j),setPublicPath:t=>(r.p=t,j)};window.OG=window.OG||{},Object.assign(window.OG,j),Object.assign(j.initialize,j),n(),t.exports=j.initialize},function(t,e,r){window,t.exports=function(t){function e(e){for(var r,o,i=e[0],s=e[1],a=0,u=[];a<i.length;a++)o=i[a],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&u.push(n[o][0]),n[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r]);for(c&&c(e);u.length;)u.shift()()}var r={},n={0:0};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(t){var e=[],r=n[t];if(0!==r)if(r)e.push(r[2]);else{var i=new Promise((function(e,o){r=n[t]=[e,o]}));e.push(r[2]=i);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(t){return o.p+""+t+".offers-live-editor.js"}(t);var c=new Error;s=function(e){a.onerror=a.onload=null,clearTimeout(u);var r=n[t];if(0!==r){if(r){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",c.name="ChunkLoadError",c.type=o,c.request=i,r[1](c)}n[t]=void 0}};var u=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(e)},o.m=t,o.c=r,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="//static.ordergroove.com/@ordergroove/offers-live-editor/0.3.0/dist/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonp=window.webpackJsonp||[],s=i.push.bind(i);i.push=e,i=i.slice();for(var a=0;a<i.length;a++)e(i[a]);var c=s;return o(o.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"offersLiveEditor",(function(){return s}));const n=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],o=t=>(e,r)=>{n.forEach(n=>t.postMessage({ogType:e,...r},n))};function i(t){const e=(t=>e=>t.indexOf(e.origin)>=0)(n),s=o(t.source);e(t)&&"READY"===t.data.ogType&&r.e(1).then(r.bind(null,2)).then(({initializeClient:t})=>{t(e,s),window.removeEventListener("message",i)})}function s(t=window.opener){t&&t!==window&&(window.addEventListener("message",i),o(t)("READY"))}e.default=s}])},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,r){"use strict";r.r(e),r.d(e,"getProductsForPurchasePost",(function(){return o}));var n=r(5);const o=(t={},e=[])=>(t.optedin||[]).map(e=>{const r={product:e.id,subscription_info:{components:e.components||[]},tracking_override:{offer:((t.productOffer||{})[e.id]||[])[0],...Object(n.parseFrequency)(e.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[e.id]&&(r.subscription_info.first_order_place_date=t.firstOrderPlaceDate[e.id]),t.productToSubscribe&&t.productToSubscribe[e.id]&&(r.tracking_override.product=t.productToSubscribe[e.id]),r}).filter(t=>t.tracking_override.offer).filter(t=>e.length?e.includes(t.product):t);e.default={getProductsForPurchasePost:o}},function(t,e,r){const n=r(21);t.exports=t=>{let e="";const r=[];for(const o of t){const t=o.charCodeAt(0);switch(t){case n.PAR_OPEN:case n.PAR_CLOSE:case n.OP_NOT:case n.BINARY_AND:case n.BINARY_OR:e&&(r.push({type:n.LITERAL,value:e}),e=""),r.push({type:t,value:o});break;default:e+=o}}return e&&r.push({type:n.LITERAL,value:e}),r}},function(t,e,r){const n=r(21);t.exports={PolishNotation:t=>{const e=[],r=[];return t.forEach(t=>{switch(t.type){case n.LITERAL:e.unshift(t);break;case n.BINARY_AND:case n.BINARY_OR:case n.OP_NOT:case n.PAR_OPEN:r.push(t);break;case n.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==n.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===n.OP_NOT&&e.unshift(r.pop())}}),r.length&&[...r.reverse(),...e]||e},PolishGenerator:function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]}}},function(t,e,r){const n=r(21);class o{constructor(t,e,r,n){this.op=t,this.left=e,this.right=r,this.literal=n}isLeaf(){return this.op===n.LEAF}isAtomic(){return this.isLeaf()||this.op===n.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(t,e){return new o(n.BINARY_AND,t,e)}static CreateNot(t){return new o(n.OP_NOT,t)}static CreateOr(t,e){return new o(n.BINARY_OR,t,e)}static CreateLiteral(t){return new o(n.LEAF,null,null,t)}}const i=t=>{const e=t.next().value;switch(e.type){case n.LITERAL:return o.CreateLiteral(e.value);case n.OP_NOT:return o.CreateNot(i(t));case n.BINARY_AND:{const e=i(t),r=i(t);return o.CreateAnd(e,r)}case n.BINARY_OR:{const e=i(t),r=i(t);return o.CreateOr(e,r)}}return null},s=(t,e)=>t.isLeaf()?e(t.getLiteralValue()):t.op===n.OP_NOT?!s(t.left,e):t.op===n.BINARY_OR?s(t.left,e)||s(t.right,e):t.op===n.BINARY_AND?s(t.left,e)&&s(t.right,e):void 0;t.exports={make:i,nodeEvaluator:s}},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinButton",(function(){return u})),r.d(e,"ConnectedOptinButton",(function(){return l}));var n=r(1),o=r(3),i=r(9),s=r(4),a=r(8),c=r(6);class u extends i.OptinStatus{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:a.b,optinButtonLabel:{type:String}}}handleClick(t){this.optinProduct(Object(c.a)(this),this.defaultFrequency),t.preventDefault()}render(){return n.c`
237
- <slot name="default">
238
- <button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
239
- <label for="action-trigger">
240
- <slot>
241
- <slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
242
- </slot>
243
- </label>
244
- </slot>
245
- `}}const l=Object(s.connect)(i.mapStateToProps,{optinProduct:o.optinProduct})(u);e.default=l},function(t,e,r){"use strict";r.r(e),r.d(e,"OptoutButton",(function(){return a})),r.d(e,"ConnectedOptoutButton",(function(){return c}));var n=r(1),o=r(3),i=r(9),s=r(4);class a extends i.OptinStatus{static get properties(){return{...super.properties,label:{type:String}}}handleClick(t){this.optoutProduct(this.product),t.preventDefault()}render(){return n.c`
246
- <slot name="default">
247
- <button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
248
- <label for="action-trigger">
249
- <slot>
250
- <og-text key="offerOptOutLabel"></og-text>
251
- </slot>
252
- </label>
253
- </slot>
254
- `}}const c=Object(s.connect)(i.mapStateToProps,{optoutProduct:o.optoutProduct})(a);e.default=c},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinSelect",(function(){return l})),r.d(e,"ConnectedOptinSelect",(function(){return d}));var n=r(1),o=r(3),i=r(6),s=r(9),a=r(13),c=r(4),u=r(8);class l extends(Object(i.b)(s.OptinStatus)){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:u.b}}static get styles(){return n.b`
121
+ `}};n(Ge,"FrequencyStatus");We=n((t,e)=>({subscribed:z(e.product)(t),frequency:ne(e.product)(t),productDefaultFrequency:Bt((e.product||{}).id)(t),...G(t,e,"frequencies",[]),...G(t,e,"defaultFrequency"),...De(t,e)}),"mapStateToProps"),vi=m(We)(Ge),kl=vi});var Oi={};b(Oi,{ConnectedOptinSelect:()=>Ti,OptinSelect:()=>gr,default:()=>ql});var gr,Ti,ql,Ci=u(()=>{v();k();M();He();mr();R();pe();gr=class extends lr(L){static get properties(){return{...super.properties,frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:ue}}static get styles(){return T`
255
122
  :host {
256
123
  display: inline-block;
257
124
  cursor: pointer;
@@ -261,26 +128,26 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
261
128
  border-width: var(--og-select-border-width, 1px);
262
129
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
263
130
  }
264
- `}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(t){"optedOut"===t?this.optoutProduct(this.product):this.productChangeFrequency(this.product,t)}render(){const{options:t,isSelected:e}=this.childOptions;let r=t;return t.length||(r=[{value:"optedOut",text:n.c`
131
+ `}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:p`
265
132
  <og-text key="offerOptOutLabel"></og-text>
266
- `},...(this.frequencies||[]).map(t=>({value:t,text:Object(a.frequencyText)(t,this.defaultFrequency)}))]),n.c`
133
+ `},...(this.frequencies||[]).map(s=>({value:s,text:ze(s,this.defaultFrequency)}))]),p`
267
134
  <og-select
268
- .options="${r}"
269
- .selected="${e}"
270
- .onChange="${({target:{value:t}})=>this.onOptinChange(t)}"
135
+ .options="${o}"
136
+ .selected="${r}"
137
+ .onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
271
138
  ></og-select>
272
- `}}const d=Object(c.connect)((t,e)=>({...Object(s.mapStateToProps)(t,e),...Object(a.mapStateToProps)(t,e)}),{productChangeFrequency:o.productChangeFrequency,optoutProduct:o.optoutProduct})(l);e.default=d},function(t,e,r){"use strict";r.r(e),r.d(e,"UpsellButton",(function(){return u})),r.d(e,"mapStateToProps",(function(){return l})),r.d(e,"ConnectedUpsellButton",(function(){return d}));var n=r(1),o=r(3),i=r(4),s=r(8),a=r(6),c=r(10);class u extends(Object(a.d)(c.a)){static get styles(){return n.b`
139
+ `}};n(gr,"OptinSelect");Ti=m((t,e)=>({...H(t,e),...We(t,e)}),{productChangeFrequency:rt,optoutProduct:ye})(gr),ql=Ti});var Ri={};b(Ri,{ConnectedUpsellButton:()=>Il,UpsellButton:()=>ft,default:()=>Ul,mapStateToProps:()=>Pi});var ft,Pi,Il,Ul,Ai=u(()=>{v();k();R();pe();M();Be();ft=class extends D(B){static get styles(){return T`
273
140
  :host[hidden] {
274
141
  display: none;
275
142
  }
276
143
  :host {
277
144
  display: inline-block;
278
145
  }
279
- `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:s.a,isPreview:{type:Boolean,attribute:!1},target:{type:String}}}constructor(){super(),this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(t){t.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let t;if(!this.target&&this.offer)t=this.offer.querySelector("og-upsell-modal"),t||(t=this.offer.shadowRoot.querySelector("og-upsell-modal"));else{if(!this.target)throw Error("You must specify a target attribute or place this element as child of og-offer");t=document.querySelector(this.target)}t&&t.setAttribute("show",!0)}render(){return n.c`
146
+ `}static get properties(){return{...super.properties,upcomingOrderDate:{type:String,attribute:!1},auth:$e,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 p`
280
147
  <slot>
281
148
  <og-next-upcoming-order></og-next-upcoming-order>
282
149
  </slot>
283
- `}}const l=t=>({isPreview:t.previewUpsellOffer}),d=Object(i.connect)(l,{fetchOrders:o.fetchOrders})(u);e.default=u},function(t,e,r){"use strict";r.r(e),r.d(e,"UpsellModal",(function(){return l})),r.d(e,"mapStateToProps",(function(){return d})),r.d(e,"ConnectedUpsellModal",(function(){return p}));var n=r(1),o=r(3),i=r(4),s=r(8),a=r(2),c=r(6),u=r(10);class l extends(Object(c.d)(u.a)){static get properties(){return{...super.properties,defaultFrequency:s.b,auth:s.a,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.title="",this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return n.c`
150
+ `}};n(ft,"UpsellButton");Pi=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Il=m(Pi,{fetchOrders:nt})(ft),Ul=ft});var ki={};b(ki,{ConnectedUpsellModal:()=>Fl,UpsellModal:()=>ht,default:()=>Dl,mapStateToProps:()=>Ni});var ht,Ni,Fl,Dl,qi=u(()=>{v();k();R();pe();W();M();Be();ht=class extends D(B){static get properties(){return{...super.properties,defaultFrequency:ue,auth:$e,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 p`
284
151
  <og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
285
152
  <div slot="content">
286
153
  <slot>
@@ -318,7 +185,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
318
185
  </slot>
319
186
  </span>
320
187
  </og-modal>
321
- `}set defaultFrequency(t){this._defaultFrequency=t}get defaultFrequency(){const t=this.querySelector("og-select-frequency");return t?t.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")}}const d=(t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:Object(a.e)(e.product)(t),frequency:Object(a.h)(e.product)(t),...Object(a.b)(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),p=Object(i.connect)(d,{concludeUpsell:o.concludeUpsell,createIu:o.createIu})(l);e.default=l},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinToggle",(function(){return a})),r.d(e,"ConnectedOptinToggle",(function(){return c}));var n=r(1),o=r(3),i=r(9),s=r(4);class a extends i.OptinStatus{static get properties(){return{...super.properties,frequency:{type:String}}}handleClick(t){this.subscribed?this.optoutProduct(this.product):this.optinProduct(this.product,this.frequency||this.defaultFrequency),t.preventDefault()}render(){return n.c`
188
+ `}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(ht,"UpsellModal");Ni=n((t,e)=>({auth:t.auth,offerId:t.offerId,subscribed:z(e.product)(t),frequency:ne(e.product)(t),...G(t,e,"defaultFrequency"),nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Fl=m(Ni,{concludeUpsell:Yr,createIu:Kr})(ht),Dl=ht});var Ui={};b(Ui,{ConnectedOptinToggle:()=>Ii,OptinToggle:()=>yr,default:()=>Ll});var yr,Ii,Ll,Fi=u(()=>{v();k();He();R();yr=class extends L{static get properties(){return{...super.properties,frequency:{type:String}}}handleClick(e){this.subscribed?this.optoutProduct(this.product):this.optinProduct(this.product,this.frequency||this.defaultFrequency),e.preventDefault()}render(){return p`
322
189
  <slot name="default">
323
190
  <button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
324
191
  <label for="action-trigger">
@@ -327,13 +194,13 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
327
194
  ></slot>
328
195
  </label>
329
196
  </slot>
330
- `}}const c=Object(s.connect)(i.mapStateToProps,{optoutProduct:o.optoutProduct,optinProduct:o.optinProduct})(a);e.default=c},function(t,e,r){"use strict";r.r(e),r.d(e,"pluralize",(function(){return s})),r.d(e,"Text",(function(){return a})),r.d(e,"mapStateToProps",(function(){return c})),r.d(e,"ConnectedText",(function(){return u}));var n=r(1),o=r(4),i=r(6);const s=(t,e)=>`${t}${parseInt(e,10)>1?"s":""}`;class a extends(Object(i.c)(n.a)){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(t){const e={...this.i18n,...this.offer&&this.offer.locale},r=void 0!==e[t]?e[t]:"";return void 0===this.variant?r:r[this.variant]}getPluralizedText(t){return void 0===this.pluralize?t:t?s(t,this.pluralize):t}render(){return n.c`
197
+ `}};n(yr,"OptinToggle");Ii=m(H,{optoutProduct:ye,optinProduct:Y})(yr),Ll=Ii});var Mi={};b(Mi,{ConnectedText:()=>ji,Text:()=>br,default:()=>jl,mapStateToProps:()=>Li,pluralize:()=>Di});var Di,br,Li,ji,jl,Vi=u(()=>{v();R();M();Di=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),br=class extends Po(x){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&&Di(e,this.pluralize)}render(){return p`
331
198
  ${this.getText()}
332
- `}}const c=t=>({i18n:t.locale||{}}),u=Object(o.connect)(c)(a);e.default=u},function(t,e,r){"use strict";r.r(e),r.d(e,"DiscountAmount",(function(){return s})),r.d(e,"getTransformedDiscounts",(function(){return l})),r.d(e,"filterIncentives",(function(){return d})),r.d(e,"replaceText",(function(){return p})),r.d(e,"IncentiveText",(function(){return f})),r.d(e,"mapStateToProps",(function(){return h})),r.d(e,"ConnectedIncentiveText",(function(){return g}));var n=r(1),o=r(4),i=r(6);class s{constructor(t){this.value=t,this.className="DiscountAmount"}toString(){return`${this.value}`}}class a extends s{constructor(t){super(t),this.className="DiscountPercent"}toString(){return`${super.toString()}%`}}class c extends a{constructor(t){super(t),this.className="ShippingDiscountPercent"}toString(){return 100===this.value?"free shipping":super.toString()}}const u=({field:t,object:e,type:r,value:n})=>{const o=[[new a(n),{field:"total_price",object:"item",type:"Discount Percent"}],[new s(n),{field:"total_price",object:"item",type:"Discount Amount"}],[new c(n),{field:"shipping_total",object:"order",type:"Discount Percent"}],[new s(n),{field:"shipping_total",object:"order",type:"Discount Amount"}],[new a(n),{field:"sub_total",object:"order",type:"Discount Percent"}],[new s(n),{field:"sub_total",object:"order",type:"Discount Amount"}]].find(([,n])=>n.field===t&&n.object===e&&n.type===r);return o&&o[0]},l=t=>t.map(t=>u(t)).filter(t=>void 0!==t);function d(t){return u(t).className===this.incentiveClass&&(!this.incentiveValue||this.incentiveValue.toString()===t.value.toString())}function p(t,e){return t.replace(this.textToReplace,u(e))}class f extends(Object(i.d)(n.a)){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(){const t=this.from,e=this.value,r=this.initial?"initial":"ongoing",o=(this.incentives[r]||[]).find(d.bind({incentiveClass:t,incentiveValue:e}));return n.c`
333
- ${this.label} ${o?u(o):this.renderFallback()}
334
- `}renderFallback(){this.from,this.value,this.initial;return n.c`
335
- ${u({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
336
- `}}const h=(t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),g=Object(o.connect)(h)(f);e.default=g},function(t,e,r){"use strict";r.r(e),r.d(e,"frequencyEquals",(function(){return c})),r.d(e,"SelectFrequency",(function(){return u})),r.d(e,"ConnectedSelectFrequency",(function(){return l}));var n=r(1),o=r(3),i=r(6),s=r(13),a=r(4);const c=(t,e)=>null!==t&&null!==e&&(t.every===e.every&&t.period===e.period);class u extends(Object(i.b)(s.FrequencyStatus)){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return n.b`
199
+ `}};n(br,"Text");Li=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),ji=m(Li)(br),jl=ji});var Yi={};b(Yi,{ConnectedIncentiveText:()=>Wi,DiscountAmount:()=>Oe,IncentiveText:()=>_r,default:()=>$l,filterIncentives:()=>zi,getTransformedDiscounts:()=>Ml,mapStateToProps:()=>Gi,replaceText:()=>Vl});function zi(t){return!(gt(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}function Vl(t,e){return t.replace(this.textToReplace,gt(e))}var Oe,mt,Ao,No,ko,$i,Bi,Hi,gt,Ml,_r,Gi,Wi,$l,Qi=u(()=>{v();R();M();Oe=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Oe,"DiscountAmount");mt=class extends Oe{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(mt,"DiscountPercent");Ao=class extends mt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(Ao,"ShippingDiscountPercent");No="Discount Percent",ko="Discount Amount",$i="total_price",Bi="shipping_total",Hi="sub_total",gt=n(({field:t,object:e,type:r,value:o})=>{let i=[[new mt(o),{field:$i,object:"item",type:No}],[new Oe(o),{field:$i,object:"item",type:ko}],[new Ao(o),{field:Bi,object:"order",type:No}],[new Oe(o),{field:Bi,object:"order",type:ko}],[new mt(o),{field:Hi,object:"order",type:No}],[new Oe(o),{field:Hi,object:"order",type:ko}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder"),Ml=n(t=>t.map(e=>gt(e)).filter(e=>e!==void 0),"getTransformedDiscounts");n(zi,"filterIncentives");n(Vl,"replaceText");_r=class extends D(x){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(zi.bind({incentiveClass:e,incentiveValue:r}));return p`
200
+ ${this.label} ${s?gt(s):this.renderFallback()}
201
+ `}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return p`
202
+ ${gt({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
203
+ `}};n(_r,"IncentiveText");Gi=n((t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),"mapStateToProps"),Wi=m(Gi)(_r),$l=Wi});var Ki={};b(Ki,{ConnectedSelectFrequency:()=>Ji,SelectFrequency:()=>Er,default:()=>Hl,frequencyEquals:()=>Bl});var Bl,Er,Ji,Hl,Zi=u(()=>{v();k();M();mr();R();Bl=n((t,e)=>t===null||e===null?!1:t.every===e.every&&t.period===e.period,"frequencyEquals"),Er=class extends lr(Ge){static get properties(){return{...super.properties,defaultText:{type:String,attribute:"default-text"}}}static get styles(){return T`
337
204
  :host {
338
205
  display: inline-block;
339
206
  cursor: pointer;
@@ -344,13 +211,15 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
344
211
  box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
345
212
  z-index: 1;
346
213
  }
347
- `}set defaultFrequency(t){this._defaultFrequency=t}get defaultFrequency(){const{options:t,isSelected:e}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:e||(t.length?t[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(t,e){this.frequency=e}render(){let{options:t}=this.childOptions;t.length||(t=(this.frequencies||[]).map(t=>({value:t,text:Object(s.frequencyText)(t,this.defaultFrequency)})));const e=this.defaultFrequency;return t=t.map(({text:t,value:r})=>({text:r===e?`${t} ${(this.defaultText||"").trim()}`.trim():t,value:r})),n.c`
214
+ `}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:ze(o,this.defaultFrequency)})));let r=this.defaultFrequency;return e=e.map(({text:o,value:s})=>({text:s===r?`${o} ${(this.defaultText||"").trim()}`.trim():o,value:s})),p`
348
215
  <og-select
349
- .options="${t}"
216
+ .options="${e}"
350
217
  .selected="${this.currentFrequency}"
351
- .onChange="${({target:{value:t}})=>{this.productChangeFrequency(this.product,t)}}"
218
+ .onChange="${({target:{value:o}})=>{this.productChangeFrequency(this.product,o)}}"
352
219
  ></og-select>
353
- `}}const l=Object(a.connect)(s.mapStateToProps,{productChangeFrequency:o.productChangeFrequency})(u);e.default=l},function(t,e,r){"use strict";r.r(e),r.d(e,"productAndComponents",(function(){return d})),r.d(e,"Offer",(function(){return p})),r.d(e,"mapStateToProps",(function(){return f})),r.d(e,"ConnectedOffer",(function(){return h}));var n=r(1),o=r(7),i=r.n(o),s=r(4),a=r(3),c=r(2),u=r(8),l=r(10);const d=i()((t,e)=>Object.assign({components:e},t),(...t)=>JSON.stringify(t));class p extends l.a{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:u.c,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:u.a,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}}}firstUpdated(){const t=Array.from(this.getAttributeNames()).find(t=>t.startsWith("preview-"));"preview-standard-offer"===t?this.preview="regular":"preview-upsell-offer"===t?this.preview="upsell":"preview-subscribed-offer"===t&&(this.preview="subscribed")}static get styles(){return n.b`
220
+ `}};n(Er,"SelectFrequency");Ji=m(We,{productChangeFrequency:rt})(Er),Hl=Ji});var zl,Xi,ea=u(()=>{zl={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"}},Xi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=zl[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 ra={};b(ra,{ConnectedNextUpcomingOrder:()=>Gl,FormattedDate:()=>yt,default:()=>Wl,mapStateToProps:()=>ta});var yt,ta,Gl,Wl,oa=u(()=>{v();R();ea();yt=class extends x{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return p`
221
+ ${Xi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
222
+ `}};n(yt,"FormattedDate");ta=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Gl=m(ta)(yt),Wl=yt});var na,Yl,sa,ia=u(()=>{k();Ae();na=n((t,e)=>n(async function(o){await o({type:Ze,payload:t}),await o({type:Pe}),await o(be({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},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"]}}}))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Yl=n((t,e)=>n(async function(o,s){await o({type:Xe,payload:t});let{merchantId:i}=s();t?(await o(be({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},modifiers:{}})),await o(Gt({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 o(zt(i,"sig_field","ts","sig"))):await o(se())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),sa=n((t,e,r)=>async function(o,s){switch(await o({type:te}),await o({type:Ze,payload:!1}),await o({type:Xe,payload:!1}),t){case"regular":o(na(!0,r.product.id));break;case"upsell":o(Yl(!0,r.product.id));break;case"subscribed":o(na(!0,r.product.id)),o(Y(r.product,"2_2"));break;default:}},"setPreview")});var pa={};b(pa,{ConnectedOffer:()=>ua,Offer:()=>xr,default:()=>Jl,mapStateToProps:()=>la,productAndComponents:()=>ca});var aa,Ql,ca,xr,la,ua,Jl,da=u(()=>{v();aa=de(jt());R();ia();k();W();pe();Be();Ql=n((...t)=>JSON.stringify(t),"memoizeKey"),ca=(0,aa.default)((t,e)=>Object.assign({components:e},t),Ql),xr=class extends B{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:hi,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:$e,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}}}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 T`
354
223
  :host[hidden] {
355
224
  display: none;
356
225
  }
@@ -416,9 +285,82 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
416
285
  background-color: var(--og-confirm-button-background, #00449e);
417
286
  color: var(--og-confirm-button-color, #fff);
418
287
  }
419
- `}static get initialTemplate(){return'\n <og-when test="regularEligible">\n <div>\n <og-optout-button>\n <og-text key="offerOptOutLabel"></og-text>\n </og-optout-button>\n </div>\n <div>\n <og-optin-button>\n <og-text key="offerOptInLabel"></og-text>\n </og-optin-button>\n <og-tooltip placement="top-right">\n <div slot="trigger">\n <og-text key="offerTooltipTrigger"></og-text>\n </div>\n <div slot="content">\n <og-text key="offerTooltipContent"></og-text>\n </div>\n </og-tooltip>\n </div>\n <div style="margin-left: 1.5em">\n <og-text key="offerEveryLabel"></og-text>\n <og-select-frequency>\n <option value="3_1" selected>3 Days</option>\n <option value="1_2">1 Week</option>\n <option value="1_3">1 Month</option>\n </og-select-frequency>\n </div>\n </og-when>\n\n <og-when test="upsellEligible">\n <og-when test="!upcomingOrderContainsProduct">\n <div class="og-iu-offer">\n <og-text key="upsellButtonLabel"></og-text>\n <og-upsell-button>\n <button type="button">\n <og-text key="upsellButtonContent"></og-text>\n <og-next-upcoming-order></og-next-upcoming-order>\n </button>\n </og-upsell-button>\n <og-upsell-modal>\n <og-text key="upsellModalContent"></og-text>\n <br />\n\n <og-optout-button>\n <og-text key="upsellModalOptOutLabel"></og-text>\n </og-optout-button>\n\n <br />\n\n <og-optin-button>\n <og-text key="upsellModalOptInLabel"></og-text>\n </og-optin-button>\n <br />\n\n <og-text key="offerEveryLabel"></og-text>\n <og-select-frequency>\n <option value="3_1" selected>3 Days</option>\n <option value="1_2">1 Week</option>\n <option value="1_3">1 Month</option>\n </og-select-frequency>\n\n <button slot="confirm" class="og-modal__btn og-modal__btn-primary">\n <og-text key="upsellModalConfirmLabel"></og-text>\n </button>\n <button slot="cancel" class="og-modal__btn"><og-text key="upsellModalCancelLabel"></og-text></button>\n </og-upsell-modal>\n </div>\n </og-when>\n <og-when test="upcomingOrderContainsProduct">\n The product is in your next upcomming order\n </og-when>\n </og-when>\n '}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(t){super.applyTemplate(t);const{locale:e}=t;this.locale=e;const r=new CustomEvent("template-changed");this.dispatchEvent(r)}updated(t){if(t.has("preview")&&r.e(2).then(r.bind(null,54)).then(({setPreview:e})=>this.store.dispatch(e(this.preview,t.get("preview"),this))),this.frequency=this.defaultFrequency,t.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id),t.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),t.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),t.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),t.has("productComponents")){const e=d(this.product,this.productComponents),r=Object.assign({},this.product,{components:t.get("productComponents")});Object(c.c)(e,r)||this.productHasChangedComponents(e,r)}(t.has("offerId")||t.has("autoshipByDefault")||t.has("location")||t.has("product"))&&this.offerId&&this.autoshipByDefault&&"cart"===this.location&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(t=>Object(c.c)(t,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency)}get isPreview(){return this.preview}render(){return n.c`
288
+ `}static get initialTemplate(){return`
289
+ <og-when test="regularEligible">
290
+ <div>
291
+ <og-optout-button>
292
+ <og-text key="offerOptOutLabel"></og-text>
293
+ </og-optout-button>
294
+ </div>
295
+ <div>
296
+ <og-optin-button>
297
+ <og-text key="offerOptInLabel"></og-text>
298
+ </og-optin-button>
299
+ <og-tooltip placement="top-right">
300
+ <div slot="trigger">
301
+ <og-text key="offerTooltipTrigger"></og-text>
302
+ </div>
303
+ <div slot="content">
304
+ <og-text key="offerTooltipContent"></og-text>
305
+ </div>
306
+ </og-tooltip>
307
+ </div>
308
+ <div style="margin-left: 1.5em">
309
+ <og-text key="offerEveryLabel"></og-text>
310
+ <og-select-frequency>
311
+ <option value="3_1" selected>3 Days</option>
312
+ <option value="1_2">1 Week</option>
313
+ <option value="1_3">1 Month</option>
314
+ </og-select-frequency>
315
+ </div>
316
+ </og-when>
317
+
318
+ <og-when test="upsellEligible">
319
+ <og-when test="!upcomingOrderContainsProduct">
320
+ <div class="og-iu-offer">
321
+ <og-text key="upsellButtonLabel"></og-text>
322
+ <og-upsell-button>
323
+ <button type="button">
324
+ <og-text key="upsellButtonContent"></og-text>
325
+ <og-next-upcoming-order></og-next-upcoming-order>
326
+ </button>
327
+ </og-upsell-button>
328
+ <og-upsell-modal>
329
+ <og-text key="upsellModalContent"></og-text>
330
+ <br />
331
+
332
+ <og-optout-button>
333
+ <og-text key="upsellModalOptOutLabel"></og-text>
334
+ </og-optout-button>
335
+
336
+ <br />
337
+
338
+ <og-optin-button>
339
+ <og-text key="upsellModalOptInLabel"></og-text>
340
+ </og-optin-button>
341
+ <br />
342
+
343
+ <og-text key="offerEveryLabel"></og-text>
344
+ <og-select-frequency>
345
+ <option value="3_1" selected>3 Days</option>
346
+ <option value="1_2">1 Week</option>
347
+ <option value="1_3">1 Month</option>
348
+ </og-select-frequency>
349
+
350
+ <button slot="confirm" class="og-modal__btn og-modal__btn-primary">
351
+ <og-text key="upsellModalConfirmLabel"></og-text>
352
+ </button>
353
+ <button slot="cancel" class="og-modal__btn"><og-text key="upsellModalCancelLabel"></og-text></button>
354
+ </og-upsell-modal>
355
+ </div>
356
+ </og-when>
357
+ <og-when test="upcomingOrderContainsProduct">
358
+ The product is in your next upcomming order
359
+ </og-when>
360
+ </og-when>
361
+ `}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{locale:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&this.product.id&&!this.isPreview&&this.fetchOffer(this.product.id),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=ca(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});N(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&this.location==="cart"&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>N(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency)}get isPreview(){return this.preview}render(){return p`
420
362
  <slot></slot>
421
- `}get defaultFrequency(){const t=this.productFrequency||this.productDefaultFrequency;if(t)return t;const e=this.querySelector("og-select-frequency");return e&&e.currentFrequency?e.currentFrequency:this.getOption("defaultFrequency")}}const f=(t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:Object(c.h)(e.product)(t),productDefaultFrequency:Object(c.g)((e.product||{}).id)(t),...Object(c.b)(t,e,"autoshipByDefault",Object(c.a)(t)[(e.product||{}).id]),...Object(c.f)(e.product)(t)&&{autoshipByDefault:!1},optedin:Object(c.j)(t),subscribed:Object(c.e)(e.product)(t),...Object(c.k)(t)}),h=Object(s.connect)(f,{fetchOffer:a.fetchOffer,fetchOrders:a.fetchOrders,productHasChangedComponents:a.productHasChangedComponents,optinProduct:a.optinProduct,setFirstOrderPlaceDate:a.setFirstOrderPlaceDate,setProductToSubscribe:a.setProductToSubscribe})(p);e.default=h},function(t,e,r){"use strict";r.r(e),r.d(e,"Modal",(function(){return o}));var n=r(1);class o extends n.a{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 n.b`
363
+ `}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(xr,"Offer");la=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:ne(e.product)(t),productDefaultFrequency:Bt((e.product||{}).id)(t),...G(t,e,"autoshipByDefault",$r(t)[(e.product||{}).id]),...On(e.product)(t)&&{autoshipByDefault:!1},optedin:$t(t),subscribed:z(e.product)(t),...De(t)}),"mapStateToProps"),ua=m(la,{fetchOffer:Jr,fetchOrders:nt,productHasChangedComponents:Wr,optinProduct:Y,setFirstOrderPlaceDate:Zr,setProductToSubscribe:Xr,setPreview:sa})(xr),Jl=ua});var fa={};b(fa,{Modal:()=>Sr,default:()=>Kl});var Sr,Kl,ha=u(()=>{v();Sr=class extends x{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 T`
422
364
  :host[hidden] {
423
365
  display: none;
424
366
  }
@@ -530,7 +472,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
530
472
  .btn {
531
473
  cursor: pointer;
532
474
  }
533
- `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?n.c`
475
+ `}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?p`
534
476
  <span @click="${()=>this.confirm()}">
535
477
  <slot name="confirm" class="btn">
536
478
  <button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
@@ -538,7 +480,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
538
480
  </button>
539
481
  </slot>
540
482
  </span>
541
- `:n.c``}get cancelButton(){return this.showCancelButton?n.c`
483
+ `:p``}get cancelButton(){return this.showCancelButton?p`
542
484
  <span @click="${()=>this.close()}" class="btn">
543
485
  <slot name="cancel">
544
486
  <button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">
@@ -546,7 +488,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
546
488
  </button>
547
489
  </slot>
548
490
  </span>
549
- `:n.c``}render(){return this.show?n.c`
491
+ `:p``}render(){return this.show?p`
550
492
  <div class="og-modal is-open" aria-hidden="true">
551
493
  <div class="og-modal__overlay" tabindex="-1">
552
494
  <div class="og-modal__container" role="dialog" aria-modal="true">
@@ -565,7 +507,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
565
507
  </div>
566
508
  </div>
567
509
  </div>
568
- `:n.c``}}e.default=o},function(t,e,r){"use strict";r.r(e),r.d(e,"Select",(function(){return o}));var n=r(1);class o extends n.a{static get styles(){return n.b`
510
+ `:p``}};n(Sr,"Modal");Kl=Sr});var ma={};b(ma,{Select:()=>vr,default:()=>Zl});var vr,Zl,ga=u(()=>{v();vr=class extends x{static get styles(){return T`
569
511
  :host {
570
512
  display: inline-block;
571
513
  color: inherit;
@@ -624,10 +566,10 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
624
566
  line-height: 0.2em;
625
567
  transform: scaleY(0.5);
626
568
  }
627
- `}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return n.c`
569
+ `}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return p`
628
570
  <select @change="${this.onChange}" .value="${this.selected}">
629
- ${this.options.map(t=>n.c`
630
- <option value="${t.value}" ?selected=${this.selected===t.value}>${t.text}</option>
571
+ ${this.options.map(e=>p`
572
+ <option value="${e.value}" ?selected=${this.selected===e.value}>${e.text}</option>
631
573
  `)}
632
574
  </select>
633
575
  <span>&#9660;</span>
@@ -635,7 +577,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
635
577
  <path d="M10.5 15l7.5 7.5 7.5-7.5z" />
636
578
  <path d="M0 0h36v36h-36z" fill="none" />
637
579
  </svg> -->
638
- `}}e.default=o},function(t,e,r){"use strict";r.r(e),r.d(e,"Tooltip",(function(){return o}));var n=r(1);class o extends n.a{static get properties(){return{placement:{type:String,default:"top"}}}static get styles(){return n.b`
580
+ `}};n(vr,"Select");Zl=vr});var ya={};b(ya,{Tooltip:()=>wr,default:()=>Xl});var wr,Xl,ba=u(()=>{v();wr=class extends x{static get properties(){return{placement:{type:String,default:"top"}}}static get styles(){return T`
639
581
  :host[hidden] {
640
582
  display: none;
641
583
  }
@@ -782,7 +724,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
782
724
  pointer-events: auto;
783
725
  transform: translateY(0px);
784
726
  }
785
- `}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){const t=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),e=this.shadowRoot.querySelector(".content"),r=e.getBoundingClientRect();this.placement&&"top"!==this.placement&&"bottom"!==this.placement?"left"!==this.placement&&"right"!==this.placement||(e.style.top=`${(-1*r.height+t.height)/2}px`):e.style.left=`${(-1*r.width+t.width)/2}px`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return n.c`
727
+ `}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return p`
786
728
  <span class="tooltip">
787
729
  <span class="trigger">
788
730
  <slot name="trigger">
@@ -795,9 +737,104 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
795
737
  </slot>
796
738
  </div>
797
739
  </span>
798
- `}}e.default=o},function(t,e,r){"use strict";r.r(e),r.d(e,"keys",(function(){return n})),r.d(e,"enable",(function(){return o}));const n=[79,71,68,69,86],o=()=>{let t=0;document.addEventListener("keyup",(async function(e){if(e.which===n[t]){const e=n[t];setTimeout((function(){t<=e&&(t=0)}),5e3),t+=1,t>=n.length&&r.e(3).then(r.bind(null,22)).then(({default:t})=>{t()})}else t=0}),!1)};e.default=o},,function(t,e,r){"use strict";r.r(e);var n=r(12);function o(t){return function(e){var r=e.dispatch,n=e.getState;return function(e){return function(o){return"function"==typeof o?o(r,n,t):e(o)}}}}var i=o();i.withExtraArgument=o;var s=i,a=r(23),c=r(14),u=r(25);function l(){if(window.og&&window.og.store)return window.og.store;const t=window.og&&window.og.previewMode,e="object"==typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):n.d,r=[s,u.a];t||r.push(u.b);const o=e(Object(n.a)(...r)),i=Object(n.e)(a.default,t?{}:Object(c.loadState)(),o);return window.og=window.og||{},window.og.store=i,i}r.d(e,"getStore",(function(){return l}));e.default=l},function(t,e,r){"use strict";r.r(e);var n={};r.r(n),r.d(n,"inStock",(function(){return l})),r.d(n,"eligible",(function(){return d})),r.d(n,"subscriptionEligible",(function(){return p})),r.d(n,"eligibilityGroups",(function(){return f})),r.d(n,"hasUpsellGroup",(function(){return h})),r.d(n,"subscribed",(function(){return g})),r.d(n,"hasUpcomingOrder",(function(){return y})),r.d(n,"upcomingOrderContainsProduct",(function(){return m})),r.d(n,"upsellEligible",(function(){return b})),r.d(n,"regularEligible",(function(){return v}));var o=r(1),i=r(27),s=r.n(i),a=r(4),c=r(6),u=r(2);const l=(t,e)=>(t.inStock||{})[(e.product||{}).id],d=(t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,p=(t,e)=>!(!t.offerId||"0"===t.offerId)&&d(t,e)&&l(t,e),f=(t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,h=(t,e)=>{const r=f(t,e);return null===r||!!r.find(t=>"upsell"===t||"impulse_upsell"===t)},g=(t,e)=>Object(u.i)(e.product)(t),y=t=>!(!t.nextUpcomingOrder||!t.nextUpcomingOrder.public_id),m=(t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),b=(t,e)=>t.offerId&&"0"!==t.offerId&&t.auth&&l(t,e)&&y(t)&&h(t,e),v=(t,e)=>p(t,e)&&!b(t,e);r.d(e,"removeWhitespace",(function(){return _})),r.d(e,"When",(function(){return w})),r.d(e,"mapStateToProps",(function(){return O})),r.d(e,"ConnectedWhen",(function(){return S}));const _=t=>t.replace(/(\r\n|\n|\r|\s)+/gm,"");class w extends(Object(c.d)(o.a)){static get properties(){return{...super.properties,state:{type:Object,attribute:!1},test:{type:String}}}render(){return this.test&&s.a.parse(_(this.test),t=>n[t]&&n[t](this.state,this))?o.c`
799
- <slot></slot>
800
- `:o.c``}shouldUpdate(t){return t.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}}const O=t=>({state:t}),S=Object(a.connect)(O)(w);e.default=S},function(t,e,r){"use strict";r.r(e);var n=r(1),o=r(4);const i={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"}};r.d(e,"FormattedDate",(function(){return s})),r.d(e,"mapStateToProps",(function(){return a})),r.d(e,"ConnectedNextUpcomingOrder",(function(){return c}));class s extends n.a{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return n.c`
801
- ${t=this.value,e=this.format||"{{month-long}} {{day}}, {{year-numeric}}",t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,e=>{const r=e.replace(/[{}]/g,""),n=i[r];if(void 0===n)return r;const o=new Intl.DateTimeFormat("en-us",n).formatToParts(t),[{value:s}]=o;return s}):t}
802
- `;var t,e}}const a=t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),c=Object(o.connect)(a)(s);e.default=s}])}));
803
- //# sourceMappingURL=offers.js.map
740
+ `}};n(wr,"Tooltip");Xl=wr});var _a={};b(_a,{TestWizard:()=>Tr,default:()=>eu});var Tr,eu,Ea=u(()=>{v();k();Tr=class extends x{static get styles(){return T`
741
+ :host {
742
+ position: fixed;
743
+ top: 5em;
744
+ right: 5em;
745
+ background-color: rgba(255, 255, 255, 0.7);
746
+ width: 400px;
747
+ padding: 1em;
748
+ border-radius: 5px;
749
+ border: 1px solid #ccc;
750
+ box-shadow: 2px 2px 0 0 #000;
751
+ }
752
+
753
+ button {
754
+ margin: 0 0.5em 0.5em;
755
+ background-color: gray;
756
+ color: white;
757
+ border: 0;
758
+ border-radius: 3px;
759
+ cursor: pointer;
760
+ padding: 0.5em;
761
+ }
762
+
763
+ button.primary {
764
+ background-color: blue;
765
+ padding: 1em;
766
+ color: white;
767
+ border: 0;
768
+ border-radius: 3px;
769
+ }
770
+
771
+ button[disabled] {
772
+ background-color: #777;
773
+ }
774
+
775
+ div {
776
+ margin-bottom: 0.5em;
777
+ }
778
+
779
+ .message {
780
+ margin-left: 0.5em;
781
+ margin: 1em;
782
+ }
783
+
784
+ .success {
785
+ color: green;
786
+ }
787
+
788
+ .error {
789
+ color: red;
790
+ }
791
+
792
+ .warning {
793
+ color: orange;
794
+ }
795
+ a {
796
+ color: white;
797
+ }
798
+ `}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?p`
799
+ <div class="message error">No offer element found on the page</div>
800
+ `:this.results.map((e,r)=>p`
801
+ <div>For offer tag with product = "${e.product}"</div>
802
+ ${e.messages.map(o=>p`
803
+ <div class="message ${o.type}">
804
+ ${o.name}
805
+ </div>
806
+ `)}
807
+ <button @click=${this.toggleProductFlags(r,{})}>
808
+ Set inStock and eligible
809
+ </button>
810
+ <br />
811
+ <button @click=${this.toggleProductFlags(r,{inStock:!1})}>
812
+ Set to not inStock
813
+ </button>
814
+ <br />
815
+ <button @click=${this.toggleProductFlags(r,{autoship:!1})}>
816
+ Set to not eligible
817
+ </button>
818
+ <br />
819
+ <button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
820
+ Set to not eligible and not in stock
821
+ </button>
822
+ <br />
823
+ <button @click=${this.toggleUpsellPreview(r)}>
824
+ Toggle upsell/regular in this offer
825
+ </button>
826
+ <br />
827
+ <button @click=${this.toggleUpsellNextOrder(r)}>
828
+ upsell product is in next order
829
+ </button>
830
+ <br />
831
+ `)}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(be({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(Wt({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 p`
832
+ <div>
833
+ ${this.testsRan?this.resultsCodeBlock():p`
834
+ <div>Click the button to run tests</div>
835
+ `}
836
+ <button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
837
+ </div>
838
+ `}};n(Tr,"TestWizard");eu=Tr});function qo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,tu);let e=document.createElement(t);document.body.appendChild(e)}var tu,xa=u(()=>{({TestWizard:tu}=(Ea(),_a));n(qo,"default")});var va={};b(va,{default:()=>ru,enable:()=>Sa,keys:()=>Or});var Or,Sa,ru,wa=u(()=>{xa();Or=[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===Or[t]){let o=Or[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Or.length&&qo()}else t=0},!1)},"enable"),ru=Sa});var Cu=K((ih,Oa)=>{var{offersLiveEditor:ou}=(Lo(),Do),{setStore:nu}=(R(),Wo),{getStore:su}=(Ss(),xs),{listenLocalStorageChanges:iu}=(Qt(),hs),Ta=(Ts(),ws),V=(k(),ps),{ConnectedWhen:au}=(fi(),di),{ConnectedOptinButton:cu}=(_i(),bi),{ConnectedOptoutButton:lu}=(Si(),xi),{ConnectedOptinSelect:uu}=(Ci(),Oi),{ConnectedUpsellButton:pu}=(Ai(),Ri),{ConnectedUpsellModal:du}=(qi(),ki),{ConnectedOptinToggle:fu}=(Fi(),Ui),{ConnectedOptinStatus:hu}=(He(),gi),{ConnectedText:mu}=(Vi(),Mi),{ConnectedIncentiveText:gu}=(Qi(),Yi),{ConnectedSelectFrequency:yu}=(Zi(),Ki),{ConnectedNextUpcomingOrder:bu}=(oa(),ra),{ConnectedOffer:_u}=(da(),pa),{Modal:Eu}=(ha(),fa),{Select:xu}=(ga(),ma),{Tooltip:Su}=(ba(),ya),{ConnectedFrequencyStatus:vu}=(mr(),wi),wu=(wa(),va),{default:Tu}=(oe(),vn),{environment:Ou}=(zr(),Zn);wu.enable();var A,w={setEnvironment(t){return A.dispatch(V.setEnvironment(t)),w},setMerchantId(t){return A.dispatch(V.setMerchantId(t)),w},setAuthUrl(t){return A.dispatch(V.setAuthUrl(t)),w},getProductsForPurchasePost(t=[]){return Ta.getProductsForPurchasePost(A.getState(),t)},getOptins(t=[]){return Ta.getProductsForPurchasePost(A.getState(),t)},clear(){A.dispatch(V.checkout())},addOptinChangedCallback(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",au),customElements.define("og-text",mu),customElements.define("og-incentive-text",gu),customElements.define("og-offer",_u),customElements.define("og-select-frequency",yu),customElements.define("og-optout-button",lu),customElements.define("og-optin-toggle",fu),customElements.define("og-optin-status",hu),customElements.define("og-optin-button",cu),customElements.define("og-optin-select",uu),customElements.define("og-upsell-button",pu),customElements.define("og-frequency-status",vu),customElements.define("og-modal",Eu),customElements.define("og-select",xu),customElements.define("og-tooltip",Su),customElements.define("og-upsell-modal",du),customElements.define("og-next-upcoming-order",bu)}catch(t){console.log("this?",t)}w.register=()=>0},previewMode(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this},initialize(t,e,r){if(w.isReady)return console.warn("og.offers has been initialized already. Skipping."),w;A=su();let o=window.og_settings;if(t&&e&&o){let s=[];o.product?s.push(o.product):o.cart&&Array.isArray(o.cart.products)&&(s=s.concat(o.cart.products));let{apiUrl:i}=Ou({},V.setEnvironment(e)),{sessionId:a}=A.getState();a&&s.forEach(c=>Tu.fetchOffer(i,t,a,`${c}`,"pdp"))}return nu(A),t&&w.setMerchantId(t),e&&w.setEnvironment(e),r&&w.setAuthUrl(r),window.addEventListener("storage",iu(A)),t&&e&&(A.dispatch(V.requestSessionId()),A.dispatch(V.fetchAuth()),w.register()),w.isReady=!0,w},config(t){return A.dispatch(V.setConfig(t)),w},setLocale(t){return A.dispatch(V.setLocale(t)),w},addTemplate(t,e,r){return A.dispatch(V.addTemplate(t,e,r)),w},setTemplates(t){return A.dispatch(V.setTemplates(t)),w},setPublicPath(t){return w}};window.OG=window.OG||{};Object.assign(window.OG,w);Object.assign(w.initialize,w);ou();Oa.exports=w.initialize});return Cu();})();
839
+ ; return lib; });
840
+ //# sourceMappingURL=offers.js.map