import{j as r,m as A,r as j}from"./main-7700519c.js";import{b as S}from"./chunk-index-69956742.js";import{G as E,e as h}from"./chunk-material-ui-241eb317.js";import{S as C}from"./chunk-index-355ad0d2.js";import{D as m}from"./chunk-index-8609782e.js";import{B as L}from"./chunk-index-26eed4ba.js";const O=({props:o,setOpenInfo:l,setOpenCart:d,getBasket:c})=>{var f;const s=()=>{l(!1),d(!0),c()};if(!o)return null;const u=o.NAME,t=o.PRICE,i=o.PRODUCT_INFO,n=i.DETAIL_PAGE_URL,e=i.OFFERS_GALLERY,x=i.TREE_PROPS.COLOR.VALUE,P=i.TREE_PROPS.SIZE.VALUE,R=(f=o.PROPERTIES.find(p=>p.CODE==="CML2_ARTICLE"))==null?void 0:f.VALUE;return r.jsxs(r.Fragment,{children:[r.jsx(S,{sku:0,itemName:u,link:n,imgPath:A(e,x,"200x200"),color:x,size:P,currentPrice:t,article:R}),r.jsx(E,{item:!0,sm:6,xs:12,children:r.jsx(h,{onClick:s,style:{padding:"8px 16px",fontSize:14},fullWidth:!0,color:"secondary",variant:"outlined",children:"Перейти в корзину"})}),r.jsx(E,{item:!0,sm:6,xs:12,children:r.jsx(h,{href:j.checkout.index,style:{padding:"8px 16px",fontSize:14},fullWidth:!0,color:"default",variant:"contained",children:"Оформить заказ"})})]})};function U({cartItem:o,open:l,handleClose:d,getBasket:c,setOpenCart:s,setOpenInfo:u,openCart:t,basketLoading:i,basketData:n}){var e;return r.jsxs(r.Fragment,{children:[r.jsx(C,{open:l,autoHideDuration:3e3,onClose:d,title:Array.isArray(o==null?void 0:o.data)?"Товара нет":"Добавлено в корзину",children:r.jsx(r.Fragment,{children:!Array.isArray(o==null?void 0:o.data)&&r.jsx(O,{props:o==null?void 0:o.data,getBasket:c,setOpenCart:s,setOpenInfo:u})})}),r.jsx(m,{isWrapped:!0,showCloseIcon:!0,open:t,onClose:()=>s(!1),handlerCloseIcon:()=>s(!1),anchor:"right",closeIconPosition:"right",children:r.jsx(L,{loading:i,itemsBasket:n==null?void 0:n.data.BASKET,pricesBasket:n==null?void 0:n.data.ORDER_PRICES,couponList:Object.values(((e=n==null?void 0:n.data.DISCOUNT_DATA)==null?void 0:e.COUPON_LIST)??{})})})]})}export{U as B};