import{I as y}from"./ItemsListing-e7c9377b.js";import{d as v,r as l,s as c,o as b,b as a,a7 as n,a as k,c as T,g as E,f as d,u as h,F as w,M as u}from"./index-e34071c2.js";import{_ as D}from"./AddManualLink.vue_vue_type_script_setup_true_lang-f7a77427.js";import{s as m}from"./VCheckbox-081529bb.js";import"./eventbus-edb4a70e.js";import"./VListItem-6fb16d04.js";import"./ListItem-f09faddc.js";import"./Button-d52131a6.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./VMenu-8ea0aa0a.js";import"./VCard-0f63f60c.js";import"./VCardText-2a290ffe.js";import"./VSpacer-b7ae4876.js";/* empty css              */import"./PanelviewItemCompact-8de8744a.js";import"./VAlert-cd8a958f.js";import"./Container-1af89f37.js";import"./Toolbar-bbf3d11a.js";import"./VList-5a526902.js";import"./VToolbar-790d92bd.js";import"./VTextField-df721147.js";import"./VCheckboxBtn-43c6a5b9.js";import"./VInfiniteScroll-311fcdfe.js";import"./layout-4fa46c33.js";import"./VVirtualScroll-8b839030.js";import"./VDialog-57dacf99.js";const Y=v({name:"Tracks",__name:"LibraryTracks",setup(A){const o=l(!1),r=l(c.libraryTracksCount),i=l(!1),p=["name","name_desc","sort_name","sort_name_desc","duration","duration_desc","timestamp_added","timestamp_added_desc","last_played","last_played_desc","play_count","play_count_desc"];b(()=>{const t=a.subscribe_multi([n.MEDIA_ITEM_ADDED,n.MEDIA_ITEM_UPDATED,n.MEDIA_ITEM_DELETED],e=>{var s;(s=e.object_id)!=null&&s.startsWith("library://track")&&(o.value=!0)});k(t)});const f=async function(t){if(t.favoritesOnly=t.favoritesOnly||void 0,t.refresh&&!o.value){for(a.startSync([u.TRACK]),await m(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(u.TRACK)).length!=0;)await m(500);await m(500)}return o.value=!1,_(t),await a.getLibraryTracks(t.favoritesOnly,t.search,t.limit,t.offset,t.sortBy)},_=async function(t){if(!t.favoritesOnly){r.value=c.libraryTracksCount;return}r.value=await a.getLibraryTracksCount(t.favoritesOnly||!1)};return(t,e)=>(T(),E(w,null,[d(y,{itemtype:"tracks","show-provider":!1,"show-favorites-only-filter":!0,"show-track-number":!1,"load-paged-data":f,"sort-keys":p,"show-album":!0,"update-available":o.value,title:t.$t("tracks"),"show-search-button":!0,"allow-key-hooks":!0,"extra-menu-items":[{label:"add_url_item",labelArgs:[],action:()=>{i.value=!0},icon:"mdi-playlist-plus"}],icon:"mdi-music-note","restore-state":!0,total:r.value},null,8,["update-available","title","extra-menu-items","total"]),d(D,{modelValue:i.value,"onUpdate:modelValue":e[0]||(e[0]=s=>i.value=s),type:h(u).RADIO},null,8,["modelValue","type"])],64))}});export{Y as default};
