import{I as _,_ as k}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-Cn4WWbvY.js";import{I as d}from"./ItemsListing-XUXN-Um6.js";import{M as g}from"./MediaItemImages-DiXyyEvy.js";import{d as A,r as v,ae as h,m as D,v as l,a$ as M,q as V,c as B,b as E,h as m,e as n,a as u,u as f,o as s}from"./index-Bn2Tzsay.js";import"./Toolbar-Ba4dAxS1.js";import"./VToolbar-Z0nE2qFc.js";import"./VBtn-BQk37KYJ.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-CHIyYfjU.js";import"./MediaItemThumb-B7hfZSf2.js";import"./VDialog-DRfRMr5_.js";import"./layout-kFqKNtL6.js";import"./Container-CEbFgC5b.js";import"./index-CBho6rsP.js";import"./VContainer-CRIwFZfO.js";/* empty css              */import"./ListItem-BNbxxrdg.js";import"./Button-r9Wpw3CQ.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-DCLVCnPO.js";import"./VInput-C_1AW61Q.js";import"./PanelviewItemCompact-By5cXXTW.js";import"./VSpacer-ygjaGObn.js";import"./VTextField-fPA0WAHx.js";import"./VInfiniteScroll-DvbiA0kw.js";import"./VRow-CNVApy9v.js";import"./VVirtualScroll-B56qZ1Y0.js";import"./VAlert-Bj5fXNhB.js";const ae=A({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(y){const a=y,e=v(),i=v(!1),c=async function(){i.value=!0,e.value=await l.getArtist(a.itemId,a.provider),i.value=!1};h(()=>a.itemId,r=>{r&&c()},{immediate:!0}),D(()=>{const r=l.subscribe(M.MEDIA_ITEM_UPDATED,t=>{const o=t.data;if(e.value?.uri==o.uri)i.value=!0,e.value=o,i.value=!1;else if("provider_mappings"in o){for(const p of o.provider_mappings)if(p.item_id==a.itemId&&[p.provider_instance,p.provider_domain].includes(a.provider)){i.value=!0,e.value=o,i.value=!1;break}}});V(r)});const b=async function(r){return await l.getArtistAlbums(a.itemId,a.provider,r.libraryOnly)},w=async function(r){return await l.getArtistTracks(a.itemId,a.provider,r.libraryOnly)},I=async function(){e.value&&(e.value=await l.sendCommand("music/artists/update",{item_id:e.value.item_id,update:e.value,overwrite:!0}))};return(r,t)=>(s(),B("section",null,[E(_,{item:e.value},null,8,["item"]),e.value&&!i.value?(s(),m(d,{key:0,itemtype:"artistalbums","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!0,"show-library-only-filter":e.value.provider=="library"&&f(l).hasStreamingProviders.value,"show-album-type-filter":!0,"show-refresh-button":!1,"load-items":b,"sort-keys":["name","sort_name","year","name_desc","sort_name_desc","year_desc"],title:r.$t("albums"),"allow-collapse":!0},null,8,["parent-item","show-library-only-filter","title"])):n("",!0),t[1]||(t[1]=u("br",null,null,-1)),e.value&&!i.value?(s(),m(d,{key:1,itemtype:"artisttracks","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!0,"show-library-only-filter":e.value.provider=="library"&&f(l).hasStreamingProviders.value,"show-refresh-button":!1,"show-track-number":!1,"load-items":w,"sort-keys":["name","sort_name","album","duration","name_desc","sort_name_desc","duration_desc","original"],title:r.$t("tracks"),"allow-collapse":!0},null,8,["parent-item","show-library-only-filter","title"])):n("",!0),t[2]||(t[2]=u("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images?(s(),m(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=o=>e.value.metadata.images=o),I]},null,8,["modelValue"])):n("",!0),t[3]||(t[3]=u("br",null,null,-1)),e.value?(s(),m(k,{key:3,"item-details":e.value},null,8,["item-details"])):n("",!0),t[4]||(t[4]=u("br",null,null,-1))]))}});export{ae as default};
