import{I as h,_ as x}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-DKVZaoMX.js";import{C as V}from"./Container-Br6JH6Pm.js";import{T as w}from"./Toolbar-BvxWbi_E.js";import{U as y,x as f,c as g,a0 as m,X as a,F as r,W as u,ab as d,$ as A,Y as l,I as C,a1 as E,Z as T,a2 as D,bs as k,ad as v,aV as B,E as I,bp as M,as as $,a3 as N,a6 as _,w as L,o as U,aY as F,b as S}from"./index-B-lUZalq.js";import"./MediaItemThumb-DapaMoP4.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-D7pvlIaW.js";import"./VBtn-BPJ1JKW-.js";import"./VDialog-CAgq0L03.js";import"./layout-BuzUTwrQ.js";import"./ListItem-LV_WU--g.js";import"./Button-kSJGA_Pw.js";import"./VContainer-DB65WVbe.js";/* empty css              */import"./VToolbar-RljK0PC9.js";const Y={style:{"margin-bottom":"10px"}},H={style:{width:"50px"}},P={key:0,class:"text-caption"},W=y({__name:"Chapters",props:{itemDetails:{}},setup(p){const i=p,s=f(!0),e=function(){s.value=!s.value},c=g(()=>[{label:"tooltip.collapse_expand",icon:s.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),n=function(t){!i.itemDetails||!k(i.itemDetails)||_.playMedia(i.itemDetails.uri,void 0,void 0,t.position.toString())};return(t,b)=>(a(),m("section",Y,[r(w,{title:t.$t("chapters"),"menu-items":c.value,onTitleClicked:e},null,8,["title","menu-items"]),r(A),s.value?(a(),u(V,{key:0},{default:l(()=>[r(N,null,{default:l(()=>[(a(!0),m(C,null,E(t.itemDetails?.metadata?.chapters,o=>(a(),u(T,{key:o.position,disabled:!D(k)(t.itemDetails),onClick:X=>n(o)},{prepend:l(()=>[I("div",H,[r(M,null,{default:l(()=>[$(v(o.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(o.name),1)]),append:l(()=>[o.end?(a(),m("span",P,v(D(B)(o.end-o.start)),1)):d("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):d("",!0)]))}}),se=y({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(p){const i=p,s=f(!1),e=f(),c=async function(){e.value=await _.getAudiobook(i.itemId,i.provider)};return L(()=>i.itemId,n=>{n&&c()},{immediate:!0}),U(()=>{const n=_.subscribe(F.MEDIA_ITEM_UPDATED,t=>{const b=t.data;e.value?.uri==b.uri&&(s.value=!0)});S(n)}),(n,t)=>(a(),m(C,null,[r(h,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(a(),u(W,{key:0,"item-details":e.value},null,8,["item-details"])):d("",!0),e.value?(a(),u(x,{key:1,"item-details":e.value},null,8,["item-details"])):d("",!0)],64))}});export{se as default};
