import{I as y}from"./ItemsListing-Bq7dQOiw.js";import{s as d,f as r,h as s,E as a,e as v}from"./index-DkCrJWiT.js";import{d as E,r as n,o as b,a0 as A,D as I,u as h,aL as T,e as L}from"./lucide-CCrbsyJI.js";import"./Container-ht6g3SFE.js";import"./index-kQIztB-E.js";import"./vuetify-DEtiqX2e.js";import"./Toolbar-Cm8ayNM7.js";import"./userPreferences-CvP8TO0n.js";import"./vue-router-D-D-f2lE.js";import"./Button-C0-5VNWx.js";import"./ListItem-DbXLF-gF.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-ZEWdOjMC.js";import"./MediaItemThumb-BOlp6GIr.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-hy1bGinH.js";import"./vue-i18n-krBRuO6q.js";import"./PanelviewItemCompact-CXjnVwrs.js";import"./color-CcshWhNz.js";import"./qrcode-CCHMWIXh.js";import"./marked-i_gIkIP3.js";import"./vueuse-FEBxOGD_.js";/* empty css            */import"./swiper-YiD1SI-4.js";const N=E({name:"Playlists",__name:"LibraryPlaylists",setup(P){const l=n(!1),o=n(d.libraryPlaylistsCount),u=n([]),_=["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"],c=async function(e){return l.value=!1,m(e),await r.getLibraryPlaylists(e.favoritesOnly||void 0,e.search,e.limit,e.offset,e.sortBy,e.provider&&e.provider.length>0?e.provider:void 0,e.genreIds)},m=async function(e){if(!e.favoritesOnly&&!e.provider){o.value=d.libraryPlaylistsCount;return}if(e.provider&&e.provider.length>0){o.value=void 0;return}o.value=await r.getLibraryPlaylistsCount(e.favoritesOnly||!1)};b(()=>{const e=[];for(const i of Object.values(r.providers).filter(t=>t.available&&(t.supported_features.includes(s.PLAYLIST_CREATE)||t.supported_features.includes(s.PLAYLIST_CREATE_TRACKS)||t.supported_features.includes(s.PLAYLIST_CREATE_AUDIOBOOKS)||t.supported_features.includes(s.PLAYLIST_CREATE_PODCAST_EPISODES)||t.supported_features.includes(s.PLAYLIST_CREATE_RADIOS))))e.push({label:"create_playlist_on",labelArgs:[i.name],action:()=>{f(i.instance_id)},icon:"mdi-playlist-plus",overflowAllowed:!0});e.length&&u.value.push({label:"create_playlist_on",icon:"mdi-playlist-plus",subItems:e,overflowAllowed:!0});const p=r.subscribe_multi([a.MEDIA_ITEM_ADDED,a.MEDIA_ITEM_UPDATED,a.MEDIA_ITEM_DELETED],i=>{i.object_id?.startsWith("library://playlist")&&(l.value=!0)});A(p)});const f=function(e){v.emit("createPlaylist",{providerId:e})};return(e,p)=>(L(),I(y,{itemtype:"playlists",path:"libraryplaylists","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":c,"show-library":!0,"sort-keys":_,"update-available":l.value,title:e.$t("playlists"),"allow-key-hooks":!0,"show-search-button":!0,"show-genre-filter":!0,"extra-menu-items":u.value,icon:h(T),"restore-state":!0,total:o.value,"show-provider-filter":!0},null,8,["update-available","title","extra-menu-items","icon","total"]))}});export{N as default};
