import{I as e,i as t,t as n}from"./jsx-runtime-ktpX_HJe.js";import{t as r}from"./Image-Cn5a1pql.js";import{t as i}from"./ArtistLinks-B-97h-o5.js";e();var a=n(),o=e=>{switch(e){case`sm`:return 56;case`md`:return 90;case`lg`:return 125}},s=(e,t,n,i)=>{let s=o(e),c=``,l=``;switch(e){case`sm`:c=`${t.xs} 64w, ${t.small} 128w, ${t.medium} 300w`,l=`56px`;break;case`md`:c=`${t.small} 128w, ${t.medium} 300w`,l=`90px`;break;case`lg`:c=`${t.small} 128w, ${t.medium} 300w, ${t.large} 640w`,l=`123px`;break}return(0,a.jsx)(r,{src:t.medium,size:s,lazy:i,alt:n,srcset:c,sizes:l})};function c({image:e,size:n,title:r,link:i,subtitle:c,meta:l,alt:u,className:d,alignTop:f,lazy:p}){return(0,a.jsxs)(`div`,{className:`flex ${f?`items-start`:`items-center`} gap-3 ${d??``}`,children:[(0,a.jsx)(t,{to:i,style:{minWidth:o(n)},children:s(n,e,u,p||!1)}),(0,a.jsxs)(`div`,{className:`flex flex-col items-start`,style:f?{marginTop:6}:void 0,children:[(0,a.jsx)(t,{to:i,style:{minWidth:o(n)},children:(0,a.jsx)(`div`,{className:`line-clamp-2 hover:text-(--color-fg-secondary)`,children:r})}),c!==void 0&&(0,a.jsx)(`div`,{className:`text-[12px] sm:text-[14px]`,children:c}),l!==void 0&&(0,a.jsx)(`div`,{className:`color-fg-secondary text-[12px] sm:text-[14px]`,children:l})]})]})}function l({size:e,subtitle:t,meta:n,className:r,bgColor:i,alignTop:s}){let c=o(e),l=e===`sm`?100:e===`md`?140:180,u=i||`bg-secondary`;return(0,a.jsxs)(`div`,{className:`flex ${s?`items-start`:`items-center`} gap-3 ${r??``}`,children:[(0,a.jsx)(`div`,{className:`rounded-(--border-radius) ${u} animate-pulse shrink-0`,style:{width:c,height:c}}),(0,a.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,style:s?{marginTop:6}:void 0,children:[(0,a.jsx)(`div`,{className:`h-4 ${u} animate-pulse rounded-(--border-radius)`,style:{width:l}}),t&&(0,a.jsx)(`div`,{className:`h-3 ${u} animate-pulse rounded-(--border-radius)`,style:{width:l*.7}}),n&&(0,a.jsx)(`div`,{className:`h-3 ${u} animate-pulse rounded-(--border-radius)`,style:{width:l*.5}})]})]})}function u({data:e,slug:n,separators:r,startIndex:i,type:o,className:s,ranked:c,showSeeMore:l}){return i&&e.items.splice(0,i-1),(0,a.jsxs)(`div`,{className:`flex flex-col gap-1 ${s} min-w-[200px]`,children:[e.items.map((t,n)=>(0,a.jsxs)(`div`,{style:{fontSize:12},className:`mb-0.5`,children:[(0,a.jsx)(d,{ranked:c,rank:t.rank,item:t.item,type:o}),r&&n!==e.items.length-1&&(0,a.jsx)(`div`,{className:`border-b border-(--color-bg-tertiary) mt-2`})]},`${o}-${t.item.id}`)),l&&e.has_next_page&&(0,a.jsx)(`div`,{className:`flex items-center w-full mt-2`,children:(0,a.jsx)(t,{to:n,className:`text-[13px] sm:text-[15px] inline-block w-fit mx-auto text-(--color-fg-secondary) hover:text-(--color-fg) hover:cursor-pointer`,children:`SEE MORE →`})})]})}function d({item:e,type:t,rank:n,ranked:r}){let o=t===`album`,s=t===`artist`,l=e,u=o?l.is_various_artists?`Various Artists`:(0,a.jsx)(i,{artists:[l.artists[0]]}):s?void 0:(0,a.jsx)(i,{artists:l.artists});return(0,a.jsx)(`table`,{className:`table-fixed w-full sm:text-[15px] text-[13px] border-collapse`,children:(0,a.jsx)(`tbody`,{children:(0,a.jsxs)(`tr`,{children:[r&&(0,a.jsx)(`td`,{className:`w-8 pr-3`,children:(0,a.jsx)(`div`,{className:`color-fg-secondary text-end ${n===1&&`color-primary`}`,children:n.toString().padStart(2,`0`)})}),(0,a.jsx)(`td`,{className:`max-w-0 w-full pr-3 py-1`,children:(0,a.jsx)(c,{className:`gap-2`,image:l.image,link:`/${t}/${l.id}`,size:`sm`,title:s?l.name:l.title,alt:s?l.name:l.title,meta:u,lazy:!0})}),(0,a.jsx)(`td`,{className:`w-[75px]`,children:(0,a.jsxs)(`div`,{className:`color-fg-secondary text-end`,children:[l.listen_count,` plays`]})})]})})})}function f({count:e=5,ranked:t,type:n,className:r}){return(0,a.jsx)(`div`,{className:`flex flex-col gap-1 ${r} min-w-[350px]`,children:Array.from({length:e}).map((e,r)=>(0,a.jsx)(`div`,{style:{fontSize:12},className:`mb-3`,children:(0,a.jsx)(`table`,{className:`sm:text-[15px] text-[13px] border-collapse`,children:(0,a.jsx)(`tbody`,{children:(0,a.jsxs)(`tr`,{children:[t&&(0,a.jsx)(`td`,{className:`pr-3`,children:(0,a.jsx)(`div`,{className:`w-5 h-3 bg-secondary animate-pulse rounded-(--border-radius)`})}),(0,a.jsx)(`td`,{className:`pr-3 py-1 w-full`,children:(0,a.jsx)(l,{size:`sm`,className:`gap-2`,subtitle:n===`track`,meta:n===`album`})}),(0,a.jsx)(`td`,{className:`min-w-[75px]`,children:(0,a.jsx)(`div`,{className:`flex justify-end`,children:(0,a.jsx)(`div`,{className:`w-14 h-3 bg-secondary animate-pulse rounded-(--border-radius)`})})})]})})})},r))})}export{l as i,f as n,c as r,u as t};