import{I as d}from"./ItemsListing-BHlkb6-j.js";import{I,_ as w}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-bItMFJVo.js";import{d as g,i as v,ad as _,j as A,m as l,a_ as V,l as h,c as D,o as s,b as M,e as m,q as u,a as n,u as B}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:"AlbumDetails",props:{itemId:{},provider:{}},setup(f){const a=f,e=v(),o=v(!1),b=async function(){o.value=!0,e.value=await l.getAlbum(a.itemId,a.provider),o.value=!1};_(()=>a.itemId,r=>{r&&b()},{immediate:!0}),A(()=>{const r=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==a.itemId&&[p.provider_instance,p.provider_domain].includes(a.provider)){o.value=!0,e.value=i,o.value=!1;break}}});h(r)});const y=async function(r){return await l.getAlbumTracks(a.itemId,a.provider,r.libraryOnly)},c=async function(r){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(r,t)=>(s(),D("section",null,[M(I,{item:e.value,"active-provider":r.provider},null,8,["item","active-provider"]),e.value?(s(),m(d,{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(d,{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:r.$t("other_versions"),"hide-on-empty":!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?(s(),m(E,{key:2,modelValue:e.value.metadata.images,"onUpdate:modelValue":[t[0]||(t[0]=i=>e.value.metadata.images=i),k]},null,8,["modelValue"])):u("",!0),t[3]||(t[3]=n("br",null,null,-1)),e.value?(s(),m(w,{key:3,"item-details":e.value},null,8,["item-details"])):u("",!0),t[4]||(t[4]=n("br",null,null,-1))]))}});export{re as default};
