1"use strict";(self.webpackChunkb2c_checkout=self.webpackChunkb2c_checkout||[]).push([[147],{66382:function(e,t,n){n.d(t,{K:function(){return b}});var i=n(99797),r=(n(92842),n(34578)),o=n(75590),s=n(1413),a=n(93433),l=n(29439),c=n(25567),d=n(20043),u=n(41813),m=n(76910),p=n(47313),h=n(75627),x=n(46417),g=function(e){var t,n=e.deliveryOptions,g=e.isCart,v=e.sellerId,f=e.sellersAmount,b=e.purchaseNumber,j=void 0===b?0:b,y=e.isThankYouScreen,C=void 0!==y&&y,S=(0,i.i)(),k=S.setPickUpStoreSelected,I=S.setSelectedShippingKey,w=S.selectedShippingKey,T=S.shippingInfo,Z=S.handleUpdateTotalizers,W=(0,o.$G)().t,z=(0,p.useState)(),B=(0,l.Z)(z,2),U=B[0],P=B[1],L=(0,h.cI)(),A=L.register,M=L.setValue,O=(0,L.watch)("selectedShipping"),D=[{label:W("components.cart.deliveryOption.delivery"),textAlign:"left"},{label:W("components.cart.deliveryOption.receiveDeadline"),textAlign:"center"},{label:W("components.cart.deliveryOption.price"),textAlign:"right"}],E=null===n||void 0===n?void 0:n.some((function(e){return e.value===m.l.PickUp}));(0,p.useEffect)((function(){var e=(0,c.WJ)(u.b.isPickUpChoose)&&E||1===n.length&&E?m.l.PickUp:m.l.Normal;if(L.setValue("selectedShipping",e),e===m.l.Normal)return k(void 0);P({sellerId:v})}),[n.length,E]),(0,p.useEffect)((function(){O&&I((function(e){return e&&!e.some((function(e){return e===O}))&&f&&f>1?[].concat((0,a.Z)(e),[O]):[O]}))}),[O]),(0,p.useEffect)((function(){var e,t,n,i;if(U){var r=null===T||void 0===T||null===(e=T.optionsBySeller)||void 0===e?void 0:e.find((function(e){return!!e.pickUpStoreOptions}));((null===r||void 0===r?void 0:r.sellerId)===U.sellerId?null===r||void 0===r||null===(t=r.pickUpStoreOptions)||void 0===t?void 0:t[0]:null===T||void 0===T||null===(n=T.optionsBySeller)||void 0===n||null===(i=n[0].pickUpStoreOptions)||void 0===i?void 0:i[0])&&k({sellerId:U.sellerId})}}),[U,null===T||void 0===T||null===(t=T.optionsBySeller)||void 0===t?void 0:t.length]);var F=(0,p.useMemo)((function(){var e=function(e,t,n,i){var r=t===m.l.PickUp,o=W(r?"components.cart.deliveryOption.pickUpFrom":"components.cart.deliveryOption.until");if(r){if(n&&n>0)return"".concat(o," ").concat((0,d.p6)(e),"*");if(i)return 1===i?"".concat(o," ").concat(W("components.cart.deliveryOption.anHour")):"".concat(o," ").concat(i," ").concat(W("components.cart.deliveryOption.hours"))}return e?"".concat(o," ").concat((0,d.p6)(e),"*"):W("components.cart.deliveryOption.deadlineNotInformed")},t=function(e){return e.value===m.l.PickUp?W("components.cart.deliveryOption.pickUp"):W("components.cart.deliveryOption.receiveAtHome")};return null===n||void 0===n?void 0:n.map((function(n){return(0,s.Z)((0,s.Z)({},n),{},{deliveryTime:e(n.estimatedDelivery,n.value,n.deliveryDate,n.deliveryHours),label:t(n)})}))}),[n,W]),V=(0,p.useCallback)((function(e,t,n){!e&&M("selectedShipping",t);var i=w&&!w.some((function(e){return e===t}))&&f&&f>1?[].concat((0,a.Z)(w),[t]):[t];t===m.l.Normal?((0,c.xf)(u.b.isPickUpChoose),k(void 0)):((0,c.FY)(u.b.isPickUpChoose,"true"),P({sellerId:v})),Z(n,i)}),[]);return(0,x.jsx)(r.kCb,{borderTopWidth:{base:"0",md:"0.0625rem"},paddingBottom:{base:"0.5rem",md:g?"1.5rem":"0.75rem"},paddingTop:"0.75rem","data-testid":C?"delivery-option-purchase-".concat(j):void 0,children:(0,x.jsx)(r.xJi,{flex:"1","data-testid":"delivery-options",children:(0,x.jsxs)(r.iA_,{variant:"unstyled",children:[(0,x.jsx)(r.hrZ,{children:(0,x.jsx)(r.Tr,{display:{base:"none",md:g?"table-row":"none"},children:D.map((function(e){return(0,x.jsx)(r.Th,{border:"none",color:"neutral.800",fontSize:"1rem",fontWeight:"500",paddingX:"0",textAlign:e.textAlign,textTransform:"capitalize",children:e.label},e.label)}))})}),(0,x.jsx)(r.p3B,{children:F.map((function(e){return(0,x.jsxs)(r.Tr,{_last:{border:"none"},borderBottomWidth:"0.0625rem",onClick:function(){return V(O===e.value,e.value,T)},children:[(0,x.jsx)(r.Td,{_hover:{cursor:"pointer"},flexDir:"row",maxW:{base:"7.5rem",md:"5.5rem"},paddingX:"0",children:(0,x.jsxs)(r.kCb,{children:[(0,x.jsx)(h.RV,(0,s.Z)((0,s.Z)({},L),{},{children:(0,x.jsx)(r.Y8K,(0,s.Z)((0,s.Z)({},A("selectedShipping")),{},{_disabled:{_checked:{_before:{backgroundColor:"neutral.200",height:"0.625rem !important",width:"0.625rem !important"},backgroundColor:"neutral.0 !important",borderColor:"neutral.200 !important",borderWidth:"0.125rem"}},borderColor:"blue.500",display:g?"inline-flex":"none",isDisabled:1===(null===n||void 0===n?void 0:n.length),isChecked:O===e.value,onClick:function(e){return e.stopPropagation()},size:"lg",value:e.value,variant:"gradio"}))})),(0,x.jsxs)(r.kCb,{flexDirection:"column",children:[(0,x.jsx)(r.xvT,{as:"span",color:"neutral.700",fontSize:"1rem",fontWeight:"600",marginLeft:g?"1.5rem":"0",children:e.label}),(0,x.jsx)(r.xvT,{as:"span",color:"neutral.600",display:{base:"block",md:"none"},fontSize:"0.75rem",fontWeight:"400",marginLeft:g?"1.5rem":"unset",marginTop:"0.2rem",children:e.deliveryTime})]})]})}),(0,x.jsx)(r.Td,{color:"neutral.600",display:{base:"none",md:"table-cell"},paddingX:"0",textAlign:"center",children:e.deliveryTime}),(0,x.jsx)(r.Td,{color:"success.500",fontSize:"md",fontWeight:"500",paddingX:"0",textAlign:"right",children:e.shippingCost?(0,x.jsx)(r.bb5,{colorAndWeight:!0,children:e.shippingCost}):W("components.cart.deliveryOption.free")})]},e.label)}))}),g&&E&&(0,x.jsx)(r.Rn9,{color:"neutral.800",marginTop:"0",maxW:"5.5rem",paddingX:"0",textAlign:"left",children:W("components.cart.deliveryOption.pickUpPointInformationNextStage")})]})})})},v=n(64081),f=n(58467),b=function(e){var t=e.deliveredBy,n=e.deliveryOptions,s=e.haveStock,a=e.isCart,l=void 0!==a&&a,c=e.purchaseNumber,d=void 0===c?0:c,u=e.sellerId,m=e.sellerName,p=e.sellersAmount,h=(0,o.$G)().t,b=(0,i.i)().shippingInfo,j=(0,f.TH)(),y=!(null===n||void 0===n||!n.length)&&!!s||!(null===n||void 0===n||!n.length)&&!l,C=l&&!(null!==n&&void 0!==n&&n.length)&&!(null!==b&&void 0!==b&&b.errorMessage)&&!!s,S=j.pathname===v.X.thankYou;return(0,x.jsxs)(r.xuv,{children:[(0,x.jsx)(r.kCb,{alignItems:"flex-end",flexDirection:"column",width:"full","data-testid":S?"delivery-seller-box-".concat(d):void 0,children:(0,x.jsxs)(r.kCb,{borderColor:"neutral.100",borderTopWidth:{base:"none",md:"0.063rem"},flexDirection:"column",gap:"1",paddingBottom:{base:"0",md:"1.5rem"},paddingTop:"1.5rem",width:{base:"full",md:"82%"},children:[!!m&&(0,x.jsx)(x.Fragment,{children:m===t?(0,x.jsxs)(r.xvT,{color:"neutral.600",children:[h("components.cart.sellerBox.soldAndDeliveredBy")," ",(0,x.jsx)("b",{children:m})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(r.xvT,{color:"neutral.600",children:[h("components.cart.sellerBox.soldBy")," ",(0,x.jsx)("b",{children:m})]}),(0,x.jsxs)(r.xvT,{color:"neutral.600",children:[h("components.cart.sellerBox.deliveredBy")," ",(0,x.jsx)("b",{children:t})]})]})}),C&&(0,x.jsx)(r.xvT,{color:"neutral.600",fontWeight:"600",paddingBottom:{base:"1.5rem",md:0},children:h("components.cart.sellerBox.informationToCalculateShipping")})]})}),y&&(0,x.jsx)(g,{deliveryOptions:n,isCart:l,sellerId:u||0,sellersAmount:p,isThankYouScreen:S,purchaseNumber:d})]})}},67001:function(e,t,n){n.d(t,{P:function(){return o}});var i=n(34578),r=n(46417),o=function(e){var t=e.onClick,n=e.isDisabled;return(0,r.jsx)(i.PZ7,{isDisabled:n,size:"sm",color:"primary.500",bgColor:"primary.50",borderRadius:"full",onClick:t,_focus:{outline:"none"}})}},9383:function(e,t,n){n.d(t,{M:function(){return a}});var i=n(34578),r=n(31808),o=n(75590),s=n(46417),a=function(e){var t=e.label,n=e.value,a=e.discount,l=e.isLoading,c=e.isValueShipping,d=(0,o.$G)().t,u=0==n;
1return(0,s.jsxs)(i.kCb,{justifyContent:"space-between",mb:"6","data-testid":"value-line(".concat(t,")"),children:[(0,s.jsx)(i.xvT,{children:t}),(0,s.jsx)(i.xvT,{fontWeight:500,opacity:l?.4:1,color:a&&!u||c&&u?"success.500":"",children:c&&u?d("components.delivery.deliveryType.freeShipping"):"".concat(a||u?"-":"").concat(n>0?(0,r.x)(n):"")})]})}},90147:function(e,t,n){n.r(t),n.d(t,{CartTemplate:function(){return me},default:function(){return he}});var i,r,o=n(1413),s=n(93433),a=n(29439),l=n(74165),c=n(15861),d=n(99797),u=n(29641),m=n(25567),p=n(41813),h=n(34578),x=n(47313),g=n(67001),v=n(97158),f=(n(92842),n(56191)),b=n(15405),j=n(22857),y=n(75627),C=n(75590),S=n(46417),k=function(e){var t,n=e.haveError,i=e.shippingInfo,r=e.zipcode;return(0,S.jsx)(S.Fragment,{children:!!r&&!(null===i||void 0===i||!i.address)&&!!i.options.length&&!n&&(0,S.jsxs)(h.Ugi,{alignItems:"flex-start",marginTop:"1rem !important",w:"full",children:[(0,S.jsx)(h.tMq,{color:"neutral.700",height:"1.5rem",width:"1.5rem"}),(0,S.jsx)(h.xvT,{"data-testid":"shipping-title",color:"neutral.700",fontSize:{base:"sm",md:"md"},fontWeight:"normal",children:(t=i.address,(t.street?t.street+" - ":"")+(t.district?t.district+" - ":"")+"".concat(t.city," - ").concat(t.state))})]})})},I=function(e){var t,n,i,r,s,u=e.onSubmit,I=e.shippingInfo,w=e.informedZipcode,T=(0,C.$G)().t,Z=(0,x.useState)(!1),W=(0,a.Z)(Z,2),z=W[0],B=W[1],U=(0,x.useState)(!1),P=(0,a.Z)(U,2),L=P[0],A=P[1],M=(0,d.i)(),O=M.calculateShippingSmartDelivery,D=M.setShippingInfo,E=M.handleUpdateTotalizers,F=M.calculateShipping,V=M.setZipCode,R=M.setLoadingShipping,q=(0,v.d)().executeCallbackByFeatureFlag,_=(0,y.Gc)(),N=_.watch,G=_.register,Y=_.setError,$=_.handleSubmit,K=_.formState,Q=K.errors,X=K.isSubmitting,J=_.setValue,H=_.clearErrors,ee=(0,x.useCallback)(function(){var e=(0,c.Z)((0,l.Z)().mark((function e(t){var n,i,r,o;return(0,l.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.zipcode,i=t.isManual,r=void 0!==i&&i,n){e.next=3;break}return e.abrupt("return");case 3:return J("zipcode",n),R(!0),e.next=7,q("smart_delivery",(0,c.Z)((0,l.Z)().mark((function e(){return(0,l.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(n,!1,!0);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),(0,c.Z)((0,l.Z)().mark((function e(){return(0,l.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F(n,!1);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))));case 7:o=e.sent,B(!1),(0,m.FY)(p.b.cep,n),r&&(0,m.FY)(p.b.cepOrigin,b.U.MANUAL),V(n),Y("zipcode",{type:"manual",message:null!==o&&void 0!==o?o:void 0}),u(n);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[]);(0,x.useEffect)((function(){var e=(0,m.WJ)(p.b.cep);if(e){var t=(0,j.Kr)(e);B(!0),ee({zipcode:t})}}),[ee]),(0,x.useEffect)((function(){var e=N((function(e,t){"zipcode"===t.name&&A(!!e.zipcode)})).unsubscribe;return function(){return e()}}),[N]);var te=(0,x.useCallback)((function(e){var t,n=null===(t=e.target)||void 0===t?void 0:t.value.length;(n&&n<9||0===n)&&D(void 0),J("zipcode",e.target.value)}),[]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(h.Ugi,{alignItems:"start",as:"form",maxW:{base:"none",md:"26.5rem"},onSubmit:$((function(e){return ee({zipcode:e.zipcode,isManual:!0})})),w:"100%",children:[(0,S.jsx)(h.Icd,(0,o.Z)((0,o.Z)({"data-testid":"zipcode-input"},G("zipcode")),{},{borderColor:"neutral.90",errorMessage:"CEP inv\xe1lido"===(null===Q||void 0===Q||null===(t=Q.zipcode)||void 0===t?void 0:t.message)?(0,S.jsx)(f.c,{errorMessage:null===Q||void 0===Q||null===(n=Q.zipcode)||void 0===n?void 0:n.message,icon:h.OeB}):null===Q||void 0===Q||null===(i=Q.zipcode)||void 0===i?void 0:i.message,inputProps:{mask:"99999-999",maskChar:null},isDisabled:X||z,isInvalid:Boolean(null===Q||void 0===Q||null===(r=Q.zipcode)||void 0===r?void 0:r.message),mr:"2",name:"zipcode",placeholder:T("components.calculateShipping.shippingForm.typeZipcode"),onChange:te,rightElement:L&&(0,S.jsx)(g.P,{isDisabled:X||z,onClick:function(){J("zipcode",""),(0,m.xf)(p.b.cep),H("zipcode"),D(void 0),E(void 0,[])}})})),(0,S.jsx)(h.Jiv,{"data-testid":"calculate-shipping-button",isLoading:X||z,label:T("components.calculateShipping.shippingForm.calculate"),loadingText:T("components.calculateShipping.shippingForm.calculating"),px:"7",type:"submit",variant:"secondary"})]}),(0,S.jsx)(k,{haveError:!(null===(s=Q.zipcode)||void 0===s||!s.message),shippingInfo:I,zipcode:w})]})},w=function(){var e=(0,d.i)(),t=e.shippingInfo,n=e.cartListBySeller,i=e.zipCode,r=e.setZipCode,o=e.calculateShipping,s=e.calculateShippingSmartDelivery,a=e.isSmartQuoteWithCartReturn,g=e.setIsSmartQuoteWithCartReturn,f=(0,v.d)().executeCallbackByFeatureFlag,b=(0,C.$G)().t,j=(0,u.w)().setAddress;(0,x.useEffect)((function(){i&&i===(0,m.WJ)(p.b.cep)&&!a&&f("smart_delivery",(0,c.Z)((0,l.Z)().mark((function e(){return(0,l.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s(i,!1,!0);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),(0,c.Z)((0,l.Z)().mark((function e(){return(0,l.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o(i,!1);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))),a&&g(!1)}),[n]);return(0,S.jsx)(h.gCW,{alignItems:"start","data-testid":"shipping-observations",maxW:"52.5rem",paddingTop:{base:"1.5rem",md:"3rem"},paddingBottom:{base:"0.25rem",md:"2.75rem"},px:{base:4,md:0},w:"full",children:(0,S.jsxs)(h.Ugi,{alignItems:"start",display:"grid",gridTemplateColumns:["2rem 1fr","2.55rem 1fr"],w:"full",children:[(0,S.jsx)(h.xuv,{gridColumn:"1",children:(0,S.jsx)(h.czB,{height:"1.4rem",marginTop:"0.5",width:"1.3rem"})}),(0,S.jsxs)(h.gCW,{alignItems:"start",gridColumn:"2",m:"0 !important",w:"full",children:[(0,S.jsx)(h.xvT,{color:"neutral.800",fontSize:{base:"md",md:"lg"},fontWeight:"600",children:b("components.calculateShipping.shippingTitle.calculateShipping")}),(0,S.jsx)(h.xvT,{color:"neutral.600",fontSize:{base:"sm",md:"md"},fontWeight:"normal",marginBottom:"0.6rem !important",marginTop:"0.20rem !important",children:b("components.calculateShipping.shippingTitle.typeZipcode")})]}),(0,S.jsx)(h.gCW,{alignItems:"flex-start",gridColumn:{base:"span 2",lg:"2"},marginLeft:"0 !important",children:(0,S.jsx)(I,{onSubmit:function(e){e!==i&&(j(void 0),r(e),(0,m.FY)(p.b.cep,e))},shippingInfo:t,informedZipcode:i})})]})})}
1,T=n(78758),Z=n(98433),W=n(57089),z=n(49448),B=n(25881),U=n(43248),P=n(57942),L=n(72818),A=function(e){var t=(0,C.$G)().t,n=(0,L.x)().eventAnalyticRemoveFromCart,i=(0,d.i)(),r=i.updateCartItem,s=i.removeCartItem,u=i.loadingShipping,m=(0,x.useState)(!1),p=(0,a.Z)(m,2),g=p[0],v=p[1],f=(0,x.useState)(!1),b=(0,a.Z)(f,2),j=b[0],y=b[1],k=(0,x.useState)(!1),I=(0,a.Z)(k,2),w=I[0],T=I[1],Z=g||j,W=(0,h.l0L)({status:"error"}),z=function(){var t=(0,c.Z)((0,l.Z)().mark((function t(){return(0,l.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return T(!0),t.next=3,s(e.adId);case 3:T(!1),n(e.adId);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return(0,S.jsxs)(h.Ugi,{children:[(0,S.jsxs)(h.hE2,{isDisabled:Z,size:"sm",isAttached:!0,variant:"outline",children:[(0,S.jsx)(h.hU,{"data-testid":"minus-button",borderLeftRadius:"0.156rem",borderColor:"neutral.100","aria-label":t("components.cart.itemQuantity.decrement"),icon:(0,S.jsx)(h.NIg,{}),onClick:function(){if(1===e.quantity)return W({description:t("components.cart.itemQuantity.minLimitReached")});y(!0);var n=(0,o.Z)((0,o.Z)({},e),{},{quantity:e.quantity-1});r(n).finally((function(){return y(!1)}))},isLoading:j,h:"9",_focus:{outline:"none"},isDisabled:u}),(0,S.jsx)(h.M5Y,{"data-testid":"item-quantity",borderTopWidth:"0.063rem",borderBottomWidth:"0.063rem",borderColor:"neutral.100",color:"neutral.600",px:"3.5",opacity:Z?.4:1,children:e.quantity.toString().padStart(2,"0")}),(0,S.jsx)(h.hU,{"data-testid":"plus-button",borderRightRadius:"0.156rem",borderColor:"neutral.100","aria-label":t("components.cart.itemQuantity.increment"),icon:(0,S.jsx)(h.QIK,{}),onClick:e.limit?void 0:function(){if(10===e.quantity)return W({description:t("components.cart.itemQuantity.maxLimitReached")});v(!0);var n=(0,o.Z)((0,o.Z)({},e),{},{quantity:e.quantity+1});r(n).finally((function(){return v(!1)}))},isLoading:g,h:"9",isDisabled:e.limit||u,_focus:{outline:"none"}})]}),(0,S.jsx)(h.M5Y,{children:(0,S.jsx)(h.hU,{"data-testid":"trash-button",variant:"link",isLoading:w,onClick:z,"aria-label":t("components.cart.itemQuantity.remove"),icon:(0,S.jsx)(h.IT9,{}),_focus:{outline:"none"},isDisabled:u})})]})},M=n(81784),O=n(1276),D=n(31808),E=function(e){var t=e.amountProductItem,n=e.adId,i=e.months,r=e.minimumPrice,o=e.warrantyChecked,s=e.onChangeWarranty,a=e.loading,l=void 0!==a&&a,c=(0,C.$G)().t;return(0,S.jsxs)(h.kCb,{backgroundColor:"#E3E3E8",py:"0.313rem",px:"0.5rem",borderRadius:"0.25rem",width:"26rem",alignItems:"center",justifyContent:"space-between",color:"neutral.700",children:[(0,S.jsxs)(h.kCb,{gridGap:"2",children:[(0,S.jsx)(h.M5Y,{children:l?(0,S.jsx)(h.$jN,{w:"5",h:"5"}):(0,S.jsx)(h.XZJ,{size:"lg",backgroundColor:"white",isChecked:o,onChange:s})}),(0,S.jsx)(h.M5Y,{children:(0,S.jsx)(h.xq1,{})}),(0,S.jsx)(h.Ugi,{spacing:"0",alignItems:"center",children:(0,S.jsx)(h.xvT,{as:"span",fontWeight:"bold",fontSize:"xs",color:"neutral.800",children:c(o?"components.cart.warrantyBox.extendedWarranty":"components.cart.warrantyBox.addExtendedWarranty")})})]}),(0,S.jsx)(h.Ugi,{spacing:"0",alignItems:"center",children:r&&(0,S.jsx)(h.xvT,{as:"span",fontSize:"xs",children:o?"".concat(i," ").concat(c("components.cart.warrantyBox.protectedMonths")):"".concat(c("components.cart.warrantyBox.from")," ").concat((0,D.x)(r))})}),(0,S.jsx)(h.rUS,{href:"".concat(z.O.mainAppUri,"/garantia/").concat(n,"?quantidade=").concat(t,"&editar=true"),children:(0,S.jsx)(O.g,{children:c("components.cart.warrantyBox.edit")})})]})},F=function(e){var t=e.months,n=e.minimumPrice,i=e.price,r=e.productWarrantyId,s=e.selected,l=void 0===s||s,c=e.adId,u=e.amountProductItem,m=(0,d.i)().updateWarranty,p=(0,x.useState)(l),g=(0,a.Z)(p,2),v=g[0],f=g[1],b=(0,x.useState)(!1),j=(0,a.Z)(b,2),y=j[0],C=j[1],k=function(){C(!0),m(c).finally((function(){C(!1),f(!v)}))},I={pointerEvents:y?"none":"auto",opacity:y?.4:1};return(0,h.Sx0)({base:!0,md:!1})?(0,S.jsx)(h.xuv,(0,o.Z)((0,o.Z)({},I),{},{w:"full",children:(0,S.jsx)(M.Z,{months:t,minimumPrice:n,price:i,productWarrantyId:r,warrantyChecked:v,onChangeWarranty:k,loading:y,showPrice:!0})})):(0,S.jsx)(h.kCb,(0,o.Z)((0,o.Z)({},I),{},{width:"full",flexDirection:"column",children:(0,S.jsxs)(h.kCb,{width:"full",children:[(0,S.jsx)(h.kCb,{width:"calc(70% + 6.8em)",justifyContent:"start",pl:"18%",children:(0,S.jsx)(E,{amountProductItem:u,months:t,minimumPrice:n,warrantyChecked:v,onChangeWarranty:k,adId:c,loading:y})}),v&&(0,S.jsx)(h.kCb,{alignItems:"center",children:(0,S.jsx)(h.bb5,{children:i})})]})}))},V=function(e){var t=e.thumborImageUrl,n=e.adUrl,i=e.title,r=e.quantity,s=e.itemPrice,a=e.itemBilletPrice,l=e.stockControl,c=e.warranty,u=e.adId,m=e.discountPercentage,p=e.stockQuantity,g=e.variation,v=e.sku,f=(0,C.$G)().t,b=(0,d.i)(),j=b.shippingInfo,y=b.selectedShippingKey,k=b.cartListBySeller,I=(0,T.hI)(a),w=t||"/images/produto-default.jpg",L=(0,U.k)(u,y,j),M=Number("5")||void 0,O=M&&m>=M,D=(0,x.useMemo)((function(){var e=0===p,t=p<r;if(!I)return f("components.cart.cartItem.unavailable");if(null!==l&&void 0!==l&&l.limit){if(e)return f("components.cart.cartItem.unavailable");var n=String(p).padStart(2,"0");return t?"".concat(f("components.cart.cartItem.exceeded")," ").concat(n):f("components.cart.cartItem.limit")}}),[r,k,I]);return(0,S.jsxs)(h.gCW,{_first:{paddingTop:{base:"0",md:"8"}},_last:{gridGap:"6"},paddingBottom:{base:"0",md:"8"},children:[(0,S.jsxs)(h.kCb,{px:"0",flexDirection:"row",width:"full",flexWrap:"wrap",alignItems:{base:"end",md:"start"},children:[(0,S.jsxs)(h.Ugi,{width:{base:"full",md:"55%"},maxWidth:{md:"25rem"},gridGap:"7",paddingBottom:{base:"6",md:"0"},alignItems:{base:"center",md:"start"}
1,justifyContent:{base:"center"},children:[(0,S.jsxs)(h.Ugi,{maxHeight:"5.625rem",position:"relative",children:[O&&(0,S.jsx)(h.d0y,{percent:m,position:"absolute",right:"4.063rem",top:"-0.625rem"}),(0,S.jsx)(h.rUS,{href:"".concat(z.O.mainAppUri).concat(n),children:(0,S.jsx)(h.GH2,{"data-testid":"cart-item-image",src:w,alt:i,maxWidth:"5.625rem",maxHeight:"5.625rem"})})]}),(0,S.jsxs)(h.rUS,{href:"".concat(z.O.mainAppUri).concat(n),"data-testid":"cart-item-link",children:[(0,S.jsx)(h.xvT,{paddingTop:1,fontWeight:"normal",color:"neutral.600",fontSize:"xs",textAlign:"start",children:"(C\xf3d. ".concat(v,")")}),(0,S.jsx)(h.xvT,{fontWeight:"500",fontSize:"md",color:"neutral.700",maxWidth:{base:"13.75rem",md:"17.75rem"},mb:".3rem",children:i}),g&&(0,S.jsx)(Z.v,(0,o.Z)({},(0,B.F)(g)))]})]}),(0,S.jsxs)(h.M5Y,{width:{base:"100%",md:"45%"},justifyContent:"space-around",flexDirection:"row",flexWrap:"wrap",children:[(0,S.jsx)(A,{quantity:r,limit:null===l||void 0===l?void 0:l.limit,adId:u}),I&&(0,S.jsxs)(h.xuv,{children:[(0,S.jsx)(h.xvT,{fontWeight:"normal",color:"neutral.600",fontSize:"xs",children:f("components.cart.cartItem.unityValue")}),(0,S.jsx)(h.bb5,{children:s})]}),D&&(0,S.jsx)(h.xvT,{fontWeight:"normal",color:"danger.500",fontSize:"xs",children:D})]})]}),(0,S.jsxs)(h.kCb,{direction:"column",gap:"2",w:"full",children:[c&&(0,S.jsx)(F,(0,o.Z)((0,o.Z)({},c),{},{adId:u,amountProductItem:r})),L&&(0,S.jsx)(P.x,{width:"26rem",paddingLeft:"18%"}),(0,S.jsx)(W.s,{price:s,amount:r,estimatedPointsAmount:!0})]})]})},R=n(66382),q=n(82002),_=n(41021),N=n(94921),G=function(e){var t=e.currentRouteState,n=e.deliveredBy,i=e.deliveryOptions,r=e.items,s=e.sellerId,a=e.sellerName,l=e.sellersAmount,c=e.setCurrentRouteState,d=(0,C.$G)().t,u=(0,_.b)(r.map((function(e){return{id:e.adId,src:e.imageUrl}})),N.l.cartItem),m={deliveredBy:n,deliveryOptions:i,haveStock:(0,T.cb)(r),isCart:!0,sellerId:s,sellerName:a,sellersAmount:l};return(0,S.jsxs)(h.xuv,{borderRadius:"md",borderWidth:{base:"none",md:"0.063rem"},borderColor:"neutral.100",maxWidth:"52.5rem",width:"full",children:[(0,S.jsxs)(h.Ugi,{borderBottom:"0.0625rem solid",borderColor:"neutral.90",paddingX:"8",paddingY:"1rem",display:{base:"none",md:"flex"},children:[(0,S.jsx)(h.xvT,{fontSize:"md",fontWeight:"500",width:"56%",children:d("components.cart.product")}),(0,S.jsx)(h.xvT,{fontSize:"md",fontWeight:"500",width:"27%",children:d("components.cart.quantity")}),(0,S.jsx)(h.xvT,{fontSize:"md",fontWeight:"500",width:"15%",children:d("components.cart.price")})]}),(0,S.jsxs)(h.xuv,{paddingX:{base:"4",md:"8"},children:[r.map((function(e){var t="".concat(N.l.cartItem,"_").concat(e.adId);return(0,S.jsx)(V,(0,o.Z)((0,o.Z)({},e),{},{thumborImageUrl:u[t]||e.imageUrl}),"".concat(e.productId,"-").concat(e.adId))}
1)),(0,S.jsx)(R.K,(0,o.Z)({},m)),(0,S.jsx)(q._,{currentRouteState:t,isCart:!0,items:r,sellerId:s,setCurrentRouteState:c})]})]})},Y=n(40812),$=function(){var e=(0,C.$G)().t;return(0,S.jsxs)(h.Ugi,{maxW:{base:"52.5rem",lg:"25.25rem"},px:{base:2.5,md:0},children:[(0,S.jsx)(h.YNi,{minW:"3.4375rem",w:"3.4375rem",minH:"2.9218rem",h:"2.9218rem",display:{base:"none",sm:"block"}}),(0,S.jsxs)(h.xvT,{fontSize:{base:"sm",md:"md"},fontWeight:"semibold",color:"neutral.600",children:[e("components.discountInfo.hasTicket")," ",(0,S.jsx)(h.xvT,{as:"span",fontWeight:"normal",children:e("components.discountInfo.useInPayment")})]})]})},K=n(99259),Q=n(30168),X=n(44925),J=n(85711),H=n(28465),ee=n(26689),te=n(76910),ne=n(64081),ie=n(58467),re=n(9383),oe=["installmentInfo","isCart","isLoadingCart","isLoadingShipping","isShippingLoaded","items","selectedShipping","title"],se=function(e){var t,n,o,s,a=e.installmentInfo,l=e.isCart,c=e.isLoadingCart,u=e.isLoadingShipping,x=e.isShippingLoaded,g=e.items,v=e.selectedShipping,f=e.title,b=(0,X.Z)(e,oe),j=(0,C.$G)().t,y=(0,ie.s0)(),k=(0,ee.cq)(),I=(0,d.i)().hasTotalizersError,w=(0,T.cb)(g),Z=g.flat().some((function(e){return e.quantity>(null===e||void 0===e?void 0:e.stockQuantity)})),B=g.some((function(e){return!(0,T.RX)(e)})),U=(0,J.V)(),P=U.getInCashDescription,L=U.haveInstallments,A=U.haveInCashPayment,M=Number(null===a||void 0===a||null===(t=a.withoutInterest)||void 0===t?void 0:t.installments)>0||Number(null===a||void 0===a||null===(n=a.withInterest)||void 0===n?void 0:n.installments)>0,O=L&&M;return(0,S.jsxs)(h.xuv,{w:"full",maxW:{base:"52.5rem"},bgColor:{base:"none",lg:"neutral.50"},borderRadius:"0.375rem",p:{base:4,lg:8},color:"neutral.600",fontSize:"sm",children:[(0,S.jsxs)(h.xuv,{display:{base:"none",lg:"block"},children:[(0,S.jsx)(h.xvT,{fontWeight:"bold",color:"neutral.800",fontSize:"md",children:f}),(0,S.jsx)(h.izJ,{my:"8",borderColor:"neutral.200"}),(0,S.jsx)(re.M,{isLoading:c,label:j("components.orderValuesBox.subtotal"),value:b.totalItemsValue}),(0,S.jsx)(re.M,{isLoading:c,label:j("components.orderValuesBox.service"),value:b.totalServiceValue}),(0,S.jsx)(re.M,{isLoading:c||u,label:j("components.orderValuesBox.shipping"),value:w?b.totalShipping:0,isValueShipping:!!w&&x}),(0,S.jsx)(h.xuv,{display:{base:"none",lg:"block"},children:(0,S.jsx)(W.s,{price:b.totalItemsValue,showBorder:!0,showTopDivider:!0,estimatedPointsAmount:!0})}),(0,S.jsx)(h.izJ,{my:"8",borderColor:"neutral.200"})]}),(0,S.jsxs)(h.kCb,{w:"full",justifyContent:"space-between","data-testid":"order-total",children:[(0,S.jsx)(h.xvT,{fontWeight:{base:"medium",lg:"normal"},children:j("components.orderValuesBox.orderTotal")}),(0,S.jsxs)(h.xuv,{textAlign:"right",opacity:c||u?.4:1,children:[(0,S.jsxs)(h.Ugi,{justifyContent:"end",children:[(c||u)&&(0,S.jsx)(h.$jN,{size:"xs"}),(0,S.jsx)(h.xvT,{fontWeight:"bold",fontSize:{base:"md",lg:"lg"},color:"primary.500",children:w?(0,D.x)(b.totalValue):"-"})]}),O&&(null!==a&&void 0!==a&&a.withInterest?(0,S.jsxs)(h.xvT,{fontSize:"xs",children:[(0,S.jsxs)(h.xvT,{children:[j(i||(i=(0,Q.Z)(["hooks.paymentsMethods.prefix"])))," ",(0,S.jsxs)("strong",{children:[a.withoutInterest.installments,"x"]})," ",j("hooks.paymentsMethods.withoutFee")]}),(0,S.jsxs)(h.xvT,{children:[j("hooks.paymentsMethods.or")," ",(0,S.jsxs)("strong",{children:[a.withInterest.installments,"x "]}),j("hooks.paymentsMethods.of")," ",(0,S.jsxs)("strong",{children:[(0,D.x)(null===a||void 0===a||null===(o=a.withInterest)||void 0===o?void 0:o.installmentValue)," "]}),j("hooks.paymentsMethods.withFee")]})]}):(0,S.jsxs)(h.xvT,{fontSize:"xs",children:[j(r||(r=(0,Q.Z)(["hooks.paymentsMethods.prefix"])))," ",(0,S.jsxs)("strong",{children:[a.withoutInterest.installments,"x"," "]}),j("hooks.paymentsMethods.of")," ",(0,S.jsxs)("strong",{children:[(0,D.x)(null===a||void 0===a||null===(s=a.withoutInterest)||void 0===s?void 0:s.installmentValue)," "]})," ",j("hooks.paymentsMethods.withoutFee")]})),A&&w&&(0,S.jsxs)(h.xvT,{color:"neutral.600",fontSize:"xs",children:[O?j("components.orderValuesBox.or")+" ":"",(0,S.jsx)("strong",{children:(0,D.x)(b.totalInCashValue)})," ",P()]})]})]}),L&&(null===a||void 0===a?void 0:a.withInterest)&&(0,S.jsx)(h.kCb,{justifyContent:"flex-end",marginTop:"1rem",children:(0,S.jsx)(h.xvT,{color:"neutral.600",fontSize:"xs",children:j("hooks.paymentsMethods.valueSubjectToChange")})}),l&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h.xuv,{display:{base:"block",lg:"none"},children:(0,S.jsx)(W.s,{price:b.totalItemsValue,showBorder:!0,showTopDivider:!0,estimatedPointsAmount:!0})}),B&&(0,S.jsx)(h.xvT,{"data-testid":"unsellable-item-warning",color:"danger.500",fontSize:"xs",mt:{base:4,lg:8},textAlign:"center",children:j("components.orderValuesBox.unsellableItem")}),(0,S.jsx)(h.Jiv,{"data-testid":"continue-button",isDisabled:u||Z||c||I||B,label:j("components.orderValuesBox.continue"),variant:"success",w:"full",mt:B?2:{base:4,lg:8},h:"3.75rem",leftIcon:(0,S.jsx)(h.k5K,{w:"5",h:"5",color:"white"}),onClick:function(){if(!g.some((function(e){return e.quantity>(null===e||void 0===e?void 0:e.stockQuantity)}
1))&&!B)return(null===v||void 0===v?void 0:v.some((function(e){return e===te.l.PickUp})))?(0,m.FY)(p.b.isPickUpChoose,"true"):(0,m.xf)(p.b.isPickUpChoose),(0,H.z8)(),k?y(ne.X.shipping):y(ne.X.identification,{state:{isCheckoutFlow:!0,returnUrl:window.location.origin+ne.X.shipping}})}}),(0,S.jsx)(h.rUS,{href:z.O.mainAppUri,children:(0,S.jsx)(h.Jiv,{"data-testid":"keep-buy-button",_active:{bgColor:"success.400",borderColor:"success.400",color:"white"},_hover:{bgColor:"success.500",color:"white"},bg:"none",borderColor:"success.500",borderRadius:"0.25rem",color:"success.500",h:"3.75rem",label:j("components.orderValuesBox.keepBuy"),mt:{base:4,lg:4},variantType:"outline",w:"full"})})]})]})},ae=n(53289),le=n(64676),ce=n(30831),de=n(47397),ue=n.n(de),me=function(){return(0,S.jsx)(pe,{})},pe=function(){var e,t=(0,C.$G)().t,n=ue().object({zipcode:ue().string().pattern(/\d{5}-\d{3}$/).messages({"string.pattern.base":t("components.calculateShipping.shippingForm.invalidZipcode")}).allow("").optional()}),i=(0,d.i)(),r=i.cartListBySeller,l=i.clearShipping,c=i.fetchCart,u=i.hasPickUpInStoreOption,g=i.isShippingLoaded,v=i.loadingCart,f=i.loadingChanges,b=i.loadingShipping,j=i.selectedShippingKey,k=i.shippingInfo,I=i.totalValues,Z=null===(e=(0,ie.TH)().state)||void 0===e?void 0:e.sellerSuggestionId,W=(0,x.useState)(Z),B=(0,a.Z)(W,2),U=B[0],P=B[1],L=(0,x.useState)(),A=(0,a.Z)(L,2),M=A[0],O=A[1],D=(0,y.cI)({resolver:(0,ce.L)(n)});document.title=t("templates.cart.title"),(0,x.useEffect)((function(){var e=function(){var e=(0,m.WJ)(p.b.cart);O(e)},t=function(){"visible"===document.visibilityState&&e()};return e(),document.addEventListener("visibilitychange",t),window.addEventListener("focus",e),function(){document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",e)}}),[]),(0,x.useEffect)((function(){l(),c(),(0,H.dW)()}),[]);var E=r.flatMap((function(e){return e.items})),F=(0,le.q)().initRequestFromPaymentEnabled,V=(0,x.useRef)([]);!function(){var e=E.flat(1).map((function(e){return e.adId}));e.every((function(e){return V.current.includes(e)}))||(V.current=e)}(),(0,x.useEffect)((function(){V.current.length&&F()}),[V.current]);var R=(0,x.useMemo)((function(){var e,t,n=null===k||void 0===k||null===(e=k.optionsBySeller)||void 0===e||null===(t=e.find((function(e){return!!e.pickUpStoreOptions})))||void 0===t?void 0:t.sellerId;return(0,s.Z)(r).sort((function(e){return e.sellerId===Number(n)&&e.items.some((function(e){return!!e.stockQuantity}))?-1:1})).map((function(e){var t;return(0,o.Z)((0,o.Z)({},e),{},{deliveryOptions:null===k||void 0===k||null===(t=k.optionsBySeller.find((function(t){return t.sellerId===e.sellerId})))||void 0===t?void 0:t.options})}))}),[r,null===k||void 0===k?void 0:k.optionsBySeller]);return v?(0,S.jsx)(K.a,{}):(0,T.rz)(null===r||void 0===r?void 0:r.length,M)?(0,S.jsxs)(h.gCW,{h:{base:"40vh",md:"68vh"},p:"10",textAlign:"center",children:[(0,S.jsxs)(h.Kqy,{direction:{base:"column",sm:"row"},alignItems:"center",children:[(0,S.jsx)(h.k5K,{h:{base:10,sm:6},w:{base:10,sm:6},color:"secondary.500"}),(0,S.jsx)(h.xvT,{color:"neutral.700",fontWeight:"medium",children:t("templates.cart.noProductFound")})]}),(0,S.jsxs)(h.xvT,{color:"neutral.500",children:[t("templates.cart.backTo")," ",(0,S.jsx)(h.rUS,{href:z.O.mainAppUri,fontWeight:"medium",children:t("templates.cart.startPage")}),t("templates.cart.seeMoreProducts")]})]}):(0,S.jsx)(h.M5Y,{mb:"40","data-testid":"cart-template",children:(0,S.jsx)(y.RV,(0,o.Z)((0,o.Z)({},D),{},{children:(0,S.jsxs)(h.xuv,{w:"full",maxW:"container.xl",px:{base:"0",md:"6"},children:[(0,S.jsx)(w,{}),(0,S.jsx)(ae.B,{haveDivider:!1,icon:(0,S.jsx)(h.k5K,{height:"1.4rem",width:"1.4rem",withBackgroundElement:!0}),title:"".concat(t("templates.cart.shoppingCart")).concat(I.totalItemsQuantity).concat(t("templates.cart.closedParentheses"))}),(0,S.jsxs)(h.Kqy,{direction:{base:"column",lg:"row"},w:"full",alignItems:{base:"center",lg:"start"},justifyContent:{base:"center",lg:"stretch"},spacing:{base:"4",lg:"8"},children:[(0,S.jsxs)(h.gCW,{flexGrow:1,w:{base:"full",lg:"auto"},alignItems:{base:"center",sm:"stretch"},maxW:"52.5rem",spacing:{base:0,md:8},children:[null===R||void 0===R?void 0:R.map((function(e){return(0,S.jsx)(h.xuv,{_notFirst:{paddingTop:{base:8,md:0}},borderBottomWidth:{base:"0.5rem",md:"0"},borderColor:"neutral.90",w:"full",children:(0,S.jsx)(G,(0,o.Z)((0,o.Z)({},e),{},{currentRouteState:U,sellersAmount:R.length,setCurrentRouteState:P}))},e.sellerId)})),(0,S.jsx)(Y.k,{showDeliveryTerm:function(e){var t=null===e||void 0===e?void 0:e.options.find((function(e){return(null===e||void 0===e?void 0:e.value)===te.l.PickU
1p}));return!(null===t||void 0===t||!t.deliveryHours)&&!(null!==t&&void 0!==t&&t.deliveryDate)}(k),showPickUpRequirementsInfo:u,showValidTerm:g})]}),(0,S.jsxs)(h.gCW,{alignItems:"center",borderTopWidth:{base:"8px",lg:0},flexGrow:1,marginTop:{base:"0 !important",md:0},spacing:{base:2,lg:6},w:{base:"full",lg:"auto"},children:[(0,S.jsx)(se,(0,o.Z)((0,o.Z)({},I),{},{isCart:!0,isLoadingCart:f,isLoadingShipping:b,isShippingLoaded:g,items:E,selectedShipping:j,title:t("templates.cart.orderSummary")})),(0,S.jsx)($,{})]})]})]})}))})},he=me}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.