import{I as f}from"./ItemsListing-6VW59A0B.js";import{av as b,bG as v,H as o,au as u,aL as e,aM as h,a3 as I,aN as w,b6 as r,a4 as E,aD as P,ax as T}from"./index-C-Ivu3jU.js";import"./Container-DVyc_Yt_.js";import"./index-kQIztB-E.js";import"./VContainer-CNNJtZg6.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./Toolbar-CLPRlZ-4.js";import"./VToolbar-DTucOBiF.js";import"./Button-FtStaD9_.js";import"./ListItem-BLmrgznL.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-B5IzKSW4.js";import"./VCheckboxBtn-BmKOjEU4.js";import"./VInput-CnrZS6Kh.js";import"./MediaItemThumb-BsXB7IV6.js";import"./PanelviewItemCompact-5_ppRL3T.js";import"./VTextField-Bkx949P5.js";import"./VSnackbar-C_PtJN1U.js";import"./layout-D2NB7OTD.js";import"./VRow-DOG0WeJD.js";import"./VVirtualScroll-C_Lzj3jv.js";import"./VAlert-B3qbTkCR.js";const q=b({name:"Playlists",__name:"LibraryPlaylists",setup(A){const{t:c}=v(),l=o(!1),i=o(u.libraryPlaylistsCount),n=o([{label:"sync_now",icon:"mdi-sync",action:()=>{e.startSync([h.PLAYLIST])},overflowAllowed:!0,disabled:e.syncTasks.value.length>0}]),m=["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 l.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){i.value=u.libraryPlaylistsCount;return}i.value=await e.getLibraryPlaylistsCount(t.favoritesOnly||!1)};I(()=>{const t=[];for(const a of Object.values(e.providers).filter(p=>p.available&&p.supported_features.includes(w.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")&&(l.value=!0)});E(s)});const _=async function(t){const s=prompt(c("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":m,"update-available":l.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:i.value},null,8,["update-available","title","extra-menu-items","total"]))}});export{q as default};
