import{I as _,_ as k}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-B_OXjTPr.js";import{I as p}from"./ItemsListing-D_KqSTZS.js";import{M as g}from"./MediaItemImages-CkUXDoIN.js";import{ay as A,J as v,L as h,a3 as D,aP as o,bb as B,a4 as E,az as M,aA as s,o as V,aI as n,aB as u,E as m,aD as f}from"./index-BRUnowC8.js";import"./Toolbar-BEJzY0mB.js";import"./VToolbar-DS4mUdOC.js";import"./marquee_text_sync-BajKmu-m.js";import"./MediaItemThumb-CIE9_Elw.js";import"./VDialog-Bh3mGVOy.js";import"./Container-ZHtGcXZO.js";import"./index-kQIztB-E.js";import"./ListItem-jfbxOrad.js";import"./Button-BKv4xLAv.js";import"./userPreferences-DBWZCHKf.js";import"./VCheckboxBtn-D390s4L9.js";import"./VSelectionControl-Co1cRcmS.js";import"./PanelviewItemCompact-CsJmi5IT.js";import"./VInfiniteScroll-BORsRMGl.js";import"./VVirtualScroll-htzu2YXu.js";import"./VAlert-DQxypmdN.js";const W=A({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(y){const r=y,e=v(),i=v(!1),b=async function(){i.value=!0,e.value=await o.getArtist(r.itemId,r.provider),i.value=!1};h(()=>r.itemId,a=>{a&&b()},{immediate:!0}),D(()=>{const a=o.subscribe(B.MEDIA_ITEM_UPDATED,t=>{const l=t.data;if(e.value?.uri==l.uri)i.value=!0,e.value=l,i.value=!1;else if("provider_mappings"in l){for(const d of l.provider_mappings)if(d.item_id==r.itemId&&[d.provider_instance,d.provider_domain].includes(r.provider)){i.value=!0,e.value=l,i.value=!1;break}}});E(a)});const c=async function(a){return await o.getArtistAlbums(r.itemId,r.provider,a.libraryOnly)},w=async function(a){return await o.getArtistTracks(r.itemId,r.provider,a.libraryOnly)},I=async function(){e.value&&(e.value=await o.sendCommand("music/artists/update",{item_id:e.value.item_id,update:e.value,overwrite:!0}))};return(a,t)=>(s(),M("section",null,[V(_,{item:e.value},null,8,["item"]),e.value&&!i.value?(s(),n(p,{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(o).hasStreamingProviders.value,"show-album-type-filter":!0,"show-refresh-button":!1,"load-items":c,"sort-keys":["name","sort_name","year","name_desc","sort_name_desc","year_desc"],title:a.$t("albums"),"allow-collapse":!0},null,8,["parent-item","show-library-only-filter","title"])):u("",!0),t[1]||(t[1]=m("br",null,null,-1)),e.value&&!i.value?(s(),n(p,{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(o).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:a.$t("tracks"),"allow-collapse":!0},null,8,["parent-item","show-library-only-filter","title"])):u("",!0),t[2]||(t[2]=m("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images?(s(),n(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=l=>e.value.metadata.images=l),I]},null,8,["modelValue"])):u("",!0),t[3]||(t[3]=m("br",null,null,-1)),e.value?(s(),n(k,{key:3,"item-details":e.value},null,8,["item-details"])):u("",!0),t[4]||(t[4]=m("br",null,null,-1))]))}});export{W as default};
