import{I as f}from"./ItemsListing-CqOkN5bP.js";import{d as b,bw as v,i as o,s as m,m as e,M as h,j as w,P as I,a_ as r,l as E,e as P,o as T}from"./index-BLuBzgcR.js";import"./Container-BVutxj42.js";import"./index-CBho6rsP.js";import"./VContainer-DOe7JF0h.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./Toolbar-RSDUeNZR.js";import"./VToolbar-BFOvSQM-.js";import"./VBtn-i8gedOhv.js";import"./Button-BEhYIX-0.js";import"./ListItem-D3UfOTqB.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-Dwz4QKKd.js";import"./VInput-S8c2HXsf.js";import"./MediaItemThumb-4FqrTjbr.js";import"./PanelviewItemCompact-Czo8xJLH.js";import"./VSpacer-FdmIBMIx.js";import"./VTextField-BRzkPyuL.js";import"./VInfiniteScroll-XtiIpwbc.js";import"./layout-Dtt5lK8k.js";import"./VRow-Dw7kUaJt.js";import"./VVirtualScroll-JP5E3DQw.js";import"./VAlert-Du-laR0E.js";const N=b({name:"Playlists",__name:"LibraryPlaylists",setup(A){const{t:u}=v(),i=o(!1),l=o(m.libraryPlaylistsCount),n=o([{label:"sync_now",icon:"mdi-sync",action:()=>{e.startSync([h.PLAYLIST])},overflowAllowed:!0,disabled:e.syncTasks.value.length>0}]),c=["name","name_desc","sort_name","sort_name_desc","timestamp_added","timestamp_added_desc","timestamp_modified","timestamp_modified_desc","last_played","last_played_desc","play_count","play_count_desc"],y=async function(t){return i.value=!1,d(t),await e.getLibraryPlaylists(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},d=async function(t){if(!t.favoritesOnly){l.value=m.libraryPlaylistsCount;return}l.value=await e.getLibraryPlaylistsCount(t.favoritesOnly||!1)};w(()=>{const t=[];for(const a of Object.values(e.providers).filter(p=>p.available&&p.supported_features.includes(I.PLAYLIST_CREATE)))t.push({label:"create_playlist_on",labelArgs:[a.name],action:()=>{_(a.instance_id)},icon:"mdi-playlist-plus"});t.length&&n.value.push({label:"create_playlist_on",icon:"mdi-playlist-plus",subItems:t});const s=e.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],a=>{a.object_id?.startsWith("library://playlist")&&(i.value=!0)});E(s)});const _=async function(t){const s=prompt(u("new_playlist_name"));s&&await e.createPlaylist(s,t).then(()=>location.reload()).catch(a=>alert(a))};return(t,s)=>(T(),P(f,{itemtype:"playlists",path:"libraryplaylists","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":y,"show-library":!0,"sort-keys":c,"update-available":i.value,title:t.$t("playlists"),"allow-key-hooks":!0,"show-search-button":!0,"extra-menu-items":n.value,icon:"mdi-playlist-play","restore-state":!0,total:l.value},null,8,["update-available","title","extra-menu-items","total"]))}});export{N as default};
