"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[29],{307:(t,e,n)=>{const r=n(131);(0,n(4).createEntrypoint)("initCart",r.InitCartContainer)()},131:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{c(r.next(t))}catch(t){a(t)}}function u(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,u)}c((r=r.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.InitCartContainer=void 0;const o=n(0),a=n(1),i=n(3),u=n(308);e.InitCartContainer=({useSharedState:t})=>{const e=t(),{cart:n,customer:c,shouldGenerateNewCartByForce:s,initCart:d,updateCartCustomer:C}=e((t=>({cart:t.cart,checkout:t.checkout,customer:t.customer,shouldGenerateNewCartByForce:t.shouldGenerateNewCartByForce,initCart:t._initCart,updateCartCustomer:t.updateCartCustomer})));return(0,u.useSaveCartItems)(n.itemsCount),(0,i.useEffect)((()=>{n.id&&!s||n.id||function(){r(this,void 0,void 0,(function*(){try{yield d()}catch(t){console.error("Cart has not been created")}}))}()}),[s]),(0,i.useEffect)((()=>{const t=null==n?void 0:n.id,e=null==c?void 0:c.entityId,r=t&&t.length>0;e&&e>0&&r&&n.customer_id!==e&&C()}),[null==n?void 0:n.id,null==c?void 0:c.entityId]),(0,o.jsx)(a.Fragment,{})}},308:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.useSaveCartItems=void 0;const r=n(3);e.useSaveCartItems=function(t){const[e,n]=(0,r.useState)(!1);(0,r.useEffect)((()=>{n(!0)}),[e]),(0,r.useEffect)((()=>{e&&"undefined"!=typeof document&&(document.cookie=`cart_items=${t}; path=/;`)}),[e,t])}}},t=>{t.O(0,[1,2],(()=>(307,t(t.s=307)))),t.O()}]);