(()=>{var t={502:function(){window.addEventListener("DOMContentLoaded",()=>{var t=document.getElementById("tutor-download-invoice");if(t){t.addEventListener("click",e=>{var r;var o=t.dataset.orderId;t.classList.add("is-loading");var n=document.getElementById("tutor-invoice-content");// Create a new <style> element and append it to the document's <head>
var a=document.createElement("style");document.head.appendChild(a);(r=a.sheet)===null||r===void 0?void 0:r.insertRule("body > div:last-child img { all: unset; }");html2canvas(n,{scale:2}).then(e=>{// Remove the temporary style element to clean up the DOM
a.remove();// Get the image data from the canvas
var r=e.toDataURL("image/jpeg");var n=595;var i=842;// Create a new jsPDF instance (use 'p' for portrait or 'l' for landscape)
var s=new jspdf.jsPDF({orientation:"p",unit:"px",format:[n,i]});// Calculate width and height to fit the PDF page
var u=s.internal.pageSize.getWidth();var d=i*u/n;s.addImage(r,"JPEG",0,0,u,d);s.save("invoice-".concat(o,".pdf"));t.classList.remove("is-loading")})})}})}};/************************************************************************/// The module cache
var e={};// The require function
function r(o){// Check if module is in cache
var n=e[o];if(n!==undefined){return n.exports}// Create a new module (and put it into the cache)
var a=e[o]={exports:{}};// Execute the module function
t[o](a,a.exports,r);// Return the exports of the module
return a.exports}/************************************************************************/// webpack/runtime/rspack_version
(()=>{r.rv=()=>"1.5.7"})();// webpack/runtime/rspack_unique_id
(()=>{r.ruid="bundler=rspack@1.5.7"})();/************************************************************************/// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(()=>{"use strict";// CONCATENATED MODULE: ./node_modules/@swc/helpers/esm/_async_to_generator.js
function t(t,e,r,o,n,a,i){try{var s=t[a](i);var u=s.value}catch(t){r(t);return}if(s.done)e(u);else Promise.resolve(u).then(o,n)}function e(e){return function(){var r=this,o=arguments;return new Promise(function(n,a){var i=e.apply(r,o);function s(e){t(i,n,a,s,u,"next",e)}function u(e){t(i,n,a,s,u,"throw",e)}s(undefined)})}};// CONCATENATED MODULE: ./assets/lib/tutor-formdata.js
/**
 * Creates FormData object from array of data objects
 * @deprecated This function is deprecated and will be removed in a future version
 * @param {Array} data - Array of objects to convert to FormData
 * @returns {FormData} FormData object with nonce data included
 */function o(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];var e=new FormData;t.forEach(t=>{for(var[r,o]of Object.entries(t)){e.set(r,o)}});e.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);return e}/* ESM default export */const n=o;// EXTERNAL MODULE: ./assets/react/download-invoice.js
var a=r(502);// CONCATENATED MODULE: ./assets/react/lib/ajax-handler.js
function i(t){return e(function*(){try{var e=yield fetch(window._tutorobject.ajaxurl,{method:"POST",body:t});return e}catch(t){tutor_toast(__("Operation failed","tutor-pro"),t,"error")}})()};// CONCATENATED MODULE: ./assets/react/license.js
window.addEventListener("DOMContentLoaded",function(){if(document.querySelector(".tutor-license-page-wrapper")){var t,r,o;var{__}=wp.i18n;// Hide and show license form
var a=document.getElementById("tutor-license-delete-button");var s=document.getElementById("tutor-license-edit-button");var u=document.getElementById("tutor-license-update-button");var d=document.getElementById("tutor-license-edit-cancel-button");var l=document.querySelector(".tutor-license-key-wrapper");var c=(t=document)===null||t===void 0?void 0:t.querySelector(".tutor-license-key-form-wrapper");var v=c===null||c===void 0?void 0:c.querySelector('input[type="text"]');var _=(r=document)===null||r===void 0?void 0:r.getElementById("tutor-common-confirmation-modal");var p=document.querySelectorAll("[data-tutor-modal-close]");var m=(o=document)===null||o===void 0?void 0:o.getElementById("tutor-license-remove-action");var f=document.getElementById("update-input-tutor-pro-license-key");s===null||s===void 0?void 0:s.addEventListener("click",function(t){t.preventDefault();l.classList.add("tutor-d-none");c.classList.remove("tutor-d-none");var e=f.value.length;f.setSelectionRange(e,e);f.focus()});m===null||m===void 0?void 0:m.addEventListener("click",t=>e(function*(){var e=t.currentTarget;var r=n([{action:"delete_tutor_license"}]);try{e.classList.add("is-loading");e.setAttribute("disabled",true);var o=yield i(r);var a=yield o.json();var s=(a===null||a===void 0?void 0:a.response)?a.response:__("Something went wrong!!","tutor-pro");if(200===a.status_code){tutor_toast(s,"","Success");location.href=a===null||a===void 0?void 0:a.url}else{tutor_toast(s,__("Please try again!","tutor-pro"),"error")}}catch(t){tutor_toast(__("Something went wrong","tutor-pro"),__("Please try again!!!","tutor-pro"),"error")}finally{e.removeAttribute("disabled");e.classList.remove("is-loading")}})());u===null||u===void 0?void 0:u.addEventListener("click",t=>e(function*(){t.preventDefault();var e=t.currentTarget;var r=f.value;if(!r||!r.trim().length||r.indexOf("*")>-1){tutor_toast(__("Please enter valid license key","tutor-pro"),"","error");return}var o=n([{action:"update_tutor_license",updated_license_key:r}]);try{e.classList.add("is-loading");e.setAttribute("disabled",true);var a=yield i(o);var s=yield a.json();var u=(s===null||s===void 0?void 0:s.response)?s.response:__("Something went wrong!!","tutor-pro");if(a.ok){if((s===null||s===void 0?void 0:s.status)==200){tutor_toast(u,"","success");location.href="".concat(_tutorobject.home_url,"/wp-admin/admin.php?page=tutor_settings&tab_page=license")}else{tutor_toast(u,"","error")}}else{tutor_toast(u,"","error")}}catch(t){tutor_toast(t,"","error")}finally{e.removeAttribute("disabled");e.classList.remove("is-loading")}})());d===null||d===void 0?void 0:d.addEventListener("click",function(){l.classList.remove("tutor-d-none");c.classList.add("tutor-d-none")});// Validate license form input and handle submit
var g=document.querySelector(".tutor-verify-license-wrapper");var y=document.getElementById("tutor-license-submit-btn");if(g&&y){y.addEventListener("click",function(t){return e(function*(){t.preventDefault();var e=g.querySelector('input[type="text"]');var r=e?e.value:"";if(!r||!r.trim().length||r.indexOf("*")>-1){tutor_toast(__("Failed","tutor-pro"),__("Please enter valid license key","tutor-pro"),"error");return}else{var o=n([{action:"tutor_oauth_check",license_key:r}]);var a=Object.fromEntries(o.entries());try{y.innerText="Verifying...";y.classList.add("is-loading");y.setAttribute("disabled",true);var s=yield i(o);var u=yield s.json();var d=(u===null||u===void 0?void 0:u.response)?u.response:__("Something went wrong!!","tutor-pro");if(200===u.status){tutor_toast(d,"","success");window.location.assign(u.body_response)}else{tutor_toast(d,__("Please try again!!","tutor-pro"),"error")}}catch(t){tutor_toast(__("Something went wrong","tutor-pro"),__("Please try again!!","tutor-pro"),"error")}finally{y.removeAttribute("disabled");y.classList.remove("is-loading");y.innerText="Verify License"}}})()})}}// Handle license form input enter key press
var h=document.querySelector(".tutor-option-tab-pages #license");if(h){h.addEventListener("keydown",function(t){// Prevent default enter key behavior for all inputs and buttons
if(t.key==="Enter"&&(t.target.tagName==="INPUT"||t.target.tagName==="BUTTON")){t.preventDefault()}})}});// CONCATENATED MODULE: ./assets/react/progress-reset.js
document.addEventListener("DOMContentLoaded",function(){var /**
     * Handle reset progress ajax
     * 
     * @since 3.9.0
     */t;var{__}=wp.i18n;var r=__("Something went wrong!","tutor-pro");/**
     * Handle reset progress modal open click
     * 
     * @since 3.9.0
     */var o=document.querySelectorAll(".tutor-reset-progress-btn");o.forEach(t=>{t.addEventListener("click",function(t){var e=document.querySelector("#tutor-reset-progress-modal .tutor-reset-progress-action");if(e){e.setAttribute("data-course_id",t.target.dataset.course_id);e.setAttribute("data-student_id",t.target.dataset.student_id)}})});(t=document.querySelector(".tutor-reset-progress-action"))===null||t===void 0?void 0:t.addEventListener("click",function(t){return e(function*(){var e=t.target;e.classList.add("is-loading");var o=n([{action:"tutor_reset_student_course_progress"},{course_id:e.dataset.course_id},{student_id:e.dataset.student_id}]);try{var a=yield i(o);var{status_code:s,message:u}=yield a.json();if(s===200){tutor_toast(__("Success","tutor-pro"),u,"success");window.location.reload()}else{tutor_toast(__("Failed","tutor-pro"),u,"error")}}catch(t){tutor_toast(__("Operation failed","tutor-pro"),r,"error")}finally{e.classList.remove("is-loading")}})()})});// CONCATENATED MODULE: ./assets/react/admin.js
jQuery(document).ready(function(t){"use strict";var{__}=wp.i18n;t(document).on("click",".install-tutor-button",function(e){e.preventDefault();var r=t(this);t.ajax({type:"POST",url:ajaxurl,data:{install_plugin:"tutor",action:"install_tutor_plugin"},beforeSend:function t(){r.addClass("is-loading")},success:function e(e){t(".install-tutor-button").remove();t("#tutor_install_msg").html(e)},complete:function t(){r.removeClass("is-loading")}})});/**
     * Import Sample Grade Data
     *
     * @since v.1.4.2
     */t(document).on("click","#import-gradebook-sample-data",function(e){e.preventDefault();var r=t(this);t.ajax({type:"POST",url:ajaxurl,data:{action:"import_gradebook_sample_data"},beforeSend:function t(){r.addClass("is-loading")},success:function t(t){if(t.success){location.reload()}},complete:function t(){r.removeClass("is-loading")}})});/**
     * Hide cron frequency on wp cron disabling
     * @since v.1.8.7
     */t('[name="tutor_option[tutor_email_disable_wpcron]"]').change(function(){t('[name="tutor_option[tutor_email_cron_frequency]"]').closest(".tutor-option-field-row")[!t(this).prop("checked")?"show":"hide"]()}).trigger("change");/**
     * From Admin clear active session of a student
     *
     * @since 2.1.10
     */if(_tutorobject.current_page==="tutor-students"){var r=document.querySelectorAll(".tutor-clear-sessions");r.forEach(t=>{t.onclick=t=>e(function*(){var e=t.target;var r=t.target.dataset.studentId;var o=n([{user_id:r,action:"tutor_clear_active_sessions"}]);try{e.classList.add("is-loading");e.setAttribute("disabled",true);var a=yield i(o);var s=yield a.json();var{success:u,data:d}=s;if(u){tutor_toast(__("Success","tutor-pro"),d,"success")}else{tutor_toast(__("Failed","tutor-pro"),d,"error");e.removeAttribute("disabled")}}catch(t){tutor_toast(__("Something went wrong","tutor-pro"),__("Please try again after reloading page!","tutor-pro"),"error");e.removeAttribute("disabled")}finally{e.classList.remove("is-loading")}})()})}/**
     * On course completion mode change toggle video lesson completion options.
     * 
     * @since 2.2.4
     */if(_tutorobject.current_page==="tutor_settings"){var o=t("#field_control_video_lesson_completion,#field_required_percentage_to_complete_video_lesson");var a=t("#field_course_completion_process input:checked").val();if(a==="flexible"){o.hide()}t("#field_course_completion_process input").change(function(){if(t(this).val()==="flexible"){o.hide()}else{o.show()}});t(".tutor-option-form .tutor-thumbnail-uploader").on("tutor_settings_media_selected",function(t){if(t.detail.settingsName==="email_template_bg"){var{width:e,height:r}=t.detail.attachment;var o=t.detail.wrapper;if(e!==602||r!==124){o.find("span.delete-btn").click();tutor_toast(__("Failed","tutor-pro"),__("The image dimensions need to be 602x124px","tutor-pro"),"error")}}});var s=t("#field_email_disable_banner input.tutor-form-toggle-input"),u=t("#field_email_template_bg");if(s){if(s.is(":checked")){u.removeClass("tutor-d-block").hide()}s.change(function(){if(s.is(":checked")){u.removeClass("tutor-d-block").hide()}else{u.addClass("tutor-d-block")}})}}if(_tutorobject.current_page==="tutor-instructors"){/**
         * Commission amount input hide/show handler
         *
         * @since 2.4.0
         */t("select.edit_commission_type").change(function(){var e=t(this).val();var r=e==="default"?"hide":"show";var o=t(this).parent().parent().next(".edit_commission_amount_field");o[r]();if(r==="show"){o.find('input[name="instructor_amount"]').eq(0).focus()}});/**
         * Instructor profile edit form submit handler
         * 
         * @since 2.3.1
         */t(document).on("submit","form.tutor-instructor-edit-modal",function(e){e.preventDefault();var r=t(this);var o=r.serializeObject();var n=r.find("[data-tutor-modal-submit]");var a=r.find("div.tutor-form-response").eq(0);o.action="tutor_update_instructor_data";t.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:o,beforeSend:function t(){n.attr("disabled","disable").addClass("is-loading");a.html("")},success:function t(t){if(!t.success){var e;if(t===null||t===void 0?void 0:(e=t.data)===null||e===void 0?void 0:e.errors){for(var o of Object.values(t.data.errors)){a.append('\n                                    <div class=\'tutor-col\'>\n                                        <div class="tutor-alert tutor-warning">\n                                        <div class="tutor-alert-text">\n                                            <span class="tutor-alert-icon tutor-icon-circle-info tutor-mr-8"></span>\n                                            <span>'.concat(o,"</span>\n                                        </div>\n                                        </div>\n                                    </div>\n                                    "))}}}else{r.trigger("reset");tutor_toast(__("Success","tutor-pro"),__("Instructor data updated!","tutor-pro"),"success");location.reload()}},complete:function t(){n.removeAttr("disabled").removeClass("is-loading")}})})}// end tutor-instructors page
})})()})();