(()=>{var e={};/************************************************************************/// The module cache
var t={};// The require function
function r(a){// Check if module is in cache
var o=t[a];if(o!==undefined){return o.exports}// Create a new module (and put it into the cache)
var l=t[a]={exports:{}};// Execute the module function
e[a](l,l.exports,r);// Return the exports of the module
return l.exports}/************************************************************************/// webpack/runtime/rspack_version
(()=>{r.rv=()=>"1.4.11"})();// webpack/runtime/rspack_unique_id
(()=>{r.ruid="bundler=rspack@1.4.11"})();/************************************************************************/document.addEventListener("DOMContentLoaded",function(){var e=document.querySelector(".tutor-template-import-area");var t=document.querySelector(".tutor-template-preview-modal");var r=document.querySelector(".tutor-template-preview-modal-overlay");var a=document.querySelector(".tutor-template-preview-iframe-wrapper");var o=document.getElementById("tutor-template-preview-iframe");var l=document.querySelector(".tutor-template-preview-modal-back-link");var i=document.querySelectorAll(".tutor-template-preview-device-switcher li");var d=document.querySelector(".tutor-preview-template-name");var c=document.querySelector(".tutor-template-shimmer-effect");var n=document.querySelector(".tutor-template-import-btn");var s=document.getElementById("tutor_template_course_data_url");var u=document.getElementById("droip-color-presets");if(e){// Open live preview modal
e.addEventListener("click",e=>{if(e.target.closest(".tutor-template-preview-btn")){var r;document.body.style.overflow="hidden";c.style.display="block";t.style.display="flex";d.innerText=e.target.dataset.template_name;s.value=e.target.dataset.template_course_data_url;o.src=e.target.dataset.template_url;if((r=_tutorobject)===null||r===void 0?void 0:r.tutor_pro_url){n.setAttribute("data-import_template_id",e.target.dataset.template_id)}}});// Hide loading indicator when iframe is fully loaded
o.addEventListener("load",function(){c.style.display="none"});l===null||l===void 0?void 0:l.addEventListener("click",function(){v();var e=n.querySelector("i");n.classList.remove("is-loading");n.classList.add("tutor-template-import-btn");n.classList.remove("tutor-template-view-template-btn");e.classList.add("tutor-icon-import");e.classList.remove("tutor-icon-circle-mark");var t='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" role="presentation" aria-hidden="true" class="css-xron3k-svg-SVGIcon"><rect width="16" height="16" rx="8" fill="#E5803C"></rect><path d="M12.252 7.042c0 .004 0 .008-.003.012l-.862 3.951a.609.609 0 0 1-.598.495H5.213a.61.61 0 0 1-.598-.495l-.862-3.95c0-.005-.002-.009-.003-.013a.609.609 0 0 1 1.056-.51l1.28 1.38 1.362-3.054v-.004a.609.609 0 0 1 1.106.004l1.362 3.054 1.28-1.38a.609.609 0 0 1 1.055.51h.001Z" fill="#fff"></path></svg>';n.innerHTML="".concat(e.outerHTML," import ").concat(_tutorobject.tutor_pro_url?"":t)});// Device switcher
i.forEach(e=>{e.addEventListener("click",function(){m(i);e.classList.add("active");var t=this.getAttribute("data-width");var r=this.getAttribute("data-height");var a=this.getAttribute("data-device");o.style.width=t;if("desktop"!==a){o.style.transform="scale(0.8085714286)";o.style.transformOrigin="center top"}else{o.style.transform="scale(0.8085714286)";o.style.transformOrigin="left top"}})});// Reset preview modal
function v(){t.style.display="none";o.src="";m(i);i[0].classList.add("active");c.style.display="none";document.body.style.overflow="visible";o.style.width="1400px";u.style.display="none"}// Remove active class from device list
function m(e){e.forEach(e=>{e.classList.remove("active")})}}});(function(){var e=document.querySelector("#tutor-template-preview-iframe");document.addEventListener("DOMContentLoaded",()=>{// Wait for the iframe to load before interacting with it
e.addEventListener("load",()=>{window.addEventListener("message",t);var e=document.querySelector(".tutor-template-preview-import-area .tutor-template-shimmer-effect-2");e.style.display="none";o();// Safe to send message now
l()})});var t=e=>{var{type:t}=e.data;switch(t){case"RETURN_DROIP_VARIABLE_DATA":{var a,o,l;if(((l=e.data.droipCSSVariable)===null||l===void 0?void 0:(o=l.data)===null||o===void 0?void 0:(a=o[0])===null||a===void 0?void 0:a.modes.length)>1){var c=document.querySelector(".tutor-droip-color-presets-heading");c.style.display="block";var n=document.querySelector("#droip-color-modes");n.style.display="block";var s=e.data.droipCSSVariable.data[0];var u=s.modes;// Hide #color-preset if 1 or fewer modes
colorPresetBlock=document.getElementById("droip-color-presets");if(n&&colorPresetBlock){if(u.length<=1){colorPresetBlock.style.display="none"}else{colorPresetBlock.style.display="flex";colorPresetBlock.style.justifyContent="center";colorPresetBlock.style.alignItems="center"}}var v=document.createElement("div");v.classList.add("all-colors-wrapper");v.style.display="flex";u.forEach((e,t)=>{var r=d(e.key,s);var a=document.createElement("div");a.classList.add("color-palette");a.setAttribute("data-mode",e.key);r.forEach((e,t)=>{if(t<3){var r='<div style="background-color:'.concat(e,';" data-index="').concat(t,'"></div>');a.innerHTML+=r}});v.append(a)});document.querySelector("#droip-color-modes").innerHTML=v.outerHTML;document.querySelectorAll(".color-palette").forEach(e=>{e.addEventListener("click",()=>{var t=e.getAttribute("data-mode");i(t);r(t)})})}break}case"RETURN_DROIP_ACTIVE_MODE":{var m;var p=(e===null||e===void 0?void 0:(m=e.data)===null||m===void 0?void 0:m.activeMode)||"default";r(p);break}}};var r=e=>{var t,r;var a=document.querySelectorAll(".color-palette");if(!a)return;a.forEach(e=>{e.classList.remove("active")});(r=document.querySelector('[data-mode="'+e+'"]'))===null||r===void 0?void 0:(t=r.classList)===null||t===void 0?void 0:t.add("active")};var a=t=>{e.contentWindow.postMessage(t,"*");// You can replace '*' with the exact origin
};var o=()=>{a({type:"GET_DROIP_VARIABLE_DATA"})};var l=()=>{a({type:"GET_DROIP_ACTIVE_MODE"})};var i=e=>{a({type:"APPLY_DROIP_VARIABLE_PALETTE",mode:e})};var d=(e,t)=>{if(!t||!t.variables){return[]}var r=t.variables.filter(e=>e.type==="color").map(t=>{var r,a;if((r=t.value)===null||r===void 0?void 0:r[e]){return t.value[e]}if((a=t.value)===null||a===void 0?void 0:a.default){return t.value.default}return"#000000"});return r}})()})();