import{_ as f}from"./ItemsListing.vue_vue_type_style_index_0_lang-8114fc79.js";import{v as _,Q as y,r as u,o as b,L as a,ak as s,b as v,y as h,z as D,x as k,M as i,al as n,K as E}from"./index-20675090.js";import"./ListviewItem-ea07a19b.js";import"./VBadge-778cac01.js";import"./ListItem-e092a77b.js";import"./forwardRefs-67412654.js";import"./VMenu-ae4158ef.js";import"./VCheckboxBtn-bbfa74a1.js";import"./VSlideGroup-14bb6bf6.js";import"./VCard-30020028.js";import"./VCardText-5e149cd1.js";import"./VTooltip-cf009865.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-4e768a3d.js";import"./contextmenu-ec90c658.js";import"./Alert-daf9024b.js";import"./Container-e8fef44d.js";/* empty css              */import"./VToolbar-7174c765.js";import"./VTextField-8bb22937.js";import"./VVirtualScroll-b47ffb64.js";const W=_({__name:"LibraryRadios",setup(I){const{t:l}=y(),p=u([]),o=u(!1),m={name:"sort_name",recent:"timestamp_added DESC"};b(()=>{const t=a.subscribe_multi([s.MEDIA_ITEM_ADDED,s.MEDIA_ITEM_UPDATED,s.MEDIA_ITEM_DELETED],e=>{var r;(r=e.object_id)!=null&&r.startsWith("library://radio")&&(o.value=!0)});v(t)});const c=async function(t){if(t.refresh&&!o.value){for(a.startSync([i.RADIO]),await n(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(i.RADIO)).length!=0;)await n(500);await n(500)}return o.value=!1,await a.getLibraryRadios(t.favoritesOnly||void 0,t.search,t.limit,t.offset,m[t.sortBy])},d=async function(){const t=prompt(l("enter_url"));t&&a.getItem(i.RADIO,t,"url").then(e=>{const r=prompt(l("enter_name"),e.name);e.name=r||e.name,a.addItemToLibrary(e).then(()=>o.value=!0)}).catch(e=>alert(e))};return(t,e)=>(h(),D(f,{itemtype:"radios",items:p.value,"show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":c,"sort-keys":Object.keys(m),"update-available":o.value,title:k(E)("bp4")?t.$t("radios"):"","show-search-button":!0,"allow-key-hooks":!0,"context-menu-items":[{label:"add_url_item",labelArgs:[],action:()=>{d()},icon:"mdi-link-plus"}]},null,8,["items","sort-keys","update-available","title","context-menu-items"]))}});export{W as default};
