/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./modules/mangopay/assets/src/js/vendor-dashboard.js":
/*!************************************************************!*\
  !*** ./modules/mangopay/assets/src/js/vendor-dashboard.js ***!
  \************************************************************/
/***/ (() => {

eval(";\n\n(function ($) {\n  var dokanMangopayVendorSettings = {\n    init: function init() {\n      this.accountSettings.init();\n    },\n    accountSettings: {\n      init: function init() {\n        this.toggleBusinessTypeField();\n        this.updateStates();\n        $('#dokan-mangopay-account-disconnect').click(this.disconnect);\n        $('#dokan-mangopay-account-connect').click(this.signUp);\n        $('#dokan-mangopay-tabs li').click(this.toggle);\n        $('#dokan-mangopay-user-status, #dokan-mangopay-business-type').change(this.toggleBusinessTypeField);\n        $('#dokan-mangopay-country').change(this.updateStates);\n      },\n      toggle: function toggle() {\n        $('#dokan-mangopay-tabs li').each(function () {\n          $(this).data('id').split('|').forEach(function (section) {\n            $(\"#dokan-mangopay-\".concat(section)).addClass('hidden');\n          });\n          $(this).removeClass('active');\n        });\n        $(this).data('id').split('|').forEach(function (section) {\n          $(\"#dokan-mangopay-\".concat(section)).removeClass('hidden');\n        });\n        $(this).addClass('active');\n\n        if ($(this).hasClass('dokan-mp-bank')) {\n          dokanMangopayVendorSettings.bankAccount.init();\n        } else if ($(this).hasClass('dokan-mp-verification')) {\n          dokanMangopayVendorSettings.kyc.init();\n          dokanMangopayVendorSettings.ubo.init();\n        }\n      },\n      signUp: function signUp(e) {\n        e.preventDefault();\n        dokanMangopayVendorSettings.accountSettings.showProcessing();\n        $('#dokan-mangopay-account-connect').hide();\n        $('#dokan-mangopay-account-processing').show();\n        var data = {\n          action: 'dokan_mangopay_signup',\n          user_id: $(this).data('user'),\n          date_of_birth: $('#dokan-mangopay-user-birthday').val(),\n          nationality: $('#dokan-mangopay-user-nationality').val(),\n          person_type: $('#dokan-mangopay-user-status').val(),\n          business_type: $('#dokan-mangopay-business-type').val(),\n          company_number: $('#dokan-mangopay-company-number').val(),\n          address1: $('#dokan-mangopay-address1').val(),\n          address2: $('#dokan-mangopay-address2').val(),\n          country: $('#dokan-mangopay-country').val(),\n          postcode: $('#dokan-mangopay-postcode').val(),\n          city: $('#dokan-mangopay-city').val(),\n          state: $('#dokan-mangopay-state').val(),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        wp.ajax.send({\n          data: data,\n          success: function success(response) {\n            $('#dokan-mangopay-account-connect').hide();\n            $('#dokan-mangopay-account .action-notice').removeClass('hidden').removeClass('dokan-alert-danger').addClass('dokan-alert-success').html(response);\n            $('form#payment-form').submit();\n            setTimeout(function () {\n              window.location.reload(true);\n            }, 500);\n            $('#dokan-mangopay-account-processing').hide();\n            dokanMangopayVendorSettings.accountSettings.hideProcessing();\n          },\n          error: function error(_error) {\n            $('#dokan-mangopay-account .action-notice').removeClass('hidden').removeClass('dokan-alert-success').addClass('dokan-alert-danger').html(_error);\n            $('html, body').animate({\n              scrollTop: $('#dokan-mangopay-account-notice').offset().top\n            }, 500);\n            $('#dokan-mangopay-account-processing').hide();\n            $('#dokan-mangopay-account-connect').show();\n            dokanMangopayVendorSettings.accountSettings.hideProcessing();\n          }\n        });\n      },\n      disconnect: function disconnect(e) {\n        e.preventDefault();\n        dokanMangopayVendorSettings.accountSettings.showProcessing();\n        $('#dokan-mangopay-account-processing').show();\n        $('#dokan-mangopay-account-disconnect').hide();\n        wp.ajax.send({\n          data: {\n            'action': 'dokan_mangopay_disconnect_vendor',\n            'user_id': $(this).data('user'),\n            '_wpnonce': $('#payment-form #_wpnonce').val()\n          },\n          success: function success(response) {\n            $('#dokan-mangopay-account .action-notice').removeClass('hidden').addClass('dokan-alert-success').html(response);\n            setTimeout(window.location.reload(true), 200);\n            $('#dokan-mangopay-account-processing').hide();\n            dokanMangopayVendorSettings.accountSettings.hideProcessing();\n          },\n          error: function error(_error2) {\n            $('#dokan-mangopay-account .action-notice').addClass('dokan-alert-danger').html(_error2);\n            $('#dokan-mangopay-account-processing').hide();\n            $('#dokan-mangopay-account-disconnect').show();\n            dokanMangopayVendorSettings.accountSettings.hideProcessing();\n          }\n        });\n      },\n      toggleBusinessTypeField: function toggleBusinessTypeField() {\n        if ($('#dokan-mangopay-user-status').val() === 'LEGAL') {\n          if ($('#dokan-mangopay-business-type').attr('type') !== 'hidden') {\n            $('#dokan-mangopay-business-type').closest('p').removeClass('hidden');\n          }\n\n          if ($('#dokan-mangopay-business-type').val() === 'BUSINESS') {\n            $('#dokan-mangopay-company-number').closest('p').removeClass('hidden');\n          } else {\n            $('#dokan-mangopay-company-number').closest('p').addClass('hidden');\n          }\n\n          $('#dokan-mangopay-account .dokan-mp-hq-address').each(function (index, element) {\n            var $label = $(element).closest('p').find('label');\n\n            if (!$label.find('abbr').length) {\n              $label.append('<abbr class=\"required\" title=\"required\">*</abbr>');\n            }\n\n            $label.find('span').remove();\n          });\n        } else {\n          $('#dokan-mangopay-business-type').closest('p').addClass('hidden');\n          $('#dokan-mangopay-company-number').closest('p').addClass('hidden');\n          $('#dokan-mangopay-account .dokan-mp-hq-address').each(function (index, element) {\n            var $label = $(element).closest('p').find('label');\n            $label.find('abbr').remove();\n\n            if (!$label.find('span').length) {\n              $label.append('<span class=\"optional\">(optional)</span>');\n            }\n          });\n        }\n      },\n      updateStates: function updateStates() {\n        dokanMangopayVendorSettings.accountSettings.showProcessing();\n        $('#dokan-mangopay-state').val('');\n        wp.ajax.send({\n          data: {\n            action: 'dokan_mangopay_get_country_wise_states',\n            country: $('#dokan-mangopay-country').val(),\n            _wpnonce: $('#payment-form #_wpnonce').val()\n          },\n          success: function success(response) {\n            if (!response || Object.keys(response).length === 0) {\n              $('#dokan-mangopay-state').closest('p').hide();\n              dokanMangopayVendorSettings.accountSettings.hideProcessing();\n              return;\n            }\n\n            $('#dokan-mangopay-state').closest('p').show();\n            options = \"<option>\".concat($($('#dokan-mangopay-state option')[0]).html(), \"</option>\");\n\n            for (var key in response) {\n              options += \"<option value=\\\"\".concat(key, \"\\\">\").concat(response[key], \"</option>\");\n            }\n\n            $('#dokan-mangopay-state').html(options);\n            dokanMangopayVendorSettings.accountSettings.hideProcessing();\n          }\n        });\n      },\n      showProcessing: function showProcessing() {\n        dokanMangopayVendorSettings.processing.show('#dokan-mangopay-account');\n      },\n      hideProcessing: function hideProcessing() {\n        dokanMangopayVendorSettings.processing.hide('#dokan-mangopay-account');\n      }\n    },\n    kyc: {\n      init: function init() {\n        $('#dokan-mangopay-submit-kyc').off('click').click(this.submit);\n        $('#dokan-mangopay-submit-kyc').attr('disabled', 'disabled');\n        $('#dokan-kyc-file').change(function () {\n          $('#dokan-mangopay-kyc-notice').removeClass('dokan-alert-success dokan-alert-danger').html('').hide();\n          $('#dokan-mangopay-kyc-submit-container .upload-progress-status').hide();\n          $('#dokan-mangopay-kyc-notice').hide();\n          $('#dokan-mangopay-kyc-submit-container .progress-bar').css('width', '0%');\n          $('#dokan-mangopay-kyc-submit-container .status').text('0%');\n\n          if ($(this).val()) {\n            $('#dokan-mangopay-submit-kyc').attr('disabled', false);\n          } else {\n            $('#dokan-mangopay-submit-kyc').attr('disabled', 'disabled');\n          }\n        });\n      },\n      submit: function submit(e) {\n        e.preventDefault();\n        $('#dokan-mangopay-kyc-notice').removeClass('dokan-alert-success dokan-alert-danger').html('').hide();\n        $('#dokan-mangopay-kyc-submit-container #dokan-mangopay-submit-kyc').hide();\n        $('#dokan-mangopay-kyc-submit-container #dokan-mangopay-submit-kyc-disabled').show();\n        $('#dokan-kyc-inputs').html('');\n        var formData = new FormData();\n        formData.append('action', 'dokan_mangopay_submit_kyc');\n        formData.append('doc_type', $('#dokan-kyc-file-type').val());\n        formData.append('_wpnonce', $('#payment-form #_wpnonce').val());\n        $.each($('#dokan-kyc-file'), function (index, object) {\n          $.each(object.files, function (i, file) {\n            formData.append('files[]', file);\n            $('#dokan-kyc-inputs').append(\"<p> \".concat(i + 1, \". \").concat(file.name, \"</p>\"));\n          });\n        });\n        $.ajax({\n          url: dokanMangopay.ajaxurl,\n          data: formData,\n          cache: false,\n          processData: false,\n          contentType: false,\n          type: 'POST',\n          success: function success(response) {\n            $('#dokan-mangopay-kyc-notice').show();\n\n            if (response.success) {\n              $('#dokan-mangopay-kyc-notice').removeClass('dokan-alert-warning').addClass('dokan-alert-success').html(response.data);\n            } else {\n              $('#dokan-mangopay-kyc-notice').removeClass('dokan-alert-success').addClass('dokan-alert-danger').html(response.data);\n            }\n\n            $('#dokan-mangopay-kyc-submit-container #dokan-mangopay-submit-kyc').show();\n            $('#dokan-mangopay-kyc-submit-container #dokan-mangopay-submit-kyc-disabled').hide();\n            $('#dokan-kyc-file').val('');\n            $('#dokan-mangopay-submit-kyc').attr('disabled', 'disabled');\n            $('#dokan-mangopay-kyc-submit-container .upload-progress-status').hide();\n          },\n          xhr: function xhr() {\n            //upload Progress\n            var xhr = $.ajaxSettings.xhr();\n\n            if (!$('#dokan-kyc-file').val()) {\n              return xhr;\n            }\n\n            if (xhr.upload) {\n              $('#dokan-mangopay-kyc-submit-container .upload-progress-status').show();\n              xhr.upload.addEventListener('progress', function (event) {\n                var percent = 0;\n                var position = event.loaded || event.position;\n                var total = event.total;\n\n                if (event.lengthComputable) {\n                  percent = Math.ceil(position / total * 100);\n                } //update progressbar\n\n\n                $('#dokan-mangopay-kyc-submit-container .progress-bar').css('width', +percent + '%');\n                $('#dokan-mangopay-kyc-submit-container .status').text(percent + '%');\n              }, true);\n            }\n\n            return xhr;\n          }\n        });\n      }\n    },\n    ubo: {\n      init: function init() {\n        var self = this;\n\n        if ($('#ubo_data').length > 0) {\n          this.renderForm();\n        }\n\n        $(document).on('click', '#add_button_ubo_element, #update_button_ubo_element', self.submitUbo);\n        $(document).on('click', '#ubo_create_declaration_button', self.create);\n        $(document).on('click', '#ubo_askvalidation_button', self.askValidation);\n        $(document).on('click', '#ubo_add_button', self.resetForm);\n        $(document).on('change', '#dokan_mp_country', self.updateStates);\n        $(document).on('click', '#cancel_button_ubo_element', function () {\n          $('#form_add_ubo_element').hide();\n          self.enableAddBtn();\n          $('#ubo_askvalidation_button').show();\n          $('html, body').animate({\n            scrollTop: $(\"#ubo_data\").offset().top\n          }, 500);\n        });\n        $(document).on('click', \"[id^='show_ubo_elements_button_']\", function () {\n          if ($(this).data('value') == 'show') {\n            $(this).data('value', 'hide');\n            $(this).html('<span class=\"dashicons dashicons-remove\"></span>');\n          } else {\n            $(this).data('value', 'show');\n            $(this).html('<span class=\"dashicons dashicons-insert\"></span>');\n          }\n\n          $('#tr_ubo_' + $(this).data('id')).toggle();\n        });\n        $(document).on('click', '[id^=\"uboelementbutton_\"]', self.prepareFieldData);\n      },\n      prepareFieldData: function prepareFieldData() {\n        var self = dokanMangopayVendorSettings.ubo;\n        self.resetErrors();\n        var uboData = $(this).data('uboelement');\n        $('#ubo_element_id').val(uboData.Id);\n        $('#dokan_mp_first_name').val(uboData.FirstName);\n        $('#dokan_mp_last_name').val(uboData.LastName);\n        $('#dokan_mp_address_line1').val(uboData.Address.AddressLine1);\n        $('#dokan_mp_address_line2').val(uboData.Address.AddressLine2);\n        $('#dokan_mp_city').val(uboData.Address.City);\n        $('#dokan_mp_region').val(uboData.Address.Region);\n        $('#dokan_mp_postal_code').val(uboData.Address.PostalCode);\n        $('#dokan_mp_birthplace_city').val(uboData.Birthplace.City);\n        $('#dokan_mp_country').val(uboData.Address.Country);\n        $('#dokan_mp_nationality').val(uboData.Nationality);\n        $('#dokan_mp_birthplace_country').val(uboData.Birthplace.Country);\n\n        if (!uboData.Address.Region) {\n          self.updateStates();\n        }\n\n        var date = new Date(uboData.Birthday * 1000),\n            year = date.getFullYear(),\n            month = date.getMonth() + 1,\n            day = date.getDate();\n\n        if (month < 10) {\n          month = '0' + month;\n        }\n\n        if (day < 10) {\n          day = '0' + day;\n        }\n\n        $('#dokan_mp_birthday').val(year + '-' + month + '-' + day);\n        $('#add_button_ubo_element').hide();\n        $('#ubo_askvalidation_button').hide();\n        $('#ubo_add_button').hide();\n        $('#update_button_ubo_element').show(); //show form\n\n        $('#form_add_ubo_element').show();\n      },\n      askValidation: function askValidation() {\n        var self = dokanMangopayVendorSettings.ubo;\n        self.showProcessing();\n        var data = {\n          action: 'dokan_mangopay_ask_ubo_declaration',\n          user_id: $('#ubo_mp_id').val(),\n          ubo_declaration_id: $('#ubo_declaration_id').val(),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        $.post(dokanMangopay.ajaxurl, data, function (response) {\n          if (response.success) {\n            self.renderForm();\n          } else {\n            $('#ubo_create_error_div').html(response.data);\n            $('#ubo_create_error_div').show();\n          }\n\n          self.hideProcessing();\n        });\n      },\n      create: function create() {\n        var self = dokanMangopayVendorSettings.ubo;\n        self.showProcessing();\n        var data = {\n          action: 'dokan_mangopay_create_ubo',\n          user_id: $('#ubo_mp_id').val(),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        $.post(dokanMangopay.ajaxurl, data, function (response) {\n          if (response.success) {\n            dokanMangopayVendorSettings.ubo.renderForm();\n          } else {\n            $('#ubo_create_error_div').html(response.data);\n            $('#ubo_create_error_div').show();\n          }\n\n          self.hideProcessing();\n        });\n      },\n      getFields: function getFields() {\n        return ['first_name', 'last_name', 'address_line1', 'address_line2', 'city', 'region', 'postal_code', 'country', 'nationality', 'birthday', 'birthplace_city', 'birthplace_country'];\n      },\n      updateStates: function updateStates() {\n        dokanMangopayVendorSettings.ubo.showProcessing();\n        $('#dokan_mp_region').val('');\n        wp.ajax.send({\n          data: {\n            action: 'dokan_mangopay_get_country_wise_states',\n            country: $('#dokan_mp_country').val(),\n            _wpnonce: $('#payment-form #_wpnonce').val()\n          },\n          success: function success(response) {\n            if (!response || Object.keys(response).length === 0) {\n              $('#dokan_mp_region').closest('p').hide();\n              dokanMangopayVendorSettings.ubo.hideProcessing();\n              return;\n            }\n\n            $('#dokan_mp_region').closest('p').show();\n            options = \"<option>\".concat($($('#dokan_mp_region option')[0]).html(), \"</option>\");\n\n            for (var key in response) {\n              options += \"<option value=\\\"\".concat(key, \"\\\">\").concat(response[key], \"</option>\");\n            }\n\n            $('#dokan_mp_region').html(options);\n            dokanMangopayVendorSettings.ubo.hideProcessing();\n          }\n        });\n      },\n      resetForm: function resetForm() {\n        dokanMangopayVendorSettings.ubo.getFields().forEach(function (field) {\n          $('#' + field).val('');\n        });\n        $('#ubo_element_id').val('');\n        $('#form_add_ubo_element').show();\n        $('#ubo_add_button').hide();\n        $('#ubo_askvalidation_button').hide();\n        $('#add_button_ubo_element').show();\n        $('#update_button_ubo_element').hide();\n        dokanMangopayVendorSettings.ubo.updateStates();\n      },\n      resetErrors: function resetErrors() {\n        this.getFields().forEach(function (field) {\n          $('#' + field + '_error').hide();\n        });\n        $('#ubo_list_errors').hide();\n        $('#ubo_create_error_div').html('');\n        $('#ubo_create_error_div').hide();\n      },\n      validateForm: function validateForm() {\n        var validated = true;\n        this.getFields().forEach(function (field) {\n          if (field === 'region' && !['US', 'MX', 'CA'].includes($('#dokan_mp_country').val())) {\n            return; // Skip and continue the loop from here\n          }\n\n          if ($('#dokan_mp_' + field).val() == '') {\n            $('#dokan_mp_' + field + '_error').show();\n            validated = false;\n          }\n        });\n        return validated;\n      },\n      renderForm: function renderForm() {\n        dokanMangopayVendorSettings.ubo.showProcessing();\n        var data = {\n          action: 'dokan_mangopay_render_ubo_form',\n          account_id: $('#ubo_data').data('mpid'),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        $.post(dokanMangopay.ajaxurl, data, function (response) {\n          $('#ubo_data').html(response.data);\n          dokanMangopayVendorSettings.ubo.hideProcessing();\n        });\n      },\n      submitUbo: function submitUbo() {\n        var self = dokanMangopayVendorSettings.ubo;\n        /** reset error validation messages **/\n\n        self.resetErrors();\n\n        if (!self.validateForm()) {\n          /** show errors **/\n          $('#ubo_list_errors').show();\n          $('html, body').animate({\n            scrollTop: $(\"#ubo_list_errors\").offset().top\n          }, 1000);\n          return;\n        }\n\n        self.showProcessing();\n        $('#form_add_ubo_element').hide();\n        self.enableAddBtn();\n        $('#ubo_askvalidation_button').show();\n        var data = {\n          action: 'dokan_mangopay_add_ubo_element',\n          account_id: $('#ubo_mp_id').val(),\n          ubo_declaration_id: $('#ubo_declaration_id').val(),\n          first_name: $('#dokan_mp_first_name').val(),\n          last_name: $('#dokan_mp_last_name').val(),\n          address_line1: $('#dokan_mp_address_line1').val(),\n          address_line2: $('#dokan_mp_address_line2').val(),\n          city: $('#dokan_mp_city').val(),\n          region: $('#dokan_mp_region').val(),\n          postal_code: $('#dokan_mp_postal_code').val(),\n          country: $('#dokan_mp_country').val(),\n          nationality: $('#dokan_mp_nationality').val(),\n          date_of_birth: $('#dokan_mp_birthday').val(),\n          birthplace_city: $('#dokan_mp_birthplace_city').val(),\n          birthplace_country: $('#dokan_mp_birthplace_country').val(),\n          ubo_element_id: $('#ubo_element_id').val(),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        $.post(dokanMangopay.ajaxurl, data, function (response) {\n          if (response.success) {\n            var data = {\n              action: 'dokan_mangopay_render_ubo_form',\n              account_id: $('#ubo_mp_id').val(),\n              _wpnonce: $('#payment-form #_wpnonce').val()\n            };\n            $.post(dokanMangopay.ajaxurl, data, function (response) {\n              $('#ubo_data').html(response.data);\n              var ubo_declaration_id = $('#ubo_declaration_id').val();\n\n              if ($('#show_ubo_elements_button_' + ubo_declaration_id).data('value') == 'show') {\n                $('#show_ubo_elements_button_' + ubo_declaration_id).data('value', 'hide');\n                $('#show_ubo_elements_button_' + ubo_declaration_id).data('<span class=\"dashicons dashicons-remove\"></span>');\n              } else {\n                $('#show_ubo_elements_button_' + ubo_declaration_id).data('value', 'show');\n                $('#show_ubo_elements_button_' + ubo_declaration_id).html('<span class=\"dashicons dashicons-insert\"></span>');\n              }\n\n              $('#tr_ubo_' + ubo_declaration_id).toggle();\n              $('html, body').animate({\n                scrollTop: $('#tr_ubo_' + ubo_declaration_id).offset().top\n              }, 500);\n            });\n          }\n\n          self.hideProcessing();\n        });\n      },\n      enableAddBtn: function enableAddBtn() {\n        var ubo_count = parseInt($('#ubo_declaration_ubo_count_' + $('#ubo_declaration_id').val()).val());\n\n        if (!ubo_count || ubo_count < 4) {\n          $('#ubo_add_button').show();\n        }\n      },\n      showProcessing: function showProcessing() {\n        dokanMangopayVendorSettings.processing.show('#dokan-mangopay-kyc');\n      },\n      hideProcessing: function hideProcessing() {\n        dokanMangopayVendorSettings.processing.hide('#dokan-mangopay-kyc');\n      }\n    },\n    bankAccount: {\n      init: function init() {\n        var self = this;\n        self.updateStates();\n        $('.dokan_mangopay_vendor_account_fields').hide();\n\n        if ($('#dokan-mangopay-vendor-acccount-type').val()) {\n          $('.dokan_mangopay_vendor_account_fields.' + $('#dokan-mangopay-vendor-acccount-type').val() + '_fields').show();\n        }\n\n        $('#dokan-mangopay-vendor-acccount-type').on('change', function (e) {\n          $('.dokan_mangopay_vendor_account_fields').hide();\n          $('.dokan_mangopay_vendor_account_fields.' + $(this).val() + '_fields').show();\n        });\n        $('#dokan-mangopay-vendor-account-country').change(self.updateStates);\n        $('#dokan-mp-bank-account-add-new').click(self.showForm);\n        $('#dokan-mp-bank-account-cancel').click(self.hideForm);\n        $('#dokan-mp-bank-account-create').click(self.create);\n        $(document).on('click', '[id^=\"dokan-mp-active-bank-account-\"]', self.activate);\n      },\n      create: function create(e) {\n        e.preventDefault();\n        dokanMangopayVendorSettings.bankAccount.showProcessing();\n        $('#dokan-mp-bank-account-create').hide();\n        $('#dokan-mp-bank-account-creating').show();\n        var data = $('#payment-form').serialize();\n        data += '&action=dokan_mangopay_create_bank_account';\n        wp.ajax.send({\n          data: data,\n          success: function success(response) {\n            $('#dokan-mangopay-bank-account-notice').show();\n            $('#dokan-mangopay-bank-account-notice').removeClass('dokan-alert-danger').addClass('dokan-alert-success').html(response);\n            $('html, body').animate({\n              scrollTop: $('#dokan-mangopay-bank-account-notice').offset().top\n            }, 500);\n            $('#dokan-mp-bank-account-create').show();\n            $('#dokan-mp-bank-account-creating').hide();\n            setTimeout(function () {\n              $('#dokan-mangopay-bank-account-notice').html('').hide();\n            }, 10000);\n            dokanMangopayVendorSettings.bankAccount.loadAccounts();\n            dokanMangopayVendorSettings.bankAccount.hideForm();\n            dokanMangopayVendorSettings.bankAccount.hideProcessing();\n          },\n          error: function error(_error3) {\n            $('#dokan-mangopay-bank-account-notice').show();\n            $('#dokan-mangopay-bank-account-notice').removeClass('dokan-alert-success').addClass('dokan-alert-danger').html(_error3);\n            $('html, body').animate({\n              scrollTop: $('#dokan-mangopay-bank-account-notice').offset().top\n            }, 500);\n            $('#dokan-mp-bank-account-create').show();\n            $('#dokan-mp-bank-account-creating').hide();\n            setTimeout(function () {\n              $('#dokan-mangopay-bank-account-notice').html('').hide();\n            }, 10000);\n            dokanMangopayVendorSettings.bankAccount.hideProcessing();\n          }\n        });\n      },\n      activate: function activate(e) {\n        e.preventDefault();\n        dokanMangopayVendorSettings.bankAccount.showProcessing();\n        var elem = $(this);\n        elem.html(dokanMangopay.processing + '...');\n        $('[id^=\"dokan-mp-active-bank-account-\"]').each(function () {\n          $(this).attr('disabled', 'disabled');\n        });\n        var data = {\n          action: 'dokan_mangopay_update_active_bank_account',\n          user_id: elem.data('user'),\n          bank_account_id: elem.data('bank-account'),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        $.post(dokanMangopay.ajaxurl, data, function (response) {\n          if (response.success) {\n            dokanMangopayVendorSettings.bankAccount.loadAccounts();\n          } else {\n            $('#dokan-mangopay-bank-account-list-notice').html(response.data).removeClass('hidden');\n            setTimeout(function () {\n              $('#dokan-mangopay-bank-account-list-notice').html('').addClass('hidden');\n            }, 10000);\n            elem.html(dokanMangopay.makeActive);\n            $('[id^=\"dokan-mp-active-bank-account-\"]').each(function () {\n              $(this).removeAttr('disabled');\n            });\n          }\n\n          dokanMangopayVendorSettings.bankAccount.hideProcessing();\n        });\n      },\n      loadAccounts: function loadAccounts() {\n        var data = {\n          action: 'dokan_mangopay_get_bank_accounts',\n          user_id: $('#dokan-mangopay-bank-account').data('user'),\n          _wpnonce: $('#payment-form #_wpnonce').val()\n        };\n        $.post(dokanMangopay.ajaxurl, data, function (response) {\n          if (response.success) {\n            $('#dokan-mangopay-bank-account .dokan-mp-bank-accounts').html(response.data);\n          }\n        });\n      },\n      showForm: function showForm(e) {\n        e.preventDefault();\n        $('#dokan-mp-bank-account-fields').removeClass('hidden');\n        $('#dokan-mp-bank-account-add-new').hide();\n      },\n      hideForm: function hideForm() {\n        var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n        if (false !== e) {\n          e.preventDefault();\n        }\n\n        $('#dokan-mp-bank-account-fields').addClass('hidden');\n        $('#dokan-mp-bank-account-add-new').show();\n      },\n      updateStates: function updateStates() {\n        dokanMangopayVendorSettings.bankAccount.showProcessing();\n        $('#dokan-mangopay-vendor-account-state').val('');\n        wp.ajax.send({\n          data: {\n            action: 'dokan_mangopay_get_country_wise_states',\n            country: $('#dokan-mangopay-vendor-account-country').val(),\n            _wpnonce: $('#payment-form #_wpnonce').val()\n          },\n          success: function success(response) {\n            if (!response || Object.keys(response).length === 0) {\n              $('#dokan-mangopay-vendor-account-state').closest('p').hide();\n              dokanMangopayVendorSettings.bankAccount.hideProcessing();\n              return;\n            }\n\n            $('#dokan-mangopay-vendor-account-state').closest('p').show();\n            options = \"<option>\".concat($($('#dokan-mangopay-vendor-account-state option')[0]).html(), \"</option>\");\n\n            for (var key in response) {\n              options += \"<option value=\\\"\".concat(key, \"\\\">\").concat(response[key], \"</option>\");\n            }\n\n            $('#dokan-mangopay-vendor-account-state').html(options);\n            dokanMangopayVendorSettings.bankAccount.hideProcessing();\n          }\n        });\n      },\n      showProcessing: function showProcessing() {\n        dokanMangopayVendorSettings.processing.show('#dokan-mangopay-bank-account');\n      },\n      hideProcessing: function hideProcessing() {\n        dokanMangopayVendorSettings.processing.hide('#dokan-mangopay-bank-account');\n      }\n    },\n    processing: {\n      show: function show() {\n        var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.dokan-mangopay-container';\n        $(element).block({\n          message: null,\n          overlayCSS: {\n            background: '#fff',\n            opacity: 0.6\n          }\n        });\n      },\n      hide: function hide() {\n        var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.dokan-mangopay-container';\n        $(element).unblock();\n      }\n    }\n  };\n  $(document).ready(function () {\n    dokanMangopayVendorSettings.init();\n  });\n})(jQuery);\n\n//# sourceURL=webpack://dokan-pro/./modules/mangopay/assets/src/js/vendor-dashboard.js?");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	var __webpack_exports__ = {};
/******/ 	__webpack_modules__["./modules/mangopay/assets/src/js/vendor-dashboard.js"]();
/******/ 	
/******/ })()
;