\n\t\t\t\t\t `})),e("#paramFieldsrepeaterResult").html(i)}else if(m?.mf_redirect_params===undefined||0===Object.keys(m.mf_redirect_params).length){e(".mf-form-data-bypass-single-field").each(((e,t)=>{0!==e&&t.remove()})),e(".mf-form-data-bypass-input").val(""),e(".mf-form-data-bypass-select").html(o)}p(),c()},error:function(e){}});var _=0;e(".mf-add-rf").click((function(){var t=e("#mf-rf-single-field-copier").clone();_++,t.attr("id","mr-repeater-field-"+_),e(".mf-rf-single-field",t).attr("data-id",_),t.appendTo(e(".rf-repeaterResult"))})),e(".mf-btn-del-url-field").click((function(){e(this).parent(".mf-rf-single-field-input").remove()})),function(t,o){var i=e("#metform-form-modalinput-settings").attr("data-nonce"),a=e(".get-response-campaign-list");e.ajax({url:window.metform_api.resturl+"metform/v1/entries/get_response_list/"+t,type:"get",headers:{"X-WP-Nonce":i},dataType:"json",success:function(e){a.empty(),a.append(''),e.length&&e.forEach((e=>{let t="";o?.mf_get_response_list_id===e.campaignId&&(t="selected"),a.append("")}))},error:function(e){}})}(o,m),function(t){var o=e(".metfrom-btn-refresh-hubsopt-list");o.addClass("mf-setting-spin");var i=e("#metform-form-modalinput-settings").attr("data-nonce"),a=e(".hubspot_forms"),s=e("#mf-hubsopt-fileds"),n=t;e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_hubspot_forms/"+n,type:"get",headers:{"X-WP-Nonce":i},dataType:"json",beforeSend:function(t){e(s).text("Please wait....")},success:function(t){if(Array.isArray(t)){var o=e(".mf_hubspot_form_guid").val();try{a.empty(),a.append(''),t.forEach((e=>{var t="";e.guid===o&&(t='selected="selected"'),a.append("")}))}catch(i){}}else a.empty(),a.append('')},error:function(e){console.log(e)},complete:function(t){o.removeClass("mf-setting-spin"),e(s).text("")}})}(o),function(t,o){var i=e(".mf_hubspot_form_guid").val(),a=e("#metform-form-modalinput-settings").attr("data-nonce");if(e("#mf-hubsopt-fileds").html("Please wait...."),"1"!==o.mf_hubspot_forms)return!1;e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+t,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(s){e.ajax({url:window.metform_api.resturl+"metform/v1/forms/hubspot_form_fields/"+t,type:"post",headers:{"X-WP-Nonce":a},dataType:"json",data:{guid:i},success:function(t){var i="",a="mf_hubspot_form_field_name_";t.forEach((e=>{var t=a+e.name;if(t in o){var n="";for(const e in s){var r="";o[t]===s[e].mf_input_name&&(r='selected="selected"'),n+=``}i+="
"+e.label+"
"}})),e("#mf-hubsopt-fileds").html('
'+i+"
")},error:function(t){401===t?.responseJSON?.code?(e("#mf-hubsopt-fileds").html("Please connect your HubSpot account."),e(".hubspot_forms").empty()):e("#mf-hubsopt-fileds").html("Please click the button to fetch forms and then select a form from the list.")}})},error:function(t){e("#mf-hubsopt-fileds").html("Sorry ! Something went wrong")}})}(o,m),function(t){e("#metform_form_modal");var o,i=e("#metform-form-modalinput-settings").attr("data-nonce"),a=e(".mailchimp_list");o=t,e.ajax({url:window.metform_api.resturl+"metform/v1/entries/get_mailchimp_list/"+o,type:"get",headers:{"X-WP-Nonce":i},dataType:"json",success:function(t){try{a.empty(),t.lists.forEach((e=>{a.append("")})),1===t.lists.length?e(".mf-mailchimp-list-id").attr("value",t.lists[0].id):(r(),e(".mailchimp_list").on("change",(t=>{e(".mf-mailchimp-list-id").attr("value",t.target.value)})))}catch(o){}},error:function(e){}})}(o),function(t,o){let i=e("#mf-aweber-fields"),a=e("option:selected",this).val();if(!a)return void i.html("");i.html("Please wait....");let s=e("#metform-form-modalinput-settings").attr("data-nonce"),n="";e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+t,type:"get",headers:{"X-WP-Nonce":s},dataType:"json",success:function(r){n=r;let m=metform_api.admin_url+"admin-ajax.php",l={action:"get_aweber_custom_fields",selectedValue:a,formId:t,nonce:s};e.ajax({url:m,type:"post",data:l,headers:{"X-WP-Nonce":s},dataType:"json",success:function(e){let t=e.data;if("ok"===t.result)if(t.custom_fields.error)i.html("");else{let e,a="",s=Object.keys(n).map((function(e){return[n[e]]})),r="mf_aweber_custom_field_name_",m="mf_aweber_custom_field_label_";t.custom_fields.entries.forEach((t=>{let i;e="",s.map((a=>{i="";let s=o[r+t.id];s&&a[0].mf_input_name===s.field_key&&(i='selected="selected"'),e+=""})),a+="
"+t.name+'
"})),i.html('
'+a+"
")}else i.html("")},error:function(e){i.html(""),console.log("Error: "+e)}})},error:function(t){e("#mf-aweber-fields").html("Sorry ! Something went wrong")}})}(o,m);let v=e(".mf-form-modalinput-title").val();i.find("form").attr("data-mf-id",o);let g=i.find("button.metform-go-to-emailkit-builder-btn"),w=i.find("#emailkit-metform-button-wrap"),k=i.find("#need-emailkit-pro-btn-wrap");if(g.length&&w.length&&k.length){w.hide(),k.hide();let t=await async function(){return new Promise(((t,o)=>{e.ajax({url:window?.metform_emailkit_config?.ajax_url,method:"GET",data:{action:"check_built_template",rest_nonce:window?.metform_emailkit_config?.nonce},success:function(e){t(e?.data?e.data:"")},error:function(e){console.error("Template check error:",e),o(e)}})}))}();"1"==window?.metform_emailkit_config?.is_emailkit_pro_active||t==o||""==t?(k.hide(),w.show()):(w.hide(),k.show()),g.attr("data-emailkit-form",o),g.attr("data-emailkit-form-title",v)}i.find(".get-response-campaign-list").attr("get-response-list-id",o)}));var u=0;e(".mf-add-param_fields").click((function(){var t=e("#mf-cf-single-field-data-bypass").clone();u++,t.attr("id","mf-repeater-field-"+u),e(".mf-btn-del-singl-field",t).attr("data-id",u),t.appendTo(e("#paramFieldsrepeaterResult")),p(),setTimeout((()=>{c()}),10)}));let _=0;function h(e,t="",o=""){return'
";e(".mf-mailster-settings-section").html(a),function(t,o){var i=window.mf_mailster_list_id;if(e(".mf-mailster-list-id").val()==i){var a=e("#metform-form-modalinput-settings").attr("data-nonce");e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_mailster_form_data/"+o,type:"get",headers:{"X-WP-Nonce":a},dataType:"json",success:function(t){for(const[o,i]of Object.entries(t))for(const[t,o]of Object.entries(i))e("#"+t+' option[value="'+o+'"]').prop("selected",!0)},error:function(e){}})}}(0,i)},error:function(e){}})}(t,s,o)},error:function(e){}})}function L(t,o){if(v.hide(),g.hide(),w.hide(),b.hide(),k.hide(),y.hide(),x.hide(),T.hide(),W.hide(),X.hide(),D.hide(),O.hide(),Q.hide(),q.hide(),""!=t.form_title){e(".mf-form-modalinput-title").val(t.form_title),e(".mf-form-modalinput-success_message").val(t.success_message),e(".mf-entry-title-input").val("undefined"!=typeof t.entry_title&&""!=t.entry_title?t.entry_title:"undefined"==typeof t.entry_title||""==t.entry_title?"Entry # [mf_id]":""),e(".mf-form-modalinput-redirect_to").val(t.redirect_to),e(".mf-form-modalinput-success_url").val(t.success_url),e(".mf-form-modalinput-failed_cancel_url").val(t.failed_cancel_url),e(".mf-form-modalinput-limit_total_entries").val(t.limit_total_entries),e(".mf-form-email-verification-email-subject").val(t.email_verification_email_subject),e(".mf-form-email-verification-email-redirect").val(t.email_verification_confirm_redirect),e(".mf-form-email-verification-heading").val(t.email_verification_heading),e(".mf-form-email-verification-paragraph").val(t.email_verification_paragraph);let o=e(".mf-form-email-verification-enable");"1"==t.email_verification_enable?(o.attr("checked",!0),I.show()):(o.removeAttr("checked"),I.hide());let k=e(".mf_automizy_list_id");k&&k.val(t.mf_automizy_list_id);var i=e(".mf-form-modalinput-store_entries");"1"==t.store_entries?(i.attr("checked",!0),v.show()):(i.removeAttr("checked"),v.hide());var a=e(".mf-form-modalinput-hide_form_after_submission");"1"==t.hide_form_after_submission?a.attr("checked",!0):a.removeAttr("checked");var m=e(".mf-form-modalinput-require_login");"1"==t.require_login?m.attr("checked",!0):m.removeAttr("checked");var l=e(".mf-form-modalinput-quiz_result_show");"1"==t.quiz_summery?l.attr("checked",!0):l.removeAttr("checked");var f=e(".mf-form-modalinput-limit_status");"1"==t.limit_total_entries_status?f.attr("checked",!0):f.removeAttr("checked");var c=e(".mf-form-modalinput-count_views");"1"==t.count_views?c.attr("checked",!0):c.removeAttr("checked");var d=e(".mf-form-modalinput-stop_vertical_scrolling");"1"==t.mf_stop_vertical_scrolling?d.attr("checked",!0):d.removeAttr("checked");var p=e(".mf-form-modalinput-multiple_submission");"1"==t.multiple_submission?p.attr("checked",!0):p.removeAttr("checked");var u=e(".mf-form-modalinput-enable_recaptcha");"1"==t.enable_recaptcha?u.attr("checked",!0):u.removeAttr("checked");var _=e(".mf-form-modalinput-capture_user_browser_data");"1"==t.capture_user_browser_data?(_.attr("checked",!0),e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):_.removeAttr("checked"),e(".mf-form-user-email-subject").val(t.user_email_subject),e(".mf-form-user-email-from").val(t.user_email_from),e(".mf-form-user-reply-to").val(t.user_email_reply_to),e(".mf-form-user-email-body").val(t.user_email_body);var h=e(".mf-form-user-enable");"1"==t.enable_user_notification?(h.attr("checked",!0),g.show(300)):(h.removeAttr("checked"),g.hide(300));var j=e(".mf-form-redirect-enable");"1"==t.enable_form_redirect_notification?(j.attr("checked",!0),b.show()):(j.removeAttr("checked"),b.hide());var $=e(".mf-form-user-submission-copy");"1"==t.user_email_attach_submission_copy?$.attr("checked",!0):$.removeAttr("checked"),e(".mf-form-admin-email-subject").val(t.admin_email_subject),e(".mf-form-admin-email-from").val(t.admin_email_from),e(".mf-form-admin-email-to").val(t.admin_email_to),e(".mf-form-admin-reply-to").val(t.admin_email_reply_to),e(".mf-form-admin-email-body").val(t.admin_email_body);var L=e(".mf-form-admin-enable");"1"==t.enable_admin_notification?(L.attr("checked",!0),w.show()):(L.removeAttr("checked"),w.hide());var G=e(".mf-form-admin-submission-copy");"1"==t.admin_email_attach_submission_copy?G.attr("checked",!0):G.removeAttr("checked");var M=e(".mf-form-modalinput-rest_api");"1"==t.mf_rest_api?(M.attr("checked",!0),e(".mf-rest-api").show(200)):(M.removeAttr("checked"),e(".mf-rest-api").hide(200));var J=e(".mf-form-modalinput-mail_chimp");"1"==t.mf_mail_chimp?(J.attr("checked",!0),y.show()):(J.removeAttr("checked"),y.hide());var V=e(".mf-form-modal_input-google_sheet");"1"==t.mf_google_sheet?(V.attr("checked",!0),q.show()):V.removeAttr("checked");let U=e(".mf-form-modalinput-ckit"),ue=e(".mf-form-modalinput-mail_aweber"),_e=e(".mf-form-modalinput-mail_poet");if("1"==t.mf_convert_kit?(U.attr("checked",!0),D.show()):(U.removeAttr("checked"),D.hide()),"1"==t.mf_mail_aweber?(ue.attr("checked",!0),O.show()):(ue.removeAttr("checked"),O.hide()),"1"==t.mf_mail_poet?(_e.attr("checked",!0),Q.show()):(_e.removeAttr("checked"),Q.hide()),t.ckit_opt){let o=e("select.mf-ckit-list-id").first(),i=t.mf_ckit_list_id||"";o.html(),t.ckit_opt.forEach((function(e){o.append('")})),o.val(i)}if(t.aweber_opt){let o=e("select.mf-aweber-list-id").first(),i=t.mf_aweber_list_id||"";o.html(o.find("option.mf_aweber_default_option").clone());for(let e in t.aweber_opt)o.append('");o.val(i)}if(t.mp_opt){let o=e("select.mf-mail-poet-list-id").first(),i=t.mf_mail_poet_list_id||"";o.html();for(let e in t.mp_opt)o.append('");o.val(i)}if("1"===t.mf_active_campaign){F.attr("checked",!0),R.show();let o=t.mf_active_campaign_list_id||"",i=t.mf_active_campaign_tag_id||"";e("select[name=mf_active_campaign_list_id]").val(o),e("select[name=mf_active_campaign_tag_id]").val(i)}else F.removeAttr("checked"),R.hide();var B=e(".mf-form-modalinput-get_response");"1"==t.mf_get_response?(B.attr("checked",!0),e(".mf-get_response").show()):(B.removeAttr("checked"),e(".mf-get_response").hide());var H=e(".mf-hubsopt");"1"==t.mf_hubspot?H.attr("checked",!0):H.removeAttr("checked");var K=e(".mf-hubspot-forms"),Z=e(".hubspot_forms_section");"1"==t.mf_hubspot_forms?(K.attr("checked",!0),Z.show()):(K.removeAttr("checked"),Z.hide()),e(".mf_hubspot_form_portalId").val(t.mf_hubspot_form_portalId),e(".mf_hubspot_form_guid").val(t.mf_hubspot_form_guid);var Y=e(".mf-zoho");"1"==t.mf_zoho?Y.attr("checked",!0):Y.removeAttr("checked");var ee=e(".mf-helpscout");"1"==t.mf_helpscout?(ee.attr("checked",!0),e(".helpscout_forms_section").show()):(ee.removeAttr("chekced"),e(".helpscout_forms_section").hide()),t.mf_helpscout_mailbox&&e('#mf_helpscout_mailbox option[value="'+t.mf_helpscout_mailbox+'"]').prop("selected",!0);var te=e(".mf-form-modalinput-mailster"),oe=e(".mf-mailster-settings-section");"1"==t.mf_mailster?(te.attr("checked",!0),oe.show(),e(".mf-mailster-forms").show()):(te.removeAttr("checked"),oe.hide(),e(".mf-mailster-forms").hide());var ie=e(".mf-register");1==t.mf_registration?(ie.attr("checked",!0),e(".mf_register_form_fields").show()):(ie.removeAttr("checked"),e(".mf_register_form_fields").hide());var ae=e(".mf-login");1==t.mf_login?(ae.attr("checked",!0),e(".mf_login_form_fields").show()):(e(".mf_login_form_fields").hide(),ae.removeAttr("checked"));var se=e(".mf-form-to-post"),ne=e(".mf-form-to-post-fields");1==t.mf_form_to_post?(se.attr("checked",!0),ne.show()):(se.removeAttr("checked"),ne.hide());var re=e(".mf-form-modalinput-zapier");"1"==t.mf_zapier?(re.attr("checked",!0),x.show()):(re.removeAttr("checked",!0),x.hide());var me=e(".mf-form-modalinput-slack");"1"==t.mf_slack?(me.attr("checked",!0),T.show()):(me.removeAttr("checked",!0),T.hide());var le=e(".mf-form-modalinput-fluent");if("1"==t.mf_fluent?(le.attr("checked",!0),C.show()):(le.removeAttr("checked",!0),C.hide()),"1"==t.mf_sms_user_status?(E.attr("checked",!0),z.show()):(E.removeAttr("checked",!0),z.hide()),"1"==t.mf_sms_admin_status?(S.attr("checked",!0),P.show()):(S.removeAttr("checked",!0),P.hide()),"1"==t.mf_sms_status?(N.attr("checked",!0),A.show()):(N.removeAttr("checked",!0),A.hide(),E.removeAttr("checked",!0),z.hide(),S.removeAttr("checked",!0),P.hide()),t.mf_payment_currency){e("select.mf_payment_currency").val(t.mf_payment_currency)}let he=e(".mf-form-modalinput-paypal");"1"==t.mf_paypal?(he.attr("checked",!0),W.show()):(he.removeAttr("checked",!0),W.hide());var fe=e(".mf-form-modalinput-stripe");"1"==t.mf_stripe?(fe.attr("checked",!0),X.show()):(fe.removeAttr("checked",!0),X.hide());fe=e(".mf-form-modalinput-stripe");"1"==t.mf_stripe?(fe.attr("checked",!0),X.show()):(fe.removeAttr("checked",!0),X.hide());var ce=e(".mf-form-modalinput-paypal_sandbox");"1"==t.mf_paypal_sandbox?ce.attr("checked",!0):ce.removeAttr("checked",!0);var de=e(".mf-form-modalinput-stripe_sandbox");"1"==t.mf_stripe_sandbox?de.attr("checked",!0):de.removeAttr("checked",!0);var pe=t.mf_rest_api_method&&t.mf_rest_api_method.length?t.mf_rest_api_method:"POST";e('.mf-rest-api-method option[value="'+pe+'"]').prop("selected",!0),e(".mf-rest-api-url").val(t.mf_rest_api_url),e(".mf-mailchimp-api-key").val(t.mf_mailchimp_api_key),e(".mf-mailchimp-list-id").val(t.mf_mailchimp_list_id),e(".mf-google-spreadsheets-list-id").val(t.mf_google_spreadsheets_list_id),e(".mf-google-sheets-list-id").val(t.mf_google_sheets_list_id),""==t.mf_google_spreadsheets_list_id&&e(".mf-google-spreadsheets-list-id").val(e(".mf-google-spreadsheets-list").find(":selected").val()),0!=t.mf_google_spreadsheets_list_id&&(s(),n(t.mf_google_spreadsheets_list_id),e('.mf-google-spreadsheets-list option[value="'+t.mf_google_spreadsheets_list_id+'"]').prop("selected",!0)),""==t.mf_google_sheets_list_id&&e(".mf-google-sheets-list-id").val(e(".mf-google-sheets-list").find(":selected").val()),0!=t.mf_google_sheets_list_id&&e('.mf-google-sheets-list option[value="'+t.mf_google_sheets_list_id+'"]').prop("selected",!0),""==t.mf_mailchimp_list_id&&e(".mf-mailchimp-list-id").val(e(".mailchimp_list").find(":selected").val()),0!=t.mf_mailchimp_list_id&&e('.mailchimp_list option[value="'+t.mf_get_response_list_id+'"]').prop("selected",!0),r(),e(".mf-get_response-list-id").val(t.mf_get_response_list_id),0!=t.mf_get_response_list_id&&e('.get-response-campaign-list option[value="'+t.mf_get_response_list_id+'"]').prop("selected",!0),e(".mf-zapier-web-hook").val(t.mf_zapier_webhook),e(".mf-slack-web-hook").val(t.mf_slack_webhook),e(".mf-fluent-web-hook").val(t.mf_fluent_webhook),e(".mf-sms-from").val(t.mf_sms_from),e(".mf-sms-twilio-account-sid").val(t.mf_sms_twilio_account_sid),e(".mf-sms-twilio-auth-token").val(t.mf_sms_twilio_auth_token),e(".mf-sms-user-body").val(t.mf_sms_user_body),e(".mf-sms-admin-body").val(t.mf_sms_admin_body),e(".mf-sms-admin-to").val(t.mf_sms_admin_to),e(".mf-paypal-email").val(t.mf_paypal_email),e(".mf-paypal-token").val(t.mf_paypal_token),e(".mf-stripe-image-url").val(t.mf_stripe_image_url),e(".mf-stripe-live-publishiable-key").val(t.mf_stripe_live_publishiable_key),e(".mf-stripe-live-secret-key").val(t.mf_stripe_live_secret_key),e(".mf-stripe-test-publishiable-key").val(t.mf_stripe_test_publishiable_key),e(".mf-stripe-test-secret-key").val(t.mf_stripe_test_secret_key),e(".mf-recaptcha-site-key").val(t.mf_recaptcha_site_key),e(".mf-recaptcha-secret-key").val(t.mf_recaptcha_secret_key),e("input.mf-form-modalinput-limit_status, .mf-form-modalinput-rest_api").trigger("change")}(window.mf_mailster_list_id=t.mf_mailster_list_id,e('.mf-mailster-list-id option[value="'+t.mf_mailster_list_id+'"]').prop("selected",!0),e(".mf-form-modalinput-mailster").length)&&U(e(".mf-mailster-list-id").find(":selected").val(),e("#metform_form_modal").find("form").attr("data-mf-id"))}e("input.mf-form-modalinput-store_entries").on("change",(function(){e(this).is(":checked")?v.show(200):e(this).is(":not(:checked)")&&v.hide(200)})),e("input.mf-form-modalinput-limit_status").on("change",(function(){e(this).is(":checked")?e("#limit_status").find("input").removeAttr("disabled"):e(this).is(":not(:checked)")&&e("#limit_status").find("input").attr("disabled","disabled")})),e("input.mf-form-user-enable").on("change",(function(){e(this).is(":checked")?g.show(300):e(this).is(":not(:checked)")&&g.hide(300)})),e("input.mf-form-redirect-enable").on("change",(function(){e(this).is(":checked")?(b.show(300),e("input.mf_redirect_params_status").val("true")):e(this).is(":not(:checked)")&&(b.hide(300),e("input.mf_redirect_params_status").val("false"))})),e("input.mf-form-admin-enable").on("change",(function(){e(this).is(":checked")?w.show(300):e(this).is(":not(:checked)")&&w.hide(300)})),e("input.mf-form-modalinput-rest_api").on("change",(function(){e(this).is(":checked")?k.show(200):e(this).is(":not(:checked)")&&k.hide(200)})),e("input.mf-form-modalinput-mail_chimp").on("change",(function(){e(this).is(":checked")?y.show(200):e(this).is(":not(:checked)")&&y.hide(200)})),e("input.mf-form-modal_input-google_sheet").on("change",(function(){e(this).is(":checked")?(q.show(200),s()):e(this).is(":not(:checked)")&&q.hide(200)})),e(".mf-form-modalinput-get_response").on("change",(function(){e(this).is(":checked")?j.show(200):j.hide(200)})),e("input.mf-form-email-verification-enable").on("change",(function(){e(this).is(":checked")?I.show(300):e(this).is(":not(:checked)")&&I.hide(300)})),F.on("change",(function(){e(this).is(":checked")?R.show(200):R.hide(200)})),e("input.mf-form-modalinput-mail_aweber").on("change",(function(){e(this).is(":checked")?O.show(200):e(this).is(":not(:checked)")&&O.hide(200)})),e("input.mf-form-modalinput-mail_poet").on("change",(function(){e(this).is(":checked")?Q.show(200):e(this).is(":not(:checked)")&&Q.hide(200)})),e("input.mf-form-modalinput-ckit").on("change",(function(){e(this).is(":checked")?D.show(200):e(this).is(":not(:checked)")&&D.hide(200)})),e("input.mf-form-modalinput-zapier").on("change",(function(){e(this).is(":checked")?x.show(200):e(this).is(":not(:checked)")&&x.hide(200)})),e("input.mf-form-modalinput-slack").on("change",(function(){e(this).is(":checked")?T.show(200):e(this).is(":not(:checked)")&&T.hide(200)})),e("input.mf-form-modalinput-fluent").on("change",(function(){e(this).is(":checked")?C.show(200):e(this).is(":not(:checked)")&&C.hide(200)})),e("input.mf-form-modalinput-sms-user").on("change",(function(){e(this).is(":checked")?z.show(200):e(this).is(":not(:checked)")&&z.hide(200)})),e("input.mf-form-modalinput-sms-admin").on("change",(function(){e(this).is(":checked")?P.show(200):e(this).is(":not(:checked)")&&P.hide(200)})),e("input.mf-form-modalinput-sms").on("change",(function(){e(this).is(":checked")?A.show(200):e(this).is(":not(:checked)")&&(A.hide(200),E.removeAttr("checked",!0),z.hide(),S.removeAttr("checked",!0),P.hide())})),e("input.mf-form-modalinput-paypal").on("change",(function(){e(this).is(":checked")?W.show():e(this).is(":not(:checked)")&&W.hide()})),e("input.mf-form-modalinput-stripe").on("change",(function(){e(this).is(":checked")?stripe.show():e(this).is(":not(:checked)")&&stripe.hide()})),e("input.mf-form-modalinput-stripe_sandbox").on("change",(function(){e(this).is(":checked")?e(".mf_stripe_sandbox").show():e(this).is(":not(:checked)")&&e(".mf_stripe_sandbox").hide()})),e(".mf-hubspot-forms").on("change",(function(){e(this).is(":checked")?e(".hubspot_forms_section").show(200):e(".hubspot_forms_section").hide(200)})),e(".mf-register").on("change",(function(){e(this).is(":checked")?e(".mf_register_form_fields").show(200):e(".mf_register_form_fields").hide(200)})),e(".mf-login").on("change",(function(){e(this).is(":checked")?e(".mf_login_form_fields").show(200):e(".mf_login_form_fields").hide(200)})),e(".mf-form-to-post").on("change",(function(){e(this).is(":checked")?e(".mf-form-to-post-fields").show(200):e(".mf-form-to-post-fields").hide(200)})),e(".mf-zoho").on("change",(function(){e(this).is(":checked")?e(".mf_zoho_forms_section").show(200):e(".mf_zoho_forms_section").hide(200)})),e(".mf-helpscout").on("change",(function(){e(this).is(":checked")?e(".helpscout_forms_section").show(200):e(".helpscout_forms_section").hide(200)})),e(".mf-form-modalinput-mailster").on("change",(function(){e(this).is(":checked")?(e(".mf-mailster-settings-section").show(),e(".mf-mailster-forms").show()):(e(".mf-mailster-settings-section").hide(),e(".mf-mailster-forms").hide())})),e(".mf-mailster-list-id").on("change",(function(){e(this).val(),e("#metform-form-modalinput-settings").attr("data-mf-id")})),e(".get-response-campaign-list").on("change",(function(){e(".mf-get_response-list-id ").val(e(this).val())})),e("input.mf-form-modalinput-capture_user_browser_data").click((function(){e(this).is(":checked")?(e("#multiple_submission").removeClass("hide_input"),e("#multiple_submission").addClass("show_input")):e(this).is(":not(:checked)")&&(e("#multiple_submission").removeClass("show_input"),e("#multiple_submission").addClass("hide_input"))})),e(".mf-settings-tab .mf-setting-nav-link").on("click",(function(t){if(!e(this).hasClass("mf-setting-nav-hidden")){t.preventDefault();var o=e(this).attr("href"),i=e(o).hasClass("active");window.location.hash=o,e(this).parent().addClass("nav-tab-active").siblings().removeClass("nav-tab-active"),i||(e(".mf-settings-section").removeClass("active"),e(o).addClass("active")),i||(window.location.hash=o)}})),e(".mf-setting-nav-link").on("click",(function(t){e(this).hasClass("mf-setting-nav-hidden")?t.preventDefault():(e(this).parents(".nav-tab-wrapper").find("a").removeClass("top").removeClass("bottom"),e(this).parents("li").prev().find("a").addClass("top"),e(this).parents("li").next().find("a").addClass("bottom"))}));var G=e(".mf-settings-tab .mf-setting-nav-link").eq(1).attr("href");function M(){return e("#metform-form-modalinput-settings").attr("data-nonce")}function J(){return e("#mf_wp_rest_nonce").val()}let V;window.location.hash&&(G=window.location.hash),e('.mf-settings-tab .mf-setting-nav-link[href="'+G+'"]').trigger("click"),e(window).on("resize.mfSettings",(function(){e(".mf-setting-sidebar").css("width",e(".mf-setting-sidebar-column").width())})).trigger("resize.mfSettings"),e(".mf-admin-single-accordion").on("click",".mf-admin-single-accordion--heading",(function(){e(this).next().slideToggle().parent().toggleClass("active").siblings().removeClass("active").find(".mf-admin-single-accordion--body").slideUp()})),e(".mf-admin-single-accordion:first-child .mf-admin-single-accordion--heading").trigger("click"),e(".mf-recaptcha-version").on("change",(function(){var t=e(this).val();e("#mf-"+t).fadeIn().siblings().hide()})),e(".mf-recaptcha-version").trigger("change"),e(".mf-form-modalinput-stripe_sandbox").on("change",(function(){var t=e(this).parents(".attr-form-group").eq(0).next(".mf-form-modalinput-stripe_sandbox_keys");e(this).is(":checked")?t.fadeIn():t.fadeOut()})),e(".mf-form-modalinput-stripe_sandbox").trigger("change"),e(document).on("click","#met_pro_aweber_authorize",(function(t){t.preventDefault();let o=e(this).closest("p.description");o.html("Wait....");var i=metform_api.admin_url+"admin-ajax.php",a={action:"get_aweber_authorization_url",api_key:e("#mf_aweber_dev_api_key").val(),api_sec:e("#mf_aweber_dev_api_sec").val()};e.ajax({url:i,method:"POST",data:a,headers:{"X-WP-Nonce":J()},dataType:"json",success:function(e){if(!0===e.success){let t='Authorize The App ';o.html(t)}else if(e.data){let t=e.data;o.html(''+t.msg+"")}},error:function(e){o.html(' ajax error occurred, please check your internet connection..')},complete:function(){}})})),e(document).on("click","#met_pro_aweber_propmpt_re_auth",(function(t){t.preventDefault(),e("#mf_aweber_dev_api_key").val("").prop("disabled",!1),e("#mf_aweber_dev_api_sec").val("").prop("disabled",!1),e(this).closest("p.description").html(' Get Re - Authorization URL ')})),e(document).on("click","#met_pro_aweber_re_authorize",(function(t){t.preventDefault();let o=e(this).closest("p.description");o.html("Wait....");let i=e("#mf_aweber_dev_api_key").val();if(!i||i.length<1)return o.html('API Key can not be empty..'),!1;var a=metform_api.admin_url+"admin-ajax.php",s={action:"get_aweber_re_authorization_url",api_key:i,api_sec:e("#mf_aweber_dev_api_sec").val()};e.ajax({url:a,method:"POST",data:s,headers:{"X-WP-Nonce":J()},dataType:"json",success:function(e){if(!0===e.success){let t=e.data;if("ok"==t.result){let e='Authorize The App ';o.html(e)}else o.html(""+t.msg+"")}else if(e.data){let t=e.data;o.html(''+t.msg+"")}},error:function(e){o.html(' ajax error occurred, please check your internet connection..')},complete:function(){}})})),e(document).on("click","#met_form_aweber_get_list",(function(t){t.preventDefault();let o=e(this),i=e("#mf_aweber_info"),a=metform_api.admin_url+"admin-ajax.php";e.ajax({url:a,method:"POST",data:{action:"get_list_lists"},headers:{"X-WP-Nonce":M()},dataType:"json",beforeSend:function(){i.html('Loading')},success:function(e){if(!0===e.success){let t=e.data,a=o.parent(".mf-input-help").siblings("select.mf-aweber-list-id"),s=a.find("option.mf_aweber_default_option").clone();if(a.html(s),t.lists)for(let e in t.lists)a.append('");i.html(""),o.parent(".mf-input-help").siblings("#mf-aweber-fields").html("")}else if(e.data){let t=e.data;i.html(''+t.msg+"")}},error:function(e){i.html(' ajax error occurred, please check your internet connection..')},complete:function(){}})})),e(".mf-aweber-list-id").on("change",(function(){let t=e("#mf-aweber-fields"),o=e("option:selected",this).val();if(!o)return void t.html("");t.html("Please wait....");let i=e("#metform-form-modalinput-settings").attr("data-nonce"),s=e("#metform_form_modal").find("form").attr("data-mf-id"),n="";e.ajax({url:window.metform_api.resturl+"metform/v1/forms/get_fields_data/"+s,type:"get",headers:{"X-WP-Nonce":i},dataType:"json",success:function(r){n=r;let m=metform_api.admin_url+"admin-ajax.php",l={action:"get_aweber_custom_fields",selectedValue:o,formId:s,nonce:i};e.ajax({url:m,type:"post",data:l,headers:{"X-WP-Nonce":i},dataType:"json",success:function(e){let o=e.data;if("ok"===o.result&&o.custom_fields){let e,i="",s=Object.keys(n).map((function(e){return[n[e]]})),r="mf_aweber_custom_field_name_",m="mf_aweber_custom_field_label_";o.custom_fields.entries.forEach((t=>{let o;e="",s.map((i=>{o="",i[0].mf_input_name===a[r+t.id]&&(o='selected="selected"'),e+=""})),i+="
"+t.name+'
"})),t.html('
'+i+"
")}},error:function(e){console.log("Error: "+e)}})},error:function(t){e("#mf-aweber-fields").html("Sorry ! Something went wrong")}})})),e(document).on("click","#met_form_mail_poet_get_list",(function(t){t.preventDefault();let o=e(this),i=e("#mf_mail_poet_info"),a=metform_api.admin_url+"admin-ajax.php";e.ajax({url:a,method:"POST",data:{action:"mail_poet_get_email_list_lists"},headers:{"X-WP-Nonce":M()},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,a=o.closest("div.mf-mail-poet").find("select");if(a.html(""),t.lists)for(let e in t.lists)a.append('");i.html("")}else if(e.data){let t=e.data;i.html(''+t.msg+"")}},error:function(e){i.html(' ajax error occurred, please check your internet connection..')},complete:function(){}})})),e(document).on("click","#met_form_ckit_get_list",(function(t){t.preventDefault();var o=metform_api.admin_url+"admin-ajax.php";let i=e(this);e.ajax({url:o,method:"POST",data:{action:"get_form_lists"},headers:{"X-WP-Nonce":M()},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=i.closest("div.mf-ckit").find("select");o.html(""),t.forms&&t.forms.forEach((function(e){o.append('")}))}else alert("Error occurred when trying to check for aweber authorization.")},error:function(e){},complete:function(){}})})),e(document).on("click","#met_form_act_camp_get_list",(function(t){t.preventDefault();let o=window.metform_api.resturl+"metform-pro/v1/active-campaign/email_lists",i=M(),a=e(this),s=e("#mf_act_camp_info");e.ajax({url:o,method:"GET",data:[],headers:{"X-WP-Nonce":i},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=a.closest("div.mf-input-group").find("select");o.html(""),t.list&&t.list.forEach((function(e){o.append('")})),s.html(e.data.msg)}else s.html(e.data.msg)},error:function(e){s.html(' ajax error occurred, please check your internet connection..')},complete:function(){}})})),e(document).on("click","#met_form_act_camp_get_tags",(function(t){t.preventDefault();let o=window.metform_api.resturl+"metform-pro/v1/active-campaign/tag_lists",i=M(),a=e(this),s=e("#mf_act_camp_tag_info");e.ajax({url:o,method:"GET",data:[],headers:{"X-WP-Nonce":i},dataType:"json",success:function(e){if(!0===e.success){let t=e.data,o=a.closest("div.mf-input-group").find("select");o.html(""),t.list&&t.list.forEach((function(e){o.append('")})),s.html(e.data.msg)}else s.html(e.data.msg)},error:function(e){s.html(' ajax error occurred, please check your internet connection..')},complete:function(){}})})),e("#mf-helpscout-btn-token").click((function(){let t=window.metform_api.resturl+"metform/v1/forms/get_helpscout_access_token/123";e.ajax({url:t,type:"get",headers:{"X-WP-Nonce":J()},success:function(e){200==e.status&&location.reload()},error:function(e){alert("Something went wrong")}})}));let B=[];e(".mf-settings-form-submit-btn").on("click",(function(t){t.preventDefault();let o=e(this).closest("form").serializeArray(),i={};o.forEach((function(e){i[e.name]=e.value}));let a=metform_api.admin_url+"admin-ajax.php",s={action:"metform_admin_settings",form_data:i};e.ajax({url:a,method:"POST",data:s,headers:{"X-WP-Nonce":J()},dataType:"json",success:function(t){let o=e("#changes-toaster");o.toggleClass("show"),setTimeout((function(){o.removeClass("show")}),1e3)},error:function(e){alert("Error occurred while saving settings.")}})})),e(".mf-modal-mailchimp-integration").on("click",(function(t){t.preventDefault(),e("#metform_mailchimp_modal").modal("show")})),e(".mf-modal-aweber-integration").on("click",(function(t){t.preventDefault(),e("#metform_aweber_modal").modal("show")})),e(".mf-modal-activecampaign-integration").on("click",(function(t){t.preventDefault(),e("#metform_activecampaign_modal").modal("show")})),e(".mf-modal-getresponse-integration").on("click",(function(t){t.preventDefault(),e("#metform_getresponse_modal").modal("show")})),e(".mf-modal-convertkit-integration").on("click",(function(t){t.preventDefault(),e("#metform_convertkit_modal").modal("show")})),e(".mf-modal-helpscout-integration").on("click",(function(t){t.preventDefault(),e("#metform_helpscout_modal").modal("show")})),e(".mf-modal-zoho-integration").on("click",(function(t){t.preventDefault(),e("#metform_zoho_modal").modal("show")})),e(".mf-modal-hubspot-integration").on("click",(function(t){t.preventDefault(),e("#metform_hubspot_modal").modal("show")}))}));