import{l as E,r as b,w as U,o as z,O as l,af as R,b as F,q as p,y as w,j as s,x as m,v as k,F as P,z as S,M as y,L as h,ai as V,K as I,N as c,A as j,ah as q}from"./index-ade73b84.js";import{_ as T,f as $}from"./ItemsListing.vue_vue_type_script_setup_true_lang-3b792876.js";import{_ as H}from"./InfoHeader.vue_vue_type_style_index_0_lang-2f9c70b4.js";import{C,L as K,a as O}from"./Container-282a676b.js";import{V as G}from"./VToolbar-806969a3.js";import{V as J}from"./VDivider-adefbf87.js";import{V as M}from"./VMenu-ccc026f2.js";import{a as Q}from"./VCard-f3e11b51.js";import{l as W}from"./VBtn-61e39030.js";import"./ListviewItem-2bd74fad.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-cd169f56.js";import"./VDialog-93a2100b.js";import"./VListItem-f848c028.js";import"./VSelect-a66ffc02.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-93dbfb68.js";import"./Alert-4d78da02.js";import"./VSpacer-159b0383.js";import"./VBadge-12aff0c7.js";import"./VRow-74a0e5a5.js";/* empty css              */import"./layout-b0232ef9.js";const X=h("br",null,null,-1),Y=h("br",null,null,-1),Z=["src"],ye=E({__name:"TrackDetails",props:{itemId:{},provider:{},album:{}},setup(A){const a=A,D=b(""),d=b(!1),n=b(),f=async function(){console.log("props",a),n.value=await l.getTrack(a.itemId,a.provider,a.album),D.value="versions"};U(()=>a.itemId,e=>{e&&f()},{immediate:!0}),z(()=>{const e=l.subscribe(R.MEDIA_ITEM_ADDED,r=>{var t;const o=r.data;((t=n.value)==null?void 0:t.uri)==o.uri&&(d.value=!0)});F(e)});const g=async function(e,r,o,t,v=!0){const u=[];if(a.provider=="library"){const i=await l.getTrackVersions(a.itemId,a.provider);u.push(...i)}for(const i of V(n.value)){const _=await l.getTrackVersions(i.item_id,i.provider_instance);u.push(..._)}return $(u,e,r,o,t,v)},B=async function(e,r,o,t,v=!0){const u=[];if(a.provider=="library"){const i=await l.getTrackAlbums(a.itemId,a.provider);u.push(...i)}for(const i of V(n.value)){const _=await l.getTrackAlbums(i.item_id,i.provider_instance);u.push(..._)}return $(u,e,r,o,t,v)},L=function(e){window.open(e,"_blank")},N=function(e,r){return`${l.baseUrl}/preview?provider=${e}&item_id=${encodeURIComponent(r)}`};return(e,r)=>(p(),w("section",null,[s(H,{item:n.value,"active-provider":e.provider},null,8,["item","active-provider"]),s(C,null,{default:m(()=>[s(T,{itemtype:"trackalbums","parent-item":n.value,"show-provider":!0,"show-favorites-only-filter":!1,"show-library":!0,"show-track-number":!1,"load-data":B,"sort-keys":["provider","sort_name","duration"],"update-available":d.value,onRefreshClicked:r[0]||(r[0]=o=>{f(),d.value=!1}),title:e.$t("appears_on"),checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),X,s(T,{itemtype:"trackversions","parent-item":n.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":d.value,onRefreshClicked:r[1]||(r[1]=o=>{f(),d.value=!1}),title:e.$t("other_versions"),"hide-on-empty":!0,checksum:e.provider+e.itemId},null,8,["parent-item","update-available","title","checksum"]),Y,e.provider=="library"?(p(),k(Q,{key:0,style:{"margin-bottom":"10px"}},{default:m(()=>[s(G,{color:"transparent",title:e.$t("mapped_providers"),style:{height:"55px"}},null,8,["title"]),s(J),s(C,null,{default:m(()=>[s(M,null,{default:m(()=>{var o;return[(p(!0),w(P,null,S((o=n.value)==null?void 0:o.provider_mappings,t=>(p(),k(K,null,{prepend:m(()=>[s(O,{domain:t.provider_domain,size:30},null,8,["domain"])]),title:m(()=>[I(c(j(l).providerManifests[t.provider_domain].name),1)]),subtitle:m(()=>[I(c(t.item_id)+" | "+c(t.audio_format.content_type)+" | "+c(t.audio_format.sample_rate/1e3)+"kHz/"+c(t.audio_format.bit_depth)+" bits ",1)]),append:m(()=>[h("audio",{name:"preview",title:"preview",controls:"",src:N(t.provider_domain,t.item_id)},null,8,Z),t.url?(p(),k(W,{key:0,variant:"plain",icon:"mdi-open-in-new",onClick:q(v=>L(t.url),["prevent"])},null,8,["onClick"])):y("",!0)]),_:2},1024))),256))]}),_:1})]),_:1})]),_:1})):y("",!0)]),_:1})]))}});export{ye as default};
