import{I as w,_ as I}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-DHRwPkTM.js";import{I as v}from"./ItemsListing-Bd2thLHu.js";import{M as g}from"./MediaItemImages-N1kUFeEI.js";import{aw as _,J as f,L as A,a3 as V,aN as l,b9 as h,a4 as D,ax as B,ay as s,o as E,aG as u,az as n,E as m,aB as M}from"./index-BeguICWm.js";import"./Toolbar-DMSWIhz4.js";import"./VToolbar-DZP2Ylkv.js";import"./marquee_text_sync-Vcm7FleQ.js";import"./MediaItemThumb-B7Ks6j0U.js";import"./VDialog-3N5CnNiB.js";import"./Container-L7ytxuXf.js";import"./index-kQIztB-E.js";import"./ListItem-DzMz1Zx0.js";import"./Button-BjWxTVGU.js";import"./userPreferences-CVtQlCYs.js";import"./VCheckboxBtn-HpD-UT_z.js";import"./PanelviewItemCompact-YKRtLaLa.js";import"./VInfiniteScroll-aGYTBb1l.js";import"./VVirtualScroll-Vx_hX6dw.js";import"./VAlert-Dkia6PbV.js";const R=_({__name:"AlbumDetails",props:{itemId:{},provider:{}},setup(p){const r=p,e=f(),o=f(!1),b=async function(){o.value=!0,e.value=await l.getAlbum(r.itemId,r.provider),o.value=!1};A(()=>r.itemId,a=>{a&&b()},{immediate:!0}),V(()=>{const a=l.subscribe(h.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 d of i.provider_mappings)if(d.item_id==r.itemId&&[d.provider_instance,d.provider_domain].includes(r.provider)){o.value=!0,e.value=i,o.value=!1;break}}});D(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(w,{item:e.value,"active-provider":p.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(I,{key:3,"item-details":e.value},null,8,["item-details"])):n("",!0),t[4]||(t[4]=m("br",null,null,-1))]))}});export{R as default};
