import{I as h}from"./InfoHeader-CoNYNcZm.js";import{_ as x}from"./ProviderDetails.vue_vue_type_style_index_0_lang-CXtwfgiQ.js";import{C as w}from"./Container-B1UOd5ED.js";import{T as V}from"./Toolbar-Da01lZeW.js";import{J as D,q as g,a as _,E as A}from"./index-CKxLfxpS.js";import{e as E,b as T,c as B,n as M}from"./vuetify-C0IIhwYL.js";import{d as y,b as u,J as m,G as d,K as p,c as N,r as b,H as r,F as C,O as $,e as t,u as k,a4 as v,f as I,a2 as L,w as F,o as H,a3 as J}from"./lucide-UY9XeFdQ.js";import"./marquee_text_sync-C4anEqYx.js";import"./vue-router-DNlH4vva.js";import"./MarqueeText-DvK0-Oq1.js";import"./MediaItemThumb-DiY2t3Gt.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-DYXAnx83.js";import"./vue-i18n-DwYfJ_fn.js";import"./ListItem-BP0lui-9.js";import"./Button-DdCpYaoc.js";import"./index-kQIztB-E.js";import"./color-CcshWhNz.js";import"./qrcode-CJNXjF_3.js";import"./marked-D9eDbhZJ.js";import"./vueuse-Dj-fx4H6.js";/* empty css            */import"./swiper-DNx4mJDO.js";const S={style:{"margin-bottom":"10px"}},U={style:{width:"50px"}},q={key:0,class:"text-caption"},G=y({__name:"Chapters",props:{itemDetails:{}},setup(l){const a=l,o=b(!0),e=function(){o.value=!o.value},c=N(()=>[{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,f)=>(t(),u("section",S,[m(V,{title:n.$t("chapters"),"menu-items":c.value,onTitleClicked:e},null,8,["title","menu-items"]),m(E),o.value?(t(),d(w,{key:0},{default:r(()=>[m(T,null,{default:r(()=>[(t(!0),u(C,null,$(l.itemDetails?.metadata?.chapters,i=>(t(),d(B,{key:i.position,disabled:!k(D)(l.itemDetails),onClick:K=>s(i)},{prepend:r(()=>[I("div",U,[m(M,null,{default:r(()=>[L(v(i.position),1)]),_:2},1024)])]),title:r(()=>[I("div",null,v(i.name),1)]),append:r(()=>[i.end?(t(),u("span",q,v(k(g)(i.end-i.start)),1)):p("",!0)]),_:2},1032,["disabled","onClick"]))),128))]),_:1})]),_:1})):p("",!0)]))}}),pe=y({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(l){const a=l,o=b(!1),e=b(),c=async function(){e.value=await _.getAudiobook(a.itemId,a.provider)};return F(()=>a.itemId,s=>{s&&c()},{immediate:!0}),H(()=>{const s=_.subscribe(A.MEDIA_ITEM_UPDATED,n=>{const f=n.data;e.value?.uri==f.uri&&(e.value=f,o.value=!0)});J(s)}),(s,n)=>(t(),u(C,null,[m(h,{item:e.value},null,8,["item"]),e.value&&e.value.metadata?.chapters?(t(),d(G,{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{pe as default};
