(e=>{"use strict";const t={init:()=>{const e=t;e.toggleMode(),e.toggleDelayPeriodField(),e.togglePaymentRequestFields(),e.toggleCrossBorderTransferFields(),e.toggleIntervalField(),e.toggleSandboxFields(),e.toggleEnvironmentFields(),e.element("testmode").change(e.toggleEnvironmentFields),e.element("sandbox_mode").change(e.toggleEnvironmentFields),e.element("disburse_mode").change(e.toggleDelayPeriodField),e.element("payment_request").change(e.togglePaymentRequestFields),e.element("cross_border_transfer").change(e.toggleCrossBorderTransferFields),e.element("announcement_to_sellers").change(e.toggleIntervalField)},toggleEnvironmentFields:()=>{const s=t.element("testmode"),o=t.element("sandbox_mode"),l=["test_publishable_key","test_secret_key","test_webhook_key"],n=["sandbox_publishable_key","sandbox_secret_key","sandbox_webhook_key"],r=["publishable_key","secret_key","webhook_key"],d=(e('th:contains("API Credentials")').closest("tr"),e('th:contains("Sandbox API Credentials")').closest("tr"),e('th:contains("Test Mode API Credentials")').closest("tr"));[...l,...n,...r].forEach(e=>{t.element(e).closest("tr").hide()}),s.is(":checked")?(o.prop("checked",!1).prop("disabled",!0),l.forEach(e=>t.element(e).closest("tr").show()),d.find("th").text("Test Mode API Credentials")):o.is(":checked")?(s.prop("checked",!1).prop("disabled",!0),n.forEach(e=>t.element(e).closest("tr").show()),d.find("th").text("Sandbox API Credentials")):(s.prop("disabled",!1),o.prop("disabled",!1),r.forEach(e=>t.element(e).closest("tr").show()),d.find("th").text("API Credentials"))},toggleMode:()=>{["test_publishable_key","test_secret_key","test_webhook_key"].forEach(e=>{t.element("testmode").is(":checked")?(t.element(e).closest("tr").show(),t.element("webhook_key").closest("tr").hide()):(t.element(e).closest("tr").hide(),t.element("webhook_key").closest("tr").show())})},togglePaymentRequestFields:()=>{["type","theme","size","locations"].forEach(e=>{t.element("payment_request").is(":checked")?t.element(e,"payment_request_button").closest("tr").show():t.element(e,"payment_request_button").closest("tr").hide()})},toggleCrossBorderTransferFields:()=>{["restricted_countries","disconnect_restricted_vendors"].forEach(e=>{t.element("cross_border_transfer").is(":checked")?t.element(e).closest("tr").show():t.element(e).closest("tr").hide()}),["disconnect_connected_vendors"].forEach(e=>{t.element("cross_border_transfer").is(":checked")?t.element(e).closest("tr").hide():t.element(e).closest("tr").show()})},toggleDelayPeriodField:()=>{"DELAYED"===t.element("disburse_mode").val()?t.element("disbursement_delay_period").closest("tr").show():t.element("disbursement_delay_period").closest("tr").hide()},toggleIntervalField:()=>{t.element("announcement_to_sellers").is(":checked")?t.element("notice_interval").closest("tr").show():t.element("notice_interval").closest("tr").hide()},toggleSandboxFields:()=>{const e=t.element("testmode"),s=t.element("sandbox_mode"),o=t.element("sandbox_webhook_key"),l=t.element("sandbox_publishable_key"),n=t.element("sandbox_secret_key");e.is(":checked")?(s.prop("disabled",!0),s.prop("checked",!1)):s.prop("disabled",!1),s.is(":checked")?(e.prop("disabled",!0),e.prop("checked",!1),o.closest("tr").show(),l.closest("tr").show(),n.closest("tr").show()):(e.prop("disabled",!1),o.closest("tr").hide(),l.closest("tr").hide(),n.closest("tr").hide())},element:(t,s=!1)=>(s&&s.length&&(t=`${s}_${t}`),e(`#woocommerce_dokan_stripe_express_${t}`))};e(document).ready(t.init)})(jQuery);