!function(e){"use strict";let n=function(e,n){let i=e.find(".sifency-audio-player");if(!i.length)return;let t=i.find(".sifency-html5-audio")[0],a=i.find(".sifency-ap-play-btn"),s=a.find("i"),o=i.find(".sifency-ap-prev-btn"),c=i.find(".sifency-ap-next-btn"),l=i.find(".sifency-ap-seek-bar"),d=i.find(".sifency-ap-progress-fill"),f=i.find(".sifency-ap-current-time"),r=i.find(".sifency-ap-total-time"),p=i.find(".sifency-ap-volume-btn"),u=i.find(".sifency-ap-volume-slider"),y=i.find(".sifency-ap-download-btn"),v=e.find(".sifency-ap-playlist-item"),m=i.find(".sifency-ap-title"),$=i.find(".sifency-ap-artist"),h=i.find(".sifency-ap-cover-img"),C={autoplay:"no",loop:"no",tracks:[]},g=0,_=!1;try{let k=i.data("ap-settings");k&&n.extend(C,k)}catch(x){}let b=C.tracks;function w(e){if(isNaN(e))return"0:00";let n=Math.floor(e%60);return n<10&&(n="0"+n),Math.floor(e/60)+":"+n}function E(e){e<0&&(e=b.length-1),e>=b.length&&(e=0),g=e;let n=b[e];t.src=n.src,t.load(),m.text(n.title),$.text(n.artist),n.cover?(h.attr("src",n.cover),i.find(".sifency-ap-cover").show()):h.attr("src",""),y.length&&y.attr("href",n.src),v.removeClass("active"),v.eq(e).addClass("active"),l.val(0),d.css("width","0%"),f.text("0:00"),_&&t.play()}function L(){t.paused?t.play().then(()=>{_=!0,i.addClass("sifency-playing"),s.removeClass("eicon-play").addClass("eicon-play"),v.eq(g).find(".sifency-ap-pl-icon i").removeClass("eicon-play").addClass("eicon-play")}).catch(e=>console.log("Audio Play Error:",e)):(t.pause(),_=!1,i.removeClass("sifency-playing"),s.removeClass("eicon-play").addClass("eicon-play"),v.find(".sifency-ap-pl-icon i").removeClass("eicon-play").addClass("eicon-play"))}a.on("click",L),o.on("click",function(){_=!0,E(g-1)}),c.on("click",function(){_=!0,E(g+1)}),v.on("click",function(){let e=n(this).data("index");e===g?L():(_=!0,E(e))}),t.addEventListener("timeupdate",function(){if(isNaN(t.duration))return;let e=t.currentTime/t.duration*100;l.val(e),d.css("width",e+"%"),f.text(w(t.currentTime))}),t.addEventListener("loadedmetadata",function(){r.text(w(t.duration)),"yes"===C.autoplay&&0===g&&L()}),t.addEventListener("ended",function(){"yes"===C.loop?(E(g+1),t.play()):g<b.length-1?(E(g+1),t.play()):(_=!1,i.removeClass("sifency-playing"),s.removeClass("eicon-play").addClass("eicon-play"))}),l.on("input",function(){let e=t.duration/100*n(this).val();t.currentTime=e}),u.on("input",function(){t.volume=n(this).val()}),p.on("click",function(){t.muted=!t.muted,t.muted?u.val(0):u.val(t.volume)})};e(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/sifency-audio-player.default",n)})}(jQuery);