import{l as v,J as y,r as i,B as m,O as r,S as l,b as p,o as E,af as n,q as I,v as T}from"./index-a5bb9833.js";import{_ as D}from"./ItemsListing.vue_vue_type_script_setup_true_lang-83c47556.js";import"./ListviewItem-e2342ce8.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-a35ce75a.js";import"./VMenu-240a4406.js";import"./VDivider-df9414f0.js";import"./VBtn-629f5316.js";import"./VListItem-39677d21.js";import"./Container-4773c160.js";/* empty css              */import"./VDialog-667c0916.js";import"./VCard-04ae357c.js";import"./VToolbar-b79315e8.js";import"./VSelect-4d69c543.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-d218249a.js";import"./Alert-a5ce795e.js";import"./VBadge-f7d58168.js";import"./VRow-7d86481a.js";const $=v({__name:"LibraryTracks",setup(k){const{t:s}=y(),c=i([]),o=i(!1);m.topBarContextMenuItems=[{label:"sync_now",labelArgs:[s("tracks")],action:()=>{r.startSync([l.TRACK])},icon:"mdi-sync"},{label:"add_url_item",labelArgs:[],action:()=>{_()},icon:"mdi-link-plus"}],p(()=>{m.topBarContextMenuItems=[]}),E(()=>{const a=r.subscribe_multi([n.MEDIA_ITEM_ADDED,n.MEDIA_ITEM_UPDATED,n.MEDIA_ITEM_DELETED],t=>{var e;(e=t.object_id)!=null&&e.startsWith("library://track")&&(o.value=!0)});p(a)});const u=async function(a,t,e,d,f=!0){const b=f||void 0;return o.value=!1,await r.getLibraryTracks(b,d,t,a,e)},_=async function(){const a=prompt(s("enter_url"));a&&r.getItem(l.TRACK,a,"url").then(t=>{const e=prompt(s("enter_name"),t.name);t.name=e||t.name,r.addItemToLibrary(t).then(()=>o.value=!0)}).catch(t=>alert(t))};return(a,t)=>(I(),T(D,{itemtype:"tracks",items:c.value,"show-provider":!1,"show-favorites-only-filter":!0,"show-track-number":!1,"load-data":u,"sort-keys":["sort_name","timestamp_added DESC","sort_artist","duration"],"show-album":!1,"update-available":o.value},null,8,["items","update-available"]))}});export{$ as default};
