Liferay.Loader.define("commerce-frontend-js@4.0.75/components/mini_cart/Opener",["module","exports","require","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./MiniCartContext"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(r("@frontend-taglib-clay$clayui/icon")),a=_interopRequireDefault(r("liferay!frontend-js-react-web$classnames")),i=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=n?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"))),o=_interopRequireDefault(r("./MiniCartContext"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var u=function Opener(){const{cartState:e,displayTotalItemsQuantity:t,openCart:r}=(0,i.useContext)(o.default),{cartItems:u=[],summary:c={}}=e,{itemsQuantity:f}=c,[l,d]=(0,i.useState)(0);return(0,i.useEffect)((()=>{d(f)}),[f,d]),(0,i.useEffect)((()=>{d(t&&"itemsQuantity"in c?c.itemsQuantity:u.length)}),[u,t,c,d]),i.default.createElement("button",{className:(0,a.default)({"has-badge":l>0,"mini-cart-opener":!0}),"data-badge-count":l,onClick:r},i.default.createElement(n.default,{symbol:"shopping-cart"}))};t.default=u}}));
//# sourceMappingURL=Opener.js.map