(()=>{var n;jQuery(document).ready(((n=jQuery)(".ff_show_payments").on("click",function(t){t.preventDefault(),n(".ff_sub_cancel_confirmation").hide();var s=n(this),a=s.data("subscription_id"),e=s.closest(".ff_subscription").find(".ff_subscription_payments");if(s.attr("data-got_payments"))return s.attr("data-got_payments",""),void e.removeClass("ff_has_payments").html("");e.html("Fetching Payments..."),function(n,t,s){t.addClass("ff_payments_fetching").prop("disabled",!0),jQuery.get(window.ff_transactions_vars.ajax_url,{subscription_id:n,action:"fluentform_user_payment_endpoints",route:"get_subscription_transactions",_nonce:window.ff_transactions_vars.nonce}).then(function(n){s(n.data.html,"success")}).catch(function(n){n.responseJSON?n.responseJSON.data?s(n.responseJSON.data.message):s("Could not fetch the payments. Please try again"):s(n.responseText)}).always(function(){t.removeClass("ff_payments_fetching").prop("disabled",!1)})}(a,s,function(n,t){t?s.attr("data-got_payments","yes"):s.attr("data-got_payments",""),e.addClass("ff_has_payments").html(n)})}),n(".ff_cancel_subscription").on("click",function(t){t.preventDefault(),n(".ff_subscription_payments").html("").removeClass("ff_has_payments");var s=n(this),a=s.data("subscription_id"),e=s.closest(".ff_subscription").find(".ff_sub_cancel_confirmation");e.find(".ff_confirm_subscription_cancel").attr("data-subscription_id",a),e.show()}),n(".ff_confirm_subscription_cancel").on("click",function(){var t=n(this),s=t.data("subscription_id");t.prop("disabled",!0);var a=t.closest(".ff_sub_cancel_confirmation").find(".ff_sub_message_notices");a.html("Sending Request Please wait..."),jQuery.post(window.ff_transactions_vars.ajax_url,{subscription_id:s,action:"fluentform_user_payment_endpoints",route:"cancel_transaction",_nonce:window.ff_transactions_vars.nonce}).then(function(n){a.html(n.message),setTimeout(function(){window.location.reload()},1e3)}).catch(function(n){var t="Request failed. Please try again";n.responseJSON?n.responseJSON.data&&(t=n.responseJSON.data.message):t=n.responseText,a.html(t)}).always(function(){t.prop("disabled",!1)})}),void n(".ff_cancel_close").on("click",function(){n(".ff_sub_cancel_confirmation").hide()})))})();