import{_ as v,f as c}from"./ItemsListing.vue_vue_type_style_index_0_lang-17edc154.js";import{_ as I,a as T}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-293d6364.js";import{l as g,r as n,c as D,w as A,o as M,L as i,a9 as B,b as E,y as l,I as V,j as $,z as u,H as p,D as b}from"./index-c2905444.js";import{n as f}from"./utils-a855eb36.js";import"./ListviewItem-90d92dc7.js";import"./ListItem-e72ce29c.js";import"./VImg-ee22af0e.js";import"./VMenu-8ba8f078.js";import"./VTooltip-54e33c2a.js";import"./VCheckboxBtn-020d02eb.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-74d21d61.js";import"./VCard-a2a52f2b.js";import"./contextmenu-c9d825c5.js";import"./eventbus-d154090d.js";import"./Alert-854e6197.js";import"./Container-920d5187.js";/* empty css              */import"./VToolbar-0b568cf9.js";import"./VTextField-b3baf9d7.js";import"./VBadge-78c551e8.js";import"./VRow-a177c0dd.js";import"./VVirtualScroll-da9f2ada.js";import"./layout-cc3c7cd6.js";import"./VDialog-d570b2c9.js";const F=b("br",null,null,-1),N=b("br",null,null,-1),ie=g({__name:"TrackDetails",props:{itemId:{},provider:{},album:{}},setup(k){const o=k,_=n(""),s=n(!1),r=n(),h=D(()=>{var t;if(((t=r.value)==null?void 0:t.provider)!=="library")return[];const e=["library"];for(const a of f(r.value))e.push(a.provider_instance);return e}),m=async function(){r.value=await i.getTrack(o.itemId,o.provider,o.album),_.value="versions"};A(()=>o.itemId,e=>{e&&m()},{immediate:!0}),M(()=>{const e=i.subscribe(B.MEDIA_ITEM_ADDED,t=>{var d;const a=t.data;((d=r.value)==null?void 0:d.uri)==a.uri&&(s.value=!0)});E(e)});const y=async function(e){return c(await i.getTrackVersions(r.value.item_id,r.value.provider),e)},w=async function(e){let t=[];if(e.refresh&&(await m(),s.value=!1),!r.value)t=[];else if(e.providerFilter&&e.providerFilter!="library"){for(const a of f(r.value))if(a.provider_instance==e.providerFilter){t=await i.getTrackAlbums(a.item_id,a.provider_instance);break}}else t=await i.getTrackAlbums(r.value.item_id,r.value.provider);return c(t,e)};return(e,t)=>(l(),V("section",null,[$(I,{item:r.value,"active-provider":e.provider},null,8,["item","active-provider"]),r.value?(l(),u(v,{key:0,itemtype:"trackalbums","parent-item":r.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":w,"sort-keys":["provider","name","duration"],"update-available":s.value,title:e.$t("appears_on"),checksum:e.provider+e.itemId,"provider-filter":h.value},null,8,["parent-item","update-available","title","checksum","provider-filter"])):p("",!0),F,r.value?(l(),u(v,{key:1,itemtype:"trackversions","parent-item":r.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":y,"sort-keys":["provider","name","duration"],"update-available":s.value,title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"])):p("",!0),N,r.value?(l(),u(T,{key:2,"item-details":r.value},null,8,["item-details"])):p("",!0)]))}});export{ie as default};
