(()=>{var e={42242:function(){/**
 * Color PRESET and PICKER manipulation
 */(()=>{var e=document.querySelectorAll("label.color-preset-input input[type='radio']");var t=document.querySelectorAll("label.color-picker-input input[type='color']");var r=document.querySelectorAll("label.color-picker-input input[type='text']");var o=document.querySelectorAll(".color-picker-wrapper [data-key]");// Color PRESET selection (color inputs)
if(e){e.forEach(e=>{var t=e.parentElement.querySelector(".preset-item");var r=t.querySelectorAll(".header span");var a=e.closest(".color-preset-input");var n=a.parentElement.querySelectorAll("label.color-preset-input");// listening preset input events
if(e.checked){a.classList.add("is-checked")}e.addEventListener("input",e=>{n.forEach(e=>e.classList.remove("is-checked"));a.classList.add("is-checked");r.forEach(e=>{var t=e.dataset.preset;var r=e.dataset.color;o.forEach(e=>{var o=e.dataset.key;if(o==t){e.querySelectorAll("input").forEach(e=>e.value=r);e.style.borderColor=r;e.style.boxShadow="inset 0 0 0 1px ".concat(r);setTimeout(()=>{e.style.borderColor="#cdcfd5";e.style.boxShadow="none"},5e3)}})})})})}// Updating Custom Color PRESET
var a=e=>{var r=document.querySelector("label.color-preset-input[for='tutor_preset_custom']");// listening picker input events
e.addEventListener("input",function(o){var a=r&&r.querySelectorAll(".header span");var n=r&&r.querySelector('input[type="radio"]');var i=e.nextElementSibling;i.value=e.value;if(a){t.forEach(e=>{var t=e.dataset.picker;a.forEach(r=>{if(r.dataset.preset==t){r.dataset.color=e.value;r.style.backgroundColor=e.value}});n.checked=true})}})};// listening color pickers input event
if(t){t.forEach(e=>{a(e)})}if(r){r.forEach(e=>{e.addEventListener("input",function(t){if(t.target.value.length===7){e.previousElementSibling.value=t.target.value;e.previousElementSibling.dispatchEvent(new Event("input",{bubbles:true}))}})})}})()},45397:function(){/**
 * Consent logs modal functionality for students and instructors.
 *
 * @since 4.0.0
 */var e,t,r;var o=window.ajaxurl||((e=window._tutorobject)===null||e===void 0?void 0:e.ajaxurl)||"";var a="tutor_user_consents";var n=((t=window._tutorobject)===null||t===void 0?void 0:t.nonce_key)||"_tutor_nonce";var i=((r=window._tutorobject)===null||r===void 0?void 0:r[n])||"";var s=document.getElementById("tutor-consent-logs-modal");var l=s===null||s===void 0?void 0:s.querySelector(".tutor-consent-logs-modal-body");var c=s===null||s===void 0?void 0:s.querySelector("[data-consent-logs-download]");var u=s===null||s===void 0?void 0:s.querySelector(".tutor-consent-user-card-name");var d=s===null||s===void 0?void 0:s.querySelector(".tutor-consent-user-card-joined");var v=s===null||s===void 0?void 0:s.querySelector(".tutor-consent-user-card img");// Current open state.
var p=0;var m="";var f="";var _="";var g="";var h=[];var{__}=wp.i18n;/**
 * Build a human-readable title from the consent log.
 *
 * @param log - The consent log object
 * @param includeAccepted - Whether to prefix the title with "Accepted"
 * @returns A human-readable title string
 */var y=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:true;if(e.consent_title){return t?"".concat(__("Accepted","tutor")," ").concat(e.consent_title):e.consent_title}return t?__("Accepted Consent","tutor"):__("Consent","tutor")};var b=e=>{var t=e.map((e,t)=>{var r=y(e);var o=e.created_at_gmt||"";var a=e.timeAgo||e.time_ago||"";var n=e.ip_address?"IP: ".concat(e.ip_address):"";var i=e.source?"Source: ".concat(e.source):"";var s=e.user_agent?"Agent: ".concat(e.user_agent):"";var l=[n,i,s].filter(Boolean);return'\n                <div class="tutor-consent-timeline-item">\n                    <div class="tutor-consent-timeline-track">\n                        <span class="tutor-consent-timeline-dot"></span>\n                    </div>\n                    <div class="tutor-consent-timeline-content">\n                        <p class="tutor-consent-timeline-title">'.concat(r,'</p>\n                        <p class="tutor-consent-timeline-date">').concat(o,"</p>\n                        ").concat(l.length?'<div class="tutor-consent-timeline-meta">'.concat(l.join("<br>"),"</div>"):"",'\n                    </div>\n                    <div class="tutor-consent-timeline-ago">').concat(a,"</div>\n                </div>\n            ")});return t.join("")};var w=()=>{if(!l)return;l.innerHTML='<div class="tutor-d-flex tutor-align-center tutor-justify-center tutor-py-48 tutor-color-muted tutor-fs-6">'.concat(__("Loading…","tutor"),"</div>");if(c)c.style.display="none"};var S=()=>{if(!l)return;l.innerHTML='<div class="tutor-d-flex tutor-align-center tutor-justify-center tutor-py-48 tutor-color-muted tutor-fs-6">'.concat(__("No consent logs found.","tutor"),"</div>");if(c)c.style.display="none"};var E=(e,t,r,y,E,L)=>{if(!s||!l)return;p=e;m=t;f=r;_=E;g=L;// Show loading state and hide download button.
w();// Fill user card.
if(u)u.textContent=t;if(d)d.textContent=r?"".concat(__("Joined","tutor")," ").concat(r):"";if(v&&y)v.src=y;var k=new FormData;k.append("action",a);k.append("user_action","all_consents_given_by_user");k.append("user_id",e);k.append(n,i);fetch(o,{method:"POST",body:k}).then(e=>e.json()).then(e=>{var o=e.data;h=o;if(!o.length){S();return}var a='\n                    <div class="tutor-consent-user-card">\n                        '.concat(y?'<img src="'.concat(y,'" alt="').concat(t,'" />'):"",'\n                        <div class="tutor-consent-user-card-info">\n                            <span class="tutor-consent-user-card-name">').concat(t,'</span>\n                            <span class="tutor-consent-user-card-joined">').concat(r?"".concat(__("Joined","tutor")," ").concat(r):"","</span>\n                        </div>\n                    </div>\n                ");l.innerHTML='\n                    <div class="tutor-consent-timeline">'.concat(b(o),"</div>\n                    ").concat(a,"\n                ");if(c)c.style.display=""}).catch(()=>S())};var L=()=>{if(!h.length)return;var e=[["Name:",m],["User Name:",g],["Email:",_],["Joined At:",f],[]];var t=["Title","Date (UTC)","IP Address","Source","User Agent"];var r=h.map(e=>[y(e,false),e.created_at_gmt||"",e.ip_address||"",e.source||"",e.user_agent||""]);var o=e=>'"'.concat(String(e).replace(/"/g,'""'),'"');var a=[...e,t,...r].map(e=>e.map(o).join(",")).join("\n");var n=new Blob([a],{type:"text/csv;charset=utf-8;"});var i=URL.createObjectURL(n);var s=document.createElement("a");s.href=i;s.download="consent-logs-".concat(m,".csv");s.click();URL.revokeObjectURL(i)};var k=()=>{document.querySelectorAll("[data-consent-logs-trigger]").forEach(e=>{e.addEventListener("click",()=>{// Hide download button immediately before modal opens.
if(c)c.style.display="none";var t=e.dataset.userId||"";var r=e.dataset.userName||"";var o=e.dataset.userJoined||"";var a=e.dataset.avatarSrc||"";var n=e.dataset.userEmail||"";var i=e.dataset.userLogin||"";E(t,r,o,a,n,i)})})};if(c)c.addEventListener("click",L);document.addEventListener("DOMContentLoaded",k)},76431:function(){(function(){"use strict";h()})();/**
 * Toggle disable input fields
 * Selecetor -> .tutor-option-single-item.monetization-fees
 */var e=document.querySelector(".monetization-fees");var t=document.querySelector(".monetization-fees input[name=deduct-fees]");if(e&&t){window.addEventListener("load",()=>r(t,e));t.addEventListener("change",()=>r(t,e))}var r=(t,r)=>{if(t.checked){r.classList.remove("is-disable");o(e,false)}else{r.classList.add("is-disable");o(e,true)}};var o=(e,t)=>{var r=e.querySelectorAll(".tutor-option-field-row:nth-child(2) textarea, .tutor-option-field-row:nth-child(3) select, .tutor-option-field-row:nth-child(3) input");r.forEach(e=>e.disabled=t)};/**
 * Image Preview : Logo and Signature Upload
 * Selector -> .tutor-option-field-input.image-previewer
 */var a=document.querySelectorAll(".image-previewer");var n=document.querySelectorAll(".image-previewer img");var i=document.querySelectorAll(".image-previewer input[type=file]");var s=document.querySelectorAll(".image-previewer .delete-btn");if(i&&s){// Checking Img Src when document loads
document.addEventListener("DOMContentLoaded",()=>{a.forEach(e=>{n.forEach(t=>{if(t.getAttribute("src")){t.closest(".image-previewer").classList.add("is-selected")}else{e.classList.remove("is-selected")}})})});// Updating Image Preview
i.forEach(e=>{e.addEventListener("change",function(t){var r=this.files[0];var o=e.closest(".image-previewer");var a=o.querySelector("img");var n=o.querySelector(".preview-loading");if(r){n.classList.add("is-loading");l(r,a);o.classList.add("is-selected");setTimeout(()=>{n.classList.remove("is-loading")},200)}})});// Deleting Image Preview
s.forEach(e=>{e.addEventListener("click",function(e){var t=this.closest(".image-previewer");var r=t.querySelector("img");r.setAttribute("src","");t.classList.remove("is-selected")})})}// Get Image file as Data URL
var l=(e,t)=>{var r=new FileReader;r.onload=function e(){t.setAttribute("src",this.result)};r.readAsDataURL(e)};/**
 * Sharing Percentage : Monitization > Option
 */var c=document.querySelector("input[type=number]#revenue-instructor");var u=document.querySelector("input[type=number]#revenue-admin");var d=document.querySelectorAll(".revenue-percentage input[type=number]");var v=document.getElementById("save_tutor_option");var p=e=>{setTimeout(()=>{if(v)v.disabled=true},e)};if(c&&u&&d){c.addEventListener("input",e=>{var{__,_x:t,_n:r,_nx:o}=wp.i18n;if(e.target.value<=100){u.value=100-e.target.value}else{u.value=0;tutor_toast(__("Error","tutor"),__("Amount must be less than 100","tutor"),"error");p(50)}});u.addEventListener("input",e=>{var{__,_x:t,_n:r,_nx:o}=wp.i18n;if(e.target.value<=100){c.value=100-e.target.value}else{c.value=0;tutor_toast(__("Error","tutor"),__("Amount must be less than 100","tutor"),"error");p(50)}})}/**
 * Copy to clipboard : Email > Server Cron
 */var m=document.querySelector(".input-field-code textarea");var f=document.querySelector(".code-copy-btn");if(f&&m){f.addEventListener("click",function(e){e.preventDefault();this.focus();m.select();document.execCommand("copy");var t=this.innerHTML;setTimeout(()=>{this.innerHTML=t},3e3);// @todo: remove las icon
this.innerHTML='\n			<span class="tutor-btn-icon las la-clipboard-list"></span>\n			<span>Copied to Clipboard!</span>\n		'})}/**
 * Drag and Drop files -> Import/Export > .import-setting
 */var _=document.querySelectorAll(".drag-drop-zone input[type=file]");_.forEach(e=>{var t=e.closest(".drag-drop-zone");["dragover","dragleave","dragend"].forEach(e=>{if(e==="dragover"){t.addEventListener(e,e=>{e.preventDefault();t.classList.add("dragover")})}else{t.addEventListener(e,e=>{t.classList.remove("dragover")})}});t.addEventListener("drop",r=>{r.preventDefault();var o=r.dataTransfer.files;g(o,e,t);t.classList.remove("dragover")});e.addEventListener("change",r=>{var o=r.target.files;g(o,e,t)})});var g=(e,t,r)=>{if(e.length){t.files=e;r.classList.add("file-attached");r.querySelector(".file-info").innerHTML="File attached - ".concat(e[0].name)}else{r.classList.remove("file-attached");r.querySelector(".file-info").innerHTML=""}};/**
 * Tooltip direction change on smaller devices -> .tooltip-right
 */function h(){var e=window.matchMedia("(max-width: 992px)");var t=document.querySelectorAll(".tooltip-responsive");if(t.length){if(e.matches){var r=document.querySelectorAll(".tooltip-right");r.forEach(e=>{e.classList.replace("tooltip-right","tooltip-left")})}else{var o=document.querySelectorAll(".tooltip-left");o.forEach(e=>{e.classList.replace("tooltip-left","tooltip-right")})}}}window.addEventListener("resize",h)},34168:function(){var{__}=wp.i18n;var e={legalConsentPage:"legal_consents",headerSaveButton:"save_tutor_option",tutorOptionForm:"tutor-option-form",tabLinks:"[tutor-option-tabs] a",tabPages:".tutor-option-nav-page",nonceInput:'input[name="_tutor_nonce"]',legalConsentsContainer:"[data-legal-consents]",consentList:"[data-consent-list]",consentTemplate:"[data-consent-template]",consentCard:"[data-consent-card]",consentEmptyState:"[data-consent-empty-state]",consentFooter:"[data-consent-footer]",addConsent:"[data-add-consent]",consentTitleDisplay:"[data-consent-title]",consentTitleInput:"[data-consent-title-input]",consentEnabled:"[data-consent-enabled]",consentEnabledHidden:"[data-consent-enabled-hidden]",consentToggleButton:"[data-consent-toggle]",consentDeleteButton:"[data-consent-delete]",consentCancelButton:"[data-consent-cancel]",consentSaveButton:"[data-consent-save]",consentMessageTextarea:'textarea[name="consent_message"]',consentMethodSelect:'select[name="consent_method"]',displayOnCheckboxes:'[name="display_on[]"]',pageDropdownToggle:"[data-page-dropdown-toggle]",pageDropdown:"[data-page-dropdown]",pageButton:"[data-page-btn]"};var t={active:"is-active",collapsed:"is-collapsed",loading:"is-loading"};var r={expanded:"aria-expanded"};var o={consentId:"consentId",nextIndex:"nextIndex",pageKey:"pageKey"};var a={legalConsents:"tutor_gdpr_legal_consents"};var n={create:"create",update:"update",delete:"delete"};var i={action:"action",crudAction:"crud_action",nonce:"_tutor_nonce",id:"id",title:"consent_title",message:"consent_message",displayOn:"display_on",method:"consent_method",consentMap:"consent_map",isActive:"is_active"};var s=__("Consent Title","tutor");var l=/\{([a-zA-Z0-9_-]+)\}/g;var c="__INDEX__";var u="tutor_option_saved";var d=()=>{var t;return((t=document.querySelector(e.nonceInput))===null||t===void 0?void 0:t.value)||""};var v=()=>document.getElementById(e.legalConsentPage);var p=()=>document.getElementById(e.headerSaveButton);var m=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"success";if(typeof window.tutor_toast==="function"){window.tutor_toast(e,t,r)}};var f=(e,t)=>{if(typeof(e===null||e===void 0?void 0:e.message)==="string"&&e.message.length){return e.message}if(typeof(e===null||e===void 0?void 0:e.data)==="string"&&e.data.length){return e.data}return t};var _=e=>{var t;var r=e===null||e===void 0?void 0:(t=e.data)===null||t===void 0?void 0:t.validation_error;if(!r||typeof r!=="object"){return null}return Object.entries(r).map(e=>{var[t,r]=e;return"".concat(t,": ").concat(r)}).join("\n")};var g=e=>Boolean((e===null||e===void 0?void 0:e.success)===true||typeof(e===null||e===void 0?void 0:e.status_code)==="number"&&e.status_code>=200&&e.status_code<300);var h=()=>{var e=v();return!!e&&e.classList.contains(t.active)};var y=()=>{var r=v();var o=p();if(!r||!o){return}var a=o.classList.contains(t.loading);r.querySelectorAll(e.consentSaveButton).forEach(e=>{e.classList.toggle(t.loading,a)})};var b=()=>{var e=p();if(!e){return}e.style.display=h()?"none":""};var w=()=>{var e=p();if(!e){return}e.removeAttribute("disabled");y()};var S=(t,r)=>{var o=t.querySelector(e.consentTitleDisplay);if(o){o.textContent=r.trim()||s}};var E=t=>{var r=t===null||t===void 0?void 0:t.querySelector(e.consentList);var o=t===null||t===void 0?void 0:t.querySelector(e.consentEmptyState);var a=t===null||t===void 0?void 0:t.querySelector(e.consentFooter);if(!r||!o){return}var n=r.querySelectorAll(e.consentCard).length>0;o.hidden=n;if(a){a.hidden=!n}};var L=t=>{var r,o,a,n;return{title:((r=t.querySelector(e.consentTitleInput))===null||r===void 0?void 0:r.value)||"",enabled:Boolean((o=t.querySelector(e.consentEnabled))===null||o===void 0?void 0:o.checked),message:((a=t.querySelector(e.consentMessageTextarea))===null||a===void 0?void 0:a.value)||"",method:((n=t.querySelector(e.consentMethodSelect))===null||n===void 0?void 0:n.value)||"",displayOn:Array.from(t.querySelectorAll(e.displayOnCheckboxes)).filter(e=>e.checked).map(e=>e.value).sort(),consentMap:k(t)}};var k=t=>{var r;var a=((r=t.querySelector(e.consentMessageTextarea))===null||r===void 0?void 0:r.value)||"";var n=new Set(Array.from(a.matchAll(l),e=>e[1]));var i={};t.querySelectorAll(e.pageButton).forEach(e=>{var t=e.dataset[o.pageKey];if(t&&n.has(t)){i[t]=e.value}});return i};var q=(e,t)=>{if(!e||!t){return false}return e.title===t.title&&e.enabled===t.enabled&&e.message===t.message&&e.method===t.method&&JSON.stringify(e.displayOn)===JSON.stringify(t.displayOn)&&JSON.stringify(e.consentMap)===JSON.stringify(t.consentMap)};var C=e=>Boolean(e.title.trim()&&e.message.trim()&&e.method&&e.displayOn.length>0);var x=(t,r)=>{var o=t.querySelector(e.consentTitleInput);var a=t.querySelector(e.consentEnabled);var n=t.querySelector(e.consentEnabledHidden);var i=t.querySelector(e.consentMessageTextarea);var s=t.querySelector(e.consentMethodSelect);if(o){o.value=r.title||"";S(t,o.value)}if(a){a.checked=Boolean(r.enabled)}if(n){n.value=r.enabled?"on":"off"}if(i){i.value=r.message||"";i.dispatchEvent(new Event("input",{bubbles:true}))}if(s){s.value=r.method||s.value}t.querySelectorAll(e.displayOnCheckboxes).forEach(e=>{e.checked=r.displayOn.includes(e.value)})};var A=(r,o)=>{var a=r.querySelector(e.consentSaveButton);if(!a||a.classList.contains(t.loading)){return}a.disabled=q(L(r),o)};var j=(r,o)=>{var a=r.querySelector(e.consentCancelButton);if(!a||a.classList.contains(t.loading)){return}a.disabled=q(L(r),o)};var T=(a,n)=>{if(0===Number(a.dataset[o.consentId]||0)){return}a.classList.toggle(t.collapsed,n);var i=a.querySelector(e.consentToggleButton);if(i){i.setAttribute(r.expanded,String(!n))}};var I=(e,t)=>{if(!e){return}e.hidden=true;if(t){t.setAttribute(r.expanded,"false")}};var D=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:document,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;t.querySelectorAll(e.pageDropdown).forEach(t=>{var o;if(t===r){return}I(t,(o=t.parentElement)===null||o===void 0?void 0:o.querySelector(e.pageDropdownToggle))})};var O=(t,a)=>{var n;var i=(n=t.querySelector(e.pageDropdownToggle))===null||n===void 0?void 0:n.closest(".tutor-option-field-input");var s=i===null||i===void 0?void 0:i.querySelector(e.pageDropdownToggle);var l=i===null||i===void 0?void 0:i.querySelector(e.pageDropdown);var c=i===null||i===void 0?void 0:i.querySelector(e.consentMessageTextarea);var u=(i===null||i===void 0?void 0:i.querySelectorAll(e.pageButton))||[];if(!i||!s||!l||!c){return}var d=()=>{u.forEach(e=>{var t=e.dataset[o.pageKey]||"";var r=t?"{".concat(t,"}"):"";var a=Boolean(r&&c.value.includes(r));e.disabled=a;e.classList.toggle("is-selected",a)})};s.addEventListener("click",o=>{o.stopPropagation();var a=l.hidden;D(t.closest(e.legalConsentsContainer)||document,a?l:null);l.hidden=!a;s.setAttribute(r.expanded,String(a))});u.forEach(e=>{e.addEventListener("click",()=>{var t=e.dataset[o.pageKey];if(!t){return}var r="{".concat(t,"}");var a=c.value.trim();if(!a.includes(r)){c.value=a?"".concat(a," ").concat(r):r;c.dispatchEvent(new Event("input",{bubbles:true}))}d();I(l,s)})});c.addEventListener("input",()=>{d();a()});d()};var M=e=>{var{card:t,consentId:r,enabledInput:o,savedState:s}=e;var l=L(t);var c=new FormData;c.append(i.action,a.legalConsents);c.append(i.crudAction,r?n.update:n.create);c.append(i.nonce,d());if(r){c.append(i.id,String(r))}var u={[i.title]:l.title,[i.message]:l.message,[i.displayOn]:l.displayOn.join(","),[i.method]:l.method,[i.consentMap]:JSON.stringify(l.consentMap),[i.isActive]:(o===null||o===void 0?void 0:o.checked)?"1":"0"};if(!r){Object.entries(u).forEach(e=>{var[t,r]=e;c.append(t,r)});return c}var v=s.displayOn.join(",");var p=JSON.stringify(s.consentMap);if(u[i.title]!==s.title){c.append(i.title,u[i.title])}if(u[i.message]!==s.message){c.append(i.message,u[i.message])}if(u[i.displayOn]!==v){c.append(i.displayOn,u[i.displayOn])}if(u[i.method]!==s.method){c.append(i.method,u[i.method])}if(u[i.consentMap]!==p){c.append(i.consentMap,u[i.consentMap])}if(u[i.isActive]!==(s.enabled?"1":"0")){c.append(i.isActive,u[i.isActive])}return c};var B=e=>{var{card:r,consentId:o,deleteButton:s,onSuccess:l=()=>{}}=e;var c=new FormData;c.append(i.action,a.legalConsents);c.append(i.crudAction,n.delete);c.append(i.nonce,d());c.append(i.id,String(o));s.classList.add(t.loading);s.disabled=true;fetch(ajaxurl,{method:"POST",body:c}).then(e=>e.json()).then(e=>{if(g(e)){r.remove();l();m(__("Success","tutor"),f(e,__("Legal consent deleted successfully.","tutor")),"success");return}m(__("Failed","tutor"),f(e,__("Failed to delete legal consent.","tutor")),"error")}).catch(()=>{m(__("Failed","tutor"),__("Failed to delete legal consent.","tutor"),"error")}).finally(()=>{s.classList.remove(t.loading);s.disabled=false})};var F=e=>{var{consentId:t,enabledInput:r,enabledHiddenInput:o,onSuccess:s}=e;var l=new FormData;l.append(i.action,a.legalConsents);l.append(i.crudAction,n.update);l.append(i.nonce,d());l.append(i.id,String(t));l.append(i.isActive,r.checked?"1":"0");r.disabled=true;fetch(ajaxurl,{method:"POST",body:l}).then(e=>e.json()).then(e=>{if(g(e)){s();m(__("Success","tutor"),f(e,__("Legal consent updated successfully.","tutor")),"success");return}r.checked=!r.checked;o.value=r.checked?"on":"off";m(__("Failed","tutor"),f(e,__("Failed to update legal consent.","tutor")),"error")}).catch(()=>{r.checked=!r.checked;o.value=r.checked?"on":"off";m(__("Failed","tutor"),__("Failed to update legal consent.","tutor"),"error")}).finally(()=>{r.disabled=false})};var N=e=>{var{card:r,consentId:o,saveButton:a,enabledInput:n,savedState:i,onSuccess:s}=e;var l=L(r);if(!C(l)){m(__("Error","tutor"),__("Please fill all the required fields.","tutor"),"error");return}var c=M({card:r,consentId:o,enabledInput:n,savedState:i});a.classList.add(t.loading);a.disabled=true;fetch(ajaxurl,{method:"POST",body:c}).then(e=>e.json()).then(e=>{if(g(e)){var r;a.classList.remove(t.loading);s(Number((e===null||e===void 0?void 0:(r=e.data)===null||r===void 0?void 0:r.id)||0));m(__("Success","tutor"),f(e,__("Legal consent saved successfully.","tutor")),"success");return}var o=_(e);var n=o||f(e,__("Failed to save legal consent.","tutor"));m(__("Failed","tutor"),n,"error");a.classList.remove(t.loading);a.disabled=false}).catch(()=>{m(__("Failed","tutor"),__("Failed to save legal consent.","tutor"),"error");a.classList.remove(t.loading);a.disabled=false})};var P=r=>{var a;var n=r.querySelector(e.consentTitleInput);var i=r.querySelector(e.consentEnabled);var s=r.querySelector(e.consentEnabledHidden);var l=r.querySelector(e.consentToggleButton);var c=r.querySelector(e.consentDeleteButton);var u=r.querySelector(e.consentCancelButton);var d=r.querySelector(e.consentSaveButton);var v=r.closest(e.legalConsentsContainer);var p=Number(r.dataset[o.consentId]||0);var f=L(r);A(r,f);j(r,f);var _=()=>{w();A(r,f);j(r,f)};n===null||n===void 0?void 0:n.addEventListener("input",e=>{S(r,e.target.value);_()});if(i&&s){i.addEventListener("change",()=>{s.value=i.checked?"on":"off";if(!p){_();return}F({consentId:p,enabledInput:i,enabledHiddenInput:s,onSuccess:()=>{f=L(r);A(r,f)}})})}r.querySelectorAll(e.displayOnCheckboxes).forEach(e=>{e.addEventListener("change",_)});(a=r.querySelector(e.consentMethodSelect))===null||a===void 0?void 0:a.addEventListener("change",_);l===null||l===void 0?void 0:l.addEventListener("click",()=>{if(l.disabled){return}T(r,!r.classList.contains(t.collapsed))});c===null||c===void 0?void 0:c.addEventListener("click",()=>{var e=document.getElementById("tutor-legal-consent-delete-modal");var t=document.getElementById("tutor-legal-consent-confirm-delete");if(!e||!t){if(!p){r.remove();m(__("Success","tutor"),__("Legal consent removed.","tutor"),"success");E(v);w();return}B({card:r,consentId:p,deleteButton:c,onSuccess:()=>E(v)});return}e.classList.add("tutor-is-active");var o=t.cloneNode(true);t.parentNode.replaceChild(o,t);o.addEventListener("click",()=>{var t=e.querySelector("[data-tutor-modal-close]");if(!p){t===null||t===void 0?void 0:t.click();r.remove();m(__("Success","tutor"),__("Legal consent removed.","tutor"),"success");E(v);w();return}B({card:r,consentId:p,deleteButton:o,onSuccess:()=>{t===null||t===void 0?void 0:t.click();E(v)}})})});u===null||u===void 0?void 0:u.addEventListener("click",()=>{x(r,f);A(r,f);j(r,f)});d===null||d===void 0?void 0:d.addEventListener("click",()=>{N({card:r,consentId:p,saveButton:d,enabledInput:i,savedState:f,onSuccess:e=>{if(!p&&e){p=e;r.dataset[o.consentId]=String(e);if(l){l.disabled=false}if(i){i.disabled=false}}T(r,true);f=L(r);A(r,f);j(r,f)}})});O(r,_)};var H=t=>{var r;var a=t.querySelector(e.consentTemplate);var n=t.querySelector(e.consentList);if(!a||!n){return}var i=Number(t.dataset[o.nextIndex]||n.children.length||0);var s=a.innerHTML.replaceAll(c,String(i));var l=document.createElement("div");l.innerHTML=s.trim();var u=l.firstElementChild;if(!u){return}n.appendChild(u);t.dataset[o.nextIndex]=String(i+1);P(u);S(u,((r=u.querySelector(e.consentTitleInput))===null||r===void 0?void 0:r.value)||"");E(t);w()};var R=()=>{var t=v();if(!t){return}var r=t.querySelector(e.legalConsentsContainer);if(!r){return}var a=r.querySelectorAll(e.consentCard);r.dataset[o.nextIndex]=String(a.length);a.forEach(t=>{var r;P(t);S(t,((r=t.querySelector(e.consentTitleInput))===null||r===void 0?void 0:r.value)||"")});E(r);r.querySelectorAll(e.addConsent).forEach(e=>{e.addEventListener("click",()=>{H(r)})});document.addEventListener("click",t=>{var o=t.target;if(!(o instanceof Element)){return}if(!o.closest(e.pageDropdown)&&!o.closest(e.pageDropdownToggle)){D(r)}});b();y();var n=p();if(n){var i=new MutationObserver(()=>{b();y()});i.observe(n,{attributes:true,attributeFilter:["disabled","class","style"]})}document.querySelectorAll(e.tabLinks).forEach(e=>{e.addEventListener("click",()=>{window.setTimeout(()=>{b();y()},0)})});var s=document.getElementById(e.tutorOptionForm);s===null||s===void 0?void 0:s.addEventListener("input",y);s===null||s===void 0?void 0:s.addEventListener("change",y);window.addEventListener(u,y);var l=new MutationObserver(()=>{b();y()});document.querySelectorAll(e.tabPages).forEach(e=>{l.observe(e,{attributes:true,attributeFilter:["class"]})})};document.addEventListener("DOMContentLoaded",R)},480:function(){// this function will load after document content load
window.readyState_complete=e=>{var t=e=>e();document.addEventListener("readystatechange",r=>r.target.readyState==="complete"?typeof e=="function"?setTimeout(()=>t(e)):"":"")};window.addBodyClass=e=>{// History push
var t=new URL(e);var r=t.searchParams.get("tab_page");var o=t.searchParams.get("edit")&&"_edit";document.body.classList.add(r);document.body.classList.add(r+o)};window.selectorById=e=>{return document.getElementById(e)};window.selectorByClass=e=>{return document.getElementsByClassName(e)};/**
 * Function to download json file
 * @param {json} response
 * @param {string} fileName
 */window.json_download=(e,t)=>{var r=new Blob([e],{type:"application/json"});var o=document.createElement("a");o.href=URL.createObjectURL(r);o.download=t;o.click()}},77867:function(){var e=e=>{var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())};var t=document.querySelectorAll(".multiple_email_input");t.forEach(t=>{var r=t.value.split(",");var o="";r.forEach(e=>{// console.log(arrItem.trim());
o+='<span class="item_email">'+e.trim()+'<span class="delete tutor-icon-line-cross-line"></span></span>'});t.insertAdjacentHTML("beforebegin",'<div class="receipient_input">'+o+'<input type="email" placeholder="add receipient..."></div>');// inputReceipient.onchange
var a=t.previousElementSibling.querySelector("input[type=email]");setTimeout(()=>{console.log(t.previousElementSibling.querySelectorAll(".item_email"));t.previousElementSibling.querySelectorAll(".item_email").forEach(e=>{e.querySelector(".delete").onclick=()=>{console.log(e);e.remove()};e.addEventListener("dblclick",function(t){a.value=e.innerText;e.remove();a.focus()})});a.addEventListener("keyup",function(e){});a.addEventListener("keydown",function(r){var o=r.key;// const {key} = event; ES6+
a.classList.remove("invalid");if(r.keyCode===32){tutor_toast("Invalid","Space is not allowed!","warning");r.preventDefault()}if(o==="Backspace"){if(""===a.value){a.previousElementSibling.remove()}}if(o==="Enter"||o==="Tab"||r.keyCode===188){if(false===e(a.value)){tutor_toast("Invalid","Invalid email","warning");r.preventDefault();a.focus();a.classList.add("invalid");return false}else{// console.log(inputReceipient.value);
t.value+=","+a.value;console.log(a.value);a.insertAdjacentHTML("beforebegin",'<span class="item_email">'+a.value+'<span class="delete tutor-icon-line-cross-line"></span></span>');a.style.borderColor="transparent";a.value="";tutor_toast("Success","Valid email","success");r.preventDefault();a.focus();return false}}})},10)})},88441:function(){/**
 * Navigation tab
 */var e=document.querySelectorAll("[tutor-option-tabs]");var t=document.querySelectorAll("[tutor-option-tabs] li > a");var r=document.querySelectorAll(".tutor-option-nav-page");function o(){if(document.getElementById("save_tutor_option")){document.getElementById("save_tutor_option").disabled=false}}readyState_complete(()=>{var o=document.querySelector("[tutor-option-tabs] li > a.is-active");if(null!==o){document.title=o.querySelector("[tutor-option-label]").innerText+" < "+_tutorobject.site_title}e.forEach(e=>{e.addEventListener("click",e=>{var o=e.target.parentElement.dataset.tab||e.target.dataset.tab;var a=e.target.parentElement.dataset.page||e.target.dataset.page;if(o){// Set page title on changing nav tabs
document.title=e.target.innerText+" < "+_tutorobject.site_title;// remove active from other buttons
t.forEach(t=>{t.classList.remove("is-active");document.body.classList.remove(t.dataset.tab);if(e.target.dataset.tab){document.body.classList.add(e.target.dataset.tab);e.target.classList.add("is-active")}else{e.target.parentElement.classList.add("is-active")}});// hide other tab contents
r.forEach(e=>{e.classList.remove("is-active")});// add active to the current content
var n=document.querySelector("#".concat(o));n.classList.add("is-active");// History push
var i=new URL(window.location);var s=new URLSearchParams({page:a,tab_page:o});var l="".concat(i.origin+i.pathname,"?").concat(s.toString());window.history.pushState({},"",l);addBodyClass(window.location);var c=document.getElementById(o).querySelector(".loading-spinner");if(c){document.getElementById(o).querySelector(".loading-spinner").remove()}// Update certificate pagination on tab change
if(o==="tutor_certificate"){var u=document.querySelectorAll("#tutor-settings-tab-certificate_list .tutor-pagination a");u.forEach(e=>{var t=new URL(e.href);t.searchParams.set("tab_page",o);// Update the 'tab_page' parameter
e.href=t.toString()})}}})})});addBodyClass(window.location)},76592:function(){/**
 * Reset to default for settings individual page
 */readyState_complete(()=>{typeof r==="function"?r():"";typeof t==="function"?t():""});var e=document.getElementById("tutor-modal-bulk-action");var t=()=>{var t=document.querySelectorAll(".modal-reset-open");var r=e&&e.querySelector(".reset_to_default");var o=e&&e.querySelector("[data-modal-dynamic-title]");var a=e&&e.querySelector("[data-modal-dynamic-content]");t.forEach((e,t)=>{e.disabled=false;e.onclick=t=>{r.dataset.reset=e.dataset.reset;o.innerText=e.dataset.heading;r.dataset.resetFor=e.previousElementSibling.innerText;a.innerText=e.dataset.message}})};var r=()=>{var{__,sprintf:t}=wp.i18n;var r=document.querySelectorAll(".reset_to_default");r.forEach((r,a)=>{r.onclick=a=>{if(!a.detail||a.detail==1){a.preventDefault();r.classList.add("is-loading");var n=r.dataset.reset;var i=r.dataset.resetFor.replace("_"," ").toUpperCase();var s=new FormData;s.append("action","reset_settings_data");s.append("reset_page",n);s.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);var l=new XMLHttpRequest;l.open("POST",_tutorobject.ajaxurl,true);l.send(s);l.onreadystatechange=function(){if(l.readyState===4){var a=JSON.parse(l.response).data;a.forEach(e=>{var t=["color_field","upload_full","checkbox_notification","checkgroup","group_radio_full_3","group_radio","radio_vertical","checkbox_horizontal","radio_horizontal","radio_horizontal_full","radio_horizontal_image","checkbox_vertical","toggle_switch","toggle_switch_button","text","textarea","email","hidden","select","number"];if(t.includes(e.type)){var r="tutor_option["+e.key+"]";var a=o(r)[0];if(e.type=="select"){var n=a.options;[...n].forEach(t=>{t.selected=typeof e.default==="number"?t.value===e.default:e.default.includes(t.value)})}else if(e.type=="color_field"){var i="tutor_option["+e.key+"]";var s=o(i)[0];if(s){s.value=e.default;s.nextElementSibling.innerText=e.default}}else if(e.type=="checkbox_horizontal"||e.type=="checkbox_vertical"||e.type=="radio_horizontal"||e.type=="radio_horizontal_full"||e.type=="radio_horizontal_image"||e.type=="radio_vertical"||e.type=="group_radio"||e.type=="group_radio_full_3"){if(e.type=="checkbox_horizontal"){Object.keys(e.options).forEach(t=>{r="tutor_option["+e.key+"]["+t+"]";checkElements=o("".concat(r));[...checkElements].forEach(t=>{t.checked=e.default.includes(t.value)?true:false})})}else{var l=o("".concat(r));[...l].forEach(t=>{t.checked=e.default.includes(t.value)?true:false})}}else if(e.type=="upload_full"){a.value="";a.nextElementSibling.src="";a.parentNode.querySelector(".delete-btn").style.display="none"}else if(e.type=="checkbox_notification"){Object.keys(e.options).forEach(e=>{r="tutor_option"+e;checkElements=o("".concat(r));[...checkElements].forEach(e=>{e.checked=false})})}else if(e.type=="checkgroup"){Object.values(e.group_options).forEach(e=>{r="tutor_option["+e.key+"]";checkElements=o("".concat(r));[...checkElements].forEach(t=>{t.value="on"===e.default?"on":"off";t.nextElementSibling.checked="on"===e.default?true:false})})}else if(e.type=="toggle_switch_button"){r="tutor_option["+e.key+"]["+e.event+"]";checkElements=o("".concat(r));[...checkElements].forEach(t=>{t.nextElementSibling.checked="on"===e.default?true:false})}else if(e.type=="toggle_switch"){a.value=a.nextElementSibling.value=e.default;a.nextElementSibling.checked=false}else{a.value=e.default}}var c=["group_fields"];if(c.includes(e.type)){var u=e.key;var d=e.group_fields;if(typeof d==="object"&&d!==null){Object.keys(d).forEach((e,t)=>{var r=d[e];var a=["toggle_switch","text","textarea","email","hidden","select","number"];if(a.includes(r.type)){var n="tutor_option[".concat(u,"][").concat(e,"]");// console.log(itemName);
var i=o(n)[0];if(r.type=="select"){var s=i.options;[...s].forEach(e=>{e.selected=r.default===e.value?true:false})}else if(r.type=="toggle_switch"){i.value=r.default;i.nextElementSibling.value=r.default;i.nextElementSibling.checked=false}else{// console.log(itemChild);
i.value=r.default}}})}}});setTimeout(()=>{r.classList.remove("is-loading");tutor_toast(__("Reset Successful","tutor"),t(__("All modified settings of %s have been changed to default.","tutor"),i),"success");e.classList.remove("tutor-is-active");document.body.classList.remove("tutor-modal-open");if(document.getElementById("save_tutor_option")){document.getElementById("save_tutor_option").disabled=false}},300)}}}}})};var o=e=>{return document.getElementsByName(e)};/**
 * Enable save button if any input changes
 */var a=document.querySelector("#tutor-option-form");if(null!==a){a.addEventListener("input",e=>{if(document.getElementById("save_tutor_option")){document.getElementById("save_tutor_option").disabled=false}})}},39298:function(){/**
 * WP Gutenberg Events Subscriber
 *
 * @since 2.1.7
 * @package Tutor\AdminScripts
 */document.addEventListener("DOMContentLoaded",function(){wp.data.subscribe(function(){// Handle course move to trash event
var e=_tutorobject.course_list_page_url;var t=_tutorobject.course_post_type;if(wp.data&&wp.data.select("core/editor")){var r=wp.data.select("core/editor").getEditedPostAttribute("type");if(r===t){var o=wp.data.select("core/editor").getEditedPostAttribute("status");if(o==="trash"){// Redirect to course list page
window.location.href=e}}}})})},71962:function(){window.selectSearchField=e=>{var t=document.querySelectorAll(e);(()=>{t.forEach(e=>{if(e&&!e.classList.contains("tutor-js-form-select")&&!e.hasAttribute("noDropdown")&&!e.classList.contains("no-tutor-dropdown")){var t=e.hasAttribute("data-searchable");var a=e.options[e.selectedIndex];e.style.display="none";var n,i,s,l,c,u,d,v;e.insertAdjacentHTML("afterend",o(e.options,e.value,t));n=e.nextElementSibling;i=n.querySelector(".tutor-form-select-search");s=i&&i.querySelector("input");v=n.querySelector(".tutor-form-select-dropdown");var p=n.querySelector(".tutor-form-select-label");p.innerText=a&&a.text;n.onclick=e=>{e.stopPropagation();r(document.querySelectorAll(".tutor-js-form-select"),n);n.classList.toggle("is-active");if(s){setTimeout(()=>{s.focus()},100)}v.onclick=e=>{e.stopPropagation()}};r(document.querySelectorAll(".tutor-js-form-select"));c=n.querySelector(".tutor-form-select-options");u=c&&c.querySelectorAll(".tutor-form-select-option");if(u){u.forEach(t=>{t.onclick=r=>{r.stopPropagation();var o=Array.from(e.options);o.forEach((o,a)=>{if(o.value===r.target.dataset.key){var i;(i=c.querySelector(".is-active"))===null||i===void 0?void 0:i.classList.remove("is-active");t.classList.add("is-active");n.classList.remove("is-active");p.innerText=r.target.innerText;p.dataset.value=o.value;e.value=o.value;var s=document.getElementById("save_tutor_option");if(s){s.disabled=false}}});var a=new Event("change",{bubbles:true});e.dispatchEvent(a)}})}var m=e=>{var t=0;e.forEach(e=>{if(e.style.display!=="none"){t+=1}});return t};if(s){s.oninput=e=>{var t,r=false;l=e.target.value.toUpperCase();u.forEach(e=>{d=e.querySelector("[tutor-dropdown-item]");t=d.textContent||d.innerText;if(t.toUpperCase().indexOf(l)>-1){e.style.display="";r="false"}else{r="true";e.style.display="none"}});var o='\n							<div class="tutor-form-select-option noItem tutor-text-center tutor-fs-7">\n								'.concat(window.wp.i18n.__("No item found","tutor"),"\n							</div>\n						");var a=v.querySelector(".tutor-form-select-options");if(0==m(u)){var n=false;a.querySelectorAll(".tutor-form-select-option").forEach(e=>{if(e.classList.contains("noItem")==true){n=true}});if(false==n){a.insertAdjacentHTML("beforeend",o);n=true}}else{if(null!==v.querySelector(".noItem")){v.querySelector(".noItem").remove()}}}}}});var e=document.querySelectorAll(".tutor-js-form-select");e.forEach(e=>{if(e.nextElementSibling){if(e.nextElementSibling.classList.contains("tutor-js-form-select")){e.nextElementSibling.remove()}}});var a=document.querySelectorAll(".tutor-js-form-select");document.onclick=e=>{r(a)}})();function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(e){e.forEach(e=>{if(e!==t){e.classList.remove("is-active")}})}}function o(e,t,r){var o="";Array.from(e).forEach(e=>{o+='\n            <div class="tutor-form-select-option '.concat(t===e.value?"is-active":"",'">\n				<span tutor-dropdown-item data-key="').concat(tutor_esc_attr(e.value),'" class="tutor-nowrap-ellipsis" title="').concat(tutor_esc_attr(e.text),'">').concat(tutor_esc_html(e.text),"</span>\n            </div>\n            ")});var a="";if(r){a='\n				<div class="tutor-form-select-search tutor-pt-8 tutor-px-8">\n					<div class="tutor-form-wrap">\n						<span class="tutor-form-icon">\n							<i class="tutor-icon-search" aria-hidden="true"></i>\n						</span>\n						<input type="search" class="tutor-form-control" placeholder="'.concat(window.wp.i18n.__("Search ...","tutor"),'" />\n					</div>\n				</div>\n			')}var n='\n			<div class="tutor-form-control tutor-form-select tutor-js-form-select">\n				<span class="tutor-form-select-label" tutor-dropdown-label>'.concat(window.wp.i18n.__("Select","tutor"),'</span>\n				<div class="tutor-form-select-dropdown">\n					').concat(a,'\n					<div class="tutor-form-select-options">\n						').concat(o,"\n					</div>\n				</div>\n			</div>\n        ");return n}};selectSearchField(".tutor-form-select")}};// The module cache
var t={};// The require function
function r(o){// Check if module is in cache
var a=t[o];if(a!==undefined){return a.exports}// Create a new module (and put it into the cache)
var n=t[o]={exports:{}};// Execute the module function
e[o](n,n.exports,r);// Return the exports of the module
return n.exports}// webpack/runtime/rspack_version
(()=>{r.rv=()=>"1.6.5"})();// webpack/runtime/rspack_unique_id
(()=>{r.ruid="bundler=rspack@1.6.5"})();// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(()=>{"use strict";// CONCATENATED MODULE: ./node_modules/.pnpm/@swc+helpers@0.5.17/node_modules/@swc/helpers/esm/_async_to_generator.js
function e(e,t,r,o,a,n,i){try{var s=e[n](i);var l=s.value}catch(e){r(e);return}if(s.done)t(l);else Promise.resolve(l).then(o,a)}function t(t){return function(){var r=this,o=arguments;return new Promise(function(a,n){var i=t.apply(r,o);function s(t){e(i,a,n,s,l,"next",t)}function l(t){e(i,a,n,s,l,"throw",t)}s(undefined)})}};// CONCATENATED MODULE: ./assets/src/js/helper/ajax-handler.js
function o(e){return t(function*(){try{var t=yield fetch(window._tutorobject.ajaxurl,{method:"POST",body:e});return t}catch(e){tutor_toast(__("Operation failed","tutor"),e,"error")}})()}// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/color-preset.js
var a=r(42242);// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/consent-logs.js
var n=r(45397);// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/segments/filter.js
/**
 * On click add filter value on the url
 * and refresh page
 *
 * Handle bulk action
 *
 * @package Filter / sorting
 * @since v2.0.0
 */document.addEventListener("DOMContentLoaded",function(){var{__,_x:e,_n:r,_nx:a}=wp.i18n;var n=document.getElementById("tutor-common-confirmation-modal");var i=document.getElementById("tutor-common-confirmation-form");var s=document.querySelectorAll(".tutor-filter-select");s.forEach(e=>{e.addEventListener("change",e=>{var t=e.target.name;var r=e.target.value;if(r.length){window.location=y(t,r)}else{window.location=b(t)}},{once:true})});var l=document.querySelectorAll(".tutor-admin-dashboard-filter-form");l.forEach(e=>{e.addEventListener("submit",e=>{e.preventDefault();var t=new FormData(e.target);var r=Object.fromEntries(t);var o=new URL(window.location.href);var a=o.searchParams;a.set("paged",1);for(var n in r){var i=r[n];if(i){a.set(n,i)}else{a.delete(n)}}window.location=o})});var c=document.getElementById("tutor-backend-filter-course");if(c){c.addEventListener("change",e=>{window.location=y("course-id",e.target.value)},{once:true})}var u=document.getElementById("tutor-backend-filter-category");if(u){u.addEventListener("change",e=>{window.location=y("category",e.target.value)},{once:true})}var d=document.getElementById("tutor-backend-filter-order");if(d){d.addEventListener("change",e=>{window.location=y("order",e.target.value)},{once:true})}var v=document.getElementById("tutor-backend-filter-payment-status");v===null||v===void 0?void 0:v.addEventListener("change",e=>{window.location=y("payment-status",e.target.value)},{once:true});var p=document.getElementById("tutor-admin-search-filter-form");var m=document.getElementById("tutor-backend-filter-search");if(p){// Resubmit filter on clear
// So we can avoid wrong tab link retaining search value
m.addEventListener("search",e=>{var{value:t}=e.currentTarget||{};if(/\S+/.test(t)==false){window.location=b("search")}});// Assign search value to normal form submission
p.onsubmit=e=>{e.preventDefault();var t=m.value;window.location=y("search",t)}}/**
	 * onclick apply button show checkbox select message
	 * if not selected
	 */var f=document.getElementById("tutor-admin-bulk-action-btn");var _=document.querySelector(".tutor-bulk-modal-disabled");if(f){f.onclick=()=>{var e=[];var t=document.querySelectorAll(".tutor-bulk-checkbox");for(var r of t){if(r.checked){e.push(r.value)}}if(e.length){_.setAttribute("id","tutor-bulk-confirm-popup")}else{tutor_toast(__("Warning","tutor"),__("Nothing was selected for bulk action.","tutor"),"error");if(_.hasAttribute("id")){_.removeAttribute("id")}}}}/**
	 * Onsubmit bulk form handle ajax request then reload page
	 */var g=document.getElementById("tutor-admin-bulk-action-form");if(g){g.onsubmit=e=>t(function*(){e.preventDefault();e.stopPropagation();var t=new FormData(g);var r=[];var o=document.querySelectorAll(".tutor-bulk-checkbox");for(var a of o){if(a.checked){r.push(a.value)}}if(!r.length){alert(__("Select checkbox for action","tutor"));return}t.set("bulk-ids",r);t.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);try{var n=document.querySelector("#tutor-confirm-bulk-action[data-tutor-modal-submit]");n.classList.add("is-loading");var i=yield fetch(window._tutorobject.ajaxurl,{method:"POST",body:t});n.classList.remove("is-loading");if(i.ok){var s=yield i.json();if(s.success||200===(s===null||s===void 0?void 0:s.status_code)){location.reload()}else{var{message:l=__("Something went wrong, please try again ","tutor")}=s.data||{};tutor_toast(__("Failed","tutor"),l,"error")}}}catch(e){console.log(e)}})()}/**
	 * onclick bulk action button show confirm popup
	 * on click confirm button submit bulk form
	 */var h=document.getElementById("tutor-confirm-bulk-action");if(h){h.onclick=()=>{var e=document.createElement("input");e.type="submit";g.appendChild(e);e.click();e.remove()}}function y(e,t){var r=new URL(window.location.href);var o=r.searchParams;o.set(e,t);o.set("paged",1);return r}function b(e){var t=new URL(window.location.href);var r=t.searchParams;r.delete(e);return t}/**
	 * Select all bulk checkboxes
	 *
	 * @since v2.0.0
	 */var w=document.querySelector("#tutor-bulk-checkbox-all");if(w){w.addEventListener("click",()=>{var e=document.querySelectorAll(".tutor-bulk-checkbox");e.forEach(e=>{if(w.checked){e.checked=true}else{e.checked=false}})})}/**
	 * Delete course delete
	 */var S=document.querySelectorAll(".tutor-admin-course-delete");for(var E of S){E.onclick=e=>{var t=e.currentTarget.dataset.id;if(i){i.elements.action.value="tutor_course_delete";i.elements.id.value=t}}}/**
	 * Handle permanent delete action
	 *
	 * @since 3.0.0
	 */var L=document.querySelectorAll(".tutor-delete-permanently");for(var k of L){k.onclick=e=>{var t=e.currentTarget.dataset.id;var r=e.currentTarget.dataset.action;if(i){i.elements.action.value=r;i.elements.id.value=t}}}/**
	 * Handle common confirmation form
	 *
	 * @since v.2.0.0
	 */if(i){i.onsubmit=e=>t(function*(){e.preventDefault();var t=new FormData(i);//show loading
    var r=i.querySelector("[data-tutor-modal-submit]");r.classList.add("is-loading");var a=yield o(t);//hide modal
    if(n.classList.contains("tutor-is-active")){n.classList.remove("tutor-is-active")}if(a.ok){var s=yield a.json();r.classList.remove("is-loading");if(s){if(typeof s==="object"&&s.success){tutor_toast(__("Delete","tutor"),s.data,"success");location.reload(true)}else if(typeof s==="object"&&s.success===false){tutor_toast(__("Failed","tutor"),s.data,"error")}else{tutor_toast(__("Delete","tutor"),__("Successfully deleted ","tutor"),"success");location.reload()}}else{tutor_toast(__("Failed","tutor"),__("Delete failed ","tutor"),"error")}}})()}});// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/image-preview.js
var i=r(76431);// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/segments/import-export.js
/**
 * Settings logs, previously known as import/export
 * 
 * @since 3.6.0
 */var s=()=>{return Math.ceil(Date.now()/1e3)+6*60*60};var l=()=>t(function*(){var e=new FormData;e.append("action","load_saved_data");e.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);var t=yield o(e);var r=yield t.json();c(Object.entries(r.data))})();function c(e){var{__:t}=wp.i18n;var r="";if(null!==e&&0!==e.length){e.forEach(e=>{var o=e[0];var a=e[1];var n=a.datatype=="saved"?" label-primary":a.datatype==="Imported"?" label-success":" label-default";r+='<div class="tutor-option-field-row">\n				<div class="tutor-option-field-label">\n					<div class="tutor-fs-7 tutor-fw-medium">'.concat(a.history_date,'\n					<span class="tutor-badge-label tutor-text-capitalize tutor-ml-16').concat(n,'"> ').concat(a.datatype,'</span> </div>\n				</div>\n				<div class="tutor-option-field-input">\n					<button class="tutor-btn tutor-btn-outline-primary tutor-btn-sm apply_settings" data-tutor-modal-target="tutor-modal-bulk-action" data-btntext="').concat(t('Yes, Restore Settings" data-heading="Restore Previous Settings?',"tutor"),'" data-message="').concat(t("WARNING! This will overwrite all existing settings, please proceed with caution.","tutor"),'" data-id="').concat(o,'">').concat(t("Apply","tutor"),'</button>\n					<div class="tutor-dropdown-parent tutor-ml-16">\n						<button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">\n							<span class="tutor-icon-kebab-menu" aria-hidden="true"></span>\n						</button>\n						<ul class="tutor-dropdown tutor-dropdown-dark tutor-text-left">\n							<li>\n								<a href="javascript:;" class="tutor-dropdown-item export_single_settings" data-id="').concat(o,'">\n									<span class="tutor-icon-archive tutor-mr-8" aria-hidden="true"></span>\n									<span>').concat(t("Download","tutor"),'</span>\n								</a>\n							</li>\n							<li>\n								<a href="javascript:;" class="tutor-dropdown-item delete_single_settings" data-tutor-modal-target="tutor-modal-bulk-action" data-btntext="Yes, Delete Settings" data-heading="Delete This Settings?" data-message="WARNING! This will remove the settings history data from your system, please proceed with caution." data-id="').concat(o,'">\n									<span class="tutor-icon-trash-can-bold tutor-mr-8" aria-hidden="true"></span>\n									<span>').concat(t("Delete","tutor"),"</span>\n								</a>\n							</li>\n						</ul>\n					</div>\n          		</div>\n        	</div>")})}else{r+='<div class="tutor-option-field-row"><div class="tutor-option-field-label"><p class="tutor-fs-7 tutor-fw-medium">'.concat(t("No settings data found.","tutor"),"</p></div></div>")}var o='<div class="tutor-option-field-row"><div class="tutor-option-field-label">'.concat(t("Date","tutor"),"</div></div>");var a=document.querySelector(".history_data");if(a){a.innerHTML=o+r}}var u=(e,r,a)=>t(function*(){var{__:e}=wp.i18n;var t=new FormData;t.append("action","tutor_option_default_save");t.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);try{var n=yield o(t);var i=yield n.json();if(i.success){r.classList.remove("tutor-is-active");document.body.classList.remove("tutor-modal-open");tutor_toast(e("Success","tutor"),e("Reset all settings to default successfully!","tutor"),"success")}else{tutor_toast(e("Failed","tutor"),e("Something went wrong!","tutor"),"error")}}catch(t){tutor_toast(e("Failed","tutor"),e("Something went wrong!","tutor"),"error")}finally{a.classList.remove("is-loading")}})();var d=(e,r,a)=>t(function*(){var{__:t}=wp.i18n;var n=e.dataset.id;var i=new FormData;i.append("action","tutor_apply_settings");i.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);i.append("apply_id",n);try{var s=yield o(i);var l=yield s.json();if(l.success){r.classList.remove("tutor-is-active");document.body.classList.remove("tutor-modal-open");tutor_toast(t("Success","tutor"),t("Applied settings successfully!","tutor"),"success")}else{tutor_toast(t("Failed","tutor"),t("Something went wrong!","tutor"),"error")}}catch(e){tutor_toast(t("Failed","tutor"),t("Something went wrong!","tutor"),"error")}finally{a.classList.remove("is-loading")}})();var v=(e,r,a)=>t(function*(){var{__:t}=wp.i18n;var n=e.dataset.id;var i=new FormData;i.append("action","tutor_delete_single_settings");i.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);i.append("time",Date.now());i.append("delete_id",n);try{var s=yield o(i);var l=yield s.json();if(l.success){r.classList.remove("tutor-is-active");document.body.classList.remove("tutor-modal-open");tutor_toast(t("Success","tutor"),t("Data deleted successfully!","tutor"),"success");c(Object.entries(l.data))}else{tutor_toast(t("Failed","tutor"),t("Something went wrong!","tutor"),"error")}}catch(e){tutor_toast(t("Failed","tutor"),t("Something went wrong!","tutor"),"error")}finally{a.classList.remove("is-loading")}})();var p=e=>{var t=document.getElementById(e.dataset.tutorModalTarget);var r=t&&t.querySelector("[data-reset]");var o=t&&t.querySelector("[data-modal-dynamic-title]");var a=t&&t.querySelector("[data-modal-dynamic-content]");r.innerText=e.dataset.btntext;r.dataset.reset="";o.innerText=e.dataset.heading;a.innerText=e.dataset.message;if(r._handleConfirmClick){r.removeEventListener("click",r._handleConfirmClick)}var n=()=>{r.classList.add("is-loading");if(e.classList.contains("tutor-reset-all")){u(e,t,r)}if(e.classList.contains("apply_settings")){d(e,t,r)}if(e.classList.contains("delete_single_settings")){v(e,t,r)}};r._handleConfirmClick=n;r.addEventListener("click",n)};document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector(".tutor-backend-tutor-tools");var t=document.querySelector(".tutor-modal-body button[data-reset]");if(e&&t){t.removeAttribute("data-reset-for");t.classList.remove("reset_to_default")}});document.addEventListener("click",function(e){return t(function*(){// Handle export all settings
var t=e.target.closest("#tutor_export_settings");if(t){var r=new FormData;r.append("action","tutor_export_settings");r.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);var a="tutor_options_"+s();try{var n;t.classList.add("is-loading");var i=yield o(r);var c=yield i.json();var u=c===null||c===void 0?void 0:(n=c.data)===null||n===void 0?void 0:n.exported_data;if(u){json_download(JSON.stringify(u),a);l()}else{tutor_toast(__("Failed","tutor"),__("Something went wrong!","tutor"),"error")}}catch(e){tutor_toast(__("Failed","tutor"),__("Something went wrong!","tutor"),"error")}finally{t.classList.remove("is-loading")}}// Handle export single settings
var d=e.target.closest(".export_single_settings");if(d){var v=d.dataset.id;var m=new FormData;m.append("action","tutor_export_single_settings");m.append(_tutorobject.nonce_key,_tutorobject._tutor_nonce);m.append("time",Date.now());m.append("export_id",v);var f=yield o(m);var _=yield f.json();json_download(JSON.stringify(_.data),v)}// Handle apply single settings
var g=e.target.closest(".apply_settings");if(g){p(g)}// Handle delete single settings
var h=e.target.closest(".delete_single_settings");if(h){p(h)}// Reset to default settings
var y=e.target.closest(".tutor-reset-all");if(y){p(y)}})()});// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/legal-consents.js
var m=r(34168);// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/lib.js
var f=r(480);// CONCATENATED MODULE: ./assets/src/js/helper/tutor-formdata.js
/**
 * Prepare custom form data, while setting form data
 * it will also set tutor nonce field.
 * 
 * @since v2.1.0
 * 
 * @param formId  form id attribute
 * @param data array of objects of form elements. Key value par
 * like: [{name: 'john doe'}, {age: 100}]
 * 
 * @return mixed formData on success, false on any error
 */if(!window.tutor_get_nonce_data){window.tutor_get_nonce_data=function(e){var t=window._tutorobject||{};var r=t.nonce_key||"";var o=t[r]||"";if(e){return{key:r,value:o}}return{[r]:o}}}function _(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];var t=new FormData;e.forEach(e=>{for(var[r,o]of Object.entries(e)){t.set(r,o)}});t.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);return t}/* export default */const g=_;// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/segments/manage-api-keys.js
document.addEventListener("DOMContentLoaded",function(){return t(function*(){var{__}=wp.i18n;var e=__("Something went wrong, please try again after refreshing page","tutor");var r=document.querySelector(".tutor-rest-api-keys-wrapper");var a=document.querySelector(".tutor-rest-api-keys-wrapper tbody");var n=document.getElementById("tutor-generate-api-keys");var i=document.querySelector("#tutor-generate-api-keys button[type=submit]");var s=document.getElementById("tutor-add-new-api-keys");var l=document.getElementById("tutor-api-keys-no-record");var c=document.querySelector("#tutor-update-permission-form");var u=document.querySelector("#tutor-update-permission-modal button[type=submit]");var d=document.querySelector("#tutor-update-permission-modal");if(!r){return}// Add API keys
if(n){n.onsubmit=r=>t(function*(){r.preventDefault();var t=new FormData(n);try{// Show loading
    i.classList.add("is-loading");i.setAttribute("disabled",true);var c=yield o(t);var u=yield c.json();var{success:d,data:v}=u;if(d){a.insertAdjacentHTML("afterbegin","".concat(v));tutor_toast(__("Success","tutor"),__("API key & secret generated successfully","tutor"),"success")}else{tutor_toast(__("Failed","tutor"),v,"error")}}catch(t){tutor_toast(__("Failed","tutor"),e,"error")}finally{i.classList.remove("is-loading");i.removeAttribute("disabled");s.classList.remove("tutor-is-active");document.body.classList.remove("tutor-modal-open");if(l){l.remove()}// Reset form
    n.reset()}})()}// Edit API keys
if(c){c.onsubmit=r=>t(function*(){r.preventDefault();var t=new FormData(c);try{u.classList.add("is-loading");u.setAttribute("disabled",true);var a=yield o(t);var n=yield a.json();var{success:i,data:s}=n;if(i){document.getElementById(t.get("meta_id")).innerHTML=s;tutor_toast(__("Success","tutor"),__("API key permission updated successfully","tutor"),"success")}else{tutor_toast(__("Failed","tutor"),s,"error")}}catch(t){tutor_toast(__("Failed","tutor"),e,"error")}finally{u.classList.remove("is-loading");u.removeAttribute("disabled");d.classList.remove("tutor-is-active");document.body.classList.remove("tutor-modal-open");c.reset()}})()}if(a){a.addEventListener("click",r=>t(function*(){var t=r.target;// Revoke API keys
    if(t.hasAttribute("data-meta-id")){var a=t.dataset.metaId;var n=g([{action:"tutor_revoke_api_keys",meta_id:a}]);try{t.classList.add("is-loading");t.setAttribute("disabled",true);var i=yield o(n);var s=yield i.json();var{success:l,data:u}=s;if(l){t.closest("tr").remove();tutor_toast(__("Success","tutor"),u,"success")}else{tutor_toast(__("Failed","tutor"),u,"error")}}catch(r){tutor_toast(__("Failed","tutor"),e,"error");t.classList.remove("is-loading");t.removeAttribute("disabled")}}// Add meta id to forms input value
    if(t.hasAttribute("data-update-id")){var d=t.dataset.updateId;var v=t.dataset.permission;var p=t.dataset.description;if(d){c.querySelector("input[name=meta_id]").value=d;c.querySelector("select[name=permission]").value=v;c.querySelector("textarea[name=description]").value=p}}})())}})()});// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/multiple_email_input.js
var h=r(77867);// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/navigation.js
var y=r(88441);// CONCATENATED MODULE: ./assets/src/js/helper/response.js
var b=(e,t)=>{var{__}=wp.i18n;var{data:r={}}=e||{};var{message:o=t||__("Something Went Wrong!","tutor")}=r;return o};// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/segments/options.js
// SVG Icons Totor V2
var w={warning:'<svg class="tutor-icon-v2 warning" width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18.0388 14.2395C18.2457 14.5683 18.3477 14.9488 18.3321 15.3333C18.3235 15.6951 18.2227 16.0493 18.0388 16.3647C17.851 16.6762 17.5885 16.9395 17.2733 17.1326C16.9301 17.3257 16.5383 17.4237 16.1412 17.4159H5.87591C5.47974 17.4234 5.08907 17.3253 4.74673 17.1326C4.42502 16.9409 4.15549 16.6776 3.96071 16.3647C3.77376 16.0506 3.67282 15.6956 3.66741 15.3333C3.6596 14.9496 3.76106 14.5713 3.96071 14.2395L9.11094 5.64829C9.29701 5.31063 9.58016 5.03215 9.9263 4.84641C10.2558 4.67355 10.6248 4.58301 10.9998 4.58301C11.3747 4.58301 11.7437 4.67355 12.0732 4.84641C12.4259 5.02952 12.7154 5.30825 12.9062 5.64829L18.0388 14.2395ZM11.7447 10.4086C11.7447 10.2131 11.7653 10.0176 11.7799 9.81924C11.7946 9.62089 11.8063 9.41971 11.818 9.21853C11.8178 9.1484 11.8129 9.07836 11.8034 9.00885C11.7916 8.94265 11.7719 8.87799 11.7447 8.81617C11.6644 8.64655 11.5255 8.50928 11.3517 8.42798C11.1805 8.3467 10.9848 8.32759 10.8003 8.37414C10.6088 8.42217 10.4413 8.53471 10.3281 8.69149C10.213 8.84985 10.1525 9.03921 10.1551 9.2327C10.1551 9.3602 10.1756 9.48771 10.1844 9.61239C10.1932 9.73706 10.202 9.86457 10.2137 9.99208C10.2401 10.4709 10.2695 10.947 10.2988 11.4088C10.3281 11.8707 10.3545 12.3552 10.3838 12.8256C10.3857 12.9019 10.4032 12.9771 10.4352 13.0468C10.4672 13.1166 10.5131 13.1796 10.5703 13.2322C10.6275 13.2849 10.6948 13.3261 10.7685 13.3536C10.8422 13.381 10.9208 13.3942 10.9998 13.3923C11.0794 13.3946 11.1587 13.3813 11.2328 13.353C11.307 13.3248 11.3744 13.2822 11.4309 13.228C11.5454 13.1171 11.6115 12.968 11.6157 12.8114V12.5281C11.6157 12.4317 11.6157 12.3382 11.6157 12.2447C11.6362 11.9415 11.6538 11.6327 11.6743 11.3238C11.6949 11.015 11.7271 10.7118 11.7447 10.4086ZM10.9998 15.5118C11.1049 15.5119 11.2091 15.4919 11.3062 15.453C11.4034 15.4141 11.4916 15.3571 11.5658 15.2851C11.6441 15.2191 11.7061 15.137 11.7472 15.0448C11.7883 14.9526 11.8075 14.8527 11.8034 14.7524C11.8053 14.6497 11.7863 14.5476 11.7474 14.452C11.7085 14.3564 11.6505 14.2692 11.5767 14.1953C11.5029 14.1213 11.4147 14.0621 11.3172 14.0211C11.2197 13.9801 11.1149 13.958 11.0086 13.9562C10.9023 13.9543 10.7966 13.9727 10.6977 14.0103C10.5987 14.0479 10.5084 14.1039 10.4319 14.1752C10.3553 14.2465 10.2941 14.3317 10.2516 14.4259C10.2092 14.52 10.1863 14.6214 10.1844 14.7241C10.1844 14.933 10.2703 15.1333 10.4232 15.2811C10.5761 15.4288 10.7835 15.5118 10.9998 15.5118Z" fill="#9CA0AC"/></svg>',magnifyingGlass:'<svg class="tutor-icon-v2 magnifying-glass" width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.3056 5.375C7.58249 5.375 5.375 7.58249 5.375 10.3056C5.375 13.0286 7.58249 15.2361 10.3056 15.2361C13.0286 15.2361 15.2361 13.0286 15.2361 10.3056C15.2361 7.58249 13.0286 5.375 10.3056 5.375ZM4.125 10.3056C4.125 6.89214 6.89214 4.125 10.3056 4.125C13.719 4.125 16.4861 6.89214 16.4861 10.3056C16.4861 13.719 13.719 16.4861 10.3056 16.4861C6.89214 16.4861 4.125 13.719 4.125 10.3056Z" fill="#9CA0AC"/><path fill-rule="evenodd" clip-rule="evenodd" d="M13.7874 13.7872C14.0314 13.5431 14.4272 13.5431 14.6712 13.7872L17.6921 16.8081C17.9362 17.0521 17.9362 17.4479 17.6921 17.6919C17.448 17.936 17.0523 17.936 16.8082 17.6919L13.7874 14.6711C13.5433 14.427 13.5433 14.0313 13.7874 13.7872Z" fill="#9CA0AC"/></svg>',angleRight:'<svg class="tutor-icon-v2 angle-right" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7.842 12.633C7.80402 12.6702 7.7592 12.6998 7.71 12.72C7.65839 12.7401 7.60341 12.7503 7.548 12.75C7.49655 12.7496 7.44563 12.7395 7.398 12.72C7.34843 12.7005 7.30347 12.6709 7.266 12.633L6.88201 12.252C6.84384 12.2138 6.81284 12.1691 6.79051 12.12C6.76739 12.0694 6.75367 12.015 6.75001 11.9595C6.74971 11.9045 6.75832 11.8498 6.77551 11.7975C6.79308 11.7477 6.82181 11.7025 6.85951 11.6655L9.53249 9.00001L6.86701 6.33453C6.82576 6.29904 6.79427 6.2536 6.77551 6.20253C6.75832 6.15026 6.74971 6.09555 6.75001 6.04053C6.75367 5.98502 6.76739 5.93064 6.79051 5.88003C6.81284 5.8309 6.84384 5.78619 6.88201 5.74803L7.263 5.36704C7.30047 5.32916 7.34543 5.29953 7.395 5.28004C7.44263 5.26056 7.49355 5.25038 7.545 5.25004C7.60142 5.24931 7.65745 5.2595 7.71 5.28004C7.7592 5.30025 7.80402 5.3298 7.842 5.36704L11.181 8.70752C11.2233 8.74442 11.2579 8.78926 11.283 8.83951C11.3077 8.88941 11.3206 8.94433 11.3206 9.00001C11.3206 9.05569 11.3077 9.11062 11.283 9.16051C11.2579 9.21076 11.2233 9.25561 11.181 9.29251L7.842 12.633Z" fill="#B4B7C0"/></svg>'};// Tutor v2 icons
var{angleRight:S,magnifyingGlass:E,warning:L}=w;document.addEventListener("DOMContentLoaded",function(){var e=function(e){var t=r[e].closest(".image-previewer");var o=t.querySelector(".input_file");var a=t.querySelector(".upload_preview");var n=document.querySelector('[data-source="email-title-logo"]');// document.querySelector(
//   "[data-source='email-title-logo']"
// );
var i=t.querySelector(".delete-btn");r[e].onclick=function(e){e.preventDefault();var t=wp.media({title:"Upload Image",library:{type:"image"},multiple:false,frame:"post",state:"insert"});t.open();/* image_frame.on("select", function (e) {
				console.log("image size");
				console.log(image.state().get("selection").first().toJSON());

				var image_url = image_frame.state().get("selection").first().toJSON().url;

				upload_previewer.src = image_input.value = image_url;
			}); */t.on("insert",function(e){var r=t.state();e=e||r.get("selection");if(!e)return;// We set multiple to false so only get one image from the uploader
var i=e.first();var s=r.display(i).toJSON();// <-- additional properties
i=i.toJSON();// Do something with attachment.id and/or attachment.url here
var l=i.sizes[s.size].url;if(null!==a){a.src=o.value=l}if(null!==n){n.src=o.value=l}})};i.onclick=function(){o.value="";n.src=""}};var t=window.jQuery;var{__}=wp.i18n;var r=document.querySelectorAll(".image_upload_button");// let image_input = document.getElementById("image_url_field");
for(var o=0;o<r.length;++o)e(o);var a=e=>{var t=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return t.test(String(e).toLowerCase())};t(window).on("click",function(e){t(".tutor-notification, .search_result").removeClass("show")});t(".tutor-notification-close").click(function(e){t(".tutor-notification").removeClass("show")});var n=false;var i=e=>{e.forEach(e=>{e.onchange=t=>{if(false===a(e.value)){e.style.borderColor="red";e.focus();n=false}else{e.style.borderColor="#ddd";n=true}}})};var s=e=>{e.forEach(e=>{e.oninput=e=>{var{target:t}=e;var r=Number(t.getAttribute("min")||-Infinity);var o=Number(t.getAttribute("max")||Infinity);var a=t.getAttribute("data-number-type")||"decimal";var n=Number(t.value);if(r!==-Infinity&&n<=r)e.target.value=r;if(o!==Infinity&&n>=o)e.target.value=o;if(["integer","int"].includes(a))e.target.value=parseInt(e.target.value)}})};var l=e=>{e.forEach(e=>{var t=e.closest(".tutor-option-nav-page");var r=e&&e.parentNode.parentNode.querySelector("[tutor-option-name]").innerText;var o=t&&t.querySelector("[tutor-option-title]").innerText;var i='"'+o+" > "+r+'" email is invalid!';if(e.value&&false===a(e.value)){e.style.borderColor="red";e.focus();tutor_toast(__("Warning","tutor"),i,"error")}else{n=true}})};var c=e=>{e.forEach(e=>{// console.log(numberField);
})};var u=document.querySelectorAll('.tutor-form-control[type="email"]');// const inputEmailFields = document.querySelectorAll('[type="email"]');
var d=document.querySelectorAll('.tutor-form-control[type="number"]');// const inputNumberFields = document.querySelectorAll('[type="number"]');
if(d.length)s(d);if(0!==u.length){i(u)}else{n=true}t("#save_tutor_option").click(function(e){e.preventDefault();t("#tutor-option-form").submit()});t("#tutor-option-form").submit(function(e){e.preventDefault();if(tinyMCE){tinyMCE.triggerSave()}var r=t("#save_tutor_option");var o=t(this);var a=o.serializeObject();// if (typeof inputNumberFields !== 'undefined') {
if(0!==d.length){c(d)}// if (typeof inputEmailFields !== 'undefined') {
if(0!==u.length){l(u)}// Only keep action and properties that starts with tutor_option
a=Object.fromEntries(Object.entries(a).filter(e=>{var[t,r]=e;return t==="action"||t.startsWith("tutor_option")}));if(true===n){if(!e.detail||e.detail==1){t.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:a,beforeSend:function e(){r.addClass("is-loading");r.attr("disabled",true)},success:function e(e){var{data:t={},success:r,message:o=__("Settings Saved","tutor"),reload_required:a=false}=e||{};if(r){// Disabling save btn after saved successfully
if(document.getElementById("save_tutor_option")){document.getElementById("save_tutor_option").disabled=true}tutor_toast(__("Success!","tutor"),t.message||o,"success");window.dispatchEvent(new CustomEvent("tutor_option_saved",{detail:t}));if(a){window.location.reload(true)}}else{tutor_toast(__("Error!","tutor"),t.message||o,"error")}},error:function e(){tutor_toast(__("Error!","tutor"),__("Something went wrong!","tutor"),"error")},complete:function e(){r.removeClass("is-loading");r.attr("disabled","disabled")}})}}});function v(e,t,r,o,a){var n=o?"".concat(S," ").concat(o):"";var i='\n		<a data-tab="'.concat(t,'" data-key="field_').concat(a,'">\n			<div class="search_result_title">\n			').concat(E,'\n			<span class="tutor-fs-7">').concat(e,'</span>\n			</div>\n			<div class="search_navigation">\n			<div class="nav-track tutor-fs-7">\n				<span>').concat(r,"</span>\n				<span>").concat(n,"</span>\n			</div>\n			</div>\n		</a>");return i}var p;t("#search_settings").on("input",function(e){e.preventDefault();var r=t(this);if(p){window.clearTimeout(p)}p=window.setTimeout(()=>{if(e.target.value){var o=this.value;t.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:{action:"tutor_option_search",keyword:o},beforeSend:function e(){r.parent().find(".tutor-form-icon").removeClass("tutor-icon-search").addClass("tutor-icon-circle-notch tutor-animation-spin")},success:function e(e){if(!e.success){tutor_toast(__("Error","tutor"),b(e),"error");return}var a="",n="",i=true,s="",l="",c="",u="",d="",p="",m="",f=e.data.fields;Object.values(f).forEach(function(e,t,r){var f;s=e.label;l=e.section_slug;c=e.section_label;u=e.block_label;m=e.event?e.key+"_"+e.event:e.key;p=new RegExp(o,"ig");d=(f=s.match(p))===null||f===void 0?void 0:f[0];if(d){n=s.replace(p,"<span style='color: #212327; font-weight:500'>".concat(d,"</span>"));a+=v(n,l,c,u,m);i=false}});if(i){a+='<div class="no_item">'.concat(L," No Results Found</div>")}t(".search_result").html(a).addClass("show");r.parent().find(".tutor-form-icon").removeClass("tutor-icon-circle-notch tutor-animation-spin").addClass("tutor-icon-search");a=""},complete:function e(){m()}})}else{document.querySelector(".search-popup-opener").classList.remove("show")}p=undefined},500)});/**
	 * Search suggestion, navigation trigger
	 */function m(){var e=document.querySelectorAll(".tutor-options-search .search-popup-opener a");var t=document.querySelectorAll("[tutor-option-tabs] li > a");var r=document.querySelectorAll(".tutor-option-nav-page");e.forEach(e=>{e.addEventListener("click",e=>{var o=e.target.closest("[data-tab]").dataset.tab;var a=e.target.closest("[data-key]").dataset.key;if(o){document.title=e.target.innerText+" < "+_tutorobject.site_title;t.forEach(e=>{e.classList.remove("is-active")});// add active to the current nav item
document.querySelector(".tutor-option-tabs [data-tab=".concat(o,"]")).classList.add("is-active");// hide other tab contents
r.forEach(e=>{e.classList.remove("is-active")});// add active to the current content
document.querySelector(".tutor-option-tab-pages #".concat(o)).classList.add("is-active");// History push
var n=new URL(window.location);n.searchParams.set("tab_page",o);window.history.pushState({},"",n)}// Reset + Hide Suggestion box
document.querySelector(".search-popup-opener").classList.remove("visible");document.querySelector('.tutor-options-search input[type="search"]').value="";// Highlight selected element
f(a)})})}/**
	 * Highlight items form search suggestion
	 */function f(e){var t=document.querySelector("#".concat(e));var r=t&&t.querySelector("[tutor-option-name]");if(r){r.classList.add("isHighlighted");setTimeout(()=>{r.classList.remove("isHighlighted")},6e3);r.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}else{console.warn("scrollTargetEl Not found!")}}/**
	 * Highlight items form query params
	 */var _=new URLSearchParams(window.location.search);if(_.get("highlight")){f(_.get("highlight"))}/**
	 * Input value change detector (Normal/Hidden input)
	 * 
	 * @param object	element 
	 * @param function	callback 
	 * @return void
	 * 
	 * @since 2.0.7
	 */function g(e,t){MutationObserver=window.MutationObserver||window.WebKitMutationObserver;var r=new MutationObserver(function(r,o){if(r[0].attributeName=="value"){if(typeof t==="function"){t(e.value)}}});r.observe(e,{attributes:true})}/**
	 * On toggle switch change - show, hide setting's elements
	 * @since 2.1.9
	 */function h(e){var r=e.is(":checked");var o=e.data("toggle-fields").split(",");if(Array.isArray(o)===false||o.length===0)return;o=o.map(e=>e.trim());r?o.forEach(e=>t("#field_".concat(e)).removeClass("tutor-hide-option")):o.forEach(e=>t("#field_".concat(e)).addClass("tutor-hide-option"));var a=e.closest(".tutor-option-field-row");var n=e.closest(".item-wrapper");var i=n.find(".tutor-option-field-row").not("div.tutor-hide-option");if(i.length===1){a.addClass("tutor-option-no-bottom-border")}else{a.removeClass("tutor-option-no-bottom-border");i.last().addClass("tutor-option-no-bottom-border")}}var y=t('input[type="checkbox"][data-toggle-fields]');y.each(function(){h(t(this))});y.change(function(){h(t(this))});/**
	 * On toggle switch change - show, hide setting's blocks
	 * @since 3.0.0
	 */function w(e){var r=e.is(":checked");var o=e.data("toggle-blocks").split(",");if(Array.isArray(o)===false||o.length===0)return;o=o.map(e=>e.trim());o.forEach(e=>{if(r){t(".tutor-option-single-item.".concat(e)).removeClass("tutor-d-none")}else{t(".tutor-option-single-item.".concat(e)).addClass("tutor-d-none")}})}var k=t('input[type="checkbox"][data-toggle-blocks]');k.each(function(){w(t(this))});k.change(function(){w(t(this))});/**
	 * Show/Hide setting option
	 * @param object element			Dom object
	 * @param conditionFn function	Condition function
	 * @return void
	 * 
	 * @since 2.0.7
	 */function q(e,t){if(!e)return;if(t()){e.classList.remove("tutor-d-none")}else{e.classList.add("tutor-d-none")}// Remove border if only one item left.
var r=e.closest(".item-wrapper");if(r){var o=r.querySelectorAll(".tutor-option-field-row:not(.tutor-d-none)");if(o.length&&o.length===1){o[0].classList.add("tutor-option-no-bottom-border")}else{o[0].classList.remove("tutor-option-no-bottom-border")}}}/**
	 * Woocommerce order auto complete
	 *
	 * @since 2.0.5
	 * 
	 * Invoice generate options added
	 *
	 * @since 2.1.4
	 * 
	 * Monetization options refactored
	 *
	 * @since 3.0.0
	 */var C=document.querySelector("[name='tutor_option[monetize_by]']");if(C){var x=C===null||C===void 0?void 0:C.value;var A=document.querySelector("[data-toggle-fields=sharing_percentage]");var j=["tutor","wc","edd","pmpro","restrict-content-pro"];var T=document.querySelector(".tutor-option-single-item.woocommerce");var I=document.querySelector(".tutor-option-single-item.ecommerce_currency");var D=document.querySelector(".tutor-option-single-item.revenue_sharing");var O=document.querySelector(".tutor-option-single-item.fees");var M=document.querySelector(".tutor-option-single-item.withdraw");var B=document.querySelector(".tutor-option-single-item.ecommerce_invoice");var F=document.querySelector("#field_tutor_cart_page_id");var N=document.querySelector("#field_tutor_checkout_page_id");q(T,()=>x==="wc");q(I,()=>x==="tutor");q(F,()=>x==="tutor");q(N,()=>x==="tutor");q(B,()=>x==="tutor");q(D,()=>j.includes(x));q(O,()=>j.includes(x)&&(A===null||A===void 0?void 0:A.checked));q(M,()=>j.includes(x)&&(A===null||A===void 0?void 0:A.checked));// Handle monetization fields on change.
C.onchange=e=>{var t=e.target.value;q(T,()=>t==="wc");q(I,()=>t==="tutor");q(F,()=>t==="tutor");q(N,()=>t==="tutor");q(B,()=>t==="tutor");q(D,()=>j.includes(t));q(O,()=>j.includes(t)&&(A===null||A===void 0?void 0:A.checked));q(M,()=>j.includes(t)&&(A===null||A===void 0?void 0:A.checked))}}/**
	 * Maxlength counter for Textarea and Text field.
	 * @since 2.2.3
	 */var P=t(".tutor-option-field-input textarea[maxlength], .tutor-option-field-input input[maxlength]");P.each(function(){var e=t(this),r=t(this).attr("maxlength"),o=t(this).val().length,a="".concat(o,"/").concat(r);e.css("margin-right",0);t(this).parent().append('<div class="tutor-field-maxlength-info tutor-mr-4 tutor-fs-8 tutor-color-muted">'.concat(a,"</div>"))});P.keyup(function(){var e=t(this),r=t(this).attr("maxlength"),o=t(this).val().length,a="".concat(o,"/").concat(r);e.parent().find(".tutor-field-maxlength-info").text(a)});/**
	 * Tutor option password type hide and show
	 * 
	 * @since 3.0.0
	 */document.querySelectorAll(".tutor-option-field-input .tutor-type-password").forEach(e=>{var t=e.querySelector("input");var r=e.querySelector("button");var o=r===null||r===void 0?void 0:r.querySelector("i");if(!t||!r||!o){return}r.addEventListener("click",()=>{var e=t.type==="password";t.type=e?"text":"password";o.className=e?"tutor-icon-eye-bold":"tutor-icon-eye-slash-bold"})});/**
	 * Tutor option withdraw bank transfer instruction hide and show
	 * 
	 * @since 3.0.0
	 */var H=document.querySelector("#tutor_check_bank_transfer_withdraw");var R=document.querySelector("#field_tutor_bank_transfer_withdraw_instruction");if(H&&R){if(!H.checked){var U;R.classList.add("tutor-d-none");(U=R.previousElementSibling)===null||U===void 0?void 0:U.classList.add("tutor-option-no-bottom-border")}H.addEventListener("change",e=>{var t;R.classList.toggle("tutor-d-none",!e.target.checked);(t=R.previousElementSibling)===null||t===void 0?void 0:t.classList.toggle("tutor-option-no-bottom-border",!e.target.checked)})}});// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/segments/reset.js
var k=r(76592);// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/segments/withdraw.js
document.addEventListener("DOMContentLoaded",function(){var{__,_x:e,_n:r,_nx:o,sprintf:a}=wp.i18n;// Approve and Reject button
var n=document.querySelectorAll(".tutor-admin-open-withdraw-approve-modal");var i=document.querySelectorAll(".tutor-admin-open-withdraw-reject-modal");var s;// Onclick button dynamically create content
if(n){for(var l of n){l.onclick=e=>{s=e.currentTarget.dataset.id;var t=e.currentTarget.dataset.amount;var r=e.currentTarget.dataset.name;var o=document.getElementById("tutor-admin-withdraw-approve-content");o.innerHTML="".concat(/* translators: %1$s is the Account name and %2$s is the Amount */a(__("You are approving %1$s withdrawal request for %2$s. Are you sure you want to approve?","tutor"),'<strong style="color:#000;">'.concat(r,"</strong>"),'<strong  style="color:#000;">'.concat(t,"</strong>")))}}}// Onclick button dynamically create content
if(i){for(var c of i){c.onclick=e=>{s=e.currentTarget.dataset.id;var t=e.currentTarget.dataset.amount;var r=e.currentTarget.dataset.name;var o=document.getElementById("tutor-admin-withdraw-reject-content");o.innerHTML="".concat(/* translators: %1$s is the Account name and %2$s is the Amount */a(__("You are rejecting %1$s withdrawal request for %2$s. Are you sure you want to reject?","tutor"),'<strong style="color:#000;">'.concat(r,"</strong>"),'<strong style="color:#000;">'.concat(t,"</strong>")))}}}// Approve & Reject form
var u=document.getElementById("tutor-admin-withdraw-approve-form");var d=document.getElementById("tutor-admin-withdraw-reject-form");// Handle form submit
if(u){u.onsubmit=e=>t(function*(){e.preventDefault();var t=new FormData(u);t.set("withdraw-id",s);var r=yield p(t,e.currentTarget);if(r.ok){var o=r.json();if(o){location.reload()}else{tutor_toast(__("Failed","tutor"),__("Something went wrong, please try again!","tutor"),"error")}}})()}if(d){d.onsubmit=e=>t(function*(){e.preventDefault();var t=new FormData(d);t.set("withdraw-id",s);var r=yield p(t,e.currentTarget);if(r.ok){var o=r.json();if(o){location.reload()}else{tutor_toast(__("Failed","tutor"),__("Something went wrong, please try again!","tutor"),"error")}}})()}// Onchange reject reason if other is value then create input field for adding reason
var v=document.getElementById("tutor-admin-withdraw-reject-type");if(v){v.onchange=e=>{var t=e.target.value;if(t==="Other"){document.getElementById("tutor-withdraw-reject-other").innerHTML='<input type="text" name="reject-comment" class="tutor-form-control" placeholder="'.concat(__("Withdraw Reject Reason","tutor"),'" required/>')}}}/**
     * Handle ajax request show toast message on success | failure
     *
     * @param {*} formData including action and all form fields
     */function p(e,r){return t(function*(){e.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);try{// select loading button
var t=r.querySelector("[data-tutor-modal-submit]");t.classList.add("is-loading");var o=yield fetch(window._tutorobject.ajaxurl,{method:"POST",body:e});t.classList.remove("is-loading");return o}catch(e){tutor_toast(__("Operation failed","tutor"),e,"error")}})()}/*
    * function to copy 
    * @textToCopy string
    * return a promise
    */function m(e){// navigator clipboard api needs a secure context (https)
if(navigator.clipboard&&window.isSecureContext){// navigator clipboard api method'
return navigator.clipboard.writeText(e)}else{// text area method
var t=document.createElement("textarea");t.value=e;// make the textarea out of viewport
t.style.position="fixed";t.style.left="-999999px";t.style.top="-999999px";document.body.appendChild(t);t.focus();t.select();return new Promise((e,r)=>{// here the magic happens
document.execCommand("copy")?e():r();t.remove()})}}var f=document.querySelectorAll(".withdraw-tutor-copy-to-clipboard");if(f){var _=function(e){e.addEventListener("click",t=>{m(t.currentTarget.dataset.textCopy).then(t=>{var r=e.innerHTML;e.innerHTML="".concat(__("Copied","tutor"));setTimeout(()=>{e.innerHTML=r},5e3)})})};for(var g of f)_(g)}});// EXTERNAL MODULE: ./assets/src/js/front/_select_dd_search.js
var q=r(71962);// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/quiz-attempts.js
/**
 * Get quiz attempts count data
 *
 * @since v2.0.6
 */document.addEventListener("DOMContentLoaded",function(){return t(function*(){// Create new course
var e=_tutorobject.current_page;if(e==="tutor_quiz_attempts"){var t=new FormData;t.set("action","tutor_quiz_attempts_count");t.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);var r=new URLSearchParams(window.location.search);var a=["course-id","date","search"];a.forEach(e=>{var o=r.get(e);if(o){t.set(e.replace("-","_"),o)}});var n=yield o(t);if(n.ok){var i=yield n.json();if(i.success&&i.data){var s=document.querySelector(".tutor-form-control[name=data]");if(s){var l=document.querySelectorAll(".tutor-form-control[name=data] + .tutor-form-select .tutor-form-select-label");l.forEach(e=>{e.innerHTML=e.innerHTML.replace("(0)","(".concat(i.data[s.value||"all"],")"))})}var c=document.querySelectorAll(".tutor-form-control[name=data] + .tutor-form-select [tutor-dropdown-item]");c.forEach(e=>{e.innerHTML=e.innerHTML.replace("(0)","(".concat(i.data[e.dataset.key||"all"],")"))})}}}})()});// EXTERNAL MODULE: ./assets/src/js/admin-dashboard/wp-events-subscriber.js
var C=r(39298);// CONCATENATED MODULE: ./assets/src/js/admin-dashboard/tutor-admin.js
document.querySelectorAll(".tutor-control-button").forEach(function(e){e.addEventListener("click",function(t){e.classList.toggle("active");var r=e.querySelector('input[type="checkbox"]');r.checked=!r.checked;r.dispatchEvent(new Event("change",{bubbles:true}))})});jQuery(document).ready(function(e){"use strict";var r;var{__}=wp.i18n;/**i
	 * Color Picker
	 * @since v.1.2.21
	 */if(jQuery().wpColorPicker){e(".tutor_colorpicker").wpColorPicker()}if(jQuery().select2){e(".tutor_select2").select2()}/**
	 * Open Sidebar Menu
	 */if(_tutorobject.open_tutor_admin_menu){var a=e("#adminmenu");a.find('[href="admin.php?page=tutor"]').closest("li.wp-has-submenu").addClass("wp-has-current-submenu");a.find('[href="admin.php?page=tutor"]').closest("li.wp-has-submenu").find("a.wp-has-submenu").removeClass("wp-has-current-submenu").addClass("wp-has-current-submenu")}e(document).on("click",".tutor-option-media-upload-btn",function(t){t.preventDefault();var r=e(this);var o;if(o){o.open();return}o=wp.media({title:__("Select or Upload Media Of Your Choice","tutor"),button:{text:__("Upload media","tutor")},multiple:false});o.on("select",function(){var e=o.state().get("selection").first().toJSON();r.closest(".option-media-wrap").find(".option-media-preview").html('<img src="'+e.url+'" alt="" />');r.closest(".option-media-wrap").find("input").val(e.id);r.closest(".option-media-wrap").find(".tutor-media-option-trash-btn").show()});o.open()});/**
	 * Remove option media
	 * @since v.1.4.3
	 */e(document).on("click",".tutor-media-option-trash-btn",function(t){t.preventDefault();var r=e(this);r.closest(".option-media-wrap").find("img").remove();r.closest(".option-media-wrap").find("input").val("");r.closest(".option-media-wrap").find(".tutor-media-option-trash-btn").hide()});// $(document).on("change", ".tutor-form-toggle-input", function(e) {
//   var $that = $(this);
//   var isEnable = $that.prop("checked") ? 1 : 0;
//   var addonFieldName = $that.attr("name");
//   $.ajax({
//     url: window._tutorobject.ajaxurl,
//     type: "POST",
//     data: {
//       isEnable: isEnable,
//       addonFieldName: addonFieldName,
//       action: "addon_enable_disable",
//     },
//     success: function(data) {
//       if (data.success) {
//         //Success
//       }
//     },
//   });
// });
/**
	 * Add instructor
	 * @since v.1.0.3
	 */e(document).on("submit","#tutor-new-instructor-form",function(t){t.preventDefault();var r=e(this);var o=r.serializeObject();var a=e("#tutor-new-instructor-form [data-tutor-modal-submit]");var n=e("#tutor-new-instructor-form-response");o.action="tutor_add_instructor";e.ajax({url:window._tutorobject.ajaxurl,type:"POST",data:o,beforeSend:function e(){a.attr("disabled","disable").addClass("is-loading");n.html("")},success:function t(t){if(!t.success){var r;if(t===null||t===void 0?void 0:(r=t.data)===null||r===void 0?void 0:r.errors.errors){for(var o of Object.values(t.data.errors.errors)){n.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>\n											'.concat(o,"\n										</span>\n									</div>\n									</div>\n								</div>\n              				"))}}else{for(var a of Object.values(t.data.errors)){n.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>\n											'.concat(a,"\n										</span>\n									</div>\n									</div>\n								</div>\n							"))}}}else{e("#tutor-new-instructor-form").trigger("reset");tutor_toast(__("Success","tutor"),__("New Instructor Added","tutor"),"success");location.reload()}},complete:function e(){a.removeAttr("disabled").removeClass("is-loading")}})});/**
	 * Instructor block unblock action
	 * @since v.1.5.3
	 */e(document).on("click","a.instructor-action",function(r){return t(function*(){r.preventDefault();var t=e(this);var a=t.attr("data-action");var n=t.attr("data-instructor-id");var i=r.target;var s=i.innerHTML;i.innerHTML="";i.classList.add("is-loading");// prepare form data
var l=new FormData;l.set("action","instructor_approval_action");l.set("action_name",a);l.set("instructor_id",n);l.set(window.tutor_get_nonce_data(true).key,window.tutor_get_nonce_data(true).value);try{var c=yield o(l);var u=yield c.json();if(i.classList.contains("is-loading")){i.classList.remove("is-loading");i.innerHTML=a.charAt(0).toUpperCase()+a.slice(1)}if(c.ok&&u.success){var d="";if(a=="approve"){d="Instructor approved!"}if(a=="blocked"){d="Instructor blocked!"}/**
				 * If it is instructor modal for approve or blocked
				 * hide modal then show toast then reload
				 *
				 * @since v2.0.0
				 */var v=document.querySelector(".tutor-modal-ins-approval");if(v){if(v.classList.contains("tutor-is-active")){v.classList.remove("tutor-is-active")}tutor_toast(__("Success","tutor"),__(d,"tutor"),"success");location.href="".concat(window._tutorobject.home_url,"/wp-admin/admin.php?page=tutor-instructors")}else{tutor_toast(__("Success","tutor"),__(d,"tutor"),"success");location.reload()}}else{tutor_toast(__("Failed","tutor"),__("Something went wrong!","tutor"),"error")}}catch(e){i.innerHTML=s;tutor_toast(__("Operation failed","tutor"),e,"error")}}).call(this)});/**
	 * If click on close instructor approve or modal then redirect to main URL
	 * if not redirect then it will not work with pagination.
	 */var n=document.querySelector(".tutor-modal-ins-approval .tutor-icon-56.tutor-icon-line-cross-line");if(n){n.addEventListener("click",function(){console.log("ckk");location.href="".concat(window._tutorobject.home_url,"/wp-admin/admin.php?page=tutor-instructors")})}/**
	 * On form submit block | approve instructor
	 *
	 * @since v.2.0.0
	 */// if (instructorActionForm) {
//   instructorActionForm.onsubmit = async (e) => {
//     e.preventDefault();
//     const formData = new FormData(instructorActionForm);
//     const loadingButton = instructorActionForm.querySelector('#tutor-instructor-confirm-btn.tutor-btn-loading');
//     const prevHtml = loadingButton.innerHTML;
//     loadingButton.innerHTML = `<div class="ball"></div>
//     <div class="ball"></div>
//     <div class="ball"></div>
//     <div class="ball"></div>`;
//     try {
//       const post = await ajaxHandler(formData);
//       const response = await post.json();
//       loadingButton.innerHTML = prevHtml;
//       if (post.ok && response.success) {
//         location.reload();
//       } else {
//         tutor_toast(__("Failed", "tutor"), __('Something went wrong!', 'tutor'), "error");
//       }
//     } catch (error) {
//       loadingButton.innerHTML = prevHtml;
//       tutor_toast(__("Operation failed", "tutor"), error, "error");
//     }
//   }
// }
/**
	 * Password Reveal
	 */e(document).on("click",".tutor-password-reveal",function(t){//toggle icon
e(this).toggleClass("tutor-icon-eye-line tutor-icon-eye-bold");//toggle attr
e(this).next().attr("type",function(e,t){return t=="password"?"text":"password"})});/**
	 * Used for backend profile photo upload.
	 *///tutor_video_poster_upload_btn
e(document).on("click",".tutor_video_poster_upload_btn",function(t){t.preventDefault();var r=e(this);var o;// If the media frame already exists, reopen it.
if(o){o.open();return}// Create a new media frame
o=wp.media({title:__("Select or Upload Media Of Your Choice","tutor"),button:{text:__("Upload media","tutor")},multiple:false});// When an image is selected in the media frame...
o.on("select",function(){// Get media attachment details from the frame state
var e=o.state().get("selection").first().toJSON();r.closest(".tutor-video-poster-wrap").find(".video-poster-img").html('<img src="'+e.sizes.thumbnail.url+'" alt="" />');r.closest(".tutor-video-poster-wrap").find("input").val(e.id)});// Finally, open the modal on click
o.open()});/**
	 * Tutor Memberships toggle in Paid Membership Pro panel
	 * @since v.1.3.6
	 */e(document).on("change","#tutor_pmpro_membership_model_select",function(t){t.preventDefault();var r=e(this);if(r.val()==="category_wise_membership"){e(".membership_course_categories").show()}else{e(".membership_course_categories").hide()}});e(document).on("change","#tutor_pmpro_membership_model_select",function(t){t.preventDefault();var r=e(this);if(r.val()==="category_wise_membership"){e(".membership_course_categories").show()}else{e(".membership_course_categories").hide()}});// Require category selection
e(document).on("submit",".pmpro_admin form",function(t){var r=e(this);if(!r.find('input[name="tutor_action"]').length){// Level editor or tutor action not necessary
return}if(r.find('[name="tutor_pmpro_membership_model"]').val()=="category_wise_membership"&&!r.find(".membership_course_categories input:checked").length){if(!confirm(__("Do you want to save without any category?","tutor"))){t.preventDefault()}}});/**
	 * Show hide is course public checkbox (backend dashboard editor)
	 *
	 * @since  v.1.7.2
	 */var i=e('#tutor-attach-product [name="tutor_course_price_type"]');if(i.length==0){e("#_tutor_is_course_public_meta_checkbox").show()}else{i.change(function(){if(e(this).prop("checked")){var t=e(this).val()=="paid"?"hide":"show";e("#_tutor_is_course_public_meta_checkbox")[t]()}}).trigger("change")}/**
	 * Focus selected instructor layout in setting page
	 *
	 * @since  v.1.7.5
	 */e(document).on("click",".instructor-layout-template",function(){e(".instructor-layout-template").removeClass("selected-template");e(this).addClass("selected-template")});/**
	 * Programmatically open preview link. For some reason it's not working normally.
	 *
	 * @since  v.1.7.9
	 */e("#preview-action a.preview").click(function(t){var r=e(this).attr("href");if(r){t.preventDefault();window.open(r,"_blank")}});/**
	 * If Tutor course edit then show tutor menu as active
	 *
	 * @since v2.0.0
	 */var s=document.querySelectorAll("#adminmenu li > a");if(window._tutorobject.is_tutor_course_edit&&s){s.forEach(e=>{if(e.tagName==="A"&&e.hasAttribute("href")&&e.getAttribute("href")=="admin.php?page=tutor"){e.classList.add("current");e.closest("li").classList.add("current");var t=e.closest("li#toplevel_page_tutor");var r=e.closest("#toplevel_page_tutor  li.wp-not-current-submenu.menu-top.toplevel_page_tutor > a");if(t){t.className="wp-has-submenu wp-has-current-submenu wp-menu-open menu-top toplevel_page_tutor current"}if(r){r.className="wp-has-submenu wp-has-current-submenu wp-menu-open menu-top toplevel_page_tutor current"}}})}/**
	 * Fix - Table last row context menu hidden.
	 * 
	 * @since 2.2.4
	 */var l=jQuery(".tutor-table-responsive .tutor-table .tutor-dropdown");if(l.length){var c=jQuery(".tutor-table-responsive .tutor-table").height();jQuery(".tutor-table-responsive").css("min-height",c+110)}/**
	 * Set get pro link
	 * @since 2.2.5
	 */var u=document.querySelector("span.tutor-get-pro-text");if((u===null||u===void 0?void 0:(r=u.parentElement)===null||r===void 0?void 0:r.nodeName)==="A"){var d=u.parentElement;var v="https://tutorlms.com/pricing?utm_source=tutor_plugin_get_pro_page&utm_medium=wordpress_dashboard&utm_campaign=go_premium";d.setAttribute("href",v);d.setAttribute("target","_blank")}/**
	 * Offer notice dismiss handler.
	 * 
	 * @since 4.0.0
	 */var p=document.querySelector(".tutor-offer-notice-dismiss");if(p){p.addEventListener("click",function(){return t(function*(){p.disabled=true;try{var e=document.querySelector(".tutor-offer-notice");e.remove();var t=new FormData;t.set("action","tutor_dismiss_offer_notice");var r=yield o(t);if(!r.ok){throw new Error(__("Operation failed","tutor"))}}catch(e){tutor_toast(__("Operation failed","tutor"),e,"error");p.disabled=false;setTimeout(()=>{window.location.reload()},1e3)}})()})}/**
	 * Offer notice countdown timer.
	 *
	 * @since 4.0.0
	 */var m=document.querySelector(".tutor-offer-notice-timer");if(m){var f=parseInt(m.dataset.expiry,10)*1e3;if(!f)return;var _=e=>String(e).padStart(2,"0");var g=()=>{var e=Date.now();var t=Math.max(0,f-e);var r=Math.floor(t/864e5);var o=Math.floor(t%864e5/36e5);var a=Math.floor(t%36e5/6e4);var n=Math.floor(t%6e4/1e3);m.textContent="".concat(r,"d:").concat(_(o),"h:").concat(_(a),":").concat(_(n));if(t<=0){clearInterval(h)}};g();var h=setInterval(g,1e3)}})})()})();