import{_ as b}from"./ItemsListing.vue_vue_type_style_index_0_lang-8114fc79.js";import{_ as A,a as h}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-fa22e869.js";import{v as g,r as p,w as I,o as D,L as l,ak as F,b as M,c as T,y as o,E as B,l as E,z as v,I as m,B as _,am as d}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";import"./layout-0badeb0a.js";import"./VDialog-d7f48b87.js";const $=_("br",null,null,-1),N=_("br",null,null,-1),re=g({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(y){const s=y,n=p("library"),a=p(!1),t=p(),u=async function(){const e=n.value;n.value="",t.value=await l.getArtist(s.itemId,s.provider),n.value=e};I(()=>s.itemId,e=>{e&&u()},{immediate:!0}),D(()=>{const e=l.subscribe(F.MEDIA_ITEM_ADDED,r=>{var f;const i=r.data;((f=t.value)==null?void 0:f.uri)==i.uri&&(a.value=!0)});M(e)});const k=async function(e){let r=[];if(e.refresh&&(await u(),a.value=!1),!t.value)r=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const i of d(t.value))if(i.provider_instance==e.providerFilter){r=await l.getArtistAlbums(i.item_id,i.provider_instance);break}}else r=await l.getArtistAlbums(t.value.item_id,t.value.provider);return a.value=!1,r},w=async function(e){let r=[];if(e.refresh&&(await u(),a.value=!1),!t.value)r=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const i of d(t.value))if(i.provider_instance==e.providerFilter){r=await l.getArtistTracks(i.item_id,i.provider_instance);break}}else r=await l.getArtistTracks(t.value.item_id,t.value.provider);return a.value=!1,r},c=T(()=>{var r;if(((r=t.value)==null?void 0:r.provider)!=="library")return[];const e=["library"];for(const i of d(t.value))e.push(i.provider_instance);return e});return(e,r)=>(o(),B("section",null,[E(A,{item:t.value},null,8,["item"]),t.value?(o(),v(b,{key:0,itemtype:"artisttracks","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"show-track-number":!1,"load-items":w,"sort-keys":["recent","name","album"],"update-available":a.value,title:e.$t("tracks"),"provider-filter":c.value,"allow-collapse":!0},null,8,["parent-item","update-available","title","provider-filter"])):m("",!0),$,t.value?(o(),v(b,{key:1,itemtype:"artistalbums","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-items":k,"sort-keys":["recent","name","year"],"update-available":a.value,title:e.$t("albums"),"provider-filter":c.value,"allow-collapse":!0},null,8,["parent-item","update-available","title","provider-filter"])):m("",!0),N,t.value?(o(),v(h,{key:2,"item-details":t.value},null,8,["item-details"])):m("",!0)]))}});export{re as default};
