import{l as v,J as y,r as n,B as m,O as o,U as l,b as p,o as I,af as i,q as D,v as E}from"./index-e9211ef1.js";import{_ as A}from"./ItemsListing.vue_vue_type_script_setup_true_lang-436cf3d3.js";import"./ListviewItem-b7a4258b.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-278977b5.js";import"./VMenu-bc0cce60.js";import"./VDivider-336c24cd.js";import"./VBtn-68784d55.js";import"./VListItem-230d1393.js";import"./Container-349a0ac0.js";/* empty css              */import"./VDialog-5f240a62.js";import"./VCard-138864fc.js";import"./VToolbar-daf2b89f.js";import"./VSelect-04a129eb.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-fefd2afe.js";import"./Alert-55091fd0.js";import"./VSpacer-bdf2f653.js";import"./VBadge-9fa94f29.js";import"./VRow-e8f3e51e.js";const F=v({__name:"LibraryRadios",setup(M){const{t:s}=y(),u=n([]),r=n(!1);m.topBarContextMenuItems=[{label:"sync_now",labelArgs:[s("radios")],action:()=>{o.startSync([l.RADIO])},icon:"mdi-sync"},{label:"add_url_item",labelArgs:[],action:()=>{d()},icon:"mdi-link-plus"}],p(()=>{m.topBarContextMenuItems=[]}),I(()=>{const a=o.subscribe_multi([i.MEDIA_ITEM_ADDED,i.MEDIA_ITEM_UPDATED,i.MEDIA_ITEM_DELETED],t=>{var e;(e=t.object_id)!=null&&e.startsWith("library://radio")&&(r.value=!0)});p(a)});const c=async function(a,t,e,_,f=!0){const b=f||void 0;return r.value=!1,await o.getLibraryRadios(b,_,t,a,e)},d=async function(){const a=prompt(s("enter_url"));a&&o.getItem(l.RADIO,a,"url").then(t=>{const e=prompt(s("enter_name"),t.name);t.name=e||t.name,o.addItemToLibrary(t).then(()=>r.value=!0)}).catch(t=>alert(t))};return(a,t)=>(D(),E(A,{itemtype:"radios",items:u.value,"show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-data":c,"sort-keys":["sort_name","timestamp_added DESC"],"update-available":r.value},null,8,["items","update-available"]))}});export{F as default};
