import{_,f as I}from"./ItemsListing.vue_vue_type_script_setup_true_lang-436cf3d3.js";import{_ as B}from"./InfoHeader.vue_vue_type_style_index_0_lang-36a95710.js";import{l as E,r as v,w as L,o as z,O as m,af as N,b as F,q as s,y as c,j as u,v as f,x as k,F as R,z as j,A as w,M as b,ah as q,L as $}from"./index-e9211ef1.js";import{L as C,a as T}from"./Container-349a0ac0.js";import{a as O}from"./VCard-138864fc.js";import"./ListviewItem-b7a4258b.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-278977b5.js";import"./VMenu-bc0cce60.js";import"./VDivider-336c24cd.js";import"./VBtn-68784d55.js";import"./VListItem-230d1393.js";import"./VDialog-5f240a62.js";import"./VToolbar-daf2b89f.js";import"./VSelect-04a129eb.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-fefd2afe.js";import"./Alert-55091fd0.js";import"./VSpacer-bdf2f653.js";import"./VBadge-9fa94f29.js";import"./VRow-e8f3e51e.js";/* empty css              */import"./layout-4499d5bc.js";const ne=E({__name:"TrackDetails",props:{itemId:{},provider:{},album:{}},setup(A){const i=A,D=v(""),l=v(!1),r=v(),d=async function(){console.log("props",i),r.value=await m.getTrack(i.itemId,i.provider,i.album),D.value="versions"};L(()=>i.itemId,e=>{e&&d()},{immediate:!0}),z(()=>{const e=m.subscribe(N.MEDIA_ITEM_ADDED,a=>{var o;const t=a.data;((o=r.value)==null?void 0:o.uri)==t.uri&&(l.value=!0)});F(e)});const V=async function(e,a,t,o,p=!0){const n=await m.getTrackVersions(i.itemId,i.provider);return I(n,e,a,t,o,p)},g=async function(e,a,t,o,p=!0){var y,h;let n=await m.getTrackAlbums(i.itemId,i.provider);return n.length==0&&((y=r.value)!=null&&y.album)&&(n=[(h=r.value)==null?void 0:h.album]),I(n,e,a,t,o,p)};return(e,a)=>(s(),c("section",null,[u(B,{item:r.value,"active-provider":e.provider},null,8,["item","active-provider"]),u(_,{itemtype:"trackalbums","parent-item":r.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":g,"sort-keys":["provider","sort_name","duration"],"update-available":l.value,onRefreshClicked:a[0]||(a[0]=t=>{d(),l.value=!1}),title:e.$t("appears_on"),checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),u(_,{itemtype:"trackversions","parent-item":r.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":V,"sort-keys":["provider","sort_name","duration"],"update-available":l.value,onRefreshClicked:a[1]||(a[1]=t=>{d(),l.value=!1}),title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),r.value&&r.value.provider=="library"?(s(),f(O,{key:0,style:{"margin-left":"20px","margin-right":"20px"}},{default:k(()=>[(s(!0),c(R,null,j(w(q)(r.value),t=>(s(),c("div",{key:t.provider_instance},[[t.provider_domain,t.provider_instance].includes(e.provider)?b("",!0):(s(),f(C,{key:0,onClick:o=>e.$router.push({name:"track",params:{itemId:t.item_id,provider:t.provider_instance}}),subtitle:e.$t("check_item_on_provider",[r.value.name,w(m).providerManifests[t.provider_domain].name])},{prepend:k(()=>[$("div",null,[u(T,{domain:t.provider_domain,size:30},null,8,["domain"])])]),_:2},1032,["onClick","subtitle"])),e.provider!="library"&&r.value.provider=="library"?(s(),f(C,{key:1,onClick:a[2]||(a[2]=o=>e.$router.push({name:"track",params:{itemId:r.value.item_id,provider:r.value.provider}})),subtitle:e.$t("check_item_in_library",[r.value.name])},{prepend:k(()=>[$("div",null,[u(T,{domain:"library",size:30})])]),_:1},8,["subtitle"])):b("",!0)]))),128))]),_:1})):b("",!0)]))}});export{ne as default};
