import{I as V,_ as g}from"./ProviderDetails.vue_vue_type_script_setup_true_lang-Bf7qdK33.js";import{c as I}from"./ItemContextMenu.vue_vue_type_style_index_0_scoped_4409cede_lang-41DbVClm.js";import{x as C,r as D,c as x,y as a,D as p,n as u,z as d,A as r,K as c,F as h,E as A,G as y,S as w,J as _,B as E,U as T,I as k,w as B,o as M,af as N,b as $}from"./index-CFvoaD7J.js";import{C as L}from"./Container-BDz3QMuX.js";import{T as S}from"./Toolbar-DNen7a-V.js";import{V as U,a as F}from"./VList-fGk9SRdf.js";import{k as z}from"./VListItem-CSPID7yq.js";import{a as G}from"./VChip-Ccz1-bmn.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-Ji67J6Pu.js";import"./VMenu-9pSrU4Fo.js";import"./marquee_text_sync-k18A2BIX.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./VCard-DxLPF-Ra.js";import"./VCardText-CpOuj25H.js";import"./VDialog-CdvGeqlS.js";import"./VTooltip-DC73AT2B.js";import"./layout-BeGdxe2Y.js";import"./ListItem-nYGtvGaY.js";import"./eventbus-CGRXT3Tn.js";import"./VContainer-CzfHAKpA.js";/* empty css              */import"./VToolbar-Da4d1W_R.js";const H={style:{"margin-bottom":"10px"}},J={style:{"margin-left":"15px"}},K={key:0},P=C({__name:"Chapters",props:{itemDetails:{}},setup(f){const i=f,s=D(!1),e=function(){s.value=!s.value},v=x(()=>[{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)||k.playMedia(i.itemDetails.uri,void 0,void 0,t.position.toString())};return(t,l)=>(a(),p("section",H,[u(S,{title:t.$t("chapters"),"menu-items":v.value,onTitleClicked:e},null,8,["title","menu-items"]),u(U),s.value?(a(),d(L,{key:0},{default:r(()=>[u(F,null,{default:r(()=>{var m,b;return[(a(!0),p(h,null,A((b=(m=t.itemDetails)==null?void 0:m.metadata)==null?void 0:b.chapters,o=>(a(),d(z,{key:o.position,disabled:!y(I)(t.itemDetails),onClick:j=>n(o)},{prepend:r(()=>[u(G,null,{default:r(()=>[w(_(o.position),1)]),_:2},1024)]),title:r(()=>[E("div",J,_(o.name),1)]),append:r(()=>[o.end?(a(),p("span",K,_(y(T)(o.end-o.start)),1)):c("",!0)]),_:2},1032,["disabled","onClick"]))),128))]}),_:1})]),_:1})):c("",!0)]))}}),fe=C({__name:"AudiobookDetails",props:{itemId:{},provider:{}},setup(f){const i=f,s=D(!1),e=D(),v=async function(){e.value=await k.getAudiobook(i.itemId,i.provider)};return B(()=>i.itemId,n=>{n&&v()},{immediate:!0}),M(()=>{const n=k.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(),p(h,null,[u(V,{item:e.value},null,8,["item"]),e.value&&((l=e.value.metadata)!=null&&l.chapters)?(a(),d(P,{key:0,"item-details":e.value},null,8,["item-details"])):c("",!0),e.value?(a(),d(g,{key:1,"item-details":e.value},null,8,["item-details"])):c("",!0)],64)}}});export{fe as default};
