import{I as y,_ as h}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-CXwX75cg.js";import{C as g}from"./Container-DVyc_Yt_.js";import{T as w}from"./Toolbar-CLPRlZ-4.js";import{av as I,H as f,r as V,aw as m,x as u,aD as d,ay as c,aQ as A,aB as l,ax as t,ag as x,aC as E,aE as T,az as D,bF as k,aI as v,b2 as B,d as C,bC as M,bc as L,aJ as N,aL as _,J as $,a3 as F,b6 as H,a4 as J}from"./index-C-Ivu3jU.js";import"./marquee_text_sync-DUGxi-pZ.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./MediaItemThumb-BsXB7IV6.js";import"./VDialog-BZuFHdVP.js";import"./layout-D2NB7OTD.js";import"./ListItem-BLmrgznL.js";import"./Button-FtStaD9_.js";import"./index-kQIztB-E.js";import"./VContainer-CNNJtZg6.js";import"./VToolbar-DTucOBiF.js";const S={style:{"margin-bottom":"10px"}},U={style:{width:"50px"}},z={key:0,class:"text-caption"},P=I({__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",S,[u(w,{title:n.$t("chapters"),"menu-items":p.value,onTitleClicked:e},null,8,["title","menu-items"]),u(A),o.value?(t(),d(g,{key:0},{default:l(()=>[u(N,null,{default:l(()=>[(t(!0),m(x,null,E(r.itemDetails?.metadata?.chapters,i=>(t(),d(T,{key:i.position,disabled:!D(k)(r.itemDetails),onClick:Q=>s(i)},{prepend:l(()=>[C("div",U,[u(M,null,{default:l(()=>[L(v(i.position),1)]),_:2},1024)])]),title:l(()=>[C("div",null,v(i.name),1)]),append:l(()=>[i.end?(t(),m("span",z,v(D(B)(i.end-i.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):c("",!0)]))}}),oe=I({__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)});J(s)}),(s,n)=>(t(),m(x,null,[u(y,{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(h,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64))}});export{oe as default};
