import{I as _}from"./ItemsListing-6g08lefW.js";import{x as v,r as l,H as u,o as b,I as a,af as n,b as D,y as E,D as h,n as d,G as I,F as w,M as m,aj as p}from"./index-CiFFF7gT.js";import{_ as A}from"./AddManualLink.vue_vue_type_script_setup_true_lang-BA_RF4yP.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_4409cede_lang-Z-tWQ5Xz.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-DHkbc-Ta.js";import"./VListItem-De5QDDiQ.js";import"./VChip-BY-Tj5X5.js";import"./VList-ox5PnObc.js";import"./VCardText-DAFrt-9i.js";import"./VCard-OVRwQRVf.js";import"./VMenu-pCNX3_Sk.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-DLjAZgMM.js";import"./VCheckbox-CjvWyEya.js";import"./VCheckboxBtn-BFRXrpB8.js";import"./VTooltip-DXDcYn3_.js";import"./VSpacer-ouclmOAP.js";/* empty css              */import"./PanelviewItemCompact-BLpiE-97.js";import"./Container-cMCd9Qd7.js";import"./VContainer-CuT7UpRw.js";import"./Toolbar-D7ssdDI_.js";import"./VToolbar-Cw0dLkzx.js";import"./VTextField-BPDkDfKc.js";import"./VInfiniteScroll-fVwyx_Ti.js";import"./layout-CZzu_XZd.js";import"./VRow-DJbzO2VZ.js";import"./VVirtualScroll-BganvpON.js";import"./VAlert-DvGaZwBF.js";import"./VDialog-dHvRVqSU.js";const ot=v({name:"Radios",__name:"LibraryRadios",setup(T){const o=l(!1),s=l(u.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 i;(i=e.object_id)!=null&&i.startsWith("library://radio")&&(o.value=!0)});D(t)});const f=async function(t){if(t.refresh&&!o.value){for(a.startSync([m.RADIO]),await p(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(m.RADIO)).length!=0;)await p(500);await p(500)}return o.value=!1,y(t),await a.getLibraryRadios(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},y=async function(t){if(!t.favoritesOnly){s.value=u.libraryRadiosCount;return}s.value=await a.getLibraryRadiosCount(t.favoritesOnly||!1)};return(t,e)=>(E(),h(w,null,[d(_,{itemtype:"radios",path:"libraryradios","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:s.value},null,8,["update-available","title","extra-menu-items","total"]),d(A,{modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=i=>r.value=i),type:I(m).RADIO},null,8,["modelValue","type"])],64))}});export{ot as default};
