import{I as v}from"./ItemsListing-Be0Rl7jr.js";import{I as g,_ as A}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-BLlMxT8e.js";import{Q as h,x as f,w as D,o as B,a4 as o,aU as M,b as V,Z as E,B as T,R as u,a9 as p,W as d,a0 as y,S as m}from"./index-Bduq4vJM.js";import{M as U}from"./MediaItemImages-ByAD2LPn.js";import"./MediaItemThumb-CN4TRL8T.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ListItem-B-hzVPBy.js";import"./Button-DDaesvMx.js";import"./VBtn-DWiYTBpb.js";import"./VCheckbox-BiGeI08h.js";import"./VCheckboxBtn-DLibXb0-.js";import"./PanelviewItemCompact-C9loINH4.js";import"./VSpacer-BnmXZ56R.js";/* empty css              */import"./Container-Ps6BlEWu.js";import"./VContainer-BVUS8uFb.js";import"./Toolbar-MtNZFNYL.js";import"./VToolbar-CG7bivmQ.js";import"./VTextField-lpT7m_Xn.js";import"./VInfiniteScroll-Ar7Xm9mt.js";import"./layout-B2wBEHPQ.js";import"./VRow-Cj9YdJtG.js";import"./VVirtualScroll-VdTkqEkN.js";import"./VAlert-BjDi0iTj.js";import"./marquee_text_sync-BY5RFSQ3.js";import"./VDialog-B3s_EL-H.js";const ie=h({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(c){const a=c,e=f(),i=f(!1),b=async function(){i.value=!0,e.value=await o.getArtist(a.itemId,a.provider),i.value=!1};D(()=>a.itemId,r=>{r&&b()},{immediate:!0}),B(()=>{const r=o.subscribe(M.MEDIA_ITEM_UPDATED,t=>{var n;const l=t.data;if(((n=e.value)==null?void 0:n.uri)==l.uri)i.value=!0,e.value=l,i.value=!1;else if("provider_mappings"in l){for(const s of l.provider_mappings)if(s.item_id==a.itemId&&[s.provider_instance,s.provider_domain].includes(a.provider)){i.value=!0,e.value=l,i.value=!1;break}}});V(r)});const w=async function(r){return await o.getArtistAlbums(a.itemId,a.provider,r.libraryOnly)},I=async function(r){return await o.getArtistTracks(a.itemId,a.provider,r.libraryOnly)},_=async function(){e.value&&(e.value=await o.sendCommand("music/artists/update",{item_id:e.value.item_id,update:e.value,overwrite:!0}))};return(r,t)=>{var l,n,s;return m(),E("section",null,[T(g,{item:e.value},null,8,["item"]),e.value&&!i.value?(m(),u(v,{key:0,itemtype:"artistalbums","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!0,"show-library-only-filter":e.value.provider=="library"&&y(o).hasStreamingProviders.value,"show-album-type-filter":!0,"show-refresh-button":!1,"load-items":w,"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"])):p("",!0),t[1]||(t[1]=d("br",null,null,-1)),e.value&&!i.value?(m(),u(v,{key:1,itemtype:"artisttracks","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!0,"show-library-only-filter":e.value.provider=="library"&&y(o).hasStreamingProviders.value,"show-refresh-button":!1,"show-track-number":!1,"load-items":I,"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"])):p("",!0),t[2]||(t[2]=d("br",null,null,-1)),((l=e.value)==null?void 0:l.provider)=="library"&&((s=(n=e.value)==null?void 0:n.metadata)!=null&&s.images)?(m(),u(U,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=k=>e.value.metadata.images=k),_]},null,8,["modelValue"])):p("",!0),t[3]||(t[3]=d("br",null,null,-1)),e.value?(m(),u(A,{key:3,"item-details":e.value},null,8,["item-details"])):p("",!0),t[4]||(t[4]=d("br",null,null,-1))])}}});export{ie as default};
