import{d as U,r as w,e7 as j,j as s,e8 as B,q as _,A as L,x as c,a8 as A,a9 as q,O as e,D as M,B as f,aC as F,v as H,Q as v,k as r,a0 as T,t as Q,m as X,e1 as G,e9 as J}from"./chunk.eVCQshbn.js";import{aa as K,j as W,T as Y}from"./components.a6A3eWos.js";import{a as Z,_ as ee}from"./SoundControl.vue.8-O-YdAi.js";const oe=["content"],te=["href"],ae=["muted"],se=["src"],le={class:"bre-audio-player__text"},ne=["onMouseover"],re={class:"bre-audio-player__progress"},ie={class:"bre-audio-player-progress-line"},ue={class:"bre-audio-player-progress-time_box"},ce={class:"bre-audio-player-progress-time-base"},de={class:"bre-audio-player-progress-time-base"},pe=["textContent"],me={class:"bre-audio-player_footer"},_e={class:"bre-audio-player__author"},fe={class:"tw-inline-flex"},ge=U({__name:"EmbedBreAudio",props:{element:{},caption:{}},setup($){const o=$,d=w(),i=w(!1),D=j(d,{src:o.element.src}),{playing:u,buffered:p,currentTime:l,duration:y,volume:m}=D,E=s(()=>p.value.length>0?p.value[p.value.length-1][1]:0),N=s(()=>B(l.value)),I=s(()=>{var t;return B(y.value,(t=o.element)==null?void 0:t.duration)}),h=s(()=>{var t,a;return{copyright:(t=o.caption)==null?void 0:t.copyright,copyrightLink:(a=o.caption)==null?void 0:a.copyrightLink}}),P=s(()=>{var t;return!!((t=h.value)!=null&&t.copyright)});function z(){u.value=!u.value,u.value&&J(d.value)}function O(){i.value=!i.value}function R(){var t;l.value=Number((t=o.element)==null?void 0:t.timecode)||0}const S=s(()=>({backgroundImage:`url(${o.element.poster})`}));return(t,a)=>{var g,b,k,x,C,V;return _(),L("div",{class:f(["bre-audio-player",r(G)])},[c(K,A(q({...o,itemprop:"audio",isVideo:!1,class:"grid-area-footer"})),null,16),e("meta",{itemprop:"copyrightNotice",content:(g=o.caption)==null?void 0:g.copyright},null,8,oe),(b=o.caption)!=null&&b.copyrightLink?(_(),L("link",{key:0,itemprop:"copyrightHolder",href:(k=o.caption)==null?void 0:k.copyrightLink},null,8,te)):M("",!0),e("audio",{ref_key:"audio",ref:d,muted:i.value,onLoadedmetadata:R},[e("source",{src:(x=o.element)==null?void 0:x.src,type:"",itemprop:"url"},null,8,se)],40,ae),e("div",{class:f(["bre-audio-player__poster",{_default:!((C=o.element)!=null&&C.poster)}]),style:F(((V=o.element)==null?void 0:V.poster)&&{backgroundImage:S.value})},null,6),e("div",le,[c(W,{"is-shown-tooltip-if-clamped":"",tooltip:o.caption.text,placement:"top-start"},{default:H(({checkIsTextClamped:n})=>[e("span",{class:"tw-line-clamp-2 tw-cursor-default",onMouseover:n},v(o.caption.text),41,ne)]),_:1},8,["tooltip"])]),e("button",{class:f(`bre-audio-player__play ${r(u)?"_pause":"_play"}`),onClick:z},null,2),e("div",re,[e("div",ie,[c(Z,{modelValue:r(l),"onUpdate:modelValue":a[0]||(a[0]=n=>T(l)?l.value=n:null),secondary:E.value,max:r(y),hasMask:!0,lineColor:"#dfdfdf",passedColor:"#dfdfdf",processColor:"#3380ef"},null,8,["modelValue","secondary","max"]),e("div",ue,[e("div",ce,v(N.value),1),e("div",de,[e("span",{textContent:v(I.value)},null,8,pe)])])])]),e("div",me,[e("div",_e,[P.value?(_(),Q(Y,X({key:0},h.value,{showIcon:!1}),null,16)):M("",!0)]),e("div",fe,[c(ee,{modelValue:r(m),"onUpdate:modelValue":a[1]||(a[1]=n=>T(m)?m.value=n:null),max:1,lineColor:"#e7f3ff",processColor:"#3380EF",theme:"audio",muted:i.value,onDynamicClick:O},null,8,["modelValue","muted"])])])],2)}}});export{ge as _};