!function(t,e){"use strict";ElementsKit_Helper.registerWidget("elementskit-coupon-code.default",(function(e){var o=e.find(".ekit-coupon-popup"),i=e.find(".ekit-coupon-wrapper"),n=e.find(".ekit-coupon-outer"),c=e.find(".ekit_coupon_btn_group");let a;o.magnificPopup({type:"inline",fixedContentPos:!0,fixedBgPos:!0,overflowY:"auto",closeBtnInside:!0,prependTo:e.find(".ekit-wid-con"),showCloseBtn:!1,callbacks:{beforeOpen:function(){this.st.mainClass="my-mfp-slide-bottom ekit-promo-popup ekit-coupon-popup ekit-coupon-modal"}}}),e.find(".ekit-coupon-modal-close").on("click",(function(){o.magnificPopup("close")})),t(i).on("click",(function(){var e=t(this).find("#btn_copy_code"),o=t(this).find("#copy_code"),i=t(this).data("popup-select");t(o).removeClass("slide-hide"),"click"==i&&t(e).addClass("slide-hide")})),e.find(".ekit_copy_btn_text").on("click",(function(e){t(this).addClass("active"),t(this).next(".ekit_after_copied_text").addClass("active"),a&&clearTimeout(a),a=setTimeout((()=>{t(this).removeClass("active"),t(this).next(".ekit_after_copied_text").removeClass("active")}),2e3)})),e.find(".ekit_coupon_copybtn").on("click",(function(o){let i=e.find(".ekit_coupon_copy_code").data("coupon-text"),n=e.find(".ekit_copybtn_text").text();t(this).find(".ekit_coupon_btn_group_wrap .ekit_copybtn_text").text(`${i}`),a&&clearTimeout(a),a=setTimeout((()=>{t(this).find(".ekit_coupon_btn_group_wrap .ekit_copybtn_text").text(`${n}`)}),2e3)}));var d=function(t){navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(t)["catch"]((function(){p(t)})):p(t)},p=function(e){var o=t("<textarea>");t("body").append(o),o.val(e).select(),document.execCommand("copy"),o.remove()};t(i).on("click",(function(){var e=t(this).find(".ekit_coupon_code").data("coupon");e&&d(e)})),t(n).on("click",(function(){var e=t(this).find(".ekit_modal_code").data("coupon");e&&d(e)})),t(c).on("click",(function(){var e=t(this).find(".ekit_coupon_copy_code").data("coupon");e&&d(e)}));const s=document.querySelectorAll(".click-to-copy__text"),l=document.querySelectorAll(".copy_success");s.length&&l.length&&s.forEach(((t,e)=>{const o=l[e];t.addEventListener("click",(()=>{navigator.clipboard.writeText(t.textContent),t.classList.add("hide"),o.classList.remove("hide"),setTimeout((()=>{t.classList.remove("hide"),o.classList.add("hide")}),1500)}))}))}))}(jQuery,window.elementorFrontend);