(()=>{"use strict";var t=[],e={uiSettings:{},load:function(){e.addEvents()},addEvents:function(){$(document).on("submit","#user-contact-form",(function(t){t.preventDefault();var e=$(this).closest("form");e.find(".error-msg").html("").closest(".f-form-input-group").removeClass("has-error");var o=showLoading();$.ajax({type:"POST",dataType:"JSON",processData:!1,contentType:!1,url:e.attr("action"),data:new FormData(e[0]),success:function(t){if(loadingOut(o),1==t.success)Swal({type:"success",title:"Requested!",html:t.message,showCancelButton:!1,confirmButtonText:"OK",showConfirmButton:!0,timer:3e3}),$("#user-contact-form").trigger("reset");else if(0==t.success){t.error;for(var r in t.error_info){var n=t.error_info[r];e.find("#"+r).closest(".f-form-input-group").find(".error-msg").html(n),e.find("#"+r).focus(),e.find("#"+r).closest(".f-form-input-group").addClass("has-error")}t&&null!=t.message&&Swal({type:"error",title:"Oops!...",text:t.message,showCancelButton:!1,showConfirmButton:!1,timer:5e3})}},error:function(t){loadingOut(o),Swal({type:"error",title:"Oops!...",text:"Something went wrong! Please try again later",showCancelButton:!1,showConfirmButton:!1,timer:5e3})}})}))}};function o(e,o){if(e.command,void 0!==e.data&&void 0!==e.callback&&"yes"==e.callback)t.pop()}window.addEventListener("load",(function(){chrome.runtime.onMessage.addListener(o),e.load()}))})();