import{I as y}from"./ItemsListing-e7c9377b.js";import{d as v,r as l,s as d,o as b,b as a,a7 as n,a as D,c as E,g as h,f as p,u as w,F as I,M as m}from"./index-e34071c2.js";import{_ as A}from"./AddManualLink.vue_vue_type_script_setup_true_lang-f7a77427.js";import{s as u}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:"Radios",__name:"LibraryRadios",setup(g){const o=l(!1),i=l(d.libraryRadiosCount),r=l(!1),c=["name","name_desc","sort_name","sort_name_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://radio")&&(o.value=!0)});D(t)});const f=async function(t){if(t.refresh&&!o.value){for(a.startSync([m.RADIO]),await u(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(m.RADIO)).length!=0;)await u(500);await u(500)}return o.value=!1,_(t),await a.getLibraryRadios(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},_=async function(t){if(!t.favoritesOnly){i.value=d.libraryRadiosCount;return}i.value=await a.getLibraryRadiosCount(t.favoritesOnly||!1)};return(t,e)=>(E(),h(I,null,[p(y,{itemtype:"radios","show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":f,"sort-keys":c,"update-available":o.value,title:t.$t("radios"),"show-search-button":!0,"allow-key-hooks":!0,"extra-menu-items":[{label:"add_url_item",labelArgs:[],action:()=>{r.value=!0},icon:"mdi-playlist-plus"}],icon:"mdi-access-point","restore-state":!0,total:i.value},null,8,["update-available","title","extra-menu-items","total"]),p(A,{modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=s=>r.value=s),type:w(m).RADIO},null,8,["modelValue","type"])],64))}});export{Y as default};
