1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,70273,e=>{"use strict";let t=(0,e.i(75254).default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",()=>t],70273)},94351,e=>{"use strict";let t=(0,e.i(75254).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);e.s(["Home",()=>t],94351)},31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},78917,e=>{"use strict";let t=(0,e.i(75254).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",()=>t],78917)},42896,e=>{"use strict";var t=e.i(43476),r=e.i(78917),s=e.i(63209);function a({uberEatsUrl:e,doorDashUrl:a,productName:i="this product",compact:l=!1,className:n="",uberEatsText:o="Buy from Uber Eats",doorDashText:c="Buy from DoorDash"}){let d=e&&e.trim().length>0,u=a&&a.trim().length>0,g=l?"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-semibold rounded-lg transition-all":"inline-flex items-center gap-2 px-4 py-2.5 text-sm font-semibold rounded-lg transition-all";return d||u?(0,t.jsxs)("div",{className:`flex flex-wrap gap-2 ${n}`,children:[d&&(0,t.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:`${g} bg-green-600 text-white hover:bg-green-700`,title:`Buy ${i} on Uber Eats`,children:[(0,t.jsx)("span",{children:o}),(0,t.jsx)(r.ExternalLink,{className:l?"h-3 w-3":"h-4 w-4"})]}),u&&(0,t.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:`${g} bg-red-600 text-white hover:bg-red-700`,title:`Buy ${i} on DoorDash`,children:[(0,t.jsx)("span",{children:c}),(0,t.jsx)(r.ExternalLink,{className:l?"h-3 w-3":"h-4 w-4"})]})]}):(0,t.jsxs)("div",{className:n,children:[(0,t.jsxs)("div",{className:`${g} bg-gray-400 text-white cursor-not-allowed w-full justify-center`,children:[(0,t.jsx)(s.AlertCircle,{className:l?"h-3 w-3":"h-4 w-4"}),(0,t.jsx)("span",{children:"Delivery Unavailable"})]}),(0,t.jsx)("p",{className:"text-xs text-gray-500 text-center mt-2",children:"Online delivery not yet available for this item"})]})}e.s(["ProductPartnerButtons",()=>a])},35152,e=>{"use strict";var t=e.i(43476),r=e.i(31278);function s({size:e="md",text:s,className:a=""}){return(0,t.jsxs)("div",{className:`flex items-center justify-center space-x-2 ${a}
1`,children:[(0,t.jsx)(r.Loader2,{className:`animate-spin text-green-600 ${{sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"}[e]}`}),s&&(0,t.jsx)("span",{className:`text-gray-600 ${{sm:"text-sm",md:"text-base",lg:"text-lg"}[e]}`,children:s})]})}function a(){return(0,t.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border animate-pulse p-6",children:[(0,t.jsx)("div",{className:"h-48 bg-gray-200 rounded-lg mb-4"}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),(0,t.jsx)("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),(0,t.jsx)("div",{className:"h-6 bg-gray-200 rounded w-1/3"})]})]})}function i(){return(0,t.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((e,r)=>(0,t.jsx)(a,{},r))})}e.s(["LoadingProductGrid",()=>i,"default",()=>s])},16715,e=>{"use strict";let t=(0,e.i(75254).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",()=>t],16715)},47666,7879,3764,e=>{"use strict";var t=e.i(43476),r=e.i(78894),s=e.i(16715),a=e.i(71689),i=e.i(94351),l=e.i(22016);function n({title:e="Something went wrong",message:n="We encountered an unexpected error. Please try again.",showRefresh:o=!0,showHome:c=!1,showBack:d=!1,onRefresh:u,onBack:g,className:m=""}){return(0,t.jsx)("div",{className:`flex items-center justify-center p-8 ${m}`,children:(0,t.jsxs)("div",{className:"text-center max-w-md",children:[(0,t.jsx)("div",{className:"w-16 h-16 bg-red-50 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,t.jsx)(r.AlertTriangle,{className:"h-8 w-8 text-red-500"})}),(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:e}),(0,t.jsx)("p",{className:"text-gray-600 mb-6",children:n}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[o&&(0,t.jsxs)("button",{onClick:()=>{u?u():window.location.reload()},className:"inline-flex items-center space-x-2 bg-green-600 text-white px-6 py-3 rounded-lg hover:bg-green-700 transition-colors",children:[(0,t.jsx)(s.RefreshCw,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:"Try Again"})]}),d&&(0,t.jsxs)("button",{onClick:()=>{g?g():window.history.back()},className:"inline-flex items-center space-x-2 border border-gray-300 text-gray-700 px-6 py-3 rounded-lg hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(a.ArrowLeft,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:"Go Back"})]}),c&&(0,t.jsxs)(l.default,{href:"/",className:"inline-flex items-center space-x-2 border border-gray-300 text-gray-700 px-6 py-3 rounded-lg hover:bg-gray-50 transition-colors",children:[(0,t.jsx)(i.Home,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:"Go Home"})]})]})]})})}function o({onRetry:e}){return(0,t.jsx)(n,{title:"Connection Error",message:"Unable to connect to our servers. Please check your internet connection and try again.",showRefresh:!0,onRefresh:e})}function c(){return(0,t.jsx)(n,{title:"Product Not Found",message:"The product you're looking for is no longer available or doesn't exist.",showRefresh:!1,showHome:!0,showBack:!0})}e.s(["NetworkError",()=>o,"ProductNotFoundError",()=>c],47666);var d=e.i(70273),u=e.i(71645);function g({rating:e,totalReviews:r,size:s="md",showNumber:a=!0,interactive:i=!1,onRatingChange:l}){let[n,o]=(0,u.useState)(0),[c,g]=(0,u.useState)(e);(0,u.useEffect)(()=>{g(e)},[e]);let m=i?n||c:e,x={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"}[s];return(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-0.5",onMouseLeave:()=>{i&&o(0)},children:[1,2,3,4,5].map(e=>{let r=e<=m,s=e-.5<=m&&e>m;return(0,t.jsxs)("div",{className:`relative ${i?"cursor-pointer":""}`,onClick:()=>{i&&(g(e),l?.(e))},onMouseEnter:()=>{i&&o(e)},children:[(0,t.jsx)(d.Star,{className:`${x} transition-colors ${r||s?"text-yellow-400 fill-yellow-400":i&&n>=e?"text-yellow-300 fill-yellow-300":"text-gray-300"}`}),s&&(0,t.jsx)(d.Star,{className:`${x} absolute top-0 left-0 text-yellow-400 fill-yellow-400`,style:{clipPath:`inset(0 ${100-(m-Math.floor(m))*100}% 0 0)`}})]},e)})}),a&&(0,t.jsxs)("div",{className:`${{sm:"text-xs",md:"text-sm",lg:"text-base"}[s]} text-gray-600 flex items-center gap-1`,children:[(0,t.jsx)("span",{className:"font-medium",children:e.toFixed(1)}),void 0!==r&&(0,t.jsxs)("span",{className:"text-gray-500",children:["(",r," ",1===r?"review":"reviews",")"]})]})]})}function m({rating:e,size:r="md"}){return(0,t.jsx)(g,{rating:e,size:r,showNumber:!1})}e.s(["Rating",()=>g,"RatingStars",()=>m],7879);var x=e.i(11795);function h(e){let[t,r]=(0,u.useState)(null),[s,a]=(0,u.useState)(!0);return(0,u.useEffect)(()=>{e&&(async()=>{try{let t=(0,x.createClient)(),{data:s,error:a}=await t.from("reviews").select("rating").eq("product_id",e).eq("is_approved",!0);if(a){console.error("Error fetching reviews:",a),r({product_id:e,average_rating:5,total_reviews:0,rating_distribution:{1:0,2:0,3:0,4:0,5:0}});return}if(!s||0===s.length)return void r({product_id:e,average_rating:5,total_reviews:1,rating_distribution:{1:0,2:0,3:0,4:0,5:1}});let i=s.length,l=s.reduce((e,t)=>
1e+t.rating,0)/i,n={1:s.filter(e=>1===e.rating).length,2:s.filter(e=>2===e.rating).length,3:s.filter(e=>3===e.rating).length,4:s.filter(e=>4===e.rating).length,5:s.filter(e=>5===e.rating).length};r({product_id:e,average_rating:Math.round(10*l)/10,total_reviews:i,rating_distribution:n})}catch(t){console.error("Error:",t),r({product_id:e,average_rating:5,total_reviews:1,rating_distribution:{1:0,2:0,3:0,4:0,5:1}})}finally{a(!1)}})()},[e]),{rating:t,loading:s}}function f(e){let[t,r]=(0,u.useState)({}),[s,a]=(0,u.useState)(!0);return(0,u.useEffect)(()=>{e.length?(async()=>{try{let t=(0,x.createClient)(),{data:s,error:a}=await t.from("reviews").select("product_id, rating").in("product_id",e).eq("is_approved",!0);a&&console.error("Error fetching reviews:",a);let i={};if(e.forEach(e=>{i[e]={product_id:e,average_rating:5,total_reviews:0,rating_distribution:{1:0,2:0,3:0,4:0,5:0}}}),s&&s.length>0){let e=s.reduce((e,t)=>(e[t.product_id]||(e[t.product_id]=[]),e[t.product_id].push(t),e),{});Object.entries(e).forEach(([e,t])=>{let r=t.length,s=t.reduce((e,t)=>e+t.rating,0)/r,a={1:t.filter(e=>1===e.rating).length,2:t.filter(e=>2===e.rating).length,3:t.filter(e=>3===e.rating).length,4:t.filter(e=>4===e.rating).length,5:t.filter(e=>5===e.rating).length};i[e]={product_id:e,average_rating:Math.round(10*s)/10,total_reviews:r,rating_distribution:a}})}r(i)}catch(s){console.error("Error:",s);let t={};e.forEach(e=>{t[e]={product_id:e,average_rating:5,total_reviews:0,rating_distribution:{1:0,2:0,3:0,4:0,5:0}}}),r(t)}finally{a(!1)}})():a(!1)},[e]),{ratings:t,loading:s}}e.s(["useProductRating",()=>h,"useProductsRatings",()=>f],3764)},47401,86896,8101,54922,70956,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(57688),a=e.i(22016),i=e.i(7233),l=e.i(70273),n=e.i(88844),o=e.i(98688),c=e.i(75157),d=e.i(11795),u=e.i(35152),g=e.i(47666),m=e.i(42896),x=e.i(7879),h=e.i(3764);function f({searchTerm:e,categoryFilter:f,viewMode:y="grid",selectedFilters:b}){let[j,v]=(0,r.useState)([]),[w,N]=(0,r.useState)(!0),[_,k]=(0,r.useState)(null),[C,$]=(0,r.useState)({}),{addToCart:E}=(0,o.useStore)(),R=j.map(e=>e.id),{ratings:P,loading:S}=(0,h.useProductsRatings)(R);(0,r.useEffect)(()=>{M()},[]);let M=async()=>{try{N(!0),k(null);let e=(0,d.createClient)(),{data:t,error:r}=await e.from("products").select(` 2 *, 3 categories!inner(id, name, slug) 4 `).eq("is_available",!0).eq("is_cooked",!1).order("created_at",{ascending:!1});if(r){console.error("Error fetching products:",r);let e=p();console.log("Using mock data fallback:",e.length,"products"),v(e)}else{console.log("Using Supabase data:",t?.length||0,"products");let e=(t||[]).map(e=>({...e,weight:e.weight||null,origin:e.origin||null}));v(e)}}catch(e){console.error("Error:",e),k("Failed to load products. Please try again."),v(p())}finally{N(!1)}},q=j.filter(t=>{let r=!e||t.name.toLowerCase().includes(e.toLowerCase())||t.description?.toLowerCase().includes(e.toLowerCase()),s=!f||t.category_id===f,a=!b?.categories?.length||b.categories.includes(t.category_id||""),i=!b?.priceRange||(0===b.priceRange.min||t.price>=b.priceRange.min)&&(b.priceRange.max>=100||t.price<=b.priceRange.max);return(b?.categories?.length||b?.priceRange)&&console.log("ProductGrid: Filtering product",{productName:t.name,productCategoryId:t.category_id,productPrice:t.price,selectedFilters:b,matchesSelectedCategories:a,matchesPriceRange:i,finalMatch:r&&s&&a&&i}),r&&s&&a&&i});return w?(0,t.jsx)(u.LoadingProductGrid,{}):_?(0,t.jsx)(g.NetworkError,{onRetry:M}):0===q.length?(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)(n.Package,{className:"h-16 w-16 text-gray-300 mx-auto mb-4"}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No products found"}),(0,t.jsx)("p",{className:"text-gray-600",children:e||f?"Try adjusting your search or filters":"Products will appear here once they are added to the store"})]}):(0,t.jsx)("div",{className:"grid"===y?"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6":"space-y-4",children:q.map(e=>(0,t.jsxs)("div",{className:`bg-white rounded-lg shadow-sm border hover:shadow-md transition-shadow group ${"list"===y?"flex items-center p-4":""}`,children:[(0,t.jsxs)("div",{className:`relative ${"list"===y?"w-24 h-24 flex-shrink-0 mr-4":""}`,children:[(0,t.jsx)(a.default,{href:`/products/${e.categories?.slug||"groceries"}/${e.slug}`,children:(0,t.jsx)("div",{className:`bg-gray-100 rounded-lg overflow-hidden ${"list"===y?"w-24 h-24":"h-48 rounded-t-lg"}`,children:e.images&&e.images.length>0?(0,t.jsx)(s.default,{src:e.images[0],alt:e.name,width:"list"===y?96:300,height:"list"===y?96:200,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200"}):(0,t.jsx)(s.default,{src:"/Kfreshplaceholder.webp",alt:`${e.name} â Image Coming Soon`,width:"list"===y?96:300,height:"list"===y?96:200,className:"w-full h-full object-cover"})})}),"grid"===y&&(0,t.jsxs)(t.Fragment,{children:[e.is_featured&&(0,t.jsxs)("div",{className:"absolute top-2 left-2 bg-green-600 text-white px-2 py-1 rounded text-xs font-semibold flex items-center",children:[(0,t.jsx)(l.Star,{className:"h-3 w-3 mr-1 fill-current"}),"Featured"]}),e.compare_price&&e.compare_price>e.price&&(0,t.jsxs)("div",{className:"absolute top-2 right-2 bg-red-500 text-white px-2 py-1 rounded text-xs font-semibold",children:["Save ",(0,c.formatPrice)(e.compare_price-e.price)]}),e.stock_quantity<=0&&(0,t.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-60 rounded-t-lg flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-white font-semibold",children:"Out of Stock"})})]})]}),(0,t.jsxs)("div",{className:`${"list"===y?"flex-1":"p-4"}`,children:[(0,t.jsx)(a.default,{href:`/products/${e.categories?.slug||"groceries"}/${e.slug}`,children:(0,t.jsx)("h3",{className:"font-semibold text-gray-900 mb-2 hover:text-green-600 transition-colors",children:e.name})}),P[e.id]&&(0,t.jsx)("div",{className:`${"list"===y?"mb-1":"mb-2"}`,children:(0,t.jsx)(x.Rating,{rating:P[e.id].average_rating,totalReviews:P[e.id].total_reviews,size:"list"===y?"sm":"md"})}),"grid"===y&&(0,t.jsx)("p",{className:"text-gray-600 text-sm mb-3 line-clamp-2",children:e.description}),(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)("span",{className:"text-lg font-bold text-green-600",children:(0,c.formatPrice)(e.price)}),e.compare_price&&e.compare_price>e.price&&(0,t.jsx)("span",{className:"text-sm text-gray-500 line-through",children:(0,c.formatPrice)(e.compare_price)})]})}),(0,t.jsx)("div",{className:`${"list"===y?"ml-4":"mt-4"}`,children:"fresh_meals"===e.delivery_type||e.is_cooked?(0,t.jsxs)("button",{onClick:()=>{e.stock_quantity<=0?alert("Sorry, this product is out of stock"):(E({id:e.id,name:e.name,price:e.price,quantity:1,image_url:e.images&&e.images.length>0?e.images[0]:"/Kfreshplaceholder.webp",isCookedMeal:!!e.is_cooked,uber_eats_url:e.uber_eats_url,doordash_url:e.doordash_url}),$(t=>
4({...t,[e.id]:!0})),setTimeout(()=>{$(t=>({...t,[e.id]:!1}))},1e3))},"data-product-id":e.id,className:`${"list"===y?"px-3 py-1 text-sm":"w-full px-4 py-2"} rounded-lg transition-all duration-200 flex items-center justify-center space-x-2 font-medium ${0===e.stock_quantity?"bg-gray-300 text-gray-500 cursor-not-allowed":C[e.id]?"bg-green-700 text-white":"bg-green-600 text-white hover:bg-green-700 hover:scale-105 active:scale-95"}`,disabled:0===e.stock_quantity,"aria-label":0===e.stock_quantity?"Out of stock":"Add for pickup",children:[(0,t.jsx)(i.Plus,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:C[e.id]?"Added!":"ð½ï¸ Order for Pickup"})]}):(0,t.jsxs)("div",{className:`${"list"===y?"space-y-1":"space-y-2"}`,children:[(0,t.jsx)("div",{className:`text-center rounded border border-blue-200 bg-blue-50 text-blue-800 ${"list"===y?"p-1 text-xs":"p-2 text-xs font-medium"}`,children:"ðª Available in-store ⢠Online partners below"}),(0,t.jsx)(m.ProductPartnerButtons,{uberEatsUrl:e.uber_eats_url,doorDashUrl:e.doordash_url,productName:e.name,compact:"list"===y})]})}),e.stock_quantity>0&&e.stock_quantity<=10&&(0,t.jsxs)("p",{className:`text-orange-600 ${"list"===y?"text-xs mt-1":"text-xs mt-2"}`,children:["Only ",e.stock_quantity," left in stock"]})]})]},e.id))})}function p(){return[{id:"1",name:"Ajax lemon dish liquid",slug:"ajax-lemon-dish-liquid",description:"Powerful dishwashing liquid with fresh lemon scent",price:3.49,compare_price:null,images:[],stock_quantity:50,is_featured:!0,unit:"800 ml",brand:"Ajax",sku:"KF-AJ-001",weight:null,origin:"Local",category_id:null},{id:"2",name:"Ghana Yam",slug:"ghana-yam",description:"Fresh Ghana yam",price:5.99,compare_price:null,images:[],stock_quantity:45,is_featured:!0,unit:"lbs",brand:null,sku:"KF-GH-001",weight:2.5,origin:"Ghana",category_id:null},{id:"3",name:"Jollof Rice (Ready to Eat)",slug:"jollof-rice-ready",description:"Ready to eat Jollof rice",price:12.99,compare_price:null,images:[],stock_quantity:32,is_featured:!0,unit:"serving",brand:null,sku:"KF-JR-001",weight:null,origin:"Local",category_id:null,is_cooked:!0}]}e.s(["default",()=>f],47401);var y=e.i(63059),b=e.i(64659),j=e.i(27612);function v({initialSelectedCategoryIds:e=[],onFiltersChange:s}){let[a,i]=(0,r.useState)([]),[l,n]=(0,r.useState)(e),[o,c]=(0,r.useState)({min:0,max:100}),[u,g]=(0,r.useState)({categories:!0,price:!0,top:!0});(0,r.useEffect)(()=>{m()},[]),(0,r.useEffect)(()=>{e.length>0&&0===l.length&&n(e)},[e]);let m=async()=>{try{let e=(0,d.createClient)(),{data:t,error:r}=await e.from("categories").select("id, name, slug, is_fresh_meals").eq("is_active",!0).eq("is_fresh_meals",!1).order("name");r?(console.error("Error fetching categories:",r),i(w())):i(t||[])}catch(e){console.error("Error:",e),i(w())}},x=e=>{g(t=>({...t,[e]:!t[e]}))};return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"bg-accent text-white p-3 flex items-center justify-between rounded-t-lg",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(j.Trash2,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Filters"})]}),(0,t.jsx)("div",{className:"flex items-center gap-2 text-white/90",children:(0,t.jsx)("span",{className:"text-xs",children:"Refine your search"})})]}),(0,t.jsxs)("div",{className:"border-b border-gray-200",children:[(0,t.jsxs)("button",{onClick:()=>x("top"),className:"w-full p-4 flex items-center justify-between hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2",children:[(0,t.jsx)("span",{className:"font-medium text-gray-900",children:"Top Tags"}),u.top?(0,t.jsx)(b.ChevronDown,{className:"h-4 w-4 text-gray-500"}):(0,t.jsx)(y.ChevronRight,{className:"h-4 w-4 text-gray-500"})]}),u.top&&(0,t.jsxs)("div",{className:"px-4 pb-4",children:[(0,t.jsx)("div",{className:"bg-accent/10 p-2 mb-3 rounded",children:(0,t.jsx)("div",{className:"text-xs text-accent font-medium mb-2",children:"BEST SELLERS"})}),(0,t.jsx)("div",{className:"bg-accent text-white text-center py-2 text-sm font-medium rounded",children:"TOP PICKS >"})]})]}),(0,t.jsxs)("div",{className:"border-b border-gray-200",children:[(0,t.jsxs)("button",{onClick:()=>x("categories"),className:"w-full p-4 flex items-center justify-between hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2",children:[(0,t.jsx)("span",{className:"font-bold text-gray-900",children:"All Categories"}),u.categories?(0,t.jsx)(b.ChevronDown,{className:"h-4 w-4 text-gray-500"}):(0,t.jsx)(y.ChevronRight,{className:"h-4 w-4 text-gray-500"})]}),u.categories&&(0,t.jsx)("div",{className:"px-4 pb-4 space-y-2",children:a.map(e=>(0,t.jsxs)("div",{className:`flex items-center justify-between py-3 px-3 -mx-1 rounded-lg cursor-pointer transition-all duration-200 ${l.includes(e.id)?"bg-brand/5 border border-brand/20 shadow-sm":"hover:bg-gray-50 border border-transparent"}`,onClick:()=>{var t;console.log("Category clicked:",e.id,e.name),console.log("handleCategoryChange c
4alled with:",t=e.id),console.log("Current selectedCategories:",l),n(e=>{let r=e.includes(t),a=r?e.filter(e=>e!==t):[...e,t];return console.log("ProductFilters: Category changed",{categoryId:t,isCurrentlySelected:r,prev:e,newCategories:a,priceRange:o}),s?.({categories:a,priceRange:o}),a})},children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1 pointer-events-none",children:[(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)("div",{className:`w-12 h-6 rounded-full transition-all duration-300 relative ${l.includes(e.id)?"bg-green-500":"bg-gray-300"}`,children:(0,t.jsx)("div",{className:`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full shadow-lg transition-all duration-300 flex items-center justify-center ${l.includes(e.id)?"translate-x-6":"translate-x-0"}`,children:l.includes(e.id)&&(0,t.jsx)("svg",{className:"w-3 h-3 text-green-600 font-bold",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})})}),(0,t.jsx)("span",{className:`text-sm font-medium select-none transition-colors duration-200 ${l.includes(e.id)?"text-brand font-semibold":"text-gray-900"}`,children:e.name})]}),(0,t.jsx)(y.ChevronRight,{className:`h-4 w-4 transition-all duration-200 pointer-events-none ${l.includes(e.id)?"text-brand":"text-gray-400"}`})]},e.id))})]}),(0,t.jsxs)("div",{className:"border-b border-gray-200",children:[(0,t.jsxs)("button",{onClick:()=>x("price"),className:"w-full p-4 flex items-center justify-between hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2",children:[(0,t.jsx)("span",{className:"font-medium text-gray-900",children:"Price"}),u.price?(0,t.jsx)(b.ChevronDown,{className:"h-4 w-4 text-gray-500"}):(0,t.jsx)(y.ChevronRight,{className:"h-4 w-4 text-gray-500"})]}),u.price&&(0,t.jsx)("div",{className:"px-4 pb-4",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-1",children:"Min Price"}),(0,t.jsx)("input",{type:"number",placeholder:"0",value:o.min||"",onChange:e=>{let t={...o,min:Number(e.target.value)||0};c(t),s?.({categories:l,priceRange:t})},className:"w-full px-3 py-2 border-2 border-gray-300 rounded-lg text-sm font-medium text-gray-900 bg-white placeholder-gray-400 focus:border-brand focus:ring-1 focus:ring-brand focus:outline-none"})]}),(0,t.jsx)("div",{className:"text-gray-500 text-sm font-medium mt-5",children:"to"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-gray-600 block mb-1",children:"Max Price"}),(0,t.jsx)("input",{type:"number",placeholder:"100",value:o.max||"",onChange:e=>{let t={...o,max:Number(e.target.value)||100};c(t),s?.({categories:l,priceRange:t})},className:"w-full px-3 py-2 border-2 border-gray-300 rounded-lg text-sm font-medium text-gray-900 bg-white placeholder-gray-400 focus:border-brand focus:ring-1 focus:ring-brand focus:outline-none"})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-600",children:[(0,t.jsx)("span",{children:"Under $5"}),(0,t.jsx)("span",{children:"(12)"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-600",children:[(0,t.jsx)("span",{children:"$5 - $15"}),(0,t.jsx)("span",{children:"(24)"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-600",children:[(0,t.jsx)("span",{children:"$15 - $30"}),(0,t.jsx)("span",{children:"(18)"})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-600",children:[(0,t.jsx)("span",{children:"Over $30"}),(0,t.jsx)("span",{children:"(8)"})]})]})]})})]}),(0,t.jsxs)("div",{className:"p-4 border-t border-gray-200 bg-gray-50",children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,t.jsx)("div",{className:"text-xs font-medium text-gray-600",children:l.length>0||o.min>0||o.max<100?`${l.length+ +(o.min>0||o.max<100)} filter${l.length+ +(o.min>0||o.max<100)!==1?"s":""} active`:"No filters active"})}),(l.length>0||o.min>0||o.max<100)&&(0,t.jsx)("button",{onClick:()=>{n([]),c({min:0,max:100}),s?.({categories:[],priceRange:{min:0,max:100}})},className:"w-full bg-red-50 hover:bg-red-100 text-red-700 font-medium py-2 px-4 roun
4ded-lg transition-colors duration-200 text-sm border border-red-200",children:"Clear All Filters"})]})]})}function w(){return[{id:"1",name:"Fresh Produce",slug:"fresh-produce"},{id:"2",name:"Meat & Poultry",slug:"meat-poultry"},{id:"3",name:"International Foods",slug:"international-foods"},{id:"4",name:"Cooked Meals",slug:"cooked-meals"},{id:"5",name:"Dairy & Eggs",slug:"dairy-eggs"},{id:"6",name:"Pantry Essentials",slug:"pantry-essentials"}]}e.s(["default",()=>v],86896);var N=e.i(37727),_=e.i(87130);function k({isOpen:e,onClose:s,initialSelectedCategoryIds:a=[],onFiltersChange:i}){let l=(0,r.useRef)(null);return((0,r.useEffect)(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset"}),[e]),(0,r.useEffect)(()=>{let t=e=>{"Escape"===e.key&&s()};return e&&document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e,s]),e)?(0,t.jsxs)("div",{className:"fixed inset-0 z-50 lg:hidden",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:s,"aria-hidden":"true"}),(0,t.jsxs)("div",{ref:l,className:"absolute inset-x-0 bottom-0 bg-white rounded-t-xl shadow-2xl max-h-[85vh] flex flex-col animate-in slide-in-from-bottom-full duration-300",role:"dialog","aria-modal":"true","aria-labelledby":"filters-title",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 bg-white rounded-t-xl",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(_.Filter,{className:"h-5 w-5 text-brand"}),(0,t.jsx)("h2",{id:"filters-title",className:"text-lg font-semibold text-gray-900",children:"Filters & Sort"})]}),(0,t.jsx)("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-brand transition-colors","aria-label":"Close filters",children:(0,t.jsx)(N.X,{className:"h-5 w-5 text-gray-600"})})]}),(0,t.jsx)("div",{className:"flex justify-center py-2 border-b border-gray-100",children:(0,t.jsx)("div",{className:"w-12 h-1 bg-gray-300 rounded-full"})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)("div",{className:"p-0",children:(0,t.jsx)(v,{initialSelectedCategoryIds:a,onFiltersChange:i})})}),(0,t.jsxs)("div",{className:"border-t border-gray-200 bg-gray-50 px-4 py-3 flex gap-3",children:[(0,t.jsx)("button",{onClick:s,className:"flex-1 px-4 py-3 bg-gray-200 text-gray-800 rounded-lg font-medium hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400 transition-colors",children:"Clear All"}),(0,t.jsx)("button",{onClick:s,className:"flex-1 px-4 py-3 bg-brand text-white rounded-lg font-medium hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-brand transition-colors",children:"Apply Filters"})]})]})]}):null}e.s(["default",()=>k],8101);var C=e.i(95828);e.s(["Grid",()=>C.default],54922);let $=(0,e.i(75254).default)("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);e.s(["List",()=>$],70956)}]);
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.