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