var FB_Submissions=function(){function n(){this.initEvents()}var e=n.prototype;return e.initEvents=function(){var e=this;document.addEventListener("change",function(n){e.onFormChange(n)}),document.addEventListener("click",function(n){e.onFormSubmissionStateChange(n)})},e.onFormChange=function(n){var e=n.target.closest(".fb-form-selection");e&&(window.location.href=fbox_admin_js_object.submissions_page+"&form_id="+e.value)},e.onFormSubmissionStateChange=function(n){var e,t,s,o=n.target.closest(".fb-toggle-form-state");o&&(o.classList.add("disabled"),e=o.getAttribute("data-submission-id"),t=o.checked?"publish":"unpublish",(s=new FormData).append("nonce",o.closest(".fb-submissions").querySelector('input[type="hidden"][name="fb_form_submission_field"]').value),s.append("submission_id",e),s.append("new_state",t),s.append("action","fb_form_submission_status_change"),fetch(fpf_js_object.ajax_url,{method:"POST",body:s}).then(function(n){return n.json()}).then(function(n){o.classList.remove("disabled")}))},n}();document.addEventListener("DOMContentLoaded",function(){new FB_Submissions});

