import{I as e,t}from"./jsx-runtime-ktpX_HJe.js";import{i as n,o as r}from"./LastPlayed-CtFlEIGx.js";import{i}from"./Image-iLcFsxYI.js";import"./Modal-BHePu0hN.js";import{r as a}from"./TopItemList-DirbLxx_.js";var o=t(),s=e=>i(`/apis/web/v1/top/albums`,{period:`all_time`,limit:99,artist_id:e});function c({artistId:e,name:t}){let{isPending:i,isError:c,data:l,error:u}=r({queryKey:[`artist-albums`,e],queryFn:()=>s(e)});return i?(0,o.jsxs)(`div`,{children:[(0,o.jsx)(n,{children:`Albums From This Artist`}),(0,o.jsx)(`p`,{children:`Loading...`})]}):c?(0,o.jsxs)(`div`,{children:[(0,o.jsx)(n,{children:`Albums From This Artist`}),(0,o.jsxs)(`p`,{className:`error`,children:[`Error:`,u.message]})]}):(0,o.jsxs)(`div`,{children:[(0,o.jsxs)(n,{children:[`Albums featuring `,t]}),(0,o.jsxs)(`div`,{className:`flex flex-wrap gap-8 mt-8`,children:[l.items.length<1&&`Nothing to show`,l.items.map(e=>(0,o.jsx)(`div`,{className:`w-[330px]`,children:(0,o.jsx)(a,{image:e.item.image,size:`lg`,link:`/album/${e.item.id}`,alt:e.item.title,alignTop:!0,title:e.item.title,meta:`${e.item.listen_count} plays`})},e.item.id))]})]})}e();export{c as t};