import{j as s}from"./@radix-D8tIKeo-.js";import{e as n,aI as l,B as c,s as m}from"./index-B44sgOyQ.js";import{f as d}from"./index-Hfv1xSzc.js";import{k as p}from"./@tanstack-nMqraTcu.js";import{C as u}from"./ComponentIcon-Btqtj6Xx.js";function L({type:a,setSelectedFlavor:e}){const r=p(d.flavorListInfinite({type:a}));if(r.isPending)return s.jsx(f,{});if(r.isError)return s.jsx("p",{children:"Failed to fetch Flavor List"});const{data:t}=r;return s.jsx("ul",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-4",children:t.pages.map(o=>o.items.map(i=>s.jsx("li",{className:"",children:s.jsx(x,{type:a,onClick:()=>e(i),id:i.id,name:i.name,displayName:i.body?.display_name??void 0,logoUrl:i.body?.logo_url??void 0})},i.id)))})}function x({name:a,logoUrl:e,onClick:r,type:t,displayName:o}){const i=o??l(a);return s.jsxs(c,{onClick:r,intent:"secondary",emphasis:"subtle",className:"h-auto w-full gap-2 px-5 py-3",children:[e?s.jsx("img",{alt:`Logo of ${a}`,width:36,height:36,className:"aspect-square object-contain",src:m(e)}):s.jsx(u,{className:"aspect-square h-[36px] w-[36px] fill-primary-400 object-contain",type:t}),s.jsx("span",{className:"min-w-0 truncate",children:i})]})}function f(){return s.jsx("ul",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 2xl:grid-cols-4",children:Array.from({length:4}).map((a,e)=>s.jsx(n,{className:"h-[70px] w-full"},e))})}export{L as S};
