import{g as b,l as _,r as k,o as V,L as l,M as p,y as o,I as m,F as d,J as y,j as u,B as C,A as r,z as v,H as h,R as S,N as g,E as x,v as f}from"./index-c2905444.js";import{_ as L}from"./PanelviewItem.vue_vue_type_style_index_0_lang-74d21d61.js";import{e as D}from"./eventbus-d154090d.js";import{i as A}from"./contextmenu-c9d825c5.js";import{x as E,y as G,V as N,k as P}from"./VImg-ee22af0e.js";import{V as B}from"./VBadge-78c551e8.js";import{V as M}from"./VToolbar-0b568cf9.js";import{V as T,a as $}from"./VSlideGroup-2bb96bf3.js";import"./utils-a855eb36.js";import"./ListItem-e72ce29c.js";import"./VMenu-8ba8f078.js";import"./VCheckboxBtn-020d02eb.js";import"./VCard-a2a52f2b.js";import"./VTooltip-54e33c2a.js";const F=b()({name:"VSlideGroupItem",props:E(),emits:{"group:selected":c=>!0},setup(c,t){let{slots:n}=t;const e=G(c,T);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})}}}),H={key:0,class:"widget-row"},R=_({__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}),l.browse().then(e=>{t.value.browse.items=e.items})});const n=function(e){A(e)&&["artist","album","playlist"].includes(e.media_type)?f.push({name:e.media_type,params:{itemId:e.item_id,provider:e.provider}}):e.media_type===p.FOLDER?f.push({name:"browse",query:{path:e.path}}):D.emit("playdialog",{items:[e],showContextMenuItems:!0})};return(e,i)=>(o(),m("div",null,[(o(!0),m(d,null,y(t.value,s=>(o(),m("div",{key:s.label},[u(N),s.items.length?(o(),m("div",H,[u(M,{color:"transparent",onClick:a=>s.path?e.$router.replace(s.path):"",style:x(s.path?"cursor: pointer":"")},C({prepend:r(()=>[u(P,{icon:s.icon,style:{"margin-left":"15px"}},null,8,["icon"])]),title:r(()=>[S(g(e.$t(s.label)),1)]),_:2},[s.path?{name:"append",fn:r(()=>[s.count?(o(),v(B,{key:0,color:"grey",content:s.count,inline:""},null,8,["content"])):h("",!0)]),key:"0"}:void 0]),1032,["onClick","style"]),u($,{"show-arrows":!1},{prev:r(()=>[]),next:r(()=>[]),default:r(()=>[(o(!0),m(d,null,y(s.items,a=>(o(),v(F,{key:a.uri},{default:r(()=>[u(L,{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)])):h("",!0)]))),128))]))}});export{R as default};
