import{I as y}from"./ItemsListing-HGPehT6Y.js";import{d as v,r as l,s as d,o as b,b as a,a9 as n,a as D,c as E,h,f as p,u as w,F as I,M as m,ad as u}from"./index-BcUYXcPq.js";import{_ as A}from"./AddManualLink.vue_vue_type_script_setup_true_lang-83nPE71y.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_85c6bb69_lang-CQtpREte.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-B54PMsCQ.js";import"./VListItem-DC0X47Q4.js";import"./VCheckboxBtn-DvMOQpng.js";import"./VList-BKlimdrv.js";import"./VCardText-D-aWL0fz.js";import"./VCard-Dx-t9yLE.js";import"./VMenu-7bd_kTRb.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-Cq4V-Lz8.js";import"./Button-70QbWoUa.js";import"./VCheckbox-BEPbmvTc.js";import"./VSpacer-G9Q32ju2.js";/* empty css              */import"./PanelviewItemCompact-w04R_lVh.js";import"./VAlert-DbYDqcUs.js";import"./Container-BixSAZes.js";import"./VContainer-CoH7hbKx.js";import"./Toolbar-CtV0cu85.js";import"./VToolbar-B-HEXsGH.js";import"./VTextField-rtqk6KCF.js";import"./VInfiniteScroll-BVPAk5NO.js";import"./layout-B1VfN3Kd.js";import"./VRow-CBTscIT0.js";import"./VVirtualScroll-BfIwRbDJ.js";import"./VDialog-Bj6h5fTK.js";const at=v({name:"Radios",__name:"LibraryRadios",setup(T){const o=l(!1),s=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 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 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){s.value=d.libraryRadiosCount;return}s.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:s.value},null,8,["update-available","title","extra-menu-items","total"]),p(A,{modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=i=>r.value=i),type:w(m).RADIO},null,8,["modelValue","type"])],64))}});export{at as default};
