jQuery(function(e){e(document).on("click",".sp-pagebuilder-btn-install",function(s){s.preventDefault();var a=e(this),n=a.closest("li").data("integration");e.ajax({type:"POST",url:pagebuilder_base+"index.php?option=com_sppagebuilder&task=integrations.install&integration="+n,beforeSend:function(){a.html('<i class="fa fa-spinner fa-spin"></i> Installing...')},success:function(s){a.find("i").removeAttr("class");var n=e.parseJSON(s);n.success?(a.html('<i class="fa fa-check"></i> Installed'),setTimeout(function(){a.closest("li").removeAttr("class").addClass("installed")},500)):alert(n.message)}})}),e(document).on("click",".sp-pagebuilder-btn-enable",function(s){s.preventDefault();var a=e(this),n=a.closest("li").data("integration");e.ajax({type:"POST",url:pagebuilder_base+"index.php?option=com_sppagebuilder&task=integrations.enable&integration="+n,beforeSend:function(){a.find("i").addClass("fa fa-spinner fa-spin")},success:function(s){a.find("i").removeAttr("class");var n=e.parseJSON(s);n.success?a.closest("li").removeAttr("class").addClass("enabled"):alert(n.message)}})}),e(document).on("click",".sp-pagebuilder-btn-disable",function(s){s.preventDefault();var a=e(this),n=a.closest("li").data("integration");e.ajax({type:"POST",url:pagebuilder_base+"index.php?option=com_sppagebuilder&task=integrations.disable&integration="+n,beforeSend:function(){a.find("i").addClass("fa fa-spinner fa-spin")},success:function(s){a.find("i").removeAttr("class");var n=e.parseJSON(s);n.success?a.closest("li").removeAttr("class").addClass("installed"):alert(n.message)}})}),e(document).on("click",".sp-pagebuilder-btn-uninstall",function(s){s.preventDefault();var a=e(this),n=a.closest("li").data("integration");e.ajax({type:"POST",url:pagebuilder_base+"index.php?option=com_sppagebuilder&task=integrations.uninstall&integration="+n,beforeSend:function(){a.html('<i class="fa fa-spinner fa-spin"></i> Uninstalling...')},success:function(s){a.find("i").remove();var n=e.parseJSON(s);n.success?(a.html('<i class="fa fa-check"></i> Uninstalled'),setTimeout(function(){a.html("Uninstall"),a.closest("li").removeAttr("class").addClass("available")},500)):alert(n.message)}})})});