import{I as h,_ as x}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-BKRBxfS6.js";import{C as g}from"./Container-iGBsqgnx.js";import{T}from"./Toolbar-DambSy-S.js";import{a7 as y,F as f,i as V,a8 as m,a9 as t,o as u,ai as d,aa as c,au as w,ae as l,a0 as C,af as A,ag as E,aj as M,ac as D,bo as k,an as v,aJ as N,E as I,bm as B,aT as L,ap as _,M as $,L as F,aN as S,N as U}from"./index-CFcIX8RO.js";import"./marquee_text_sync-gXoJPEDk.js";import"./MediaItemThumb-oOnMmU-2.js";import"./VDialog-C2cPU7vi.js";import"./ListItem-CWPLlf7K.js";import"./Button-IxLZkOI0.js";import"./index-kQIztB-E.js";import"./VToolbar-B_3_MVxk.js";const j={style:{"margin-bottom":"10px"}},H={style:{width:"50px"}},J={key:0,class:"text-caption"},P=y({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=f(!0),e=function(){o.value=!o.value},p=V(()=>[{label:"tooltip.collapse_expand",icon:o.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),s=function(n){!a.itemDetails||!k(a.itemDetails)||_.playMedia(a.itemDetails.uri,void 0,void 0,n.position.toString())};return(n,b)=>(t(),m("section",j,[u(T,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),u(w),o.value?(t(),d(g,{key:0},{default:l(()=>[u(E,null,{default:l(()=>[(t(!0),m(C,null,A(r.itemDetails?.metadata?.chapters,i=>(t(),d(M,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:q=>s(i)},{prepend:l(()=>[I("div",H,[u(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(),m("span",J,v(D(N)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),te=y({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(r){const a=r,o=f(!1),e=f(),p=async function(){e.value=await _.getAudiobook(a.itemId,a.provider)};return $(()=>a.itemId,s=>{s&&p()},{immediate:!0}),F(()=>{const s=_.subscribe(S.MEDIA_ITEM_UPDATED,n=>{const b=n.data;e.value?.uri==b.uri&&(o.value=!0)});U(s)}),(s,n)=>(t(),m(C,null,[u(h,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(P,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(t(),d(x,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64))}});export{te as default};
