import{I as y,_ as C}from"./ProviderDetails.vue_vue_type_style_index_0_lang-B173j0nZ.js";import{C as V}from"./Container-C7yRkeCv.js";import{T as E}from"./Toolbar-C66D0zTJ.js";import{az as h,J as f,i as g,aP as d,aG as t,o as u,aF as m,aK as c,bi as w,aH as l,ah as x,b5 as A,bj as T,bk as B,aE as k,cd as D,aW as v,bx as M,E as I,c7 as L,aV as N,bc as _,L as $,a3 as F,bB as H,a4 as P}from"./index-D2rF_80D.js";import"./marquee_text_sync-Bj0t3siK.js";import"./MediaItemThumb-A-03axGx.js";import"./ListItem-CU9QYmiw.js";import"./Button-CrfR8Gdt.js";import"./index-kQIztB-E.js";import"./VToolbar-Db4qfa2C.js";const S={style:{"margin-bottom":"10px"}},U={style:{width:"50px"}},j={key:0,class:"text-caption"},z=h({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=f(!0),e=function(){o.value=!o.value},p=g(()=>[{label:"tooltip.collapse_expand",icon:o.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),s=function(n){!a.itemDetails||!D(a.itemDetails)||_.playMedia(a.itemDetails.uri,void 0,void 0,n.position.toString())};return(n,b)=>(t(),d("section",S,[u(E,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),u(w),o.value?(t(),m(V,{key:0},{default:l(()=>[u(T,null,{default:l(()=>[(t(!0),d(x,null,A(r.itemDetails?.metadata?.chapters,i=>(t(),m(B,{key:i.position,disabled:!k(D)(r.itemDetails),onClick:G=>s(i)},{prepend:l(()=>[I("div",U,[u(L,null,{default:l(()=>[N(v(i.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),d("span",j,v(k(M)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),ee=h({__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(H.MEDIA_ITEM_UPDATED,n=>{const b=n.data;e.value?.uri==b.uri&&(o.value=!0)});P(s)}),(s,n)=>(t(),d(x,null,[u(y,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),m(z,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(t(),m(C,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64))}});export{ee as default};
