import{I as C,_ as x}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-BaDwFhok.js";import{C as V}from"./Container-BVutxj42.js";import{T as w}from"./Toolbar-RSDUeNZR.js";import{d as h,i as f,N as g,c as u,b as m,e as d,q as p,p as A,w as l,o as t,F as y,r as T,V as E,u as D,bv as k,t as v,aX as B,a as I,bs as M,b4 as N,h as $,m as _,ad as L,j as F,a_ as S,l as U}from"./index-BLuBzgcR.js";import"./MediaItemThumb-4FqrTjbr.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-CbqHGytl.js";import"./VBtn-i8gedOhv.js";import"./VDialog-CUNnqGJy.js";import"./layout-Dtt5lK8k.js";import"./ListItem-D3UfOTqB.js";import"./Button-BEhYIX-0.js";import"./index-CBho6rsP.js";import"./VContainer-DOe7JF0h.js";/* empty css              */import"./VToolbar-BFOvSQM-.js";const j={style:{"margin-bottom":"10px"}},q={style:{width:"50px"}},H={key:0,class:"text-caption"},P=h({__name:"Chapters",props:{itemDetails:{}},setup(r){const a=r,o=f(!0),e=function(){o.value=!o.value},c=g(()=>[{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(),u("section",j,[m(w,{title:n.$t("chapters"),"menu-items":c.value,onTitleClicked:e},null,8,["title","menu-items"]),m(A),o.value?(t(),d(V,{key:0},{default:l(()=>[m($,null,{default:l(()=>[(t(!0),u(y,null,T(r.itemDetails?.metadata?.chapters,i=>(t(),d(E,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:X=>s(i)},{prepend:l(()=>[I("div",q,[m(M,null,{default:l(()=>[N(v(i.position),1)]),_:2},1024)])]),title:l(()=>[I("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),u("span",H,v(D(B)(i.end-i.start)),1)):p("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):p("",!0)]))}}),ne=h({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(r){const a=r,o=f(!1),e=f(),c=async function(){e.value=await _.getAudiobook(a.itemId,a.provider)};return L(()=>a.itemId,s=>{s&&c()},{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(),u(y,null,[m(C,{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"])):p("",!0),e.value?(t(),d(x,{key:1,"item-details":e.value},null,8,["item-details"])):p("",!0)],64))}});export{ne as default};
