PageSourceSearch

https://gingerate.ai/assets/vendor-wavesurfer-DuHh7yO6.js

js gingerate.ai collected 2026-10-05 12:15:57 UTC 40,710 bytes, 74 lines download raw bytes

1var lt=Object.defineProperty;var c=(u,t)=>lt(u,"name",{value:t,configurable:!0});function R(u,t,e,i){return new(e||(e=Promise))((function(s,n){function r(o){try{l(i.next(o))}catch(h){n(h)}}c(r,"o");function a(o){try{l(i.throw(o))}catch(h){n(h)}}c(a,"a");function l(o){var h;o.done?s(o.value):(h=o.value,h instanceof e?h:new e((function(m){m(h)}))).then(r,a)}c(l,"l"),l((i=i.apply(u,t||[])).next())}))}c(R,"t");const V=class V{constructor(){this.listeners={}}on(t,e,i){if(this.listeners[t]||(this.listeners[t]=new Set),i==null?void 0:i.once){const s=c((...n)=>{this.un(t,s),e(...n)},"i");return this.listeners[t].add(s),()=>this.un(t,s)}return this.listeners[t].add(e),()=>this.un(t,e)}un(t,e){var i;(i=this.listeners[t])===null||i===void 0||i.delete(e)}once(t,e){return this.on(t,e,{once:!0})}unAll(){this.listeners={}}emit(t,...e){this.listeners[t]&&this.listeners[t].forEach((i=>i(...e)))}};c(V,"e");let N=V;const B={decode:c(function(u,t){return R(this,void 0,void 0,(function*(){const e=new AudioContext({sampleRate:t});try{return yield e.decodeAudioData(u)}finally{e.close()}}))},"decode"),createBuffer:c(function(u,t){if(!u||u.length===0)throw new Error("channelData must be a non-empty array");if(t<=0)throw new Error("duration must be greater than 0");if(typeof u[0]=="number"&&(u=[u]),!u[0]||u[0].length===0)throw new Error("channelData must contain non-empty channel arrays");(function(i){const s=i[0];if(s.some((n=>n>1||n<-1))){const n=s.length;let r=0;for(let a=0;a<n;a++){const l=Math.abs(s[a]);l>r&&(r=l)}for(const a of i)for(let l=0;l<n;l++)a[l]/=r}})(u);const e=u.map((i=>i instanceof Float32Array?i:Float32Array.from(i)));return{duration:t,length:e[0].length,sampleRate:e[0].length/t,numberOfChannels:e.length,getChannelData:c(i=>{const s=e[i];if(!s)throw new Error(`Channel ${i} not found`);return s},"getChannelData"),copyFromChannel:AudioBuffer.prototype.copyFromChannel,copyToChannel:AudioBuffer.prototype.copyToChannel}},"createBuffer")};function st(u,t){const e=t.xmlns?document.createElementNS(t.xmlns,u):document.createElement(u);for(const[i,s]of Object.entries(t))if(i==="children"&&s)for(const[n,r]of Object.entries(s))r instanceof Node?e.appendChild(r):typeof r=="string"?e.appendChild(document.createTextNode(r)):e.appendChild(st(n,r));else i==="style"?Object.assign(e.style,s):i==="textContent"?e.textContent=s:e.setAttribute(i,s.toString());return e}c(st,"n");function Q(u,t,e){const i=st(u,t||{});return e==null||e.appendChild(i),i}c(Q,"s");var ht=Object.freeze({__proto__:null,createElement:Q,default:Q});const ut={fetchBlob:c(function(u,t,e){return R(this,void 0,void 0,(function*(){const i=yield fetch(u,e);if(i.status>=400)throw new Error(`Failed to fetch ${u}: ${i.status} (${i.statusText})`);return(function(s,n){R(this,void 0,void 0,(function*(){if(!s.body||!s.headers)return;const r=s.body.getReader(),a=Number(s.headers.get("Content-Length"))||0;let l=0;const o=c(h=>{l+=(h==null?void 0:h.length)||0;const m=Math.round(l/a*100);n(m)},"r");try{for(;;){const h=yield r.read();if(h.done)break;o(h.value)}}catch(h){console.warn("Progress tracking error:",h)}}))})(i.clone(),t),i.blob()}))},"fetchBlob")};function S(u){let t=u;const e=new Set;return{get value(){return t},set(i){Object.is(t,i)||(t=i,e.forEach((s=>s(t))))},update(i){this.set(i(t))},subscribe:c(i=>(e.add(i),()=>e.delete(i)),"subscribe")}}c(S,"a");function _(u,t){const e=S(u());return t.forEach((i=>i.subscribe((()=>{const s=u();Object.is(e.value,s)||e.set(s)})))),{get value(){return e.value},subscribe:c(i=>e.subscribe(i),"subscribe")}}c(_,"l");function H(u,t){let e;const i=c(()=>{e&&(e(),e=void 0),e=u()},"n"),s=t.map((n=>n.subscribe(i)));return i(),()=>{e&&(e(),e=void 0),s.forEach((n=>n()))}}c(H,"h");const q=class q extends N{get isPlayingSignal(){return this._isPlaying}get currentTimeSignal(){return this._currentTime}get durationSignal(){return this._duration}get volumeSignal(){return this._volume}get mutedSignal(){return this._muted}get playbackRateSignal(){return this._playbackRate}get seekingSignal(){return this._seeking}constructor(t){super(),this.isExternalMedia=!1,this.reactiveMediaEventCleanups=[],t.media?(this.media=t.media,this.isExternalMedia=!0):this.media=document.createElement("audio"),this._isPlaying=S(!1),this._currentTime=S(0),this._duration=S(0),this._volume=S(this.media.volume),this._muted=S(this.media.muted),this._playbackRate=S(this.media.playbackRate||1),this._seeking=S(!1),this.setupReactiveMediaEvents(),t.mediaControl
1s&&(this.media.controls=!0),t.autoplay&&(this.media.autoplay=!0),t.playbackRate!=null&&this.onMediaEvent("canplay",(()=>{t.playbackRate!=null&&(this.media.playbackRate=t.playbackRate)}),{once:!0})}setupReactiveMediaEvents(){this.reactiveMediaEventCleanups.push(this.onMediaEvent("play",(()=>{this._isPlaying.set(!0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("pause",(()=>{this._isPlaying.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ended",(()=>{this._isPlaying.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("timeupdate",(()=>{this._currentTime.set(this.media.currentTime)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("durationchange",(()=>{this._duration.set(this.media.duration||0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("loadedmetadata",(()=>{this._duration.set(this.media.duration||0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeking",(()=>{this._seeking.set(!0)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("seeked",(()=>{this._seeking.set(!1)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("volumechange",(()=>{this._volume.set(this.media.volume),this._muted.set(this.media.muted)}))),this.reactiveMediaEventCleanups.push(this.onMediaEvent("ratechange",(()=>{this._playbackRate.set(this.media.playbackRate)})))}onMediaEvent(t,e,i){return this.media.addEventListener(t,e,i),()=>this.media.removeEventListener(t,e,i)}getSrc(){return this.media.currentSrc||this.media.src||""}revokeSrc(){const t=this.getSrc();t.startsWith("blob:")&&URL.revokeObjectURL(t)}canPlayType(t){return this.media.canPlayType(t)!==""}setSrc(t,e){const i=this.getSrc();if(t&&i===t)return;this.revokeSrc();const s=e instanceof Blob&&(this.canPlayType(e.type)||!t)?URL.createObjectURL(e):t;if(i&&this.media.removeAttribute("src"),s||t)try{this.media.src=s}catch{this.media.src=t}}destroy(){this.reactiveMediaEventCleanups.forEach((t=>t())),this.reactiveMediaEventCleanups=[],this.isExternalMedia||(this.media.pause(),this.revokeSrc(),this.media.removeAttribute("src"),this.media.load(),this.media.remove())}setMediaElement(t){this.reactiveMediaEventCleanups.forEach((e=>e())),this.reactiveMediaEventCleanups=[],this.media=t,this.setupReactiveMediaEvents()}play(){return R(this,void 0,void 0,(function*(){try{return yield this.media.play()}catch(t){if(t instanceof DOMException&&t.name==="AbortError")return;throw t}}))}pause(){this.media.pause()}isPlaying(){return!this.media.paused&&!this.media.ended}setTime(t){this.media.currentTime=Math.max(0,Math.min(t,this.getDuration()))}getDuration(){return this.media.duration}getCurrentTime(){return this.media.currentTime}getVolume(){return this.media.volume}setVolume(t){this.media.volume=t}getMuted(){return this.media.muted}setMuted(t){this.media.muted=t}getPlaybackRate(){return this.media.playbackRate}isSeeking(){return this.media.seeking}setPlaybackRate(t,e){e!=null&&(this.media.preservesPitch=e),this.media.playbackRate=t}getMediaElement(){return this.media}setSinkId(t){return this.media.setSinkId(t)}};c(q,"c");let j=q;function ct({maxTop:u,maxBottom:t,halfHeight:e,vScale:i,barMinHeight:s=0,barAlign:n}){let r=Math.round(u*e*i),a=r+Math.round(t*e*i)||1;return a<s&&(a=s,n||(r=a/2)),{topHeight:r,totalHeight:a}}c(ct,"u");function dt({barAlign:u,halfHeight:t,topHeight:e,totalHeight:i,canvasHeight:s}){return u==="top"?0:u==="bottom"?s-i:t-e}c(dt,"d");function tt(u,t,e){const i=t-u.left,s=e-u.top;return[i/u.width,s/u.height]}c(tt,"p");function nt(u){return!!(u.barWidth||u.barGap||u.barAlign)}c(nt,"m");function et(u,t){if(!nt(t))return u;const e=t.barWidth||.5,i=e+(t.barGap||e/2);return i===0?u:Math.floor(u/i)*i}c(et,"g");function it({scrollLeft:u,totalWidth:t,numCanvases:e}){if(t===0)return[0];const i=u/t,s=Math.floor(i*e);return[s-1,s,s+1]}c(it,"v");function rt(u){const t=u._cleanup;typeof t=="function"&&t()}c(rt,"f");function pt(u){const t=S({scrollLeft:u.scrollLeft,scrollWidth:u.scrollWidth,clientWidth:u.clientWidth}),e=_((()=>(function(n){const{scrollLeft:r,scrollWidth:a,clientWidth:l}=n;if(a===0)return{startX:0,endX:1};const o=r/a,h=(r+l)/a;return{startX:Math.max(0,Math.min(1,o)),endX:Math.max(0,Math.min(1,h))}})(t.value)),[t]),i=_((()=>(function(n){return{left:n.scrollLeft,right:n.scrollLeft+n.clientWidth}})(t.value)),[t]),s=c(()=>{t.set({scrollLeft:u.scrollLeft,scrollWidth:u.scrollWidth,clientWidth:u.clientWidth}
1)},"s");return u.addEventListener("scroll",s,{passive:!0}),{scrollData:t,percentages:e,bounds:i,cleanup:c(()=>{u.removeEventListener("scroll",s),rt(t)},"cleanup")}}c(pt,"b");const G=class G extends N{constructor(t,e){super(),this.timeouts=[],this.isScrollable=!1,this.audioData=null,this.resizeObserver=null,this.lastContainerWidth=0,this.isDragging=!1,this.subscriptions=[],this.unsubscribeOnScroll=[],this.dragStream=null,this.scrollStream=null,this.subscriptions=[],this.options=t;const i=this.parentFromOptionsContainer(t.container);this.parent=i;const[s,n]=this.initHtml();i.appendChild(s),this.container=s,this.scrollContainer=n.querySelector(".scroll"),this.wrapper=n.querySelector(".wrapper"),this.canvasWrapper=n.querySelector(".canvases"),this.progressWrapper=n.querySelector(".progress"),this.cursor=n.querySelector(".cursor"),e&&n.appendChild(e),this.initEvents()}parentFromOptionsContainer(t){let e;if(typeof t=="string"?e=document.querySelector(t):t instanceof HTMLElement&&(e=t),!e)throw new Error("Container not found");return e}initEvents(){this.wrapper.addEventListener("click",(e=>{const i=this.wrapper.getBoundingClientRect(),[s,n]=tt(i,e.clientX,e.clientY);this.emit("click",s,n)})),this.wrapper.addEventListener("dblclick",(e=>{const i=this.wrapper.getBoundingClientRect(),[s,n]=tt(i,e.clientX,e.clientY);this.emit("dblclick",s,n)})),this.options.dragToSeek!==!0&&typeof this.options.dragToSeek!="object"||this.initDrag(),this.scrollStream=pt(this.scrollContainer);const t=H((()=>{const{startX:e,endX:i}=this.scrollStream.percentages.value,{left:s,right:n}=this.scrollStream.bounds.value;this.emit("scroll",e,i,s,n)}),[this.scrollStream.percentages,this.scrollStream.bounds]);if(this.subscriptions.push(t),typeof ResizeObserver=="function"){const e=this.createDelay(100);this.resizeObserver=new ResizeObserver((()=>{e().then((()=>this.onContainerResize())).catch((()=>{}))})),this.resizeObserver.observe(this.scrollContainer)}}onContainerResize(){const t=this.parent.clientWidth;t===this.lastContainerWidth&&this.options.height!=="auto"||(this.lastContainerWidth=t,this.reRender(),this.emit("resize"))}initDrag(){if(this.dragStream)return;this.dragStream=(function(e,i={}){const{threshold:s=3,mouseButton:n=0,touchDelay:r=100}=i,a=S(null),l=new Map,o=matchMedia("(pointer: coarse)").matches;let h=c(()=>{},"h");const m=c(p=>{if(p.button!==n||(l.set(p.pointerId,p),l.size>1))return;let g=p.clientX,d=p.clientY,f=!1;const b=Date.now(),P=e.getBoundingClientRect(),{left:w,top:x}=P,M=c(y=>{if(y.defaultPrevented||l.size>1||o&&Date.now()-b<r)return;const T=y.clientX,W=y.clientY,L=T-g,O=W-d;(f||Math.abs(L)>s||Math.abs(O)>s)&&(y.preventDefault(),y.stopPropagation(),f||(a.set({type:"start",x:g-w,y:d-x}),f=!0),a.set({type:"move",x:T-w,y:W-x,deltaX:L,deltaY:O}),g=T,d=W)},"v"),E=c(y=>{if(l.delete(y.pointerId),f){const T=y.clientX,W=y.clientY;a.set({type:"end",x:T-w,y:W-x})}h()},"f"),C=c(y=>{l.delete(y.pointerId),y.relatedTarget&&y.relatedTarget!==document.documentElement||E(y)},"b"),k=c(y=>{f&&(y.stopPropagation(),y.preventDefault())},"y"),D=c(y=>{y.defaultPrevented||l.size>1||f&&y.preventDefault()},"C");document.addEventListener("pointermove",M),document.addEventListener("pointerup",E),document.addEventListener("pointerout",C),document.addEventListener("pointercancel",C),document.addEventListener("touchmove",D,{passive:!1}),document.addEventListener("click",k,{capture:!0}),h=c(()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",E),document.removeEventListener("pointerout",C),document.removeEventListener("pointercancel",C),document.removeEventListener("touchmove",D),setTimeout((()=>{document.removeEventListener("click",k,{capture:!0})}),10)},"h")},"c");return e.addEventListener("pointerdown",m),{signal:a,cleanup:c(()=>{h(),e.removeEventListener("pointerdown",m),l.clear(),rt(a)},"cleanup")}})(this.wrapper);const t=H((()=>{const e=this.dragStream.signal.value;if(!e)return;const i=this.wrapper.getBoundingClientRect().width,s=(n=e.x/i)<0?0:n>1?1:n;var n;e.type==="start"?(this.isDragging=!0,this.emit("dragstart",s)):e.type==="move"?this.emit
1("drag",s):e.type==="end"&&(this.isDragging=!1,this.emit("dragend",s))}),[this.dragStream.signal]);this.subscriptions.push(t)}initHtml(){const t=document.createElement("div"),e=t.attachShadow({mode:"open"}),i=this.options.cspNonce&&typeof this.options.cspNonce=="string"?this.options.cspNonce.replace(/"/g,""):"";return e.innerHTML=`
2      <style${i?` nonce="${i}"`:""}>
3        :host {
4          user-select: none;
5          min-width: 1px;
6        }
7        :host audio {
8          display: block;
9          width: 100%;
10        }
11        :host .scroll {
12          overflow-x: auto;
13          overflow-y: hidden;
14          width: 100%;
15          position: relative;
16        }
17        :host .noScrollbar {
18          scrollbar-color: transparent;
19          scrollbar-width: none;
20        }
21        :host .noScrollbar::-webkit-scrollbar {
22          display: none;
23          -webkit-appearance: none;
24        }
25        :host .wrapper {
26          position: relative;
27          overflow: visible;
28          z-index: 2;
29        }
30        :host .canvases {
31          min-height: ${this.getHeight(this.options.height,this.options.splitChannels)}px;
32          pointer-events: none;
33        }
34        :host .canvases > div {
35          position: relative;
36        }
37        :host canvas {
38          display: block;
39          position: absolute;
40          top: 0;
41          image-rendering: pixelated;
42        }
43        :host .progress {
44          pointer-events: none;
45          position: absolute;
46          z-index: 2;
47          top: 0;
48          left: 0;
49          width: 0;
50          height: 100%;
51          overflow: hidden;
52        }
53        :host .progress > div {
54          position: relative;
55        }
56        :host .cursor {
57          pointer-events: none;
58          position: absolute;
59          z-index: 5;
60          top: 0;
61          left: 0;
62          height: 100%;
63          border-radius: 2px;
64        }
65      </style>
66
67      <div class="scroll" part="scroll">
68        <div class="wrapper" part="wrapper">
69          <div class="canvases" part="canvases"></div>
70          <div class="progress" part="progress"></div>
71          <div class="cursor" part="cursor"></div>
72        </div>
73      </div>
74    `,[t,e]}setOptions(t){var e;if(this.options.container!==t.container){const i=this.parentFromOptionsContainer(t.container);i.appendChild(this.container),this.parent=i}t.dragToSeek===!0||typeof this.options.dragToSeek=="object"?this.initDrag():((e=this.dragStream)===null||e===void 0||e.cleanup(),this.dragStream=null),this.options=t,this.reRender()}getWrapper(){return this.wrapper}getWidth(){return this.scrollContainer.clientWidth}getScroll(){return this.scrollContainer.scrollLeft}setScroll(t){this.scrollContainer.scrollLeft=t}setScrollPercentage(t){const{scrollWidth:e}=this.scrollContainer,i=e*t;this.setScroll(i)}destroy(){var t;this.subscriptions.forEach((e=>e())),this.container.remove(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),(t=this.unsubscribeOnScroll)===null||t===void 0||t.forEach((e=>e())),this.unsubscribeOnScroll=[],this.dragStream&&(this.dragStream.cleanup(),this.dragStream=null),this.scrollStream&&(this.scrollStream.cleanup(),this.scrollStream=null)}createDelay(t=10){let e,i;const s=c(()=>{e&&(clearTimeout(e),e=void 0),i&&(i(),i=void 0)},"n");return this.timeouts.push(s),()=>new Promise(((n,r)=>{s(),i=r,e=setTimeout((()=>{e=void 0,i=void 0,n()}),t)}))}getHeight(t,e){var i;const s=((i=this.audioData)===null||i===void 0?void 0:i.numberOfChannels)||1;return(function({optionsHeight:n,optionsSplitChannels:r,parentHeight:a,numberOfChannels:l,defaultHeight:o=128}){if(n==null)return o;const h=Number(n);if(!isNaN(h))return h;if(n==="auto"){const m=a||o;return r!=null&&r.every((p=>!p.overlay))?m/l:m}return o})({optionsHeight:t,optionsSplitChannels:e,parentHeight:this.parent.clientHeight,numberOfChannels:s,defaultHeight:128})}convertColorValues(t,e){return(function(i,s,n){if(!Array.isArray(i))return i||"";if(i.length===0)return"#999";if(i.length<2)return i[0]||"";const r=document.createElement("canvas"),a=r.getContext("2d"),l=n??r.he
74ight*s,o=a.createLinearGradient(0,0,0,l||s),h=1/(i.length-1);return i.forEach(((m,p)=>{o.addColorStop(p*h,m)})),o})(t,this.getPixelRatio(),e==null?void 0:e.canvas.height)}getPixelRatio(){return t=window.devicePixelRatio,Math.max(1,t||1);var t}renderBarWaveform(t,e,i,s){const{width:n,height:r}=i.canvas,{halfHeight:a,barWidth:l,barRadius:o,barIndexScale:h,barSpacing:m,barMinHeight:p}=(function({width:d,height:f,length:b,options:P,pixelRatio:w}){const x=f/2,M=P.barWidth?P.barWidth*w:1,E=P.barGap?P.barGap*w:P.barWidth?M/2:0,C=M+E||1;return{halfHeight:x,barWidth:M,barGap:E,barRadius:P.barRadius||0,barMinHeight:P.barMinHeight?P.barMinHeight*w:0,barIndexScale:b>0?d/C/b:0,barSpacing:C}})({width:n,height:r,length:(t[0]||[]).length,options:e,pixelRatio:this.getPixelRatio()}),g=(function({channelData:d,barIndexScale:f,barSpacing:b,barWidth:P,halfHeight:w,vScale:x,canvasHeight:M,barAlign:E,barMinHeight:C}){const k=d[0]||[],D=d[1]||k,y=k.length,T=[];let W=0,L=0,O=0;for(let v=0;v<=y;v++){const A=Math.round(v*f);if(A>W){const{topHeight:ot,totalHeight:K}=ct({maxTop:L,maxBottom:O,halfHeight:w,vScale:x,barMinHeight:C,barAlign:E}),at=dt({barAlign:E,halfHeight:w,topHeight:ot,totalHeight:K,canvasHeight:M});T.push({x:W*b,y:at,width:P,height:K}),W=A,L=0,O=0}const Z=Math.abs(k[v]||0),J=Math.abs(D[v]||0);Z>L&&(L=Z),J>O&&(O=J)}return T})({channelData:t,barIndexScale:h,barSpacing:m,barWidth:l,halfHeight:a,vScale:s,canvasHeight:r,barAlign:e.barAlign,barMinHeight:p});i.beginPath();for(const d of g)o&&"roundRect"in i?i.roundRect(d.x,d.y,d.width,d.height,o):i.rect(d.x,d.y,d.width,d.height);i.fill(),i.closePath()}renderLineWaveform(t,e,i,s){const{width:n,height:r}=i.canvas,a=(function({channelData:l,width:o,height:h,vScale:m}){const p=h/2,g=l[0]||[];return[g,l[1]||g].map(((d,f)=>{const b=d.length,P=b?o/b:0,w=p,x=f===0?-1:1,M=[{x:0,y:w}];let E=0,C=0;for(let k=0;k<=b;k++){const D=Math.round(k*P);if(D>E){const T=w+(Math.round(C*p*m)||1)*x;M.push({x:E,y:T}),E=D,C=0}const y=Math.abs(d[k]||0);y>C&&(C=y)}return M.push({x:E,y:w}),M}))})({channelData:t,width:n,height:r,vScale:s});i.beginPath();for(const l of a)if(l.length){i.moveTo(l[0].x,l[0].y);for(let o=1;o<l.length;o++){const h=l[o];i.lineTo(h.x,h.y)}}i.fill(),i.closePath()}renderWaveform(t,e,i){if(i.fillStyle=this.convertColorValues(e.waveColor,i),e.renderFunction)return void e.renderFunction(t,i);const s=(function({channelData:n,barHeight:r,normalize:a,maxPeak:l}){var o;const h=r||1;if(!a)return h;const m=n[0];if(!m||m.length===0)return h;let p=l??0;if(!l)for(let g=0;g<m.length;g++){const d=(o=m[g])!==null&&o!==void 0?o:0,f=Math.abs(d);f>p&&(p=f)}return p?h/p:h})({channelData:t,barHeight:e.barHeight,normalize:e.normalize,maxPeak:e.maxPeak});nt(e)?this.renderBarWaveform(t,e,i,s):this.renderLineWaveform(t,e,i,s)}renderSingleCanvas(t,e,i,s,n,r,a){const l=this.getPixelRatio(),o=document.createElement("canvas");o.width=Math.round(i*l),o.height=Math.round(s*l),o.style.width=`${i}px`,o.style.height=`${s}px`,o.style.left=`${Math.round(n)}px`,r.appendChild(o);const h=o.getContext("2d");if(e.renderFunction?(h.fillStyle=this.convertColorValues(e.waveColor,h),e.renderFunction(t,h)):this.renderWaveform(t,e,h),o.width>0&&o.height>0){const m=o.cloneNode(),p=m.getContext("2d");p.drawImage(o,0,0),p.globalCompositeOperation="source-in",p.fillStyle=this.convertColorValues(e.progressColor,p),p.fillRect(0,0,o.width,o.height),a.appendChild(m)}}renderMultiCanvas(t,e,i,s,n,r){const a=this.getPixelRatio(),{clientWidth:l}=this.scrollContainer,o=i/a,h=(function({clientWidth:d,totalWidth:f,options:b}){return et(Math.min(8e3,d,f),b)})({clientWidth:l,totalWidth:o,options:e});let m={};if(h===0)return;const p=c(d=>{if(d<0||d>=g||m[d])return;m[d]=!0;const f=d*h;let b=Math.min(o-f,h);if(b=et(b,e),b<=0)return;const P=(function({channelData:w,offset:x,clampedWidth:M,totalWidth:E}){return w.map((C=>{const k=Math.floor(x/E*C.length),D=Math.floor((x+M)/E*C.length);return C.slice(k,D)}))})({channelData:t,offset:f,clampedWidth:b,totalWidth:o});this.renderSingleCanvas(P,e,b,s,f,n,r)},"u"),g=Math.ceil(o/h);if(!this.isScrollable){for(let d=0;d<g;d++)p(d);return}if(it({scrollLeft:this.scrollContainer.scrollLeft,totalWidth:o,numCanvase
74s:g}).forEach((d=>p(d))),g>1){const d=this.on("scroll",(()=>{const{scrollLeft:f}=this.scrollContainer;Object.keys(m).length>10&&(n.innerHTML="",r.innerHTML="",m={}),it({scrollLeft:f,totalWidth:o,numCanvases:g}).forEach((b=>p(b)))}));this.unsubscribeOnScroll.push(d)}}renderChannel(t,e,i,s){var{overlay:n}=e,r=(function(h,m){var p={};for(var g in h)Object.prototype.hasOwnProperty.call(h,g)&&m.indexOf(g)<0&&(p[g]=h[g]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var d=0;for(g=Object.getOwnPropertySymbols(h);d<g.length;d++)m.indexOf(g[d])<0&&Object.prototype.propertyIsEnumerable.call(h,g[d])&&(p[g[d]]=h[g[d]])}return p})(e,["overlay"]);const a=document.createElement("div"),l=this.getHeight(r.height,r.splitChannels);a.style.height=`${l}px`,n&&s>0&&(a.style.marginTop=`-${l}px`),this.canvasWrapper.style.minHeight=`${l}px`,this.canvasWrapper.appendChild(a);const o=a.cloneNode();this.progressWrapper.appendChild(o),this.renderMultiCanvas(t,r,i,l,a,o)}render(t){return R(this,void 0,void 0,(function*(){var e;this.timeouts.forEach((o=>o())),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 i=this.getPixelRatio(),s=this.scrollContainer.clientWidth,{scrollWidth:n,isScrollable:r,useParentWidth:a,width:l}=(function({duration:o,minPxPerSec:h=0,parentWidth:m,fillParent:p,pixelRatio:g}){const d=Math.ceil(o*h),f=d>m,b=!!(p&&!f);return{scrollWidth:d,isScrollable:f,useParentWidth:b,width:(b?m:d)*g}})({duration:t.duration,minPxPerSec:this.options.minPxPerSec||0,parentWidth:s,fillParent:this.options.fillParent,pixelRatio:i});if(this.isScrollable=r,this.wrapper.style.width=a?"100%":`${n}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=t,this.emit("render"),this.options.splitChannels)for(let o=0;o<t.numberOfChannels;o++){const h=Object.assign(Object.assign({},this.options),(e=this.options.splitChannels)===null||e===void 0?void 0:e[o]);this.renderChannel([t.getChannelData(o)],h,l,o)}else{const o=[t.getChannelData(0)];t.numberOfChannels>1&&o.push(t.getChannelData(1)),this.renderChannel(o,this.options,l,0)}Promise.resolve().then((()=>
74this.emit("rendered")))}))}reRender(){if(this.unsubscribeOnScroll.forEach((i=>i())),this.unsubscribeOnScroll=[],!this.audioData)return;const{scrollWidth:t}=this.scrollContainer,{right:e}=this.progressWrapper.getBoundingClientRect();if(this.render(this.audioData),this.isScrollable&&t!==this.scrollContainer.scrollWidth){const{right:i}=this.progressWrapper.getBoundingClientRect(),s=(function(n){const r=2*n;return(r<0?Math.floor(r):Math.ceil(r))/2})(i-e);this.scrollContainer.scrollLeft+=s}}zoom(t){this.options.minPxPerSec=t,this.reRender()}scrollIntoView(t,e=!1){const{scrollLeft:i,scrollWidth:s,clientWidth:n}=this.scrollContainer,r=t*s,a=i,l=i+n,o=n/2;if(this.isDragging)r+30>l?this.scrollContainer.scrollLeft+=30:r-30<a&&(this.scrollContainer.scrollLeft-=30);else{(r<a||r>l)&&(this.scrollContainer.scrollLeft=r-(this.options.autoCenter?o:0));const h=r-i-o;e&&this.options.autoCenter&&h>0&&(this.scrollContainer.scrollLeft+=h)}}renderProgress(t,e){if(isNaN(t))return;const i=100*t;this.canvasWrapper.style.clipPath=`polygon(${i}% 0%, 100% 0%, 100% 100%, ${i}% 100%)`,this.progressWrapper.style.width=`${i}%`,this.cursor.style.left=`${i}%`,this.cursor.style.transform=this.options.cursorWidth?`translateX(-${t*this.options.cursorWidth}px)`:"",this.isScrollable&&this.options.autoScroll&&this.audioData&&this.audioData.duration>0&&this.scrollIntoView(t,e)}exportImage(t,e,i){return R(this,void 0,void 0,(function*(){const s=this.canvasWrapper.querySelectorAll("canvas");if(!s.length)throw new Error("No waveform data");if(i==="dataURL"){const n=Array.from(s).map((r=>r.toDataURL(t,e)));return Promise.resolve(n)}return Promise.all(Array.from(s).map((n=>new Promise(((r,a)=>{n.toBlob((l=>{l?r(l):a(new Error("Could not export image"))}),t,e)})))))}))}};c(G,"y");let F=G;const U=class U extends N{constructor(){super(...arguments),this.animationFrameId=null,this.isRunning=!1}start(){if(this.isRunning)return;this.isRunning=!0;const t=c(()=>
74{this.isRunning&&(this.emit("tick"),this.animationFrameId=requestAnimationFrame(t))},"t");t()}stop(){this.isRunning=!1,this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}destroy(){this.stop()}};c(U,"C");let X=U;const Y=class Y extends N{constructor(t=new AudioContext){super(),this.bufferNode=null,this.playStartTime=0,this.playbackPosition=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=t,this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination)}load(){return R(this,void 0,void 0,(function*(){}))}get src(){return this.currentSrc}set src(t){if(this.currentSrc=t,this._duration=void 0,!t)return this.buffer=null,void this.emit("emptied");fetch(t).then((e=>{if(e.status>=400)throw new Error(`Failed to fetch ${t}: ${e.status} (${e.statusText})`);return e.arrayBuffer()})).then((e=>this.currentSrc!==t?null:this.audioContext.decodeAudioData(e))).then((e=>{this.currentSrc===t&&(this.buffer=e,this.emit("loadedmetadata"),this.emit("canplay"),this.autoplay&&this.play())})).catch((e=>{console.error("WebAudioPlayer load error:",e)}))}_play(){if(!this.paused)return;this.paused=!1,this.bufferNode&&(this.bufferNode.onended=null,this.bufferNode.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.playbackPosition;(t>=this.duration||t<0)&&(t=0,this.playbackPosition=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 t;this.paused=!0,(t=this.bufferNode)===null||t===void 0||t.stop(),this.playbackPosition+=(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}play(){return R(this,void 0,void 0,(function*(){this.paused&&(this._play(),this.emit("play"))}))}pause(){this.paused||(this._pause(),this.emit("pause"))}stopAt(t){const e=t-this.currentTime,i=this.bufferNode;i==null||i.stop(this.audioContext.currentTime+e),i==null||i.addEventListener("ended",(()=>{i===this.bufferNode&&(this.bufferNode=null,this.pause())}),{once:!0})}setSinkId(t){return R(this,void 0,void 0,(function*(){return this.audioContext.setSinkId(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){const e=!this.paused;e&&this._pause(),this._playbackRate=t,e&&this._play(),this.bufferNode&&(this.bufferNode.playbackRate.value=t)}get currentTime(){return this.paused?this.playbackPosition:this.playbackPosition+(this.audioContext.currentTime-this.playStartTime)*this._playbackRate}set currentTime(t){const e=!this.paused;e&&this._pause(),this.playbackPosition=t,e&&this._play(),this.emit("seeking"),this.emit("timeupdate")}get duration(){var t,e;return(t=this._duration)!==null&&t!==void 0?t:((e=this.buffer)===null||e===void 0?void 0:e.duration)||0}set duration(t){this._duration=t}get volume(){return this.gainNode.gain.value}set volume(t){this.gainNode.gain.value=t,this.emit("volumechange")}get muted(){return this._muted}set muted(t){this._muted!==t&&(this._muted=t,this._muted?this.gainNode.disconnect():this.gainNode.connect(this.audioContext.destination))}canPlayType(t){return/^(audio|video)\//.test(t)}getGainNode(){return this.gainNode}getChannelData(){const t=[];if(!this.buffer)return t;const e=this.buffer.numberOfChannels;for(let i=0;i<e;i++)t.push(this.buffer.getChannelData(i));return t}removeAttribute(t){switch(t){case"src":this.src="";break;case"playbackRate":this.playbackRate=0;break;case"currentTime":this.currentTime=0;break;case"duration":this.duration=0;break;case"volume":this.volume=0;break;case"muted":this.muted=!1}}};c(Y,"S");let z=Y;const mt={waveColor:"#999",progressColor:"#555",cursorWidth:1,minPxPerSec:0,fillParent:!0,interact:!0,dragToSeek:!1,autoScroll:!0,autoCenter:!0,sampleRate:8e3}
74,$=class $ extends j{static create(t){return new $(t)}getState(){return this.wavesurferState}getRenderer(){return this.renderer}constructor(t){const e=t.media||(t.backend==="WebAudio"?new z:void 0);super({media:e,mediaControls:t.mediaControls,autoplay:t.autoplay,playbackRate:t.audioRate}),this.plugins=[],this.decodedData=null,this.stopAtPosition=null,this.subscriptions=[],this.mediaSubscriptions=[],this.abortController=null,this.reactiveCleanups=[],this.options=Object.assign({},mt,t);const{state:i,actions:s}=(function(a){var l,o,h,m,p,g;const d=(l=a==null?void 0:a.currentTime)!==null&&l!==void 0?l:S(0),f=(o=a==null?void 0:a.duration)!==null&&o!==void 0?o:S(0),b=(h=a==null?void 0:a.isPlaying)!==null&&h!==void 0?h:S(!1),P=(m=a==null?void 0:a.isSeeking)!==null&&m!==void 0?m:S(!1),w=(p=a==null?void 0:a.volume)!==null&&p!==void 0?p:S(1),x=(g=a==null?void 0:a.playbackRate)!==null&&g!==void 0?g:S(1),M=S(null),E=S(null),C=S(""),k=S(0),D=S(0),y=_((()=>!b.value),[b]),T=_((()=>M.value!==null),[M]),W=_((()=>T.value&&f.value>0),[T,f]),L=_((()=>d.value),[d]),O=_((()=>f.value>0?d.value/f.value:0),[d,f]);return{state:{currentTime:d,duration:f,isPlaying:b,isPaused:y,isSeeking:P,volume:w,playbackRate:x,audioBuffer:M,peaks:E,url:C,zoom:k,scrollPosition:D,canPlay:T,isReady:W,progress:L,progressPercent:O},actions:{setCurrentTime:c(v=>{const A=Math.max(0,Math.min(f.value||1/0,v));d.set(A)},"setCurrentTime"),setDuration:c(v=>{f.set(Math.max(0,v))},"setDuration"),setPlaying:c(v=>{b.set(v)},"setPlaying"),setSeeking:c(v=>{P.set(v)},"setSeeking"),setVolume:c(v=>{const A=Math.max(0,Math.min(1,v));w.set(A)},"setVolume"),setPlaybackRate:c(v=>{const A=Math.max(.1,Math.min(16,v));x.set(A)},"setPlaybackRate"),setAudioBuffer:c(v=>{M.set(v),v&&f.set(v.duration)},"setAudioBuffer"),setPeaks:c(v=>{E.set(v)},"setPeaks"),setUrl:c(v=>{C.set(v)},"setUrl"),setZoom:c(v=>{k.set(Math.max(0,v))},"setZoom"),setScrollPosition:c(v=>{D.set(Math.max(0,v))},"setScrollPosition")}}})({isPlaying:this.isPlayingSignal,currentTime:this.currentTimeSignal,duration:this.durationSignal,volume:this.volumeSignal,playbackRate:this.playbackRateSignal,isSeeking:this.seekingSignal});this.wavesurferState=i,this.wavesurferActions=s,this.timer=new X;const n=e?void 0:this.getMediaElement();this.renderer=new F(this.options,n),this.initPlayerEvents(),this.initRendererEvents(),this.initTimerEvents(),this.initReactiveState(),this.initPlugins();const r=this.options.url||this.getSrc()||"";Promise.resolve().then((()=>{this.emit("init");const{peaks:a,duration:l}=this.options;(r||a&&l)&&this.load(r,a,l).catch((o=>{this.emit("error",o instanceof Error?o:new Error(String(o)))}))}))}updateProgress(t=this.getCurrentTime()){return this.renderer.renderProgress(t/this.getDuration(),this.isPlaying()),t}initTimerEvents(){this.subscriptions.push(this.timer.on("tick",(()=>{if(!this.isSeeking()){const t=this.updateProgress();this.emit("timeupdate",t),this.emit("audioprocess",t),this.stopAtPosition!=null&&this.isPlaying()&&t>=this.stopAtPosition&&this.pause()}})))}initReactiveState(){this.reactiveCleanups.push((function(t,e){const i=[];i.push(H((()=>{const r=t.isPlaying.value;e.emit(r?"play":"pause")}),[t.isPlaying])),i.push(H((()=>{const r=t.currentTime.value;e.emit("timeupdate",r),t.isPlaying.value&&e.emit("audioprocess",r)}),[t.currentTime,t.isPlaying])),i.push(H((()=>{t.isSeeking.value&&e.emit("seeking",t.currentTime.value)}),[t.isSeeking,t.currentTime]));let s=!1;i.push(H((()=>{t.isReady.value&&!s&&(s=!0,e.emit("ready",t.duration.value))}),[t.isReady,t.duration]));let n=!1;return i.push(H((()=>{const r=t.isPlaying.value,a=t.currentTime.value,l=t.duration.value,o=l>0&&a>=l;n&&!r&&o&&e.emit("finish"),n=r&&o}),[t.isPlaying,t.currentTime,t.duration])),i.push(H((()=>{const r=t.zoom.value;r>0&&e.emit("zoom",r)}),[t.zoom])),()=>{i.forEach((r=>r()))}})(this.wavesurferState,{emit:this.emit.bind(this)}))}initPlayerEvents(){this.isPlaying()&&(this.emit("play"),this.timer.start()),this.mediaSubscriptions.push(this.onMediaEvent("timeupdate",(()=>{const t=this.updateProgress();this.emit("timeupdate",t)})),this.onMediaEvent("play",(()=>
74{this.emit("play"),this.timer.start()})),this.onMediaEvent("pause",(()=>{this.emit("pause"),this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("emptied",(()=>{this.timer.stop(),this.stopAtPosition=null})),this.onMediaEvent("ended",(()=>{this.emit("timeupdate",this.getDuration()),this.emit("finish"),this.stopAtPosition=null})),this.onMediaEvent("seeking",(()=>{this.emit("seeking",this.getCurrentTime())})),this.onMediaEvent("error",(()=>{var t;this.emit("error",(t=this.getMediaElement().error)!==null&&t!==void 0?t:new Error("Media error")),this.stopAtPosition=null})))}initRendererEvents(){this.subscriptions.push(this.renderer.on("click",((t,e)=>{this.options.interact&&(this.seekTo(t),this.emit("interaction",t*this.getDuration()),this.emit("click",t,e))})),this.renderer.on("dblclick",((t,e)=>{this.emit("dblclick",t,e)})),this.renderer.on("scroll",((t,e,i,s)=>{const n=this.getDuration();this.emit("scroll",t*n,e*n,i,s)})),this.renderer.on("render",(()=>{this.emit("redraw")})),this.renderer.on("rendered",(()=>{this.emit("redrawcomplete")}
74)),this.renderer.on("dragstart",(t=>{this.emit("dragstart",t)})),this.renderer.on("dragend",(t=>{this.emit("dragend",t)})),this.renderer.on("resize",(()=>{this.emit("resize")})));{let t;const e=this.renderer.on("drag",(i=>{var s;if(!this.options.interact)return;this.renderer.renderProgress(i),clearTimeout(t);let n=0;const r=this.options.dragToSeek;this.isPlaying()?n=0:r===!0?n=200:r&&typeof r=="object"&&(n=(s=r.debounceTime)!==null&&s!==void 0?s:200),t=setTimeout((()=>{this.seekTo(i)}),n),this.emit("interaction",i*this.getDuration()),this.emit("drag",i)}));this.subscriptions.push((()=>{clearTimeout(t),e()}))}}initPlugins(){var t;!((t=this.options.plugins)===null||t===void 0)&&t.length&&this.options.plugins.forEach((e=>{this.registerPlugin(e)}))}unsubscribePlayerEvents(){this.mediaSubscriptions.forEach((t=>t())),this.mediaSubscriptions=[]}setOptions(t){this.options=Object.assign({},this.options,t),t.duration&&!t.peaks&&(this.decodedData=B.createBuffer(this.exportPeaks(),t.duration)),t.peaks&&t.duration&&(this.decodedData=B.createBuffer(t.peaks,t.duration)),this.renderer.setOptions(this.options),t.audioRate&&this.setPlaybackRate(t.audioRate),t.mediaControls!=null&&(this.getMediaElement().controls=t.mediaControls)}registerPlugin(t){if(this.plugins.includes(t))return t;t._init(this),this.plugins.push(t);const e=t.once("destroy",(()=>{this.plugins=this.plugins.filter((i=>i!==t)),this.subscriptions=this.subscriptions.filter((i=>i!==e))}));return this.subscriptions.push(e),t}unregisterPlugin(t){this.plugins=this.plugins.filter((e=>e!==t)),t.destroy()}getWrapper(){return this.renderer.getWrapper()}getWidth(){return this.renderer.getWidth()}getScroll(){return this.renderer.getScroll()}setScroll(t){return this.renderer.setScroll(t)}setScrollTime(t){const e=t/this.getDuration();this.renderer.setScrollPercentage(e)}getActivePlugins(){return this.plugins}loadAudio(t,e,i,s){return R(this,void 0,void 0,(function*(){var n;if(this.emit("load",t),!this.options.media&&this.isPlaying()&&this.pause(),this.decodedData=null,this.stopAtPosition=null,(n=this.abortController)===null||n===void 0||n.abort(),this.abortController=null,!e&&!i){const a=this.options.fetchParams||{};window.AbortController&&!a.signal&&(this.abortController=new AbortController,a.signal=this.abortController.signal);const l=c(h=>
74this.emit("loading",h),"i");e=yield ut.fetchBlob(t,l,a);const o=this.options.blobMimeType;o&&(e=new Blob([e],{type:o}))}this.setSrc(t,e);const r=yield new Promise((a=>{const l=s||this.getDuration();l?a(l):this.mediaSubscriptions.push(this.onMediaEvent("loadedmetadata",(()=>a(this.getDuration())),{once:!0}))}));if(!t&&!e){const a=this.getMediaElement();a instanceof z&&(a.duration=r)}if(i)this.decodedData=B.createBuffer(i,r||0);else if(e){const a=yield e.arrayBuffer();this.decodedData=yield B.decode(a,this.options.sampleRate)}this.decodedData&&(this.emit("decode",this.getDuration()),this.renderer.render(this.decodedData)),this.emit("ready",this.getDuration())}))}load(t,e,i){return R(this,void 0,void 0,(function*(){try{return yield this.loadAudio(t,void 0,e,i)}catch(s){throw this.emit("error",s),s}}))}loadBlob(t,e,i){return R(this,void 0,void 0,(function*(){try{return yield this.loadAudio("",t,e,i)}catch(s){throw this.emit("error",s),s}}))}zoom(t){if(!this.decodedData)throw new Error("No audio loaded");this.renderer.zoom(t),this.emit("zoom",t)}getDecodedData(){return this.decodedData}exportPeaks({channels:t=2,maxLength:e=8e3,precision:i=1e4}={}){if(!this.decodedData)throw new Error("The audio has not been decoded yet");const s=Math.min(t,this.decodedData.numberOfChannels),n=[];for(let r=0;r<s;r++){const a=this.decodedData.getChannelData(r),l=[],o=a.length/e;for(let h=0;h<e;h++){const m=a.slice(Math.floor(h*o),Math.ceil((h+1)*o));let p=0;for(let g=0;g<m.length;g++){const d=m[g];Math.abs(d)>Math.abs(p)&&(p=d)}l.push(Math.round(p*i)/i)}n.push(l)}return n}getDuration(){let t=super.getDuration()||0;return t!==0&&t!==1/0||!this.decodedData||(t=this.decodedData.duration),t}toggleInteraction(t){this.options.interact=t}setTime(t){this.stopAtPosition=null,super.setTime(t),this.updateProgress(t),this.emit("timeupdate",t)}seekTo(t){const e=this.getDuration()*t;this.setTime(e)}play(t,e){const i=Object.create(null,{play:{get:c(()=>super.play,"get")}});return R(this,void 0,void 0,(function*(){t!=null&&this.setTime(t);const s=yield i.play.call(this);return e!=null&&(this.media instanceof z?this.media.stopAt(e):this.stopAtPosition=e),s}))}playPause(){return R(this,void 0,void 0,(function*(){return this.isPlaying()?this.pause():this.play()}))}stop(){this.pause(),this.setTime(0)}skip(t){this.setTime(this.getCurrentTime()+t)}empty(){this.load("",[[0]],.001)}setMediaElement(t){this.unsubscribePlayerEvents(),super.setMediaElement(t),this.initPlayerEvents()}exportImage(){return R(this,arguments,void 0,(function*(t="image/png",e=1,i="dataURL"){return this.renderer.exportImage(t,e,i)}))}destroy(){var t;this.emit("destroy"),(t=this.abortController)===null||t===void 0||t.abort(),this.plugins.forEach((e=>e.destroy())),this.subscriptions.forEach((e=>e())),this.unsubscribePlayerEvents(),this.reactiveCleanups.forEach((e=>e())),this.reactiveCleanups=[],this.timer.destroy(),this.renderer.destroy(),super.destroy()}};c($,"P");let I=$;I.BasePlugin=class extends N{constructor(u){super(),this.subscriptions=[],this.isDestroyed=!1,this.options=u}onInit(){}_init(u){this.isDestroyed&&(this.subscriptions=[],this.isDestroyed=!1),this.wavesurfer=u,this.onInit()}destroy(){this.emit("destroy"),this.subscriptions.forEach((u=>u())),this.subscriptions=[],this.isDestroyed=!0,this.wavesurfer=void 0}},I.dom=ht;export{I as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.