import{I as h,_ as x}from"./ProviderDetails.vue_vue_type_style_index_0_lang-ClXR5oFa.js";import{C as w}from"./Container-CwfZ2VgM.js";import{T as E}from"./Toolbar-MwYpbj3t.js";import{z as b,i as V,c as _,E as g}from"./index-CxiRlsCY.js";import{e as A,b as T,c as M,o as B}from"./vuetify-RelkxOq-.js";import{d as y,r as D,c as $,b as u,e as t,H as m,D as d,I as p,E as l,F as C,M as N,u as k,a1 as v,f as I,$ as L,w as F,o as H,a0 as S}from"./lucide-C2DU1LFb.js";import"./marquee_text_sync-BtOjTSaq.js";import"./vue-router-BgJK_hRC.js";import"./MediaItemThumb-C7OhU3lK.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-C17dV9_V.js";import"./ListItem-DzUpG5Dm.js";import"./Button-DBt8j7D4.js";import"./index-kQIztB-E.js";import"./vue-i18n-DySrp6mW.js";import"./qrcode-DSFhiIp2.js";import"./marked-C0Rlrcoy.js";import"./color-BTziYnFN.js";import"./vueuse-DIaEWNCo.js";/* empty css            */import"./swiper-Jy9GbtzK.js";const U={style:{"margin-bottom":"10px"}},z={style:{width:"50px"}},P={key:0,class:"text-caption"},j=y({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=D(!0),e=function(){o.value=!o.value},c=$(()=>[{label:"tooltip.collapse_expand",icon:o.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),s=function(n){!a.itemDetails||!b(a.itemDetails)||_.playMedia(a.itemDetails.uri,void 0,void 0,n.position.toString())};return(n,f)=>(t(),u("section",U,[m(E,{title:n.$t("chapters"),"menu-items":c.value,onTitleClicked:e},null,8,["title","menu-items"]),m(A),o.value?(t(),d(w,{key:0},{default:l(()=>[m(T,null,{default:l(()=>[(t(!0),u(C,null,N(r.itemDetails?.metadata?.chapters,i=>(t(),d(M,{key:i.position,disabled:!k(b)(r.itemDetails),onClick:q=>s(i)},{prepend:l(()=>[I("div",z,[m(B,null,{default:l(()=>[L(v(i.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),u("span",P,v(k(V)(i.end-i.start)),1)):p("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):p("",!0)]))}}),ue=y({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(r){const a=r,o=D(!1),e=D(),c=async function(){e.value=await _.getAudiobook(a.itemId,a.provider)};return F(()=>a.itemId,s=>{s&&c()},{immediate:!0}),H(()=>{const s=_.subscribe(g.MEDIA_ITEM_UPDATED,n=>{const f=n.data;e.value?.uri==f.uri&&(e.value=f,o.value=!0)});S(s)}),(s,n)=>(t(),u(C,null,[m(h,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(j,{key:0,"item-details":e.value},null,8,["item-details"])):p("",!0),e.value?(t(),d(x,{key:1,"item-details":e.value},null,8,["item-details"])):p("",!0)],64))}});export{ue as default};
