import{_ as b,f as _}from"./ItemsListing.vue_vue_type_style_index_0_lang-13c0a7ea.js";import{_ as h,a as g}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-562a4470.js";import{l as I,r as p,w as D,o as F,L as a,a9 as M,b as T,c as B,y as o,I as E,j as $,z as m,H as v,D as y}from"./index-0b85ac09.js";import{n as d}from"./utils-6da9b08b.js";import"./ListviewItem-8ca5221f.js";import"./ListItem-13203a50.js";import"./VImg-0b02a672.js";import"./VMenu-17c39295.js";import"./VTooltip-98b8e750.js";import"./VCheckboxBtn-f7c239ad.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-849cf90d.js";import"./VCard-49371ce3.js";import"./contextmenu-224584f8.js";import"./eventbus-d154090d.js";import"./Alert-0cea1739.js";import"./Container-f51d504d.js";/* empty css              */import"./VToolbar-7dc49a97.js";import"./VTextField-5fb2df8c.js";import"./VBadge-0d62eaa1.js";import"./VRow-b57e52b9.js";import"./VVirtualScroll-3bbd56c5.js";import"./layout-815d5a1a.js";import"./VDialog-69cc554b.js";const N=y("br",null,null,-1),V=y("br",null,null,-1),ae=I({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(k){const s=k,n=p("library"),l=p(!1),t=p(),u=async function(){const e=n.value;n.value="",t.value=await a.getArtist(s.itemId,s.provider),n.value=e};D(()=>s.itemId,e=>{e&&u()},{immediate:!0}),F(()=>{const e=a.subscribe(M.MEDIA_ITEM_ADDED,r=>{var f;const i=r.data;((f=t.value)==null?void 0:f.uri)==i.uri&&(l.value=!0)});T(e)});const w=async function(e){let r=[];if(e.refresh&&(await u(),l.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 a.getArtistAlbums(i.item_id,i.provider_instance);break}}else r=await a.getArtistAlbums(t.value.item_id,t.value.provider);return _(r,e)},A=async function(e){let r=[];if(e.refresh&&(await u(),l.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 a.getArtistTracks(i.item_id,i.provider_instance);break}}else r=await a.getArtistTracks(t.value.item_id,t.value.provider);return _(r,e)},c=B(()=>{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(),E("section",null,[$(h,{item:t.value},null,8,["item"]),t.value?(o(),m(b,{key:0,itemtype:"artisttracks","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"show-track-number":!1,"load-data":A,"sort-keys":["recent","name","album"],"update-available":l.value,title:e.$t("tracks"),"provider-filter":c.value,"allow-collapse":!0},null,8,["parent-item","update-available","title","provider-filter"])):v("",!0),N,t.value?(o(),m(b,{key:1,itemtype:"artistalbums","parent-item":t.value,"show-provider":!1,"show-favorites-only-filter":!1,"load-data":w,"sort-keys":["recent","name","year"],"update-available":l.value,title:e.$t("albums"),"provider-filter":c.value,"allow-collapse":!0},null,8,["parent-item","update-available","title","provider-filter"])):v("",!0),V,t.value?(o(),m(g,{key:2,"item-details":t.value},null,8,["item-details"])):v("",!0)]))}});export{ae as default};
