import{I as w,_ as V}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-C7zJx_G7.js";import{Q as h,x as b,c as g,Z as d,B as u,R as p,a9 as c,Y as A,U as l,S as a,G as x,$ as T,a1 as B,X as E,a0 as I,bb as y,aa as _,an as M,W as C,al as $,a4 as D,w as N,o as S,aS as L,b as U}from"./index-orrnp8a1.js";import{C as F}from"./Container-C-MxRHLg.js";import{T as G}from"./Toolbar-CE2HDv9i.js";import{b as H}from"./VChip-DzIcRFdM.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-DgYavPcK.js";import"./MediaItemThumb-BFLLxiOJ.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./marquee_text_sync-BWkPRIK0.js";import"./VBtn-BJolvyKt.js";import"./VDialog-oxeMlk6d.js";import"./layout-BTr25AHs.js";import"./ListItem-BOpEb2vA.js";import"./VContainer-DvR1uhzJ.js";/* empty css              */import"./VToolbar-BlKUHnwt.js";const P={style:{"margin-bottom":"10px"}},Q={style:{width:"50px"}},R={key:0,class:"text-caption"},W=h({__name:"Chapters",props:{itemDetails:{}},setup(v){const i=v,s=b(!0),e=function(){s.value=!s.value},f=g(()=>[{label:"tooltip.collapse_expand",icon:s.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),n=function(t){!i.itemDetails||!y(i.itemDetails)||D.playMedia(i.itemDetails.uri,void 0,void 0,t.position.toString())};return(t,r)=>(a(),d("section",P,[u(G,{title:t.$t("chapters"),"menu-items":f.value,onTitleClicked:e},null,8,["title","menu-items"]),u(A),s.value?(a(),p(F,{key:0},{default:l(()=>[u(B,null,{default:l(()=>{var m,k;return[(a(!0),d(x,null,T((k=(m=t.itemDetails)==null?void 0:m.metadata)==null?void 0:k.chapters,o=>(a(),p(E,{key:o.position,disabled:!I(y)(t.itemDetails),onClick:X=>n(o)},{prepend:l(()=>[C("div",Q,[u(H,null,{default:l(()=>[$(_(o.position),1)]),_:2},1024)])]),title:l(()=>[C("div",null,_(o.name),1)]),append:l(()=>[o.end?(a(),d("span",R,_(I(M)(o.end-o.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]}),_:1})]),_:1})):c("",!0)]))}}),re=h({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(v){const i=v,s=b(!1),e=b(),f=async function(){e.value=await D.getAudiobook(i.itemId,i.provider)};return N(()=>i.itemId,n=>{n&&f()},{immediate:!0}),S(()=>{const n=D.subscribe(L.MEDIA_ITEM_UPDATED,t=>{var m;const r=t.data;((m=e.value)==null?void 0:m.uri)==r.uri&&(s.value=!0)});U(n)}),(n,t)=>{var r;return a(),d(x,null,[u(w,{item:e.value},null,8,["item"]),e.value&&((r=e.value.metadata)!=null&&r.chapters)?(a(),p(W,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(a(),p(V,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64)}}});export{re as default};
