const e=e=>{e.preventDefault()};function l(t){var n=jQuery(".llms-complete-lesson-form"),o=jQuery('.llms-complete-lesson-form button[type="submit"]'),l=jQuery("#llms_start_quiz, #llms-start-assignment");!0===t?(n.off("submit",e),o.removeAttr("disabled"),l.removeClass("llms-av-disabled").off("click",e)):(n.on("submit",e),o.attr("disabled","disabled"),l.addClass("llms-av-disabled").on("click",e))}const s=e=>({ts:e.currentTime,duration:e.duration,url:e.source,provider:e.provider,id:e.config.id}),t=(e,t)=>{llms.tracking.addEvent("video."+e,{meta:t})},n=e=>{let n=s(e.detail.plyr);t("paused",n)},o=e=>{let n=s(e.detail.plyr);t(n.ts<1?"started":"played",n)},d=(e,n,o)=>{let i=s(e.detail.plyr);t("ended",i),function(e,t){LLMS.Ajax.call({data:{action:"llms_av_video_ended",id:t.post_id,nonce:t.nonce},beforeSend:function(){LLMS.Spinner.start(e)},error:function(t,n,o){LLMS.Spinner.stop(e),console.error(t.responseText+" ("+o+" "+n+")"),console.log(t)},success:function(t){LLMS.Spinner.stop(e),t?.html&&(e.append(t.html),function(e){var t,n=e.find(".llms-av-pv--seconds");setInterval((function(){1==(t=1*n.text()-1)&&n.closest("a")[0].click(),t>=0&&n.text(t)}),1e3)}(e))}})}(n,o),l(!0)};function i(e){var t={},s=llms?.tracking?.getSettings()||null;s?.av&&(t=s.av),t.require_video_completion&&!t.video_completed&&l(!1);let i=jQuery(".presto-block-video");e.on("pause",n),e.on("playing",o),e.on("ended",(e=>d(e,i,t)))}export default i;export{d as onEndedVideo,n as onPauseVideo,o as onPlayingVideo};