"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),A=require("nanoid"),u=require("lodash"),J=["autoplay","loop","muted"],k=["src"],b=e.createStaticVNode('<svg width="100%" height="100%" viewBox="0 0 75 75" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-a3d928ad><circle cx="37.5" cy="37.5" r="37.5" fill="#3D9CFF" fill-opacity="0.1" data-v-a3d928ad></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M51.3268 20.4054H33.1254C32.2255 20.4 31.3554 20.728 30.6832 21.3264C30.0109 21.9247 29.5841 22.7508 29.4852 23.6453L27.0161 44.2762C26.1001 43.746 25.053 43.4598 23.9763 43.4598C22.3672 43.4598 20.824 44.099 19.6862 45.2368C18.5484 46.3746 17.9092 47.9178 17.9092 49.5269C17.9092 51.136 18.5484 52.6792 19.6862 53.817C20.824 54.9548 22.3672 55.594 23.9763 55.594C25.5854 55.594 27.1286 54.9548 28.2664 53.817C29.3529 52.7305 29.9848 51.2743 30.0395 49.744L30.0555 49.746L32.361 31.3141H50.5623L48.8975 44.2994C47.9722 43.7543 46.9103 43.4598 45.818 43.4598C44.2089 43.4598 42.6657 44.099 41.5279 45.2368C40.3901 46.3746 39.7509 47.9178 39.7509 49.5269C39.7509 51.136 40.3901 52.6792 41.5279 53.817C42.6657 54.9548 44.2089 55.594 45.818 55.594C47.4271 55.594 48.9703 54.9548 50.1081 53.817C51.1946 52.7305 51.8265 51.2743 51.8812 49.744L51.8971 49.746L54.9792 24.434C55.034 23.9233 54.9801 23.4069 54.8211 22.9185C54.6621 22.4301 54.4015 21.981 54.0566 21.6005C53.7116 21.22 53.29 20.9168 52.8196 20.7108C52.3491 20.5049 51.8403 20.4008 51.3268 20.4054Z" fill="url(#paint0_linear_534:1941)" data-v-a3d928ad></path><defs data-v-a3d928ad><linearGradient id="paint0_linear_534:1941" x1="17.9092" y1="37.9996" x2="56.4836" y2="37.9996" gradientUnits="userSpaceOnUse" data-v-a3d928ad><stop stop-color="#3D9CFF" data-v-a3d928ad></stop><stop offset="1" stop-color="#43E8F3" data-v-a3d928ad></stop></linearGradient></defs></svg>',1),D=[b],L=e.defineComponent({name:"zv-media-audio-dynamic"}),V=e.defineComponent({...L,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},emits:["on-audio-progress","on-audio-play","on-audio-pause","on-audio-ended","on-audio-playing","on-audio-timeupdate","on-audio-error","on-audio-volumechange"],setup(c,{expose:p,emit:v}){const o=c,f=()=>{const a=e.ref(""),i=e.ref(A.nanoid()),H=e.ref(!1),r=()=>{window.SHJDatasourceV2({tId:o.uuid,sources:o.sources,callback:({data:l})=>{try{window.SHJParseEvent(o.useEvents,"dataListener",l),a.value=l[0].data[0].src}catch{window.SHJParseEvent(o.useEvents,"dataListener",null)}}})};return e.onMounted(()=>e.nextTick(()=>r())),{init:r,src:a,key:i,isAudioPlay:H}},{init:t,src:w,key:y,isAudioPlay:s}=f();e.watch(()=>u.cloneDeep(o.basicOption),(a,i)=>{u.isEqual(a,i)||t()},{deep:!0}),e.watch(()=>u.cloneDeep(o.sources),(a,i)=>{u.isEqual(a,i)||t()},{deep:!0});const d=e.ref(),n=v,E=()=>{n("on-audio-progress"),window.SHJParseEvent(o.useEvents,"on-audio-progress"),s.value=!0},m=()=>{n("on-audio-play"),window.SHJParseEvent(o.useEvents,"on-audio-play"),s.value=!0},h=()=>{n("on-audio-pause"),window.SHJParseEvent(o.useEvents,"on-audio-pause"),s.value=!1},C=()=>{n("on-audio-ended"),window.SHJParseEvent(o.useEvents,"on-audio-ended"),s.value=!1},g=()=>{n("on-audio-playing"),window.SHJParseEvent(o.useEvents,"on-audio-playing")},P=()=>{n("on-audio-timeupdate"),window.SHJParseEvent(o.useEvents,"on-audio-timeupdate")},_=()=>{n("on-audio-error"),window.SHJParseEvent(o.useEvents,"on-audio-error"),s.value=!1},S=()=>{n("on-audio-volumechange"),window.SHJParseEvent(o.useEvents,"on-audio-volumechange")};return p({play:()=>{d.value&&d.value.play()},pause:()=>{d.value&&d.value.pause()},refresh:()=>t(),refreshView:()=>t(),refreshData:()=>t()}),(a,i)=>(e.openBlock(),e.createElementBlock("div",{key:e.unref(y),class:"audio"},[e.withDirectives(e.createElementVNode("audio",{ref_key:"audioRef",ref:d,autoplay:a.basicOption.autoplay,loop:a.basicOption.loop,controls:!1,muted:a.basicOption.muted,onProgress:E,onPlay:m,onEnded:C,onPlaying:g,onPause:h,onTimeupdate:P,onError:_,onVolumechange:S},[e.createElementVNode("source",{src:e.unref(w)},null,8,k)],40,J),[[e.vShow,!1]]),e.createElementVNode("div",{class:e.normalizeClass(["audio-svg",{animation:e.unref(s)}])},D,2)]))}});exports.default=V;
