import{I,_ as w}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-Boj6o7qU.js";import{I as v}from"./ItemsListing-4Tzirx3k.js";import{M as g}from"./MediaItemImages-Dz3pW0B9.js";import{ay as A,J as f,L as _,a3 as D,aP as l,bb as V,a4 as h,az as B,aA as s,o as E,aI as u,aB as n,E as m,aD as M}from"./index-GQ3lWXrm.js";import"./Toolbar-BhPGsr4E.js";import"./VToolbar-BTrAkkB7.js";import"./marquee_text_sync-a11Dvzhd.js";import"./MediaItemThumb-C--YJJ5Y.js";import"./VDialog-OmJrmVI_.js";import"./Container-Bc5cvdS8.js";import"./index-kQIztB-E.js";import"./ListItem-Cz0zK7Ay.js";import"./Button-BcX_QSum.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-BZUcSWaz.js";import"./VCheckbox-CgwahLqh.js";import"./VCheckboxBtn-orONEqTE.js";import"./VSelectionControl-C9uJkKHo.js";import"./PanelviewItemCompact-BFofUlbn.js";import"./userPreferences-CU3N6m4Z.js";import"./VInfiniteScroll-C839Qj3G.js";import"./VVirtualScroll-YsHPZNGu.js";import"./VAlert-C8Oto4eV.js";const Y=A({__name:"AlbumDetails",props:{itemId:{},provider:{}},setup(d){const r=d,e=f(),o=f(!1),b=async function(){o.value=!0,e.value=await l.getAlbum(r.itemId,r.provider),o.value=!1};_(()=>r.itemId,a=>{a&&b()},{immediate:!0}),D(()=>{const a=l.subscribe(V.MEDIA_ITEM_UPDATED,t=>{const i=t.data;if(e.value?.uri==i.uri)o.value=!0,e.value=i,o.value=!1;else if("provider_mappings"in i){for(const p of i.provider_mappings)if(p.item_id==r.itemId&&[p.provider_instance,p.provider_domain].includes(r.provider)){o.value=!0,e.value=i,o.value=!1;break}}});h(a)});const y=async function(a){return await l.getAlbumTracks(r.itemId,r.provider,a.libraryOnly)},c=async function(a){return await l.getAlbumVersions(e.value.item_id,e.value.provider)},k=async function(){e.value&&(e.value=await l.sendCommand("music/albums/update",{item_id:e.value.item_id,update:e.value,overwrite:!0}))};return(a,t)=>(s(),B("section",null,[E(I,{item:e.value,"active-provider":d.provider},null,8,["item","active-provider"]),e.value?(s(),u(v,{key:0,itemtype:"albumtracks","parent-item":e.value,"show-provider":!0,"show-track-number":!0,"show-favorites-only-filter":!0,"show-library-only-filter":e.value.provider=="library"&&M(l).hasStreamingProviders.value,"show-refresh-button":!1,"allow-key-hooks":!0,"load-items":y,"sort-keys":["track_number","name","sort_name","duration","duration_desc"],title:a.$t("tracks")},null,8,["parent-item","show-library-only-filter","title"])):n("",!0),t[1]||(t[1]=m("br",null,null,-1)),e.value?(s(),u(v,{key:1,itemtype:"albumversions","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-refresh-button":!1,"load-items":c,"sort-keys":["provider","name","year"],title:a.$t("other_versions"),"hide-on-empty":!0},null,8,["parent-item","title"])):n("",!0),t[2]||(t[2]=m("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images?(s(),u(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=i=>e.value.metadata.images=i),k]},null,8,["modelValue"])):n("",!0),t[3]||(t[3]=m("br",null,null,-1)),e.value?(s(),u(w,{key:3,"item-details":e.value},null,8,["item-details"])):n("",!0),t[4]||(t[4]=m("br",null,null,-1))]))}});export{Y as default};
