import{I as V,_ as w}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-OXy0lG-f.js";import{c as I}from"./ItemContextMenu.vue_vue_type_style_index_0_scoped_3a9a25e3_lang-CIVcfVNt.js";import{x as C,r as D,c as A,y as a,D as d,n as u,z as p,A as r,K as c,F as x,E as g,G as y,B as h,S as E,J as _,U as T,I as b,w as B,o as M,ah as N,b as $}from"./index-m8nKq5sO.js";import{C as L}from"./Container-CzaMJHFj.js";import{T as S}from"./Toolbar-DE7xAoi9.js";import{V as U,a as F}from"./VList-Dq2hFeo-.js";import{k as z}from"./VListItem-BgwpeMXY.js";import{b as G}from"./VChip-3PA_sq0L.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-DCVBDHCR.js";import"./VMenu-Bm7-wo-8.js";import"./marquee_text_sync-DCQdTOa4.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./VCard-DaTV885y.js";import"./VCardText-DV3N2e-3.js";import"./VDialog-BQ5W8yPe.js";import"./layout-CKQl_2vD.js";import"./ListItem-DgDbw47e.js";import"./eventbus-CGRXT3Tn.js";import"./VContainer-CFZeQyHT.js";/* empty css              */import"./VToolbar-CjHms_z-.js";const H={style:{"margin-bottom":"10px"}},J={style:{width:"50px"}},K={key:0,class:"text-caption"},P=C({__name:"Chapters",props:{itemDetails:{}},setup(f){const i=f,s=D(!0),e=function(){s.value=!s.value},v=A(()=>[{label:"tooltip.collapse_expand",icon:s.value?"mdi-chevron-up":"mdi-chevron-down",action:e,overflowAllowed:!1}]),n=function(t){!i.itemDetails||!I(i.itemDetails)||b.playMedia(i.itemDetails.uri,void 0,void 0,t.position.toString())};return(t,l)=>(a(),d("section",H,[u(S,{title:t.$t("chapters"),"menu-items":v.value,onTitleClicked:e},null,8,["title","menu-items"]),u(U),s.value?(a(),p(L,{key:0},{default:r(()=>[u(F,null,{default:r(()=>{var m,k;return[(a(!0),d(x,null,g((k=(m=t.itemDetails)==null?void 0:m.metadata)==null?void 0:k.chapters,o=>(a(),p(z,{key:o.position,disabled:!y(I)(t.itemDetails),onClick:j=>n(o)},{prepend:r(()=>[h("div",J,[u(G,null,{default:r(()=>[E(_(o.position),1)]),_:2},1024)])]),title:r(()=>[h("div",null,_(o.name),1)]),append:r(()=>[o.end?(a(),d("span",K,_(y(T)(o.end-o.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]}),_:1})]),_:1})):c("",!0)]))}}),ce=C({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(f){const i=f,s=D(!1),e=D(),v=async function(){e.value=await b.getAudiobook(i.itemId,i.provider)};return B(()=>i.itemId,n=>{n&&v()},{immediate:!0}),M(()=>{const n=b.subscribe(N.MEDIA_ITEM_UPDATED,t=>{var m;const l=t.data;((m=e.value)==null?void 0:m.uri)==l.uri&&(s.value=!0)});$(n)}),(n,t)=>{var l;return a(),d(x,null,[u(V,{item:e.value},null,8,["item"]),e.value&&((l=e.value.metadata)!=null&&l.chapters)?(a(),p(P,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(a(),p(w,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64)}}});export{ce as default};
