11var $ = Object . defineProperty ;
22var I = ( i , e , t ) => e in i ? $ ( i , e , { enumerable : ! 0 , configurable : ! 0 , writable : ! 0 , value : t } ) : i [ e ] = t ;
3- var u = ( i , e , t ) => ( I ( i , typeof e != "symbol" ? e + "" : e , t ) , t ) ;
4- import { defineComponent as L , ref as d , onMounted as E , watchEffect as m , onUnmounted as O , openBlock as P , createElementBlock as X , normalizeStyle as y , createVNode as Y , Transition as V , withCtx as q , withDirectives as _ , createElementVNode as C , vShow as A } from "vue" ;
3+ var l = ( i , e , t ) => ( I ( i , typeof e != "symbol" ? e + "" : e , t ) , t ) ;
4+ import { defineComponent as L , ref as d , onMounted as E , watchEffect as m , onUnmounted as P , openBlock as O , createElementBlock as X , normalizeStyle as y , createVNode as Y , Transition as V , withCtx as q , withDirectives as _ , createElementVNode as C , vShow as k } from "vue" ;
55class U {
66 constructor ( e , t , a ) {
7- u ( this , "canvasCtx" ) ;
7+ l ( this , "canvasCtx" ) ;
88 var n ;
99 this . canvas = e , this . props = t , this . filteredData = a , this . canvas = e , this . canvasCtx = ( n = this . canvas ) == null ? void 0 : n . getContext ( "2d" ) , this . props = t , this . filteredData = a ;
1010 }
@@ -32,12 +32,12 @@ class U {
3232 drawCanvasLines ( ) {
3333 const { canvas : e , canvasCtx : t , filteredData : a } = this ;
3434 a . forEach ( ( n , o ) => {
35- const c = e . width / a . length , l = c * o - c / 2 ;
35+ const c = e . width / a . length , u = c * o - c / 2 ;
3636 t . moveTo (
37- l ,
37+ u ,
3838 e . height / 2 - Math . abs ( n [ 0 ] ) * e . height * 0.4
3939 ) , t . lineTo (
40- l ,
40+ u ,
4141 e . height / 2 + Math . abs ( n [ 0 ] ) * e . height * 0.4
4242 ) ;
4343 } ) ;
@@ -57,12 +57,12 @@ class U {
5757}
5858class j {
5959 constructor ( e ) {
60- u ( this , "props" ) ;
61- u ( this , "audioCtx" ) ;
62- u ( this , "audioBuffer" ) ;
63- u ( this , "audioBufferSourceNode" ) ;
64- u ( this , "filterData" ) ;
65- u ( this , "arrayBuffer" ) ;
60+ l ( this , "props" ) ;
61+ l ( this , "audioCtx" ) ;
62+ l ( this , "audioBuffer" ) ;
63+ l ( this , "audioBufferSourceNode" ) ;
64+ l ( this , "filterData" ) ;
65+ l ( this , "arrayBuffer" ) ;
6666 this . props = e , this . audioCtx = new AudioContext ( ) ;
6767 }
6868 get _filterData ( ) {
@@ -93,9 +93,9 @@ class j {
9393 a . push ( this . audioBuffer . getChannelData ( o ) ) ;
9494 for ( let o = 0 ; o < e ; o ++ ) {
9595 const c = [ 0 , 0 ] ;
96- for ( let l = 0 ; l < t ; l ++ ) {
97- const r = Math . floor ( a [ l ] . length / e ) ;
98- c [ l ] = a [ l ] [ o * r ] ;
96+ for ( let u = 0 ; u < t ; u ++ ) {
97+ const r = Math . floor ( a [ u ] . length / e ) ;
98+ c [ u ] = a [ u ] [ o * r ] ;
9999 }
100100 n . push ( c ) ;
101101 }
@@ -114,10 +114,10 @@ class j {
114114class G extends j {
115115 constructor ( t ) {
116116 super ( t ) ;
117- u ( this , "startAt" ) ;
118- u ( this , "pauseAt" ) ;
119- u ( this , "pickAt" ) ;
120- u ( this , "playing" ) ;
117+ l ( this , "startAt" ) ;
118+ l ( this , "pauseAt" ) ;
119+ l ( this , "pickAt" ) ;
120+ l ( this , "playing" ) ;
121121 this . startAt = 0 , this . pauseAt = 0 , this . pickAt = 0 , this . playing = ! 1 ;
122122 }
123123 get _playing ( ) {
@@ -135,11 +135,14 @@ class G extends j {
135135 this . stop ( ) , this . pauseAt = t ;
136136 }
137137 pick ( t ) {
138- t <= 0 && ( t = 0 ) , t >= this . _audioDuration && ( t = this . _audioDuration ) , this . pickAt = t , this . playing && ( this . stopSource ( ) , this . play ( ) ) ;
138+ this . pickAt = t , this . playing && ( this . stopSource ( ) , this . play ( ) ) ;
139139 }
140140 replay ( ) {
141141 this . audioBufferSourceNode && this . stop ( ) , this . play ( ) ;
142142 }
143+ finish ( ) {
144+ this . pauseAt = 0 , this . stop ( ) ;
145+ }
143146 stop ( ) {
144147 this . stopSource ( ) , this . initializeState ( ) ;
145148 }
@@ -150,18 +153,18 @@ class G extends j {
150153 this . playing = ! 1 , this . startAt = 0 , this . pauseAt = 0 , this . pickAt = 0 ;
151154 }
152155}
153- function D ( i ) {
156+ function B ( i ) {
154157 const e = Math . floor ( i / 60 ) , t = Math . floor ( i % 60 ) ;
155158 return `${ e } :${ t < 10 ? "0" : "" } ${ t } ` ;
156159}
157160function J ( i , e ) {
158- const t = Q ( ( ) => k ( i , e ) , 500 ) ;
161+ const t = Q ( ( ) => A ( i , e ) , 500 ) ;
159162 document . addEventListener ( "scroll" , ( ) => t ( ) ) ;
160163}
161164function K ( i , e ) {
162- document . removeEventListener ( "scroll" , ( ) => k ( i , e ) ) ;
165+ document . removeEventListener ( "scroll" , ( ) => A ( i , e ) ) ;
163166}
164- function k ( i , e ) {
167+ function A ( i , e ) {
165168 const t = window . innerHeight , a = window . scrollY , n = window . pageYOffset + i . getBoundingClientRect ( ) . top ;
166169 n >= a - t / 4 && n - a - t < t / 4 && e ( ) ;
167170}
@@ -201,86 +204,86 @@ const Z = /* @__PURE__ */ L({
201204 setup ( i , { expose : e , emit : t } ) {
202205 const a = i , n = d ( ! 1 ) , o = d ( null ) ;
203206 E ( async ( ) => {
204- a . lazy ? ( k ( o . value , c ) , J (
207+ a . lazy ? ( A ( o . value , c ) , J (
205208 o . value ,
206209 c
207210 ) , m ( async ( ) => {
208211 n . value && await x ( ) ;
209212 } ) ) : await x ( ) ;
210- } ) , O ( ( ) => {
213+ } ) , P ( ( ) => {
211214 a . lazy && K ( o . value , c ) ;
212215 } ) ;
213216 function c ( ) {
214217 n . value = ! 0 ;
215218 }
216- const l = d ( null ) , r = d ( ! 1 ) ;
217- let s , h ;
219+ const u = d ( null ) , r = d ( ! 1 ) ;
220+ let s , f ;
218221 async function x ( ) {
219- r . value || ( t ( "onInit" , ! 0 ) , await S ( ) , await W ( ) , r . value = ! 0 , t ( "onReady" , r . value ) ) ;
222+ r . value || ( t ( "onInit" , ! 0 ) , await S ( ) , await D ( ) , r . value = ! 0 , t ( "onReady" , r . value ) ) ;
220223 }
221224 async function S ( ) {
222225 s = new G ( a ) , await s . fetchAudioFile ( ) , t ( "onFetched" , ! 0 ) , await s . setupAudio ( ) , R ( ) ;
223226 }
224- async function W ( ) {
225- h = new U (
226- l . value ,
227+ async function D ( ) {
228+ f = new U (
229+ u . value ,
227230 a ,
228231 s . _filterData
229- ) , h . setupCanvas ( ) , m ( ( ) => {
230- h . _props = a , h . setWaveStyle ( w . value ) ;
232+ ) , f . setupCanvas ( ) , m ( ( ) => {
233+ f . _props = a , f . setWaveStyle ( w . value ) ;
231234 } ) ;
232235 }
233- const v = d ( 0 ) , p = d ( 0 ) , w = d ( 0 ) ;
236+ const p = d ( 0 ) , v = d ( 0 ) , w = d ( 0 ) ;
234237 function g ( ) {
235- ! s . _playing || ( requestAnimationFrame ( g ) , p . value = s . _currentTime , w . value = p . value / s . _audioDuration * h . _canvas . width ) ;
238+ ! s . _playing || ( requestAnimationFrame ( g ) , v . value = s . _currentTime , w . value = v . value / s . _audioDuration * f . _canvas . width ) ;
236239 }
237- function T ( f ) {
238- ! r . value || ! a . interact || ( f . layerX <= 0 ? v . value = 0 : f . layerX >= h . _canvas . width ? v . value = h . _canvas . width : v . value = f . layerX ) ;
240+ function W ( h ) {
241+ ! r . value || ! a . interact || ( h . layerX <= 0 ? p . value = 0 : h . layerX >= f . _canvas . width ? p . value = f . _canvas . width : p . value = h . layerX ) ;
239242 }
240- function N ( ) {
243+ function T ( ) {
241244 if ( ! r . value || ! a . interact )
242245 return ;
243- w . value = v . value ;
244- const f = v . value / h . _canvas . width * s . _audioDuration ;
245- s . pick ( f ) , p . value = f , t ( "onClick" , o ) , t ( "onFinish" , ! 1 ) ;
246+ w . value = p . value ;
247+ const h = p . value / f . _canvas . width * s . _audioDuration ;
248+ s . pick ( h ) , v . value = h , t ( "onClick" , o ) , t ( "onFinish" , ! 1 ) ;
246249 }
247250 function b ( ) {
248251 ! r . value || ( s . play ( ) , t ( "onPlay" , ! 0 ) , g ( ) ) ;
249252 }
250- function F ( ) {
253+ function N ( ) {
251254 s . replay ( ) , t ( "onFinish" , ! 1 ) , t ( "onPlay" , ! 0 ) , g ( ) ;
252255 }
253- function B ( ) {
256+ function F ( ) {
254257 s . pause ( ) , t ( "onPause" , ! 1 ) ;
255258 }
256259 function M ( ) {
257- t ( "onFinish" , ! 0 ) ;
260+ s . finish ( ) , t ( "onPlay" , ! 1 ) , t ( "onFinish" , ! 0 ) ;
258261 }
259262 function R ( ) {
260263 m ( ( ) => {
261- p . value < s . _audioDuration || ( B ( ) , M ( ) ) ;
264+ v . value <= s . _audioDuration || M ( ) ;
262265 } ) ;
263266 }
264267 function z ( ) {
265- return D ( p . value ) ;
268+ return B ( v . value ) ;
266269 }
267270 function H ( ) {
268- const f = s . _audioDuration ;
269- return D ( f ) ;
271+ const h = s . _audioDuration ;
272+ return B ( h ) ;
270273 }
271274 return e ( {
272275 play : b ,
273- pause : B ,
274- replay : F ,
276+ pause : F ,
277+ replay : N ,
275278 getCurrentTime : z ,
276279 getDuration : H
277- } ) , ( f , at ) => ( P ( ) , X ( "section" , {
280+ } ) , ( h , at ) => ( O ( ) , X ( "section" , {
278281 id : "illest-wave-container" ,
279282 ref_key : "waveformContainer" ,
280283 ref : o ,
281284 style : y ( `${ r . value && i . interact ? "cursor: pointer" : "" } ` ) ,
282- onMousemove : T ,
283- onClick : N
285+ onMousemove : W ,
286+ onClick : T
284287 } , [
285288 Y ( V , { name : "fade" } , {
286289 default : q ( ( ) => [
@@ -292,24 +295,24 @@ const Z = /* @__PURE__ */ L({
292295 id : "illest-skeleton__load" ,
293296 style : y ( `background-color: ${ i . skeletonColor } ` )
294297 } , null , 4 ) , [
295- [ A , ! r . value ]
298+ [ k , ! r . value ]
296299 ] )
297300 ] , 4 ) , [
298- [ A , a . skeleton && ! r . value ]
301+ [ k , a . skeleton && ! r . value ]
299302 ] )
300303 ] ) ,
301304 _ : 1
302305 } ) ,
303306 C ( "canvas" , {
304307 id : "illest-wave" ,
305308 ref_key : "waveRef" ,
306- ref : l
309+ ref : u
307310 } , null , 512 ) ,
308311 _ ( C ( "div" , {
309312 id : "illest-cursor" ,
310- style : y ( `width:${ a . cursorWidth } px; transform: translateX(${ v . value } px);background-color: ${ a . cursorColor } ; ` )
313+ style : y ( `width:${ a . cursorWidth } px; transform: translateX(${ p . value } px);background-color: ${ a . cursorColor } ; ` )
311314 } , null , 4 ) , [
312- [ A , r . value && a . interact ]
315+ [ k , r . value && a . interact ]
313316 ] )
314317 ] , 36 ) ) ;
315318 }
@@ -319,7 +322,7 @@ const tt = (i, e) => {
319322 for ( const [ a , n ] of e )
320323 t [ a ] = n ;
321324 return t ;
322- } , et = /* @__PURE__ */ tt ( Z , [ [ "__scopeId" , "data-v-10d3d361 " ] ] ) , ot = {
325+ } , et = /* @__PURE__ */ tt ( Z , [ [ "__scopeId" , "data-v-020db612 " ] ] ) , ot = {
323326 install : ( i ) => {
324327 i . component ( "IllestWaveform" , et ) ;
325328 }
0 commit comments