import{I as C,_ as x}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-B_OXjTPr.js";import{C as A}from"./Container-ZHtGcXZO.js";import{T as V}from"./Toolbar-BEJzY0mB.js";import{ay as h,J as f,i as g,az as m,aA as t,o as u,aI as d,aB as c,aU as w,aG as l,ah as y,aH as E,aF as T,aJ as B,aD as D,bM as k,aN as v,b7 as M,E as I,bK as N,bh as L,aP as _,L as $,a3 as U,bb as F,a4 as H}from"./index-BRUnowC8.js";import"./marquee_text_sync-BajKmu-m.js";import"./MediaItemThumb-CIE9_Elw.js";import"./VDialog-Bh3mGVOy.js";import"./ListItem-jfbxOrad.js";import"./Button-BKv4xLAv.js";import"./index-kQIztB-E.js";import"./VToolbar-DS4mUdOC.js";const J={style:{"margin-bottom":"10px"}},P={style:{width:"50px"}},S={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||!k(a.itemDetails)||_.playMedia(a.itemDetails.uri,void 0,void 0,n.position.toString())};return(n,b)=>(t(),m("section",J,[u(V,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),u(w),o.value?(t(),d(A,{key:0},{default:l(()=>[u(T,null,{default:l(()=>[(t(!0),m(y,null,E(r.itemDetails?.metadata?.chapters,i=>(t(),d(B,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:G=>s(i)},{prepend:l(()=>[I("div",P,[u(N,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",S,v(D(M)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),te=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}),U(()=>{const s=_.subscribe(F.MEDIA_ITEM_UPDATED,n=>{const b=n.data;e.value?.uri==b.uri&&(o.value=!0)});H(s)}),(s,n)=>(t(),m(y,null,[u(C,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(z,{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};
