var SmilePackDashboard=function(){function t(){this.initEvents()}var e=t.prototype;return e.initEvents=function(){document.addEventListener("click",function(t){this.toggleModuleStatus(t),this.copySmartTagToClipboard(t)}.bind(this))},e.toggleModuleStatus=function(t){var e,o,i,a=t.target.closest(".smilePackModuleStatusToggle");a&&(t=a.closest(".smilepack-grid--item"),e=a.closest(".smilepack-grid").dataset.rootUrl,o=a.closest(".smilepack-grid").dataset.token,t=t.dataset.module,i=a.querySelector('input[type="checkbox"]').checked?1:0,a.classList.add("working"),fetch(e+"?option=com_ajax&format=raw&plugin=smilepack&task=toggleModuleStatus&"+o+"=1&mod="+t+"&status="+i,{method:"POST"}).then(function(t){return t.json()}).then(function(t){a.classList.remove("working")}))},e.copySmartTagToClipboard=function(t){var e=t.target.closest(".smilepack-copy-to-clipboard-trigger");e&&(document.querySelectorAll(".smilepack-copy-to-clipboard-trigger").forEach(function(t){t.classList.remove("is-copied")}),t=e.querySelector(".smilepack-copy-to-clipboard-text"),navigator.clipboard.writeText(t.innerHTML),e.classList.add("is-copied"),setTimeout(function(){e.classList.remove("is-copied")},1500))},t}();document.addEventListener("DOMContentLoaded",function(){new SmilePackDashboard});

