import{I as d}from"./ItemsListing-BHlkb6-j.js";import{I as _,_ as k}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-bItMFJVo.js";import{d as g,i as v,ad as A,j as h,m as o,a_ as D,l as M,c as V,o as s,b as B,e as n,q as m,a as u,u as f}from"./index-LFx1jIjH.js";import{M as E}from"./MediaItemImages-BsUw5BGo.js";import"./Container-CuH2YNr5.js";import"./Button-SUce42c3.js";import"./VBtn-BYKkZzw0.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./VContainer-or1Uze2V.js";/* empty css              */import"./Toolbar-iQxHKI_C.js";import"./VToolbar-Dc2WDt1C.js";import"./ListItem-DhvO1M3C.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-B4veTxLS.js";import"./VInput-B3Z2GK8Z.js";import"./MediaItemThumb-cYqdWFcl.js";import"./PanelviewItemCompact-Bf82DAtE.js";import"./VSpacer-Cg-cZSyv.js";import"./VTextField-DyzwZgKh.js";import"./VInfiniteScroll-DH2IK80_.js";import"./layout-C6GuZOkj.js";import"./VRow-cyJLSUM5.js";import"./VVirtualScroll-DYZmdOFl.js";import"./VAlert-Cyb25ra3.js";import"./marquee_text_sync-AxiznPti.js";import"./VDialog-zNF2U_x9.js";const re=g({__name:"ArtistDetails",props:{itemId:{},provider:{}},setup(y){const a=y,e=v(),i=v(!1),c=async function(){i.value=!0,e.value=await o.getArtist(a.itemId,a.provider),i.value=!1};A(()=>a.itemId,r=>{r&&c()},{immediate:!0}),h(()=>{const r=o.subscribe(D.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 p of l.provider_mappings)if(p.item_id==a.itemId&&[p.provider_instance,p.provider_domain].includes(a.provider)){i.value=!0,e.value=l,i.value=!1;break}}});M(r)});const b=async function(r){return await o.getArtistAlbums(a.itemId,a.provider,r.libraryOnly)},w=async function(r){return await o.getArtistTracks(a.itemId,a.provider,r.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(r,t)=>(s(),V("section",null,[B(_,{item:e.value},null,8,["item"]),e.value&&!i.value?(s(),n(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(o).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"])):m("",!0),t[1]||(t[1]=u("br",null,null,-1)),e.value&&!i.value?(s(),n(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(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:r.$t("tracks"),"allow-collapse":!0},null,8,["parent-item","show-library-only-filter","title"])):m("",!0),t[2]||(t[2]=u("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images?(s(),n(E,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=l=>e.value.metadata.images=l),I]},null,8,["modelValue"])):m("",!0),t[3]||(t[3]=u("br",null,null,-1)),e.value?(s(),n(k,{key:3,"item-details":e.value},null,8,["item-details"])):m("",!0),t[4]||(t[4]=u("br",null,null,-1))]))}});export{re as default};
