import{I as d}from"./ItemsListing-DTp3_m1l.js";import{I as y,_ as b}from"./ProviderDetails.vue_vue_type_style_index_0_lang-DOM5lPlX.js";import{ay as k,J as h,L as w,a3 as I,aP as s,bb as T,a4 as g,az as D,aA as l,o as B,aI as m,aB as u,E as p,aD as E}from"./index-Cf2d7tRd.js";import"./Container-BGtVf2Qd.js";import"./index-kQIztB-E.js";import"./Toolbar-B9Fs9NMu.js";import"./VToolbar-DHXfwhSR.js";import"./Button-BD74GKCZ.js";import"./ListItem-D8YpN8_X.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-BTSbwY9o.js";import"./MediaItemThumb-DaTdIweX.js";import"./VCheckbox-ZvBMyjKt.js";import"./VCheckboxBtn-C3kP6Fas.js";import"./VSelectionControl-MlceO9op.js";import"./PanelviewItemCompact-CHXOx79k.js";import"./userPreferences-UtGMA5qW.js";import"./VInfiniteScroll-CWvL6JWG.js";import"./VVirtualScroll-h86e3kaS.js";import"./VAlert-DoHvibq7.js";import"./marquee_text_sync-BVJRdTlo.js";import"./VDialog-evn4v93H.js";const Q=k({__name:"TrackDetails",props:{itemId:{},provider:{},album:{}},setup(i){const r=i,e=h(),v=async function(){e.value=await s.getTrack(r.itemId,r.provider,r.album)};w(()=>r.itemId,t=>{t&&v()},{immediate:!0}),I(()=>{const t=s.subscribe(T.MEDIA_ITEM_UPDATED,a=>{const o=a.data;if(e.value?.uri==o.uri)e.value=o;else if("provider_mappings"in o){for(const n of o.provider_mappings)if(n.item_id==r.itemId&&[n.provider_instance,n.provider_domain].includes(r.provider)){e.value=o;break}}});g(t)});const f=async function(t){return await s.getTrackVersions(e.value.item_id,e.value.provider)},c=async function(t){return await s.getTrackAlbums(r.itemId,r.provider,t.libraryOnly)};return(t,a)=>(l(),D("section",null,[B(y,{item:e.value,"active-provider":i.provider},null,8,["item","active-provider"]),e.value?(l(),m(d,{key:0,itemtype:"trackalbums","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library-only-filter":e.value.provider=="library"&&E(s).hasStreamingProviders.value,"show-track-number":!1,"show-refresh-button":!1,"load-items":c,"sort-keys":["name","sort_name","year","year_desc"],title:t.$t("appears_on"),path:i.provider+i.itemId,"allow-collapse":!0},null,8,["parent-item","show-library-only-filter","title","path"])):u("",!0),a[0]||(a[0]=p("br",null,null,-1)),e.value?(l(),m(d,{key:1,itemtype:"trackversions","parent-item":e.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-track-number":!1,"load-items":f,"sort-keys":["name","sort_name","duration"],title:t.$t("other_versions"),"hide-on-empty":!0,path:i.provider+i.itemId,"allow-collapse":!0,"show-refresh-button":!1,"refresh-on-parent-update":!0},null,8,["parent-item","title","path"])):u("",!0),a[1]||(a[1]=p("br",null,null,-1)),e.value?(l(),m(b,{key:2,"item-details":e.value},null,8,["item-details"])):u("",!0),a[2]||(a[2]=p("br",null,null,-1))]))}});export{Q as default};
