UNPKG

mediaquad-sound-component

Version:

This component is built on the [wavesurfer](https://wavesurfer.xyz) library.

92 lines (90 loc) 41.7 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue");function C(i,e,t,n){return new(t||(t=Promise))(function(r,o){function a(h){try{d(n.next(h))}catch(c){o(c)}}function l(h){try{d(n.throw(h))}catch(c){o(c)}}function d(h){var c;h.done?r(h.value):(c=h.value,c instanceof t?c:new t(function(p){p(c)})).then(a,l)}d((n=n.apply(i,e||[])).next())})}class P{constructor(){this.listeners={}}on(e,t,n){if(this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t),n==null?void 0:n.once){const r=()=>{this.un(e,r),this.un(e,t)};return this.on(e,r),r}return()=>this.un(e,t)}un(e,t){var n;(n=this.listeners[e])===null||n===void 0||n.delete(t)}once(e,t){return this.on(e,t,{once:!0})}unAll(){this.listeners={}}emit(e,...t){this.listeners[e]&&this.listeners[e].forEach(n=>n(...t))}}const D={decode:function(i,e){return C(this,void 0,void 0,function*(){const t=new AudioContext({sampleRate:e});return t.decodeAudioData(i).finally(()=>t.close())})},createBuffer:function(i,e){return typeof i[0]=="number"&&(i=[i]),function(t){const n=t[0];if(n.some(r=>r>1||r<-1)){const r=n.length;let o=0;for(let a=0;a<r;a++){const l=Math.abs(n[a]);l>o&&(o=l)}for(const a of t)for(let l=0;l<r;l++)a[l]/=o}}(i),{duration:e,length:i[0].length,sampleRate:i[0].length/e,numberOfChannels:i.length,getChannelData:t=>i==null?void 0:i[t],copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}}};function A(i,e){const t=e.xmlns?document.createElementNS(e.xmlns,i):document.createElement(i);for(const[n,r]of Object.entries(e))if(n==="children")for(const[o,a]of Object.entries(e))typeof a=="string"?t.appendChild(document.createTextNode(a)):t.appendChild(A(o,a));else n==="style"?Object.assign(t.style,r):n==="textContent"?t.textContent=r:t.setAttribute(n,r.toString());return t}function O(i,e,t){const n=A(i,e||{});return t==null||t.appendChild(n),n}var j=Object.freeze({__proto__:null,createElement:O,default:O});const q={fetchBlob:function(i,e,t){return C(this,void 0,void 0,function*(){const n=yield fetch(i,t);if(n.status>=400)throw new Error(`Failed to fetch ${i}: ${n.status} (${n.statusText})`);return function(r,o){C(this,void 0,void 0,function*(){if(!r.body||!r.headers)return;const a=r.body.getReader(),l=Number(r.headers.get("Content-Length"))||0;let d=0;const h=p=>C(this,void 0,void 0,function*(){d+=(p==null?void 0:p.length)||0;const u=Math.round(d/l*100);o(u)}),c=()=>C(this,void 0,void 0,function*(){let p;try{p=yield a.read()}catch{return}p.done||(h(p.value),yield c())});c()})}(n.clone(),e),n.blob()})}};class F extends P{constructor(e){super(),this.isExternalMedia=!1,e.media?(this.media=e.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),e.mediaControls&&(this.media.controls=!0),e.autoplay&&(this.media.autoplay=!0),e.playbackRate!=null&&this.onMediaEvent("canplay",()=>{e.playbackRate!=null&&(this.media.playbackRate=e.playbackRate)},{once:!0})}onMediaEvent(e,t,n){return this.media.addEventListener(e,t,n),()=>this.media.removeEventListener(e,t,n)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const e=this.getSrc();e.startsWith("blob:")&&URL.revokeObjectURL(e)}canPlayType(e){return this.media.canPlayType(e)!==""}setSrc(e,t){const n=this.getSrc();if(e&&n===e)return;this.revokeSrc();const r=t instanceof Blob&&(this.canPlayType(t.type)||!e)?URL.createObjectURL(t):e;try{this.media.src=r}catch{this.media.src=e}}destroy(){this.media.pause(),this.isExternalMedia||(this.media.remove(),this.revokeSrc(),this.media.src="",this.media.load())}setMediaElement(e){this.media=e}play(){return C(this,void 0,void 0,function*(){return this.media.play()})}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(e){this.media.currentTime=e}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(e){this.media.volume=e}getMuted(){return this.media.muted}setMuted(e){this.media.muted=e}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(e,t){t!=null&&(this.media.preservesPitch=t),this.media.playbackRate=e}getMediaElement(){return this.media}setSinkId(e){return this.media.setSinkId(e)}}class B extends P{constructor(e,t){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.subscriptions=[],this.options=e;const n=this.parentFromOptionsContainer(e.container);this.parent=n;const[r,o]=this.initHtml();n.appendChild(r),this.container=r,this.scrollContainer=o.querySelector(".scroll"),this.wrapper=o.querySelector(".wrapper"),this.canvasWrapper=o.querySelector(".canvases"),this.progressWrapper=o.querySelector(".progress"),this.cursor=o.querySelector(".cursor"),t&&o.appendChild(t),this.initEvents()}parentFromOptionsContainer(e){let t;if(typeof e=="string"?t=document.querySelector(e):e instanceof HTMLElement&&(t=e),!t)throw new Error("Container not found");return t}initEvents(){const e=t=>{const n=this.wrapper.getBoundingClientRect(),r=t.clientX-n.left,o=t.clientY-n.top;return[r/n.width,o/n.height]};if(this.wrapper.addEventListener("click",t=>{const[n,r]=e(t);this.emit("click",n,r)}),this.wrapper.addEventListener("dblclick",t=>{const[n,r]=e(t);this.emit("dblclick",n,r)}),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollContainer.addEventListener("scroll",()=>{const{scrollLeft:t,scrollWidth:n,clientWidth:r}=this.scrollContainer,o=t/n,a=(t+r)/n;this.emit("scroll",o,a,t,t+r)}),typeof ResizeObserver=="function"){const t=this.createDelay(100);this.resizeObserver=new ResizeObserver(()=>{t().then(()=>this.onContainerResize()).catch(()=>{})}),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const e=this.parent.clientWidth;e===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=e,this.reRender())}initDrag(){this.subscriptions.push(function(e,t,n,r,o=3,a=0,l=100){if(!e)return()=>{};const d=matchMedia("(pointer: coarse)").matches;let h=()=>{};const c=p=>{if(p.button!==a)return;p.preventDefault(),p.stopPropagation();let u=p.clientX,f=p.clientY,m=!1;const k=Date.now(),g=v=>{if(v.preventDefault(),v.stopPropagation(),d&&Date.now()-k<l)return;const E=v.clientX,T=v.clientY,M=E-u,x=T-f;if(m||Math.abs(M)>o||Math.abs(x)>o){const L=e.getBoundingClientRect(),{left:W,top:V}=L;m||(n==null||n(u-W,f-V),m=!0),t(M,x,E-W,T-V),u=E,f=T}},y=v=>{if(m){const E=v.clientX,T=v.clientY,M=e.getBoundingClientRect(),{left:x,top:L}=M;r==null||r(E-x,T-L)}h()},b=v=>{v.relatedTarget&&v.relatedTarget!==document.documentElement||y(v)},S=v=>{m&&(v.stopPropagation(),v.preventDefault())},w=v=>{m&&v.preventDefault()};document.addEventListener("pointermove",g),document.addEventListener("pointerup",y),document.addEventListener("pointerout",b),document.addEventListener("pointercancel",b),document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("click",S,{capture:!0}),h=()=>{document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",y),document.removeEventListener("pointerout",b),document.removeEventListener("pointercancel",b),document.removeEventListener("touchmove",w),setTimeout(()=>{document.removeEventListener("click",S,{capture:!0})},10)}};return e.addEventListener("pointerdown",c),()=>{h(),e.removeEventListener("pointerdown",c)}}(this.wrapper,(e,t,n)=>{this.emit("drag",Math.max(0,Math.min(1,n/this.wrapper.getBoundingClientRect().width)))},e=>{this.isDragging=!0,this.emit("dragstart",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))},e=>{this.isDragging=!1,this.emit("dragend",Math.max(0,Math.min(1,e/this.wrapper.getBoundingClientRect().width)))}))}getHeight(e,t){var n;const r=((n=this.audioData)===null||n===void 0?void 0:n.numberOfChannels)||1;if(e==null)return 128;if(!isNaN(Number(e)))return Number(e);if(e==="auto"){const o=this.parent.clientHeight||128;return t!=null&&t.every(a=>!a.overlay)?o/r:o}return 128}initHtml(){const e=document.createElement("div"),t=e.attachShadow({mode:"open"}),n=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return t.innerHTML=` <style${n?` nonce="${n}"`:""}> :host { user-select: none; min-width: 1px; } :host audio { display: block; width: 100%; } :host .scroll { overflow-x: auto; overflow-y: hidden; width: 100%; position: relative; } :host .noScrollbar { scrollbar-color: transparent; scrollbar-width: none; } :host .noScrollbar::-webkit-scrollbar { display: none; -webkit-appearance: none; } :host .wrapper { position: relative; overflow: visible; z-index: 2; } :host .canvases { min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px; } :host .canvases > div { position: relative; } :host canvas { display: block; position: absolute; top: 0; image-rendering: pixelated; } :host .progress { pointer-events: none; position: absolute; z-index: 2; top: 0; left: 0; width: 0; height: 100%; overflow: hidden; } :host .progress > div { position: relative; } :host .cursor { pointer-events: none; position: absolute; z-index: 5; top: 0; left: 0; height: 100%; border-radius: 2px; } </style> <div class="scroll" part="scroll"> <div class="wrapper" part="wrapper"> <div class="canvases" part="canvases"></div> <div class="progress" part="progress"></div> <div class="cursor" part="cursor"></div> </div> </div> `,[e,t]}setOptions(e){if(this.options.container!==e.container){const t=this.parentFromOptionsContainer(e.container);t.appendChild(this.container),this.parent=t}e.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.options=e,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(e){this.scrollContainer.scrollLeft=e}setScrollPercentage(e){const{scrollWidth:t}=this.scrollContainer,n=t*e;this.setScroll(n)}destroy(){var e,t;this.subscriptions.forEach(n=>n()),this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.unsubscribeOnScroll)===null||t===void 0||t.forEach(n=>n()),this.unsubscribeOnScroll=[]}createDelay(e=10){let t,n;const r=()=>{t&&clearTimeout(t),n&&n()};return this.timeouts.push(r),()=>new Promise((o,a)=>{r(),n=a,t=setTimeout(()=>{t=void 0,n=void 0,o()},e)})}convertColorValues(e){if(!Array.isArray(e))return e||"";if(e.length<2)return e[0]||"";const t=document.createElement("canvas"),n=t.getContext("2d"),r=t.height*(window.devicePixelRatio||1),o=n.createLinearGradient(0,0,0,r),a=1/(e.length-1);return e.forEach((l,d)=>{const h=d*a;o.addColorStop(h,l)}),o}getPixelRatio(){return Math.max(1,window.devicePixelRatio||1)}renderBarWaveform(e,t,n,r){const o=e[0],a=e[1]||e[0],l=o.length,{width:d,height:h}=n.canvas,c=h/2,p=this.getPixelRatio(),u=t.barWidth?t.barWidth*p:1,f=t.barGap?t.barGap*p:t.barWidth?u/2:0,m=t.barRadius||0,k=d/(u+f)/l,g=m&&"roundRect"in n?"roundRect":"rect";n.beginPath();let y=0,b=0,S=0;for(let w=0;w<=l;w++){const v=Math.round(w*k);if(v>y){const M=Math.round(b*c*r),x=M+Math.round(S*c*r)||1;let L=c-M;t.barAlign==="top"?L=0:t.barAlign==="bottom"&&(L=h-x),n[g](y*(u+f),L,u,x,m),y=v,b=0,S=0}const E=Math.abs(o[w]||0),T=Math.abs(a[w]||0);E>b&&(b=E),T>S&&(S=T)}n.fill(),n.closePath()}renderLineWaveform(e,t,n,r){const o=a=>{const l=e[a]||e[0],d=l.length,{height:h}=n.canvas,c=h/2,p=n.canvas.width/d;n.moveTo(0,c);let u=0,f=0;for(let m=0;m<=d;m++){const k=Math.round(m*p);if(k>u){const y=c+(Math.round(f*c*r)||1)*(a===0?-1:1);n.lineTo(u,y),u=k,f=0}const g=Math.abs(l[m]||0);g>f&&(f=g)}n.lineTo(u,c)};n.beginPath(),o(0),o(1),n.fill(),n.closePath()}renderWaveform(e,t,n){if(n.fillStyle=this.convertColorValues(t.waveColor),t.renderFunction)return void t.renderFunction(e,n);let r=t.barHeight||1;if(t.normalize){const o=Array.from(e[0]).reduce((a,l)=>Math.max(a,Math.abs(l)),0);r=o?1/o:1}t.barWidth||t.barGap||t.barAlign?this.renderBarWaveform(e,t,n,r):this.renderLineWaveform(e,t,n,r)}renderSingleCanvas(e,t,n,r,o,a,l){const d=this.getPixelRatio(),h=document.createElement("canvas");h.width=Math.round(n*d),h.height=Math.round(r*d),h.style.width=`${n}px`,h.style.height=`${r}px`,h.style.left=`${Math.round(o)}px`,a.appendChild(h);const c=h.getContext("2d");if(this.renderWaveform(e,t,c),h.width>0&&h.height>0){const p=h.cloneNode(),u=p.getContext("2d");u.drawImage(h,0,0),u.globalCompositeOperation="source-in",u.fillStyle=this.convertColorValues(t.progressColor),u.fillRect(0,0,h.width,h.height),l.appendChild(p)}}renderMultiCanvas(e,t,n,r,o,a){const l=this.getPixelRatio(),{clientWidth:d}=this.scrollContainer,h=n/l;let c=Math.min(B.MAX_CANVAS_WIDTH,d,h),p={};if(c===0)return;if(t.barWidth||t.barGap){const g=t.barWidth||.5,y=g+(t.barGap||g/2);c%y!=0&&(c=Math.floor(c/y)*y)}const u=g=>{if(g<0||g>=f||p[g])return;p[g]=!0;const y=g*c,b=Math.min(h-y,c);if(b<=0)return;const S=e.map(w=>{const v=Math.floor(y/h*w.length),E=Math.floor((y+b)/h*w.length);return w.slice(v,E)});this.renderSingleCanvas(S,t,b,r,y,o,a)},f=Math.ceil(h/c);if(!this.isScrollable){for(let g=0;g<f;g++)u(g);return}const m=this.scrollContainer.scrollLeft/h,k=Math.floor(m*f);if(u(k-1),u(k),u(k+1),f>1){const g=this.on("scroll",()=>{const{scrollLeft:y}=this.scrollContainer,b=Math.floor(y/h*f);Object.keys(p).length>B.MAX_NODES&&(o.innerHTML="",a.innerHTML="",p={}),u(b-1),u(b),u(b+1)});this.unsubscribeOnScroll.push(g)}}renderChannel(e,t,n,r){var{overlay:o}=t,a=function(c,p){var u={};for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&p.indexOf(f)<0&&(u[f]=c[f]);if(c!=null&&typeof Object.getOwnPropertySymbols=="function"){var m=0;for(f=Object.getOwnPropertySymbols(c);m<f.length;m++)p.indexOf(f[m])<0&&Object.prototype.propertyIsEnumerable.call(c,f[m])&&(u[f[m]]=c[f[m]])}return u}(t,["overlay"]);const l=document.createElement("div"),d=this.getHeight(a.height,a.splitChannels);l.style.height=`${d}px`,o&&r>0&&(l.style.marginTop=`-${d}px`),this.canvasWrapper.style.minHeight=`${d}px`,this.canvasWrapper.appendChild(l);const h=l.cloneNode();this.progressWrapper.appendChild(h),this.renderMultiCanvas(e,a,n,d,l,h)}render(e){return C(this,void 0,void 0,function*(){var t;this.timeouts.forEach(d=>d()),this.timeouts=[],this.canvasWrapper.innerHTML="",this.progressWrapper.innerHTML="",this.options.width!=null&&(this.scrollContainer.style.width=typeof this.options.width=="number"?`${this.options.width}px`:this.options.width);const n=this.getPixelRatio(),r=this.scrollContainer.clientWidth,o=Math.ceil(e.duration*(this.options.minPxPerSec||0));this.isScrollable=o>r;const a=this.options.fillParent&&!this.isScrollable,l=(a?r:o)*n;if(this.wrapper.style.width=a?"100%":`${o}px`,this.scrollContainer.style.overflowX=this.isScrollable?"auto":"hidden",this.scrollContainer.classList.toggle("noScrollbar",!!this.options.hideScrollbar),this.cursor.style.backgroundColor=`${this.options.cursorColor||this.options.progressColor}`,this.cursor.style.width=`${this.options.cursorWidth}px`,this.audioData=e,this.emit("render"),this.options.splitChannels)for(let d=0;d<e.numberOfChannels;d++){const h=Object.assign(Object.assign({},this.options),(t=this.options.splitChannels)===null||t===void 0?void 0:t[d]);this.renderChannel([e.getChannelData(d)],h,l,d)}else{const d=[e.getChannelData(0)];e.numberOfChannels>1&&d.push(e.getChannelData(1)),this.renderChannel(d,this.options,l,0)}Promise.resolve().then(()=>this.emit("rendered"))})}reRender(){if(this.unsubscribeOnScroll.forEach(n=>n()),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:e}=this.scrollContainer,{right:t}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&e!==this.scrollContainer.scrollWidth){const{right:n}=this.progressWrapper.getBoundingClientRect();let r=n-t;r*=2,r=r<0?Math.floor(r):Math.ceil(r),r/=2,this.scrollContainer.scrollLeft+=r}}zoom(e){this.options.minPxPerSec=e,this.reRender()}scrollIntoView(e,t=!1){const{scrollLeft:n,scrollWidth:r,clientWidth:o}=this.scrollContainer,a=e*r,l=n,d=n+o,h=o/2;if(this.isDragging)a+30>d?this.scrollContainer.scrollLeft+=30:a-30<l&&(this.scrollContainer.scrollLeft-=30);else{(a<l||a>d)&&(this.scrollContainer.scrollLeft=a-(this.options.autoCenter?h:0));const c=a-n-h;t&&this.options.autoCenter&&c>0&&(this.scrollContainer.scrollLeft+=Math.min(c,10))}{const c=this.scrollContainer.scrollLeft,p=c/r,u=(c+o)/r;this.emit("scroll",p,u,c,c+o)}}renderProgress(e,t){if(isNaN(e))return;const n=100*e;this.canvasWrapper.style.clipPath=`polygon(${n}% 0, 100% 0, 100% 100%, ${n}% 100%)`,this.progressWrapper.style.width=`${n}%`,this.cursor.style.left=`${n}%`,this.cursor.style.transform=`translateX(-${Math.round(n)===100?this.options.cursorWidth:0}px)`,this.isScrollable&&this.options.autoScroll&&this.scrollIntoView(e,t)}exportImage(e,t,n){return C(this,void 0,void 0,function*(){const r=this.canvasWrapper.querySelectorAll("canvas");if(!r.length)throw new Error("No waveform data");if(n==="dataURL"){const o=Array.from(r).map(a=>a.toDataURL(e,t));return Promise.resolve(o)}return Promise.all(Array.from(r).map(o=>new Promise((a,l)=>{o.toBlob(d=>{d?a(d):l(new Error("Could not export image"))},e,t)})))})}}B.MAX_CANVAS_WIDTH=8e3,B.MAX_NODES=10;class G extends P{constructor(){super(...arguments),this.unsubscribe=()=>{}}start(){this.unsubscribe=this.on("tick",()=>{requestAnimationFrame(()=>{this.emit("tick")})}),this.emit("tick")}stop(){this.unsubscribe()}destroy(){this.unsubscribe()}}class z extends P{constructor(e=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playedDuration=0,this._muted=!1,this._playbackRate=1,this._duration=void 0,this.buffer=null,this.currentSrc="",this.paused=!0,this.crossOrigin=null,this.seeking=!1,this.autoplay=!1,this.addEventListener=this.on,this.removeEventListener=this.un,this.audioContext=e,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return C(this,void 0,void 0,function*(){})}get src(){return this.currentSrc}set src(e){if(this.currentSrc=e,this._duration=void 0,!e)return this.buffer=null,void this.emit("emptied");fetch(e).then(t=>{if(t.status>=400)throw new Error(`Failed to fetch ${e}: ${t.status} (${t.statusText})`);return t.arrayBuffer()}).then(t=>this.currentSrc!==e?null:this.audioContext.decodeAudioData(t)).then(t=>{this.currentSrc===e&&(this.buffer=t,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})}_play(){var e;if(!this.paused)return;this.paused=!1,(e=this.bufferNode)===null||e===void 0||e.disconnect(),this.bufferNode=this.audioContext.createBufferSource(),this.buffer&&(this.bufferNode.buffer=this.buffer),this.bufferNode.playbackRate.value=this._playbackRate,this.bufferNode.connect(this.gainNode);let t=this.playedDuration*this._playbackRate;t>=this.duration&&(t=0,this.playedDuration=0),this.bufferNode.start(this.audioContext.currentTime,t),this.playStartTime=this.audioContext.currentTime,this.bufferNode.onended=()=>{this.currentTime>=this.duration&&(this.pause(),this.emit("ended"))}}_pause(){var e;this.paused=!0,(e=this.bufferNode)===null||e===void 0||e.stop(),this.playedDuration+=this.audioContext.currentTime-this.playStartTime}play(){return C(this,void 0,void 0,function*(){this.paused&&(this._play(),this.emit("play"))})}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(e){var t,n;const r=e-this.currentTime;(t=this.bufferNode)===null||t===void 0||t.stop(this.audioContext.currentTime+r),(n=this.bufferNode)===null||n===void 0||n.addEventListener("ended",()=>{this.bufferNode=null,this.pause()},{once:!0})}setSinkId(e){return C(this,void 0,void 0,function*(){return this.audioContext.setSinkId(e)})}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e,this.bufferNode&&(this.bufferNode.playbackRate.value=e)}get currentTime(){return(this.paused?this.playedDuration:this.playedDuration+(this.audioContext.currentTime-this.playStartTime))*this._playbackRate}set currentTime(e){const t=!this.paused;t&&this._pause(),this.playedDuration=e/this._playbackRate,t&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var e,t;return(e=this._duration)!==null&&e!==void 0?e:((t=this.buffer)===null||t===void 0?void 0:t.duration)||0}set duration(e){this._duration=e}get volume(){return this.gainNode.gain.value}set volume(e){this.gainNode.gain.value=e,this.emit("volumechange")}get muted(){return this._muted}set muted(e){this._muted!==e&&(this._muted=e,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(e){return/^(audio|video)\//.test(e)}getGainNode(){return this.gainNode}getChannelData(){const e=[];if(!this.buffer)return e;const t=this.buffer.numberOfChannels;for(let n=0;n<t;n++)e.push(this.buffer.getChannelData(n));return e}}const X={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3};class N extends F{static create(e){return new N(e)}constructor(e){const t=e.media||(e.backend==="WebAudio"?new z:void 0);super({media:t,mediaControls:e.mediaControls,autoplay:e.autoplay,playbackRate:e.audioRate}),this.plugins=[],this.decodedData=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.options=Object.assign({},X,e),this.timer=new G;const n=t?void 0:this.getMediaElement();this.renderer=new B(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then(()=>{this.emit("init");const{peaks:o,duration:a}=this.options;(r||o&&a)&&this.load(r,o,a).catch(()=>null)})}updateProgress(e=this.getCurrentTime()){return this.renderer.renderProgress(e/this.getDuration(),this.isPlaying()),e}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",()=>{if(!this.isSeeking()){const e=this.updateProgress();this.emit("timeupdate",e),this.emit("audioprocess",e)}}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",()=>{const e=this.updateProgress();this.emit("timeupdate",e)}),this.onMediaEvent("play",()=>{this.emit("play"),this.timer.start()}),this.onMediaEvent("pause",()=>{this.emit("pause"),this.timer.stop()}),this.onMediaEvent("emptied",()=>{this.timer.stop()}),this.onMediaEvent("ended",()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish")}),this.onMediaEvent("seeking",()=>{this.emit("seeking",this.getCurrentTime())}),this.onMediaEvent("error",e=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error"))}))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",(e,t)=>{this.options.interact&&(this.seekTo(e),this.emit("interaction",e*this.getDuration()),this.emit("click",e,t))}),this.renderer.on("dblclick",(e,t)=>{this.emit("dblclick",e,t)}),this.renderer.on("scroll",(e,t,n,r)=>{const o=this.getDuration();this.emit("scroll",e*o,t*o,n,r)}),this.renderer.on("render",()=>{this.emit("redraw")}),this.renderer.on("rendered",()=>{this.emit("redrawcomplete")}),this.renderer.on("dragstart",e=>{this.emit("dragstart",e)}),this.renderer.on("dragend",e=>{this.emit("dragend",e)}));{let e;this.subscriptions.push(this.renderer.on("drag",t=>{if(!this.options.interact)return;let n;this.renderer.renderProgress(t),clearTimeout(e),this.isPlaying()?n=0:this.options.dragToSeek===!0?n=200:typeof this.options.dragToSeek=="object"&&this.options.dragToSeek!==void 0&&(n=this.options.dragToSeek.debounceTime),e=setTimeout(()=>{this.seekTo(t)},n),this.emit("interaction",t*this.getDuration()),this.emit("drag",t)}))}}initPlugins(){var e;!((e=this.options.plugins)===null||e===void 0)&&e.length&&this.options.plugins.forEach(t=>{this.registerPlugin(t)})}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach(e=>e()),this.mediaSubscriptions=[]}setOptions(e){this.options=Object.assign({},this.options,e),e.duration&&!e.peaks&&(this.decodedData=D.createBuffer(this.exportPeaks(),e.duration)),e.peaks&&e.duration&&(this.decodedData=D.createBuffer(e.peaks,e.duration)),this.renderer.setOptions(this.options),e.audioRate&&this.setPlaybackRate(e.audioRate),e.mediaControls!=null&&(this.getMediaElement().controls=e.mediaControls)}registerPlugin(e){return e._init(this),this.plugins.push(e),this.subscriptions.push(e.once("destroy",()=>{this.plugins=this.plugins.filter(t=>t!==e)})),e}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(e){return this.renderer.setScroll(e)}setScrollTime(e){const t=e/this.getDuration();this.renderer.setScrollPercentage(t)}getActivePlugins(){return this.plugins}loadAudio(e,t,n,r){return C(this,void 0,void 0,function*(){var o;if(this.emit("load",e),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,!t&&!n){const l=this.options.fetchParams||{};window.AbortController&&!l.signal&&(this.abortController=new AbortController,l.signal=(o=this.abortController)===null||o===void 0?void 0:o.signal);const d=c=>this.emit("loading",c);t=yield q.fetchBlob(e,d,l);const h=this.options.blobMimeType;h&&(t=new Blob([t],{type:h}))}this.setSrc(e,t);const a=yield new Promise(l=>{const d=r||this.getDuration();d?l(d):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",()=>l(this.getDuration()),{once:!0}))});if(!e&&!t){const l=this.getMediaElement();l instanceof z&&(l.duration=a)}if(n)this.decodedData=D.createBuffer(n,a||0);else if(t){const l=yield t.arrayBuffer();this.decodedData=yield D.decode(l,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())})}load(e,t,n){return C(this,void 0,void 0,function*(){try{return yield this.loadAudio(e,void 0,t,n)}catch(r){throw this.emit("error",r),r}})}loadBlob(e,t,n){return C(this,void 0,void 0,function*(){try{return yield this.loadAudio("",e,t,n)}catch(r){throw this.emit("error",r),r}})}zoom(e){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(e),this.emit("zoom",e)}getDecodedData(){return this.decodedData}exportPeaks({channels:e=2,maxLength:t=8e3,precision:n=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const r=Math.min(e,this.decodedData.numberOfChannels),o=[];for(let a=0;a<r;a++){const l=this.decodedData.getChannelData(a),d=[],h=l.length/t;for(let c=0;c<t;c++){const p=l.slice(Math.floor(c*h),Math.ceil((c+1)*h));let u=0;for(let f=0;f<p.length;f++){const m=p[f];Math.abs(m)>Math.abs(u)&&(u=m)}d.push(Math.round(u*n)/n)}o.push(d)}return o}getDuration(){let e=super.getDuration()||0;return e!==0&&e!==1/0||!this.decodedData||(e=this.decodedData.duration),e}toggleInteraction(e){this.options.interact=e}setTime(e){super.setTime(e),this.updateProgress(e),this.emit("timeupdate",e)}seekTo(e){const t=this.getDuration()*e;this.setTime(t)}playPause(){return C(this,void 0,void 0,function*(){return this.isPlaying()?this.pause():this.play()})}stop(){this.pause(),this.setTime(0)}skip(e){this.setTime(this.getCurrentTime()+e)}empty(){this.load("",[[0]],.001)}setMediaElement(e){this.unsubscribePlayerEvents(),super.setMediaElement(e),this.initPlayerEvents()}exportImage(){return C(this,arguments,void 0,function*(e="image/png",t=1,n="dataURL"){return this.renderer.exportImage(e,t,n)})}destroy(){var e;this.emit("destroy"),(e=this.abortController)===null||e===void 0||e.abort(),this.plugins.forEach(t=>t.destroy()),this.subscriptions.forEach(t=>t()),this.unsubscribePlayerEvents(),this.timer.destroy(),this.renderer.destroy(),super.destroy()}}N.BasePlugin=class extends P{constructor(i){super(),this.subscriptions=[],this.options=i}onInit(){}_init(i){this.wavesurfer=i,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach(i=>i())}},N.dom=j;var U=function(){function i(){this.buttonColor="#ffffff",this.buttonHoverColor="#ff00ff",this.waveColor="#ff4e00",this.progressColor="#dd5e98",this.cursorColor="#ddd5e9",this.backgroundColor="#ffffff",this.textColor="lightgrey"}return i}(),Y=function(){function i(){this.playBtn=!0,this.nextChapterBtn=!0,this.prevChapterBtn=!0,this.timer=!0}return i}(),Z=function(){function i(){this.showCover=!0,this.showTitle=!0,this.showDescription=!0,this.defaultVolume=1,this.autoPlaylist=!1,this.dragToSeek=!0,this.sampleRate=8e3,this.height=20,this.cursorWidth=2,this.barWidth=2,this.barGap=2,this.barRadius=2}return i}();function J(i){var e=i instanceof HTMLElement?i:document.getElementById(i);if(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height}}return{width:0,height:0}}function K(i){var e=Math.floor(i/3600),t=Math.floor(i%3600/60),n=Math.floor(i%60),r=e>0?"".concat(e.toString().padStart(2,"0"),":"):"",o="".concat(t.toString().padStart(2,"0"),":"),a=n.toString().padStart(2,"0");return"".concat(r).concat(o).concat(a)}var Q=` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"><path d="m53.213 10.788c-11.715-11.717-30.711-11.717-42.426 0-11.716 11.715-11.716 30.71 0 42.425 11.715 11.715 30.711 11.715 42.426 0 11.716-11.715 11.716-30.711 0-42.425m-28.213 41.224v-40.023l20 20.011-20 20.012" fill="currentColor"/></svg> `,ee=` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"><path d="m32 2c-16.568 0-30 13.432-30 30 0 16.569 13.432 30 30 30s30-13.431 30-30c0-16.568-13.432-30-30-30m-4 48h-8v-36h8v36m16 0h-8v-36h8v36" fill="currentColor"/></svg> `,te=` <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" id="volume-up"> <path fill="currentColor" d="M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z"></path> </svg> `,ne=` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"> <path d="M 52 46 L 46.781 46 L 46.781 32 L 29.391 46 L 29.391 32 L 12 46 L 12 18 L 29.392 32 L 29.392 18 L 46.782 32 L 46.782 18 L 52 18 L 52 46 Z" transform="matrix(0.9999999999999999, 0, 0, 0.9999999999999999, 0, -8.881784197001252e-16)"/> </svg> `,ie=` <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"> <path d="M 52 46 L 46.781 46 L 46.781 32 L 29.391 46 L 29.391 32 L 12 46 L 12 18 L 29.392 32 L 29.392 18 L 46.782 32 L 46.782 18 L 52 18 L 52 46 Z" style="transform-box: fill-box; transform-origin: 50% 50%;" transform="matrix(-1, 0, 0, -1, 0, 0.000001)"></path> </svg> `;function re(i,e){e===void 0&&(e="");var t="";switch(i){case"play":t=Q;break;case"pause":t=ee;break;case"volume":t=te;break;case"next":t=ne;break;case"prev":t=ie;break;default:t=""}return t.replaceAll("currentColor",e)}const se={name:"Loader-Component",props:{size:{type:String,required:!1,default:"100px"},color:{type:String,required:!1,default:"#FF156D"},progress:{type:Number,required:!1,default:0},className:{type:String,default:"absolute-center"}}},H=(i,e)=>{const t=i.__vccOpts||i;for(const[n,r]of e)t[n]=r;return t},oe={key:0,class:"absolute-center z-20"},ae={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200"},le={id:"a10",cx:".66",fx:".66",cy:".3125",fy:".3125",gradientTransform:"scale(1.5)"},ce=["stop-color"],he=["stop-color"],de=["stop-color"],ue=["stop-color"],pe=["stop-color"],fe=["stroke"];function me(i,e,t,n,r,o){return s.openBlock(),s.createElementBlock("div",{style:s.normalizeStyle({width:`${t.size}`,height:`${t.size}`}),class:s.normalizeClass(["z-10",t.className])},[t.progress?(s.openBlock(),s.createElementBlock("div",oe,s.toDisplayString(t.progress)+"%",1)):s.createCommentVNode("",!0),(s.openBlock(),s.createElementBlock("svg",ae,[s.createElementVNode("radialGradient",le,[s.createElementVNode("stop",{offset:"0","stop-color":t.color},null,8,ce),s.createElementVNode("stop",{offset:".3","stop-color":t.color,"stop-opacity":".9"},null,8,he),s.createElementVNode("stop",{offset:".6","stop-color":t.color,"stop-opacity":".6"},null,8,de),s.createElementVNode("stop",{offset:".8","stop-color":t.color,"stop-opacity":".3"},null,8,ue),s.createElementVNode("stop",{offset:"1","stop-color":t.color,"stop-opacity":"0"},null,8,pe)]),e[0]||(e[0]=s.createElementVNode("circle",{"transform-origin":"center",fill:"none",stroke:"url(#a10)","stroke-width":"16","stroke-linecap":"round","stroke-dasharray":"200 1000","stroke-dashoffset":"0",cx:"100",cy:"100",r:"70"},[s.createElementVNode("animateTransform",{type:"rotate",attributeName:"transform",calcMode:"spline",dur:"2",values:"360;0",keyTimes:"0;1",keySplines:"0 0 1 1",repeatCount:"indefinite"})],-1)),s.createElementVNode("circle",{"transform-origin":"center",fill:"none",opacity:".2",stroke:t.color,"stroke-width":"16","stroke-linecap":"round",cx:"100",cy:"100",r:"70"},null,8,fe)]))],6)}const ge=H(se,[["render",me]]);var R=s.defineComponent({components:{Loader:ge},props:{playlist:{type:Array,required:!0},colors:{type:Object,default:function(){return new U}},buttons:{type:Object,default:function(){return new Y}},options:{type:Object,default:function(){return new Z}}},setup:function(){return{formatTime:K,getIcon:re}},data:function(){return{currentIndex:0,containerElem:null,parentContainer:null,wavesurfer:null,ready:!1,currentTime:0,duration:0,loadingProgress:0,volume:0,redrawComplete:!1,paused:void 0,covers:new Array,parentRect:{width:0,height:0}}},computed:{isPlaylist:function(){return this.playlist.length>1},compact:function(){return this.parentRect.width<=200},maxTitleWidth:function(){var i=this.parentRect.width-46-8-58-(this.options.showCover&&!this.compact?150:0)-10;return this.compact?this.parentRect.width-4:i},current:function(){var i=this,e=this.playlist[this.currentIndex].cover;if(!this.covers.includes(e)){var t=new Image;t.onload=function(){i.covers.push(e)},t.src=e}return this.playlist[this.currentIndex]}},methods:{next:function(){var i=this.currentIndex+1;i>this.playlist.length-1&&(i=0),this.currentIndex=i,this.ready=!1,this.load()},prev:function(){var i=this.currentIndex-1;i<0&&(i=this.playlist.length),this.currentIndex=i,this.ready=!1,this.load()},load:function(){var i=this;this.wavesurfer&&this.wavesurfer.destroy(),this.parentRect=J(this.parentContainer),this.paused=void 0,this.redrawComplete=!1,this.currentTime=0,this.duration=0,this.wavesurfer=N.create({container:this.containerElem,waveColor:this.colors.waveColor,progressColor:this.colors.progressColor,cursorColor:this.colors.cursorColor,cursorWidth:this.options.cursorWidth,barWidth:this.options.barWidth,barRadius:this.options.barRadius,barGap:this.options.barGap,dragToSeek:this.options.dragToSeek,backend:"WebAudio",mediaControls:!0,height:this.options.height,normalize:!0}),this.volume=this.options.defaultVolume,this.wavesurfer.setVolume(this.volume),this.wavesurfer.on("audioprocess",function(){i.wavesurfer&&(i.currentTime=i.wavesurfer.getCurrentTime())}),this.wavesurfer.once("decode",function(e){i.duration=e,i.currentTime=0,i.ready=!0}),this.wavesurfer.on("loading",function(e){i.loadingProgress=e}),this.wavesurfer.once("redrawcomplete",function(){i.redrawComplete=!0}),this.wavesurfer.once("redraw",function(){i.redrawComplete=!1}),this.wavesurfer.load(this.current.url)},play:function(){this.wavesurfer&&(this.paused||this.paused===void 0?(this.wavesurfer.play(),this.paused=!1):(this.wavesurfer.pause(),this.paused=!0))}},unmounted:function(){this.wavesurfer&&(this.wavesurfer.isPlaying()&&this.wavesurfer.stop(),this.wavesurfer.destroy())},mounted:function(){this.containerElem=this.$refs.container,this.parentContainer=this.$refs["parent-container"],this.load()}}),I=function(){s.useCssVars(function(i){return{bf7772c8:i.colors.buttonColor,"2ecc5fee":i.colors.buttonHoverColor}})},$=R.setup;R.setup=$?function(i,e){return I(),$(i,e)}:I;const ve=["src","alt"],ye={key:1,class:"w-full flex justify-center"},be={class:"p-1 flex flex-col w-full"},Ce={class:"flex items-center gap-x-2"},we=["innerHTML"],ke={key:1},Ee=["innerHTML"],Se=["innerHTML"],Te=["innerHTML"],Me={key:0,class:"flex gap-x-2 items-end"},xe=["innerHTML"],Le=["innerHTML"],Be={ref:"container",class:"w-full mt-1"},Ne={class:"flex flex-col gap-x-2 mt-1 pt-1"};function Pe(i,e,t,n,r,o){const a=s.resolveComponent("Loader");return s.openBlock(),s.createElementBlock("div",{class:"full-size relative",ref:"parent-container",style:s.normalizeStyle(`background-color:${i.colors.backgroundColor}`)},[i.ready?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(a,{key:0,size:"100px",color:i.colors.progressColor,progress:i.loadingProgress},null,8,["color","progress"])),s.createElementVNode("div",{class:s.normalizeClass(["flex full-size",{invisible:!i.ready,"flex-col":i.compact}])},[i.options.showCover?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass([{"w-[150px]":!i.compact,"w-full":i.compact},"p-1"])},[i.covers.includes(i.current.cover)?(s.openBlock(),s.createElementBlock("img",{key:0,class:"w-full border",src:i.current.cover,alt:i.current.title},null,8,ve)):(s.openBlock(),s.createElementBlock("div",ye,[s.createVNode(a,{size:"50px","class-name":"relative opacity-30",color:"lightgary"})]))],2)):s.createCommentVNode("",!0),s.createElementVNode("div",be,[s.createElementVNode("div",{class:s.normalizeClass(["flex py-1 items-center w-full",{"flex-col":i.compact,"justify-center":i.compact,"justify-between":!i.compact}])},[s.createElementVNode("div",{class:s.normalizeClass(["flex w-full",{"flex-col":i.compact,"items-center":i.compact,"items-start":!i.compact}])},[s.createElementVNode("div",Ce,[i.compact&&i.buttons.prevChapterBtn?(s.openBlock(),s.createElementBlock("div",{key:0,class:"btn w-[35px] h-[35px]",onClick:e[0]||(e[0]=(...l)=>i.prev&&i.prev(...l))},[s.createElementVNode("span",{innerHTML:i.getIcon("prev")},null,8,we)])):s.createCommentVNode("",!0),i.buttons.playBtn?(s.openBlock(),s.createElementBlock("div",ke,[i.paused===!1?(s.openBlock(),s.createElementBlock("div",{key:0,class:"btn w-[46px] h-[46px]",onClick:e[1]||(e[1]=()=>i.play())},[s.createElementVNode("span",{innerHTML:i.getIcon("pause")},null,8,Ee)])):s.createCommentVNode("",!0),i.paused===void 0||i.paused===!0?(s.openBlock(),s.createElementBlock("div",{key:1,class:"btn w-[46px] h-[46px]",onClick:e[2]||(e[2]=()=>i.play())},[s.createElementVNode("span",{innerHTML:i.getIcon("play")},null,8,Se)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),i.compact&&i.buttons.nextChapterBtn?(s.openBlock(),s.createElementBlock("div",{key:2,class:"btn w-[35px] h-[35px]",onClick:e[3]||(e[3]=(...l)=>i.next&&i.next(...l))},[s.createElementVNode("span",{innerHTML:i.getIcon("next")},null,8,Te)])):s.createCommentVNode("",!0)]),i.options.showTitle?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["flex flex-col ml-2 gap-x-0",{"text-center":i.compact,"items-center":i.compact}]),style:s.normalizeStyle({color:i.colors.textColor})},[s.createElementVNode("div",{class:"font-semibold truncate text-nowrap",style:s.normalizeStyle({width:`${i.maxTitleWidth}px`})},s.toDisplayString(i.current.title),5),i.current.artist?(s.openBlock(),s.createElementBlock("div",{key:0,class:"text-sm truncate text-nowrap",style:s.normalizeStyle({width:`${i.maxTitleWidth}px`})},s.toDisplayString(i.current.artist),5)):s.createCommentVNode("",!0)],6)):s.createCommentVNode("",!0)],2),i.isPlaylist&&!i.compact?(s.openBlock(),s.createElementBlock("div",Me,[i.buttons.prevChapterBtn?(s.openBlock(),s.createElementBlock("div",{key:0,class:"btn w-[25px] h-[25px]",onClick:e[4]||(e[4]=(...l)=>i.prev&&i.prev(...l))},[s.createElementVNode("span",{innerHTML:i.getIcon("prev")},null,8,xe)])):s.createCommentVNode("",!0),i.buttons.nextChapterBtn?(s.openBlock(),s.createElementBlock("div",{key:1,class:"btn w-[25px] h-[25px]",onClick:e[5]||(e[5]=(...l)=>i.next&&i.next(...l))},[s.createElementVNode("span",{innerHTML:i.getIcon("next")},null,8,Le)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)],2),s.createElementVNode("div",Be,null,512),s.createElementVNode("div",Ne,[i.ready&&i.buttons.timer?(s.openBlock(),s.createElementBlock("div",{key:0,class:"text-sm",style:s.normalizeStyle(`color:${i.colors.textColor}`)},s.toDisplayString(i.formatTime(i.currentTime))+" / "+s.toDisplayString(i.formatTime(i.duration)),5)):s.createCommentVNode("",!0),i.options.showDescription&&i.current.description?(s.openBlock(),s.createElementBlock("div",{key:1,class:"text-sm py-2",style:s.normalizeStyle(`color:${i.colors.textColor}`)},s.toDisplayString(i.current.description),5)):s.createCommentVNode("",!0)])])],2)],4)}const _=H(R,[["render",Pe],["__scopeId","data-v-0cac8886"]]);var De=function(i){i.component("b-upload-files-modal",_)};const Re={install:De};exports.Player=_;exports.default=Re;