import{I as f}from"./ItemsListing-C9zw7KHa.js";import{s as p,f as i,i as _,E as r,e as v}from"./index-CyXUjyDM.js";import{d as b,r as l,o as h,a0 as w,D as E,u as I,aL as A,e as D}from"./lucide-BsOfcLnq.js";import"./Container-D40_MO5w.js";import"./index-kQIztB-E.js";import"./vuetify-DHCm6MV9.js";import"./Toolbar-CTiACIvy.js";import"./userPreferences-CnLqlkxN.js";import"./vue-router-hLkI791z.js";import"./Button-DbnN1LyR.js";import"./ListItem-_zvhSn9K.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-cya6xPO3.js";import"./MediaItemThumb-BvqlnbT6.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-CsLTxntn.js";import"./vue-i18n-CXdnqGsF.js";import"./PanelviewItemCompact-Dlf-jeIa.js";import"./qrcode-DcFvg0BH.js";import"./marked-i_gIkIP3.js";import"./color-BTziYnFN.js";import"./vueuse-CmMrRm2c.js";/* empty css            */import"./swiper-BIRaDS2w.js";const J=b({name:"Playlists",__name:"LibraryPlaylists",setup(P){const s=l(!1),e=l(p.libraryPlaylistsCount),a=l([]),d=["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"],m=async function(t){return s.value=!1,c(t),await i.getLibraryPlaylists(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy,t.provider&&t.provider.length>0?t.provider:void 0,t.genreIds)},c=async function(t){if(!t.favoritesOnly&&!t.provider){e.value=p.libraryPlaylistsCount;return}if(t.provider&&t.provider.length>0){e.value=void 0;return}e.value=await i.getLibraryPlaylistsCount(t.favoritesOnly||!1)};h(()=>{const t=[];for(const o of Object.values(i.providers).filter(u=>u.available&&u.supported_features.includes(_.PLAYLIST_CREATE)))t.push({label:"create_playlist_on",labelArgs:[o.name],action:()=>{y(o.instance_id)},icon:"mdi-playlist-plus",overflowAllowed:!0});t.length&&a.value.push({label:"create_playlist_on",icon:"mdi-playlist-plus",subItems:t,overflowAllowed:!0});const n=i.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],o=>{o.object_id?.startsWith("library://playlist")&&(s.value=!0)});w(n)});const y=function(t){v.emit("createPlaylist",{providerId:t})};return(t,n)=>(D(),E(f,{itemtype:"playlists",path:"libraryplaylists","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":m,"show-library":!0,"sort-keys":d,"update-available":s.value,title:t.$t("playlists"),"allow-key-hooks":!0,"show-search-button":!0,"show-genre-filter":!0,"extra-menu-items":a.value,icon:I(A),"restore-state":!0,total:e.value,"show-provider-filter":!0},null,8,["update-available","title","extra-menu-items","icon","total"]))}});export{J as default};
