import{I}from"./InfoHeader-t3bx_V1c.js";import{I as v}from"./ItemsListing-_udXJK94.js";import{M as g}from"./MediaItemImages-DzcLQ039.js";import{_ as h}from"./ProviderDetails.vue_vue_type_style_index_0_lang-DQwrHdL8.js";import{a as l,E as A,d as _}from"./index-B1IzS8gl.js";import{d as V,w as D,o as M,r as f,a3 as E,c as B,J as T,G as m,K as u,e as n,u as b,b as s}from"./lucide-DMa8pBeQ.js";import"./Toolbar-DGXQ_w0A.js";import"./vuetify-CbR4Ou0u.js";import"./marquee_text_sync--ebYvlR0.js";import"./vue-router-DHedY1l9.js";import"./MarqueeText-Cj40uM1k.js";import"./MediaItemThumb-T7Rn7VXY.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-lHw8tvNP.js";import"./vue-i18n-BEWj6xw2.js";import"./Container-DpRG4AkK.js";import"./index-kQIztB-E.js";import"./userPreferences-BGN8JMjw.js";import"./Button-CxfpuisU.js";import"./ListItem-xrr2Bkj_.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-kbJcSVI9.js";import"./PanelviewItemCompact-BblX2kAC.js";import"./qrcode-Cnwj8xOV.js";import"./marked-BPdRUrA1.js";import"./color-CqFg8eif.js";import"./vueuse-BL7kbX9s.js";/* empty css            */import"./swiper-DftkhebG.js";const ie=V({__name:"AlbumDetails",props:{itemId:{},provider:{}},setup(d){const a=d,e=f(),o=f(!1),c=async function(){o.value=!0,e.value=await l.getAlbum(a.itemId,a.provider),o.value=!1};D(()=>a.itemId,r=>{r&&c()},{immediate:!0}),M(()=>{const r=l.subscribe(A.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==a.itemId&&[p.provider_instance,p.provider_domain].includes(a.provider)){o.value=!0,e.value=i,o.value=!1;break}}});E(r)});const y=async function(r){return await l.getAlbumTracks(a.itemId,a.provider,r.libraryOnly)},k=async function(r){return await l.getAlbumVersions(e.value.item_id,e.value.provider)},w=async function(){e.value&&(e.value=await l.sendCommand("music/albums/update",{item_id:e.value.item_id,update:e.value,overwrite:!0}))};return(r,t)=>(s(),B("section",null,[T(I,{item:e.value,"active-provider":d.provider},null,8,["item","active-provider"]),e.value?(s(),m(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"&&b(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:r.$t("tracks")},null,8,["parent-item","show-library-only-filter","title"])):u("",!0),t[1]||(t[1]=n("br",null,null,-1)),e.value?(s(),m(v,{key:1,itemtype:"albumversions","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-refresh-button":!1,"load-items":k,"sort-keys":["provider","name","year"],title:r.$t("other_versions"),"hide-on-empty":!0,"refresh-on-parent-update":!0},null,8,["parent-item","title"])):u("",!0),t[2]||(t[2]=n("br",null,null,-1)),e.value?.provider=="library"&&e.value?.metadata?.images&&b(_).isAdmin()?(s(),m(g,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=i=>e.value.metadata.images=i),w]},null,8,["modelValue"])):u("",!0),t[3]||(t[3]=n("br",null,null,-1)),e.value?(s(),m(h,{key:3,"item-details":e.value},null,8,["item-details"])):u("",!0),t[4]||(t[4]=n("br",null,null,-1))]))}});export{ie as default};
