import{d as e,f as t,h as n,l as r,r as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{t as c}from"./shopping-cart-BBNoSjWE.js";import{t as l}from"./zap-CufcM84a.js";import{n as u}from"./cart-query-hooks-BCr0eax3.js";import{t as d}from"./react-BnURElzN.js";import{t as f}from"./central-product-store-DGoerB5U.js";var p=n(t()),m=d(e=>({slots:[],productSlotsMap:{},setSlots:t=>e({slots:t}),setProductSlotsMap:t=>e({productSlotsMap:t}),refetchSlots:null,setRefetchSlots:t=>e({refetchSlots:t})})),h=e();function g(){let e=s(),t=f(e=>e.products),n=m(e=>e.productSlotsMap),[d,g]=(0,p.useState)({}),_=u(`flash`),v=t.filter(e=>n[e.id]?.isFlashAvailable&&!n[e.id]?.isOutOfStock),y=t=>{let n=d[t.id]||1;_.mutate({productId:t.id,quantity:n,storeId:t.storeId},{onSuccess:()=>e({to:`/flash/cart`})})};return(0,h.jsxs)(a,{children:[(0,h.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,h.jsx)(l,{className:`h-6 w-6 text-yellow-500`}),(0,h.jsx)(o,{weight:`bold`,className:`text-xl`,children:`1 Hr Delivery`})]}),(0,h.jsx)(`div`,{className:`mb-4 rounded-xl bg-yellow-50 p-3`,children:(0,h.jsx)(o,{className:`text-sm text-yellow-800`,children:`Get these products delivered within 1 hour! Only available for select items.`})}),(0,h.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:v.map(e=>{let t=e.discountedPrice??e.price,n=d[e.id]||1;return(0,h.jsxs)(`div`,{className:`rounded-xl border border-gray-100 bg-white p-3 shadow-sm`,children:[(0,h.jsx)(`div`,{className:`mb-2 aspect-square w-full overflow-hidden rounded-lg bg-gray-100`,children:e.images?.[0]&&(0,h.jsx)(`img`,{src:e.images[0].uri,alt:e.name,className:`h-full w-full object-cover`})}),(0,h.jsx)(o,{weight:`semibold`,className:`text-sm`,numberOfLines:2,children:e.name}),(0,h.jsxs)(o,{weight:`bold`,className:`text-brand-600`,children:[`₹`,t]}),(0,h.jsx)(`div`,{className:`mt-2 flex items-center gap-2`,children:(0,h.jsx)(i,{value:n,setValue:t=>g(n=>({...n,[e.id]:t}))})}),(0,h.jsxs)(r,{fullWidth:!0,onClick:()=>y(e),className:`mt-2 flex items-center justify-center gap-1 bg-brand-500 text-white text-xs`,disabled:_.isPending,children:[(0,h.jsx)(c,{className:`h-3 w-3`}),`Add`]})]},e.id)})}),v.length===0&&(0,h.jsx)(`div`,{className:`py-20 text-center`,children:(0,h.jsx)(o,{className:`text-gray-500`,children:`No flash delivery products available`})})]})}export{g as component};