import{g as b,v as f,r as k,o as V,L as l,M as p,y as o,E as r,F as d,G as y,l as m,A as u,z as v,B as C,N as h,D as g,I as S,W as _}from"./index-ab7e5b57.js";import{_ as D}from"./PanelviewItem.vue_vue_type_style_index_0_lang-f3f21d77.js";import{i as L,e as x}from"./contextmenu-81dbffb6.js";import{x as G,y as A,V as E,k as N}from"./forwardRefs-d370b8e9.js";import{V as B}from"./VBadge-babce8af.js";import{V as P}from"./VToolbar-93b44e3d.js";import{V as M,a as $}from"./VSlideGroup-6eee8f80.js";import"./ListItem-fd009900.js";import"./VMenu-9ab9e35f.js";import"./VTooltip-775ce0c0.js";import"./VCheckboxBtn-b3446400.js";import"./VCard-b678de17.js";import"./VCardText-2b5487e9.js";const T=b()({name:"VSlideGroupItem",props:G(),emits:{"group:selected":c=>!0},setup(c,t){let{slots:n}=t;const e=A(c,M);return()=>{var i;return(i=n.default)==null?void 0:i.call(n,{isSelected:e.isSelected.value,select:e.select,toggle:e.toggle,selectedClass:e.selectedClass.value})}}}),F={key:0,class:"widget-row"},I={class:"mr-3"},O={key:1,class:"mr-3"},R=f({__name:"HomeView",setup(c){const t=k({recently_played:{label:"recently_played",icon:"mdi-motion-play",items:[]},artists:{label:"artists",icon:"mdi-account-music",path:"/artists",items:[]},albums:{label:"albums",icon:"mdi-album",path:"/albums",items:[]},playlists:{label:"playlists",icon:"mdi-playlist-music",path:"/playlists",items:[]},tracks:{label:"tracks",icon:"mdi-file-music",path:"/tracks",items:[]},radios:{label:"radios",icon:"mdi-radio",path:"/radios",items:[]},browse:{label:"browse",icon:"mdi-folder",path:"/browse",items:[]}});V(async()=>{l.getRecentlyPlayedItems(20).then(e=>{t.value.recently_played.items=e}),l.getLibraryArtists(void 0,void 0,20,void 0,"RANDOM()").then(e=>{t.value.artists.items=e.items,t.value.artists.count=e.total}),l.getLibraryAlbums(void 0,void 0,20,void 0,"timestamp_added DESC").then(e=>{t.value.albums.items=e.items,t.value.albums.count=e.total}),l.getRecentlyPlayedItems(10,[p.PLAYLIST]).then(e=>{t.value.playlists.items=e,l.getLibraryPlaylists(void 0,void 0,20,void 0,"timestamp_added DESC").then(i=>{t.value.playlists.count=i.total;const s=e.map(function(a){return a.name});for(const a of i.items)s.includes(a.name)||t.value.playlists.items.push(a)})}),l.getRecentlyPlayedItems(10,[p.RADIO]).then(e=>{t.value.radios.items=e,l.getLibraryRadios(void 0,void 0,20,void 0,"timestamp_added DESC").then(i=>{t.value.radios.count=i.total;const s=e.map(function(a){return a.name});for(const a of i.items)s.includes(a.name)||t.value.radios.items.push(a)})}),l.getLibraryTracks(void 0,void 0,20,void 0,"timestamp_added DESC").then(e=>{t.value.tracks.items=e.items,t.value.tracks.count=e.total}),await l.browse("",e=>{t.value.browse.items.push(...e)})});const n=function(e){L(e)&&["artist","album","playlist"].includes(e.media_type)?_.push({name:e.media_type,params:{itemId:e.item_id,provider:e.provider}}):e.media_type===p.FOLDER?_.push({name:"browse",query:{path:e.path}}):x.emit("playdialog",{items:[e],showContextMenuItems:!0})};return(e,i)=>(o(),r("div",null,[(o(!0),r(d,null,y(t.value,s=>(o(),r("div",{key:s.label},[m(E),s.items.length?(o(),r("div",F,[m(P,{color:"transparent",style:g(s.path?"cursor: pointer":""),onClick:a=>s.path?e.$router.replace(s.path):""},{prepend:u(()=>[m(N,{icon:s.icon,style:{"margin-left":"15px"}},null,8,["icon"])]),title:u(()=>[s.count?(o(),v(B,{key:0,inline:"",color:"grey",content:s.count},{default:u(()=>[C("span",I,h(e.$t(s.label)),1)]),_:2},1032,["content"])):(o(),r("span",O,h(e.$t(s.label)),1))]),_:2},1032,["style","onClick"]),m($,{"show-arrows":""},{default:u(()=>[(o(!0),r(d,null,y(s.items,a=>(o(),v(T,{key:a.uri},{default:u(()=>[m(D,{item:a,"show-checkboxes":!1,"show-track-number":!1,"is-selected":!1,style:{height:"160px",width:"120px",margin:"5px"},onClick:n},null,8,["item"])]),_:2},1024))),128))]),_:2},1024)])):S("",!0)]))),128))]))}});export{R as default};
