jQuery(document).ready(function(e){"use strict";var t;if((t=window.location.hash)&&e(`${t}-tab`).trigger("click"),e(".ekit-admin-single-accordion").on("click",".ekit-admin-single-accordion--heading",function(){e(this).next().slideToggle().parent().toggleClass("active").siblings().removeClass("active").find(".ekit-admin-single-accordion--body").slideUp()}),e(".ekit-admin-single-accordion:first-child .ekit-admin-single-accordion--heading").trigger("click"),e(".ekit-admin-video-tutorial-item").on("click","a",function(t){var i=e(this).data("video_id");i&&(t.preventDefault(),e(".ekti-admin-video-tutorial-popup").toggleClass("show").find(".ekti-admin-video-tutorial-iframe").html('<iframe width="700" height="400" src="https://www.youtube.com/embed/'+i+'?autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'))}),e(".ekti-admin-video-tutorial-close").on("click",function(){e(this).parents(".ekti-admin-video-tutorial-popup").removeClass("show").find(".ekti-admin-video-tutorial-iframe").html("")}),e(".ekit-admin-nav-link").on("click",function(t){e(this).hasClass("ekit-admin-nav-hidden")?t.preventDefault():(e(this).parents(".attr-nav-tabs").find("a").removeClass("top").removeClass("bottom"),e(this).parents("li").prev().find("a").addClass("top"),e(this).parents("li").next().find("a").addClass("bottom"))}),e(".ekit-admin-section-header").length>0){var i=e(".ekit-admin-section-header").offset().top;e(window).scroll(function(){var t=e(".ekit-admin-section-header");e(window).scrollTop()>=i?t.addClass("fixed").css({width:jQuery("#v-elementskit-tabContent").width()}):t.removeClass("fixed").css({width:"auto"})})}e("#ekit-admin-settings-form").on("submit",function(t){var i=e(this),a=i.find(".ekit-admin-settings-form-submit"),n=i.serialize();i.addClass("is-loading"),a.attr("disabled",!0),a.find(".ekit-admin-save-icon").hide(),e.post(ajaxurl+"?action=ekit_admin_action",n,function(t){var n,s,o,d;console.log(t),i.removeClass("is-loading"),a.removeAttr("disabled"),a.find(".ekit-admin-save-icon").fadeIn(),n=e("#ekit-admin-switch__module__list____header-footer").prop("checked"),s=e("#elementskit-template-admin-menu").html(),o=e("#toplevel_page_elementskit .wp-submenu"),d=o.find('a[href="edit.php?post_type=elementskit_template"]'),1==n?d.length>0||"y"==o.attr("item-added")?d.parent().show():(o.find("li.wp-first-item").after(s),o.attr("item-added","y")):d.parent().hide()}),t.preventDefault()}),e("#ekit-admin-license-form").on("submit",function(t){var i=e(this),a=i.find(".ekit-admin-license-form-submit"),n=i.serialize(),s=i.find(".elementskit-license-form-result .attr-alert");i.addClass("is-loading"),a.find(".ekit-admin-save-icon").hide(),e.post(ajaxurl+"?action=ekit_admin_license",n,function(e){i.removeClass("is-loading"),a.removeAttr("disabled"),a.find(".ekit-admin-save-icon").fadeIn(),s.attr("class","attr-alert attr-alert-"+e.status).html(e.message),1==e.validate&&setTimeout(function(){window.location.reload()},2e3)},"json"),t.preventDefault()}),e(".ekit-zoom-connection").on("click",function(e){e.preventDefault(),jQuery.ajax({data:{},type:"post",url:window.rest_config.rest_url+"elementskit/v1/zoom-meeting/hosts/",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",window.rest_config.nonce)},success:function(e){alert(e.message)}})}),e("#ekit_instagram_refresh_feed_btn").click(function(t){t.preventDefault();var i=elementskit.resturl+"widget/instagram-feed/refresh_feed",a=e("#ekit-admin-option-textuser__data__instragram____username__").val();e.get("https://www.instagram.com/"+a+"/?__a=1",function(t){console.log(t),e.ajax({type:"POST",url:i,data:{content:t},success:function(e){alert("Instagram data refreshed")},error:function(e){alert("Instagram data refreshed")}})})})});