diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 62ddff51c..d52b4d44f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,7 @@ on: # event list branches: - dev - master + - '**' env: # environment variables (available in any part of the action) PHP_VERSION: 7.4 diff --git a/cleantalk.php b/cleantalk.php index 41ebf0187..d1189b66c 100644 --- a/cleantalk.php +++ b/cleantalk.php @@ -4,7 +4,7 @@ Plugin Name: Anti-Spam by CleanTalk Plugin URI: https://cleantalk.org Description: Max power, all-in-one, no Captcha, premium anti-spam plugin. No comment spam, no registration spam, no contact spam, protects any WordPress forms. - Version: 6.75.99-dev + Version: 6.77.99-dev Author: CleanTalk - Anti-Spam Protection Author URI: https://cleantalk.org Text Domain: cleantalk-spam-protect @@ -694,6 +694,9 @@ function apbct_wpms__delete_blog(WP_Site $old_site) // After plugin loaded - to load locale as described in manual add_action('init', 'apbct_plugin_loaded'); +// SiteGround Speed Optimizer: skip cache for URLs with apbct_no_cache. +add_action('plugins_loaded', 'apbct_sgo_optimizer__register_bypass_query_params', 1); + if ( ! empty($apbct->settings['data__use_ajax']) && ! apbct_is_in_uri('.xml') && ! apbct_is_in_uri('.xsl') diff --git a/inc/cleantalk-admin.php b/inc/cleantalk-admin.php index 8ac6e95f4..9d623214c 100644 --- a/inc/cleantalk-admin.php +++ b/inc/cleantalk-admin.php @@ -751,17 +751,10 @@ function apbct_admin__admin_bar__add_structure($wp_admin_bar) * Link to project manager */ $project_manager_title_node = apbct__admin_bar__get_title_for_project_manager(); - if ( $project_manager_title_node ) { + $gf2db_title_node = apbct__admin_bar__add_gf2db_title(); + if ( $project_manager_title_node && $gf2db_title_node) { $wp_admin_bar->add_node($project_manager_title_node); - $gf2db_title_node = apbct__admin_bar__add_gf2db_title(); - if ($gf2db_title_node) { - $wp_admin_bar->add_node($gf2db_title_node); - } else { - $gf2db_invite_to_install_title = apbct__admin_bar__get_title_for_gf2db_invite_to_install(); - if ($gf2db_invite_to_install_title) { - $wp_admin_bar->add_node($gf2db_invite_to_install_title); - } - } + $wp_admin_bar->add_node($gf2db_title_node); } /** @@ -823,36 +816,6 @@ function apbct__admin_bar__add_gf2db_title() ); } -/** - * Gets the title for the "Gravity Forms to doBoard" Add-On invite to install admin bar node. - * - * This function constructs the title for the "Gravity Forms to doBoard" Add-On invite to install admin bar node based on various conditions. - * The title includes a link to the "Gravity Forms to doBoard" Add-On invite to install. - * - * @return array|false The node data for the "Gravity Forms to doBoard" Add-On invite to install admin bar node, or false if the "Gravity Forms to doBoard" Add-On invite to install admin bar node is not enabled. - */ -function apbct__admin_bar__get_title_for_gf2db_invite_to_install() -{ - if (is_plugin_active('cleantalk-doboard-add-on-for-gravity-forms/cleantalk-doboard-add-on-for-gravity-forms.php')) { - return false; - } - - $title = sprintf( - '%s', - admin_url('plugin-install.php?s=GF2DB&tab=search&type=term'), - esc_html__( - 'Organize and track all messages from your site. Gravity Forms, upgraded with project management.', - 'cleantalk-spam-protect' - ), - esc_html__('Install "Gravity Forms to doBoard" Add-On', 'cleantalk-spam-protect') - ); - - return array( - 'parent' => 'project_manager__parent_node', - 'id' => 'gf2db_invite_to_install_title', - 'title' => $title, - ); -} /** * Gets the title for the APBCT admin bar node. diff --git a/inc/cleantalk-common.php b/inc/cleantalk-common.php index cccae3ce0..54cf6d4ea 100644 --- a/inc/cleantalk-common.php +++ b/inc/cleantalk-common.php @@ -4,6 +4,7 @@ use Cleantalk\Antispam\CleantalkRequest; use Cleantalk\Antispam\CleantalkResponse; use Cleantalk\ApbctWP\API; +use Cleantalk\ApbctWP\BaseCall\DefaultParams; use Cleantalk\ApbctWP\CleantalkSettingsTemplates; use Cleantalk\ApbctWP\Cron; use Cleantalk\ApbctWP\DB; @@ -12,14 +13,14 @@ use Cleantalk\ApbctWP\GetFieldsAny; use Cleantalk\ApbctWP\Helper; use Cleantalk\ApbctWP\Honeypot; +use Cleantalk\ApbctWP\RequestParameters\RequestParameters; +use Cleantalk\ApbctWP\RequestParameters\SubmitTimeHandler; use Cleantalk\ApbctWP\Sanitize; use Cleantalk\ApbctWP\Variables\AltSessions; use Cleantalk\ApbctWP\Variables\Cookie; use Cleantalk\ApbctWP\Variables\Get; use Cleantalk\ApbctWP\Variables\Post; use Cleantalk\ApbctWP\Variables\Server; -use Cleantalk\ApbctWP\RequestParameters\RequestParameters; -use Cleantalk\ApbctWP\RequestParameters\SubmitTimeHandler; use Cleantalk\Common\TT; // Prevent direct call @@ -182,23 +183,8 @@ function apbct_base_call($params = array(), $reg_flag = false) ); } - $default_params = array( - - // IPs - 'sender_ip' => defined('CT_TEST_IP') - ? CT_TEST_IP - : \Cleantalk\ApbctWP\Helper::ipGet('remote_addr', false), - 'x_forwarded_for' => \Cleantalk\ApbctWP\Helper::ipGet('x_forwarded_for', false), - 'x_real_ip' => \Cleantalk\ApbctWP\Helper::ipGet('x_real_ip', false), - - // Misc - 'auth_key' => $apbct->api_key, - 'js_on' => apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true) ? 1 : apbct_js_test(TT::toString(Post::get('ct_checkjs'))), - - 'agent' => APBCT_AGENT, - 'sender_info' => $sender_info, - 'submit_time' => SubmitTimeHandler::getFromRequest(), - ); + $default_params_getter = new DefaultParams($apbct->api_key, $sender_info); + $default_params = $default_params_getter->get(); if (!isset($params['post_info']['post_url'])) { $params['post_info']['post_url'] = Server::get('HTTP_REFERER'); @@ -605,6 +591,14 @@ function apbct_get_sender_info() $page_hits = RequestParameters::get('apbct_page_hits', Cookie::$force_alt_cookies_global); $page_hits = !empty($page_hits) ? TT::toString($page_hits) : null; + $ct_options = json_encode( + array_merge( + (array) $apbct->settings, + ['data__bot_detector_enabled' => apbct__is_bot_detector_enabled() ? 1 : 0] + ), + JSON_UNESCAPED_SLASHES + ); + //Let's keep $data_array for debugging $data_array = array( 'plugin_request_id' => $apbct->plugin_request_id, @@ -613,7 +607,7 @@ function apbct_get_sender_info() 'USER_AGENT' => Server::get('HTTP_USER_AGENT'), 'page_url' => apbct_sender_info___get_page_url(), 'cms_lang' => substr(get_locale(), 0, 2), - 'ct_options' => json_encode($apbct->settings, JSON_UNESCAPED_SLASHES), + 'ct_options' => $ct_options, 'fields_number' => sizeof($_POST), 'direct_post' => $cookie_is_ok === null && apbct_is_post() ? 1 : 0, // Raw data to validated JavaScript test in the cloud @@ -1857,7 +1851,6 @@ function apbct__bot_detector_get_fired_exclusions() */ function apbct__bot_detector_get_fd_log() { - global $apbct; $result = array( 'plugin_status' => 'OK', 'error_msg' => '', @@ -1872,7 +1865,7 @@ function apbct__bot_detector_get_fd_log() } try { - if ( TT::toString($apbct->settings['data__bot_detector_enabled']) === '0') { + if ( ! apbct__is_bot_detector_enabled() ) { throw new \Exception('bot detector library usage is disabled'); } // Retrieve bot detector frontend data log from Alt Sessions @@ -1929,3 +1922,24 @@ function apbct__bot_detector_get_custom_exclusion_from_settings() } return $exclusions; } + +/** + * Check if Bot-Detector is enabled/disabled + * + * @return bool + */ +function apbct__is_bot_detector_enabled() +{ + global $apbct; + + // Constant is preferred + if ( isset($apbct->service_constants->bot_detector_enabled) && $apbct->service_constants->bot_detector_enabled->isDefined() ) { + return (bool) $apbct->service_constants->bot_detector_enabled->getValue(); + } + // Check by $apbct->data + if ( isset($apbct->data['bot_detector_enabled']) ) { + return (bool) $apbct->data['bot_detector_enabled']; + } + // By default - enabled + return true; +} diff --git a/inc/cleantalk-integrations-by-hook.php b/inc/cleantalk-integrations-by-hook.php index 94f68b0ca..e60b93cbf 100755 --- a/inc/cleantalk-integrations-by-hook.php +++ b/inc/cleantalk-integrations-by-hook.php @@ -135,7 +135,7 @@ 'ajax' => false ), 'EasyDigitalDownloads' => array( - 'hook' => array('edd_pre_process_register_form', 'edd_insert_user_args'), + 'hook' => array('edd_pre_process_register_form', 'edd_insert_user_args', 'edd_customer_pre_create'), 'setting' => 'forms__registrations_test', 'ajax' => false ), @@ -291,6 +291,13 @@ 'setting' => 'forms__contact_forms_test', 'ajax' => true ), + 'BookingCalendar' => array( + 'hook' => [ + 'WPBC_AJX_BOOKING__CREATE', + ], + 'setting' => 'forms__contact_forms_test', + 'ajax' => true + ), 'JobstackThemeRegistration' => array( 'hook' => 'wp_loaded', 'setting' => 'forms__registrations_test', diff --git a/inc/cleantalk-pluggable.php b/inc/cleantalk-pluggable.php index c1918f2c4..a33b90857 100644 --- a/inc/cleantalk-pluggable.php +++ b/inc/cleantalk-pluggable.php @@ -1406,6 +1406,13 @@ function apbct_is_skip_request($ajax = false, $ajax_message_obj = array()) return 'BookingPress service action'; } + if ( + apbct_is_plugin_active('booking/wpdev-booking.php') && + (Post::getString('action') === 'WPBC_AJX_BOOKING__CREATE') + ) { + return 'WP BookingCalendar service action'; + } + if ( ( apbct_is_plugin_active('pixelyoursite/pixelyoursite.php') || @@ -1812,6 +1819,11 @@ class_exists('Cleantalk\Antispam\Integrations\CleantalkInternalForms') apbct_is_in_uri('wc-ajax=iwd_opc_update_order_review') ) { return 'cartflows_save_cart'; } + // WC addon - Metorik Helper plugin service requests + if ( apbct_is_plugin_active('metorik-helper/metorik-helper.php') && + apbct_is_in_uri('wc-ajax=metorik_capture_customer_data') ) { + return 'metorik-helper skip'; + } // Vault Press (JetPack) plugin service requests if ( Post::get('do_backups') !== '' && diff --git a/inc/cleantalk-public-integrations.php b/inc/cleantalk-public-integrations.php index 0750e4f66..d30821f3d 100644 --- a/inc/cleantalk-public-integrations.php +++ b/inc/cleantalk-public-integrations.php @@ -938,6 +938,11 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema $checkjs = $checkjs_cookie ?: $checkjs_post; } + // BuddyBoss Platform use rest api for registration from phone app + if ( apbct_is_plugin_active('buddyboss-app/buddyboss-app.php') && apbct_is_in_uri('/wp-json/buddyboss-app/v1/signup') ) { + $checkjs = Post::getString('checkjs') === 'true' ? 1 : 0; + } + $sender_info = array( 'post_checkjs_passed' => $checkjs_post, 'cookie_checkjs_passed' => $checkjs_cookie, @@ -1049,6 +1054,10 @@ function ct_registration_errors($errors, $sanitized_user_login = null, $user_ema $bp->signup->errors['signup_username'] = $ct_result->comment; } + if (apbct_is_plugin_active('buddyboss-app/buddyboss-app.php') && apbct_is_in_uri('/wp-json/buddyboss-app/v1/signup')) { + wp_send_json_error(['success' => false, 'message' => $ct_result->comment]); + } + if ( $facebook ) { /** @psalm-suppress InvalidArrayOffset */ $_POST['FB_userdata']['email'] = ''; @@ -1451,6 +1460,11 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null) */ $input_array = apply_filters('apbct__filter_post', $_POST); + $honeypot_params = array(); + if ( isset($input_array['apbct__email_id__wp_contact_form_7']) ) { + $honeypot_params['honeypot_field'] = ($input_array['apbct__email_id__wp_contact_form_7'] === '') ? 1 : 0; + } + $ct_temp_msg_data = ct_get_fields_any($input_array); $sender_email = isset($ct_temp_msg_data['email']) ? $ct_temp_msg_data['email'] : ''; @@ -1463,21 +1477,24 @@ function apbct_form__contactForm7__testSpam($spam, $_submission = null) } $base_call_result = apbct_base_call( - array( - 'message' => $message, - 'sender_email' => $sender_email, - 'sender_nickname' => $sender_nickname, - 'js_on' => $checkjs, - 'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'), - 'sender_info' => array( - 'form_validation' => ! isset($apbct->validation_error) - ? null - : json_encode(array( - 'validation_notice' => $apbct->validation_error, - 'page_url' => TT::toString(Server::get('HTTP_HOST')) . TT::toString(Server::get('REQUEST_URI')), - )), - 'sender_emails_array' => $sender_emails_array, + array_merge( + array( + 'message' => $message, + 'sender_email' => $sender_email, + 'sender_nickname' => $sender_nickname, + 'js_on' => $checkjs, + 'post_info' => array('comment_type' => 'contact_form_wordpress_cf7'), + 'sender_info' => array( + 'form_validation' => ! isset($apbct->validation_error) + ? null + : json_encode(array( + 'validation_notice' => $apbct->validation_error, + 'page_url' => TT::toString(Server::get('HTTP_HOST')) . TT::toString(Server::get('REQUEST_URI')), + )), + 'sender_emails_array' => $sender_emails_array, + ), ), + $honeypot_params ) ); @@ -1870,19 +1887,16 @@ function ct_quform_post_validate($result, $form) * Filter for POST */ $input_array = apply_filters('apbct__filter_post', $form->getValues()); - $ct_temp_msg_data = ct_get_fields_any($input_array); $sender_email = isset($ct_temp_msg_data['email']) ? $ct_temp_msg_data['email'] : ''; $sender_emails_array = isset($ct_temp_msg_data['emails_array']) ? $ct_temp_msg_data['emails_array'] : ''; - $checkjs = apbct_js_test(Sanitize::cleanTextField(Cookie::get('ct_checkjs')), true); $base_call_result = apbct_base_call( array( 'message' => $form->getValues(), 'sender_email' => $sender_email, 'post_info' => array('comment_type' => $comment_type), 'sender_info' => array('sender_emails_array' => $sender_emails_array), - 'js_on' => $checkjs, ) ); diff --git a/inc/cleantalk-public-validate-skip-functions.php b/inc/cleantalk-public-validate-skip-functions.php index ebe31ade7..7e9784a3b 100755 --- a/inc/cleantalk-public-validate-skip-functions.php +++ b/inc/cleantalk-public-validate-skip-functions.php @@ -287,6 +287,11 @@ function skip_for_ct_contact_form_validate() Get::equal('wc-ajax', 'wc_stripe_frontend_request') && ! empty(Post::getString('stripe_applepay_token_key')) ), + // BuddyBoss REST API has a direct integration + '101' => ( + apbct_is_plugin_active('buddyboss-platform/buddyboss-platform.php') && + apbct_is_in_uri('/wp-json/buddyboss/v1/signup') + ), ); foreach ( $exclusions as $exclusion_key => $state ) { diff --git a/inc/cleantalk-public.php b/inc/cleantalk-public.php index 4c706eeea..6d252772f 100644 --- a/inc/cleantalk-public.php +++ b/inc/cleantalk-public.php @@ -32,7 +32,7 @@ function apbct_init() $apbct->settings['data__pixel'] && empty($apbct->pixel_url) && !( - $apbct->settings['data__bot_detector_enabled'] === '1' && + apbct__is_bot_detector_enabled() && $apbct->settings['data__pixel'] === '3' ) ) { @@ -378,6 +378,36 @@ class_exists('Jetpack', false) && } } +/** + * SiteGround Speed Optimizer: register sgo_bypass_query_params filter. + */ +function apbct_sgo_optimizer__register_bypass_query_params() +{ + if ( ! defined('SG_OPTIMIZER_VERSION') ) { + return; + } + add_filter('sgo_bypass_query_params', 'apbct_sgo_bypass_query_params', 10, 1); +} + +/** + * Adds apbct_no_cache to SG Optimizer bypass list. + * + * @param string[] $bypass_query_params + * + * @return string[] + */ +function apbct_sgo_bypass_query_params($bypass_query_params) +{ + if ( ! is_array($bypass_query_params) ) { + $bypass_query_params = array(); + } + if ( ! in_array('apbct_no_cache', $bypass_query_params, true) ) { + $bypass_query_params[] = 'apbct_no_cache'; + } + + return $bypass_query_params; +} + function apbct_buffer__start() { ob_start(); @@ -540,7 +570,7 @@ function apbct_hook__wp_footer() ( $apbct->settings['data__pixel'] === '3' && ! apbct_is_cache_plugins_exists() && - $apbct->settings['data__bot_detector_enabled'] !== '1' + ! apbct__is_bot_detector_enabled() ) ) { echo ''; @@ -1245,7 +1275,7 @@ function apbct_enqueue_and_localize_public_scripts() ApbctEnqueue::getInstance()->js($bundle_name, array(), $in_footer); // Bot detector - if ( $apbct->settings['data__bot_detector_enabled'] && ! apbct_bot_detector_scripts_exclusion()) { + if ( apbct__is_bot_detector_enabled() && ! apbct_bot_detector_scripts_exclusion()) { // Attention! Skip old enqueue way for external script. wp_enqueue_script( 'ct_bot_detector', diff --git a/inc/cleantalk-settings.php b/inc/cleantalk-settings.php index 16889ae21..8e8d344ea 100644 --- a/inc/cleantalk-settings.php +++ b/inc/cleantalk-settings.php @@ -564,14 +564,17 @@ function apbct_settings__set_fields() 'callback' => 'apbct_settings__check_alt_cookies_types' ), //bot detector - 'data__bot_detector_enabled' => array( - 'title' => __('Use ', 'cleantalk-spam-protect') - . $apbct->data['wl_brandname'] - . __(' JavaScript library', 'cleantalk-spam-protect'), - 'description' => __('This option includes external ', 'cleantalk-spam-protect') - . $apbct->data['wl_brandname'] - . __(' JavaScript library to getting visitors info data', 'cleantalk-spam-protect'), - 'childrens' => array('exclusions__bot_detector') + 'bot_detector_state' => array( + 'callback' => function () { + printf( + esc_html__('JavaScript library (Bot Detector) is %s', 'cleantalk-spam-protect'), + apbct__is_bot_detector_enabled() + ? esc_html__('enabled', 'cleantalk-spam-protect') + : esc_html__('disabled', 'cleantalk-spam-protect') + ); + }, + 'long_description' => true, + 'display' => apbct__is_bot_detector_enabled(), ), 'exclusions__bot_detector' => array( 'title' => __('JavaScript Library Exclusions', 'cleantalk-spam-protect'), @@ -584,7 +587,7 @@ function apbct_settings__set_fields() 'Regular expression. Use to skip a HTML form from special service field attach.', 'cleantalk-spam-protect' ), - 'parent' => 'data__bot_detector_enabled', + 'display' => apbct__is_bot_detector_enabled(), ), 'exclusions__bot_detector__form_attributes' => array( 'type' => 'text', @@ -592,6 +595,7 @@ function apbct_settings__set_fields() 'parent' => 'exclusions__bot_detector', 'class' => 'apbct_settings-field_wrapper--sub', 'long_description' => true, + 'display' => apbct__is_bot_detector_enabled(), ), 'exclusions__bot_detector__form_children_attributes' => array( 'type' => 'text', @@ -599,6 +603,7 @@ function apbct_settings__set_fields() 'parent' => 'exclusions__bot_detector', 'class' => 'apbct_settings-field_wrapper--sub', 'long_description' => true, + 'display' => apbct__is_bot_detector_enabled(), ), 'exclusions__bot_detector__form_parent_attributes' => array( 'type' => 'text', @@ -606,6 +611,7 @@ function apbct_settings__set_fields() 'parent' => 'exclusions__bot_detector', 'class' => 'apbct_settings-field_wrapper--sub', 'long_description' => true, + 'display' => apbct__is_bot_detector_enabled(), ), 'wp__use_builtin_http_api' => array( 'title' => __("Use WordPress HTTP API", 'cleantalk-spam-protect'), @@ -645,7 +651,7 @@ function apbct_settings__set_fields() ), 'data__email_check_exist_post' => array( 'title' => __('Show email existence alert when filling in the field', 'cleantalk-spam-protect'), - 'description' => __('Checks the email address and shows the result as an icon in the email field before submitting the form. Works for WooCommerce checkout form, FluentForms, Contact Form 7, Gravity Forms, Ninja Forms, WPForms, standard WordPress comment form and registration form.', 'cleantalk-spam-protect'), + 'description' => __('Checks the email address and shows the result as an icon in the email field before submitting the form. Works for WooCommerce checkout form, FluentForms, Contact Form 7, Gravity Forms, Ninja Forms, WPForms, standard WordPress comment form and registration form.', 'cleantalk-spam-protect') . ' ' . '' . __('Read more', 'cleantalk-spam-protect') . '', ), ), ), @@ -3150,6 +3156,14 @@ function apbct_settings__get__long_description() 'title' => __('Contact data encoding', 'cleantalk-spam-protect'), 'desc' => ContactsEncoder::getEmailEncoderCommonLongDescription(), ), + 'bot_detector_state' => array( + 'title' => esc_html__('JavaScript library (Bot Detector)', 'cleantalk-spam-protect'), + 'desc' => esc_html__("The Bot Detector is a JavaScript library that runs in the visitor's browser and collects behavioral signals to distinguish real users from bots.", 'cleantalk-spam-protect') + . '

' . esc_html__("This data is sent to the CleanTalk cloud along with each spam check request, significantly improving detection accuracy for spam on any website forms.", 'cleantalk-spam-protect') + . '

' . esc_html__("Disabling the Bot Detector will reduce anti-spam effectiveness.", 'cleantalk-spam-protect') + . '
' . esc_html__("It can only be disabled by adding the following constant to your wp-config.php: define('APBCT_SERVICE__BOT_DETECTOR_ENABLED', false);", 'cleantalk-spam-protect') + . '
' . esc_html__("We do not recommend disabling this functionality.", 'cleantalk-spam-protect') + ), ); if (!empty($setting_id) && isset($descriptions[$setting_id])) { diff --git a/inc/cleantalk-updater.php b/inc/cleantalk-updater.php index f8304326a..d4c865378 100644 --- a/inc/cleantalk-updater.php +++ b/inc/cleantalk-updater.php @@ -1377,3 +1377,14 @@ function apbct_update_to_6_60_0() } } } + +function apbct_update_to_6_76_0() +{ + global $apbct; + + if ( isset($apbct->settings['data__bot_detector_enabled']) ) { + $bot_detector_state = $apbct->settings['data__bot_detector_enabled']; + $apbct->data['bot_detector_enabled'] = $bot_detector_state; + $apbct->saveData(); + } +} diff --git a/js/apbct-public-bundle.min.js b/js/apbct-public-bundle.min.js index 277c7f47c..e8b3aec2c 100644 --- a/js/apbct-public-bundle.min.js +++ b/js/apbct-public-bundle.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(f=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,_.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(c),i.append(" "),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function c(){_classCallCheck(this,c)}return _createClass(c,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,k.apply(this,n));e.n=2;break;case 2:if(g=!1,n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,k.apply(this,n));case 3:return e.n=4,y.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=h(n[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(c=document.createElement("div")).append(i),c.append(" "),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_ext-protection.min.js b/js/apbct-public-bundle_ext-protection.min.js index 9506d835d..5f2d9de04 100644 --- a/js/apbct-public-bundle_ext-protection.min.js +++ b/js/apbct-public-bundle_ext-protection.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function c(){_classCallCheck(this,c)}return _createClass(c,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(m=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,f.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(c=document.createElement("div")).append(i),c.append(" "),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function c(){_classCallCheck(this,c)}return _createClass(c,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,k.apply(this,n));e.n=2;break;case 2:if(v=!1,n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,k.apply(this,n));case 3:return e.n=4,y.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=h(n[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,d;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",u.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(u.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(c=document.createElement("div")).append(i),c.append(" "),c.append(u.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(u.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",u.trpContentLink),s.setAttribute("target","_blank"),(d=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),d.setAttribute("alt","New window"),d.setAttribute("style","padding-top:3px"),s.append(d),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_ext-protection_gathering.min.js b/js/apbct-public-bundle_ext-protection_gathering.min.js index a81a13624..0f5b4936e 100644 --- a/js/apbct-public-bundle_ext-protection_gathering.min.js +++ b/js/apbct-public-bundle_ext-protection_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(f=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,_.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=r,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var o,n=Object.keys(t);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(t),e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)),n}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o{var o,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(o=e)}),!1===o.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var n=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(n,o.decoded_email),c[t].href=e+o.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var o="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(o=e.decoded_email)}),t.innerHTML=o})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var o=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),o.append(c),this.opened=!0},confirm:function(e){var t,o=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var o in e)if(Object.hasOwn(e,o))for(var n=o.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?o||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||Boolean(e[t]):o||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):o}},{key:"isWithoutSelector",value:function(e,t){var o,n=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(o=a.n()).done;)n=n||e===o.value}catch(e){a.e(e)}finally{a.f()}return n}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.after(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"append",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.append(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"fadeIn",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-o)/n,o=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,o=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-o)/n,o=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,o=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function n(e){for(var t in _classCallCheck(this,n),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(n,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,o="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(o=e.headers["X-WP-Nonce"]),""!==(o=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:o)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:o,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),o=0;o{function n(){for(var e=arguments.length,t=new Array(e),o=0;o{function a(){for(var e=arguments.length,t=new Array(e),o=0;o{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",o=0,n=Object.entries(this.config);oMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(n){n.addEventListener("click",function(e){var t=n.getAttribute("href"),o=apbctLocalStorage.get("bot_detector_event_token");o&&(-1===t.indexOf("?")?t+="?":t+="&",n.setAttribute("href",t+="ct_bot_detector_event_token="+o))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var o=document.createElement("input"),t=(o.setAttribute("type","hidden"),o.setAttribute("id","apbct_visible_fields_"+t),o.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),o.value=btoa(JSON.stringify(t)),e.append(o)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),o=getCleanTalkStorageDataArray(),o=JSON.stringify(o);return o="_ct_no_cookie_data_"+btoa(o),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",o),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,o;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var o="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof o[0]?o[0]:(null==(a=o[0])?void 0:a.url)||""))return e.a(2,k.apply(this,o));e.n=2;break;case 2:if(g=!1,o&&o[0]&&o[1]&&o[1].body){e.n=3;break}return e.a(2,k.apply(this,o));case 3:return e.n=4,y.processFetch(o);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return o[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{o[1].body=h(o[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return o.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var o,n,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),o=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},n=r,null!==i&&(n.apbct_search_form__honeypot_value=i),n.ct_bot_detector_event_token=l,"string"==typeof n.apbct_pixel_url&&-1!==n.apbct_pixel_url.indexOf("%3A")&&(n.apbct_pixel_url=decodeURIComponent(n.apbct_pixel_url)),void 0!==(a=JSON.stringify(n))&&0!==a.length?ctSetAlternativeCookie(a,{callback:o,onErrorCallback:o,forceAltCookies:!0}):o())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var n=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,o){n(t)}):jQuery(document).ajaxComplete(function(e,t,o){n(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&n(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,o="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(o=e.comment),o=void 0!==e.data&&void 0!==(e=e.data).message?e.message:o)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:o}})),cleantalkModal.loaded=o,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var n=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&n.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=n;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),o=this.getIdFromAjax(e);if(o){var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var c=n.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===o){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var o,n=0;n_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var o=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){o.data.push(Object.assign({},o.fieldData))})}},{key:"setListeners",value:function(){var n=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){n.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){n.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,o){e.addEventListener("input",function(){n.data[o].countOfKey++;var e,t=+new Date;1===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].firstKeyTimestamp=t):(e=t-n.data[o].lastKeyTimestamp,2===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var o,n,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((o=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(n=document.createElement("img")).setAttribute("src",d.imgPersonUrl),n.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),o.append(n),e.append(o),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(n){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),n.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),n.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),n.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.addEventListener("touchend",function(){var o=this;a=setTimeout(function(){var e=o.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=n.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_full-protection.min.js b/js/apbct-public-bundle_full-protection.min.js index 4f73a5cf8..ef19a6986 100644 --- a/js/apbct-public-bundle_full-protection.min.js +++ b/js/apbct-public-bundle_full-protection.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function c(){_classCallCheck(this,c)}return _createClass(c,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(m=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,f.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){return document.querySelectorAll("div.ct-encoded-form-wrapper")}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};1==ctPublic.settings__data__bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(t){this.wrappers.forEach(function(e){e.querySelector("div.ct-encoded-form").dataset.encodedForm&&(e.outerHTML='
'+t+"
")})}}]))();function apbctForceProtect(){+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection}function ctCheckInternal(t){var e,n={},o=t.elements;for(e in o)"submit"!==o[e].type&&void 0!==o[e].value&&""!==o[e].value&&(n[o[e].name]=t.elements[e].value);n.action="ct_check_internal",apbct_public_sendAJAX(n,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.origSubmit()}})}function ctProtectInternalForms(){for(var e,t="",n="",o=0;o .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(c=document.createElement("div")).append(i),c.append(" "),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function c(){_classCallCheck(this,c)}return _createClass(c,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,k.apply(this,n));e.n=2;break;case 2:if(v=!1,n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,k.apply(this,n));case 3:return e.n=4,y.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=h(n[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){return document.querySelectorAll("div.ct-encoded-form-wrapper")}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(t){this.wrappers.forEach(function(e){e.querySelector("div.ct-encoded-form").dataset.encodedForm&&(e.outerHTML='
'+t+"
")})}}]))();function apbctForceProtect(){+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection}function ctCheckInternal(t){var e,n={},o=t.elements;for(e in o)"submit"!==o[e].type&&void 0!==o[e].value&&""!==o[e].value&&(n[o[e].name]=t.elements[e].value);n.action="ct_check_internal",apbct_public_sendAJAX(n,{url:ctPublicFunctions._ajax_url,callback:function(e){if(!0!==e.success)return alert(e.data),!1;t.origSubmit()}})}function ctProtectInternalForms(){for(var e,t="",n="",o=0;o .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,d;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",u.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(u.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(c=document.createElement("div")).append(i),c.append(" "),c.append(u.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(u.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",u.trpContentLink),s.setAttribute("target","_blank"),(d=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),d.setAttribute("alt","New window"),d.setAttribute("style","padding-top:3px"),s.append(d),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_full-protection_gathering.min.js b/js/apbct-public-bundle_full-protection_gathering.min.js index a4432f3dd..0e13d35e7 100644 --- a/js/apbct-public-bundle_full-protection_gathering.min.js +++ b/js/apbct-public-bundle_full-protection_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(r.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";r.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=r.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function r(){_classCallCheck(this,r)}return _createClass(r,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(f=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,_.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct_email_id__"]'),r=null,i=(null!==c&&null!==c.value&&(r=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==r&&(o.apbct_search_form__honeypot_value=r),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,r=this.findParentContainer(c);if(r){var i=this.getIdFromHTML(r);if(i===n){var l=r.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){return document.querySelectorAll("div.ct-encoded-form-wrapper")}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};1==ctPublic.settings__data__bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var n;this.wrappers.forEach(function(e){n=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;n&&"string"==typeof n&&(t=decodeURIComponent(n),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(t){this.wrappers.forEach(function(e){e.querySelector("div.ct-encoded-form").dataset.encodedForm&&(e.outerHTML='
'+t+"
")})}}]))();function apbctForceProtect(){+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection}ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbctForceProtect():apbct_attach_event_handler(document,"DOMContentLoaded",apbctForceProtect));var ctMouseReadInterval,ctMouseWriteDataInterval,ApbctGatheringData=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,r,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(r=document.createElement("div")).append(i),r.append(" "),r.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),c.append(r,i),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var o,n=Object.keys(t);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(t),e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)),n}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o{var o,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(o=e)}),!1===o.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var n=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(n,o.decoded_email),c[t].href=e+o.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var o="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(o=e.decoded_email)}),t.innerHTML=o})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var o=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),o.append(c),this.opened=!0},confirm:function(e){var t,o=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var o in e)if(Object.hasOwn(e,o))for(var n=o.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?o||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||Boolean(e[t]):o||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):o}},{key:"isWithoutSelector",value:function(e,t){var o,n=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(o=a.n()).done;)n=n||e===o.value}catch(e){a.e(e)}finally{a.f()}return n}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.after(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"append",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.append(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"fadeIn",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-o)/n,o=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,o=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-o)/n,o=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,o=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function n(e){for(var t in _classCallCheck(this,n),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(n,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,o="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(o=e.headers["X-WP-Nonce"]),""!==(o=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:o)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:o,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),o=0;o{function n(){for(var e=arguments.length,t=new Array(e),o=0;o{function a(){for(var e=arguments.length,t=new Array(e),o=0;o{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",o=0,n=Object.entries(this.config);oMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(n){n.addEventListener("click",function(e){var t=n.getAttribute("href"),o=apbctLocalStorage.get("bot_detector_event_token");o&&(-1===t.indexOf("?")?t+="?":t+="&",n.setAttribute("href",t+="ct_bot_detector_event_token="+o))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var o=document.createElement("input"),t=(o.setAttribute("type","hidden"),o.setAttribute("id","apbct_visible_fields_"+t),o.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),o.value=btoa(JSON.stringify(t)),e.append(o)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),o=getCleanTalkStorageDataArray(),o=JSON.stringify(o);return o="_ct_no_cookie_data_"+btoa(o),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",o),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,o;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var o="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof o[0]?o[0]:(null==(a=o[0])?void 0:a.url)||""))return e.a(2,k.apply(this,o));e.n=2;break;case 2:if(v=!1,o&&o[0]&&o[1]&&o[1].body){e.n=3;break}return e.a(2,k.apply(this,o));case 3:return e.n=4,y.processFetch(o);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return o[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{o[1].body=h(o[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return o.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var o,n,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),o=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},n=r,null!==i&&(n.apbct_search_form__honeypot_value=i),n.ct_bot_detector_event_token=l,"string"==typeof n.apbct_pixel_url&&-1!==n.apbct_pixel_url.indexOf("%3A")&&(n.apbct_pixel_url=decodeURIComponent(n.apbct_pixel_url)),void 0!==(a=JSON.stringify(n))&&0!==a.length?ctSetAlternativeCookie(a,{callback:o,onErrorCallback:o,forceAltCookies:!0}):o())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var n=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,o){n(t)}):jQuery(document).ajaxComplete(function(e,t,o){n(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&n(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,o="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(o=e.comment),o=void 0!==e.data&&void 0!==(e=e.data).message?e.message:o)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:o}})),cleantalkModal.loaded=o,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var n=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&n.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=n;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),o=this.getIdFromAjax(e);if(o){var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var c=n.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===o){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"wrappers",[]),this.wrappers=this.findWrappers(),this.wrappers.length<1||this.checkBot()},[{key:"findWrappers",value:function(){return document.querySelectorAll("div.ct-encoded-form-wrapper")}},{key:"checkBot",value:function(){var t=this,e={post_url:document.location.href,referrer:document.referrer};+ctPublic.bot_detector_enabled?e.event_token=apbctLocalStorage.get("bot_detector_event_token"):e.event_javascript_data=getJavascriptClientData(),"rest"===ctPublicFunctions.data__ajax_type?apbct_public_sendREST("force_protection_check_bot",{data:e,method:"POST",callback:function(e){return t.checkBotCallback(e)}}):"admin_ajax"===ctPublicFunctions.data__ajax_type&&(e.action="apbct_force_protection_check_bot",apbct_public_sendAJAX(e,{callback:function(e){return t.checkBotCallback(e)}}))}},{key:"checkBotCallback",value:function(e){if(e.data&&e.data.status&&200!==e.data.status)console.log("ApbctForceProtection connection error occurred"),this.decodeForms();else{if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.log("ApbctForceProtection decodeForms error",e),void this.decodeForms()}"object"===_typeof(e)&&e.allow&&1===e.allow?(this.decodeForms(),document.dispatchEvent(new Event("apbctForceProtectionAllowed"))):this.showMessageForBot(e.message)}}},{key:"decodeForms",value:function(){var o;this.wrappers.forEach(function(e){o=e.querySelector("div.ct-encoded-form").dataset.encodedForm;try{var t;o&&"string"==typeof o&&(t=decodeURIComponent(o),e.outerHTML=atob(t))}catch(e){console.log(e)}})}},{key:"showMessageForBot",value:function(t){this.wrappers.forEach(function(e){e.querySelector("div.ct-encoded-form").dataset.encodedForm&&(e.outerHTML='
'+t+"
")})}}]))();function apbctForceProtect(){+ctPublic.settings__forms__force_protection&&void 0!==ApbctForceProtection&&new ApbctForceProtection}ctPublic.data__key_is_ok&&("loading"!==document.readyState?apbctForceProtect():apbct_attach_event_handler(document,"DOMContentLoaded",apbctForceProtect));var ctMouseReadInterval,ctMouseWriteDataInterval,ApbctGatheringData=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var o,n=0;n_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var o=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){o.data.push(Object.assign({},o.fieldData))})}},{key:"setListeners",value:function(){var n=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){n.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){n.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,o){e.addEventListener("input",function(){n.data[o].countOfKey++;var e,t=+new Date;1===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].firstKeyTimestamp=t):(e=t-n.data[o].lastKeyTimestamp,2===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var o,n,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((o=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(n=document.createElement("img")).setAttribute("src",d.imgPersonUrl),n.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),o.append(n),e.append(o),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(n){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),n.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),n.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),n.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.addEventListener("touchend",function(){var o=this;a=setTimeout(function(){var e=o.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=n.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_gathering.min.js b/js/apbct-public-bundle_gathering.min.js index f2ec8406f..81a1227b2 100644 --- a/js/apbct-public-bundle_gathering.min.js +++ b/js/apbct-public-bundle_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(f=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,_.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=r,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var o,n=Object.keys(t);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(t),e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)),n}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o{var o,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(o=e)}),!1===o.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var n=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(n,o.decoded_email),c[t].href=e+o.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var o="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(o=e.decoded_email)}),t.innerHTML=o})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var o=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),o.append(c),this.opened=!0},confirm:function(e){var t,o=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var o in e)if(Object.hasOwn(e,o))for(var n=o.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?o||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||Boolean(e[t]):o||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):o}},{key:"isWithoutSelector",value:function(e,t){var o,n=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(o=a.n()).done;)n=n||e===o.value}catch(e){a.e(e)}finally{a.f()}return n}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.after(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"append",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.append(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"fadeIn",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-o)/n,o=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,o=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-o)/n,o=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,o=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function n(e){for(var t in _classCallCheck(this,n),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(n,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,o="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(o=e.headers["X-WP-Nonce"]),""!==(o=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:o)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:o,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),o=0;o{function n(){for(var e=arguments.length,t=new Array(e),o=0;o{function a(){for(var e=arguments.length,t=new Array(e),o=0;o{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",o=0,n=Object.entries(this.config);oMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(n){n.addEventListener("click",function(e){var t=n.getAttribute("href"),o=apbctLocalStorage.get("bot_detector_event_token");o&&(-1===t.indexOf("?")?t+="?":t+="&",n.setAttribute("href",t+="ct_bot_detector_event_token="+o))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var o=document.createElement("input"),t=(o.setAttribute("type","hidden"),o.setAttribute("id","apbct_visible_fields_"+t),o.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),o.value=btoa(JSON.stringify(t)),e.append(o)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),o=getCleanTalkStorageDataArray(),o=JSON.stringify(o);return o="_ct_no_cookie_data_"+btoa(o),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",o),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,o;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var o="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof o[0]?o[0]:(null==(a=o[0])?void 0:a.url)||""))return e.a(2,k.apply(this,o));e.n=2;break;case 2:if(g=!1,o&&o[0]&&o[1]&&o[1].body){e.n=3;break}return e.a(2,k.apply(this,o));case 3:return e.n=4,y.processFetch(o);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return o[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{o[1].body=h(o[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return o.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var o,n,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),o=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},n=r,null!==i&&(n.apbct_search_form__honeypot_value=i),n.ct_bot_detector_event_token=l,"string"==typeof n.apbct_pixel_url&&-1!==n.apbct_pixel_url.indexOf("%3A")&&(n.apbct_pixel_url=decodeURIComponent(n.apbct_pixel_url)),void 0!==(a=JSON.stringify(n))&&0!==a.length?ctSetAlternativeCookie(a,{callback:o,onErrorCallback:o,forceAltCookies:!0}):o())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var n=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,o){n(t)}):jQuery(document).ajaxComplete(function(e,t,o){n(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&n(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,o="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(o=e.comment),o=void 0!==e.data&&void 0!==(e=e.data).message?e.message:o)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:o}})),cleantalkModal.loaded=o,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var n=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&n.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=n;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),o=this.getIdFromAjax(e);if(o){var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var c=n.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===o){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var o,n=0;n_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var o=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){o.data.push(Object.assign({},o.fieldData))})}},{key:"setListeners",value:function(){var n=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){n.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){n.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,o){e.addEventListener("input",function(){n.data[o].countOfKey++;var e,t=+new Date;1===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].firstKeyTimestamp=t):(e=t-n.data[o].lastKeyTimestamp,2===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var o,n,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((o=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(n=document.createElement("img")).setAttribute("src",d.imgPersonUrl),n.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),o.append(n),e.append(o),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(n){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),n.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),n.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),n.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.addEventListener("touchend",function(){var o=this;a=setTimeout(function(){var e=o.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=n.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_int-protection.min.js b/js/apbct-public-bundle_int-protection.min.js index 02cfe475d..6101be9b0 100644 --- a/js/apbct-public-bundle_int-protection.min.js +++ b/js/apbct-public-bundle_int-protection.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(i.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(f=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,_.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),i=null,c=(null!==r&&null!==r.value&&(i=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===c&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=c,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,i=this.findParentContainer(r);if(i){var c=this.getIdFromHTML(i);if(c===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,i,c,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(c=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(c),i.append(" "),i.append(d.phrases.trpContent1),(c=document.createElement("div")).style.display="flex",c.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),c.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),c.append(l)),r.append(i,c),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;et||r=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(c.data.forEach(function(e){e.encoded_email===r[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===r[t].href||0!==r[t].href.indexOf("mailto:")&&0!==r[t].href.indexOf("tel:"))r[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r[t])},2e3);else{if(0===r[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==r[t].href.indexOf("tel:"))return 0;e="tel:"}var o=r[t].href.replace(e,""),a=r[t].innerHTML;r[t].innerHTML=a.replace(o,n.decoded_email),r[t].href=e+n.decoded_email,r[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";c.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}r[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=c.data[0];r.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,r)},2e3),r.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(r.innerHTML="Loading...",t&&this.load(t)),r.setAttribute("id","cleantalk-modal-content"),n.append(r),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function c(){_classCallCheck(this,c)}return _createClass(c,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.a(2,k.apply(this,n));e.n=2;break;case 2:if(g=!1,n&&n[0]&&n[1]&&n[1].body){e.n=3;break}return e.a(2,k.apply(this,n));case 3:return e.n=4,y.processFetch(n);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=h(n[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,r=t.querySelector('[name*="apbct_email_id__"]'),c=null,i=(null!==r&&null!==r.value&&(c=r.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===i&&null===r&&null===l||(e.preventDefault(),n=function(){null!==r&&r.parentNode.removeChild(r),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=i,null!==c&&(o.apbct_search_form__honeypot_value=c),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,r=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var r=o.value,c=this.findParentContainer(r);if(c){var i=this.getIdFromHTML(c);if(i===n){var l=c.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,r,c,i,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(i=document.createElement("strong")).append(d.phrases.trpHeading),(r=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),r.setAttribute("style","white-space: nowrap"),(c=document.createElement("div")).append(i),c.append(" "),c.append(d.phrases.trpContent1),(i=document.createElement("div")).style.display="flex",i.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),i.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),i.append(l)),r.append(c,i),a.append(r),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/apbct-public-bundle_int-protection_gathering.min.js b/js/apbct-public-bundle_int-protection_gathering.min.js index 326380e5e..d49506c78 100644 --- a/js/apbct-public-bundle_int-protection_gathering.min.js +++ b/js/apbct-public-bundle_int-protection_gathering.min.js @@ -1 +1 @@ -function ownKeys(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function _objectSpread(t){for(var e=1;e=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var n;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n{var n,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(n=e)}),!1===n.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var o=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(o,n.decoded_email),c[t].href=e+n.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var n="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var n=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(n,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),n.append(c),this.opened=!0},confirm:function(e){var t,n=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var n in e)if(Object.hasOwn(e,n))for(var o=n.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?n||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?n||Boolean(e[t]):n||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):n}},{key:"isWithoutSelector",value:function(e,t){var n,o=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(n=a.n()).done;)o=o||e===n.value}catch(e){a.e(e)}finally{a.f()}return o}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.after(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"append",value:function(e){var t,n=_createForOfIteratorHelper(this.elements);try{for(n.s();!(t=n.n()).done;)t.value.append(e)}catch(e){n.e(e)}finally{n.f()}}},{key:"fadeIn",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-n)/o,n=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,n=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(o){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-n)/o,n=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,n=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function o(e){for(var t in _classCallCheck(this,o),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(o,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,n="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(n=e.headers["X-WP-Nonce"]),""!==(n=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:n)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:n,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),n=0;n{function o(){for(var e=arguments.length,t=new Array(e),n=0;n{function a(){for(var e=arguments.length,t=new Array(e),n=0;n{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",n=0,o=Object.entries(this.config);nMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(o){o.addEventListener("click",function(e){var t=o.getAttribute("href"),n=apbctLocalStorage.get("bot_detector_event_token");n&&(-1===t.indexOf("?")?t+="?":t+="&",o.setAttribute("href",t+="ct_bot_detector_event_token="+n))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.settings__data__bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var n=document.createElement("input"),t=(n.setAttribute("type","hidden"),n.setAttribute("id","apbct_visible_fields_"+t),n.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),n.value=btoa(JSON.stringify(t)),e.append(n)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),n=getCleanTalkStorageDataArray(),n=JSON.stringify(n);return n="_ct_no_cookie_data_"+btoa(n),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",n),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,n;+ctPublic.settings__data__bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(n="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,n+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var n="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var o in n){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof n[0]?n[0]:(null==(a=n[0])?void 0:a.url)||""))return e.abrupt("return",b.apply(this,n));e.next=7;break;case 7:if(f=!1,n&&n[0]&&n[1]&&n[1].body){e.next=10;break}return e.abrupt("return",b.apply(this,n));case 10:return e.next=12,_.processFetch(n);case 12:if(!0===e.sent)return e.abrupt("return",Promise.reject(new Error("Forbidden")));e.next=15;break;case 15:if(0{try{return n[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{n[1].body=p(n[1].body,d(+ctPublic.settings__data__bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return n.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var n,o,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),n=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},o=r,null!==i&&(o.apbct_search_form__honeypot_value=i),o.ct_bot_detector_event_token=l,"string"==typeof o.apbct_pixel_url&&-1!==o.apbct_pixel_url.indexOf("%3A")&&(o.apbct_pixel_url=decodeURIComponent(o.apbct_pixel_url)),void 0!==(a=JSON.stringify(o))&&0!==a.length?ctSetAlternativeCookie(a,{callback:n,onErrorCallback:n,forceAltCookies:!0}):n())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var o=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,n){o(t)}):jQuery(document).ajaxComplete(function(e,t,n){o(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&o(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,n="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(n=e.comment),n=void 0!==e.data&&void 0!==(e=e.data).message?e.message:n)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:n}})),cleantalkModal.loaded=n,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var o=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&o.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=o;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),n=this.getIdFromAjax(e);if(n){var o,a=_createForOfIteratorHelper(t);try{for(a.s();!(o=a.n()).done;){var c=o.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===n){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,n=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var n,o=0;o_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var n=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){n.data.push(Object.assign({},n.fieldData))})}},{key:"setListeners",value:function(){var o=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){o.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){o.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,n){e.addEventListener("input",function(){o.data[n].countOfKey++;var e,t=+new Date;1===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].firstKeyTimestamp=t):(e=t-o.data[n].lastKeyTimestamp,2===o.data[n].countOfKey?(o.data[n].lastKeyTimestamp=t,o.data[n].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var n,o,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((n=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(o=document.createElement("img")).setAttribute("src",d.imgPersonUrl),o.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),n.append(o),e.append(n),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(o){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),o.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),o.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),o.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),o.addEventListener("touchend",function(){var n=this;a=setTimeout(function(){var e=n.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=o.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file +function ownKeys(t,e){var o,n=Object.keys(t);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(t),e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)),n}function _objectSpread(t){for(var e=1;et||c=e.length?{done:!0}:{done:!1,value:e[c++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o{var o,e;if(i.data.forEach(function(e){e.encoded_email===c[t].dataset.originalString&&(o=e)}),!1===o.is_allowed)return{v:void 0};if(void 0===c[t].href||0!==c[t].href.indexOf("mailto:")&&0!==c[t].href.indexOf("tel:"))c[t].classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c[t])},2e3);else{if(0===c[t].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[t].href.indexOf("tel:"))return 0;e="tel:"}var n=c[t].href.replace(e,""),a=c[t].innerHTML;c[t].innerHTML=a.replace(n,o.decoded_email),c[t].href=e+o.decoded_email,c[t].querySelectorAll("span.apbct-email-encoder").forEach(function(t){var o="";i.data.forEach(function(e){e.encoded_email===t.dataset.originalString&&(o=e.decoded_email)}),t.innerHTML=o})}c[t].removeEventListener("click",ctFillDecodedEmailHandler)})(t))&&e)return e.v}else{var o=i.data[0];c.classList.add("no-blur"),setTimeout(function(){ctProcessDecodedDataResult(o,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=e),e.length)for(var t=0;t$1'):(c.innerHTML="Loading...",t&&this.load(t)),c.setAttribute("id","cleantalk-modal-content"),o.append(c),this.opened=!0},confirm:function(e){var t,o=1_createClass(function e(t){_classCallCheck(this,e),_defineProperty(this,"ajax_parameters",{}),_defineProperty(this,"restParameters",{}),_defineProperty(this,"selector",null),_defineProperty(this,"elements",[]),_defineProperty(this,"eventCallback",void 0),_defineProperty(this,"eventSelector",void 0),_defineProperty(this,"event",void 0),this.select(t)},[{key:"select",value:function(e){return e instanceof HTMLCollection?(this.selector=null,this.elements=[],this.elements=Array.prototype.slice.call(e)):"object"===_typeof(e)?(this.selector=null,this.elements=[],this.elements[0]=e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect(),this}},{key:"addElement",value:function(e){"object"===_typeof(e)?this.elements.push(e):"string"==typeof e?(this.selector=e,this.elements=Array.prototype.slice.call(document.querySelectorAll(e))):this.deselect()}},{key:"push",value:function(e){this.elements.push(e)}},{key:"reduce",value:function(){this.elements=this.elements.slice(0,-1)}},{key:"deselect",value:function(){this.elements=[]}},{key:"css",value:function(e,t){if(t=t||!1,"object"===_typeof(e)){for(var o in e)if(Object.hasOwn(e,o))for(var n=o.replace(/([-_][a-z])/g,function(e){return e.toUpperCase().replace("-","").replace("_","")}),a=0;a(e=document.createElement(e).constructor,!Boolean(~[HTMLElement,HTMLUnknownElement].indexOf(e))))(t)?o||e.tagName.toLowerCase()===t.toLowerCase():t.match(/^[a-z]/)?o||Boolean(e[t]):o||(null!==this.selector?null!==document.querySelector(this.selector+t):this.isWithoutSelector(e,t)):o}},{key:"isWithoutSelector",value:function(e,t){var o,n=!1,a=_createForOfIteratorHelper(document.querySelectorAll(t));try{for(a.s();!(o=a.n()).done;)n=n||e===o.value}catch(e){a.e(e)}finally{a.f()}return n}},{key:"filter",value:function(e){this.selector=null;for(var t=this.elements.length-1;0<=t;t--)this.isElem(this.elements[t],e)||this.elements.splice(Number(t),1);return this}},{key:"parent",value:function(e){return this.select(this.elements[0].parentElement),void 0===e||this.is(e)||this.deselect(),this}},{key:"parents",value:function(e){for(this.select(this.elements[0]);null!==this.elements[this.elements.length-1].parentElement;)this.push(this.elements[this.elements.length-1].parentElement);return this.elements.splice(0,1),void 0!==e&&this.filter(e),this}},{key:"children",value:function(e){return this.select(this.elements[0].children),void 0!==e&&this.filter(e),this}},{key:"siblings",value:function(e){var t=this.elements[0];return this.parent(),this.children(e),this.elements.splice(this.elements.indexOf(t),1),this}},{key:"remove",value:function(){var e,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(e){t.e(e)}finally{t.f()}}},{key:"after",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.after(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"append",value:function(e){var t,o=_createForOfIteratorHelper(this.elements);try{for(o.s();!(t=o.n()).done;)t.value.append(e)}catch(e){o.e(e)}finally{o.f()}}},{key:"fadeIn",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity+(new Date-o)/n,o=+new Date,+t.style.opacity<1&&(window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16))}var t=a.value,o=(t.style.opacity=0,t.style.display="block",+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}},{key:"fadeOut",value:function(n){var a,t=_createForOfIteratorHelper(this.elements);try{for(t.s();!(a=t.n()).done;)(()=>{function e(){t.style.opacity=+t.style.opacity-(new Date-o)/n,o=+new Date,0<+t.style.opacity?window.requestAnimationFrame&&requestAnimationFrame(e)||setTimeout(e,16):t.style.display="none"}var t=a.value,o=(t.style.opacity=1,+new Date);e()})()}catch(e){t.e(e)}finally{t.f()}}}]))());function selectActualNonce(){var e="";return ctPublicFunctions.hasOwnProperty("_fresh_nonce")&&"string"==typeof ctPublicFunctions._fresh_nonce&&0{function n(e){for(var t in _classCallCheck(this,n),_defineProperty(this,"xhr",new XMLHttpRequest),_defineProperty(this,"method","POST"),_defineProperty(this,"url",""),_defineProperty(this,"async",!0),_defineProperty(this,"user",null),_defineProperty(this,"password",null),_defineProperty(this,"data",{}),_defineProperty(this,"button",null),_defineProperty(this,"spinner",null),_defineProperty(this,"progressbar",null),_defineProperty(this,"context",this),_defineProperty(this,"callback",null),_defineProperty(this,"onErrorCallback",null),_defineProperty(this,"responseType","json"),_defineProperty(this,"headers",{}),_defineProperty(this,"timeout",15e3),_defineProperty(this,"methods_to_convert_data_to_URL",["GET","HEAD"]),_defineProperty(this,"body",null),_defineProperty(this,"http_code",0),_defineProperty(this,"status_text",""),e)void 0!==this[t]&&(this[t]=e[t]);if(this.prepare(),Object.keys(this.data).length&&(this.deleteDoubleJSONEncoding(this.data),this.convertData()),!this.url)return console.log("%cXHR%c not URL provided","color: red; font-weight: bold;","color: grey; font-weight: normal;"),!1;this.xhr.open(this.method,this.url,this.async,this.user,this.password),this.setHeaders(),this.xhr.responseType=this.responseType,this.xhr.timeout=this.timeout,this.xhr.onreadystatechange=function(){this.isWpNonceError()?this.getFreshNonceAndRerunXHR(e):this.onReadyStateChange()}.bind(this),this.xhr.onload=function(){this.onLoad()}.bind(this),this.xhr.onprogress=function(e){this.onProgress(e)}.bind(this),this.xhr.onerror=function(){this.onError()}.bind(this),this.xhr.ontimeout=function(){this.onTimeout()}.bind(this),this.xhr.send(this.body)}return _createClass(n,[{key:"prepare",value:function(){this.button&&(this.button.setAttribute("disabled","disabled"),this.button.style.cursor="not-allowed"),this.spinner&&(this.spinner.style.display="inline")}},{key:"complete",value:function(){this.http_code=this.xhr.status,this.status_text=this.xhr.statusText,this.button&&(this.button.removeAttribute("disabled"),this.button.style.cursor="auto"),this.spinner&&(this.spinner.style.display="none"),this.progressbar&&this.progressbar.fadeOut("slow")}},{key:"onReadyStateChange",value:function(){null!==this.on_ready_state_change&&"function"==typeof this.on_ready_state_change&&this.on_ready_state_change()}},{key:"onProgress",value:function(e){null!==this.on_progress&&"function"==typeof this.on_progress&&this.on_progress()}},{key:"onError",value:function(){console.log("error"),this.complete(),this.error(this.http_code,this.status_text),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback(this.status_text)}},{key:"onTimeout",value:function(){this.complete(),this.error(0,"timeout"),null!==this.onErrorCallback&&"function"==typeof this.onErrorCallback&&this.onErrorCallback("Timeout")}},{key:"onLoad",value:function(){if(this.complete(),"json"===this.responseType){if(null===this.xhr.response)return this.error(this.http_code,this.status_text,"No response"),!1;if(void 0!==this.xhr.response.error)return this.error(this.http_code,this.status_text,this.xhr.response.error),!1}null!==this.callback&&"function"==typeof this.callback&&this.callback.call(this.context,this.xhr.response,this.data)}},{key:"isWpNonceError",value:function(){var e=!1,t=!1;return 4==this.xhr.readyState&&(e="object"===_typeof(this.xhr.response)&&null!==this.xhr.response&&this.xhr.response.hasOwnProperty("data")&&this.xhr.response.data.hasOwnProperty("status")&&403===this.xhr.response.data.status,t="-1"===this.xhr.response&&403===this.xhr.status),e||t}},{key:"getFreshNonceAndRerunXHR",value:function(e){var t,o="";e.hasOwnProperty("headers")&&e.headers.hasOwnProperty("X-WP-Nonce")&&(o=e.headers["X-WP-Nonce"]),""!==(o=e.hasOwnProperty("data")&&e.data.hasOwnProperty("_ajax_nonce")?e.data._ajax_nonce:o)&&((t={method:"POST"}).data={spbc_remote_call_action:"get_fresh_wpnonce",plugin_name:"antispam",nonce_prev:o,initial_request_params:e},t.notJson=!0,t.url=ctPublicFunctions.host_url,t.callback=function(){for(var e=arguments.length,t=new Array(e),o=0;o{function n(){for(var e=arguments.length,t=new Array(e),o=0;o{function a(){for(var e=arguments.length,t=new Array(e),o=0;o{return _createClass(function e(){_classCallCheck(this,e),this.config=ApbctFetchProxyConfig},[{key:"findMatchingConfig",value:function(e){for(var t="string"==typeof e?e:null!=e&&"string"==typeof e.href?e.href:"",o=0,n=Object.entries(this.config);oMath.floor((new Date).getTime()/1e3)},isSet:function(e){return null!==localStorage.getItem(e)},delete:function(e){localStorage.removeItem(e)},getCleanTalkData:function(){for(var e={},t=0;t_createClass(function e(){_classCallCheck(this,e)},[{key:"attachEventTokenToMultipageGravityForms",value:function(){document.addEventListener("gform_page_loaded",function(){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||"function"!=typeof setEventTokenField||"function"!=typeof botDetectorLocalStorage||setEventTokenField(botDetectorLocalStorage.get("bot_detector_event_token"))})}},{key:"attachEventTokenToWoocommerceGetRequestAddToCart",value:function(){ctPublic.wc_ajax_add_to_cart||document.querySelectorAll("a.add_to_cart_button:not(.product_type_variable):not(.wc-interactive)").forEach(function(n){n.addEventListener("click",function(e){var t=n.getAttribute("href"),o=apbctLocalStorage.get("bot_detector_event_token");o&&(-1===t.indexOf("?")?t+="?":t+="&",n.setAttribute("href",t+="ct_bot_detector_event_token="+o))})})}},{key:"restartBotDetectorEventTokenAttach",value:function(){var e,t=0_createClass(function e(){_classCallCheck(this,e)},[{key:"attachHiddenFieldsToForms",value:function(e){void 0!==ctPublic.force_alt_cookies&&("undefined"===ctPublic.force_alt_cookies||ctPublic.force_alt_cookies)||+ctPublic.bot_detector_enabled&&!e||(ctNoCookieAttachHiddenFieldsToForms(),document.addEventListener("gform_page_loaded",ctNoCookieAttachHiddenFieldsToForms))}},{key:"attachVisibleFieldsToForm",value:function(e,t){var o=document.createElement("input"),t=(o.setAttribute("type","hidden"),o.setAttribute("id","apbct_visible_fields_"+t),o.setAttribute("name","apbct_visible_fields"),{});t[0]=this.collectVisibleFields(e),o.value=btoa(JSON.stringify(t)),e.append(o)}},{key:"attachVisibleFieldsDuringSubmit",value:function(e,t){"native"!==ctPublic.data__cookies_type&&void 0!==e.target.ctFormIndex&&this.setVisibleFieldsCookie(this.collectVisibleFields(t),e.target.ctFormIndex)}},{key:"constructNoCookieHiddenField",value:function(e){var t="hidden",e=("submit"===e&&(t="submit"),""),o=getCleanTalkStorageDataArray(),o=JSON.stringify(o);return o="_ct_no_cookie_data_"+btoa(o),(e=document.createElement("input")).setAttribute("name","ct_no_cookie_hidden_field"),e.setAttribute("value",o),e.setAttribute("type",t),e.classList.add("apbct_special_field"),e.classList.add("ct_no_cookie_hidden_field"),e}},{key:"attachNoCookieDuringSubmit",value:function(e){"none"===ctPublic.data__cookies_type&&e.target&&e.target.action&&-1!==e.target.action.toString().indexOf("mailpoet_subscription_form")&&(window.XMLHttpRequest.prototype.send=function(e){var t,o;+ctPublic.bot_detector_enabled?(t=(new ApbctHandler).toolGetEventToken())&&(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+("data%5Bct_bot_detector_event_token%5D="+t+"&")+e)):(o="data%5Bct_no_cookie_hidden_field%5D="+getNoCookieData()+"&",defaultSend.call(this,o+e)),setTimeout(function(){window.XMLHttpRequest.prototype.send=defaultSend},0)})}},{key:"setVisibleFieldsCookie",value:function(e,t){var o="object"===_typeof(e)&&null!==e?e:{};if("native"===ctPublic.data__cookies_type)for(var n in o){if(10{function i(){_classCallCheck(this,i)}return _createClass(i,[{key:"excludeForm",value:function(e){return!!this.checkHiddenFieldsExclusions(e,"visible_fields")||!!(e.querySelector('input[name="wspsc_add_cart_submit"]')||e.querySelector('input[name="option"][value="com_vikrentcar"]')||e.querySelector('input[name="option"][value="com_vikbooking"]'))||void 0!==e.elements.apbct_visible_fields&&0!(!t||"string"!=typeof t)&&["google.com/recaptcha","gstatic.com/recaptcha","recaptcha.google.com","recaptcha.net","www.google.com/recaptcha","apis.google.com","paypal.com","api.paypal.com","www.paypal.com","js.stripe.com","api.stripe.com","checkout.stripe.com","api.doboard.com"].some(function(e){return t.includes(e)}))("string"==typeof o[0]?o[0]:(null==(a=o[0])?void 0:a.url)||""))return e.a(2,k.apply(this,o));e.n=2;break;case 2:if(g=!1,o&&o[0]&&o[1]&&o[1].body){e.n=3;break}return e.a(2,k.apply(this,o));case 3:return e.n=4,y.processFetch(o);case 4:if(!0===e.v)return e.a(2,Promise.reject(new Error("Forbidden")));e.n=5;break;case 5:if(0{try{return o[0].includes(new URL(ctPublicFunctions._rest_url).pathname+"metform/")}catch(e){}})()))try{o[1].body=h(o[1].body,b(+ctPublic.bot_detector_enabled))}catch(e){}if(0{var t=e.value;"undefined"!=typeof ctPublic&&1==+ctPublic.settings__forms__search_test&&null!==t.getAttribute("apbct-form-sign")&&"native_search"===t.getAttribute("apbct-form-sign")&&(t.apbctSearchPrevOnsubmit=t.onsubmit,t.onsubmit=function(e){return o.searchFormHandler(e,t)})})()}catch(e){t.e(e)}finally{t.f()}}},{key:"searchFormHandler",value:function(e,t){try{var o,n,a,c=t.querySelector('[name*="apbct_email_id__"]'),i=null,r=(null!==c&&null!==c.value&&(i=c.value),getCleanTalkStorageDataArray()),l=apbctLocalStorage.get("bot_detector_event_token");null===r&&null===c&&null===l||(e.preventDefault(),o=function(){null!==c&&c.parentNode.removeChild(c),"function"==typeof t.apbctSearchPrevOnsubmit?t.apbctSearchPrevOnsubmit():HTMLFormElement.prototype.submit.call(t)},n=r,null!==i&&(n.apbct_search_form__honeypot_value=i),n.ct_bot_detector_event_token=l,"string"==typeof n.apbct_pixel_url&&-1!==n.apbct_pixel_url.indexOf("%3A")&&(n.apbct_pixel_url=decodeURIComponent(n.apbct_pixel_url)),void 0!==(a=JSON.stringify(n))&&0!==a.length?ctSetAlternativeCookie(a,{callback:o,onErrorCallback:o,forceAltCookies:!0}):o())}catch(e){console.warn("APBCT search form onsubmit handler error. "+e)}}},{key:"toolForAntiCrawlerCheckDuringBotDetector",value:function(){var e=setInterval(function(){localStorage.bot_detector_event_token&&(ctSetCookie("apbct_bot_detector_exist","1","3600"),clearInterval(e))},500)}},{key:"toolGetEventToken",value:function(){var t=localStorage.getItem("bot_detector_event_token");try{t=JSON.parse(t)}catch(e){t=!1}return!(null===t||!1===t||!t.hasOwnProperty("value")||""===t.value)&&t.value}}])})(),ApbctShowForbidden=(()=>_createClass(function e(){_classCallCheck(this,e)},[{key:"prepareBlockForAjaxForms",value:function(){var n=function(e){if(e.responseText&&-1!==e.responseText.indexOf('"apbct')&&-1===e.responseText.indexOf("DOCTYPE"))try{this.parseBlockMessage(JSON.parse(e.responseText))}catch(e){console.log(e.toString())}}.bind(this);"undefined"!=typeof jQuery?"function"!=typeof jQuery(document).ajaxComplete()?jQuery(document).on("ajaxComplete",function(e,t,o){n(t)}):jQuery(document).ajaxComplete(function(e,t,o){n(t)}):"undefined"!=typeof XMLHttpRequest&&document.addEventListener("readystatechange",function(e){4===e.target.readyState&&n(e.target)})}},{key:"parseBlockMessage",value:function(e){var t,o="";if((void 0!==e.apbct&&(e=e.apbct).blocked&&(o=e.comment),o=void 0!==e.data&&void 0!==(e=e.data).message?e.message:o)&&(document.dispatchEvent(new CustomEvent("apbctAjaxBockAlert",{bubbles:!0,detail:{message:o}})),cleantalkModal.loaded=o,cleantalkModal.open(),1==+e.stop_script&&(window.stop(),e.integration&&"NEXForms"===e.integration&&((t=document.querySelector("form.submit-nex-form button.nex-submit"))&&(t.disabled=!0,t.style.opacity="0.5",t.style.cursor="not-allowed",t.style.pointerEvents="none",t.style.backgroundColor="#ccc",t.style.color="#fff"),t=document.querySelector("div.nex_success_message"))&&(t.style.display="none"),e.integration)&&"ElfsightForm"===e.integration)){var n=[document];try{document.querySelectorAll("iframe").forEach(function(e){try{e.contentDocument&&n.push(e.contentDocument)}catch(e){}})}catch(e){}for(var a=0,c=n;a_createClass(function e(){_classCallCheck(this,e)},[{key:"extract",value:function(e){if(e&&"string"==typeof e){try{e=decodeURIComponent(e)}catch(e){return!1}var t=document.querySelectorAll("form"),o=this.getIdFromAjax(e);if(o){var n,a=_createForOfIteratorHelper(t);try{for(a.s();!(n=a.n()).done;){var c=n.value,i=this.findParentContainer(c);if(i){var r=this.getIdFromHTML(i);if(r===o){var l=i.querySelector("input[id^=apbct_visible_fields_]");if(null!=l&&l.value)return l.value}}}}catch(e){a.e(e)}finally{a.f()}}}return!1}},{key:"getIdFromAjax",value:function(e){return console.warn("getIdFromAjax must be implemented by child class"),null}},{key:"findParentContainer",value:function(e){return console.warn("findParentContainer must be implemented by child class"),null}},{key:"getIdFromHTML",value:function(e){return console.warn("getIdFromHTML must be implemented by child class"),null}}],[{key:"createExtractor",value:function(e){switch(e){case"action=nf_ajax_submit":return new ApbctNinjaFormsVisibleFields;case"action=mailpoet":return new ApbctMailpoetVisibleFields;default:return null}}}]))(),ApbctNinjaFormsVisibleFields=(()=>{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/"id"\s*:\s*"?(\d+)"/,/form_id\s*[:\s]*"?(\d+)"/,/nf-form-(\d+)/,/"id":(\d+)/];t{function e(){return _classCallCheck(this,e),_callSuper(this,e,arguments)}return _inherits(e,ApbctVisibleFieldsExtractor),_createClass(e,[{key:"getIdFromAjax",value:function(e){for(var t=0,o=[/form_id\s*[:\s]*"?(\d+)"/,/data\[form_id\]=(\d+)/,/form_id=(\d+)/];t_createClass(function e(){_classCallCheck(this,e)},[{key:"setSessionId",value:function(){var e;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(e=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",e,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}},{key:"writeReferrersToSessionStorage",value:function(){var e=apbctSessionStorage.get("apbct_session_current_page");!1!==e&&document.location.href!==e&&apbctSessionStorage.set("apbct_prev_referer",e,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}},{key:"setCookiesType",value:function(){var e=apbctLocalStorage.get("ct_cookies_type");e&&e===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}},{key:"startFieldsListening",value:function(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"elementBody",document.querySelector("body")),_defineProperty(this,"collectionForms",document.forms),this.setListeners()},[{key:"setListeners",value:function(){var t=this;this.elementBody.addEventListener("click",function(e){t.checkElementInForms(e,"addClicks")}),this.elementBody.addEventListener("mouseup",function(e){"Range"==document.getSelection().type.toString()&&t.addSelected()}),this.elementBody.addEventListener("mousemove",function(e){t.checkElementInForms(e,"trackMouseMovement")})}},{key:"checkElementInForms",value:function(e,t){for(var o,n=0;n_createClass(function e(){_classCallCheck(this,e),_defineProperty(this,"fieldData",{isAutoFill:!1,isUseBuffer:!1,speedDelta:0,firstKeyTimestamp:0,lastKeyTimestamp:0,lastDelta:0,countOfKey:0}),_defineProperty(this,"fields",document.querySelectorAll("textarea[name=comment]")),_defineProperty(this,"data",[])},[{key:"gatheringFields",value:function(){var o=this;Array.prototype.slice.call(this.fields).forEach(function(e,t){o.data.push(Object.assign({},o.fieldData))})}},{key:"setListeners",value:function(){var n=this;this.fields.forEach(function(e,t){e.addEventListener("paste",function(){n.data[t].isUseBuffer=!0})}),this.fields.forEach(function(e,t){e.addEventListener("onautocomplete",function(){n.data[t].isAutoFill=!0})}),this.fields.forEach(function(e,o){e.addEventListener("input",function(){n.data[o].countOfKey++;var e,t=+new Date;1===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].firstKeyTimestamp=t):(e=t-n.data[o].lastKeyTimestamp,2===n.data[o].countOfKey?(n.data[o].lastKeyTimestamp=t,n.data[o].lastDelta=e):2 .comment-body *[class*="comment-author"]',document.querySelector(".apbct-trp .comment-author .comment-author-link")&&(e='.apbct-trp *[class*="comment-author-link"]'),0!==(e=document.querySelectorAll(e+',.apbct-trp > .wp-block-group *[class*="comment-author"],.apbct-trp *[class*="review__author"],.apbct-trp td[class*="column-author"] > strong')).length)&&(e.forEach(function(e,t){var o,n,a,c,i,r,l,s,u;e.className.indexOf("review")<0&&"undefined"==typeof pagenow&&e.parentElement.className.indexOf("group")<0&&"DIV"!=e.tagName||e.querySelector(".comment-metadata")||((o=document.createElement("div")).setAttribute("class","apbct-real-user-badge"),(n=document.createElement("img")).setAttribute("src",d.imgPersonUrl),n.setAttribute("class","apbct-real-user-popup-img"),(a=document.createElement("div")).setAttribute("class","apbct-real-user-popup"),(r=document.createElement("strong")).append(d.phrases.trpHeading),(c=document.createElement("div")).setAttribute("class","apbct-real-user-popup-content_row"),c.setAttribute("style","white-space: nowrap"),(i=document.createElement("div")).append(r),i.append(" "),i.append(d.phrases.trpContent1),(r=document.createElement("div")).style.display="flex",r.style.gap="5px",(l=document.createElement("div")).append(d.phrases.trpContent2),r.append(l),p&&(l=document.createElement("div"),(s=document.createElement("a")).setAttribute("href",d.trpContentLink),s.setAttribute("target","_blank"),(u=document.createElement("img")).setAttribute("src",ctAdminCommon.new_window_gif),u.setAttribute("alt","New window"),u.setAttribute("style","padding-top:3px"),s.append(u),l.append(s),r.append(l)),c.append(i,r),a.append(c),o.append(n),e.append(o),e.append(a))}),document.querySelectorAll(".apbct-real-user-badge").forEach(function(n){var a=void 0,e=(t.body.addEventListener("click",function(e){-1==e.target.className.indexOf("apbct-real-user")&&-1==e.target.parentElement.className.indexOf("apbct-real-user")&&closeAllPopupTRP()}),n.addEventListener("click",function(){var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.toggle("visible")}),n.addEventListener("mouseenter",function(){closeAllPopupTRP();var e=this.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.add("visible")}),n.addEventListener("mouseleave",function(){var t=this;a=setTimeout(function(){var e=t.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.nextElementSibling);e.addEventListener("mouseenter",function(){clearTimeout(a),e.classList.add("visible")}),e.addEventListener("mouseleave",function(){a=setTimeout(function(){e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},1e3)}),n.addEventListener("touchend",function(){var o=this;a=setTimeout(function(){var e=o.nextElementSibling,t=window.getSelection();e&&t&&e.classList.contains("apbct-real-user-popup")&&0===t.toString().length?e.classList.remove("visible"):(clearTimeout(a),document.addEventListener("selectionchange",function e(){var t=window.getSelection();t&&0===t.toString().length&&(a=setTimeout(function(){var e=n.nextElementSibling;e&&e.classList.contains("apbct-real-user-popup")&&e.classList.remove("visible")},3e3),document.removeEventListener("selectionchange",e))}))},3e3)})}))}); \ No newline at end of file diff --git a/js/cleantalk-admin-settings-page.min.js b/js/cleantalk-admin-settings-page.min.js index c6f8fd3f7..caef8c6ca 100644 --- a/js/cleantalk-admin-settings-page.min.js +++ b/js/cleantalk-admin-settings-page.min.js @@ -1,2 +1,2 @@ -function handleAnchorDetection(t){"none"===document.querySelector("#apbct_settings__advanced_settings").style.display&&apbctExceptedShowHide("apbct_settings__advanced_settings"),scrollToAnchor("#"+t)}function scrollToAnchor(t){t=document.querySelector(t);t&&t.scrollIntoView({block:"end"})}function apbctManageEmailEncoderCustomTextField(){var t=document.querySelector("#apbct_setting_data__email_decoder_obfuscation_custom_text");let e;null!==t&&(e=void 0!==t.parentElement?t.parentElement:null),document.querySelectorAll(".apbct_setting---data__email_decoder_obfuscation_mode").forEach(t=>{e&&t.checked&&"replace"!==t.value&&e.classList.add("hidden"),t.addEventListener("click",t=>{void 0!==e&&("replace"===t.target.value?e.classList.remove("hidden"):e.classList.add("hidden"))})})}function apbctBannerCheck(){let c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbctGetElems(a){for(let t=0,e=(a=a.split(",")).length,n;t{document.getElementById(t)&&"none"!==document.getElementById(t).style.display&&apbctShowHideElem(t)})}function apbctShowRequiredGroups(t,e){var n=document.getElementById("apbct_settings__dwpms_settings");n&&"none"===n.style.display&&((n=t).preventDefault(),apbctShowHideElem("apbct_settings__dwpms_settings"),document.getElementById(e).dispatchEvent(new n.constructor(n.type,n)))}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbctGetElemsNative(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependenciesGetState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependenciesGetState(t){let e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbctSettingsShowDescription(t,e){function c(t){var e=0!=jQuery(t.target).parent(".apbct_long_desc").length,t=jQuery(t.target).hasClass("apbct_long_desc__cancel");(0
");var n=jQuery("#apbct_long_desc__"+e);n.append("").append("
").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){t&&t.title&&t.desc&&(a.empty().append("
").append("").append("

"+t.title+"

").append("

"+t.desc+"

"),jQuery(document).on("click",c))}},n)}function apbctNavigationMenuPosition(){var t,e,n=document.querySelector("#apbct_hidden_section_nav ul"),a=document.querySelector("#apbct_settings__button_section");n&&a&&(t=window.scrollY,e=window.innerWidth,1e3"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");let n={};if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var a=e.val();if(""===a)return void e.css("border-color","red");n={template_name:a}}else n={template_id:t.data("id")};let c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){let c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&(ctSettingsPage.key_changed?(jQuery(".key_changed_sync").hide(300),jQuery(".key_changed_success").show(300),setTimeout(function(){document.location.reload()},3e3)):document.location.reload())}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbctSettingsShowDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbctBannerCheck(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbctSaveButtonPosition();let e;window.addEventListener("scroll",function(){clearTimeout(e),e=setTimeout(function(){apbctSaveButtonPosition()},50),apbctNavigationMenuPosition()}),jQuery("#ct_adv_showhide a").on("click",apbctSaveButtonPosition),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val(),e=(jQuery("#apbct_settings__key_line__save_settings").off("click"),""!==t&&null===t.match(/^[a-z\d]{8,30}\s*$/));jQuery("#apbct_settings__key_is_bad").hide(),jQuery("#apbct_showApiKey").hide(),jQuery("#apbct_settings__account_name_ob").hide(),jQuery("#apbct_settings__no_agreement_notice").hide(),""===t?(jQuery("#apbct_button__key_line__save_changes_wrapper").hide(),jQuery("#apbct_button__get_key_auto__wrapper").show(),jQuery("#apbct_button__get_key_manual_chunk").show()):(jQuery("#apbct_button__key_line__save_changes_wrapper").show(),jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery("#apbct_button__get_key_manual_chunk").hide(),e&&jQuery("#apbct_settings__key_line__save_settings").on("click",function(t){t.preventDefault(),jQuery("#apbct_settings__key_is_bad").show(),apbctHighlightElement("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||ctSettingsPage.ip_license||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("

Synchronization process failed. Please, check the acces key and restart the synch.

").insertAfter(jQuery("#apbct_button__sync")),apbctHighlightElement("apbct_setting_apikey",3),apbctHighlightElement("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()}),jQuery("#apbct-custom-logo-open-gallery").click(function(t){t.preventDefault();let e=jQuery(this),n=wp.media({library:{type:"image"},multiple:!1});n.on("select",function(){var t=n.state().get("selection").first().toJSON();e.parent().prev().attr("src",t.url),jQuery("#cleantalk_custom_logo").val(t.id)}),n.open()}),jQuery("#apbct-custom-logo-remove-image").click(function(t){t.preventDefault(),!0===confirm("Sure?")&&(t=jQuery(this).parent().prev().data("src"),jQuery(this).parent().prev().attr("src",t),jQuery(this).prev().prev().val(""))}),jQuery('button[id*="apbct-action-adjust-change-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_change"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-change-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),jQuery('button[id*="apbct-action-adjust-reverse-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_reverse"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-reverse-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),document.querySelector(".apbct_hidden_section_nav_mob_btn").addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="block",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="none"}),document.querySelector(".apbct_hidden_section_nav_mob_btn-close").addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="none",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="block"}),apbctManageEmailEncoderCustomTextField(),window.location.hash&&handleAnchorDetection(window.location.hash.substring(1))}); +function handleAnchorDetection(t){"none"===document.querySelector("#apbct_settings__advanced_settings").style.display&&apbctExceptedShowHide("apbct_settings__advanced_settings"),scrollToAnchor("#"+t)}function scrollToAnchor(t){t=document.querySelector(t);t&&t.scrollIntoView({block:"end"})}function apbctManageEmailEncoderCustomTextField(){var t=document.querySelector("#apbct_setting_data__email_decoder_obfuscation_custom_text");let e;null!==t&&(e=void 0!==t.parentElement?t.parentElement:null),document.querySelectorAll(".apbct_setting---data__email_decoder_obfuscation_mode").forEach(t=>{e&&t.checked&&"replace"!==t.value&&e.classList.add("hidden"),t.addEventListener("click",t=>{void 0!==e&&("replace"===t.target.value?e.classList.remove("hidden"):e.classList.add("hidden"))})})}function apbctBannerCheck(){let c=setInterval(function(){apbct_admin_sendAJAX({action:"apbct_settings__check_renew_banner"},{callback:function(t,e,n,a){t.close_renew_banner&&(jQuery("#cleantalk_notice_renew").length&&jQuery("#cleantalk_notice_renew").hide("slow"),jQuery("#cleantalk_notice_trial").length&&jQuery("#cleantalk_notice_trial").hide("slow"),clearInterval(c))}})},9e5)}function apbctGetElems(a){for(let t=0,e=(a=a.split(",")).length,n;t{document.getElementById(t)&&"none"!==document.getElementById(t).style.display&&apbctShowHideElem(t)})}function apbctShowRequiredGroups(t,e){var n=document.getElementById("apbct_settings__dwpms_settings");n&&"none"===n.style.display&&((n=t).preventDefault(),apbctShowHideElem("apbct_settings__dwpms_settings"),document.getElementById(e).dispatchEvent(new n.constructor(n.type,n)))}function apbctSettingsDependencies(t,c){c=isNaN(c)?null:c,apbctGetElemsNative(t).forEach(function(t,e,n){var a;1===(c=null===c?null===t.getAttribute("disabled")?0:1:c)?t.removeAttribute("disabled"):t.setAttribute("disabled","disabled"),null!==t.getAttribute("apbct_children")&&null!==(a=apbctSettingsDependenciesGetState(t)&&c)&&apbctSettingsDependencies(t.getAttribute("apbct_children"),a)})}function apbctSettingsDependenciesGetState(t){let e;switch(t.getAttribute("type")){case"checkbox":e=+t.checked;break;case"radio":e=+(1==+t.getAttribute("value"));break;default:e=null}return e}function apbctSettingsShowDescription(t,e){function c(t){var e=0!=jQuery(t.target).parent(".apbct_long_desc").length,t=jQuery(t.target).hasClass("apbct_long_desc__cancel");(0
");var n=jQuery("#apbct_long_desc__"+e);n.append("").append("
").css({top:t.position().top-5,left:t.position().left+25}),apbct_admin_sendAJAX({action:"apbct_settings__get__long_description",setting_id:e},{spinner:n.children("img"),callback:function(t,e,n,a){t&&t.title&&t.desc&&(a.empty().append("
").append("").append("

"+t.title+"

").append("

"+t.desc+"

"),jQuery(document).on("click",c))}},n)}function apbctNavigationMenuPosition(){var t,e,n=document.querySelector("#apbct_hidden_section_nav ul"),a=document.querySelector("#apbct_settings__button_section");n&&a&&(t=window.scrollY,e=window.innerWidth,1e3"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_import_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_import_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_export_button",function(){jQuery("#apbct-ajax-result").remove();var t=jQuery("option:selected",jQuery("#apbct_settings_templates_export")),e=jQuery("#apbct_settings_templates_export_name");let n={};if(e.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{if("new_template"===t.data("id")){var a=e.val();if(""===a)return void e.css("border-color","red");n={template_name:a}}else n={template_id:t.data("id")};let c=this;apbct_admin_sendAJAX({action:"settings_templates_export",data:n},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_export_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_export_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_export_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}}),jQuery(document).on("click","#apbct_settings_templates_reset_button",function(){let c=this;apbct_admin_sendAJAX({action:"settings_templates_reset"},{timeout:25e3,button:c,spinner:jQuery("#apbct_settings_templates_reset_button .apbct_preloader_button"),notJson:!0,callback:function(t,e,n,a){t.success?(jQuery("

"+t.data+"

").insertAfter(jQuery(c)),jQuery("#apbct_settings_templates_reset_button .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_settings_templates_reset_button .apbct_success").hide(300)},2e3),document.addEventListener("cleantalkModalClosed",function(t){document.location.reload()}),setTimeout(function(){cleantalkModal.close()},2e3)):jQuery("

"+t.data+"

").insertAfter(jQuery(c))}})}),jQuery("#apbct_button__sync").on("click",function(){apbct_admin_sendAJAX({action:"apbct_sync"},{timeout:25e3,button:document.getElementById("apbct_button__sync"),spinner:jQuery("#apbct_button__sync .apbct_preloader_button"),callback:function(t,e,n,a){jQuery("#apbct_button__sync .apbct_success").show(300),setTimeout(function(){jQuery("#apbct_button__sync .apbct_success").hide(300)},2e3),t.reload&&(ctSettingsPage.key_changed?(jQuery(".key_changed_sync").hide(300),jQuery(".key_changed_success").show(300),setTimeout(function(){document.location.reload()},3e3)):document.location.reload())}})}),ctSettingsPage.key_changed&&jQuery("#apbct_button__sync").click(),jQuery(document).on("click",".apbct_settings-long_description---show",function(){apbctSettingsShowDescription(self=jQuery(this),self.attr("setting"))}),(jQuery("#cleantalk_notice_renew").length||jQuery("#cleantalk_notice_trial").length)&&apbctBannerCheck(),jQuery(document).on("change","#apbct_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").show():jQuery(this).parent().parent().find("#apbct_settings_templates_export_name").hide()}),apbctSaveButtonPosition();let e;window.addEventListener("scroll",function(){clearTimeout(e),e=setTimeout(function(){apbctSaveButtonPosition()},50),apbctNavigationMenuPosition()}),jQuery("#ct_adv_showhide a").on("click",apbctSaveButtonPosition),jQuery("#apbct-change-account-email").on("click",function(t){t.preventDefault();var t=jQuery(this),e=jQuery("#apbct-account-email"),n=e.text();t.toggleClass("active"),t.hasClass("active")?(t.text(t.data("save-text")),e.attr("contenteditable","true"),e.on("keydown",function(t){"Enter"===t.code&&t.preventDefault()}),e.on("input",function(t){"insertParagraph"===t.inputType&&t.preventDefault()})):(apbct_admin_sendAJAX({action:"apbct_update_account_email",accountEmail:n},{timeout:5e3,callback:function(t,e,n,a){void 0!==t.success&&"ok"===t.success&&void 0!==t.manuallyLink&&jQuery("#apbct-key-manually-link").attr("href",t.manuallyLink),void 0!==t.error&&jQuery("#apbct-account-email").css("border-color","red")}}),e.attr("contenteditable","false"),t.text(t.data("default-text")))}),jQuery("#apbct_setting_apikey").on("input",function(){var t=jQuery(this).val(),e=(jQuery("#apbct_settings__key_line__save_settings").off("click"),""!==t&&null===t.match(/^[a-z\d]{8,30}\s*$/));jQuery("#apbct_settings__key_is_bad").hide(),jQuery("#apbct_showApiKey").hide(),jQuery("#apbct_settings__account_name_ob").hide(),jQuery("#apbct_settings__no_agreement_notice").hide(),""===t?(jQuery("#apbct_button__key_line__save_changes_wrapper").hide(),jQuery("#apbct_button__get_key_auto__wrapper").show(),jQuery("#apbct_button__get_key_manual_chunk").show()):(jQuery("#apbct_button__key_line__save_changes_wrapper").show(),jQuery("#apbct_button__get_key_auto__wrapper").hide(),jQuery("#apbct_button__get_key_manual_chunk").hide(),e&&jQuery("#apbct_settings__key_line__save_settings").on("click",function(t){t.preventDefault(),jQuery("#apbct_settings__key_is_bad").show(),apbctHighlightElement("apbct_setting_apikey",3)}))}),jQuery("#apbct_setting_apikey").val()&&ctSettingsPage.key_is_ok&&jQuery("#apbct_button__get_key_auto__wrapper").hide(),ctSettingsPage.key_is_ok||ctSettingsPage.ip_license||jQuery('button.cleantalk_link[value="save_changes"]').on("click",function(t){t.preventDefault(),jQuery("#sync_required_notice").length||jQuery("

Synchronization process failed. Please, check the acces key and restart the synch.

").insertAfter(jQuery("#apbct_button__sync")),apbctHighlightElement("apbct_setting_apikey",3),apbctHighlightElement("apbct_button__sync",3),jQuery("#apbct_button__get_key_auto__wrapper").show()}),jQuery("#apbct-custom-logo-open-gallery").click(function(t){t.preventDefault();let e=jQuery(this),n=wp.media({library:{type:"image"},multiple:!1});n.on("select",function(){var t=n.state().get("selection").first().toJSON();e.parent().prev().attr("src",t.url),jQuery("#cleantalk_custom_logo").val(t.id)}),n.open()}),jQuery("#apbct-custom-logo-remove-image").click(function(t){t.preventDefault(),!0===confirm("Sure?")&&(t=jQuery(this).parent().prev().data("src"),jQuery(this).parent().prev().attr("src",t),jQuery(this).prev().prev().val(""))}),jQuery('button[id*="apbct-action-adjust-change-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_change"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-change-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),jQuery('button[id*="apbct-action-adjust-reverse-"]').click(function(t){t.preventDefault();var t={action:"apbct_action_adjust_reverse"},e=(t.adjust=jQuery(this).data("adjust"),{});e.button=document.getElementById("apbct-action-adjust-reverse-"+t.adjust),e.notJson=!0,e.callback=function(){document.location.reload()},apbct_admin_sendAJAX(t,e)}),document.querySelector(".apbct_hidden_section_nav_mob_btn")?.addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="block",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="none"}),document.querySelector(".apbct_hidden_section_nav_mob_btn-close")?.addEventListener("click",()=>{document.querySelector("#apbct_hidden_section_nav ul").style.display="none",document.querySelector(".apbct_hidden_section_nav_mob_btn").style.display="block"}),apbctManageEmailEncoderCustomTextField(),window.location.hash&&handleAnchorDetection(window.location.hash.substring(1))}); //# sourceMappingURL=cleantalk-admin-settings-page.min.js.map diff --git a/js/cleantalk-admin-settings-page.min.js.map b/js/cleantalk-admin-settings-page.min.js.map index 53d92b133..74ae7dddd 100644 --- a/js/cleantalk-admin-settings-page.min.js.map +++ b/js/cleantalk-admin-settings-page.min.js.map @@ -1 +1 @@ -{"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function() {\n // Crunch for Right to Left direction languages\n if (document.getElementsByClassName('apbct_settings-title')[0]) {\n if (getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl') {\n jQuery('.apbct_switchers').css('text-align', 'right');\n }\n }\n\n // Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(e) {\n e.preventDefault();\n jQuery(this).hide();\n jQuery('.apbct_settings-field--api_key').val(jQuery('.apbct_settings-field--api_key').attr('key'));\n jQuery('.apbct_settings-field--api_key+div').css('display', 'inline');\n });\n\n let d = new Date();\n let timezone = d.getTimezoneOffset()/60*(-1);\n jQuery('#ct_admin_timezone').val(timezone);\n\n // Key KEY automatically\n jQuery('#apbct_button__get_key_auto').on('click', function() {\n if (!jQuery('#apbct_license_agreed').is(':checked')) {\n jQuery('#apbct_settings__no_agreement_notice').show();\n apbctHighlightElement('apbct_license_agreed', 3);\n return;\n }\n apbct_admin_sendAJAX(\n {action: 'apbct_get_key_auto', ct_admin_timezone: timezone},\n {\n timeout: 25000,\n button: document.getElementById('apbct_button__get_key_auto' ),\n spinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n callback: function(result, data, params, obj) {\n jQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);\n }, 2000);\n if (result.reload) {\n document.location.reload();\n }\n if (result.getTemplates) {\n cleantalkModal.loaded = result.getTemplates;\n cleantalkModal.open();\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n }\n },\n },\n );\n });\n\n // Import settings\n jQuery( document ).on('click', '#apbct_settings_templates_import_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n let templateNameInput = jQuery('#apbct_settings_templates_import_name');\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n let data = {\n 'template_id': optionSelected.data('id'),\n 'template_name': optionSelected.data('name'),\n 'settings': optionSelected.data('settings'),\n };\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_import', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Export settings\n jQuery( document ).on('click', '#apbct_settings_templates_export_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n let templateNameInput = jQuery('#apbct_settings_templates_export_name');\n let data = {};\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n if ( optionSelected.data('id') === 'new_template' ) {\n let templateName = templateNameInput.val();\n if ( templateName === '' ) {\n templateNameInput.css('border-color', 'red');\n return;\n }\n data = {\n 'template_name': templateName,\n };\n } else {\n data = {\n 'template_id': optionSelected.data('id'),\n };\n }\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_export', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Reset settings\n jQuery( document ).on('click', '#apbct_settings_templates_reset_button', function() {\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_reset'},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Sync button\n jQuery('#apbct_button__sync').on('click', function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_sync'},\n {\n timeout: 25000,\n button: document.getElementById('apbct_button__sync' ),\n spinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n callback: function(result, data, params, obj) {\n jQuery('#apbct_button__sync .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_button__sync .apbct_success').hide(300);\n }, 2000);\n if (result.reload) {\n if ( ctSettingsPage.key_changed ) {\n jQuery('.key_changed_sync').hide(300);\n jQuery('.key_changed_success').show(300);\n setTimeout(function() {\n document.location.reload();\n }, 3000);\n } else {\n document.location.reload();\n }\n }\n },\n },\n );\n });\n\n if ( ctSettingsPage.key_changed ) {\n jQuery('#apbct_button__sync').click();\n }\n\n jQuery(document).on('click', '.apbct_settings-long_description---show', function() {\n self = jQuery(this);\n apbctSettingsShowDescription(self, self.attr('setting'));\n });\n\n if (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length) {\n apbctBannerCheck();\n }\n\n jQuery(document).on('change', '#apbct_settings_templates_export', function() {\n let optionSelected = jQuery('option:selected', this);\n if ( optionSelected.data('id') === 'new_template' ) {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n } else {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n }\n });\n\n apbctSaveButtonPosition();\n let debounceTimer;\n window.addEventListener('scroll', function() {\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(function() {\n apbctSaveButtonPosition();\n }, 50);\n apbctNavigationMenuPosition();\n });\n jQuery('#ct_adv_showhide a').on('click', apbctSaveButtonPosition);\n\n\n /**\n * Change cleantalk account email\n */\n jQuery('#apbct-change-account-email').on('click', function(e) {\n e.preventDefault();\n\n let $this = jQuery(this);\n let accountEmailField = jQuery('#apbct-account-email');\n let accountEmail = accountEmailField.text();\n\n $this.toggleClass('active');\n\n if ($this.hasClass('active')) {\n $this.text($this.data('save-text'));\n accountEmailField.attr('contenteditable', 'true');\n accountEmailField.on('keydown', function(e) {\n if (e.code === 'Enter') {\n e.preventDefault();\n }\n });\n accountEmailField.on('input', function(e) {\n if (e.inputType === 'insertParagraph') {\n e.preventDefault();\n }\n });\n } else {\n apbct_admin_sendAJAX(\n {\n action: 'apbct_update_account_email',\n accountEmail: accountEmail,\n },\n {\n timeout: 5000,\n callback: function(result, data, params, obj) {\n if (result.success !== undefined && result.success === 'ok') {\n if (result.manuallyLink !== undefined) {\n jQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n }\n }\n\n if (result.error !== undefined) {\n jQuery('#apbct-account-email').css('border-color', 'red');\n }\n },\n },\n );\n\n accountEmailField.attr('contenteditable', 'false');\n $this.text($this.data('default-text'));\n }\n });\n\n /**\n * Validate apkikey and hide get auto btn\n */\n jQuery('#apbct_setting_apikey').on('input', function() {\n let enteredValue = jQuery(this).val();\n jQuery('#apbct_settings__key_line__save_settings').off('click');\n let keyBad = enteredValue !== '' && enteredValue.match(/^[a-z\\d]{8,30}\\s*$/) === null;\n jQuery('#apbct_settings__key_is_bad').hide();\n jQuery('#apbct_showApiKey').hide();\n jQuery('#apbct_settings__account_name_ob').hide();\n jQuery('#apbct_settings__no_agreement_notice').hide();\n if (enteredValue === '') {\n jQuery('#apbct_button__key_line__save_changes_wrapper').hide();\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n jQuery('#apbct_button__get_key_manual_chunk').show();\n } else {\n jQuery('#apbct_button__key_line__save_changes_wrapper').show();\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n jQuery('#apbct_button__get_key_manual_chunk').hide();\n if (keyBad) {\n jQuery('#apbct_settings__key_line__save_settings').on('click',\n function(e) {\n e.preventDefault();\n jQuery('#apbct_settings__key_is_bad').show();\n apbctHighlightElement('apbct_setting_apikey', 3);\n },\n );\n }\n }\n });\n\n if ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n }\n\n /**\n * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n */\n if ( !ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license ) {\n jQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n function(e) {\n e.preventDefault();\n if (!jQuery('#sync_required_notice').length) {\n jQuery( '

' +\n 'Synchronization process failed. Please, check the acces key and restart the synch.' +\n '

' ).insertAfter( jQuery('#apbct_button__sync') );\n }\n apbctHighlightElement('apbct_setting_apikey', 3);\n apbctHighlightElement('apbct_button__sync', 3);\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n },\n );\n }\n\n /**\n * Open WP gallery for adding custom logo\n */\n jQuery('#apbct-custom-logo-open-gallery').click(function(e) {\n e.preventDefault();\n\n const button = jQuery(this);\n\n const customUploader = wp.media({\n library: {\n type: 'image',\n },\n multiple: false,\n });\n\n customUploader.on('select', function() {\n const image = customUploader.state().get('selection').first().toJSON();\n\n button.parent().prev().attr( 'src', image.url );\n jQuery('#cleantalk_custom_logo').val( image.id );\n });\n\n customUploader.open();\n });\n\n /**\n * Remove selected logo\n */\n jQuery('#apbct-custom-logo-remove-image').click(function(e) {\n e.preventDefault();\n\n if ( true === confirm( 'Sure?' ) ) {\n const src = jQuery(this).parent().prev().data('src');\n jQuery(this).parent().prev().attr('src', src);\n jQuery(this).prev().prev().val('');\n }\n });\n\n jQuery('button[id*=\"apbct-action-adjust-change-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_change';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-change-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n jQuery('button[id*=\"apbct-action-adjust-reverse-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_reverse';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-reverse-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn').addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'block';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'none';\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn-close').addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'none';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'block';\n });\n\n // Hide/show EmailEncoder replacing text textarea\n apbctManageEmailEncoderCustomTextField();\n\n if (window.location.hash) {\n const anchor = window.location.hash.substring(1);\n handleAnchorDetection(anchor);\n }\n});\n\n/**\n * Detect ancors and open advanced settings before scroll\n * @param {string} anchor\n */\nfunction handleAnchorDetection(anchor) {\n let advSettings = document.querySelector('#apbct_settings__advanced_settings');\n if ( 'none' === advSettings.style.display ) {\n apbctExceptedShowHide('apbct_settings__advanced_settings');\n }\n scrollToAnchor('#' + anchor);\n}\n\n/**\n * Scroll to the target element ID\n * @param {string} anchorId Anchor target element ID\n */\nfunction scrollToAnchor(anchorId) {\n const targetElement = document.querySelector(anchorId);\n if (targetElement) {\n targetElement.scrollIntoView({\n block: 'end',\n });\n }\n}\n\n/**\n * Hide/show EmailEncoder replacing text textarea\n */\nfunction apbctManageEmailEncoderCustomTextField() {\n const replacingText = document\n .querySelector('#apbct_setting_data__email_decoder_obfuscation_custom_text');\n let replacingTextWrapperSub;\n if (replacingText !== null) {\n replacingTextWrapperSub = typeof replacingText.parentElement !== 'undefined' ?\n replacingText.parentElement :\n null;\n }\n document.querySelectorAll('.apbct_setting---data__email_decoder_obfuscation_mode').forEach((elem) => {\n // visibility set on saved settings\n if (replacingTextWrapperSub && elem.checked && elem.value !== 'replace') {\n replacingTextWrapperSub.classList.add('hidden');\n }\n // visibility set on change\n elem.addEventListener('click', (event) => {\n if (typeof replacingTextWrapperSub !== 'undefined') {\n if (event.target.value === 'replace') {\n replacingTextWrapperSub.classList.remove('hidden');\n } else {\n replacingTextWrapperSub.classList.add('hidden');\n }\n }\n });\n });\n}\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbctBannerCheck() {\n let bannerChecker = setInterval( function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__check_renew_banner'},\n {\n callback: function(result, data, params, obj) {\n if (result.close_renew_banner) {\n if (jQuery('#cleantalk_notice_renew').length) {\n jQuery('#cleantalk_notice_renew').hide('slow');\n }\n if (jQuery('#cleantalk_notice_trial').length) {\n jQuery('#cleantalk_notice_trial').hide('slow');\n }\n clearInterval(bannerChecker);\n }\n },\n },\n );\n }, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param {string|array} elems\n * @return {*}\n */\nfunction apbctGetElems(elems) {\n elems = elems.split(',');\n for ( let i=0, len = elems.length, tmp; i < len; i++) {\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param {string|array} elems\n * @return {array}\n */\nfunction apbctGetElemsNative(elems) {\n // Make array from a string\n if (typeof elems === 'string') {\n elems = elems.split(',');\n }\n\n let out = [];\n\n elems.forEach(function(elem, i, arr) {\n // try to get elements with such IDs\n let tmp = document.getElementById(elem);\n if (tmp !== null) {\n out.push( tmp[key] );\n return;\n }\n\n // try to get elements with such class name\n // write each elem from collection to new element of output array\n tmp = document.getElementsByClassName(elem);\n if (tmp !== null && tmp.length !==0 ) {\n for (key in tmp) {\n if ( +key >= 0 ) {\n out.push( tmp[key] );\n }\n }\n }\n });\n\n return out;\n}\n\n/**\n * @param {string|array} elems\n */\nfunction apbctShowHideElem(elems) {\n elems = apbctGetElems(elems);\n for ( let i=0, len = elems.length; i < len; i++) {\n elems[i].each(function(i, elem) {\n elem = jQuery(elem);\n let label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(':visible')) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * @param {string|array} element\n */\nfunction apbctExceptedShowHide(element) { // eslint-disable-line no-unused-vars\n let toHide = [\n 'apbct_settings__dwpms_settings',\n 'apbct_settings__advanced_settings',\n 'trusted_and_affiliate__special_span',\n ];\n let index = toHide.indexOf(element);\n if (index !== -1) {\n toHide.splice(index, 1);\n }\n apbctShowHideElem(element);\n toHide.forEach((toHideElem) => {\n if (document.getElementById(toHideElem) && document.getElementById(toHideElem).style.display !== 'none') {\n apbctShowHideElem(toHideElem);\n }\n });\n}\n\n/**\n * @param {mixed} event\n * @param {string} id\n */\nfunction apbctShowRequiredGroups(event, id) { // eslint-disable-line no-unused-vars\n let required = document.getElementById('apbct_settings__dwpms_settings');\n if (required && required.style.display === 'none') {\n let originEvent = event;\n event.preventDefault();\n apbctShowHideElem('apbct_settings__dwpms_settings');\n document.getElementById(id).dispatchEvent(new originEvent.constructor(originEvent.type, originEvent));\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param {string|array} ids\n * @param {int} enable\n */\nfunction apbctSettingsDependencies(ids, enable) { // eslint-disable-line no-unused-vars\n enable = ! isNaN(enable) ? enable : null;\n\n // Get elements\n let elems = apbctGetElemsNative( ids );\n\n elems.forEach(function(elem, i, arr) {\n let doDisable = function() {\n elem.setAttribute('disabled', 'disabled');\n };\n let doEnable = function() {\n elem.removeAttribute('disabled');\n };\n\n // Set defined state\n if (enable === null) {\n enable = elem.getAttribute('disabled') === null ? 0 : 1;\n }\n\n enable === 1 ? doEnable() : doDisable();\n\n if ( elem.getAttribute('apbct_children') !== null) {\n let state = apbctSettingsDependenciesGetState( elem ) && enable;\n if ( state !== null ) {\n apbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n }\n }\n });\n}\n\n/**\n * @param {HTMLElement} elem\n * @return {int|null}\n */\nfunction apbctSettingsDependenciesGetState(elem) {\n let state;\n\n switch ( elem.getAttribute( 'type' ) ) {\n case 'checkbox':\n state = +elem.checked;\n break;\n case 'radio':\n state = +(+elem.getAttribute('value') === 1);\n break;\n default:\n state = null;\n }\n\n return state;\n}\n\n/**\n * @param {HTMLElement} label\n * @param {string} settingId\n */\nfunction apbctSettingsShowDescription(label, settingId) {\n let removeDescFunc = function(e) {\n const callerIsPopup = jQuery(e.target).parent('.apbct_long_desc').length != 0;\n const callerIsHideCross = jQuery(e.target).hasClass('apbct_long_desc__cancel');\n const descIsShown = jQuery('.apbct_long_desc__title').length > 0;\n if (descIsShown && !callerIsPopup || callerIsHideCross) {\n jQuery('.apbct_long_desc').remove();\n jQuery(document).off('click', removeDescFunc);\n }\n };\n\n label.after('
');\n let obj = jQuery('#apbct_long_desc__'+settingId);\n obj.append('')\n .append('
')\n .css({\n top: label.position().top - 5,\n left: label.position().left + 25,\n });\n\n\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__get__long_description', setting_id: settingId},\n {\n spinner: obj.children('img'),\n callback: function(result, data, params, obj) {\n if (result && result.title && result.desc) {\n obj.empty()\n .append('
')\n .append('')\n .append('

'+result.title+'

')\n .append('

'+result.desc+'

');\n\n jQuery(document).on('click', removeDescFunc);\n }\n },\n },\n obj,\n );\n}\n\n/**\n * Set position for navigation menu\n * @return {void}\n */\nfunction apbctNavigationMenuPosition() {\n const navBlock = document.querySelector('#apbct_hidden_section_nav ul');\n const rightBtnSave = document.querySelector('#apbct_settings__button_section');\n if (!navBlock || !rightBtnSave) {\n return;\n }\n const scrollPosition = window.scrollY;\n const windowWidth = window.innerWidth;\n if (scrollPosition > 1000) {\n navBlock.style.position = 'fixed';\n rightBtnSave.style.position = 'fixed';\n } else {\n navBlock.style.position = 'static';\n rightBtnSave.style.position = 'static';\n }\n\n if (windowWidth < 768) {\n rightBtnSave.style.position = 'fixed';\n }\n}\n\n/**\n * Set position for save button, hide it if scrolled to the bottom\n * @return {void}\n */\nfunction apbctSaveButtonPosition() {\n if (\n document.getElementById('apbct_settings__before_advanced_settings') === null ||\n document.getElementById('apbct_settings__after_advanced_settings') === null ||\n document.getElementById('apbct_settings__button_section') === null ||\n document.getElementById('apbct_settings__advanced_settings') === null ||\n document.getElementById('apbct_hidden_section_nav') === null\n ) {\n return;\n }\n\n if (!ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license) {\n jQuery('#apbct_settings__main_save_button').hide();\n return;\n }\n\n const additionalSaveButton =\n document.querySelector('#apbct_settings__button_section, cleantalk_link[value=\"save_changes\"]');\n if (!additionalSaveButton) {\n return;\n }\n\n const scrollPosition = window.scrollY;\n const documentHeight = document.documentElement.scrollHeight;\n const windowHeight = window.innerHeight;\n const threshold = 800;\n if (scrollPosition + windowHeight >= documentHeight - threshold) {\n additionalSaveButton.style.display = 'none';\n } else {\n additionalSaveButton.style.display = 'block';\n }\n\n const advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n const mainSaveButton = document.getElementById('apbct_settings__block_main_save_button');\n if (!advSettingsBlock || !mainSaveButton) {\n return;\n }\n\n if (advSettingsBlock.style.display == 'none') {\n mainSaveButton.classList.remove('apbct_settings__position_main_save_button');\n } else {\n mainSaveButton.classList.add('apbct_settings__position_main_save_button');\n }\n}\n\n/**\n * Hightlights element\n *\n * @param {string} id\n * @param {int} times\n */\nfunction apbctHighlightElement(id, times) {\n times = times-1 || 0;\n let keyField = jQuery('#'+id);\n jQuery('html, body').animate({scrollTop: keyField.offset().top - 100}, 'slow');\n keyField.addClass('apbct_highlighted');\n keyField.animate({opacity: 0}, 400, 'linear', function() {\n keyField.animate({opacity: 1}, 400, 'linear', function() {\n if (times>0) {\n apbctHighlightElement(id, times);\n } else {\n keyField.removeClass('apbct_highlighted');\n }\n });\n });\n}\n\n/**\n * Open modal to create support user\n */\nfunction apbctCreateSupportUser() { // eslint-disable-line no-unused-vars\n const localTextArray = ctSettingsPage.support_user_creation_msg_array;\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n cleantalkModal.confirm(\n localTextArray.confirm_header,\n localTextArray.confirm_text,\n '',\n apbctCreateSupportUserCallback,\n );\n}\n\n/**\n * Create support user\n */\nfunction apbctCreateSupportUserCallback() {\n const preloader = jQuery('#apbct_summary_and_support-create_user_button_preloader');\n preloader.css('display', 'block');\n apbct_admin_sendAJAX(\n {\n action: 'apbct_action__create_support_user',\n },\n {\n timeout: 10000,\n notJson: 1,\n callback: function(result, data, params, obj) {\n let localTextArray = ctSettingsPage.support_user_creation_msg_array;\n let popupMsg = localTextArray.default_error;\n const responseValid = (\n typeof result === 'object' &&\n result.hasOwnProperty('success') &&\n result.hasOwnProperty('user_created') &&\n result.hasOwnProperty('mail_sent') &&\n result.hasOwnProperty('cron_updated') &&\n result.hasOwnProperty('user_data') &&\n result.hasOwnProperty('result_code') &&\n typeof result.user_data === 'object' &&\n result.user_data.hasOwnProperty('username') &&\n result.user_data.hasOwnProperty('email') &&\n result.user_data.hasOwnProperty('password')\n );\n if (responseValid && result.success) {\n if (result.user_created) {\n let mailSentMsg = '';\n let successCreationMsg = '';\n let cronUpdatedMsg = localTextArray.cron_updated;\n\n if (result.mail_sent) {\n mailSentMsg = localTextArray.mail_sent_success;\n } else {\n mailSentMsg = localTextArray.mail_sent_error;\n }\n\n if (result.result_code === 0) {\n successCreationMsg = localTextArray.user_updated;\n } else {\n successCreationMsg = localTextArray.user_created;\n }\n\n jQuery('#apbct_summary_and_support-user_creation_username').text(result.user_data.username);\n jQuery('#apbct_summary_and_support-user_creation_email').text(result.user_data.email);\n jQuery('#apbct_summary_and_support-user_creation_password').text(result.user_data.password);\n jQuery('#apbct_summary_and_support-user_creation_mail_sent').text(mailSentMsg);\n jQuery('#apbct_summary_and_support-user_creation_title').text(successCreationMsg);\n jQuery('#apbct_summary_and_support-user_creation_cron_updated').text(cronUpdatedMsg);\n jQuery('.apbct_summary_and_support-user_creation_result').css('display', 'block');\n const createUserButton = jQuery('#apbct_summary_and_support-create_user_button');\n createUserButton.attr('disabled', true);\n createUserButton.css('color', 'rgba(93,89,86,0.55)');\n createUserButton.css('background', '#cccccc');\n preloader.css('display', 'none');\n return;\n } else {\n if (result.result_code === -2) {\n popupMsg = localTextArray.invalid_permission;\n } else if (result.result_code === -1) {\n popupMsg = localTextArray.unknown_creation_error;\n } else if (result.result_code === -4) {\n popupMsg = localTextArray.on_cooldown;\n } else if (result.result_code === -5) {\n popupMsg = localTextArray.email_is_busy;\n }\n }\n }\n preloader.css('display', 'none');\n cleantalkModal.loaded = popupMsg;\n cleantalkModal.open();\n },\n errorOutput: function(msg) {\n preloader.css('display', 'none');\n cleantalkModal.loaded = msg;\n cleantalkModal.open();\n },\n },\n );\n}\n"],"names":["handleAnchorDetection","anchor","document","querySelector","style","display","apbctExceptedShowHide","scrollToAnchor","anchorId","targetElement","scrollIntoView","block","apbctManageEmailEncoderCustomTextField","replacingText","let","replacingTextWrapperSub","parentElement","querySelectorAll","forEach","elem","checked","value","classList","add","addEventListener","event","target","remove","apbctBannerCheck","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbctGetElems","elems","i","len","split","tmp","apbctGetElemsNative","out","arr","getElementById","push","key","getElementsByClassName","apbctShowHideElem","each","label","next","prev","is","show","element","toHide","index","indexOf","splice","toHideElem","apbctShowRequiredGroups","id","required","originEvent","preventDefault","dispatchEvent","constructor","type","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependenciesGetState","apbctSettingsShowDescription","settingId","removeDescFunc","e","callerIsPopup","parent","callerIsHideCross","hasClass","off","after","append","css","top","position","left","setting_id","spinner","children","title","desc","empty","on","apbctNavigationMenuPosition","scrollPosition","windowWidth","navBlock","rightBtnSave","window","scrollY","innerWidth","apbctSaveButtonPosition","advSettingsBlock","mainSaveButton","ctSettingsPage","key_is_ok","ip_license","additionalSaveButton","documentHeight","documentElement","scrollHeight","innerHeight","apbctHighlightElement","times","keyField","animate","scrollTop","offset","addClass","opacity","removeClass","apbctCreateSupportUser","localTextArray","support_user_creation_msg_array","cleantalkModal","loaded","open","confirm","confirm_header","confirm_text","apbctCreateSupportUserCallback","preloader","timeout","notJson","popupMsg","default_error","hasOwnProperty","user_data","success","user_created","mailSentMsg","successCreationMsg","cronUpdatedMsg","cron_updated","createUserButton","mail_sent","mail_sent_success","mail_sent_error","result_code","user_updated","text","username","email","password","attr","invalid_permission","unknown_creation_error","on_cooldown","email_is_busy","errorOutput","msg","ready","getComputedStyle","direction","this","val","timezone","Date","getTimezoneOffset","ct_admin_timezone","button","setTimeout","reload","location","getTemplates","optionSelected","console","log","template_id","template_name","settings","insertAfter","close","templateNameInput","templateName","key_changed","click","self","find","debounceTimer","clearTimeout","$this","accountEmailField","accountEmail","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","keyBad","match","customUploader","wp","media","library","multiple","image","get","first","toJSON","url","src","adjust","hash","substring"],"mappings":"AAscA,SAASA,sBAAsBC,GAEtB,SADaC,SAASC,cAAc,oCAAoC,EACjDC,MAAMC,SAC9BC,sBAAsB,mCAAmC,EAE7DC,eAAe,IAAMN,CAAM,CAC/B,CAMA,SAASM,eAAeC,GACdC,EAAgBP,SAASC,cAAcK,CAAQ,EACjDC,GACAA,EAAcC,eAAe,CACzBC,MAAO,KACX,CAAC,CAET,CAKA,SAASC,yCACL,IAAMC,EAAgBX,SACjBC,cAAc,4DAA4D,EAC/EW,IAAIC,EACkB,OAAlBF,IACAE,EAAiE,KAAA,IAAhCF,EAAcG,cAC3CH,EAAcG,cACd,MAERd,SAASe,iBAAiB,uDAAuD,EAAEC,QAAQ,IAEnFH,GAA2BI,EAAKC,SAA0B,YAAfD,EAAKE,OAChDN,EAAwBO,UAAUC,IAAI,QAAQ,EAGlDJ,EAAKK,iBAAiB,QAAS,IACY,KAAA,IAA5BT,IACoB,YAAvBU,EAAMC,OAAOL,MACbN,EAAwBO,UAAUK,OAAO,QAAQ,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ACXH,OAAc,4BADF,EAIRI,GAFJD,EAAKkM,OAAS9L,OAAO4I,IAAI,EAAEhJ,KAAK,QAAQ,EAE3B,IACbC,EAAOqJ,OAASvL,SAASkD,eAAe,8BAAgCjB,EAAKkM,MAAM,EACnFjM,EAAOgH,QAAU,CAAA,EAEjBhH,EAAOH,SAAW,WACd/B,SAAS0L,SAASD,OAAO,CAC7B,EAEA5J,qBAAqBI,EAAMC,CAAM,CACrC,CAAC,EAEDG,OAAO,4CAA4C,EAAEkK,MAAM,SAAShH,GAChEA,EAAEhB,eAAe,EAEjB3D,IAAIqB,EAAO,CACXH,OAAc,6BADF,EAIRI,GAFJD,EAAKkM,OAAS9L,OAAO4I,IAAI,EAAEhJ,KAAK,QAAQ,EAE3B,IACbC,EAAOqJ,OAASvL,SAASkD,eAAe,+BAAiCjB,EAAKkM,MAAM,EACpFjM,EAAOgH,QAAU,CAAA,EAEjBhH,EAAOH,SAAW,WACd/B,SAAS0L,SAASD,OAAO,CAC7B,EAEA5J,qBAAqBI,EAAMC,CAAM,CACrC,CAAC,EAEDlC,SAASC,cAAc,mCAAmC,EAAEqB,iBAAiB,QAAS,KAClFtB,SAASC,cAAc,8BAA8B,EAAEC,MAAMC,QAAU,QACvEH,SAASC,cAAc,mCAAmC,EAAEC,MAAMC,QAAU,MAChF,CAAC,EAEDH,SAASC,cAAc,yCAAyC,EAAEqB,iBAAiB,QAAS,KACxFtB,SAASC,cAAc,8BAA8B,EAAEC,MAAMC,QAAU,OACvEH,SAASC,cAAc,mCAAmC,EAAEC,MAAMC,QAAU,OAChF,CAAC,EAGDO,uCAAuC,EAEnCqG,OAAO2E,SAAS0C,MAEhBtO,sBADeiH,OAAO2E,SAAS0C,KAAKC,UAAU,CAAC,CACnB,CAEpC,CAAC"} \ No newline at end of file +{"version":3,"file":"cleantalk-admin-settings-page.min.js","sources":["cleantalk-admin-settings-page.js"],"sourcesContent":["jQuery(document).ready(function() {\n // Crunch for Right to Left direction languages\n if (document.getElementsByClassName('apbct_settings-title')[0]) {\n if (getComputedStyle(document.getElementsByClassName('apbct_settings-title')[0]).direction === 'rtl') {\n jQuery('.apbct_switchers').css('text-align', 'right');\n }\n }\n\n // Show/Hide access key\n jQuery('#apbct_showApiKey').on('click', function(e) {\n e.preventDefault();\n jQuery(this).hide();\n jQuery('.apbct_settings-field--api_key').val(jQuery('.apbct_settings-field--api_key').attr('key'));\n jQuery('.apbct_settings-field--api_key+div').css('display', 'inline');\n });\n\n let d = new Date();\n let timezone = d.getTimezoneOffset()/60*(-1);\n jQuery('#ct_admin_timezone').val(timezone);\n\n // Key KEY automatically\n jQuery('#apbct_button__get_key_auto').on('click', function() {\n if (!jQuery('#apbct_license_agreed').is(':checked')) {\n jQuery('#apbct_settings__no_agreement_notice').show();\n apbctHighlightElement('apbct_license_agreed', 3);\n return;\n }\n apbct_admin_sendAJAX(\n {action: 'apbct_get_key_auto', ct_admin_timezone: timezone},\n {\n timeout: 25000,\n button: document.getElementById('apbct_button__get_key_auto' ),\n spinner: jQuery('#apbct_button__get_key_auto .apbct_preloader_button' ),\n callback: function(result, data, params, obj) {\n jQuery('#apbct_button__get_key_auto .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_button__get_key_auto .apbct_success').hide(300);\n }, 2000);\n if (result.reload) {\n document.location.reload();\n }\n if (result.getTemplates) {\n cleantalkModal.loaded = result.getTemplates;\n cleantalkModal.open();\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n }\n },\n },\n );\n });\n\n // Import settings\n jQuery( document ).on('click', '#apbct_settings_templates_import_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_import'));\n let templateNameInput = jQuery('#apbct_settings_templates_import_name');\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n let data = {\n 'template_id': optionSelected.data('id'),\n 'template_name': optionSelected.data('name'),\n 'settings': optionSelected.data('settings'),\n };\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_import', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_import_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_import_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_import_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Export settings\n jQuery( document ).on('click', '#apbct_settings_templates_export_button', function() {\n jQuery('#apbct-ajax-result').remove();\n let optionSelected = jQuery('option:selected', jQuery('#apbct_settings_templates_export'));\n let templateNameInput = jQuery('#apbct_settings_templates_export_name');\n let data = {};\n templateNameInput.css('border-color', 'inherit');\n if ( typeof optionSelected.data('id') === 'undefined' ) {\n console.log( 'Attribute \"data-id\" not set for the option.' );\n return;\n }\n if ( optionSelected.data('id') === 'new_template' ) {\n let templateName = templateNameInput.val();\n if ( templateName === '' ) {\n templateNameInput.css('border-color', 'red');\n return;\n }\n data = {\n 'template_name': templateName,\n };\n } else {\n data = {\n 'template_id': optionSelected.data('id'),\n };\n }\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_export', data: data},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_export_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_export_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_export_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Reset settings\n jQuery( document ).on('click', '#apbct_settings_templates_reset_button', function() {\n let button = this;\n apbct_admin_sendAJAX(\n {action: 'settings_templates_reset'},\n {\n timeout: 25000,\n button: button,\n spinner: jQuery('#apbct_settings_templates_reset_button .apbct_preloader_button' ),\n notJson: true,\n callback: function(result, data, params, obj) {\n if (result.success) {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n jQuery('#apbct_settings_templates_reset_button .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_settings_templates_reset_button .apbct_success').hide(300);\n }, 2000);\n document.addEventListener('cleantalkModalClosed', function( e ) {\n document.location.reload();\n });\n setTimeout(function() {\n cleantalkModal.close();\n }, 2000);\n } else {\n jQuery( '

' + result.data + '

' )\n .insertAfter( jQuery(button) );\n }\n },\n },\n );\n });\n\n // Sync button\n jQuery('#apbct_button__sync').on('click', function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_sync'},\n {\n timeout: 25000,\n button: document.getElementById('apbct_button__sync' ),\n spinner: jQuery('#apbct_button__sync .apbct_preloader_button' ),\n callback: function(result, data, params, obj) {\n jQuery('#apbct_button__sync .apbct_success').show(300);\n setTimeout(function() {\n jQuery('#apbct_button__sync .apbct_success').hide(300);\n }, 2000);\n if (result.reload) {\n if ( ctSettingsPage.key_changed ) {\n jQuery('.key_changed_sync').hide(300);\n jQuery('.key_changed_success').show(300);\n setTimeout(function() {\n document.location.reload();\n }, 3000);\n } else {\n document.location.reload();\n }\n }\n },\n },\n );\n });\n\n if ( ctSettingsPage.key_changed ) {\n jQuery('#apbct_button__sync').click();\n }\n\n jQuery(document).on('click', '.apbct_settings-long_description---show', function() {\n self = jQuery(this);\n apbctSettingsShowDescription(self, self.attr('setting'));\n });\n\n if (jQuery('#cleantalk_notice_renew').length || jQuery('#cleantalk_notice_trial').length) {\n apbctBannerCheck();\n }\n\n jQuery(document).on('change', '#apbct_settings_templates_export', function() {\n let optionSelected = jQuery('option:selected', this);\n if ( optionSelected.data('id') === 'new_template' ) {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').show();\n } else {\n jQuery(this).parent().parent().find('#apbct_settings_templates_export_name').hide();\n }\n });\n\n apbctSaveButtonPosition();\n let debounceTimer;\n window.addEventListener('scroll', function() {\n clearTimeout(debounceTimer);\n debounceTimer = setTimeout(function() {\n apbctSaveButtonPosition();\n }, 50);\n apbctNavigationMenuPosition();\n });\n jQuery('#ct_adv_showhide a').on('click', apbctSaveButtonPosition);\n\n\n /**\n * Change cleantalk account email\n */\n jQuery('#apbct-change-account-email').on('click', function(e) {\n e.preventDefault();\n\n let $this = jQuery(this);\n let accountEmailField = jQuery('#apbct-account-email');\n let accountEmail = accountEmailField.text();\n\n $this.toggleClass('active');\n\n if ($this.hasClass('active')) {\n $this.text($this.data('save-text'));\n accountEmailField.attr('contenteditable', 'true');\n accountEmailField.on('keydown', function(e) {\n if (e.code === 'Enter') {\n e.preventDefault();\n }\n });\n accountEmailField.on('input', function(e) {\n if (e.inputType === 'insertParagraph') {\n e.preventDefault();\n }\n });\n } else {\n apbct_admin_sendAJAX(\n {\n action: 'apbct_update_account_email',\n accountEmail: accountEmail,\n },\n {\n timeout: 5000,\n callback: function(result, data, params, obj) {\n if (result.success !== undefined && result.success === 'ok') {\n if (result.manuallyLink !== undefined) {\n jQuery('#apbct-key-manually-link').attr('href', result.manuallyLink);\n }\n }\n\n if (result.error !== undefined) {\n jQuery('#apbct-account-email').css('border-color', 'red');\n }\n },\n },\n );\n\n accountEmailField.attr('contenteditable', 'false');\n $this.text($this.data('default-text'));\n }\n });\n\n /**\n * Validate apkikey and hide get auto btn\n */\n jQuery('#apbct_setting_apikey').on('input', function() {\n let enteredValue = jQuery(this).val();\n jQuery('#apbct_settings__key_line__save_settings').off('click');\n let keyBad = enteredValue !== '' && enteredValue.match(/^[a-z\\d]{8,30}\\s*$/) === null;\n jQuery('#apbct_settings__key_is_bad').hide();\n jQuery('#apbct_showApiKey').hide();\n jQuery('#apbct_settings__account_name_ob').hide();\n jQuery('#apbct_settings__no_agreement_notice').hide();\n if (enteredValue === '') {\n jQuery('#apbct_button__key_line__save_changes_wrapper').hide();\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n jQuery('#apbct_button__get_key_manual_chunk').show();\n } else {\n jQuery('#apbct_button__key_line__save_changes_wrapper').show();\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n jQuery('#apbct_button__get_key_manual_chunk').hide();\n if (keyBad) {\n jQuery('#apbct_settings__key_line__save_settings').on('click',\n function(e) {\n e.preventDefault();\n jQuery('#apbct_settings__key_is_bad').show();\n apbctHighlightElement('apbct_setting_apikey', 3);\n },\n );\n }\n }\n });\n\n if ( jQuery('#apbct_setting_apikey').val() && ctSettingsPage.key_is_ok) {\n jQuery('#apbct_button__get_key_auto__wrapper').hide();\n }\n\n /**\n * Handle synchronization errors when key is no ok to force user check the key and restart the sync\n */\n if ( !ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license ) {\n jQuery('button.cleantalk_link[value=\"save_changes\"]').on('click',\n function(e) {\n e.preventDefault();\n if (!jQuery('#sync_required_notice').length) {\n jQuery( '

' +\n 'Synchronization process failed. Please, check the acces key and restart the synch.' +\n '

' ).insertAfter( jQuery('#apbct_button__sync') );\n }\n apbctHighlightElement('apbct_setting_apikey', 3);\n apbctHighlightElement('apbct_button__sync', 3);\n jQuery('#apbct_button__get_key_auto__wrapper').show();\n },\n );\n }\n\n /**\n * Open WP gallery for adding custom logo\n */\n jQuery('#apbct-custom-logo-open-gallery').click(function(e) {\n e.preventDefault();\n\n const button = jQuery(this);\n\n const customUploader = wp.media({\n library: {\n type: 'image',\n },\n multiple: false,\n });\n\n customUploader.on('select', function() {\n const image = customUploader.state().get('selection').first().toJSON();\n\n button.parent().prev().attr( 'src', image.url );\n jQuery('#cleantalk_custom_logo').val( image.id );\n });\n\n customUploader.open();\n });\n\n /**\n * Remove selected logo\n */\n jQuery('#apbct-custom-logo-remove-image').click(function(e) {\n e.preventDefault();\n\n if ( true === confirm( 'Sure?' ) ) {\n const src = jQuery(this).parent().prev().data('src');\n jQuery(this).parent().prev().attr('src', src);\n jQuery(this).prev().prev().val('');\n }\n });\n\n jQuery('button[id*=\"apbct-action-adjust-change-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_change';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-change-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n jQuery('button[id*=\"apbct-action-adjust-reverse-\"]').click(function(e) {\n e.preventDefault();\n\n let data = {};\n data.action = 'apbct_action_adjust_reverse';\n data.adjust = jQuery(this).data('adjust');\n\n let params = {};\n params.button = document.getElementById('apbct-action-adjust-reverse-' + data.adjust);\n params.notJson = true;\n\n params.callback = function() {\n document.location.reload();\n };\n\n apbct_admin_sendAJAX(data, params);\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn')?.addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'block';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'none';\n });\n\n document.querySelector('.apbct_hidden_section_nav_mob_btn-close')?.addEventListener('click', () => {\n document.querySelector('#apbct_hidden_section_nav ul').style.display = 'none';\n document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'block';\n });\n\n // Hide/show EmailEncoder replacing text textarea\n apbctManageEmailEncoderCustomTextField();\n\n if (window.location.hash) {\n const anchor = window.location.hash.substring(1);\n handleAnchorDetection(anchor);\n }\n});\n\n/**\n * Detect ancors and open advanced settings before scroll\n * @param {string} anchor\n */\nfunction handleAnchorDetection(anchor) {\n let advSettings = document.querySelector('#apbct_settings__advanced_settings');\n if ( 'none' === advSettings.style.display ) {\n apbctExceptedShowHide('apbct_settings__advanced_settings');\n }\n scrollToAnchor('#' + anchor);\n}\n\n/**\n * Scroll to the target element ID\n * @param {string} anchorId Anchor target element ID\n */\nfunction scrollToAnchor(anchorId) {\n const targetElement = document.querySelector(anchorId);\n if (targetElement) {\n targetElement.scrollIntoView({\n block: 'end',\n });\n }\n}\n\n/**\n * Hide/show EmailEncoder replacing text textarea\n */\nfunction apbctManageEmailEncoderCustomTextField() {\n const replacingText = document\n .querySelector('#apbct_setting_data__email_decoder_obfuscation_custom_text');\n let replacingTextWrapperSub;\n if (replacingText !== null) {\n replacingTextWrapperSub = typeof replacingText.parentElement !== 'undefined' ?\n replacingText.parentElement :\n null;\n }\n document.querySelectorAll('.apbct_setting---data__email_decoder_obfuscation_mode').forEach((elem) => {\n // visibility set on saved settings\n if (replacingTextWrapperSub && elem.checked && elem.value !== 'replace') {\n replacingTextWrapperSub.classList.add('hidden');\n }\n // visibility set on change\n elem.addEventListener('click', (event) => {\n if (typeof replacingTextWrapperSub !== 'undefined') {\n if (event.target.value === 'replace') {\n replacingTextWrapperSub.classList.remove('hidden');\n } else {\n replacingTextWrapperSub.classList.add('hidden');\n }\n }\n });\n });\n}\n\n/**\n * Checking current account status for renew notice\n */\nfunction apbctBannerCheck() {\n let bannerChecker = setInterval( function() {\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__check_renew_banner'},\n {\n callback: function(result, data, params, obj) {\n if (result.close_renew_banner) {\n if (jQuery('#cleantalk_notice_renew').length) {\n jQuery('#cleantalk_notice_renew').hide('slow');\n }\n if (jQuery('#cleantalk_notice_trial').length) {\n jQuery('#cleantalk_notice_trial').hide('slow');\n }\n clearInterval(bannerChecker);\n }\n },\n },\n );\n }, 900000);\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector passed in string separated by ,\n *\n * @param {string|array} elems\n * @return {*}\n */\nfunction apbctGetElems(elems) {\n elems = elems.split(',');\n for ( let i=0, len = elems.length, tmp; i < len; i++) {\n tmp = jQuery('#'+elems[i]);\n elems[i] = tmp.length === 0 ? jQuery('.'+elems[i]) : tmp;\n }\n return elems;\n}\n\n/**\n * Select elems like #{selector} or .{selector}\n * Selector could be passed in a string ( separated by comma ) or in array ( [ elem1, elem2, ... ] )\n *\n * @param {string|array} elems\n * @return {array}\n */\nfunction apbctGetElemsNative(elems) {\n // Make array from a string\n if (typeof elems === 'string') {\n elems = elems.split(',');\n }\n\n let out = [];\n\n elems.forEach(function(elem, i, arr) {\n // try to get elements with such IDs\n let tmp = document.getElementById(elem);\n if (tmp !== null) {\n out.push( tmp[key] );\n return;\n }\n\n // try to get elements with such class name\n // write each elem from collection to new element of output array\n tmp = document.getElementsByClassName(elem);\n if (tmp !== null && tmp.length !==0 ) {\n for (key in tmp) {\n if ( +key >= 0 ) {\n out.push( tmp[key] );\n }\n }\n }\n });\n\n return out;\n}\n\n/**\n * @param {string|array} elems\n */\nfunction apbctShowHideElem(elems) {\n elems = apbctGetElems(elems);\n for ( let i=0, len = elems.length; i < len; i++) {\n elems[i].each(function(i, elem) {\n elem = jQuery(elem);\n let label = elem.next('label') || elem.prev('label') || null;\n if (elem.is(':visible')) {\n elem.hide();\n if (label) label.hide();\n } else {\n elem.show();\n if (label) label.show();\n }\n });\n }\n}\n\n/**\n * @param {string|array} element\n */\nfunction apbctExceptedShowHide(element) { // eslint-disable-line no-unused-vars\n let toHide = [\n 'apbct_settings__dwpms_settings',\n 'apbct_settings__advanced_settings',\n 'trusted_and_affiliate__special_span',\n ];\n let index = toHide.indexOf(element);\n if (index !== -1) {\n toHide.splice(index, 1);\n }\n apbctShowHideElem(element);\n toHide.forEach((toHideElem) => {\n if (document.getElementById(toHideElem) && document.getElementById(toHideElem).style.display !== 'none') {\n apbctShowHideElem(toHideElem);\n }\n });\n}\n\n/**\n * @param {mixed} event\n * @param {string} id\n */\nfunction apbctShowRequiredGroups(event, id) { // eslint-disable-line no-unused-vars\n let required = document.getElementById('apbct_settings__dwpms_settings');\n if (required && required.style.display === 'none') {\n let originEvent = event;\n event.preventDefault();\n apbctShowHideElem('apbct_settings__dwpms_settings');\n document.getElementById(id).dispatchEvent(new originEvent.constructor(originEvent.type, originEvent));\n }\n}\n\n/**\n * Settings dependences. Switch|toggle depended elements state (disabled|enabled)\n * Recieve list of selectors ( without class mark (.) or id mark (#) )\n *\n * @param {string|array} ids\n * @param {int} enable\n */\nfunction apbctSettingsDependencies(ids, enable) { // eslint-disable-line no-unused-vars\n enable = ! isNaN(enable) ? enable : null;\n\n // Get elements\n let elems = apbctGetElemsNative( ids );\n\n elems.forEach(function(elem, i, arr) {\n let doDisable = function() {\n elem.setAttribute('disabled', 'disabled');\n };\n let doEnable = function() {\n elem.removeAttribute('disabled');\n };\n\n // Set defined state\n if (enable === null) {\n enable = elem.getAttribute('disabled') === null ? 0 : 1;\n }\n\n enable === 1 ? doEnable() : doDisable();\n\n if ( elem.getAttribute('apbct_children') !== null) {\n let state = apbctSettingsDependenciesGetState( elem ) && enable;\n if ( state !== null ) {\n apbctSettingsDependencies( elem.getAttribute('apbct_children'), state );\n }\n }\n });\n}\n\n/**\n * @param {HTMLElement} elem\n * @return {int|null}\n */\nfunction apbctSettingsDependenciesGetState(elem) {\n let state;\n\n switch ( elem.getAttribute( 'type' ) ) {\n case 'checkbox':\n state = +elem.checked;\n break;\n case 'radio':\n state = +(+elem.getAttribute('value') === 1);\n break;\n default:\n state = null;\n }\n\n return state;\n}\n\n/**\n * @param {HTMLElement} label\n * @param {string} settingId\n */\nfunction apbctSettingsShowDescription(label, settingId) {\n let removeDescFunc = function(e) {\n const callerIsPopup = jQuery(e.target).parent('.apbct_long_desc').length != 0;\n const callerIsHideCross = jQuery(e.target).hasClass('apbct_long_desc__cancel');\n const descIsShown = jQuery('.apbct_long_desc__title').length > 0;\n if (descIsShown && !callerIsPopup || callerIsHideCross) {\n jQuery('.apbct_long_desc').remove();\n jQuery(document).off('click', removeDescFunc);\n }\n };\n\n label.after('
');\n let obj = jQuery('#apbct_long_desc__'+settingId);\n obj.append('')\n .append('
')\n .css({\n top: label.position().top - 5,\n left: label.position().left + 25,\n });\n\n\n apbct_admin_sendAJAX(\n {action: 'apbct_settings__get__long_description', setting_id: settingId},\n {\n spinner: obj.children('img'),\n callback: function(result, data, params, obj) {\n if (result && result.title && result.desc) {\n obj.empty()\n .append('
')\n .append('')\n .append('

'+result.title+'

')\n .append('

'+result.desc+'

');\n\n jQuery(document).on('click', removeDescFunc);\n }\n },\n },\n obj,\n );\n}\n\n/**\n * Set position for navigation menu\n * @return {void}\n */\nfunction apbctNavigationMenuPosition() {\n const navBlock = document.querySelector('#apbct_hidden_section_nav ul');\n const rightBtnSave = document.querySelector('#apbct_settings__button_section');\n if (!navBlock || !rightBtnSave) {\n return;\n }\n const scrollPosition = window.scrollY;\n const windowWidth = window.innerWidth;\n if (scrollPosition > 1000) {\n navBlock.style.position = 'fixed';\n rightBtnSave.style.position = 'fixed';\n } else {\n navBlock.style.position = 'static';\n rightBtnSave.style.position = 'static';\n }\n\n if (windowWidth < 768) {\n rightBtnSave.style.position = 'fixed';\n }\n}\n\n/**\n * Set position for save button, hide it if scrolled to the bottom\n * @return {void}\n */\nfunction apbctSaveButtonPosition() {\n if (\n document.getElementById('apbct_settings__before_advanced_settings') === null ||\n document.getElementById('apbct_settings__after_advanced_settings') === null ||\n document.getElementById('apbct_settings__button_section') === null ||\n document.getElementById('apbct_settings__advanced_settings') === null ||\n document.getElementById('apbct_hidden_section_nav') === null\n ) {\n return;\n }\n\n if (!ctSettingsPage.key_is_ok && !ctSettingsPage.ip_license) {\n jQuery('#apbct_settings__main_save_button').hide();\n return;\n }\n\n const additionalSaveButton =\n document.querySelector('#apbct_settings__button_section, cleantalk_link[value=\"save_changes\"]');\n if (!additionalSaveButton) {\n return;\n }\n\n const scrollPosition = window.scrollY;\n const documentHeight = document.documentElement.scrollHeight;\n const windowHeight = window.innerHeight;\n const threshold = 800;\n if (scrollPosition + windowHeight >= documentHeight - threshold) {\n additionalSaveButton.style.display = 'none';\n } else {\n additionalSaveButton.style.display = 'block';\n }\n\n const advSettingsBlock = document.getElementById('apbct_settings__advanced_settings');\n const mainSaveButton = document.getElementById('apbct_settings__block_main_save_button');\n if (!advSettingsBlock || !mainSaveButton) {\n return;\n }\n\n if (advSettingsBlock.style.display == 'none') {\n mainSaveButton.classList.remove('apbct_settings__position_main_save_button');\n } else {\n mainSaveButton.classList.add('apbct_settings__position_main_save_button');\n }\n}\n\n/**\n * Hightlights element\n *\n * @param {string} id\n * @param {int} times\n */\nfunction apbctHighlightElement(id, times) {\n times = times-1 || 0;\n let keyField = jQuery('#'+id);\n jQuery('html, body').animate({scrollTop: keyField.offset().top - 100}, 'slow');\n keyField.addClass('apbct_highlighted');\n keyField.animate({opacity: 0}, 400, 'linear', function() {\n keyField.animate({opacity: 1}, 400, 'linear', function() {\n if (times>0) {\n apbctHighlightElement(id, times);\n } else {\n keyField.removeClass('apbct_highlighted');\n }\n });\n });\n}\n\n/**\n * Open modal to create support user\n */\nfunction apbctCreateSupportUser() { // eslint-disable-line no-unused-vars\n const localTextArray = ctSettingsPage.support_user_creation_msg_array;\n cleantalkModal.loaded = false;\n cleantalkModal.open(false);\n cleantalkModal.confirm(\n localTextArray.confirm_header,\n localTextArray.confirm_text,\n '',\n apbctCreateSupportUserCallback,\n );\n}\n\n/**\n * Create support user\n */\nfunction apbctCreateSupportUserCallback() {\n const preloader = jQuery('#apbct_summary_and_support-create_user_button_preloader');\n preloader.css('display', 'block');\n apbct_admin_sendAJAX(\n {\n action: 'apbct_action__create_support_user',\n },\n {\n timeout: 10000,\n notJson: 1,\n callback: function(result, data, params, obj) {\n let localTextArray = ctSettingsPage.support_user_creation_msg_array;\n let popupMsg = localTextArray.default_error;\n const responseValid = (\n typeof result === 'object' &&\n result.hasOwnProperty('success') &&\n result.hasOwnProperty('user_created') &&\n result.hasOwnProperty('mail_sent') &&\n result.hasOwnProperty('cron_updated') &&\n result.hasOwnProperty('user_data') &&\n result.hasOwnProperty('result_code') &&\n typeof result.user_data === 'object' &&\n result.user_data.hasOwnProperty('username') &&\n result.user_data.hasOwnProperty('email') &&\n result.user_data.hasOwnProperty('password')\n );\n if (responseValid && result.success) {\n if (result.user_created) {\n let mailSentMsg = '';\n let successCreationMsg = '';\n let cronUpdatedMsg = localTextArray.cron_updated;\n\n if (result.mail_sent) {\n mailSentMsg = localTextArray.mail_sent_success;\n } else {\n mailSentMsg = localTextArray.mail_sent_error;\n }\n\n if (result.result_code === 0) {\n successCreationMsg = localTextArray.user_updated;\n } else {\n successCreationMsg = localTextArray.user_created;\n }\n\n jQuery('#apbct_summary_and_support-user_creation_username').text(result.user_data.username);\n jQuery('#apbct_summary_and_support-user_creation_email').text(result.user_data.email);\n jQuery('#apbct_summary_and_support-user_creation_password').text(result.user_data.password);\n jQuery('#apbct_summary_and_support-user_creation_mail_sent').text(mailSentMsg);\n jQuery('#apbct_summary_and_support-user_creation_title').text(successCreationMsg);\n jQuery('#apbct_summary_and_support-user_creation_cron_updated').text(cronUpdatedMsg);\n jQuery('.apbct_summary_and_support-user_creation_result').css('display', 'block');\n const createUserButton = jQuery('#apbct_summary_and_support-create_user_button');\n createUserButton.attr('disabled', true);\n createUserButton.css('color', 'rgba(93,89,86,0.55)');\n createUserButton.css('background', '#cccccc');\n preloader.css('display', 'none');\n return;\n } else {\n if (result.result_code === -2) {\n popupMsg = localTextArray.invalid_permission;\n } else if (result.result_code === -1) {\n popupMsg = localTextArray.unknown_creation_error;\n } else if (result.result_code === -4) {\n popupMsg = localTextArray.on_cooldown;\n } else if (result.result_code === -5) {\n popupMsg = localTextArray.email_is_busy;\n }\n }\n }\n preloader.css('display', 'none');\n cleantalkModal.loaded = popupMsg;\n cleantalkModal.open();\n },\n errorOutput: function(msg) {\n preloader.css('display', 'none');\n cleantalkModal.loaded = msg;\n cleantalkModal.open();\n },\n },\n );\n}\n"],"names":["handleAnchorDetection","anchor","document","querySelector","style","display","apbctExceptedShowHide","scrollToAnchor","anchorId","targetElement","scrollIntoView","block","apbctManageEmailEncoderCustomTextField","replacingText","let","replacingTextWrapperSub","parentElement","querySelectorAll","forEach","elem","checked","value","classList","add","addEventListener","event","target","remove","apbctBannerCheck","bannerChecker","setInterval","apbct_admin_sendAJAX","action","callback","result","data","params","obj","close_renew_banner","jQuery","length","hide","clearInterval","apbctGetElems","elems","i","len","split","tmp","apbctGetElemsNative","out","arr","getElementById","push","key","getElementsByClassName","apbctShowHideElem","each","label","next","prev","is","show","element","toHide","index","indexOf","splice","toHideElem","apbctShowRequiredGroups","id","required","originEvent","preventDefault","dispatchEvent","constructor","type","apbctSettingsDependencies","ids","enable","isNaN","state","getAttribute","removeAttribute","setAttribute","apbctSettingsDependenciesGetState","apbctSettingsShowDescription","settingId","removeDescFunc","e","callerIsPopup","parent","callerIsHideCross","hasClass","off","after","append","css","top","position","left","setting_id","spinner","children","title","desc","empty","on","apbctNavigationMenuPosition","scrollPosition","windowWidth","navBlock","rightBtnSave","window","scrollY","innerWidth","apbctSaveButtonPosition","advSettingsBlock","mainSaveButton","ctSettingsPage","key_is_ok","ip_license","additionalSaveButton","documentHeight","documentElement","scrollHeight","innerHeight","apbctHighlightElement","times","keyField","animate","scrollTop","offset","addClass","opacity","removeClass","apbctCreateSupportUser","localTextArray","support_user_creation_msg_array","cleantalkModal","loaded","open","confirm","confirm_header","confirm_text","apbctCreateSupportUserCallback","preloader","timeout","notJson","popupMsg","default_error","hasOwnProperty","user_data","success","user_created","mailSentMsg","successCreationMsg","cronUpdatedMsg","cron_updated","createUserButton","mail_sent","mail_sent_success","mail_sent_error","result_code","user_updated","text","username","email","password","attr","invalid_permission","unknown_creation_error","on_cooldown","email_is_busy","errorOutput","msg","ready","getComputedStyle","direction","this","val","timezone","Date","getTimezoneOffset","ct_admin_timezone","button","setTimeout","reload","location","getTemplates","optionSelected","console","log","template_id","template_name","settings","insertAfter","close","templateNameInput","templateName","key_changed","click","self","find","debounceTimer","clearTimeout","$this","accountEmailField","accountEmail","toggleClass","code","inputType","undefined","manuallyLink","error","enteredValue","keyBad","match","customUploader","wp","media","library","multiple","image","get","first","toJSON","url","src","adjust","hash","substring"],"mappings":"AAscA,SAASA,sBAAsBC,GAEtB,SADaC,SAASC,cAAc,oCAAoC,EACjDC,MAAMC,SAC9BC,sBAAsB,mCAAmC,EAE7DC,eAAe,IAAMN,CAAM,CAC/B,CAMA,SAASM,eAAeC,GACdC,EAAgBP,SAASC,cAAcK,CAAQ,EACjDC,GACAA,EAAcC,eAAe,CACzBC,MAAO,KACX,CAAC,CAET,CAKA,SAASC,yCACL,IAAMC,EAAgBX,SACjBC,cAAc,4DAA4D,EAC/EW,IAAIC,EACkB,OAAlBF,IACAE,EAAiE,KAAA,IAAhCF,EAAcG,cAC3CH,EAAcG,cACd,MAERd,SAASe,iBAAiB,uDAAuD,EAAEC,QAAQ,IAEnFH,GAA2BI,EAAKC,SAA0B,YAAfD,EAAKE,OAChDN,EAAwBO,UAAUC,IAAI,QAAQ,EAGlDJ,EAAKK,iBAAiB,QAAS,IACY,KAAA,IAA5BT,IACoB,YAAvBU,EAAMC,OAAOL,MACbN,EAAwBO,UAAUK,OAAO,QAAQ,EAEjDZ,EAAwBO,UAAUC,IAAI,QAAQ,EAG1D,CAAC,CACL,CAAC,CACL,CAKA,SAASK,mBACLd,IAAIe,EAAgBC,YAAa,WAC7BC,qBACI,CAACC,OAAQ,oCAAoC,EAC7C,CACIC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACjCH,EAAOI,qBACHC,OAAO,yBAAyB,EAAEC,QAClCD,OAAO,yBAAyB,EAAEE,KAAK,MAAM,EAE7CF,OAAO,yBAAyB,EAAEC,QAClCD,OAAO,yBAAyB,EAAEE,KAAK,MAAM,EAEjDC,cAAcb,CAAa,EAEnC,CACJ,CACJ,CACJ,EAAG,GAAM,CACb,CASA,SAASc,cAAcC,GAEnB,IAAM9B,IAAI+B,EAAE,EAAGC,GADfF,EAAQA,EAAMG,MAAM,GAAG,GACIP,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BAAiCjB,EAAKkM,MAAM,EACpFjM,EAAOgH,QAAU,CAAA,EAEjBhH,EAAOH,SAAW,WACd/B,SAAS0L,SAASD,OAAO,CAC7B,EAEA5J,qBAAqBI,EAAMC,CAAM,CACrC,CAAC,EAEDlC,SAASC,cAAc,mCAAmC,GAAGqB,iBAAiB,QAAS,KACnFtB,SAASC,cAAc,8BAA8B,EAAEC,MAAMC,QAAU,QACvEH,SAASC,cAAc,mCAAmC,EAAEC,MAAMC,QAAU,MAChF,CAAC,EAEDH,SAASC,cAAc,yCAAyC,GAAGqB,iBAAiB,QAAS,KACzFtB,SAASC,cAAc,8BAA8B,EAAEC,MAAMC,QAAU,OACvEH,SAASC,cAAc,mCAAmC,EAAEC,MAAMC,QAAU,OAChF,CAAC,EAGDO,uCAAuC,EAEnCqG,OAAO2E,SAAS0C,MAEhBtO,sBADeiH,OAAO2E,SAAS0C,KAAKC,UAAU,CAAC,CACnB,CAEpC,CAAC"} \ No newline at end of file diff --git a/js/cleantalk-admin.min.js b/js/cleantalk-admin.min.js index 66b31d4f1..e914aef60 100644 --- a/js/cleantalk-admin.min.js +++ b/js/cleantalk-admin.min.js @@ -1,2 +1,2 @@ -function apbct_admin_sendAJAX(t,n,c){let o=n.callback||null,i=n.callback_context||null,a=n.callback_params||null;var e=n.async||!0;let d=n.notJson||null;var l=n.timeout||15e3,c=c||null;let r=n.button||null,s=n.spinner||null,u=n.progressbar||null;"string"==typeof t?t=t+"&_ajax_nonce="+ctAdminCommon._ajax_nonce+"&no_cache="+Math.random():(t._ajax_nonce=ctAdminCommon._ajax_nonce,t.no_cache=Math.random()),r&&(r.setAttribute("disabled","disabled"),r.style.cursor="not-allowed"),s&&jQuery(s).css("display","inline"),jQuery.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:t,async:e,success:function(e){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),s&&jQuery(s).css("display","none"),(e=d?e:JSON.parse(e)).error?(setTimeout(function(){u&&u.fadeOut("slow")},1e3),"undefined"!=typeof cleantalkModal?(cleantalkModal.loaded="Error:
"+e.error.toString(),cleantalkModal.open()):alert("Error happens: "+(e.error||"Unkown"))):o&&(a?o.apply(i,a.concat(e,t,n,c)):o(e,t,n,c))},error:function(e,t,n){r&&(r.removeAttribute("disabled"),r.style.cursor="pointer"),s&&jQuery(s).css("display","none"),console.log("APBCT_AJAX_ERROR"),console.log(e),console.log(t),console.log(n)},timeout:l})}function apbctSetEmailDecoderPopupAnimation(){var t=["apbct_dog_one","apbct_dog_two","apbct_dog_three"],n=document.createElement("div");n.classList="apbct-ee-animation-wrapper";for(let e=0;e{e.encoded_email===a.dataset.originalString&&(t=e)}),e=t.decoded_email.split(/[&?]/)[0]}else e=o.data[0].decoded_email;var n=t.querySelector("#apbct_email_ecoder__popup_text_node_first"),c=document.createElement("b"),c=(c.setAttribute("class","apbct-email-encoder-select-whole-email"),c.innerText=e,"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_click_to_select?c.title=ctPublicFunctions.text__ee_click_to_select:c.title=ctAdminCommon.text__ee_click_to_select,n&&("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_original_email?n.innerHTML=ctPublicFunctions.text__ee_original_email+" "+c.outerHTML:n.innerHTML=ctAdminCommon.text__ee_original_email+" "+c.outerHTML,n.setAttribute("style","flex-direction: row;")),t.querySelector(".apbct-ee-animation-wrapper")),n=(c&&c.remove(),t.querySelector("#apbct_email_ecoder__popup_text_node_second")),c=(n&&n.remove(),document.createElement("span"));c.classList="apbct-email-encoder-elements_center top-margin-long",document.querySelector(".apbct-email-encoder-got-it-button")||(n=document.createElement("button"),"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_got_it?n.innerText=ctPublicFunctions.text__ee_got_it:n.innerText=ctAdminCommon.text__ee_got_it,n.classList="apbct-email-encoder-got-it-button",n.addEventListener("click",function(){document.body.classList.remove("apbct-popup-fade"),t.setAttribute("style","display:none"),fillDecodedNodes(i,o),"undefined"!=typeof ctPublic&&ctPublic.encodedEmailNodesIsMixed&&a&&a.click()}),c.append(n),t.append(c))}},3e3);else if(a){let e="unknown_error";o.hasOwnProperty("data")&&0{e.encoded_email===c[n].dataset.originalString&&(t=e)}),!1===t.is_allowed)return;if(void 0===c[n].href||0!==c[n].href.indexOf("mailto:")&&0!==c[n].href.indexOf("tel:"))c[n].classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(t,c[n])},2e3);else{let e;if(0===c[n].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[n].href.indexOf("tel:"))continue;e="tel:"}var i=c[n].href.replace(e,""),a=c[n].innerHTML;c[n].innerHTML=a.replace(i,t.decoded_email),c[n].href=e+t.decoded_email,c[n].querySelectorAll("span.apbct-email-encoder").forEach(t=>{let n="";o.data.forEach(e=>{e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}c[n].removeEventListener("click",ctFillDecodedEmailHandler)}else{let e=o.data[0];c.classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(e,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}jQuery(document).ready(function(t){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),t="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+t}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap").css("display","inline-block"),jQuery("body").on("click",".apbct-notice .notice-dismiss-link",function(e){jQuery(e.target).parent().parent(".notice").after('

'+ctAdminCommon.apbctNoticeDismissSuccess+"

"),setTimeout(function(){jQuery("#apbct-notice-dismiss-success").fadeOut()},2e3),jQuery(e.target).parent().siblings(".apbct-notice .notice-dismiss").click()}),jQuery("body").on("click",".apbct-notice .notice-dismiss",function(e){e=jQuery(e.target).parent().attr("id");e&&apbct_admin_sendAJAX({action:"cleantalk_dismiss_notice",notice_id:e},{callback:null,notJson:!0})}),jQuery(".ct_username .row-actions .delete a").on("click",function(e){e.preventDefault(),confirm(ctAdminCommon.notice_when_deleting_user_text)&&(window.location=this.href)});let n=document.querySelector("#apbct_setting_forms__force_protection__On");var e;n&&n.addEventListener("click",function(e){n.checked&&!confirm(ctAdminCommon.apbctNoticeForceProtectionOn)&&e.preventDefault()}),t(".apbct-restore-spam-order-button").click(function(){var e=t(this).data("spam-order-id"),e={action:"apbct_restore_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};t.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){e.success?window.location.reload():alert(e.data.message)}})}),window.location.href.includes("options-general.php?page=cleantalk")&&(e=document.querySelector("[data-original-string]"))&&((ctAdminCommon.encodedEmailNode=e).style.cursor="pointer",e.addEventListener("click",ctFillDecodedEmailHandler))}),document.addEventListener("DOMContentLoaded",function(){var t=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=t),t.length)for(let e=0;e{e.encoded_email===a.dataset.originalString&&(t=e)}),e=t.decoded_email.split(/[&?]/)[0]}else e=o.data[0].decoded_email;var n=t.querySelector("#apbct_email_ecoder__popup_text_node_first"),c=document.createElement("b"),c=(c.setAttribute("class","apbct-email-encoder-select-whole-email"),c.innerText=e,"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_click_to_select?c.title=ctPublicFunctions.text__ee_click_to_select:c.title=ctAdminCommon.text__ee_click_to_select,n&&("undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_original_email?n.innerHTML=ctPublicFunctions.text__ee_original_email+" "+c.outerHTML:n.innerHTML=ctAdminCommon.text__ee_original_email+" "+c.outerHTML,n.setAttribute("style","flex-direction: row;")),t.querySelector(".apbct-ee-animation-wrapper")),n=(c&&c.remove(),t.querySelector("#apbct_email_ecoder__popup_text_node_second")),c=(n&&n.remove(),document.createElement("span"));c.classList="apbct-email-encoder-elements_center top-margin-long",document.querySelector(".apbct-email-encoder-got-it-button")||(n=document.createElement("button"),"undefined"!=typeof ctPublicFunctions&&ctPublicFunctions.text__ee_got_it?n.innerText=ctPublicFunctions.text__ee_got_it:n.innerText=ctAdminCommon.text__ee_got_it,n.classList="apbct-email-encoder-got-it-button",n.addEventListener("click",function(){document.body.classList.remove("apbct-popup-fade"),t.setAttribute("style","display:none"),fillDecodedNodes(i,o),"undefined"!=typeof ctPublic&&ctPublic.encodedEmailNodesIsMixed&&a&&a.click()}),c.append(n),t.append(c))}},3e3);else if(a){let e="unknown_error";o.hasOwnProperty("data")&&0{e.encoded_email===c[n].dataset.originalString&&(t=e)}),!1===t.is_allowed)return;if(void 0===c[n].href||0!==c[n].href.indexOf("mailto:")&&0!==c[n].href.indexOf("tel:"))c[n].classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(t,c[n])},2e3);else{let e;if(0===c[n].href.indexOf("mailto:"))e="mailto:";else{if(0!==c[n].href.indexOf("tel:"))continue;e="tel:"}var i=c[n].href.replace(e,""),a=c[n].innerHTML;c[n].innerHTML=a.replace(i,t.decoded_email),c[n].href=e+t.decoded_email,c[n].querySelectorAll("span.apbct-email-encoder").forEach(t=>{let n="";o.data.forEach(e=>{e.encoded_email===t.dataset.originalString&&(n=e.decoded_email)}),t.innerHTML=n})}c[n].removeEventListener("click",ctFillDecodedEmailHandler)}else{let e=o.data[0];c.classList.add("no-blur"),setTimeout(()=>{ctProcessDecodedDataResult(e,c)},2e3),c.removeEventListener("click",ctFillDecodedEmailHandler)}}function ctProcessDecodedDataResult(e,t){t.setAttribute("title",""),t.removeAttribute("style"),ctFillDecodedEmail(t,e.decoded_email)}function ctFillDecodedEmail(e,t){e.innerHTML=e.innerHTML.replace(/.+?(
)/,t+"$1")}jQuery(document).ready(function(t){jQuery(".apbct_update_notice").on("click","button",function(){var e=new Date((new Date).getTime()+2592e6),t="https:"===location.protocol?"; secure":"";document.cookie="apbct_update_banner_closed=1; path=/; expires="+e.toUTCString()+"; samesite=lax"+t}),jQuery('li a[href="options-general.php?page=cleantalk"]').css("white-space","nowrap").css("display","inline-block"),jQuery("body").on("click",".apbct-notice .notice-dismiss-link",function(e){jQuery(e.target).parent().parent(".notice").after('

'+ctAdminCommon.apbctNoticeDismissSuccess+"

"),setTimeout(function(){jQuery("#apbct-notice-dismiss-success").fadeOut()},2e3),jQuery(e.target).parent().siblings(".apbct-notice .notice-dismiss").click()}),jQuery("body").on("click",".apbct-notice .notice-dismiss",function(e){e=jQuery(e.target).parent().attr("id");e&&apbct_admin_sendAJAX({action:"cleantalk_dismiss_notice",notice_id:e},{callback:null,notJson:!0})}),jQuery(".ct_username .row-actions .delete a").on("click",function(e){e.preventDefault(),confirm(ctAdminCommon.notice_when_deleting_user_text)&&(window.location=this.href)});let n=document.querySelector("#apbct_setting_forms__force_protection__On");var e;n&&n.addEventListener("click",function(e){n.checked&&!confirm(ctAdminCommon.apbctNoticeForceProtectionOn)&&e.preventDefault()}),t(".apbct-restore-spam-order-button").click(function(){var e=t(this).data("spam-order-id"),e={action:"apbct_restore_spam_order",_ajax_nonce:ctAdminCommon._ajax_nonce,order_id:e};t.ajax({type:"POST",url:ctAdminCommon._ajax_url,data:e,success:function(e){e.success?window.location.reload():alert(e.data.message)}})}),window.location.href.includes("options-general.php?page=cleantalk")&&(e=document.querySelector("[data-original-string]"))&&((ctAdminCommon.encodedEmailNode=e).style.cursor="pointer",e.addEventListener("click",ctFillDecodedEmailHandler))}),document.addEventListener("DOMContentLoaded",function(){var t=document.querySelectorAll("[data-original-string]");if("undefined"!=typeof ctPublic&&(ctPublic.encodedEmailNodes=t),t.length)for(let e=0;e

' +\n ctAdminCommon.apbctNoticeDismissSuccess +\n '

');\n setTimeout(function() {\n jQuery('#apbct-notice-dismiss-success').fadeOut();\n }, 2000);\n jQuery(e.target).parent().siblings('.apbct-notice .notice-dismiss').click();\n });\n jQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e) {\n let apbctNoticeName = jQuery(e.target).parent().attr('id');\n if ( apbctNoticeName ) {\n apbct_admin_sendAJAX(\n {\n 'action': 'cleantalk_dismiss_notice',\n 'notice_id': apbctNoticeName,\n },\n {\n 'callback': null,\n 'notJson': true,\n },\n );\n }\n });\n\n // Notice when deleting user\n jQuery('.ct_username .row-actions .delete a').on('click', function(e) {\n e.preventDefault();\n\n let result = confirm(ctAdminCommon.notice_when_deleting_user_text);\n\n if (result) {\n window.location = this.href;\n }\n });\n\n let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On');\n if (btnForceProtectionOn) {\n btnForceProtectionOn.addEventListener('click', function(e) {\n if (btnForceProtectionOn.checked) {\n let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn);\n\n if (!result) {\n e.preventDefault();\n }\n }\n });\n }\n // Restore spam order\n $('.apbct-restore-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_restore_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n if (result.success) {\n window.location.reload();\n } else {\n alert(result.data.message);\n }\n },\n });\n });\n\n // Email decoder example\n if (window.location.href.includes('options-general.php?page=cleantalk')) {\n let encodedEmailNode = document.querySelector('[data-original-string]');\n if (encodedEmailNode) {\n ctAdminCommon.encodedEmailNode = encodedEmailNode;\n encodedEmailNode.style.cursor = 'pointer';\n encodedEmailNode.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n});\n// eslint-disable-next-line camelcase,require-jsdoc,no-unused-vars\nfunction apbct_admin_sendAJAX(data, params, obj) {\n // Default params\n let callback = params.callback || null;\n let callbackContext = params.callback_context || null;\n let callbackParams = params.callback_params || null;\n let async = params.async || true;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n var obj = obj || null; // eslint-disable-line no-var\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n\n if (typeof (data) === 'string') {\n data = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n } else {\n data._ajax_nonce = ctAdminCommon._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n async: async,\n success: function(result) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n if (!notJson) result = JSON.parse(result);\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n if ( typeof cleantalkModal !== 'undefined' ) {\n // Show the result by modal\n cleantalkModal.loaded = 'Error:
' + result.error.toString();\n cleantalkModal.open();\n } else {\n alert('Error happens: ' + (result.error || 'Unkown'));\n }\n } else {\n if (callback) {\n if (callbackParams) {\n callback.apply( callbackContext, callbackParams.concat( result, data, params, obj ) );\n } else {\n callback(result, data, params, obj);\n }\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log(errorThrown);\n },\n timeout: timeout,\n });\n}\n","/**\n * @return {HTMLElement} event\n */\nfunction apbctSetEmailDecoderPopupAnimation() {\n const animationElements = ['apbct_dog_one', 'apbct_dog_two', 'apbct_dog_three'];\n const animationWrapper = document.createElement('div');\n animationWrapper.classList = 'apbct-ee-animation-wrapper';\n for (let i = 0; i < animationElements.length; i++) {\n const apbctEEAnimationDogOne = document.createElement('span');\n apbctEEAnimationDogOne.classList = 'apbct_dog ' + animationElements[i];\n apbctEEAnimationDogOne.innerText = '@';\n animationWrapper.append(apbctEEAnimationDogOne);\n }\n return animationWrapper;\n}\n\n/**\n * @param {mixed} event\n */\nfunction ctFillDecodedEmailHandler(event = false) {\n let clickSource = false;\n let ctWlBrandname = '';\n let encodedEmail = '';\n if (typeof ctPublic !== 'undefined') {\n this.removeEventListener('click', ctFillDecodedEmailHandler);\n // remember clickSource\n clickSource = this;\n // globally remember if emails is mixed with mailto\n ctPublic.encodedEmailNodesIsMixed = false;\n ctWlBrandname = ctPublic.wl_brandname;\n encodedEmail = ctPublic.encodedEmailNodes;\n } else if (typeof ctAdminCommon !== 'undefined') {\n ctWlBrandname = ctAdminCommon.plugin_name;\n encodedEmail = ctAdminCommon.encodedEmailNode;\n }\n\n // get fade\n document.body.classList.add('apbct-popup-fade');\n // popup show\n let encoderPopup = document.getElementById('apbct_popup');\n if (!encoderPopup) {\n // construct popup\n let waitingPopup = document.createElement('div');\n waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup');\n waitingPopup.setAttribute('id', 'apbct_popup');\n\n // construct text header\n let popupHeaderWrapper = document.createElement('span');\n popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center';\n let popupHeader = document.createElement('p');\n popupHeader.innerText = ctWlBrandname;\n popupHeader.setAttribute('class', 'apbct-email-encoder--popup-header');\n popupHeaderWrapper.append(popupHeader);\n\n // construct text wrapper\n let popupTextWrapper = document.createElement('div');\n popupTextWrapper.setAttribute('id', 'apbct_popup_text');\n popupTextWrapper.setAttribute('class', 'apbct-email-encoder-elements_center');\n popupTextWrapper.style.color = 'black';\n\n // construct text first node\n // todo make translatable\n let popupTextWaiting = document.createElement('p');\n popupTextWaiting.id = 'apbct_email_ecoder__popup_text_node_first';\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) {\n popupTextWaiting.innerText = ctPublicFunctions.text__ee_wait_for_decoding;\n } else {\n popupTextWaiting.innerText = ctAdminCommon.text__ee_wait_for_decoding;\n }\n popupTextWaiting.setAttribute('class', 'apbct-email-encoder-elements_center');\n\n // construct text second node\n // todo make translatable\n let popupTextDecoding = document.createElement('p');\n popupTextDecoding.id = 'apbct_email_ecoder__popup_text_node_second';\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_decoding_process) {\n popupTextDecoding.innerText = ctPublicFunctions.text__ee_decoding_process;\n } else {\n popupTextDecoding.innerText = ctAdminCommon.text__ee_decoding_process;\n }\n\n // appending\n popupTextWrapper.append(popupTextWaiting);\n popupTextWrapper.append(popupTextDecoding);\n waitingPopup.append(popupHeaderWrapper);\n waitingPopup.append(popupTextWrapper);\n waitingPopup.append(apbctSetEmailDecoderPopupAnimation());\n document.body.append(waitingPopup);\n } else {\n encoderPopup.setAttribute('style', 'display: inherit');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) {\n document.getElementById('apbct_popup_text').innerHTML = ctPublicFunctions.text__ee_wait_for_decoding;\n } else {\n document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding;\n }\n }\n\n apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource);\n}\n\n/**\n * @param {mixed} event\n * @param {mixed} encodedEmailNodes\n * @param {mixed} clickSource\n */\nfunction apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) {\n if (event && clickSource) {\n // collect data\n let data = {\n post_url: document.location.href,\n referrer: document.referrer,\n encodedEmails: '',\n };\n if (ctPublic.settings__data__bot_detector_enabled == 1) {\n data.event_token = apbctLocalStorage.get('bot_detector_event_token');\n } else {\n data.event_javascript_data = getJavascriptClientData();\n }\n\n let encodedEmailsCollection = {};\n for (let i = 0; i < encodedEmailNodes.length; i++) {\n // disable click for mailto\n if (\n typeof encodedEmailNodes[i].href !== 'undefined' &&\n encodedEmailNodes[i].href.indexOf('mailto:') === 0\n ) {\n event.preventDefault();\n ctPublic.encodedEmailNodesIsMixed = true;\n }\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n apbct(encodedEmailNodes[i]).append(apbctTooltip);\n\n // collect encoded email strings\n encodedEmailsCollection[i] = encodedEmailNodes[i].dataset.originalString;\n }\n\n // JSONify encoded email strings\n data.encodedEmails = JSON.stringify(encodedEmailsCollection);\n\n // Using REST API handler\n if ( ctPublicFunctions.data__ajax_type === 'rest' ) {\n apbct_public_sendREST(\n 'apbct_decode_email',\n {\n data: data,\n method: 'POST',\n callback: function(result) {\n // set alternative cookie to skip next pages encoding\n ctSetCookie('apbct_email_encoder_passed', ctPublic.emailEncoderPassKey, '');\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource);\n },\n onErrorCallback: function(res) {\n resetEncodedNodes();\n ctShowDecodeComment(res);\n },\n },\n );\n\n // Using AJAX request and handler\n } else {\n data.action = 'apbct_decode_email';\n apbct_public_sendAJAX(\n data,\n {\n notJson: false,\n callback: function(result) {\n // set alternative cookie to skip next pages encoding\n ctSetCookie('apbct_email_encoder_passed', ctPublic.emailEncoderPassKey, '');\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource);\n },\n onErrorCallback: function(res) {\n resetEncodedNodes();\n ctShowDecodeComment(res);\n },\n },\n );\n }\n } else {\n const encodedEmail = encodedEmailNodes.dataset.originalString;\n let data = {\n encodedEmails: JSON.stringify({0: encodedEmail}),\n };\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n encodedEmailNodes.appendChild(apbctTooltip);\n\n apbct_admin_sendAJAX(\n {\n 'action': 'apbct_decode_email',\n 'encodedEmails': data.encodedEmails,\n },\n {\n 'callback': function(result) {\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, false);\n },\n 'notJson': true,\n },\n );\n }\n}\n\n/**\n * @param {mixed} result\n * @param {mixed} encodedEmailNodes\n * @param {mixed} clickSource\n */\nfunction apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = false) {\n if (result.success && result.data[0].is_allowed === true) {\n // start process of visual decoding\n setTimeout(function() {\n // popup remove\n let popup = document.getElementById('apbct_popup');\n if (popup !== null) {\n let email = '';\n if (clickSource) {\n let currentResultData;\n result.data.forEach((row) => {\n if (row.encoded_email === clickSource.dataset.originalString) {\n currentResultData = row;\n }\n });\n\n email = currentResultData.decoded_email.split(/[&?]/)[0];\n } else {\n email = result.data[0].decoded_email;\n }\n // handle first node\n let firstNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_first');\n // get email selectable by click\n let selectableEmail = document.createElement('b');\n selectableEmail.setAttribute('class', 'apbct-email-encoder-select-whole-email');\n selectableEmail.innerText = email;\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_click_to_select) {\n selectableEmail.title = ctPublicFunctions.text__ee_click_to_select;\n } else {\n selectableEmail.title = ctAdminCommon.text__ee_click_to_select;\n }\n // add email to the first node\n if (firstNode) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_original_email) {\n firstNode.innerHTML = ctPublicFunctions.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n } else {\n firstNode.innerHTML = ctAdminCommon.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n }\n\n firstNode.setAttribute('style', 'flex-direction: row;');\n }\n // remove animation\n let wrapper = popup.querySelector('.apbct-ee-animation-wrapper');\n if (wrapper) {\n wrapper.remove();\n }\n // remove second node\n let secondNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_second');\n if (secondNode) {\n secondNode.remove();\n }\n // add button\n let buttonWrapper = document.createElement('span');\n buttonWrapper.classList = 'apbct-email-encoder-elements_center top-margin-long';\n if (!document.querySelector('.apbct-email-encoder-got-it-button')) {\n let button = document.createElement('button');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_got_it) {\n button.innerText = ctPublicFunctions.text__ee_got_it;\n } else {\n button.innerText = ctAdminCommon.text__ee_got_it;\n }\n button.classList = 'apbct-email-encoder-got-it-button';\n button.addEventListener('click', function() {\n document.body.classList.remove('apbct-popup-fade');\n popup.setAttribute('style', 'display:none');\n fillDecodedNodes(encodedEmailNodes, result);\n // click on mailto if so\n if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) {\n clickSource.click();\n }\n });\n buttonWrapper.append(button);\n popup.append(buttonWrapper);\n }\n }\n }, 3000);\n } else {\n if (clickSource) {\n let comment = 'unknown_error';\n if (\n result.hasOwnProperty('data') &&\n result.data.length > 0 &&\n typeof result.data[0] === 'object' &&\n typeof result.data[0].comment === 'string'\n ) {\n comment = result.data[0].comment;\n }\n if (result.success) {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_blocked) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_blocked + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_blocked + ': ' + comment);\n }\n } else {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_connect) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_cannot_connect + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_cannot_connect + ': ' + comment);\n }\n }\n } else {\n console.log('result', result);\n }\n }\n}\n\n/**\n * Reset click event for encoded email\n */\nfunction resetEncodedNodes() {\n if (typeof ctPublic.encodedEmailNodes !== 'undefined') {\n ctPublic.encodedEmailNodes.forEach(function(element) {\n element.addEventListener('click', ctFillDecodedEmailHandler);\n });\n }\n}\n\n/**\n * Show Decode Comment\n * @param {string} comment\n */\nfunction ctShowDecodeComment(comment) {\n if ( ! comment ) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_decode) {\n comment = ctPublicFunctions.text__ee_cannot_decode;\n } else {\n comment = ctAdminCommon.text__ee_cannot_decode;\n }\n }\n\n let popup = document.getElementById('apbct_popup');\n let popupText = document.getElementById('apbct_popup_text');\n if (popup !== null) {\n document.body.classList.remove('apbct-popup-fade');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) {\n popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment;\n } else {\n popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment;\n }\n setTimeout(function() {\n popup.setAttribute('style', 'display:none');\n }, 3000);\n }\n}\n\n/**\n * Run filling for every node with decoding result.\n * @param {mixed} encodedNodes\n * @param {mixed} decodingResult\n */\nfunction fillDecodedNodes(encodedNodes, decodingResult) {\n if (encodedNodes.length > 0) {\n for (let i = 0; i < encodedNodes.length; i++) {\n // chek what is what\n let currentResultData;\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === encodedNodes[i].dataset.originalString) {\n currentResultData = row;\n }\n });\n // quit case on cloud block\n if (currentResultData.is_allowed === false) {\n return;\n }\n // handler for mailto\n if (\n typeof encodedNodes[i].href !== 'undefined' &&\n (\n encodedNodes[i].href.indexOf('mailto:') === 0 ||\n encodedNodes[i].href.indexOf('tel:') === 0\n )\n ) {\n let linkTypePrefix;\n if (encodedNodes[i].href.indexOf('mailto:') === 0) {\n linkTypePrefix = 'mailto:';\n } else if (encodedNodes[i].href.indexOf('tel:') === 0) {\n linkTypePrefix = 'tel:';\n } else {\n continue;\n }\n let encodedEmail = encodedNodes[i].href.replace(linkTypePrefix, '');\n let baseElementContent = encodedNodes[i].innerHTML;\n encodedNodes[i].innerHTML = baseElementContent.replace(\n encodedEmail,\n currentResultData.decoded_email,\n );\n encodedNodes[i].href = linkTypePrefix + currentResultData.decoded_email;\n\n encodedNodes[i].querySelectorAll('span.apbct-email-encoder').forEach((el) => {\n let encodedEmailTextInsideMailto = '';\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === el.dataset.originalString) {\n encodedEmailTextInsideMailto = row.decoded_email;\n }\n });\n el.innerHTML = encodedEmailTextInsideMailto;\n });\n } else {\n encodedNodes[i].classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes[i]);\n }, 2000);\n }\n // remove listeners\n encodedNodes[i].removeEventListener('click', ctFillDecodedEmailHandler);\n }\n } else {\n let currentResultData = decodingResult.data[0];\n encodedNodes.classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes);\n }, 2000);\n encodedNodes.removeEventListener('click', ctFillDecodedEmailHandler);\n }\n}\n\n/**\n * @param {mixed} response\n * @param {mixed} targetElement\n */\nfunction ctProcessDecodedDataResult(response, targetElement) {\n targetElement.setAttribute('title', '');\n targetElement.removeAttribute('style');\n ctFillDecodedEmail(targetElement, response.decoded_email);\n}\n\n/**\n * @param {mixed} target\n * @param {string} email\n */\nfunction ctFillDecodedEmail(target, email) {\n target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1');\n}\n\n// Listen clicks on encoded emails\ndocument.addEventListener('DOMContentLoaded', function() {\n let encodedEmailNodes = document.querySelectorAll('[data-original-string]');\n if (typeof ctPublic !== 'undefined') {\n ctPublic.encodedEmailNodes = encodedEmailNodes;\n }\n if (encodedEmailNodes.length) {\n for (let i = 0; i < encodedEmailNodes.length; ++i) {\n const node = encodedEmailNodes[i];\n if (\n node.parentNode &&\n node.parentNode.tagName === 'A' &&\n node.parentNode.getAttribute('href')?.includes('mailto:') &&\n node.parentNode.hasAttribute('data-original-string')\n ) {\n // This node was skipped from listeners\n continue;\n }\n node.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n});\n"]} \ No newline at end of file +{"version":3,"sources":["cleantalk-admin.js","common-decoder.js"],"names":["apbct_admin_sendAJAX","data","params","obj","let","callback","callbackContext","callback_context","callbackParams","callback_params","async","notJson","timeout","button","spinner","progressbar","ctAdminCommon","_ajax_nonce","Math","random","no_cache","setAttribute","style","cursor","jQuery","css","ajax","type","url","_ajax_url","success","result","removeAttribute","JSON","parse","error","setTimeout","fadeOut","cleantalkModal","loaded","toString","open","alert","apply","concat","jqXHR","textStatus","errorThrown","console","log","apbctSetEmailDecoderPopupAnimation","animationElements","animationWrapper","document","createElement","classList","i","length","apbctEEAnimationDogOne","innerText","append","ctFillDecodedEmailHandler","event","clickSource","ctWlBrandname","encodedEmail","ctPublic","this","removeEventListener","encodedEmailNodesIsMixed","wl_brandname","encodedEmailNodes","plugin_name","encodedEmailNode","body","add","popupHeaderWrapper","popupTextWrapper","popupTextWaiting","popupTextDecoding","encoderPopup","getElementById","ctPublicFunctions","text__ee_wait_for_decoding","innerHTML","waitingPopup","popupHeader","color","id","text__ee_decoding_process","apbctAjaxEmailDecodeBulk","post_url","location","href","referrer","encodedEmails","encodedEmailsCollection","bot_detector_enabled","event_token","apbctLocalStorage","get","event_javascript_data","getJavascriptClientData","indexOf","preventDefault","apbctTooltip","apbct","dataset","originalString","stringify","data__ajax_type","apbct_public_sendREST","method","ctSetCookie","emailEncoderPassKey","apbctEmailEncoderCallbackBulk","onErrorCallback","res","resetEncodedNodes","ctShowDecodeComment","action","apbct_public_sendAJAX","0","appendChild","is_allowed","popup","email","currentResultData","forEach","row","encoded_email","decoded_email","split","firstNode","querySelector","selectableEmail","wrapper","text__ee_click_to_select","title","text__ee_original_email","outerHTML","secondNode","remove","buttonWrapper","text__ee_got_it","addEventListener","fillDecodedNodes","click","comment","hasOwnProperty","text__ee_blocked","text__ee_cannot_connect","element","text__ee_cannot_decode","popupText","text__ee_email_decoder","encodedNodes","decodingResult","ctProcessDecodedDataResult","linkTypePrefix","replace","baseElementContent","querySelectorAll","encodedEmailTextInsideMailto","el","response","targetElement","ctFillDecodedEmail","target","ready","$","on","ctDate","Date","getTime","ctSecure","protocol","cookie","toUTCString","e","parent","after","apbctNoticeDismissSuccess","siblings","apbctNoticeName","attr","notice_id","confirm","notice_when_deleting_user_text","window","btnForceProtectionOn","checked","apbctNoticeForceProtectionOn","spmOrderId","order_id","reload","message","includes","node","parentNode","tagName","getA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A7I,IAAAmE,EAAAlB,SAAA6G,iBAAA,wBAAA,EAIA,GAHA,aAAA,OAAAhG,WACAA,SAAAK,kBAAAA,GAEAA,EAAAd,OACA,IAAArD,IAAAoD,EAAA,EAAAA,EAAAe,EAAAd,OAAA,EAAAD,EAAA,CACA,IAAA8I,EAAA/H,EAAAf,GAEA8I,EAAAC,YACA,MAAAD,EAAAC,WAAAC,SACAF,EAAAC,WAAAE,aAAA,MAAA,GAAAJ,SAAA,SAAA,GACAC,EAAAC,WAAAG,aAAA,sBAAA,GAKAJ,EAAArD,iBAAA,QAAApF,yBAAA,CACA,CAEA,CAAA","file":"cleantalk-admin.min.js","sourcesContent":["jQuery(document).ready(function($) {\n // Auto update banner close handler\n jQuery('.apbct_update_notice').on('click', 'button', function() {\n let ctDate = new Date(new Date().getTime() + 1000 * 86400 * 30 );\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = 'apbct_update_banner_closed=1; path=/; expires=' +\n ctDate.toUTCString() + '; samesite=lax' + ctSecure;\n });\n\n jQuery('li a[href=\"options-general.php?page=cleantalk\"]').css('white-space', 'nowrap')\n .css('display', 'inline-block');\n\n jQuery('body').on('click', '.apbct-notice .notice-dismiss-link', function(e) {\n jQuery(e.target).parent()\n .parent('.notice')\n .after('

' +\n ctAdminCommon.apbctNoticeDismissSuccess +\n '

');\n setTimeout(function() {\n jQuery('#apbct-notice-dismiss-success').fadeOut();\n }, 2000);\n jQuery(e.target).parent().siblings('.apbct-notice .notice-dismiss').click();\n });\n jQuery('body').on('click', '.apbct-notice .notice-dismiss', function(e) {\n let apbctNoticeName = jQuery(e.target).parent().attr('id');\n if ( apbctNoticeName ) {\n apbct_admin_sendAJAX(\n {\n 'action': 'cleantalk_dismiss_notice',\n 'notice_id': apbctNoticeName,\n },\n {\n 'callback': null,\n 'notJson': true,\n },\n );\n }\n });\n\n // Notice when deleting user\n jQuery('.ct_username .row-actions .delete a').on('click', function(e) {\n e.preventDefault();\n\n let result = confirm(ctAdminCommon.notice_when_deleting_user_text);\n\n if (result) {\n window.location = this.href;\n }\n });\n\n let btnForceProtectionOn = document.querySelector('#apbct_setting_forms__force_protection__On');\n if (btnForceProtectionOn) {\n btnForceProtectionOn.addEventListener('click', function(e) {\n if (btnForceProtectionOn.checked) {\n let result = confirm(ctAdminCommon.apbctNoticeForceProtectionOn);\n\n if (!result) {\n e.preventDefault();\n }\n }\n });\n }\n // Restore spam order\n $('.apbct-restore-spam-order-button').click(function() {\n const spmOrderId = $(this).data('spam-order-id');\n let data = {\n action: 'apbct_restore_spam_order',\n _ajax_nonce: ctAdminCommon._ajax_nonce,\n order_id: spmOrderId,\n };\n $.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n success: function(result) {\n if (result.success) {\n window.location.reload();\n } else {\n alert(result.data.message);\n }\n },\n });\n });\n\n // Email decoder example\n if (window.location.href.includes('options-general.php?page=cleantalk')) {\n let encodedEmailNode = document.querySelector('[data-original-string]');\n if (encodedEmailNode) {\n ctAdminCommon.encodedEmailNode = encodedEmailNode;\n encodedEmailNode.style.cursor = 'pointer';\n encodedEmailNode.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n});\n// eslint-disable-next-line camelcase,require-jsdoc,no-unused-vars\nfunction apbct_admin_sendAJAX(data, params, obj) {\n // Default params\n let callback = params.callback || null;\n let callbackContext = params.callback_context || null;\n let callbackParams = params.callback_params || null;\n let async = params.async || true;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n var obj = obj || null; // eslint-disable-line no-var\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n\n if (typeof (data) === 'string') {\n data = data + '&_ajax_nonce=' + ctAdminCommon._ajax_nonce + '&no_cache=' + Math.random();\n } else {\n data._ajax_nonce = ctAdminCommon._ajax_nonce;\n data.no_cache = Math.random();\n }\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) jQuery(spinner).css('display', 'inline');\n\n jQuery.ajax({\n type: 'POST',\n url: ctAdminCommon._ajax_url,\n data: data,\n async: async,\n success: function(result) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n if (!notJson) result = JSON.parse(result);\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n if ( typeof cleantalkModal !== 'undefined' ) {\n // Show the result by modal\n cleantalkModal.loaded = 'Error:
' + result.error.toString();\n cleantalkModal.open();\n } else {\n alert('Error happens: ' + (result.error || 'Unkown'));\n }\n } else {\n if (callback) {\n if (callbackParams) {\n callback.apply( callbackContext, callbackParams.concat( result, data, params, obj ) );\n } else {\n callback(result, data, params, obj);\n }\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled'); button.style.cursor = 'pointer';\n }\n if (spinner) jQuery(spinner).css('display', 'none');\n console.log('APBCT_AJAX_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log(errorThrown);\n },\n timeout: timeout,\n });\n}\n","/**\n * @return {HTMLElement} event\n */\nfunction apbctSetEmailDecoderPopupAnimation() {\n const animationElements = ['apbct_dog_one', 'apbct_dog_two', 'apbct_dog_three'];\n const animationWrapper = document.createElement('div');\n animationWrapper.classList = 'apbct-ee-animation-wrapper';\n for (let i = 0; i < animationElements.length; i++) {\n const apbctEEAnimationDogOne = document.createElement('span');\n apbctEEAnimationDogOne.classList = 'apbct_dog ' + animationElements[i];\n apbctEEAnimationDogOne.innerText = '@';\n animationWrapper.append(apbctEEAnimationDogOne);\n }\n return animationWrapper;\n}\n\n/**\n * @param {mixed} event\n */\nfunction ctFillDecodedEmailHandler(event = false) {\n let clickSource = false;\n let ctWlBrandname = '';\n let encodedEmail = '';\n if (typeof ctPublic !== 'undefined') {\n this.removeEventListener('click', ctFillDecodedEmailHandler);\n // remember clickSource\n clickSource = this;\n // globally remember if emails is mixed with mailto\n ctPublic.encodedEmailNodesIsMixed = false;\n ctWlBrandname = ctPublic.wl_brandname;\n encodedEmail = ctPublic.encodedEmailNodes;\n } else if (typeof ctAdminCommon !== 'undefined') {\n ctWlBrandname = ctAdminCommon.plugin_name;\n encodedEmail = ctAdminCommon.encodedEmailNode;\n }\n\n // get fade\n document.body.classList.add('apbct-popup-fade');\n // popup show\n let encoderPopup = document.getElementById('apbct_popup');\n if (!encoderPopup) {\n // construct popup\n let waitingPopup = document.createElement('div');\n waitingPopup.setAttribute('class', 'apbct-popup apbct-email-encoder-popup');\n waitingPopup.setAttribute('id', 'apbct_popup');\n\n // construct text header\n let popupHeaderWrapper = document.createElement('span');\n popupHeaderWrapper.classList = 'apbct-email-encoder-elements_center';\n let popupHeader = document.createElement('p');\n popupHeader.innerText = ctWlBrandname;\n popupHeader.setAttribute('class', 'apbct-email-encoder--popup-header');\n popupHeaderWrapper.append(popupHeader);\n\n // construct text wrapper\n let popupTextWrapper = document.createElement('div');\n popupTextWrapper.setAttribute('id', 'apbct_popup_text');\n popupTextWrapper.setAttribute('class', 'apbct-email-encoder-elements_center');\n popupTextWrapper.style.color = 'black';\n\n // construct text first node\n // todo make translatable\n let popupTextWaiting = document.createElement('p');\n popupTextWaiting.id = 'apbct_email_ecoder__popup_text_node_first';\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) {\n popupTextWaiting.innerText = ctPublicFunctions.text__ee_wait_for_decoding;\n } else {\n popupTextWaiting.innerText = ctAdminCommon.text__ee_wait_for_decoding;\n }\n popupTextWaiting.setAttribute('class', 'apbct-email-encoder-elements_center');\n\n // construct text second node\n // todo make translatable\n let popupTextDecoding = document.createElement('p');\n popupTextDecoding.id = 'apbct_email_ecoder__popup_text_node_second';\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_decoding_process) {\n popupTextDecoding.innerText = ctPublicFunctions.text__ee_decoding_process;\n } else {\n popupTextDecoding.innerText = ctAdminCommon.text__ee_decoding_process;\n }\n\n // appending\n popupTextWrapper.append(popupTextWaiting);\n popupTextWrapper.append(popupTextDecoding);\n waitingPopup.append(popupHeaderWrapper);\n waitingPopup.append(popupTextWrapper);\n waitingPopup.append(apbctSetEmailDecoderPopupAnimation());\n document.body.append(waitingPopup);\n } else {\n encoderPopup.setAttribute('style', 'display: inherit');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_wait_for_decoding) {\n document.getElementById('apbct_popup_text').innerHTML = ctPublicFunctions.text__ee_wait_for_decoding;\n } else {\n document.getElementById('apbct_popup_text').innerHTML = ctAdminCommon.text__ee_wait_for_decoding;\n }\n }\n\n apbctAjaxEmailDecodeBulk(event, encodedEmail, clickSource);\n}\n\n/**\n * @param {mixed} event\n * @param {mixed} encodedEmailNodes\n * @param {mixed} clickSource\n */\nfunction apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) {\n if (event && clickSource) {\n // collect data\n let data = {\n post_url: document.location.href,\n referrer: document.referrer,\n encodedEmails: '',\n };\n if (+ctPublic.bot_detector_enabled) {\n data.event_token = apbctLocalStorage.get('bot_detector_event_token');\n } else {\n data.event_javascript_data = getJavascriptClientData();\n }\n\n let encodedEmailsCollection = {};\n for (let i = 0; i < encodedEmailNodes.length; i++) {\n // disable click for mailto\n if (\n typeof encodedEmailNodes[i].href !== 'undefined' &&\n encodedEmailNodes[i].href.indexOf('mailto:') === 0\n ) {\n event.preventDefault();\n ctPublic.encodedEmailNodesIsMixed = true;\n }\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n apbct(encodedEmailNodes[i]).append(apbctTooltip);\n\n // collect encoded email strings\n encodedEmailsCollection[i] = encodedEmailNodes[i].dataset.originalString;\n }\n\n // JSONify encoded email strings\n data.encodedEmails = JSON.stringify(encodedEmailsCollection);\n\n // Using REST API handler\n if ( ctPublicFunctions.data__ajax_type === 'rest' ) {\n apbct_public_sendREST(\n 'apbct_decode_email',\n {\n data: data,\n method: 'POST',\n callback: function(result) {\n // set alternative cookie to skip next pages encoding\n ctSetCookie('apbct_email_encoder_passed', ctPublic.emailEncoderPassKey, '');\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource);\n },\n onErrorCallback: function(res) {\n resetEncodedNodes();\n ctShowDecodeComment(res);\n },\n },\n );\n\n // Using AJAX request and handler\n } else {\n data.action = 'apbct_decode_email';\n apbct_public_sendAJAX(\n data,\n {\n notJson: false,\n callback: function(result) {\n // set alternative cookie to skip next pages encoding\n ctSetCookie('apbct_email_encoder_passed', ctPublic.emailEncoderPassKey, '');\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource);\n },\n onErrorCallback: function(res) {\n resetEncodedNodes();\n ctShowDecodeComment(res);\n },\n },\n );\n }\n } else {\n const encodedEmail = encodedEmailNodes.dataset.originalString;\n let data = {\n encodedEmails: JSON.stringify({0: encodedEmail}),\n };\n\n // Adding a tooltip\n let apbctTooltip = document.createElement('div');\n apbctTooltip.setAttribute('class', 'apbct-tooltip');\n encodedEmailNodes.appendChild(apbctTooltip);\n\n apbct_admin_sendAJAX(\n {\n 'action': 'apbct_decode_email',\n 'encodedEmails': data.encodedEmails,\n },\n {\n 'callback': function(result) {\n apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, false);\n },\n 'notJson': true,\n },\n );\n }\n}\n\n/**\n * @param {mixed} result\n * @param {mixed} encodedEmailNodes\n * @param {mixed} clickSource\n */\nfunction apbctEmailEncoderCallbackBulk(result, encodedEmailNodes, clickSource = false) {\n if (result.success && result.data[0].is_allowed === true) {\n // start process of visual decoding\n setTimeout(function() {\n // popup remove\n let popup = document.getElementById('apbct_popup');\n if (popup !== null) {\n let email = '';\n if (clickSource) {\n let currentResultData;\n result.data.forEach((row) => {\n if (row.encoded_email === clickSource.dataset.originalString) {\n currentResultData = row;\n }\n });\n\n email = currentResultData.decoded_email.split(/[&?]/)[0];\n } else {\n email = result.data[0].decoded_email;\n }\n // handle first node\n let firstNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_first');\n // get email selectable by click\n let selectableEmail = document.createElement('b');\n selectableEmail.setAttribute('class', 'apbct-email-encoder-select-whole-email');\n selectableEmail.innerText = email;\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_click_to_select) {\n selectableEmail.title = ctPublicFunctions.text__ee_click_to_select;\n } else {\n selectableEmail.title = ctAdminCommon.text__ee_click_to_select;\n }\n // add email to the first node\n if (firstNode) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_original_email) {\n firstNode.innerHTML = ctPublicFunctions.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n } else {\n firstNode.innerHTML = ctAdminCommon.text__ee_original_email +\n ' ' + selectableEmail.outerHTML;\n }\n\n firstNode.setAttribute('style', 'flex-direction: row;');\n }\n // remove animation\n let wrapper = popup.querySelector('.apbct-ee-animation-wrapper');\n if (wrapper) {\n wrapper.remove();\n }\n // remove second node\n let secondNode = popup.querySelector('#apbct_email_ecoder__popup_text_node_second');\n if (secondNode) {\n secondNode.remove();\n }\n // add button\n let buttonWrapper = document.createElement('span');\n buttonWrapper.classList = 'apbct-email-encoder-elements_center top-margin-long';\n if (!document.querySelector('.apbct-email-encoder-got-it-button')) {\n let button = document.createElement('button');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_got_it) {\n button.innerText = ctPublicFunctions.text__ee_got_it;\n } else {\n button.innerText = ctAdminCommon.text__ee_got_it;\n }\n button.classList = 'apbct-email-encoder-got-it-button';\n button.addEventListener('click', function() {\n document.body.classList.remove('apbct-popup-fade');\n popup.setAttribute('style', 'display:none');\n fillDecodedNodes(encodedEmailNodes, result);\n // click on mailto if so\n if (typeof ctPublic !== 'undefined' && ctPublic.encodedEmailNodesIsMixed && clickSource) {\n clickSource.click();\n }\n });\n buttonWrapper.append(button);\n popup.append(buttonWrapper);\n }\n }\n }, 3000);\n } else {\n if (clickSource) {\n let comment = 'unknown_error';\n if (\n result.hasOwnProperty('data') &&\n result.data.length > 0 &&\n typeof result.data[0] === 'object' &&\n typeof result.data[0].comment === 'string'\n ) {\n comment = result.data[0].comment;\n }\n if (result.success) {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_blocked) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_blocked + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_blocked + ': ' + comment);\n }\n } else {\n resetEncodedNodes();\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_connect) {\n ctShowDecodeComment(ctPublicFunctions.text__ee_cannot_connect + ': ' + comment);\n } else {\n ctShowDecodeComment(ctAdminCommon.text__ee_cannot_connect + ': ' + comment);\n }\n }\n } else {\n console.log('result', result);\n }\n }\n}\n\n/**\n * Reset click event for encoded email\n */\nfunction resetEncodedNodes() {\n if (typeof ctPublic.encodedEmailNodes !== 'undefined') {\n ctPublic.encodedEmailNodes.forEach(function(element) {\n element.addEventListener('click', ctFillDecodedEmailHandler);\n });\n }\n}\n\n/**\n * Show Decode Comment\n * @param {string} comment\n */\nfunction ctShowDecodeComment(comment) {\n if ( ! comment ) {\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_cannot_decode) {\n comment = ctPublicFunctions.text__ee_cannot_decode;\n } else {\n comment = ctAdminCommon.text__ee_cannot_decode;\n }\n }\n\n let popup = document.getElementById('apbct_popup');\n let popupText = document.getElementById('apbct_popup_text');\n if (popup !== null) {\n document.body.classList.remove('apbct-popup-fade');\n if (typeof ctPublicFunctions !== 'undefined' && ctPublicFunctions.text__ee_email_decoder) {\n popupText.innerText = ctPublicFunctions.text__ee_email_decoder + ': ' + comment;\n } else {\n popupText.innerText = ctAdminCommon.text__ee_email_decoder + ': ' + comment;\n }\n setTimeout(function() {\n popup.setAttribute('style', 'display:none');\n }, 3000);\n }\n}\n\n/**\n * Run filling for every node with decoding result.\n * @param {mixed} encodedNodes\n * @param {mixed} decodingResult\n */\nfunction fillDecodedNodes(encodedNodes, decodingResult) {\n if (encodedNodes.length > 0) {\n for (let i = 0; i < encodedNodes.length; i++) {\n // chek what is what\n let currentResultData;\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === encodedNodes[i].dataset.originalString) {\n currentResultData = row;\n }\n });\n // quit case on cloud block\n if (currentResultData.is_allowed === false) {\n return;\n }\n // handler for mailto\n if (\n typeof encodedNodes[i].href !== 'undefined' &&\n (\n encodedNodes[i].href.indexOf('mailto:') === 0 ||\n encodedNodes[i].href.indexOf('tel:') === 0\n )\n ) {\n let linkTypePrefix;\n if (encodedNodes[i].href.indexOf('mailto:') === 0) {\n linkTypePrefix = 'mailto:';\n } else if (encodedNodes[i].href.indexOf('tel:') === 0) {\n linkTypePrefix = 'tel:';\n } else {\n continue;\n }\n let encodedEmail = encodedNodes[i].href.replace(linkTypePrefix, '');\n let baseElementContent = encodedNodes[i].innerHTML;\n encodedNodes[i].innerHTML = baseElementContent.replace(\n encodedEmail,\n currentResultData.decoded_email,\n );\n encodedNodes[i].href = linkTypePrefix + currentResultData.decoded_email;\n\n encodedNodes[i].querySelectorAll('span.apbct-email-encoder').forEach((el) => {\n let encodedEmailTextInsideMailto = '';\n decodingResult.data.forEach((row) => {\n if (row.encoded_email === el.dataset.originalString) {\n encodedEmailTextInsideMailto = row.decoded_email;\n }\n });\n el.innerHTML = encodedEmailTextInsideMailto;\n });\n } else {\n encodedNodes[i].classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes[i]);\n }, 2000);\n }\n // remove listeners\n encodedNodes[i].removeEventListener('click', ctFillDecodedEmailHandler);\n }\n } else {\n let currentResultData = decodingResult.data[0];\n encodedNodes.classList.add('no-blur');\n // fill the nodes\n setTimeout(() => {\n ctProcessDecodedDataResult(currentResultData, encodedNodes);\n }, 2000);\n encodedNodes.removeEventListener('click', ctFillDecodedEmailHandler);\n }\n}\n\n/**\n * @param {mixed} response\n * @param {mixed} targetElement\n */\nfunction ctProcessDecodedDataResult(response, targetElement) {\n targetElement.setAttribute('title', '');\n targetElement.removeAttribute('style');\n ctFillDecodedEmail(targetElement, response.decoded_email);\n}\n\n/**\n * @param {mixed} target\n * @param {string} email\n */\nfunction ctFillDecodedEmail(target, email) {\n target.innerHTML = target.innerHTML.replace(/.+?(
)/, email + '$1');\n}\n\n// Listen clicks on encoded emails\ndocument.addEventListener('DOMContentLoaded', function() {\n let encodedEmailNodes = document.querySelectorAll('[data-original-string]');\n if (typeof ctPublic !== 'undefined') {\n ctPublic.encodedEmailNodes = encodedEmailNodes;\n }\n if (encodedEmailNodes.length) {\n for (let i = 0; i < encodedEmailNodes.length; ++i) {\n const node = encodedEmailNodes[i];\n if (\n node.parentNode &&\n node.parentNode.tagName === 'A' &&\n node.parentNode.getAttribute('href')?.includes('mailto:') &&\n node.parentNode.hasAttribute('data-original-string')\n ) {\n // This node was skipped from listeners\n continue;\n }\n node.addEventListener('click', ctFillDecodedEmailHandler);\n }\n }\n});\n"]} \ No newline at end of file diff --git a/js/prebuild/apbct-public-bundle.js b/js/prebuild/apbct-public-bundle.js index 73ae5bc18..0a7b347f3 100644 --- a/js/prebuild/apbct-public-bundle.js +++ b/js/prebuild/apbct-public-bundle.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -4478,8 +4543,8 @@ let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_ext-protection.js b/js/prebuild/apbct-public-bundle_ext-protection.js index fd5ea20e2..62e5157d3 100644 --- a/js/prebuild/apbct-public-bundle_ext-protection.js +++ b/js/prebuild/apbct-public-bundle_ext-protection.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -4541,7 +4606,7 @@ function ctProtectExternal() { // Trying to process external form into an iframe apbctProcessIframes(); // if form is still not processed by fields listening, do it here - if (ctPublic.settings__data__bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { + if (ctPublic.bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().startFieldsListening(); } } @@ -5053,7 +5118,7 @@ function ctProtectOutsideFunctionalHandler(entity, lsStorageName, lsUniqueName) ctAttachCoverCSSToHead(); entityParent.appendChild(ctProtectOutsideFunctionalGenerateCover()); let entitiesProtected = apbctLocalStorage.get(lsStorageName); - if (false === entitiesProtected) { + if (false === entitiesProtected || !Array.isArray(entitiesProtected)) { entitiesProtected = []; } if (lsUniqueName) { @@ -5818,8 +5883,8 @@ let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_ext-protection_gathering.js b/js/prebuild/apbct-public-bundle_ext-protection_gathering.js index 5312d70e8..fef752599 100644 --- a/js/prebuild/apbct-public-bundle_ext-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_ext-protection_gathering.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -4541,7 +4606,7 @@ function ctProtectExternal() { // Trying to process external form into an iframe apbctProcessIframes(); // if form is still not processed by fields listening, do it here - if (ctPublic.settings__data__bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { + if (ctPublic.bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().startFieldsListening(); } } @@ -5053,7 +5118,7 @@ function ctProtectOutsideFunctionalHandler(entity, lsStorageName, lsUniqueName) ctAttachCoverCSSToHead(); entityParent.appendChild(ctProtectOutsideFunctionalGenerateCover()); let entitiesProtected = apbctLocalStorage.get(lsStorageName); - if (false === entitiesProtected) { + if (false === entitiesProtected || !Array.isArray(entitiesProtected)) { entitiesProtected = []; } if (lsUniqueName) { @@ -6458,7 +6523,7 @@ function getJavascriptClientData(commonCookies = []) { // eslint-disable-line no * @return {bool} */ function ctIsDrawPixel() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -6472,7 +6537,7 @@ function ctIsDrawPixel() { * @return {bool} */ function ctSetPixelImg(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } ctSetCookie('apbct_pixel_url', pixelUrl); @@ -6494,7 +6559,7 @@ function ctSetPixelImg(pixelUrl) { * @return {bool} */ function ctSetPixelImgFromLocalstorage(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } if ( ctIsDrawPixel() ) { @@ -6516,7 +6581,7 @@ function ctSetPixelImgFromLocalstorage(pixelUrl) { */ // eslint-disable-next-line no-unused-vars, require-jsdoc function ctGetPixelUrl() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -6657,44 +6722,13 @@ function apbctCancelAutocomplete(element) { })); } -/** - * ctNoCookieAttachHiddenFieldsToForms - */ -function ctNoCookieAttachHiddenFieldsToForms() { - if (ctPublic.data__cookies_type !== 'none') { - return; - } - - let forms = ctGetPageForms(); - - if (forms) { - for ( let i = 0; i < forms.length; i++ ) { - if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { - continue; - } - - // ignore forms with get method @todo We need to think about this - if (document.forms[i].getAttribute('method') === null || - document.forms[i].getAttribute('method').toLowerCase() === 'post') { - // remove old sets - let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); - for ( let j = 0; j < fields.length; j++ ) { - fields[j].outerHTML = ''; - } - // add new set - document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); - } - } - } -} - let botDetectorLogLastUpdate = 0; let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_full-protection.js b/js/prebuild/apbct-public-bundle_full-protection.js index 7dbec8a1c..540d02791 100644 --- a/js/prebuild/apbct-public-bundle_full-protection.js +++ b/js/prebuild/apbct-public-bundle_full-protection.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -4541,7 +4606,7 @@ function ctProtectExternal() { // Trying to process external form into an iframe apbctProcessIframes(); // if form is still not processed by fields listening, do it here - if (ctPublic.settings__data__bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { + if (ctPublic.bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().startFieldsListening(); } } @@ -5053,7 +5118,7 @@ function ctProtectOutsideFunctionalHandler(entity, lsStorageName, lsUniqueName) ctAttachCoverCSSToHead(); entityParent.appendChild(ctProtectOutsideFunctionalGenerateCover()); let entitiesProtected = apbctLocalStorage.get(lsStorageName); - if (false === entitiesProtected) { + if (false === entitiesProtected || !Array.isArray(entitiesProtected)) { entitiesProtected = []; } if (lsUniqueName) { @@ -5849,7 +5914,7 @@ class ApbctForceProtection { post_url: document.location.href, referrer: document.referrer, }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -6062,8 +6127,8 @@ let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_full-protection_gathering.js b/js/prebuild/apbct-public-bundle_full-protection_gathering.js index a0044256c..9c2172c89 100644 --- a/js/prebuild/apbct-public-bundle_full-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_full-protection_gathering.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -4541,7 +4606,7 @@ function ctProtectExternal() { // Trying to process external form into an iframe apbctProcessIframes(); // if form is still not processed by fields listening, do it here - if (ctPublic.settings__data__bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { + if (ctPublic.bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().startFieldsListening(); } } @@ -5053,7 +5118,7 @@ function ctProtectOutsideFunctionalHandler(entity, lsStorageName, lsUniqueName) ctAttachCoverCSSToHead(); entityParent.appendChild(ctProtectOutsideFunctionalGenerateCover()); let entitiesProtected = apbctLocalStorage.get(lsStorageName); - if (false === entitiesProtected) { + if (false === entitiesProtected || !Array.isArray(entitiesProtected)) { entitiesProtected = []; } if (lsUniqueName) { @@ -5849,7 +5914,7 @@ class ApbctForceProtection { post_url: document.location.href, referrer: document.referrer, }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -6598,7 +6663,7 @@ function getJavascriptClientData(commonCookies = []) { // eslint-disable-line no * @return {bool} */ function ctIsDrawPixel() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -6612,7 +6677,7 @@ function ctIsDrawPixel() { * @return {bool} */ function ctSetPixelImg(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } ctSetCookie('apbct_pixel_url', pixelUrl); @@ -6634,7 +6699,7 @@ function ctSetPixelImg(pixelUrl) { * @return {bool} */ function ctSetPixelImgFromLocalstorage(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } if ( ctIsDrawPixel() ) { @@ -6656,7 +6721,7 @@ function ctSetPixelImgFromLocalstorage(pixelUrl) { */ // eslint-disable-next-line no-unused-vars, require-jsdoc function ctGetPixelUrl() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -6797,37 +6862,6 @@ function apbctCancelAutocomplete(element) { })); } -/** - * ctNoCookieAttachHiddenFieldsToForms - */ -function ctNoCookieAttachHiddenFieldsToForms() { - if (ctPublic.data__cookies_type !== 'none') { - return; - } - - let forms = ctGetPageForms(); - - if (forms) { - for ( let i = 0; i < forms.length; i++ ) { - if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { - continue; - } - - // ignore forms with get method @todo We need to think about this - if (document.forms[i].getAttribute('method') === null || - document.forms[i].getAttribute('method').toLowerCase() === 'post') { - // remove old sets - let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); - for ( let j = 0; j < fields.length; j++ ) { - fields[j].outerHTML = ''; - } - // add new set - document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); - } - } - } -} - /** * Check form as internal. * @param {int} currForm Current form. @@ -6937,8 +6971,8 @@ let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_gathering.js b/js/prebuild/apbct-public-bundle_gathering.js index 3de1a78b1..72777fb64 100644 --- a/js/prebuild/apbct-public-bundle_gathering.js +++ b/js/prebuild/apbct-public-bundle_gathering.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -5118,7 +5183,7 @@ function getJavascriptClientData(commonCookies = []) { // eslint-disable-line no * @return {bool} */ function ctIsDrawPixel() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -5132,7 +5197,7 @@ function ctIsDrawPixel() { * @return {bool} */ function ctSetPixelImg(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } ctSetCookie('apbct_pixel_url', pixelUrl); @@ -5154,7 +5219,7 @@ function ctSetPixelImg(pixelUrl) { * @return {bool} */ function ctSetPixelImgFromLocalstorage(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } if ( ctIsDrawPixel() ) { @@ -5176,7 +5241,7 @@ function ctSetPixelImgFromLocalstorage(pixelUrl) { */ // eslint-disable-next-line no-unused-vars, require-jsdoc function ctGetPixelUrl() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -5317,44 +5382,13 @@ function apbctCancelAutocomplete(element) { })); } -/** - * ctNoCookieAttachHiddenFieldsToForms - */ -function ctNoCookieAttachHiddenFieldsToForms() { - if (ctPublic.data__cookies_type !== 'none') { - return; - } - - let forms = ctGetPageForms(); - - if (forms) { - for ( let i = 0; i < forms.length; i++ ) { - if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { - continue; - } - - // ignore forms with get method @todo We need to think about this - if (document.forms[i].getAttribute('method') === null || - document.forms[i].getAttribute('method').toLowerCase() === 'post') { - // remove old sets - let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); - for ( let j = 0; j < fields.length; j++ ) { - fields[j].outerHTML = ''; - } - // add new set - document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); - } - } - } -} - let botDetectorLogLastUpdate = 0; let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_int-protection.js b/js/prebuild/apbct-public-bundle_int-protection.js index 1e86ac0cc..3150a4902 100644 --- a/js/prebuild/apbct-public-bundle_int-protection.js +++ b/js/prebuild/apbct-public-bundle_int-protection.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -4582,8 +4647,8 @@ let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/prebuild/apbct-public-bundle_int-protection_gathering.js b/js/prebuild/apbct-public-bundle_int-protection_gathering.js index 0136a312d..49728d72c 100644 --- a/js/prebuild/apbct-public-bundle_int-protection_gathering.js +++ b/js/prebuild/apbct-public-bundle_int-protection_gathering.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); @@ -1924,7 +1924,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -2010,6 +2010,7 @@ class ApbctFetchProxyProtection { return await this.checkRequest(match.formKey, match.config, bodyText); } } + /** * Set init params */ @@ -2147,9 +2148,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -2185,7 +2184,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -2401,10 +2400,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -2547,6 +2548,37 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + /** * Class for event token transport @@ -2642,7 +2674,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -2712,7 +2744,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -3027,7 +3059,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -3097,7 +3129,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3114,7 +3146,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -3172,7 +3204,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -3332,7 +3364,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -3348,14 +3380,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -3369,7 +3401,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -3377,6 +3409,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -3537,6 +3598,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -3616,7 +3682,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -3699,7 +3765,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -3758,21 +3824,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -3780,7 +3846,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -4344,9 +4410,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -4355,7 +4420,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -4374,7 +4439,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -4396,7 +4461,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -4405,7 +4470,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -4432,7 +4497,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -4452,7 +4517,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } @@ -5222,7 +5287,7 @@ function getJavascriptClientData(commonCookies = []) { // eslint-disable-line no * @return {bool} */ function ctIsDrawPixel() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -5236,7 +5301,7 @@ function ctIsDrawPixel() { * @return {bool} */ function ctSetPixelImg(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } ctSetCookie('apbct_pixel_url', pixelUrl); @@ -5258,7 +5323,7 @@ function ctSetPixelImg(pixelUrl) { * @return {bool} */ function ctSetPixelImgFromLocalstorage(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } if ( ctIsDrawPixel() ) { @@ -5280,7 +5345,7 @@ function ctSetPixelImgFromLocalstorage(pixelUrl) { */ // eslint-disable-next-line no-unused-vars, require-jsdoc function ctGetPixelUrl() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -5421,44 +5486,13 @@ function apbctCancelAutocomplete(element) { })); } -/** - * ctNoCookieAttachHiddenFieldsToForms - */ -function ctNoCookieAttachHiddenFieldsToForms() { - if (ctPublic.data__cookies_type !== 'none') { - return; - } - - let forms = ctGetPageForms(); - - if (forms) { - for ( let i = 0; i < forms.length; i++ ) { - if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { - continue; - } - - // ignore forms with get method @todo We need to think about this - if (document.forms[i].getAttribute('method') === null || - document.forms[i].getAttribute('method').toLowerCase() === 'post') { - // remove old sets - let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); - for ( let j = 0; j < fields.length; j++ ) { - fields[j].outerHTML = ''; - } - // add new set - document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); - } - } - } -} - let botDetectorLogLastUpdate = 0; let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/js/public-2-gathering-data.min.js b/js/public-2-gathering-data.min.js index 6807272b9..22402fcd2 100644 --- a/js/public-2-gathering-data.min.js +++ b/js/public-2-gathering-data.min.js @@ -1,2 +1,2 @@ -class ApbctGatheringData{setSessionId(){var t;apbctSessionStorage.isSet("apbct_session_id")?apbctLocalStorage.set("apbct_page_hits",Number(apbctLocalStorage.get("apbct_page_hits"))+1):(t=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),apbctSessionStorage.set("apbct_session_id",t,!1),apbctLocalStorage.set("apbct_page_hits",1),document.referrer&&new URL(document.referrer).host!==location.host&&apbctSessionStorage.set("apbct_site_referer",document.referrer,!1))}writeReferrersToSessionStorage(){var t=apbctSessionStorage.get("apbct_session_current_page");!1!==t&&document.location.href!==t&&apbctSessionStorage.set("apbct_prev_referer",t,!1),apbctSessionStorage.set("apbct_session_current_page",document.location.href,!1)}setCookiesType(){var t=apbctLocalStorage.get("ct_cookies_type");t&&t===ctPublic.data__cookies_type||(apbctLocalStorage.set("ct_cookies_type",ctPublic.data__cookies_type),apbctLocalStorage.delete("ct_mouse_moved"),apbctLocalStorage.delete("ct_has_scrolled"))}startFieldsListening(){"alternative"!==ctPublic.data__cookies_type&&(this.startFieldsListening(),setTimeout(this.startFieldsListening,1e3))}listenAutocomplete(){window.addEventListener("animationstart",this.apbctOnAnimationStart,!0),window.addEventListener("input",this.apbctOnInput,!0)}gatheringTypoData(){document.ctTypoData=new CTTypoData,document.ctTypoData.gatheringFields(),document.ctTypoData.setListeners()}gatheringMouseData(){new ApbctCollectingUserMouseActivity}getScreenInfo(){var t=document.documentElement,e=document.body,e={scrollWidth:t.scrollWidth,bodyScrollHeight:e.scrollHeight,docScrollHeight:t.scrollHeight,bodyOffsetHeight:e.offsetHeight,docOffsetHeight:t.offsetHeight,bodyClientHeight:e.clientHeight,docClientHeight:t.clientHeight,docClientWidth:t.clientWidth};return JSON.stringify({fullWidth:e.scrollWidth,fullHeight:Math.max(e.bodyScrollHeight,e.docScrollHeight,e.bodyOffsetHeight,e.docOffsetHeight,e.bodyClientHeight,e.docClientHeight),visibleWidth:e.docClientWidth,visibleHeight:e.docClientHeight})}restartFieldsListening(){apbctLocalStorage.isSet("ct_has_input_focused")||apbctLocalStorage.isSet("ct_has_key_up")||this.startFieldsListening()}startFieldsListening(){if(!apbctLocalStorage.isSet("ct_has_key_up")&&!apbctLocalStorage.get("ct_has_key_up")||!apbctLocalStorage.isSet("ct_has_input_focused")&&!apbctLocalStorage.get("ct_has_input_focused")||"native"!==ctPublic.data__cookies_type||void 0===ctGetCookie("ct_has_input_focused")||void 0===ctGetCookie("ct_has_key_up")){var e=ctGetPageForms();if(ctPublic.handled_fields=[],0{this.checkElementInForms(t,"addClicks")}),this.elementBody.addEventListener("mouseup",t=>{"Range"==document.getSelection().type.toString()&&this.addSelected()}),this.elementBody.addEventListener("mousemove",t=>{this.checkElementInForms(t,"trackMouseMovement")})}checkElementInForms(e,t){let c;for(let t=0;t{this.data.push(Object.assign({},this.fieldData))})}setListeners(){this.fields.forEach((t,e)=>{t.addEventListener("paste",()=>{this.data[e].isUseBuffer=!0})}),this.fields.forEach((t,e)=>{t.addEventListener("onautocomplete",()=>{this.data[e].isAutoFill=!0})}),this.fields.forEach((t,c)=>{t.addEventListener("input",()=>{this.data[c].countOfKey++;var t,e=+new Date;1===this.data[c].countOfKey?(this.data[c].lastKeyTimestamp=e,this.data[c].firstKeyTimestamp=e):(t=e-this.data[c].lastKeyTimestamp,2===this.data[c].countOfKey?(this.data[c].lastKeyTimestamp=e,this.data[c].lastDelta=t):2{this.checkElementInForms(t,"addClicks")}),this.elementBody.addEventListener("mouseup",t=>{"Range"==document.getSelection().type.toString()&&this.addSelected()}),this.elementBody.addEventListener("mousemove",t=>{this.checkElementInForms(t,"trackMouseMovement")})}checkElementInForms(e,t){let c;for(let t=0;t{this.data.push(Object.assign({},this.fieldData))})}setListeners(){this.fields.forEach((t,e)=>{t.addEventListener("paste",()=>{this.data[e].isUseBuffer=!0})}),this.fields.forEach((t,e)=>{t.addEventListener("onautocomplete",()=>{this.data[e].isAutoFill=!0})}),this.fields.forEach((t,c)=>{t.addEventListener("input",()=>{this.data[c].countOfKey++;var t,e=+new Date;1===this.data[c].countOfKey?(this.data[c].lastKeyTimestamp=e,this.data[c].firstKeyTimestamp=e):(t=e-this.data[c].lastKeyTimestamp,2===this.data[c].countOfKey?(this.data[c].lastKeyTimestamp=e,this.data[c].lastDelta=t):2 0) {\n for (let i = 0; i < forms.length; i++) {\n // handle only inputs and textareas\n const handledFormFields = forms[i].querySelectorAll('input,textarea');\n for (let i = 0; i < handledFormFields.length; i++) {\n if (handledFormFields[i].type !== 'hidden') {\n // collect handled fields to remove handler in the future\n ctPublic.handled_fields.push(handledFormFields[i]);\n // do attach handlers\n apbct_attach_event_handler(handledFormFields[i], 'focus', ctFunctionHasInputFocused);\n apbct_attach_event_handler(handledFormFields[i], 'keyup', ctFunctionHasKeyUp);\n }\n }\n }\n }\n }\n}\n\n/**\n * Class collecting user mouse activity data\n *\n */\n// eslint-disable-next-line no-unused-vars, require-jsdoc\nclass ApbctCollectingUserMouseActivity {\n elementBody = document.querySelector('body');\n collectionForms = document.forms;\n /**\n * Constructor\n */\n constructor() {\n this.setListeners();\n }\n\n /**\n * Set listeners\n */\n setListeners() {\n this.elementBody.addEventListener('click', (event) => {\n this.checkElementInForms(event, 'addClicks');\n });\n\n this.elementBody.addEventListener('mouseup', (event) => {\n const selectedType = document.getSelection().type.toString();\n if (selectedType == 'Range') {\n this.addSelected();\n }\n });\n\n this.elementBody.addEventListener('mousemove', (event) => {\n this.checkElementInForms(event, 'trackMouseMovement');\n });\n }\n\n /**\n * Checking if there is an element in the form\n * @param {object} event\n * @param {string} addTarget\n */\n checkElementInForms(event, addTarget) {\n let resultCheck;\n for (let i = 0; i < this.collectionForms.length; i++) {\n if (\n event.target.outerHTML.length > 0 &&\n this.collectionForms[i].innerHTML.length > 0\n ) {\n resultCheck = this.collectionForms[i].innerHTML.indexOf(event.target.outerHTML);\n } else {\n resultCheck = -1;\n }\n }\n\n switch (addTarget) {\n case 'addClicks':\n if (resultCheck < 0) {\n this.addClicks();\n }\n break;\n case 'trackMouseMovement':\n if (resultCheck > -1) {\n this.trackMouseMovement();\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Add clicks\n */\n addClicks() {\n if (document.ctCollectingUserActivityData) {\n if (document.ctCollectingUserActivityData.clicks) {\n document.ctCollectingUserActivityData.clicks++;\n } else {\n document.ctCollectingUserActivityData.clicks = 1;\n }\n return;\n }\n\n document.ctCollectingUserActivityData = {clicks: 1};\n }\n\n /**\n * Add selected\n */\n addSelected() {\n if (document.ctCollectingUserActivityData) {\n if (document.ctCollectingUserActivityData.selected) {\n document.ctCollectingUserActivityData.selected++;\n } else {\n document.ctCollectingUserActivityData.selected = 1;\n }\n return;\n }\n\n document.ctCollectingUserActivityData = {selected: 1};\n }\n\n /**\n * Track mouse movement\n */\n trackMouseMovement() {\n if (!document.ctCollectingUserActivityData) {\n document.ctCollectingUserActivityData = {};\n }\n if (!document.ctCollectingUserActivityData.mouseMovementsInsideForm) {\n document.ctCollectingUserActivityData.mouseMovementsInsideForm = false;\n }\n\n document.ctCollectingUserActivityData.mouseMovementsInsideForm = true;\n }\n}\n\n/**\n * Class for gathering data about user typing.\n *\n * ==============================\n * isAutoFill - only person can use auto fill\n * isUseBuffer - use buffer for fill current field\n * ==============================\n * lastKeyTimestamp - timestamp of last key press in current field\n * speedDelta - change for each key press in current field,\n * as difference between current and previous key press timestamps,\n * robots in general have constant speed of typing.\n * If speedDelta is constant for each key press in current field,\n * so, speedDelta will be roughly to 0, then it is robot.\n * ==============================\n */\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nclass CTTypoData {\n fieldData = {\n isAutoFill: false,\n isUseBuffer: false,\n speedDelta: 0,\n firstKeyTimestamp: 0,\n lastKeyTimestamp: 0,\n lastDelta: 0,\n countOfKey: 0,\n };\n\n fields = document.querySelectorAll('textarea[name=comment]');\n\n data = [];\n\n /**\n * Gather fields.\n */\n gatheringFields() {\n let fieldSet = Array.prototype.slice.call(this.fields);\n fieldSet.forEach((field, i) => {\n this.data.push(Object.assign({}, this.fieldData));\n });\n }\n\n /**\n * Set listeners.\n */\n setListeners() {\n this.fields.forEach((field, i) => {\n field.addEventListener('paste', () => {\n this.data[i].isUseBuffer = true;\n });\n });\n\n this.fields.forEach((field, i) => {\n field.addEventListener('onautocomplete', () => {\n this.data[i].isAutoFill = true;\n });\n });\n\n this.fields.forEach((field, i) => {\n field.addEventListener('input', () => {\n this.data[i].countOfKey++;\n let time = + new Date();\n let currentDelta = 0;\n\n if (this.data[i].countOfKey === 1) {\n this.data[i].lastKeyTimestamp = time;\n this.data[i].firstKeyTimestamp = time;\n return;\n }\n\n currentDelta = time - this.data[i].lastKeyTimestamp;\n if (this.data[i].countOfKey === 2) {\n this.data[i].lastKeyTimestamp = time;\n this.data[i].lastDelta = currentDelta;\n return;\n }\n\n if (this.data[i].countOfKey > 2) {\n this.data[i].speedDelta += Math.abs(this.data[i].lastDelta - currentDelta);\n this.data[i].lastKeyTimestamp = time;\n this.data[i].lastDelta = currentDelta;\n }\n });\n });\n }\n}\n\n// eslint-disable-next-line camelcase\nconst ctTimeMs = new Date().getTime();\nlet ctMouseEventTimerFlag = true; // Reading interval flag\nlet ctMouseData = [];\nlet ctMouseDataCounter = 0;\nlet ctMouseReadInterval;\nlet ctMouseWriteDataInterval;\n\n\n// Writing first key press timestamp\nconst ctFunctionFirstKey = function output(event) {\n let KeyTimestamp = Math.floor(new Date().getTime() / 1000);\n ctSetCookie('ct_fkp_timestamp', KeyTimestamp);\n ctKeyStopStopListening();\n};\n\n/**\n * Stop mouse observing function\n */\nfunction ctMouseStopData() {\n apbct_remove_event_handler(document, 'mousemove', ctFunctionMouseMove);\n clearInterval(ctMouseReadInterval);\n clearInterval(ctMouseWriteDataInterval);\n}\n\n\n// mouse read\nif (ctPublic.data__key_is_ok) {\n // Reading interval\n ctMouseReadInterval = setInterval(function() {\n ctMouseEventTimerFlag = true;\n }, 150);\n\n // Writting interval\n ctMouseWriteDataInterval = setInterval(function() {\n ctSetCookie('ct_pointer_data', JSON.stringify(ctMouseData));\n }, 1200);\n}\n\n// Logging mouse position each 150 ms\nconst ctFunctionMouseMove = function output(event) {\n ctSetMouseMoved();\n if (ctMouseEventTimerFlag === true) {\n ctMouseData.push([\n Math.round(event.clientY),\n Math.round(event.clientX),\n Math.round(new Date().getTime() - ctTimeMs),\n ]);\n\n ctMouseDataCounter++;\n ctMouseEventTimerFlag = false;\n if (ctMouseDataCounter >= 50) {\n ctMouseStopData();\n }\n }\n};\n\n/**\n * Stop key listening function\n */\nfunction ctKeyStopStopListening() {\n apbct_remove_event_handler(document, 'mousedown', ctFunctionFirstKey);\n apbct_remove_event_handler(document, 'keydown', ctFunctionFirstKey);\n}\n\n/**\n * ctSetHasScrolled\n */\nfunction ctSetHasScrolled() {\n if ( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n ctSetCookie('ct_has_scrolled', 'true');\n apbctLocalStorage.set('ct_has_scrolled', true);\n }\n if (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_scrolled') === undefined\n ) {\n ctSetCookie('ct_has_scrolled', 'true');\n }\n}\n\n/**\n * ctSetMouseMoved\n */\nfunction ctSetMouseMoved() {\n if ( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n ctSetCookie('ct_mouse_moved', 'true');\n apbctLocalStorage.set('ct_mouse_moved', true);\n }\n if (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_mouse_moved') === undefined\n ) {\n ctSetCookie('ct_mouse_moved', 'true');\n }\n}\n\n/**\n * stop listening keyup and focus\n * @param {string} eventName\n * @param {string} functionName\n */\nfunction ctStopFieldsListening(eventName, functionName) {\n if (typeof ctPublic.handled_fields !== 'undefined' && ctPublic.handled_fields.length > 0) {\n for (let i = 0; i < ctPublic.handled_fields.length; i++) {\n apbct_remove_event_handler(ctPublic.handled_fields[i], eventName, functionName);\n }\n }\n}\n\nlet ctFunctionHasInputFocused = function output(event) {\n ctSetHasInputFocused();\n ctStopFieldsListening('focus', ctFunctionHasInputFocused);\n};\n\nlet ctFunctionHasKeyUp = function output(event) {\n ctSetHasKeyUp();\n ctStopFieldsListening('keyup', ctFunctionHasKeyUp);\n};\n\n/**\n * set ct_has_input_focused ct_has_key_up cookies on session period\n */\nfunction ctSetHasInputFocused() {\n if ( ! apbctLocalStorage.isSet('ct_has_input_focused') || ! apbctLocalStorage.get('ct_has_input_focused') ) {\n apbctLocalStorage.set('ct_has_input_focused', true);\n }\n if (\n (\n (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_input_focused') === undefined\n ) ||\n ctPublic.data__cookies_type === 'alternative'\n ) ||\n (\n ctPublic.data__cookies_type === 'none' &&\n (\n typeof ctPublic.force_alt_cookies !== 'undefined' ||\n (ctPublic.force_alt_cookies !== undefined && ctPublic.force_alt_cookies)\n )\n )\n ) {\n ctSetCookie('ct_has_input_focused', 'true');\n }\n}\n\n/**\n * ctSetHasKeyUp\n */\nfunction ctSetHasKeyUp() {\n if ( ! apbctLocalStorage.isSet('ct_has_key_up') || ! apbctLocalStorage.get('ct_has_key_up') ) {\n apbctLocalStorage.set('ct_has_key_up', true);\n }\n if (\n (\n (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_key_up') === undefined\n ) ||\n ctPublic.data__cookies_type === 'alternative'\n ) ||\n (\n ctPublic.data__cookies_type === 'none' &&\n (\n typeof ctPublic.force_alt_cookies !== 'undefined' ||\n (ctPublic.force_alt_cookies !== undefined && ctPublic.force_alt_cookies)\n )\n )\n ) {\n ctSetCookie('ct_has_key_up', 'true');\n }\n}\n\nif (ctPublic.data__key_is_ok) {\n apbct_attach_event_handler(document, 'mousemove', ctFunctionMouseMove);\n apbct_attach_event_handler(document, 'mousedown', ctFunctionFirstKey);\n apbct_attach_event_handler(document, 'keydown', ctFunctionFirstKey);\n apbct_attach_event_handler(document, 'scroll', ctSetHasScrolled);\n}\n\n/**\n * @param {mixed} commonCookies\n * @return {string}\n */\nfunction getJavascriptClientData(commonCookies = []) { // eslint-disable-line no-unused-vars\n let resultDataJson = {};\n\n resultDataJson.ct_checked_emails = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails');\n resultDataJson.ct_checked_emails_exist = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails_exist');\n resultDataJson.ct_checkjs = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checkjs');\n resultDataJson.ct_fkp_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_fkp_timestamp');\n resultDataJson.ct_pointer_data = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_pointer_data');\n resultDataJson.ct_ps_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_ps_timestamp');\n resultDataJson.ct_screen_info = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_screen_info');\n resultDataJson.ct_timezone = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_timezone');\n\n // collecting data from localstorage\n const ctMouseMovedLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n const ctHasScrolledLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n const ctCookiesTypeLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n const apbctPageHits = apbctLocalStorage.get('apbct_page_hits');\n const apbctPrevReferer = apbctSessionStorage.get('apbct_prev_referer');\n const apbctSiteReferer = apbctSessionStorage.get('apbct_site_referer');\n const ctJsErrorsLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_js_errors');\n const ctPixelUrl = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n const apbctHeadless = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n const ctBotDetectorFrontendDataLog = apbctLocalStorage.get(\n ctPublicFunctions.cookiePrefix + 'ct_bot_detector_frontend_data_log',\n );\n\n // collecting data from cookies\n const ctMouseMovedCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n const ctHasScrolledCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n const ctCookiesTypeCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n const ctCookiesPixelUrl = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n const apbctHeadlessNative = !!ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n\n\n resultDataJson.ct_mouse_moved = ctMouseMovedLocalStorage !== undefined ?\n ctMouseMovedLocalStorage : ctMouseMovedCookie;\n resultDataJson.ct_has_scrolled = ctHasScrolledLocalStorage !== undefined ?\n ctHasScrolledLocalStorage : ctHasScrolledCookie;\n resultDataJson.ct_cookies_type = ctCookiesTypeLocalStorage !== undefined ?\n ctCookiesTypeLocalStorage : ctCookiesTypeCookie;\n resultDataJson.apbct_pixel_url = ctPixelUrl !== undefined ?\n ctPixelUrl : ctCookiesPixelUrl;\n resultDataJson.apbct_headless = apbctHeadless !== undefined ?\n apbctHeadless : apbctHeadlessNative;\n resultDataJson.ct_bot_detector_frontend_data_log = ctBotDetectorFrontendDataLog !== undefined ?\n ctBotDetectorFrontendDataLog : '';\n if (resultDataJson.apbct_pixel_url && typeof(resultDataJson.apbct_pixel_url) == 'string') {\n if (resultDataJson.apbct_pixel_url.indexOf('%3A%2F')) {\n resultDataJson.apbct_pixel_url = decodeURIComponent(resultDataJson.apbct_pixel_url);\n }\n }\n\n resultDataJson.apbct_page_hits = apbctPageHits;\n resultDataJson.apbct_prev_referer = apbctPrevReferer;\n resultDataJson.apbct_site_referer = apbctSiteReferer;\n resultDataJson.apbct_ct_js_errors = ctJsErrorsLocalStorage;\n\n if (!resultDataJson.apbct_pixel_url) {\n resultDataJson.apbct_pixel_url = ctPublic.pixel__url;\n }\n\n if (typeof (commonCookies) === 'object') {\n for (let i = 0; i < commonCookies.length; ++i) {\n if ( typeof (commonCookies[i][1]) === 'object' ) {\n // this is for handle SFW cookies\n resultDataJson[commonCookies[i][1][0]] = commonCookies[i][1][1];\n } else {\n resultDataJson[commonCookies[i][0]] = commonCookies[i][1];\n }\n }\n } else {\n console.log('APBCT JS ERROR: Collecting data type mismatch');\n }\n\n // Parse JSON properties to prevent double JSON encoding\n resultDataJson = removeDoubleJsonEncoding(resultDataJson);\n\n\n return JSON.stringify(resultDataJson);\n}\n\n/**\n * @return {bool}\n */\nfunction ctIsDrawPixel() {\n if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') {\n return false;\n }\n\n return +ctPublic.pixel__enabled ||\n (ctPublic.data__cookies_type === 'none' && document.querySelectorAll('img#apbct_pixel').length === 0) ||\n (ctPublic.data__cookies_type === 'alternative' && document.querySelectorAll('img#apbct_pixel').length === 0);\n}\n\n/**\n * @param {string} pixelUrl\n * @return {bool}\n */\nfunction ctSetPixelImg(pixelUrl) {\n if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') {\n return false;\n }\n ctSetCookie('apbct_pixel_url', pixelUrl);\n if ( ctIsDrawPixel() ) {\n if ( ! document.getElementById('apbct_pixel') ) {\n let insertedImg = document.createElement('img');\n insertedImg.setAttribute('alt', 'CleanTalk Pixel');\n insertedImg.setAttribute('title', 'CleanTalk Pixel');\n insertedImg.setAttribute('id', 'apbct_pixel');\n insertedImg.setAttribute('style', 'display: none; left: 99999px;');\n insertedImg.setAttribute('src', pixelUrl);\n apbct('body').append(insertedImg);\n }\n }\n}\n\n/**\n * @param {string} pixelUrl\n * @return {bool}\n */\nfunction ctSetPixelImgFromLocalstorage(pixelUrl) {\n if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') {\n return false;\n }\n if ( ctIsDrawPixel() ) {\n if ( ! document.getElementById('apbct_pixel') ) {\n let insertedImg = document.createElement('img');\n insertedImg.setAttribute('alt', 'CleanTalk Pixel');\n insertedImg.setAttribute('title', 'CleanTalk Pixel');\n insertedImg.setAttribute('id', 'apbct_pixel');\n insertedImg.setAttribute('style', 'display: none; left: 99999px;');\n insertedImg.setAttribute('src', decodeURIComponent(pixelUrl));\n apbct('body').append(insertedImg);\n }\n }\n}\n\n/**\n * ctGetPixelUrl\n * @return {bool}\n */\n// eslint-disable-next-line no-unused-vars, require-jsdoc\nfunction ctGetPixelUrl() {\n if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') {\n return false;\n }\n\n // Check if pixel is already in localstorage and is not outdated\n let localStoragePixelUrl = apbctLocalStorage.get('apbct_pixel_url');\n if ( localStoragePixelUrl !== false ) {\n if ( ! apbctLocalStorage.isAlive('apbct_pixel_url', 3600 * 3) ) {\n apbctLocalStorage.delete('apbct_pixel_url');\n } else {\n // if so - load pixel from localstorage and draw it skipping AJAX\n ctSetPixelImgFromLocalstorage(localStoragePixelUrl);\n return;\n }\n }\n // Using REST API handler\n if ( ctPublicFunctions.data__ajax_type === 'rest' ) {\n apbct_public_sendREST(\n 'apbct_get_pixel_url',\n {\n method: 'POST',\n callback: function(result) {\n if (result &&\n (typeof result === 'string' || result instanceof String) && result.indexOf('https') === 0) {\n // set pixel url to localstorage\n if ( ! apbctLocalStorage.get('apbct_pixel_url') ) {\n // set pixel to the storage\n apbctLocalStorage.set('apbct_pixel_url', result);\n // update pixel data in the hidden fields\n ctNoCookieAttachHiddenFieldsToForms();\n }\n // then run pixel drawing\n ctSetPixelImg(result);\n }\n },\n },\n );\n // Using AJAX request and handler\n } else {\n apbct_public_sendAJAX(\n {\n action: 'apbct_get_pixel_url',\n },\n {\n notJson: true,\n callback: function(result) {\n if (result &&\n (typeof result === 'string' || result instanceof String) && result.indexOf('https') === 0) {\n // set pixel url to localstorage\n if ( ! apbctLocalStorage.get('apbct_pixel_url') ) {\n // set pixel to the storage\n apbctLocalStorage.set('apbct_pixel_url', result);\n // update pixel data in the hidden fields\n ctNoCookieAttachHiddenFieldsToForms();\n }\n // then run pixel drawing\n ctSetPixelImg(result);\n }\n },\n beforeSend: function(xhr) {\n xhr.setRequestHeader('X-Robots-Tag', 'noindex, nofollow');\n },\n },\n );\n }\n}\n\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nfunction ctSetPixelUrlLocalstorage(ajaxPixelUrl) {\n // set pixel to the storage\n ctSetCookie('apbct_pixel_url', ajaxPixelUrl);\n}\n\n/**\n * Handler for -webkit based browser that listen for a custom\n * animation create using the :pseudo-selector in the stylesheet.\n * Works with Chrome, Safari\n *\n * @param {AnimationEvent} event\n */\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nfunction apbctOnAnimationStart(event) {\n ('onautofillstart' === event.animationName) ?\n apbctAutocomplete(event.target) : apbctCancelAutocomplete(event.target);\n}\n\n/**\n * Handler for non-webkit based browser that listen for input\n * event to trigger the autocomplete-cancel process.\n * Works with Firefox, Edge, IE11\n *\n * @param {InputEvent} event\n */\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nfunction apbctOnInput(event) {\n ('insertReplacementText' === event.inputType || !('data' in event)) ?\n apbctAutocomplete(event.target) : apbctCancelAutocomplete(event.target);\n}\n\n/**\n * Manage an input element when its value is autocompleted\n * by the browser in the following steps:\n * - add [autocompleted] attribute from event.target\n * - create 'onautocomplete' cancelable CustomEvent\n * - dispatch the Event\n *\n * @param {HtmlInputElement} element\n */\nfunction apbctAutocomplete(element) {\n if (element.hasAttribute('autocompleted')) return;\n element.setAttribute('autocompleted', '');\n\n let event = new window.CustomEvent('onautocomplete', {\n bubbles: true, cancelable: true, detail: null,\n });\n\n // no autofill if preventDefault is called\n if (!element.dispatchEvent(event)) {\n element.value = '';\n }\n}\n\n/**\n * Manage an input element when its autocompleted value is\n * removed by the browser in the following steps:\n * - remove [autocompleted] attribute from event.target\n * - create 'onautocomplete' non-cancelable CustomEvent\n * - dispatch the Event\n *\n * @param {HtmlInputElement} element\n */\nfunction apbctCancelAutocomplete(element) {\n if (!element.hasAttribute('autocompleted')) return;\n element.removeAttribute('autocompleted');\n\n // dispatch event\n element.dispatchEvent(new window.CustomEvent('onautocomplete', {\n bubbles: true, cancelable: false, detail: null,\n }));\n}\n\n/**\n * ctNoCookieAttachHiddenFieldsToForms\n */\nfunction ctNoCookieAttachHiddenFieldsToForms() {\n if (ctPublic.data__cookies_type !== 'none') {\n return;\n }\n\n let forms = ctGetPageForms();\n\n if (forms) {\n for ( let i = 0; i < forms.length; i++ ) {\n if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) {\n continue;\n }\n\n // ignore forms with get method @todo We need to think about this\n if (document.forms[i].getAttribute('method') === null ||\n document.forms[i].getAttribute('method').toLowerCase() === 'post') {\n // remove old sets\n let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field');\n for ( let j = 0; j < fields.length; j++ ) {\n fields[j].outerHTML = '';\n }\n // add new set\n document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField());\n }\n }\n }\n}\n"],"names":["ApbctGatheringData","setSessionId","sessionID","apbctSessionStorage","isSet","apbctLocalStorage","set","Number","get","Math","random","toString","replace","substr","document","referrer","URL","host","location","writeReferrersToSessionStorage","sessionCurrentPage","href","setCookiesType","cookiesType","ctPublic","data__cookies_type","delete","startFieldsListening","this","setTimeout","listenAutocomplete","window","addEventListener","apbctOnAnimationStart","apbctOnInput","gatheringTypoData","ctTypoData","CTTypoData","gatheringFields","setListeners","gatheringMouseData","ApbctCollectingUserMouseActivity","getScreenInfo","docEl","documentElement","body","layoutData","scrollWidth","bodyScrollHeight","scrollHeight","docScrollHeight","bodyOffsetHeight","offsetHeight","docOffsetHeight","bodyClientHeight","clientHeight","docClientHeight","docClientWidth","clientWidth","JSON","stringify","fullWidth","fullHeight","max","visibleWidth","visibleHeight","restartFieldsListening","undefined","ctGetCookie","let","forms","ctGetPageForms","handled_fields","length","i","handledFormFields","querySelectorAll","type","push","apbct_attach_event_handler","ctFunctionHasInputFocused","ctFunctionHasKeyUp","elementBody","querySelector","collectionForms","constructor","checkElementInForms","event","getSelection","addSelected","addTarget","resultCheck","target","outerHTML","innerHTML","indexOf","addClicks","trackMouseMovement","ctCollectingUserActivityData","clicks","selected","mouseMovementsInsideForm","fieldData","isAutoFill","isUseBuffer","speedDelta","firstKeyTimestamp","lastKeyTimestamp","lastDelta","countOfKey","fields","data","Array","prototype","slice","call","forEach","field","Object","assign","currentDelta","time","Date","abs","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctMouseReadInterval","ctMouseWriteDataInterval","ctFunctionFirstKey","KeyTimestamp","floor","ctSetCookie","ctKeyStopStopListening","ctMouseStopData","apbct_remove_event_handler","ctFunctionMouseMove","clearInterval","data__key_is_ok","setInterval","ctSetMouseMoved","round","clientY","clientX","ctSetHasScrolled","ctStopFieldsListening","eventName","functionName","ctSetHasInputFocused","ctSetHasKeyUp","force_alt_cookies","getJavascriptClientData","commonCookies","resultDataJson","ct_checked_emails","ctPublicFunctions","cookiePrefix","ct_checked_emails_exist","ct_checkjs","ct_fkp_timestamp","ct_pointer_data","ct_ps_timestamp","ct_screen_info","ct_timezone","ctMouseMovedLocalStorage","ctHasScrolledLocalStorage","ctCookiesTypeLocalStorage","apbctPageHits","apbctPrevReferer","apbctSiteReferer","ctJsErrorsLocalStorage","ctPixelUrl","apbctHeadless","ctBotDetectorFrontendDataLog","ctMouseMovedCookie","ctHasScrolledCookie","ctCookiesTypeCookie","ctCookiesPixelUrl","apbctHeadlessNative","ct_mouse_moved","ct_has_scrolled","ct_cookies_type","apbct_pixel_url","apbct_headless","ct_bot_detector_frontend_data_log","decodeURIComponent","apbct_page_hits","apbct_prev_referer","apbct_site_referer","apbct_ct_js_errors","pixel__url","console","log","removeDoubleJsonEncoding","ctIsDrawPixel","pixel__setting","settings__data__bot_detector_enabled","pixel__enabled","ctSetPixelImg","pixelUrl","insertedImg","getElementById","createElement","setAttribute","apbct","append","ctSetPixelImgFromLocalstorage","ctGetPixelUrl","localStoragePixelUrl","isAlive","data__ajax_type","apbct_public_sendREST","method","callback","result","String","ctNoCookieAttachHiddenFieldsToForms","apbct_public_sendAJAX","action","notJson","beforeSend","xhr","setRequestHeader","ctSetPixelUrlLocalstorage","ajaxPixelUrl","animationName","apbctAutocomplete","apbctCancelAutocomplete","inputType","element","hasAttribute","CustomEvent","bubbles","cancelable","detail","dispatchEvent","value","removeAttribute","ApbctHandler","checkHiddenFieldsExclusions","getAttribute","toLowerCase","j","ApbctAttachData","constructNoCookieHiddenField"],"mappings":"MAGMA,mBAKFC,eACI,IACUC,EADLC,oBAAoBC,MAAM,kBAAkB,EAW7CC,kBAAkBC,IAAI,kBAAmBC,OAAOF,kBAAkBG,IAAI,iBAAiB,CAAC,EAAI,CAAC,GAVvFN,EAAYO,KAAKC,OAAO,EAAEC,SAAS,EAAE,EAAEC,QAAQ,WAAY,EAAE,EAAEC,OAAO,EAAG,EAAE,EACjFV,oBAAoBG,IAAI,mBAAoBJ,EAAW,CAAA,CAAK,EAC5DG,kBAAkBC,IAAI,kBAAmB,CAAC,EACtCQ,SAASC,UACQ,IAAIC,IAAIF,SAASC,QAAQ,EAC3BE,OAASC,SAASD,MAC7Bd,oBAAoBG,IAAI,qBAAsBQ,SAASC,SAAU,CAAA,CAAK,EAMtF,CAMAI,iCACI,IAAMC,EAAqBjB,oBAAoBK,IAAI,4BAA4B,EAErD,CAAA,IAAtBY,GAA+BN,SAASI,SAASG,OAASD,GAC1DjB,oBAAoBG,IAAI,qBAAsBc,EAAoB,CAAA,CAAK,EAG3EjB,oBAAoBG,IAAI,6BAA8BQ,SAASI,SAASG,KAAM,CAAA,CAAK,CACvF,CAOAC,iBACI,IAAMC,EAAclB,kBAAkBG,IAAI,iBAAiB,EACpDe,GAAeA,IAAgBC,SAASC,qBAC3CpB,kBAAkBC,IAAI,kBAAmBkB,SAASC,kBAAkB,EACpEpB,kBAAkBqB,OAAO,gBAAgB,EACzCrB,kBAAkBqB,OAAO,iBAAiB,EAElD,CAMAC,uBACwC,gBAAhCH,SAASC,qBACTG,KAAKD,qBAAqB,EAE1BE,WAAWD,KAAKD,qBAAsB,GAAI,EAElD,CAMAG,qBACIC,OAAOC,iBAAiB,iBAAkBJ,KAAKK,sBAAuB,CAAA,CAAI,EAC1EF,OA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c,CAEnE9K,IAAIyC,EAASxC,EAAMI,GAAGE,iBAAiB,4BAA4B,EACnE,IAAMP,IAAI+K,EAAI,EAAGA,EAAItI,EAAOrC,OAAQ2K,CAAC,GACjCtI,EAAOsI,GAAGvJ,UAAY,GAG1B/E,SAASwD,MAAMI,GAAGqI,QAAO,IAAIsC,iBAAkBC,6BAA6B,CAAC,CACjF,CApBR,CAuBJ,CApUI9N,SAASoH,kBACT7D,2BAA2BjE,SAAU,YAAa4H,mBAAmB,EACrE3D,2BAA2BjE,SAAU,YAAaqH,kBAAkB,EACpEpD,2BAA2BjE,SAAU,UAAWqH,kBAAkB,EAClEpD,2BAA2BjE,SAAU,SAAUoI,gBAAgB"} \ No newline at end of file +{"version":3,"file":"public-2-gathering-data.min.js","sources":["public-2-gathering-data.js"],"sourcesContent":["/**\n * Class for gathering data\n */\nclass ApbctGatheringData { // eslint-disable-line no-unused-vars\n /**\n * Set session ID\n * @return {void}\n */\n setSessionId() {\n if (!apbctSessionStorage.isSet('apbct_session_id')) {\n const sessionID = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);\n apbctSessionStorage.set('apbct_session_id', sessionID, false);\n apbctLocalStorage.set('apbct_page_hits', 1);\n if (document.referrer) {\n let urlReferer = new URL(document.referrer);\n if (urlReferer.host !== location.host) {\n apbctSessionStorage.set('apbct_site_referer', document.referrer, false);\n }\n }\n } else {\n apbctLocalStorage.set('apbct_page_hits', Number(apbctLocalStorage.get('apbct_page_hits')) + 1);\n }\n }\n\n /**\n * Set three statements to the sessions storage: apbct_session_current_page, apbct_prev_referer.\n * @return {void}\n */\n writeReferrersToSessionStorage() {\n const sessionCurrentPage = apbctSessionStorage.get('apbct_session_current_page');\n // set session apbct_referer\n if (sessionCurrentPage!== false && document.location.href !== sessionCurrentPage) {\n apbctSessionStorage.set('apbct_prev_referer', sessionCurrentPage, false);\n }\n // set session current page to know referrer\n apbctSessionStorage.set('apbct_session_current_page', document.location.href, false);\n }\n\n /**\n * Set cookies type.\n * If it's not set or not equal to ctPublic.data__cookies_type, clear ct_mouse_moved and ct_has_scrolled values.\n * @return {void}\n */\n setCookiesType() {\n const cookiesType = apbctLocalStorage.get('ct_cookies_type');\n if ( ! cookiesType || cookiesType !== ctPublic.data__cookies_type ) {\n apbctLocalStorage.set('ct_cookies_type', ctPublic.data__cookies_type);\n apbctLocalStorage.delete('ct_mouse_moved');\n apbctLocalStorage.delete('ct_has_scrolled');\n }\n }\n\n /**\n * Start fields listening\n * @return {void}\n */\n startFieldsListening() {\n if (ctPublic.data__cookies_type !== 'alternative') {\n this.startFieldsListening();\n // 2nd try to add listeners for delayed appears forms\n setTimeout(this.startFieldsListening, 1000);\n }\n }\n\n /**\n * Listen autocomplete\n * @return {void}\n */\n listenAutocomplete() {\n window.addEventListener('animationstart', this.apbctOnAnimationStart, true);\n window.addEventListener('input', this.apbctOnInput, true);\n }\n\n /**\n * Gathering typo data\n * @return {void}\n */\n gatheringTypoData() {\n document.ctTypoData = new CTTypoData();\n document.ctTypoData.gatheringFields();\n document.ctTypoData.setListeners();\n }\n\n /**\n * Gathering mouse data\n * @return {void}\n */\n gatheringMouseData() {\n new ApbctCollectingUserMouseActivity();\n }\n\n /**\n * Get screen info\n * @return {string}\n */\n getScreenInfo() {\n // Batch all layout-triggering property reads to avoid forced synchronous layouts\n const docEl = document.documentElement;\n const body = document.body;\n\n // Read all layout properties in one batch\n const layoutData = {\n scrollWidth: docEl.scrollWidth,\n bodyScrollHeight: body.scrollHeight,\n docScrollHeight: docEl.scrollHeight,\n bodyOffsetHeight: body.offsetHeight,\n docOffsetHeight: docEl.offsetHeight,\n bodyClientHeight: body.clientHeight,\n docClientHeight: docEl.clientHeight,\n docClientWidth: docEl.clientWidth,\n };\n\n return JSON.stringify({\n fullWidth: layoutData.scrollWidth,\n fullHeight: Math.max(\n layoutData.bodyScrollHeight, layoutData.docScrollHeight,\n layoutData.bodyOffsetHeight, layoutData.docOffsetHeight,\n layoutData.bodyClientHeight, layoutData.docClientHeight,\n ),\n visibleWidth: layoutData.docClientWidth,\n visibleHeight: layoutData.docClientHeight,\n });\n }\n\n /**\n * Restart listen fields to set ct_has_input_focused or ct_has_key_up\n * @return {void}\n */\n restartFieldsListening() {\n if (!apbctLocalStorage.isSet('ct_has_input_focused') && !apbctLocalStorage.isSet('ct_has_key_up')) {\n this.startFieldsListening();\n }\n }\n\n /**\n * Init listeners for keyup and focus events\n * @return {void}\n */\n startFieldsListening() {\n if (\n (apbctLocalStorage.isSet('ct_has_key_up') || apbctLocalStorage.get('ct_has_key_up')) &&\n (apbctLocalStorage.isSet('ct_has_input_focused') || apbctLocalStorage.get('ct_has_input_focused')) &&\n (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_input_focused') !== undefined &&\n ctGetCookie('ct_has_key_up') !== undefined\n )\n ) {\n // already set\n return;\n }\n\n let forms = ctGetPageForms();\n ctPublic.handled_fields = [];\n\n if (forms.length > 0) {\n for (let i = 0; i < forms.length; i++) {\n // handle only inputs and textareas\n const handledFormFields = forms[i].querySelectorAll('input,textarea');\n for (let i = 0; i < handledFormFields.length; i++) {\n if (handledFormFields[i].type !== 'hidden') {\n // collect handled fields to remove handler in the future\n ctPublic.handled_fields.push(handledFormFields[i]);\n // do attach handlers\n apbct_attach_event_handler(handledFormFields[i], 'focus', ctFunctionHasInputFocused);\n apbct_attach_event_handler(handledFormFields[i], 'keyup', ctFunctionHasKeyUp);\n }\n }\n }\n }\n }\n}\n\n/**\n * Class collecting user mouse activity data\n *\n */\n// eslint-disable-next-line no-unused-vars, require-jsdoc\nclass ApbctCollectingUserMouseActivity {\n elementBody = document.querySelector('body');\n collectionForms = document.forms;\n /**\n * Constructor\n */\n constructor() {\n this.setListeners();\n }\n\n /**\n * Set listeners\n */\n setListeners() {\n this.elementBody.addEventListener('click', (event) => {\n this.checkElementInForms(event, 'addClicks');\n });\n\n this.elementBody.addEventListener('mouseup', (event) => {\n const selectedType = document.getSelection().type.toString();\n if (selectedType == 'Range') {\n this.addSelected();\n }\n });\n\n this.elementBody.addEventListener('mousemove', (event) => {\n this.checkElementInForms(event, 'trackMouseMovement');\n });\n }\n\n /**\n * Checking if there is an element in the form\n * @param {object} event\n * @param {string} addTarget\n */\n checkElementInForms(event, addTarget) {\n let resultCheck;\n for (let i = 0; i < this.collectionForms.length; i++) {\n if (\n event.target.outerHTML.length > 0 &&\n this.collectionForms[i].innerHTML.length > 0\n ) {\n resultCheck = this.collectionForms[i].innerHTML.indexOf(event.target.outerHTML);\n } else {\n resultCheck = -1;\n }\n }\n\n switch (addTarget) {\n case 'addClicks':\n if (resultCheck < 0) {\n this.addClicks();\n }\n break;\n case 'trackMouseMovement':\n if (resultCheck > -1) {\n this.trackMouseMovement();\n }\n break;\n default:\n break;\n }\n }\n\n /**\n * Add clicks\n */\n addClicks() {\n if (document.ctCollectingUserActivityData) {\n if (document.ctCollectingUserActivityData.clicks) {\n document.ctCollectingUserActivityData.clicks++;\n } else {\n document.ctCollectingUserActivityData.clicks = 1;\n }\n return;\n }\n\n document.ctCollectingUserActivityData = {clicks: 1};\n }\n\n /**\n * Add selected\n */\n addSelected() {\n if (document.ctCollectingUserActivityData) {\n if (document.ctCollectingUserActivityData.selected) {\n document.ctCollectingUserActivityData.selected++;\n } else {\n document.ctCollectingUserActivityData.selected = 1;\n }\n return;\n }\n\n document.ctCollectingUserActivityData = {selected: 1};\n }\n\n /**\n * Track mouse movement\n */\n trackMouseMovement() {\n if (!document.ctCollectingUserActivityData) {\n document.ctCollectingUserActivityData = {};\n }\n if (!document.ctCollectingUserActivityData.mouseMovementsInsideForm) {\n document.ctCollectingUserActivityData.mouseMovementsInsideForm = false;\n }\n\n document.ctCollectingUserActivityData.mouseMovementsInsideForm = true;\n }\n}\n\n/**\n * Class for gathering data about user typing.\n *\n * ==============================\n * isAutoFill - only person can use auto fill\n * isUseBuffer - use buffer for fill current field\n * ==============================\n * lastKeyTimestamp - timestamp of last key press in current field\n * speedDelta - change for each key press in current field,\n * as difference between current and previous key press timestamps,\n * robots in general have constant speed of typing.\n * If speedDelta is constant for each key press in current field,\n * so, speedDelta will be roughly to 0, then it is robot.\n * ==============================\n */\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nclass CTTypoData {\n fieldData = {\n isAutoFill: false,\n isUseBuffer: false,\n speedDelta: 0,\n firstKeyTimestamp: 0,\n lastKeyTimestamp: 0,\n lastDelta: 0,\n countOfKey: 0,\n };\n\n fields = document.querySelectorAll('textarea[name=comment]');\n\n data = [];\n\n /**\n * Gather fields.\n */\n gatheringFields() {\n let fieldSet = Array.prototype.slice.call(this.fields);\n fieldSet.forEach((field, i) => {\n this.data.push(Object.assign({}, this.fieldData));\n });\n }\n\n /**\n * Set listeners.\n */\n setListeners() {\n this.fields.forEach((field, i) => {\n field.addEventListener('paste', () => {\n this.data[i].isUseBuffer = true;\n });\n });\n\n this.fields.forEach((field, i) => {\n field.addEventListener('onautocomplete', () => {\n this.data[i].isAutoFill = true;\n });\n });\n\n this.fields.forEach((field, i) => {\n field.addEventListener('input', () => {\n this.data[i].countOfKey++;\n let time = + new Date();\n let currentDelta = 0;\n\n if (this.data[i].countOfKey === 1) {\n this.data[i].lastKeyTimestamp = time;\n this.data[i].firstKeyTimestamp = time;\n return;\n }\n\n currentDelta = time - this.data[i].lastKeyTimestamp;\n if (this.data[i].countOfKey === 2) {\n this.data[i].lastKeyTimestamp = time;\n this.data[i].lastDelta = currentDelta;\n return;\n }\n\n if (this.data[i].countOfKey > 2) {\n this.data[i].speedDelta += Math.abs(this.data[i].lastDelta - currentDelta);\n this.data[i].lastKeyTimestamp = time;\n this.data[i].lastDelta = currentDelta;\n }\n });\n });\n }\n}\n\n// eslint-disable-next-line camelcase\nconst ctTimeMs = new Date().getTime();\nlet ctMouseEventTimerFlag = true; // Reading interval flag\nlet ctMouseData = [];\nlet ctMouseDataCounter = 0;\nlet ctMouseReadInterval;\nlet ctMouseWriteDataInterval;\n\n\n// Writing first key press timestamp\nconst ctFunctionFirstKey = function output(event) {\n let KeyTimestamp = Math.floor(new Date().getTime() / 1000);\n ctSetCookie('ct_fkp_timestamp', KeyTimestamp);\n ctKeyStopStopListening();\n};\n\n/**\n * Stop mouse observing function\n */\nfunction ctMouseStopData() {\n apbct_remove_event_handler(document, 'mousemove', ctFunctionMouseMove);\n clearInterval(ctMouseReadInterval);\n clearInterval(ctMouseWriteDataInterval);\n}\n\n\n// mouse read\nif (ctPublic.data__key_is_ok) {\n // Reading interval\n ctMouseReadInterval = setInterval(function() {\n ctMouseEventTimerFlag = true;\n }, 150);\n\n // Writting interval\n ctMouseWriteDataInterval = setInterval(function() {\n ctSetCookie('ct_pointer_data', JSON.stringify(ctMouseData));\n }, 1200);\n}\n\n// Logging mouse position each 150 ms\nconst ctFunctionMouseMove = function output(event) {\n ctSetMouseMoved();\n if (ctMouseEventTimerFlag === true) {\n ctMouseData.push([\n Math.round(event.clientY),\n Math.round(event.clientX),\n Math.round(new Date().getTime() - ctTimeMs),\n ]);\n\n ctMouseDataCounter++;\n ctMouseEventTimerFlag = false;\n if (ctMouseDataCounter >= 50) {\n ctMouseStopData();\n }\n }\n};\n\n/**\n * Stop key listening function\n */\nfunction ctKeyStopStopListening() {\n apbct_remove_event_handler(document, 'mousedown', ctFunctionFirstKey);\n apbct_remove_event_handler(document, 'keydown', ctFunctionFirstKey);\n}\n\n/**\n * ctSetHasScrolled\n */\nfunction ctSetHasScrolled() {\n if ( ! apbctLocalStorage.isSet('ct_has_scrolled') || ! apbctLocalStorage.get('ct_has_scrolled') ) {\n ctSetCookie('ct_has_scrolled', 'true');\n apbctLocalStorage.set('ct_has_scrolled', true);\n }\n if (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_scrolled') === undefined\n ) {\n ctSetCookie('ct_has_scrolled', 'true');\n }\n}\n\n/**\n * ctSetMouseMoved\n */\nfunction ctSetMouseMoved() {\n if ( ! apbctLocalStorage.isSet('ct_mouse_moved') || ! apbctLocalStorage.get('ct_mouse_moved') ) {\n ctSetCookie('ct_mouse_moved', 'true');\n apbctLocalStorage.set('ct_mouse_moved', true);\n }\n if (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_mouse_moved') === undefined\n ) {\n ctSetCookie('ct_mouse_moved', 'true');\n }\n}\n\n/**\n * stop listening keyup and focus\n * @param {string} eventName\n * @param {string} functionName\n */\nfunction ctStopFieldsListening(eventName, functionName) {\n if (typeof ctPublic.handled_fields !== 'undefined' && ctPublic.handled_fields.length > 0) {\n for (let i = 0; i < ctPublic.handled_fields.length; i++) {\n apbct_remove_event_handler(ctPublic.handled_fields[i], eventName, functionName);\n }\n }\n}\n\nlet ctFunctionHasInputFocused = function output(event) {\n ctSetHasInputFocused();\n ctStopFieldsListening('focus', ctFunctionHasInputFocused);\n};\n\nlet ctFunctionHasKeyUp = function output(event) {\n ctSetHasKeyUp();\n ctStopFieldsListening('keyup', ctFunctionHasKeyUp);\n};\n\n/**\n * set ct_has_input_focused ct_has_key_up cookies on session period\n */\nfunction ctSetHasInputFocused() {\n if ( ! apbctLocalStorage.isSet('ct_has_input_focused') || ! apbctLocalStorage.get('ct_has_input_focused') ) {\n apbctLocalStorage.set('ct_has_input_focused', true);\n }\n if (\n (\n (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_input_focused') === undefined\n ) ||\n ctPublic.data__cookies_type === 'alternative'\n ) ||\n (\n ctPublic.data__cookies_type === 'none' &&\n (\n typeof ctPublic.force_alt_cookies !== 'undefined' ||\n (ctPublic.force_alt_cookies !== undefined && ctPublic.force_alt_cookies)\n )\n )\n ) {\n ctSetCookie('ct_has_input_focused', 'true');\n }\n}\n\n/**\n * ctSetHasKeyUp\n */\nfunction ctSetHasKeyUp() {\n if ( ! apbctLocalStorage.isSet('ct_has_key_up') || ! apbctLocalStorage.get('ct_has_key_up') ) {\n apbctLocalStorage.set('ct_has_key_up', true);\n }\n if (\n (\n (\n ctPublic.data__cookies_type === 'native' &&\n ctGetCookie('ct_has_key_up') === undefined\n ) ||\n ctPublic.data__cookies_type === 'alternative'\n ) ||\n (\n ctPublic.data__cookies_type === 'none' &&\n (\n typeof ctPublic.force_alt_cookies !== 'undefined' ||\n (ctPublic.force_alt_cookies !== undefined && ctPublic.force_alt_cookies)\n )\n )\n ) {\n ctSetCookie('ct_has_key_up', 'true');\n }\n}\n\nif (ctPublic.data__key_is_ok) {\n apbct_attach_event_handler(document, 'mousemove', ctFunctionMouseMove);\n apbct_attach_event_handler(document, 'mousedown', ctFunctionFirstKey);\n apbct_attach_event_handler(document, 'keydown', ctFunctionFirstKey);\n apbct_attach_event_handler(document, 'scroll', ctSetHasScrolled);\n}\n\n/**\n * @param {mixed} commonCookies\n * @return {string}\n */\nfunction getJavascriptClientData(commonCookies = []) { // eslint-disable-line no-unused-vars\n let resultDataJson = {};\n\n resultDataJson.ct_checked_emails = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails');\n resultDataJson.ct_checked_emails_exist = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checked_emails_exist');\n resultDataJson.ct_checkjs = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_checkjs');\n resultDataJson.ct_fkp_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_fkp_timestamp');\n resultDataJson.ct_pointer_data = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_pointer_data');\n resultDataJson.ct_ps_timestamp = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_ps_timestamp');\n resultDataJson.ct_screen_info = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_screen_info');\n resultDataJson.ct_timezone = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_timezone');\n\n // collecting data from localstorage\n const ctMouseMovedLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n const ctHasScrolledLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n const ctCookiesTypeLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n const apbctPageHits = apbctLocalStorage.get('apbct_page_hits');\n const apbctPrevReferer = apbctSessionStorage.get('apbct_prev_referer');\n const apbctSiteReferer = apbctSessionStorage.get('apbct_site_referer');\n const ctJsErrorsLocalStorage = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'ct_js_errors');\n const ctPixelUrl = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n const apbctHeadless = apbctLocalStorage.get(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n const ctBotDetectorFrontendDataLog = apbctLocalStorage.get(\n ctPublicFunctions.cookiePrefix + 'ct_bot_detector_frontend_data_log',\n );\n\n // collecting data from cookies\n const ctMouseMovedCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_mouse_moved');\n const ctHasScrolledCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_has_scrolled');\n const ctCookiesTypeCookie = ctGetCookie(ctPublicFunctions.cookiePrefix + 'ct_cookies_type');\n const ctCookiesPixelUrl = ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_pixel_url');\n const apbctHeadlessNative = !!ctGetCookie(ctPublicFunctions.cookiePrefix + 'apbct_headless');\n\n\n resultDataJson.ct_mouse_moved = ctMouseMovedLocalStorage !== undefined ?\n ctMouseMovedLocalStorage : ctMouseMovedCookie;\n resultDataJson.ct_has_scrolled = ctHasScrolledLocalStorage !== undefined ?\n ctHasScrolledLocalStorage : ctHasScrolledCookie;\n resultDataJson.ct_cookies_type = ctCookiesTypeLocalStorage !== undefined ?\n ctCookiesTypeLocalStorage : ctCookiesTypeCookie;\n resultDataJson.apbct_pixel_url = ctPixelUrl !== undefined ?\n ctPixelUrl : ctCookiesPixelUrl;\n resultDataJson.apbct_headless = apbctHeadless !== undefined ?\n apbctHeadless : apbctHeadlessNative;\n resultDataJson.ct_bot_detector_frontend_data_log = ctBotDetectorFrontendDataLog !== undefined ?\n ctBotDetectorFrontendDataLog : '';\n if (resultDataJson.apbct_pixel_url && typeof(resultDataJson.apbct_pixel_url) == 'string') {\n if (resultDataJson.apbct_pixel_url.indexOf('%3A%2F')) {\n resultDataJson.apbct_pixel_url = decodeURIComponent(resultDataJson.apbct_pixel_url);\n }\n }\n\n resultDataJson.apbct_page_hits = apbctPageHits;\n resultDataJson.apbct_prev_referer = apbctPrevReferer;\n resultDataJson.apbct_site_referer = apbctSiteReferer;\n resultDataJson.apbct_ct_js_errors = ctJsErrorsLocalStorage;\n\n if (!resultDataJson.apbct_pixel_url) {\n resultDataJson.apbct_pixel_url = ctPublic.pixel__url;\n }\n\n if (typeof (commonCookies) === 'object') {\n for (let i = 0; i < commonCookies.length; ++i) {\n if ( typeof (commonCookies[i][1]) === 'object' ) {\n // this is for handle SFW cookies\n resultDataJson[commonCookies[i][1][0]] = commonCookies[i][1][1];\n } else {\n resultDataJson[commonCookies[i][0]] = commonCookies[i][1];\n }\n }\n } else {\n console.log('APBCT JS ERROR: Collecting data type mismatch');\n }\n\n // Parse JSON properties to prevent double JSON encoding\n resultDataJson = removeDoubleJsonEncoding(resultDataJson);\n\n\n return JSON.stringify(resultDataJson);\n}\n\n/**\n * @return {bool}\n */\nfunction ctIsDrawPixel() {\n if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) {\n return false;\n }\n\n return +ctPublic.pixel__enabled ||\n (ctPublic.data__cookies_type === 'none' && document.querySelectorAll('img#apbct_pixel').length === 0) ||\n (ctPublic.data__cookies_type === 'alternative' && document.querySelectorAll('img#apbct_pixel').length === 0);\n}\n\n/**\n * @param {string} pixelUrl\n * @return {bool}\n */\nfunction ctSetPixelImg(pixelUrl) {\n if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) {\n return false;\n }\n ctSetCookie('apbct_pixel_url', pixelUrl);\n if ( ctIsDrawPixel() ) {\n if ( ! document.getElementById('apbct_pixel') ) {\n let insertedImg = document.createElement('img');\n insertedImg.setAttribute('alt', 'CleanTalk Pixel');\n insertedImg.setAttribute('title', 'CleanTalk Pixel');\n insertedImg.setAttribute('id', 'apbct_pixel');\n insertedImg.setAttribute('style', 'display: none; left: 99999px;');\n insertedImg.setAttribute('src', pixelUrl);\n apbct('body').append(insertedImg);\n }\n }\n}\n\n/**\n * @param {string} pixelUrl\n * @return {bool}\n */\nfunction ctSetPixelImgFromLocalstorage(pixelUrl) {\n if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) {\n return false;\n }\n if ( ctIsDrawPixel() ) {\n if ( ! document.getElementById('apbct_pixel') ) {\n let insertedImg = document.createElement('img');\n insertedImg.setAttribute('alt', 'CleanTalk Pixel');\n insertedImg.setAttribute('title', 'CleanTalk Pixel');\n insertedImg.setAttribute('id', 'apbct_pixel');\n insertedImg.setAttribute('style', 'display: none; left: 99999px;');\n insertedImg.setAttribute('src', decodeURIComponent(pixelUrl));\n apbct('body').append(insertedImg);\n }\n }\n}\n\n/**\n * ctGetPixelUrl\n * @return {bool}\n */\n// eslint-disable-next-line no-unused-vars, require-jsdoc\nfunction ctGetPixelUrl() {\n if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) {\n return false;\n }\n\n // Check if pixel is already in localstorage and is not outdated\n let localStoragePixelUrl = apbctLocalStorage.get('apbct_pixel_url');\n if ( localStoragePixelUrl !== false ) {\n if ( ! apbctLocalStorage.isAlive('apbct_pixel_url', 3600 * 3) ) {\n apbctLocalStorage.delete('apbct_pixel_url');\n } else {\n // if so - load pixel from localstorage and draw it skipping AJAX\n ctSetPixelImgFromLocalstorage(localStoragePixelUrl);\n return;\n }\n }\n // Using REST API handler\n if ( ctPublicFunctions.data__ajax_type === 'rest' ) {\n apbct_public_sendREST(\n 'apbct_get_pixel_url',\n {\n method: 'POST',\n callback: function(result) {\n if (result &&\n (typeof result === 'string' || result instanceof String) && result.indexOf('https') === 0) {\n // set pixel url to localstorage\n if ( ! apbctLocalStorage.get('apbct_pixel_url') ) {\n // set pixel to the storage\n apbctLocalStorage.set('apbct_pixel_url', result);\n // update pixel data in the hidden fields\n ctNoCookieAttachHiddenFieldsToForms();\n }\n // then run pixel drawing\n ctSetPixelImg(result);\n }\n },\n },\n );\n // Using AJAX request and handler\n } else {\n apbct_public_sendAJAX(\n {\n action: 'apbct_get_pixel_url',\n },\n {\n notJson: true,\n callback: function(result) {\n if (result &&\n (typeof result === 'string' || result instanceof String) && result.indexOf('https') === 0) {\n // set pixel url to localstorage\n if ( ! apbctLocalStorage.get('apbct_pixel_url') ) {\n // set pixel to the storage\n apbctLocalStorage.set('apbct_pixel_url', result);\n // update pixel data in the hidden fields\n ctNoCookieAttachHiddenFieldsToForms();\n }\n // then run pixel drawing\n ctSetPixelImg(result);\n }\n },\n beforeSend: function(xhr) {\n xhr.setRequestHeader('X-Robots-Tag', 'noindex, nofollow');\n },\n },\n );\n }\n}\n\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nfunction ctSetPixelUrlLocalstorage(ajaxPixelUrl) {\n // set pixel to the storage\n ctSetCookie('apbct_pixel_url', ajaxPixelUrl);\n}\n\n/**\n * Handler for -webkit based browser that listen for a custom\n * animation create using the :pseudo-selector in the stylesheet.\n * Works with Chrome, Safari\n *\n * @param {AnimationEvent} event\n */\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nfunction apbctOnAnimationStart(event) {\n ('onautofillstart' === event.animationName) ?\n apbctAutocomplete(event.target) : apbctCancelAutocomplete(event.target);\n}\n\n/**\n * Handler for non-webkit based browser that listen for input\n * event to trigger the autocomplete-cancel process.\n * Works with Firefox, Edge, IE11\n *\n * @param {InputEvent} event\n */\n// eslint-disable-next-line no-unused-vars,require-jsdoc\nfunction apbctOnInput(event) {\n ('insertReplacementText' === event.inputType || !('data' in event)) ?\n apbctAutocomplete(event.target) : apbctCancelAutocomplete(event.target);\n}\n\n/**\n * Manage an input element when its value is autocompleted\n * by the browser in the following steps:\n * - add [autocompleted] attribute from event.target\n * - create 'onautocomplete' cancelable CustomEvent\n * - dispatch the Event\n *\n * @param {HtmlInputElement} element\n */\nfunction apbctAutocomplete(element) {\n if (element.hasAttribute('autocompleted')) return;\n element.setAttribute('autocompleted', '');\n\n let event = new window.CustomEvent('onautocomplete', {\n bubbles: true, cancelable: true, detail: null,\n });\n\n // no autofill if preventDefault is called\n if (!element.dispatchEvent(event)) {\n element.value = '';\n }\n}\n\n/**\n * Manage an input element when its autocompleted value is\n * removed by the browser in the following steps:\n * - remove [autocompleted] attribute from event.target\n * - create 'onautocomplete' non-cancelable CustomEvent\n * - dispatch the Event\n *\n * @param {HtmlInputElement} element\n */\nfunction apbctCancelAutocomplete(element) {\n if (!element.hasAttribute('autocompleted')) return;\n element.removeAttribute('autocompleted');\n\n // dispatch event\n element.dispatchEvent(new window.CustomEvent('onautocomplete', {\n bubbles: true, cancelable: false, detail: null,\n }));\n}\n"],"names":["ApbctGatheringData","setSessionId","sessionID","apbctSessionStorage","isSet","apbctLocalStorage","set","Number","get","Math","random","toString","replace","substr","document","referrer","URL","host","location","writeReferrersToSessionStorage","sessionCurrentPage","href","setCookiesType","cookiesType","ctPublic","data__cookies_type","delete","startFieldsListening","this","setTimeout","listenAutocomplete","window","addEventListener","apbctOnAnimationStart","apbctOnInput","gatheringTypoData","ctTypoData","CTTypoData","gatheringFields","setListeners","gatheringMouseData","ApbctCollectingUserMouseActivity","getScreenInfo","docEl","documentElement","body","layoutData","scrollWidth","bodyScrollHeight","scrollHeight","docScrollHeight","bodyOffsetHeight","offsetHeight","docOffsetHeight","bodyClientHeight","clientHeight","docClientHeight","docClientWidth","clientWidth","JSON","stringify","fullWidth","fullHeight","max","visibleWidth","visibleHeight","restartFieldsListening","undefined","ctGetCookie","let","forms","ctGetPageForms","handled_fields","length","i","handledFormFields","querySelectorAll","type","push","apbct_attach_event_handler","ctFunctionHasInputFocused","ctFunctionHasKeyUp","elementBody","querySelector","collectionForms","constructor","checkElementInForms","event","getSelection","addSelected","addTarget","resultCheck","target","outerHTML","innerHTML","indexOf","addClicks","trackMouseMovement","ctCollectingUserActivityData","clicks","selected","mouseMovementsInsideForm","fieldData","isAutoFill","isUseBuffer","speedDelta","firstKeyTimestamp","lastKeyTimestamp","lastDelta","countOfKey","fields","data","Array","prototype","slice","call","forEach","field","Object","assign","currentDelta","time","Date","abs","ctTimeMs","getTime","ctMouseEventTimerFlag","ctMouseData","ctMouseDataCounter","ctMouseReadInterval","ctMouseWriteDataInterval","ctFunctionFirstKey","KeyTimestamp","floor","ctSetCookie","ctKeyStopStopListening","ctMouseStopData","apbct_remove_event_handler","ctFunctionMouseMove","clearInterval","data__key_is_ok","setInterval","ctSetMouseMoved","round","clientY","clientX","ctSetHasScrolled","ctStopFieldsListening","eventName","functionName","ctSetHasInputFocused","ctSetHasKeyUp","force_alt_cookies","getJavascriptClientData","commonCookies","resultDataJson","ct_checked_emails","ctPublicFunctions","cookiePrefix","ct_checked_emails_exist","ct_checkjs","ct_fkp_timestamp","ct_pointer_data","ct_ps_timestamp","ct_screen_info","ct_timezone","ctMouseMovedLocalStorage","ctHasScrolledLocalStorage","ctCookiesTypeLocalStorage","apbctPageHits","apbctPrevReferer","apbctSiteReferer","ctJsErrorsLocalStorage","ctPixelUrl","apbctHeadless","ctBotDetectorFrontendDataLog","ctMouseMovedCookie","ctHasScrolledCookie","ctCookiesTypeCookie","ctCookiesPixelUrl","apbctHeadlessNative","ct_mouse_moved","ct_has_scrolled","ct_cookies_type","apbct_pixel_url","apbct_headless","ct_bot_detector_frontend_data_log","decodeURIComponent","apbct_page_hits","apbct_prev_referer","apbct_site_referer","apbct_ct_js_errors","pixel__url","console","log","removeDoubleJsonEncoding","ctIsDrawPixel","pixel__setting","bot_detector_enabled","pixel__enabled","ctSetPixelImg","pixelUrl","insertedImg","getElementById","createElement","setAttribute","apbct","append","ctSetPixelImgFromLocalstorage","ctGetPixelUrl","localStoragePixelUrl","isAlive","data__ajax_type","apbct_public_sendREST","method","callback","result","String","ctNoCookieAttachHiddenFieldsToForms","apbct_public_sendAJAX","action","notJson","beforeSend","xhr","setRequestHeader","ctSetPixelUrlLocalstorage","ajaxPixelUrl","animationName","apbctAutocomplete","apbctCancelAutocomplete","inputType","element","hasAttribute","CustomEvent","bubbles","cancelable","detail","dispatchEvent","value","removeAttribute"],"mappings":"MAGMA,mBAKFC,eACI,IACUC,EADLC,oBAAoBC,MAAM,kBAAkB,EAW7CC,kBAAkBC,IAAI,kBAAmBC,OAAOF,kBAAkBG,IAAI,iBAAiB,CAAC,EAAI,CAAC,GAVvFN,EAAYO,KAAKC,OAAO,EAAEC,SAAS,EAAE,EAAEC,QAAQ,WAAY,EAAE,EAAEC,OAAO,EAAG,EAAE,EACjFV,oBAAoBG,IAAI,mBAAoBJ,EAAW,CAAA,CAAK,EAC5DG,kBAAkBC,IAAI,kBAAmB,CAAC,EACtCQ,SAASC,UACQ,IAAIC,IAAIF,SAASC,QAAQ,EAC3BE,OAASC,SAASD,MAC7Bd,oBAAoBG,IAAI,qBAAsBQ,SAASC,SAAU,CAAA,CAAK,EAMtF,CAMAI,iCACI,IAAMC,EAAqBjB,oBAAoBK,IAAI,4BAA4B,EAErD,CAAA,IAAtBY,GAA+BN,SAASI,SAASG,OAASD,GAC1DjB,oBAAoBG,IAAI,qBAAsBc,EAAoB,CAAA,CAAK,EAG3EjB,oBAAoBG,IAAI,6BAA8BQ,SAASI,SAASG,KAAM,CAAA,CAAK,CACvF,CAOAC,iBACI,IAAMC,EAAclB,kBAAkBG,IAAI,iBAAiB,EACpDe,GAAeA,IAAgBC,SAASC,qBAC3CpB,kBAAkBC,IAAI,kBAAmBkB,SAASC,kBAAkB,EACpEpB,kBAAkBqB,OAAO,gBAAgB,EACzCrB,kBAAkBqB,OAAO,iBAAiB,EAElD,CAMAC,uBACwC,gBAAhCH,SAASC,qBACTG,KAAKD,qBAAqB,EAE1BE,WAAWD,KAAKD,qBAAsB,GAAI,EAElD,CAMAG,qBACIC,OAAOC,iBAAiB,iBAAkBJ,KAAKK,sBAAuB,CAAA,CAAI,EAC1EF,OAAOC,iBAAiB,QAASJ,KAA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AGxClB,cAAcgB,CAAM,EAE5B,EACAM,WAAY,SAASC,GACjBA,EAAIC,iBAAiB,eAAgB,mBAAmB,CAC5D,CACJ,CACJ,CAER,CAGA,SAASC,0BAA0BC,GAE/B5F,YAAY,kBAAmB4F,CAAY,CAC/C,CAUA,SAASjM,sBAAsBsD,IAC1B,oBAAsBA,EAAM4I,cACzBC,kBAAkCC,yBAAhB9I,EAAMK,MAAM,CACtC,CAUA,SAAS1D,aAAaqD,IACjB,0BAA4BA,EAAM+I,WAAe,SAAU/I,EACtB8I,wBAAlCD,mBAA0D7I,EAAMK,MAAM,CAC9E,CAWA,SAASwI,kBAAkBG,GACvB,IAGIhJ,EAHAgJ,EAAQC,aAAa,eAAe,IACxCD,EAAQ1B,aAAa,gBAAiB,EAAE,EAEpCtH,EAAQ,IAAIxD,OAAO0M,YAAY,iBAAkB,CACjDC,QAAS,CAAA,EAAMC,WAAY,CAAA,EAAMC,OAAQ,IAC7C,CAAC,EAGIL,EAAQM,cAActJ,CAAK,KAC5BgJ,EAAQO,MAAQ,GAExB,CAWA,SAAST,wBAAwBE,GACxBA,EAAQC,aAAa,eAAe,IACzCD,EAAQQ,gBAAgB,eAAe,EAGvCR,EAAQM,cAAc,IAAI9M,OAAO0M,YAAY,iBAAkB,CAC3DC,QAAS,CAAA,EAAMC,WAAY,CAAA,EAAOC,OAAQ,IAC9C,CAAC,CAAC,EACN,CArSIpN,SAASoH,kBACT7D,2BAA2BjE,SAAU,YAAa4H,mBAAmB,EACrE3D,2BAA2BjE,SAAU,YAAaqH,kBAAkB,EACpEpD,2BAA2BjE,SAAU,UAAWqH,kBAAkB,EAClEpD,2BAA2BjE,SAAU,SAAUoI,gBAAgB"} \ No newline at end of file diff --git a/js/src/FetchProxyProtection/ApbctFetchProxyProtection.js b/js/src/FetchProxyProtection/ApbctFetchProxyProtection.js index 8d7b6dae3..c34b8f760 100644 --- a/js/src/FetchProxyProtection/ApbctFetchProxyProtection.js +++ b/js/src/FetchProxyProtection/ApbctFetchProxyProtection.js @@ -57,7 +57,7 @@ class ApbctFetchProxyProtection { data.raw_body = bodyText; } - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventToken = new ApbctHandler().toolGetEventToken(); if (eventToken) { data.ct_bot_detector_event_token = eventToken; @@ -142,4 +142,4 @@ class ApbctFetchProxyProtection { const bodyText = this.extractBodyText(args); return await this.checkRequest(match.formKey, match.config, bodyText); } -} \ No newline at end of file +} diff --git a/js/src/cleantalk-admin-settings-page.js b/js/src/cleantalk-admin-settings-page.js index 04636f30b..d210587a7 100644 --- a/js/src/cleantalk-admin-settings-page.js +++ b/js/src/cleantalk-admin-settings-page.js @@ -429,12 +429,12 @@ jQuery(document).ready(function() { apbct_admin_sendAJAX(data, params); }); - document.querySelector('.apbct_hidden_section_nav_mob_btn').addEventListener('click', () => { + document.querySelector('.apbct_hidden_section_nav_mob_btn')?.addEventListener('click', () => { document.querySelector('#apbct_hidden_section_nav ul').style.display = 'block'; document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'none'; }); - document.querySelector('.apbct_hidden_section_nav_mob_btn-close').addEventListener('click', () => { + document.querySelector('.apbct_hidden_section_nav_mob_btn-close')?.addEventListener('click', () => { document.querySelector('#apbct_hidden_section_nav ul').style.display = 'none'; document.querySelector('.apbct_hidden_section_nav_mob_btn').style.display = 'block'; }); diff --git a/js/src/common-decoder.js b/js/src/common-decoder.js index 39d1c9f85..ee26f902d 100644 --- a/js/src/common-decoder.js +++ b/js/src/common-decoder.js @@ -111,7 +111,7 @@ function apbctAjaxEmailDecodeBulk(event, encodedEmailNodes, clickSource) { referrer: document.referrer, encodedEmails: '', }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); diff --git a/js/src/public-1-functions.js b/js/src/public-1-functions.js index 5e27ff3f7..84ea179ea 100644 --- a/js/src/public-1-functions.js +++ b/js/src/public-1-functions.js @@ -135,9 +135,7 @@ function ctSetCookie( cookies, value, expires ) { // do it just once ctSetAlternativeCookie(cookies, {forceAltCookies: true}); } else { - if (!+ctPublic.settings__data__bot_detector_enabled) { - ctNoCookieAttachHiddenFieldsToForms(); - } + ctNoCookieAttachHiddenFieldsToForms(); } // Using traditional cookies @@ -173,7 +171,7 @@ function ctSetAlternativeCookie(cookies, params) { if (Array.isArray(cookies)) { cookies = getJavascriptClientData(cookies); } - } else if (!+ctPublic.settings__data__bot_detector_enabled) { + } else if (!+ctPublic.bot_detector_enabled) { console.log('APBCT ERROR: getJavascriptClientData() is not loaded'); } @@ -389,10 +387,12 @@ let apbctLocalStorage = { const json = JSON.parse(storageValue); if ( json.hasOwnProperty(property) ) { try { - // if property can be parsed as JSON - do it - return JSON.parse( json[property] ); + const parsed = JSON.parse( json[property] ); + if ( parsed !== null && typeof parsed === 'object' ) { + return json[property].toString(); + } + return parsed; } catch (e) { - // if not - return string of value return json[property].toString(); } } else { @@ -535,3 +535,34 @@ function ctDebounceFuncExec(func, wait) { }; } +/** + * ctNoCookieAttachHiddenFieldsToForms + */ +function ctNoCookieAttachHiddenFieldsToForms() { + if (ctPublic.data__cookies_type !== 'none') { + return; + } + + let forms = ctGetPageForms(); + + if (forms) { + for ( let i = 0; i < forms.length; i++ ) { + if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { + continue; + } + + // ignore forms with get method @todo We need to think about this + if (document.forms[i].getAttribute('method') === null || + document.forms[i].getAttribute('method').toLowerCase() === 'post') { + // remove old sets + let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); + for ( let j = 0; j < fields.length; j++ ) { + fields[j].outerHTML = ''; + } + // add new set + document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); + } + } + } +} + diff --git a/js/src/public-1-main.js b/js/src/public-1-main.js index 2b059ff34..19fb7ba46 100644 --- a/js/src/public-1-main.js +++ b/js/src/public-1-main.js @@ -92,7 +92,7 @@ class ApbctAttachData { if (typeof ctPublic.force_alt_cookies == 'undefined' || (ctPublic.force_alt_cookies !== 'undefined' && !ctPublic.force_alt_cookies) ) { - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { ctNoCookieAttachHiddenFieldsToForms(); document.addEventListener('gform_page_loaded', ctNoCookieAttachHiddenFieldsToForms); } @@ -162,7 +162,7 @@ class ApbctAttachData { event.target.action && event.target.action.toString().indexOf('mailpoet_subscription_form') !== -1 ) { window.XMLHttpRequest.prototype.send = function(data) { - if (!+ctPublic.settings__data__bot_detector_enabled) { + if (!+ctPublic.bot_detector_enabled) { const noCookieData = 'data%5Bct_no_cookie_hidden_field%5D=' + getNoCookieData() + '&'; defaultSend.call(this, noCookieData + data); } else { @@ -477,7 +477,7 @@ class ApbctHandler { cronFormsHandler(cronStartTimeout = 2000) { setTimeout(function() { setInterval(function() { - if (!+ctPublic.settings__data__bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { + if (!+ctPublic.bot_detector_enabled && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().restartFieldsListening(); } new ApbctEventTokenTransport().restartBotDetectorEventTokenAttach(); @@ -547,7 +547,7 @@ class ApbctHandler { let addidionalCleantalkData = ''; if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -564,7 +564,7 @@ class ApbctHandler { if (isNeedToAddCleantalkDataCheckFormData) { if (!( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') )) { let noCookieData = getNoCookieData(); @@ -622,7 +622,7 @@ class ApbctHandler { args[1].body instanceof FormData || (typeof args[1].body.append === 'function') ) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { args[1].body.append( @@ -782,7 +782,7 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error @@ -798,14 +798,14 @@ class ApbctHandler { try { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } catch (e) { // Continue even if error } } - // === WooCommerce add to cart === + // === WooCommerce add to cart (direct add-item URL) === if ( ( document.querySelectorAll( @@ -819,7 +819,7 @@ class ApbctHandler { if (+ctPublic.settings__forms__wc_add_to_cart) { args[1].body = attachFieldsToBody( args[1].body, - selectFieldsData(+ctPublic.settings__data__bot_detector_enabled), + selectFieldsData(+ctPublic.bot_detector_enabled), ); } } catch (e) { @@ -827,6 +827,35 @@ class ApbctHandler { } } + // === WooCommerce add to cart (batch API - /wc/store/v1/batch) === + if ( + +ctPublic.settings__forms__wc_add_to_cart && + ( + document.querySelectorAll( + 'button.add_to_cart_button, button.ajax_add_to_cart, button.single_add_to_cart_button', + ).length > 0 || + document.querySelectorAll('a.add_to_cart_button').length > 0 + ) && + args[0].includes('/wc/store/v1/batch') && + typeof args[1].body === 'string' + ) { + try { + const batchPayload = JSON.parse(args[1].body); + if (batchPayload.requests && Array.isArray(batchPayload.requests)) { + const fieldPair = selectFieldsData(+ctPublic.bot_detector_enabled); + for (const req of batchPayload.requests) { + const isAddItem = req.path === '/wc/store/v1/cart/add-item'; + if (isAddItem && req.body && fieldPair && fieldPair.key) { + req.body[fieldPair.key] = fieldPair.value; + } + } + args[1].body = JSON.stringify(batchPayload); + } + } catch (e) { + // Continue even if error + } + } + // === Bitrix24 external form === if ( +ctPublic.settings__forms__check_external && @@ -987,6 +1016,11 @@ class ApbctHandler { if (ajaxObject.data.indexOf('action=wwlc_create_user') !== -1) { sourceSign.found = 'action=wwlc_create_user'; } + if (ajaxObject.data.indexOf('action=WPBC_AJX_BOOKING__CREATE') !== -1) { + sourceSign.found = 'action=WPBC_AJX_BOOKING__CREATE'; + sourceSign.keepUnwrapped = true; + sourceSign.attachVisibleFieldsData = true; + } if (ajaxObject.data.indexOf('action=drplus_signup') !== -1) { sourceSign.found = 'action=drplus_signup'; sourceSign.keepUnwrapped = true; @@ -1066,7 +1100,7 @@ class ApbctHandler { try { // Event token if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = this.toolGetEventToken(); @@ -1149,7 +1183,7 @@ class ApbctHandler { let visibleFieldsString = ''; if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { const token = new ApbctHandler().toolGetEventToken(); @@ -1208,21 +1242,21 @@ class ApbctHandler { return next(options); } - // add to cart + // add to cart (batch uses body not data for request payload) if (options.data.hasOwnProperty('requests') && options.data.requests.length > 0 && options.data.requests[0].hasOwnProperty('path') && options.data.requests[0].path === '/wc/store/v1/cart/add-item' ) { + const reqBody = options.data.requests[0].body || (options.data.requests[0].body = {}); if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { - let token = localStorage.getItem('bot_detector_event_token'); - options.data.requests[0].data.ct_bot_detector_event_token = token; + reqBody.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); } else { if (ctPublic.data__cookies_type === 'none') { - options.data.requests[0].data.ct_no_cookie_hidden_field = getNoCookieData(); + reqBody.ct_no_cookie_hidden_field = getNoCookieData(); } } } @@ -1230,7 +1264,7 @@ class ApbctHandler { // checkout if (options.path.includes('/wc/store/v1/checkout')) { if ( - +ctPublic.settings__data__bot_detector_enabled && + +ctPublic.bot_detector_enabled && apbctLocalStorage.get('bot_detector_event_token') ) { options.data.ct_bot_detector_event_token = localStorage.getItem('bot_detector_event_token'); @@ -1794,9 +1828,8 @@ async function apbctImportScript(scriptAbsolutePath) { // eslint-disable-next-line camelcase,require-jsdoc async function apbct_ready() { apbctLocalStorage.set('ct_checkjs', ctPublic.ct_checkjs_key, true); - if (ctPublic.data__cookies_type === 'native') { - ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); - } + ctSetCookie('ct_checkjs', ctPublic.ct_checkjs_key, true); + new ApbctShowForbidden().prepareBlockForAjaxForms(); @@ -1805,7 +1838,7 @@ async function apbct_ready() { if ( apbctLocalStorage.get('apbct_existing_visitor') && // Not for the first hit - +ctPublic.settings__data__bot_detector_enabled && // If Bot-Detector is active + +ctPublic.bot_detector_enabled && // If Bot-Detector is active !apbctLocalStorage.get('bot_detector_event_token') && // and no `event_token` generated typeof ApbctGatheringData === 'undefined' // and no `gathering` loaded yet ) { @@ -1824,7 +1857,7 @@ async function apbct_ready() { // Gathering data when bot detector is disabled if ( - ( ! +ctPublic.settings__data__bot_detector_enabled || gatheringLoaded ) && + ( ! +ctPublic.bot_detector_enabled || gatheringLoaded ) && typeof ApbctGatheringData !== 'undefined' ) { const gatheringData = new ApbctGatheringData(); @@ -1846,7 +1879,7 @@ async function apbct_ready() { setTimeout(function() { // Attach data when bot detector is enabled - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { const eventTokenTransport = new ApbctEventTokenTransport(); eventTokenTransport.attachEventTokenToMultipageGravityForms(); eventTokenTransport.attachEventTokenToWoocommerceGetRequestAddToCart(); @@ -1855,7 +1888,7 @@ async function apbct_ready() { const attachData = new ApbctAttachData(); // Attach data when bot detector is disabled or blocked - if (!+ctPublic.settings__data__bot_detector_enabled || gatheringLoaded) { + if (!+ctPublic.bot_detector_enabled || gatheringLoaded) { attachData.attachHiddenFieldsToForms(gatheringLoaded); } @@ -1882,7 +1915,7 @@ async function apbct_ready() { handler.catchJqueryAjax(); handler.catchWCRestRequestAsMiddleware(); - if (+ctPublic.settings__data__bot_detector_enabled) { + if (+ctPublic.bot_detector_enabled) { let botDetectorEventTokenStored = false; window.addEventListener('botDetectorEventTokenUpdated', (event) => { const botDetectorEventToken = event.detail?.eventToken; @@ -1902,7 +1935,7 @@ async function apbct_ready() { }); } - if (ctPublic.settings__sfw__anti_crawler && +ctPublic.settings__data__bot_detector_enabled) { + if (ctPublic.settings__sfw__anti_crawler && +ctPublic.bot_detector_enabled) { handler.toolForAntiCrawlerCheckDuringBotDetector(); } diff --git a/js/src/public-2-external-forms.js b/js/src/public-2-external-forms.js index 804ce37c8..f960e9a04 100644 --- a/js/src/public-2-external-forms.js +++ b/js/src/public-2-external-forms.js @@ -66,7 +66,7 @@ function ctProtectExternal() { // Trying to process external form into an iframe apbctProcessIframes(); // if form is still not processed by fields listening, do it here - if (ctPublic.settings__data__bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { + if (ctPublic.bot_detector_enabled != 1 && typeof ApbctGatheringData !== 'undefined') { new ApbctGatheringData().startFieldsListening(); } } @@ -578,7 +578,7 @@ function ctProtectOutsideFunctionalHandler(entity, lsStorageName, lsUniqueName) ctAttachCoverCSSToHead(); entityParent.appendChild(ctProtectOutsideFunctionalGenerateCover()); let entitiesProtected = apbctLocalStorage.get(lsStorageName); - if (false === entitiesProtected) { + if (false === entitiesProtected || !Array.isArray(entitiesProtected)) { entitiesProtected = []; } if (lsUniqueName) { diff --git a/js/src/public-2-force-protection.js b/js/src/public-2-force-protection.js index d1383be43..5ca2982ab 100644 --- a/js/src/public-2-force-protection.js +++ b/js/src/public-2-force-protection.js @@ -34,7 +34,7 @@ class ApbctForceProtection { post_url: document.location.href, referrer: document.referrer, }; - if (ctPublic.settings__data__bot_detector_enabled == 1) { + if (+ctPublic.bot_detector_enabled) { data.event_token = apbctLocalStorage.get('bot_detector_event_token'); } else { data.event_javascript_data = getJavascriptClientData(); diff --git a/js/src/public-2-gathering-data.js b/js/src/public-2-gathering-data.js index d36444c5d..ad879e1a2 100644 --- a/js/src/public-2-gathering-data.js +++ b/js/src/public-2-gathering-data.js @@ -643,7 +643,7 @@ function getJavascriptClientData(commonCookies = []) { // eslint-disable-line no * @return {bool} */ function ctIsDrawPixel() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -657,7 +657,7 @@ function ctIsDrawPixel() { * @return {bool} */ function ctSetPixelImg(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } ctSetCookie('apbct_pixel_url', pixelUrl); @@ -679,7 +679,7 @@ function ctSetPixelImg(pixelUrl) { * @return {bool} */ function ctSetPixelImgFromLocalstorage(pixelUrl) { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } if ( ctIsDrawPixel() ) { @@ -701,7 +701,7 @@ function ctSetPixelImgFromLocalstorage(pixelUrl) { */ // eslint-disable-next-line no-unused-vars, require-jsdoc function ctGetPixelUrl() { - if (ctPublic.pixel__setting == '3' && ctPublic.settings__data__bot_detector_enabled == '1') { + if (ctPublic.pixel__setting == '3' && +ctPublic.bot_detector_enabled) { return false; } @@ -841,34 +841,3 @@ function apbctCancelAutocomplete(element) { bubbles: true, cancelable: false, detail: null, })); } - -/** - * ctNoCookieAttachHiddenFieldsToForms - */ -function ctNoCookieAttachHiddenFieldsToForms() { - if (ctPublic.data__cookies_type !== 'none') { - return; - } - - let forms = ctGetPageForms(); - - if (forms) { - for ( let i = 0; i < forms.length; i++ ) { - if ( new ApbctHandler().checkHiddenFieldsExclusions(document.forms[i], 'no_cookie') ) { - continue; - } - - // ignore forms with get method @todo We need to think about this - if (document.forms[i].getAttribute('method') === null || - document.forms[i].getAttribute('method').toLowerCase() === 'post') { - // remove old sets - let fields = forms[i].querySelectorAll('.ct_no_cookie_hidden_field'); - for ( let j = 0; j < fields.length; j++ ) { - fields[j].outerHTML = ''; - } - // add new set - document.forms[i].append(new ApbctAttachData().constructNoCookieHiddenField()); - } - } - } -} diff --git a/js/src/public-3-bot-detector-log.js b/js/src/public-3-bot-detector-log.js index 051619e14..6630a29e6 100644 --- a/js/src/public-3-bot-detector-log.js +++ b/js/src/public-3-bot-detector-log.js @@ -3,8 +3,8 @@ let botDetectorLogEventTypesCollected = []; // bot_detector frontend_data log alt session saving cron if ( - ctPublicFunctions.hasOwnProperty('data__bot_detector_enabled') && - ctPublicFunctions.data__bot_detector_enabled == 1 && + ctPublicFunctions.hasOwnProperty('bot_detector_enabled') && + +ctPublicFunctions.bot_detector_enabled && ctPublicFunctions.hasOwnProperty('data__frontend_data_log_enabled') && ctPublicFunctions.data__frontend_data_log_enabled == 1 ) { diff --git a/lib/Cleantalk/Antispam/Integrations/BookingCalendar.php b/lib/Cleantalk/Antispam/Integrations/BookingCalendar.php new file mode 100644 index 000000000..0e36ea65c --- /dev/null +++ b/lib/Cleantalk/Antispam/Integrations/BookingCalendar.php @@ -0,0 +1,234 @@ +parseBookingCalendarFormdata($formdata); + + // Extract prepared data for ct_gfa_dto + $nickname = $this->extractNickname($parsed_formdata); + $email = $this->extractPrimaryEmail($parsed_formdata); + $emails_array = $this->extractEmailsArray($parsed_formdata); + $filtered_formdata = $this->filterFormdataForMessage($parsed_formdata); + + return ct_gfa_dto( + apply_filters('apbct__filter_post', $filtered_formdata), + $email, + $nickname, + $emails_array + )->getArray(); + } + + /** + * Extract nickname from firstname_val and secondname_val fields. + * Searches for patterns: firstname_val1, firstname_val2, ... and secondname_val1, secondname_val2, ... + * + * @param array $parsed_formdata + * @return string + */ + private function extractNickname(array $parsed_formdata) + { + $firstname = $this->extractFieldByPattern($parsed_formdata, '/^firstname_val\d*$/i'); + $secondname = $this->extractFieldByPattern($parsed_formdata, '/^secondname_val\d*$/i'); + + // If _val patterns not found, try without _val suffix + if (empty($firstname)) { + $firstname = $this->extractFieldByPattern($parsed_formdata, '/^firstname\d*$/i'); + } + if (empty($secondname)) { + $secondname = $this->extractFieldByPattern($parsed_formdata, '/^secondname\d*$/i'); + } + + $parts = array_filter([$firstname, $secondname]); + return implode(' ', $parts); + } + + /** + * Extract primary email from email or email_val fields. + * Priority: email_val1 > email1 > first found email field + * + * @param array $parsed_formdata + * @return string + */ + private function extractPrimaryEmail(array $parsed_formdata) + { + // Try email_val1 first + if (isset($parsed_formdata['email_val1']['value']) && $this->isValidEmail($parsed_formdata['email_val1']['value'])) { + return $parsed_formdata['email_val1']['value']; + } + + // Try email1 + if (isset($parsed_formdata['email1']['value']) && $this->isValidEmail($parsed_formdata['email1']['value'])) { + return $parsed_formdata['email1']['value']; + } + + // Fallback: find first email by pattern + return $this->extractFieldByPattern($parsed_formdata, '/^email_val\d*$/i', 'email') + ?: $this->extractFieldByPattern($parsed_formdata, '/^email\d*$/i', 'email'); + } + + /** + * Extract all emails from email_val fields into array. + * Searches for: email_val1, email_val2, email_val3, ... + * + * @param array $parsed_formdata + * @return array + */ + private function extractEmailsArray(array $parsed_formdata) + { + $emails = []; + + foreach ($parsed_formdata as $key => $field) { + // Match email_val1, email_val2, etc. + if (preg_match('/^email_val\d*$/i', $key)) { + $value = isset($field['value']) ? $field['value'] : ''; + if ($this->isValidEmail($value)) { + $emails[$key] = $value; + } + } + } + + // If no email_val found, try email1, email2, etc. + if (empty($emails)) { + foreach ($parsed_formdata as $key => $field) { + if (preg_match('/^email\d*$/i', $key) && !preg_match('/_val/i', $key)) { + $value = isset($field['value']) ? $field['value'] : ''; + if ($this->isValidEmail($value)) { + $emails[$key] = $value; + } + } + } + } + + return $emails; + } + + /** + * Extract first matching field value by regex pattern. + * + * @param array $parsed_formdata + * @param string $pattern Regex pattern to match field names + * @param string|null $expected_type Optional type filter (e.g., 'email', 'text') + * @return string + */ + private function extractFieldByPattern(array $parsed_formdata, $pattern, $expected_type = null) + { + foreach ($parsed_formdata as $key => $field) { + if (preg_match($pattern, $key)) { + $value = isset($field['value']) ? trim($field['value']) : ''; + $type = isset($field['type']) ? $field['type'] : ''; + + // If type filter specified, check it + if ($expected_type !== null && $type !== $expected_type) { + continue; + } + + if (!empty($value)) { + return $value; + } + } + } + return ''; + } + + /** + * Simple email validation. + * + * @param string $email + * @return bool + */ + private function isValidEmail($email) + { + return is_string($email) && filter_var($email, FILTER_VALIDATE_EMAIL) !== false; + } + + /** + * Filter formdata to remove duplicates and already extracted fields. + * Keeps only textarea fields for message, removes email/name fields and non-_val duplicates. + * + * @param array $parsed_formdata + * @return array + */ + private function filterFormdataForMessage(array $parsed_formdata) + { + $result = []; + + foreach ($parsed_formdata as $key => $field) { + $type = isset($field['type']) ? $field['type'] : ''; + + // Skip email fields - already extracted + if ($type === 'email' || preg_match('/^email/i', $key)) { + continue; + } + + // Skip name fields - already extracted + if (preg_match('/^(first|second|last|nick)?name/i', $key)) { + continue; + } + + // Skip non-_val duplicates if _val version exists (e.g., textarea1 when textarea_val1 exists) + if (preg_match('/^(.+?)(\d+)$/', $key, $matches)) { + $base = isset($matches[1]) ? $matches[1] : ''; + $num = isset($matches[2]) ? $matches[2] : ''; + // If this is NOT a _val field, check if _val version exists + if (substr($base, -4) !== '_val') { + $val_key = $base . '_val' . $num; + if (isset($parsed_formdata[$val_key])) { + continue; + } + } + } + + $result[$key] = $field; + } + + return $result; + } + + /** + * Parse Booking Calendar form data string into an associative array. + * @param string $formdata + * @return array + */ + private function parseBookingCalendarFormdata($formdata) + { + $result = []; + if (!is_string($formdata) || $formdata === '') { + return $result; + } + $fields = explode('~', $formdata); + foreach ($fields as $field) { + $parts = explode('^', $field, 3); + if (count($parts) === 3) { + list($type, $name, $value) = $parts; + $result[$name] = [ + 'type' => $type, + 'value' => $value, + ]; + } + } + return $result; + } + + public function doBlock($message) + { + wp_send_json($message); + } +} diff --git a/lib/Cleantalk/Antispam/Integrations/CleantalkPreprocessComment.php b/lib/Cleantalk/Antispam/Integrations/CleantalkPreprocessComment.php index 6784e2414..5c9ede4d1 100644 --- a/lib/Cleantalk/Antispam/Integrations/CleantalkPreprocessComment.php +++ b/lib/Cleantalk/Antispam/Integrations/CleantalkPreprocessComment.php @@ -445,37 +445,41 @@ private function doSkipReason($current_user, $ct_comment_done) return __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__; } - //do not hadle trackbacks on exclusions - if ($this->wp_comment['comment_type'] !== 'trackback') { - /** - * Process main ruleset - */ - if ( - apbct_is_user_enable() === false || - $this->apbct->settings['forms__comments_test'] == 0 || - $ct_comment_done || - (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], 'page=wysija_campaigns&action=editTemplate') !== false) || - (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') !== false) - ) { - return __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__; - } + $comment_type = isset($this->wp_comment['comment_type']) ? $this->wp_comment['comment_type'] : 'comment'; - /** - * Check if wordpress integrated words/chars blacklists. - */ - $wordpress_own_string_blacklists_result = apbct_wp_blacklist_check( - $this->wp_comment['comment_author'], - $this->wp_comment['comment_author_email'], - $this->wp_comment['comment_author_url'], - $this->wp_comment['comment_content'], - Server::get('REMOTE_ADDR'), - Server::get('HTTP_USER_AGENT') - ); + // Pingbacks and trackbacks are link notifications, not visitor form comments — no cloud check. + if ( in_array($comment_type, array('pingback', 'trackback'), true) ) { + return __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__; + } - // Go out if author in local blacklists, already stopped - if ( $wordpress_own_string_blacklists_result === true ) { - return __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__; - } + /** + * Process main ruleset + */ + if ( + apbct_is_user_enable() === false || + $this->apbct->settings['forms__comments_test'] == 0 || + $ct_comment_done || + (isset($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], 'page=wysija_campaigns&action=editTemplate') !== false) || + (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') !== false) + ) { + return __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__; + } + + /** + * Check if wordpress integrated words/chars blacklists. + */ + $wordpress_own_string_blacklists_result = apbct_wp_blacklist_check( + $this->wp_comment['comment_author'], + $this->wp_comment['comment_author_email'], + $this->wp_comment['comment_author_url'], + $this->wp_comment['comment_content'], + Server::get('REMOTE_ADDR'), + Server::get('HTTP_USER_AGENT') + ); + + // Go out if author in local blacklists, already stopped + if ( $wordpress_own_string_blacklists_result === true ) { + return __FILE__ . ' -> ' . __FUNCTION__ . '():' . __LINE__; } return false; diff --git a/lib/Cleantalk/Antispam/Integrations/EasyDigitalDownloads.php b/lib/Cleantalk/Antispam/Integrations/EasyDigitalDownloads.php index 70ca95de2..c1b769176 100644 --- a/lib/Cleantalk/Antispam/Integrations/EasyDigitalDownloads.php +++ b/lib/Cleantalk/Antispam/Integrations/EasyDigitalDownloads.php @@ -13,8 +13,9 @@ public function getDataForChecking($argument) $this->user_data = $argument; if ( - Post::get('edd_action') === "user_register" || - !empty($argument['user_email']) + Post::getString('edd_action') === "user_register" || + !empty($argument['user_email']) || + Post::getString('edd-process-checkout-nonce') ) { /** * Filter for POST diff --git a/lib/Cleantalk/ApbctWP/ApbctJsBundleResolver.php b/lib/Cleantalk/ApbctWP/ApbctJsBundleResolver.php index dd88c3c68..ad0721c35 100644 --- a/lib/Cleantalk/ApbctWP/ApbctJsBundleResolver.php +++ b/lib/Cleantalk/ApbctWP/ApbctJsBundleResolver.php @@ -29,7 +29,7 @@ public static function getBundleName($settings) $script = 'apbct-public-bundle.min.js'; } - if (isset($settings['data__bot_detector_enabled']) && $settings['data__bot_detector_enabled'] != '1') { + if ( ! apbct__is_bot_detector_enabled() ) { $script = str_replace('.min.js', '_gathering.min.js', $script); } diff --git a/lib/Cleantalk/ApbctWP/BaseCall/DefaultParams.php b/lib/Cleantalk/ApbctWP/BaseCall/DefaultParams.php new file mode 100644 index 000000000..8a276ea9d --- /dev/null +++ b/lib/Cleantalk/ApbctWP/BaseCall/DefaultParams.php @@ -0,0 +1,122 @@ +auth_key = $auth_key; + $this->sender_info = $sender_info; + } + + /** + * Get default params + * @return array + */ + public function get() + { + return [ + 'auth_key' => $this->auth_key, + 'sender_info' => $this->sender_info, + 'sender_ip' => $this->getSenderIP(), + 'x_forwarded_for' => $this->getXForwardedForIP(), + 'x_real_ip' => $this->getXRealIP(), + 'js_on' => $this->getJsOn(), + 'agent' => $this->getAgent(), + 'submit_time' => $this->getSubmitTime(), + ]; + } + + /** + * Get sender IP + * @return string|null + */ + public function getSenderIP() + { + $test_ip = $this->getTestIp(); + return $test_ip ?? $this->ipGet('remote_addr'); + } + + /** + * Get X-Forwarded-For + * @return string|null + */ + public function getXForwardedForIP() + { + return $this->ipGet('x_forwarded_for'); + } + + /** + * Get X-Real-IP + * @return string|null + */ + public function getXRealIP() + { + return $this->ipGet('x_real_ip'); + } + + /** + * Get JS on + * @return int|null + */ + public function getJsOn() + { + $cookieValue = Sanitize::cleanTextField( + Cookie::getString('ct_checkjs') + ); + + return apbct_js_test($cookieValue, true) + ? 1 + : apbct_js_test(Post::getString('ct_checkjs')); + } + + /** + * @return int|null + */ + public function getSubmitTime() + { + return SubmitTimeHandler::getFromRequest(); + } + + /** + * Retrieves the IP address based on the specified type. + * + * @param string $type The type or format of the IP address to retrieve. + * @return string|null Returns the IP address as a string if available; otherwise, returns null. + */ + public function ipGet($type) + { + return \Cleantalk\ApbctWP\Helper::ipGet($type, false); + } + + /** + * Retrieves the value of the constant APBCT_AGENT. + * + * @return string Returns the value of APBCT_AGENT. + */ + public function getAgent() + { + return APBCT_AGENT; + } + + /** + * Retrieves the value of the constant CT_TEST_IP if it is defined and not empty. + * + * @return string|null Returns the value of CT_TEST_IP if available; otherwise, returns null. + */ + public function getTestIp() + { + return defined('CT_TEST_IP') && !empty(CT_TEST_IP) + ? CT_TEST_IP + : null; + } +} diff --git a/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php b/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php index bece59f24..ef5d569af 100644 --- a/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php +++ b/lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php @@ -219,7 +219,7 @@ protected function checkRequest() $event_javascript_data = ''; $event_token = ''; - if ($apbct->settings['data__bot_detector_enabled'] == 1) { + if ( apbct__is_bot_detector_enabled() ) { $event_token = Post::getString('event_token'); } else { $post_event_javascript_data = TT::toString(Post::get('event_javascript_data')); diff --git a/lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php b/lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php index f6ce5478e..3d583f873 100644 --- a/lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php +++ b/lib/Cleantalk/ApbctWP/FindSpam/ListTable/Users.php @@ -293,15 +293,21 @@ public function removeSpam($ids) foreach ( $ids as $id ) { $user_id = (int)sanitize_key($id); - // Only act on users that were marked as spam by CleanTalk - if ( ! delete_user_meta($user_id, 'ct_marked_as_spam') ) { + // Check if user was marked as spam or as bad (without IP/email) + $is_marked_spam = delete_user_meta($user_id, 'ct_marked_as_spam'); + $is_bad_user = delete_user_meta($user_id, 'ct_bad'); + + // Only act on users that were marked by CleanTalk + if ( ! $is_marked_spam && ! $is_bad_user ) { continue; } - //Send feedback - $hash = get_user_meta($user_id, 'ct_hash', true); - if ( $hash ) { - ct_feedback($hash, 0); + //Send feedback (only for spam-marked users) + if ( $is_marked_spam ) { + $hash = get_user_meta($user_id, 'ct_hash', true); + if ( $hash ) { + ct_feedback($hash, 0); + } } //Delete user and posts diff --git a/lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php b/lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php index b7cd38022..706eac273 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php +++ b/lib/Cleantalk/ApbctWP/Firewall/AntiCrawler.php @@ -154,10 +154,10 @@ public static function clearDataTable($db, $db__table__data) { $db->execute("TRUNCATE TABLE {$db__table__data};"); $db->setQuery("SELECT COUNT(*) as cnt FROM {$db__table__data};")->fetch(); // Check if it is clear - if ( $db->result['cnt'] != 0 ) { + if ( isset($db->result['cnt']) && $db->result['cnt'] != 0 ) { $db->execute("DELETE FROM {$db__table__data};"); // Truncate table $db->setQuery("SELECT COUNT(*) as cnt FROM {$db__table__data};")->fetch(); // Check if it is clear - if ( $db->result['cnt'] != 0 ) { + if ( isset($db->result['cnt']) && $db->result['cnt'] != 0 ) { return array('error' => 'COULD_NOT_CLEAR_UA_BL_TABLE'); // throw an error } } @@ -510,7 +510,7 @@ public function printDiePage() 'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'], 'data__cookies_type' => $apbct->data['cookies_type'], 'data__visible_fields_required' => ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1, - 'settings__data__bot_detector_enabled' => $apbct->settings['data__bot_detector_enabled'], + 'bot_detector_enabled' => apbct__is_bot_detector_enabled(), ); $replaces = array( diff --git a/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php b/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php index 28ba56678..58f1fad5f 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php +++ b/lib/Cleantalk/ApbctWP/Firewall/AntiFlood.php @@ -302,7 +302,7 @@ public function printDiePage() 'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'], 'data__cookies_type' => $apbct->data['cookies_type'], 'data__visible_fields_required' => ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1, - 'settings__data__bot_detector_enabled' => $apbct->settings['data__bot_detector_enabled'], + 'bot_detector_enabled' => apbct__is_bot_detector_enabled(), ); $replaces = array( diff --git a/lib/Cleantalk/ApbctWP/Firewall/SFW.php b/lib/Cleantalk/ApbctWP/Firewall/SFW.php index 36c8c3774..da6f04e93 100644 --- a/lib/Cleantalk/ApbctWP/Firewall/SFW.php +++ b/lib/Cleantalk/ApbctWP/Firewall/SFW.php @@ -542,7 +542,7 @@ public function printDiePage() 'data__email_check_before_post' => $apbct->settings['data__email_check_before_post'], 'data__cookies_type' => $apbct->data['cookies_type'], 'data__visible_fields_required' => ! apbct_is_user_logged_in() || $apbct->settings['data__protect_logged_in'] == 1, - 'settings__data__bot_detector_enabled' => $apbct->settings['data__bot_detector_enabled'], + 'bot_detector_enabled' => apbct__is_bot_detector_enabled(), ); $replaces = array( diff --git a/lib/Cleantalk/ApbctWP/Localize/CtPublicFunctionsLocalize.php b/lib/Cleantalk/ApbctWP/Localize/CtPublicFunctionsLocalize.php index 0f075d1a6..c1bbcdcaf 100644 --- a/lib/Cleantalk/ApbctWP/Localize/CtPublicFunctionsLocalize.php +++ b/lib/Cleantalk/ApbctWP/Localize/CtPublicFunctionsLocalize.php @@ -22,7 +22,7 @@ public static function getData() '_rest_url' => Escape::escUrl(apbct_get_rest_url()), 'data__cookies_type' => $apbct->data['cookies_type'], 'data__ajax_type' => $apbct->data['ajax_type'], - 'data__bot_detector_enabled' => $apbct->settings['data__bot_detector_enabled'], + 'bot_detector_enabled' => apbct__is_bot_detector_enabled(), 'data__frontend_data_log_enabled' => defined('APBCT_DO_NOT_COLLECT_FRONTEND_DATA_LOGS') ? 0 : 1, 'cookiePrefix' => apbct__get_cookie_prefix(), 'wprocket_detected' => apbct_is_plugin_active('wp-rocket/wp-rocket.php'), diff --git a/lib/Cleantalk/ApbctWP/Localize/CtPublicLocalize.php b/lib/Cleantalk/ApbctWP/Localize/CtPublicLocalize.php index 331ccc71f..361e4fcda 100644 --- a/lib/Cleantalk/ApbctWP/Localize/CtPublicLocalize.php +++ b/lib/Cleantalk/ApbctWP/Localize/CtPublicLocalize.php @@ -20,7 +20,7 @@ public static function getData() 'settings__forms__force_protection' => $apbct->settings['forms__force_protection'], 'settings__forms__search_test' => $apbct->settings['forms__search_test'], 'settings__forms__wc_add_to_cart' => $apbct->settings['forms__wc_add_to_cart'], - 'settings__data__bot_detector_enabled' => $apbct->settings['data__bot_detector_enabled'], + 'bot_detector_enabled' => apbct__is_bot_detector_enabled(), 'settings__sfw__anti_crawler' => $apbct->settings['sfw__anti_crawler'], 'blog_home' => get_home_url() . '/', 'pixel__setting' => $apbct->settings['data__pixel'], diff --git a/lib/Cleantalk/ApbctWP/PluginSettingsPage/SummaryAndSupportRenderer.php b/lib/Cleantalk/ApbctWP/PluginSettingsPage/SummaryAndSupportRenderer.php index eb849ce6f..711429a03 100644 --- a/lib/Cleantalk/ApbctWP/PluginSettingsPage/SummaryAndSupportRenderer.php +++ b/lib/Cleantalk/ApbctWP/PluginSettingsPage/SummaryAndSupportRenderer.php @@ -96,6 +96,7 @@ private function renderStatistics() %s %s %s + %s
'; @@ -106,6 +107,7 @@ private function renderStatistics() $this->renderLastSfwBlock(), $this->renderSfwUpdate(), $this->renderSfwLogs(), + $this->renderBotDetectorState(), $this->renderPluginVersion() ); @@ -287,6 +289,18 @@ private function renderSfwLogs() return $this->wrapListItem($html); } + public function renderBotDetectorState() + { + return $this->wrapListItem( + sprintf( + esc_html__('JavaScript library (Bot Detector) is %s', 'cleantalk-spam-protect'), + apbct__is_bot_detector_enabled() + ? esc_html__('enabled', 'cleantalk-spam-protect') + : esc_html__('disabled', 'cleantalk-spam-protect') + ) + . '' + ); + } /** * Renders the current plugin version. diff --git a/lib/Cleantalk/ApbctWP/RemoteCalls.php b/lib/Cleantalk/ApbctWP/RemoteCalls.php index f347559ba..a6ff92ca2 100644 --- a/lib/Cleantalk/ApbctWP/RemoteCalls.php +++ b/lib/Cleantalk/ApbctWP/RemoteCalls.php @@ -173,24 +173,14 @@ public static function perform() /** * Update license * - * @return string + * @return void */ public static function action__license_update() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps { - if ( ! headers_sent() ) { - header("Content-Type: application/json"); - } - - if ( ! function_exists('apbct_settings__sync') ) { - require_once APBCT_DIR_PATH . 'inc/cleantalk-settings.php'; - } - - $result = apbct_settings__sync(true); - if ( ! empty($result['error']) ) { - die(json_encode(['ERROR' => json_encode($result['error'])])); - } + $cron = new Cron(); + $cron->updateTask('check_account_status', 'ct_account_status_check', 86400, time() + 3600); - die(json_encode(['OK' => true])); + wp_send_json(['OK' => true]); } /** @@ -531,7 +521,6 @@ private static function getSettings($settings) 'data__use_static_js_key' => 'Use static keys for JavaScript check', 'data__general_postdata_test' => 'Check all post data', 'data__set_cookies' => 'Set cookies', - 'data__bot_detector_enabled' => 'Use JavaScript library', 'exclusions__bot_detector' => 'JavaScript Library Exclusions', 'exclusions__bot_detector__form_attributes' => 'Exclude any forms that has attribute matches', 'exclusions__bot_detector__form_children_attributes' => 'Exclude any forms that includes a child element with attribute matches', diff --git a/lib/Cleantalk/ApbctWP/RequestParameters/SubmitTimeHandler.php b/lib/Cleantalk/ApbctWP/RequestParameters/SubmitTimeHandler.php index 67122704d..5e04d6f3c 100644 --- a/lib/Cleantalk/ApbctWP/RequestParameters/SubmitTimeHandler.php +++ b/lib/Cleantalk/ApbctWP/RequestParameters/SubmitTimeHandler.php @@ -70,10 +70,8 @@ final public static function setToRequest($current_timestamp, &$cookie_test_valu */ final public static function isCalculationDisabled() { - global $apbct; - // Return the value of the bot detector setting - return $apbct->settings['data__bot_detector_enabled'] + return apbct__is_bot_detector_enabled() ? !RequestParameters::get('ct_gathering_loaded') : false; } diff --git a/lib/Cleantalk/ApbctWP/ServiceConstants.php b/lib/Cleantalk/ApbctWP/ServiceConstants.php index 7c8c05288..84b4b4b77 100644 --- a/lib/Cleantalk/ApbctWP/ServiceConstants.php +++ b/lib/Cleantalk/ApbctWP/ServiceConstants.php @@ -20,6 +20,13 @@ class ServiceConstants */ public $set_ajax_route_type; + /** + * Is BotDetector enabled/disabled + * @var ApbctConstant + * @psalm-suppress PossiblyUnusedProperty + */ + public $bot_detector_enabled; + public function __construct() { $this->disable_empty_email_exception = new ApbctConstant( @@ -42,6 +49,10 @@ public function __construct() ), 'Provides AJAX route type' ); + $this->bot_detector_enabled = new ApbctConstant( + array('APBCT_SERVICE__BOT_DETECTOR_ENABLED'), + 'Allows to set Bot-Detector enabled/disabled' + ); // $accepted_constants = array( // // needs to be refactored // 'APBCT_SERVICE__SELF_OWNED_ACCESS_KEY' => array( diff --git a/lib/Cleantalk/ApbctWP/State.php b/lib/Cleantalk/ApbctWP/State.php index 402a8ac6f..b0e0804b6 100644 --- a/lib/Cleantalk/ApbctWP/State.php +++ b/lib/Cleantalk/ApbctWP/State.php @@ -84,7 +84,6 @@ class State extends \Cleantalk\Common\State 'data__use_static_js_key' => -1, 'data__general_postdata_test' => 0, //CAPD 'data__set_cookies' => 3, // Cookies type: 0 - Off / 1 - Native cookies / 2 - Alt cookies / 3 - Auto - 'data__bot_detector_enabled' => 1, 'data__pixel' => '3', 'data__email_check_before_post' => 1, 'data__email_check_exist_post' => 1, @@ -483,10 +482,10 @@ protected function setDefinitions() { global $wpdb; - $db_prefix = is_multisite() && is_main_site() ? $wpdb->base_prefix : $wpdb->prefix; + $db_prefix = is_multisite() && $this->isMainSite() ? $wpdb->base_prefix : $wpdb->prefix; // Use tables from main site on wpms_mode=2 $fw_db_prefix = - is_multisite() && ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 + is_multisite() && ! $this->isMainSite() && $this->getWpmsMode() == 2 ? $wpdb->base_prefix : $db_prefix; @@ -567,7 +566,14 @@ protected function setOptions() $wpdb_option_name = $this->option_prefix . '_' . $option_name; //prevent fatal on broken serialized data try { - $option = get_option($wpdb_option_name); + if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) { + // Options have to be gathered from the main site in this case + switch_to_blog(get_main_site_id()); + $option = get_option($wpdb_option_name); + restore_current_blog(); + } else { + $option = get_option($wpdb_option_name); + } } catch (\UnexpectedValueException $e) { $default_option_name = 'default_' . $option_name; delete_option($wpdb_option_name); @@ -649,12 +655,16 @@ protected function init() $this->stats['no_cookie_data_taken'] = null; // Network with Mutual Access key - if ( ! is_main_site() && $this->network_settings['multisite__work_mode'] == 2 ) { - // Get stats from main blog - switch_to_blog(get_main_site_id()); + if ( ! $this->isMainSite() && $this->getWpmsMode() === 2 ) { + // Get stats and errors from main blog + + $this->switchToMainBlog(); $main_blog_stats = get_option($this->option_prefix . '_stats'); - restore_current_blog(); + $main_blog_errors = get_option($this->option_prefix . '_errors'); + $this->switchToCurrentBlog(); + $this->stats = $main_blog_stats; + $this->errors = $main_blog_errors; $this->api_key = $this->network_settings['apikey']; $this->key_is_ok = $this->network_data['key_is_ok']; $this->user_token = $this->network_data['user_token']; @@ -1048,4 +1058,24 @@ public function getJsErrorsReport() return $this->js_errors_report; } + + protected function isMainSite() + { + return is_main_site(); + } + + protected function getWpmsMode() + { + return (int) $this->network_settings['multisite__work_mode']; + } + + protected function switchToMainBlog() + { + switch_to_blog(get_main_site_id()); + } + + protected function switchToCurrentBlog() + { + restore_current_blog(); + } } diff --git a/lib/Cleantalk/ApbctWP/Variables/AltSessions.php b/lib/Cleantalk/ApbctWP/Variables/AltSessions.php index 3c455a887..69e438266 100644 --- a/lib/Cleantalk/ApbctWP/Variables/AltSessions.php +++ b/lib/Cleantalk/ApbctWP/Variables/AltSessions.php @@ -224,6 +224,10 @@ public static function setFromRemote($request = null) $cookies_array[$name] = (bool)$value; break; case 'string': + if (is_array($value) || is_object($value)) { + unset($cookies_array[$name]); + break; + } $cookies_array[$name] = (string)$value; break; case 'json': diff --git a/readme.txt b/readme.txt index 7834cfe7f..970f746c8 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: glomberg, alexandergull, sergefcleantalk, antonv1 Tags: antispam, comments, contact form, captcha, spam Requires at least: 4.7 -Tested up to: 6.9 +Tested up to: 7 Requires PHP: 7.2 -Stable tag: 6.75 +Stable tag: 6.77 License: GPLv2 Blocks spam comments, fake users, contact form spam and more. No impact on SEO. Privacy focused. CAPTCHA free, premium Antispam plugin. @@ -412,6 +412,28 @@ Yes, it is. Please read this article, == Changelog == += 6.77 16.04.2026 = +* Fix. AltSession. Correcting the issue of array conversion +* New. BookingCalendar. New integration with BookingCalendar +* Upd. Settings. Updated flow to check pingback. (#764) (#773) (#774) +* Fix. CF7. Edit honeypot +* Fix. Integration. EDD integration fixed. (#770) +* Fix. Code. Editing the bot detector settings +* Fix. Exclusion. Skip request from Metorik Helper +* Fix. Common. Add bot detector state to ct_options. (#778) +* Fix. WPMS. Errors output for WPMS mutual-mutual mode fixed. (#772) +* Fix. WPMS. Settings for `mutual/mutual` fixed. +* Fix. WPMS. Settings page error fixed. + += 6.76 02.04.2026 = +* Mod. ForceAltCookies. Removed the use of force alt cookies for integration with piotnet-addons-for-elementor +* Upd. Integrations. Improve FluentBooking flow to attach meta data to request. +* Upd. Settings. Updated flow to check pingback. +* Upd. Settings. Bot Detector setting - bot-detector setting removed. +* Fix. Code. Unit tests fixed: TestFluentForms, TestNinjaForms. +* Fix. JS. Gathering. Passing js_on independent of gathering loaded. +* Fix. Integrations. QuForm. Fixed js_on param gathering. + = 6.75 19.03.2026 = * Upd. JS. catchJqueryAjax. Refactored to also use ajaxPrefilter. Bloomform now skip using force alt-sessions. * Upd. ContactEncoder. Improve aria labels protect. diff --git a/templates/apbct_settings__footer.php b/templates/apbct_settings__footer.php index 92e109469..b68583b3a 100644 --- a/templates/apbct_settings__footer.php +++ b/templates/apbct_settings__footer.php @@ -43,7 +43,6 @@ function apbct_settings__footer() ]; $block2_links = [ ['text' => 'Security plugin by CleanTalk', 'url' => admin_url('plugin-install.php') . '?s=spbct&tab=search&type=term'], - ['text' => esc_html__('Forms to CRM / Gravity Add-On'), 'url' => admin_url('plugin-install.php') . '?s=cleantalk-doboard-add-on-for-gravity-forms&tab=search&type=term'], ]; ?> diff --git a/tests/Antispam/Integrations/TestCleantalkPreprocessComment.php b/tests/Antispam/Integrations/TestCleantalkPreprocessComment.php new file mode 100644 index 000000000..4656b9161 --- /dev/null +++ b/tests/Antispam/Integrations/TestCleantalkPreprocessComment.php @@ -0,0 +1,242 @@ +savedCurrentUser = isset($current_user) ? $current_user : null; + $this->savedDisallowedKeys = (string) get_option('disallowed_keys', ''); + } + + protected function tearDown(): void + { + global $current_user; + $current_user = $this->savedCurrentUser; + if (function_exists('wp_set_current_user')) { + wp_set_current_user(0); + } + update_option('disallowed_keys', $this->savedDisallowedKeys); + parent::tearDown(); + } + + /** + * @return \stdClass + */ + private function makeSubscriberUser() + { + $subscriber = new \stdClass(); + $subscriber->ID = 91234; + $subscriber->roles = array('subscriber'); + $subscriber->caps = array('subscriber' => true); + + return $subscriber; + } + + /** + * @param array $wp_comment + * @param object $current_user + * @param bool $ct_comment_done + * @param object|null $apbct + * + * @return mixed + */ + private function invokeDoSkipReason(array $wp_comment, $current_user, $ct_comment_done = false, $apbct = null) + { + $integration = new CleantalkPreprocessComment(); + $reflection = new \ReflectionClass($integration); + + $wp_comment_prop = $reflection->getProperty('wp_comment'); + $wp_comment_prop->setAccessible(true); + $wp_comment_prop->setValue($integration, $wp_comment); + + if ($apbct !== null) { + $apbct_prop = $reflection->getProperty('apbct'); + $apbct_prop->setAccessible(true); + $apbct_prop->setValue($integration, $apbct); + } + + $method = $reflection->getMethod('doSkipReason'); + $method->setAccessible(true); + + return $method->invoke($integration, $current_user, $ct_comment_done); + } + + public function testDoSkipReasonSkipsAdministratorBeforePingbackHandling(): void + { + $user = new \stdClass(); + $user->roles = array('administrator'); + + $result = $this->invokeDoSkipReason( + array( + 'comment_type' => 'pingback', + 'comment_post_ID' => 1, + ), + $user + ); + + $this->assertNotFalse($result); + $this->assertStringContainsString('doSkipReason', $result); + } + + public function testDoSkipReasonSkipsPingback(): void + { + $user = new \stdClass(); + $user->roles = array('subscriber'); + + $result = $this->invokeDoSkipReason( + array( + 'comment_type' => 'pingback', + 'comment_post_ID' => 1, + ), + $user + ); + + $this->assertNotFalse($result); + $this->assertStringContainsString('doSkipReason', $result); + } + + public function testDoSkipReasonSkipsTrackback(): void + { + $user = new \stdClass(); + $user->roles = array('subscriber'); + + $result = $this->invokeDoSkipReason( + array( + 'comment_type' => 'trackback', + 'comment_post_ID' => 1, + ), + $user + ); + + $this->assertNotFalse($result); + $this->assertStringContainsString('doSkipReason', $result); + } + + /** + * Missing comment_type must default to "comment" and continue into the main ruleset (not pingback skip). + */ + public function testDoSkipReasonDefaultsMissingCommentTypeToComment(): void + { + global $current_user; + $subscriber = $this->makeSubscriberUser(); + $current_user = $subscriber; + + $apbct = (object) array( + 'settings' => array( + 'forms__comments_test' => 0, + ), + ); + + $wp_comment = array( + 'comment_post_ID' => 1, + ); + + $result = $this->invokeDoSkipReason($wp_comment, $subscriber, false, $apbct); + + $this->assertNotFalse($result); + $this->assertStringContainsString('doSkipReason', $result); + } + + public function testDoSkipReasonSkipsWhenCommentAlreadyHandled(): void + { + global $current_user; + $subscriber = $this->makeSubscriberUser(); + $current_user = $subscriber; + + $apbct = (object) array( + 'settings' => array( + 'forms__comments_test' => 1, + ), + ); + + $wp_comment = array( + 'comment_type' => 'comment', + 'comment_post_ID' => 1, + 'comment_author' => 'John', + 'comment_author_email' => 'john@example.com', + 'comment_author_url' => 'https://example.com', + 'comment_content' => 'Regular text', + ); + + $result = $this->invokeDoSkipReason($wp_comment, $subscriber, true, $apbct); + + $this->assertNotFalse($result); + $this->assertStringContainsString('doSkipReason', $result); + } + + public function testDoSkipReasonReturnsFalseForRegularCommentWithoutBlacklistedContent(): void + { + global $current_user; + $subscriber = $this->makeSubscriberUser(); + $current_user = $subscriber; + + update_option('disallowed_keys', 'forbidden-keyword-that-is-not-used'); + + $apbct = (object) array( + 'settings' => array( + 'forms__comments_test' => 1, + ), + ); + + $wp_comment = array( + 'comment_type' => 'comment', + 'comment_post_ID' => 1, + 'comment_author' => 'John', + 'comment_author_email' => 'john@example.com', + 'comment_author_url' => 'https://example.com', + 'comment_content' => 'Absolutely clean content', + ); + + $result = $this->invokeDoSkipReason($wp_comment, $subscriber, false, $apbct); + + $this->assertFalse($result); + } + + public function testDoSkipReasonSkipsWhenWordPressBlacklistMatches(): void + { + global $current_user; + $subscriber = $this->makeSubscriberUser(); + $current_user = $subscriber; + + update_option('disallowed_keys', 'blacklisted-fragment'); + + $apbct = (object) array( + 'settings' => array( + 'forms__comments_test' => 1, + ), + ); + + $wp_comment = array( + 'comment_type' => 'comment', + 'comment_post_ID' => 1, + 'comment_author' => 'John', + 'comment_author_email' => 'john@example.com', + 'comment_author_url' => 'https://example.com', + 'comment_content' => 'Message contains blacklisted-fragment inside', + ); + + $result = $this->invokeDoSkipReason($wp_comment, $subscriber, false, $apbct); + + $this->assertNotFalse($result); + $this->assertStringContainsString('doSkipReason', $result); + } +} + diff --git a/tests/Antispam/IntegrationsByHook/TestBookingCalendar.php b/tests/Antispam/IntegrationsByHook/TestBookingCalendar.php new file mode 100644 index 000000000..dd2257872 --- /dev/null +++ b/tests/Antispam/IntegrationsByHook/TestBookingCalendar.php @@ -0,0 +1,119 @@ +integration = new BookingCalendar(); + } + + protected function tearDown(): void + { + $_POST = []; + parent::tearDown(); + } + + /** + * Test with valid booking calendar data (with _val fields) + */ + public function testGetDataForCheckingWithValFields() + { + $_POST['calendar_request_params'] = [ + 'formdata' => 'text^firstname1^John~text^firstname_val1^John~text^secondname1^Doe~text^secondname_val1^Doe~email^email1^john.doe@example.com~email^email_val1^john.doe@example.com~textarea^textarea1^Hello~textarea^textarea_val1^Hello' + ]; + $result = $this->integration->getDataForChecking(null); + $this->assertIsArray($result); + $this->assertEquals('john.doe@example.com', $result['email']); + $this->assertEquals('John Doe', $result['nickname']); + $this->assertArrayHasKey('message', $result); + $this->assertArrayHasKey('textarea_val1[value]', $result['message']); + $this->assertEquals('Hello', $result['message']['textarea_val1[value]']); + $this->assertArrayNotHasKey('firstname_val1[value]', $result['message']); + $this->assertArrayNotHasKey('email_val1[value]', $result['message']); + } + + /** + * Test with only firstname and email (no secondname) + */ + public function testGetDataForCheckingWithOnlyFirstname() + { + $_POST['calendar_request_params'] = [ + 'formdata' => 'text^firstname_val1^Jane~email^email_val1^jane@example.com~textarea^textarea_val1^Hi' + ]; + $result = $this->integration->getDataForChecking(null); + $this->assertIsArray($result); + $this->assertEquals('jane@example.com', $result['email']); + $this->assertEquals('Jane', $result['nickname']); + $this->assertArrayHasKey('textarea_val1[value]', $result['message']); + } + + /** + * Test with only secondname and email (no firstname) + */ + public function testGetDataForCheckingWithOnlySecondname() + { + $_POST['calendar_request_params'] = [ + 'formdata' => 'text^secondname_val1^Smith~email^email_val1^smith@example.com~textarea^textarea_val1^Test message' + ]; + $result = $this->integration->getDataForChecking(null); + $this->assertIsArray($result); + $this->assertEquals('smith@example.com', $result['email']); + $this->assertEquals('Smith', $result['nickname']); + $this->assertArrayHasKey('textarea_val1[value]', $result['message']); + } + + /** + * Test with no email (should return null) + */ + public function testGetDataForCheckingNoEmail() + { + $_POST['calendar_request_params'] = [ + 'formdata' => 'text^firstname_val1^NoEmail~textarea^textarea_val1^No email here' + ]; + $result = $this->integration->getDataForChecking(null); + $this->assertIsArray($result); + $this->assertEquals('', $result['email']); + } + + /** + * Test with no formdata (should return null) + */ + public function testGetDataForCheckingNoFormdata() + { + $_POST['calendar_request_params'] = []; + $result = $this->integration->getDataForChecking(null); + $this->assertNull($result); + } + + /** + * Test with no calendar_request_params (should return null) + */ + public function testGetDataForCheckingNoParams() + { + $_POST = []; + $result = $this->integration->getDataForChecking(null); + $this->assertNull($result); + } + + /** + * Test with both _val and non-_val textarea fields (should keep only _val) + */ + public function testGetDataForCheckingTextareaDeduplication() + { + $_POST['calendar_request_params'] = [ + 'formdata' => 'textarea^textarea1^Duplicate~textarea^textarea_val1^Unique' + ]; + $result = $this->integration->getDataForChecking(null); + $this->assertIsArray($result); + $this->assertArrayHasKey('textarea_val1[value]', $result['message']); + $this->assertEquals('Unique', $result['message']['textarea_val1[value]']); + $this->assertArrayNotHasKey('textarea1[value]', $result['message']); + } +} diff --git a/tests/Antispam/IntegrationsByHook/TestEasyDigitalDownloads.php b/tests/Antispam/IntegrationsByHook/TestEasyDigitalDownloads.php new file mode 100644 index 000000000..110ce93ba --- /dev/null +++ b/tests/Antispam/IntegrationsByHook/TestEasyDigitalDownloads.php @@ -0,0 +1,70 @@ +integration = new EasyDigitalDownloads(); + } + + protected function tearDown(): void + { + // Clean up global state + $_POST = []; + $_GET = []; + Post::getInstance()->variables = []; + Get::getInstance()->variables = []; + parent::tearDown(); + } + + public function testGetDataForCheckingRegisterPage() + { + $_POST['edd_action'] = 'user_register'; + $_POST['edd_user_login'] = 'John'; + $_POST['edd_user_email'] = 'john.doe@example.com'; + + $result = $this->integration->getDataForChecking(null); + + $this->assertIsArray($result); + $this->assertEquals('john.doe@example.com', $result['email']); + $this->assertEquals('', $result['nickname']); // NickName not detected at that integration + $this->assertTrue($result['register']); + } + + public function testGetDataForCheckingRegisterDuringCheckout() + { + $_POST['edd-process-checkout-nonce'] = 'user_register'; + $_POST['edd_first'] = 'John'; + $_POST['edd_last'] = 'Doe'; + $_POST['edd_email'] = 'john.doe@example.com'; + + $result = $this->integration->getDataForChecking(null); + + $this->assertIsArray($result); + $this->assertEquals('john.doe@example.com', $result['email']); + $this->assertEquals('', $result['nickname']); // NickName not detected at that integration + $this->assertTrue($result['register']); + } + + public function testGetDataForCheckingRegisterCommon() + { + $_POST['edd_user_login'] = 'John'; + $_POST['edd_user_email'] = 'john.doe@example.com'; + + $result = $this->integration->getDataForChecking(['user_email' => 'any_email_no_sense']); + + $this->assertIsArray($result); + $this->assertEquals('john.doe@example.com', $result['email']); + $this->assertEquals('', $result['nickname']); // NickName not detected at that integration + $this->assertTrue($result['register']); + } +} diff --git a/tests/Antispam/IntegrationsByHook/TestFluentForms.php b/tests/Antispam/IntegrationsByHook/TestFluentForms.php index 51183a620..9de8f831d 100644 --- a/tests/Antispam/IntegrationsByHook/TestFluentForms.php +++ b/tests/Antispam/IntegrationsByHook/TestFluentForms.php @@ -8,6 +8,8 @@ class TestFluentForms extends TestCase { + private $post; + /** @var FluentForm */ private $fluentForm; diff --git a/tests/Antispam/IntegrationsByHook/TestNinjaForms.php b/tests/Antispam/IntegrationsByHook/TestNinjaForms.php index 27ff679ca..4249fe5e5 100644 --- a/tests/Antispam/IntegrationsByHook/TestNinjaForms.php +++ b/tests/Antispam/IntegrationsByHook/TestNinjaForms.php @@ -11,6 +11,8 @@ class TestNinjaForms extends TestCase { + private $post; + /** @var NinjaForms */ private $ninjaForms; diff --git a/tests/ApbctWP/BaseCall/BaseCallDefaultParamsTest.php b/tests/ApbctWP/BaseCall/BaseCallDefaultParamsTest.php new file mode 100644 index 000000000..9cf2bde47 --- /dev/null +++ b/tests/ApbctWP/BaseCall/BaseCallDefaultParamsTest.php @@ -0,0 +1,195 @@ +getMockBuilder(DefaultParams::class) + ->setConstructorArgs([$authKey, $senderInfo]) + ->onlyMethods([ + 'getSenderIP', + 'getXForwardedForIP', + 'getXRealIP', + 'getJsOn', + 'getSubmitTime', + 'getAgent', + 'getTestIp', + 'ipGet', + ]) + ->getMock(); + } + + public function testGetSenderIPWithTestIp() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getTestIp', + 'getSenderIP', + ]) + ->getMock(); + + $obj->method('getTestIp') + ->willReturn(null); + + $obj->method('getSenderIP') + ->willReturn('1.1.1.1'); + + $this->assertEquals('1.1.1.1', $obj->get()['sender_ip']); + } + + public function testGetSenderIPWithoutTestIp() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getTestIp', + ]) + ->getMock(); + + $obj->method('getTestIp') + ->willReturn('1.2.3.4'); + + $this->assertEquals('1.2.3.4', $obj->get()['sender_ip']); + } + + public function testGetXForwardedForIP() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getXForwardedForIP', + ]) + ->getMock(); + + $obj->method('getXForwardedForIP') + ->willReturn('10.0.0.1'); + + $this->assertEquals('10.0.0.1', $obj->get()['x_forwarded_for']); + } + + public function testGetXRealIP() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getXRealIP', + ]) + ->getMock(); + + $obj->method('getXRealIP') + ->willReturn('10.0.0.2'); + + $this->assertEquals('10.0.0.2', $obj->get()['x_real_ip']); + } + + public function testGetJsOn() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getJsOn', + ]) + ->getMock(); + + $obj->method('getJsOn')->willReturn(1); + + $this->assertEquals(1, $obj->get()['js_on']); + } + + public function testGetJsOnFail() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getJsOn', + ]) + ->getMock(); + + $obj->method('getJsOn')->willReturn(0); + + $this->assertEquals(0, $obj->get()['js_on']); + + $obj->method('getJsOn')->willReturn(null); + + $this->assertEquals(null, $obj->get()['js_on']); + } + + public function testGetSubmittime() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'getSubmitTime', + ]) + ->getMock(); + + $obj->method('getSubmitTime') + ->willReturn(123); + + $this->assertEquals(123, $obj->get()['submit_time']); + } + + public function testGetIP() + { + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', []]) + ->onlyMethods([ + 'ipGet', + ]) + ->getMock(); + + $obj->method('ipGet')->with('remote_addr')->willReturn('1.2.3.4'); + + $this->assertEquals('1.2.3.4', $obj->getSenderIP()); + } + + public function testGetFullData() + { + $senderInfo = ['foo' => 'bar']; + + $obj = $this->getMockBuilder(DefaultParams::class) + ->setConstructorArgs(['test_key', $senderInfo]) + ->onlyMethods([ + 'getSenderIP', + 'getXForwardedForIP', + 'getXRealIP', + 'getJsOn', + 'getSubmitTime', + 'getAgent', + 'getTestIp', + 'ipGet', + ]) + ->getMock(); + + $obj->method('getTestIp')->willReturn(null); + $obj->method('getSenderIP')->willReturn('1.2.3.4'); + $obj->method('getAgent')->willReturn('test-agent'); + $obj->method('getSubmitTime')->willReturn(999); + $obj->method('getXRealIP')->willReturn('10.0.0.2'); + $obj->method('getXForwardedForIP')->willReturn('10.0.0.1'); + $obj->method('getJsOn')->willReturn(1); + $obj->method('getSubmitTime')->willReturn(true); + + $result = $obj->get(); + + $this->assertEquals([ + 'sender_ip' => '1.2.3.4', + 'x_forwarded_for' => '10.0.0.1', + 'x_real_ip' => '10.0.0.2', + 'auth_key' => 'test_key', + 'js_on' => 1, + 'agent' => 'test-agent', + 'sender_info' => $senderInfo, + 'submit_time' => 999, + ], $result); + } +} diff --git a/tests/ApbctWP/PluginSettingsPage/TestSummaryAndSupportRenderer.php b/tests/ApbctWP/PluginSettingsPage/TestSummaryAndSupportRenderer.php new file mode 100644 index 000000000..d65af3307 --- /dev/null +++ b/tests/ApbctWP/PluginSettingsPage/TestSummaryAndSupportRenderer.php @@ -0,0 +1,193 @@ +apbct = new State('cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats')); + } + + public function testRender() + { + $renderer = new SummaryAndSupportRenderer($this->apbct); + $html = $renderer->render(); + + // 1. Check for the main container element + $this->assertStringContainsString( + 'id="apbct_summary_and_support"', + $html, + 'Main container div should exist' + ); + + // 2. Verify the container is hidden by default + $this->assertStringContainsString( + 'style="display: none;"', + $html, + 'Container should be hidden by default' + ); + + // 3. Verify both sections (Summary and Support) exist + $this->assertStringContainsString( + 'id="apbct_summary_and_support-left_side"', + $html, + 'Left side (Summary) should exist' + ); + + $this->assertStringContainsString( + 'id="apbct_summary_and_support-right_side"', + $html, + 'Right side (Support) should exist' + ); + + // 4. Check section headers + $this->assertStringContainsString( + '

Summary

', + $html, + 'Summary header should be present' + ); + + $this->assertStringContainsString( + '

Support

', + $html, + 'Support header should be present' + ); + + // 5. Verify all subheaders exist + $this->assertStringContainsString( + 'Statistics', + $html, + 'Statistics subheader should be present' + ); + + $this->assertStringContainsString( + 'Server requirements check', + $html, + 'Server requirements subheader should be present' + ); + + $this->assertStringContainsString( + 'Connections', + $html, + 'Connections subheader should be present' + ); + + // 6. Check support buttons and links + $this->assertStringContainsString( + 'Open Support Ticket', + $html, + 'Open Support Ticket button should exist' + ); + + $this->assertStringContainsString( + 'CleanTalk Anti-Spam Help', + $html, + 'CleanTalk Anti-Spam Help link should exist' + ); + + $this->assertStringContainsString( + 'Create Support User', + $html, + 'Create Support User button should exist' + ); + + // 7. Verify user creation result display elements + $this->assertStringContainsString( + 'id="apbct_summary_and_support-user_creation_username"', + $html, + 'Username display element should exist' + ); + + $this->assertStringContainsString( + 'id="apbct_summary_and_support-user_creation_email"', + $html, + 'Email display element should exist' + ); + + $this->assertStringContainsString( + 'id="apbct_summary_and_support-user_creation_password"', + $html, + 'Password display element should exist' + ); + + // 8. Check for preloader image + $this->assertStringContainsString( + 'apbct_preloader_button', + $html, + 'Preloader image should exist' + ); + + // 9. Verify statistics list container exists + $this->assertStringContainsString( + 'apbct_summary-list_of_items', + $html, + 'Summary list container should exist' + ); + + // 10. Verify statistics list items have the correct icon class + $this->assertStringContainsString( + 'apbct-icon-right-dir', + $html, + 'Statistics items should have the right-dir icon class' + ); + + // 11. Check for server requirements status icons + $this->assertStringContainsString( + 'apbct-icon-ok', + $html, + 'Server requirements should display success icons' + ); + + // 12. Verify the "no failed connections" message + $this->assertStringContainsString( + 'There are no failed connections to server.', + $html, + 'Should display message about no failed connections' + ); + + // 13. Check for help icon tooltip trigger + $this->assertStringContainsString( + 'apbct-icon-help-circled', + $html, + 'Help icon should be present for settings descriptions' + ); + + // 14. Verify plugin version is displayed + $this->assertStringContainsString( + 'Plugin version', + $html, + 'Plugin version information should be displayed' + ); + + // 15. Check that JavaScript function is attached to create user button + $this->assertStringContainsString( + 'onclick="apbctCreateSupportUser()"', + $html, + 'Create User button should have onclick handler' + ); + + // 16. Verify all links have target="_blank" for external URLs + $this->assertStringContainsString( + 'target="_blank"', + $html, + 'External links should open in new tab' + ); + + // 17. Check that the wrapper structure includes both sides + $this->assertStringContainsString( + 'id="apbct_summary_and_support-sides_wrap"', + $html, + 'Sides wrapper container should exist' + ); + + // 18. Verify the result container has all necessary child elements + $this->assertStringContainsString( + 'apbct_summary_and_support-user_creation_row', + $html, + 'User creation result should have row structure' + ); + } +} \ No newline at end of file diff --git a/tests/ApbctWP/TestState.php b/tests/ApbctWP/TestState.php index aa413ad8d..e326f550c 100644 --- a/tests/ApbctWP/TestState.php +++ b/tests/ApbctWP/TestState.php @@ -4,6 +4,8 @@ use PHPUnit\Framework\TestCase; use PHPUnit\Framework\Error\Notice; +require_once(CLEANTALK_PLUGIN_DIR . 'inc/cleantalk-updater.php'); + class TestApbctState extends TestCase { @@ -22,6 +24,7 @@ public function testIsHaveErrors_haveErrors() update_option( 'cleantalk_errors', array( 'error_type' => 'Error text' ) ); $apbct = new State( 'cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats') ); $this->assertTrue( $apbct->isHaveErrors() ); + delete_option('cleantalk_errors'); } public function testIsHaveErrors_emptyErrors() @@ -29,6 +32,7 @@ public function testIsHaveErrors_emptyErrors() update_option( 'cleantalk_errors', array() ); $apbct = new State( 'cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats') ); $this->assertFalse( $apbct->isHaveErrors() ); + delete_option('cleantalk_errors'); } public function testIsHaveErrors_emptyInnerErrors() @@ -36,6 +40,7 @@ public function testIsHaveErrors_emptyInnerErrors() update_option( 'cleantalk_errors', array( 'error_type' => array() ) ); $apbct = new State( 'cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats') ); $this->assertFalse( $apbct->isHaveErrors() ); + delete_option('cleantalk_errors'); } public function testIsHaveErrors_filledInnerErrors() @@ -43,6 +48,22 @@ public function testIsHaveErrors_filledInnerErrors() update_option( 'cleantalk_errors', array( 'error_type' => array( 'error_text' => 'Error text' ) ) ); $apbct = new State( 'cleantalk', array('settings', 'data', 'errors', 'remote_calls', 'stats', 'fw_stats') ); $this->assertTrue( $apbct->isHaveErrors() ); + delete_option('cleantalk_errors'); + } + + public function testErrorsArrayFromState() + { + $apbct = new State('cleantalk', array('settings', 'errors')); + + $apbct->errorAdd('api', 'error'); + + $errors_from_state = (array) $apbct->errors; + + $this->assertArrayHasKey('api', $errors_from_state); + $this->assertArrayHasKey('error', $errors_from_state['api'][0]); + $this->assertArrayHasKey('error_time', $errors_from_state['api'][0]); + + delete_option('cleantalk_errors'); } //UpdateVars section @@ -58,6 +79,7 @@ public function testAutoSaveVars__remote_calls(){ apbct_run_update_actions('6.1','6.2'); $db_result = get_option('cleantalk_remote_calls')['post_api_key']; $this->assertEquals(array ('last_call' => 0,), $db_result); + delete_option('cleantalk_remote_calls'); } public function testAutoSaveVars__settings(){ @@ -71,6 +93,7 @@ public function testAutoSaveVars__settings(){ apbct_run_update_actions('6.1','6.2'); $db_result = get_option('cleantalk_settings')['forms__registrations_test']; $this->assertEquals(1, $db_result); + delete_option('cleantalk_settings'); } public function testAutoSaveVars__data(){ @@ -84,6 +107,7 @@ public function testAutoSaveVars__data(){ apbct_run_update_actions('6.1','6.2'); $db_result = get_option('cleantalk_data')['js_key_lifetime']; $this->assertEquals(86400, $db_result); + delete_option('cleantalk_data'); } public function testAutoSaveVars__network_settings(){ @@ -97,6 +121,7 @@ public function testAutoSaveVars__network_settings(){ apbct_run_update_actions('6.1','6.2'); $db_result = get_option('cleantalk_network_settings')['multisite__white_label__plugin_name']; $this->assertEquals('Anti-Spam by CleanTalk', $db_result); + delete_option('network_settings'); } public function testAutoSaveVars__network_data(){ @@ -110,6 +135,7 @@ public function testAutoSaveVars__network_data(){ apbct_run_update_actions('6.1','6.2'); $db_result = get_option('cleantalk_network_data')['moderate']; $this->assertEquals(0, $db_result); + delete_option('cleantalk_network_data'); } public function testAutoSaveVars__stats(){ @@ -161,6 +187,7 @@ public function testAutoSaveVars__stats(){ $this->assertEquals(14400, $db_result); $db_result = get_option('cleantalk_stats')['sfw']['sending_logs__timestamp']; $this->assertEquals(10000, $db_result); + delete_option('cleantalk_stats'); } @@ -175,6 +202,7 @@ public function testAutoSaveVars__fw_stats(){ apbct_run_update_actions('6.1','6.2'); $db_result = get_option('cleantalk_fw_stats')['firewall_updating_id']; $this->assertEquals(null, $db_result); + delete_option('cleantalk_fw_stats'); } public function testAutoSaveVars__fw_stats_await_exception_without_var_updater(){ @@ -191,5 +219,33 @@ public function testAutoSaveVars__fw_stats_await_exception_without_var_updater() //await udefined index $this->expectException(Notice::class); $db_result = get_option('cleantalk_fw_stats')['firewall_updating_id']; + delete_option('cleantalk_fw_stats'); + } + + public function testInit() + { + $apbct = new class ('cleantalk', array('settings', 'errors')) extends State { + protected function isMainSite() + { + return false; + } + protected function getWpmsMode() + { + return 2; + } + protected function switchToMainBlog(){} + protected function switchToCurrentBlog(){} + + }; + + $apbct->errorAdd('api', 'error'); + + $errors_from_state = (array) $apbct->errors; + + $this->assertArrayHasKey('api', $errors_from_state); + $this->assertArrayHasKey('error', $errors_from_state['api'][0]); + $this->assertArrayHasKey('error_time', $errors_from_state['api'][0]); + + delete_option('cleantalk_errors'); } } diff --git a/tests/ApbctWP/TestSubmitTimeHandler.php b/tests/ApbctWP/TestSubmitTimeHandler.php index 4d86edb9e..52c53ba7c 100644 --- a/tests/ApbctWP/TestSubmitTimeHandler.php +++ b/tests/ApbctWP/TestSubmitTimeHandler.php @@ -9,8 +9,10 @@ public function testGetFromRequestReturnsNullWhenCalculationDisabled() { global $apbct; $apbct = (object) [ - 'settings' => ['data__bot_detector_enabled' => true], - 'data' => ['cookies_type' => 'alternative'] + 'data' => [ + 'cookies_type' => 'alternative', + 'bot_detector_enabled' => true + ] ]; $result = SubmitTimeHandler::getFromRequest(); @@ -23,8 +25,10 @@ public function testSetToRequestModifiesArrayRegardlessOfCalculationDisabled() { global $apbct; $apbct = (object) [ - 'settings' => ['data__bot_detector_enabled' => true], - 'data' => ['cookies_type' => 'alternative'] + 'data' => [ + 'cookies_type' => 'alternative', + 'bot_detector_enabled' => true + ] ]; $cookie_test_value = []; @@ -40,8 +44,10 @@ public function testIsCalculationDisabledReturnsTrueWhenBotDetectorEnabled() { global $apbct; $apbct = (object) [ - 'settings' => ['data__bot_detector_enabled' => true], - 'data' => ['cookies_type' => 'alternative'] + 'data' => [ + 'cookies_type' => 'alternative', + 'bot_detector_enabled' => true + ] ]; $result = SubmitTimeHandler::isCalculationDisabled(); @@ -52,7 +58,7 @@ public function testIsCalculationDisabledReturnsTrueWhenBotDetectorEnabled() public function testIsCalculationDisabledReturnsFalseWhenBotDetectorDisabled() { global $apbct; - $apbct = (object) ['settings' => ['data__bot_detector_enabled' => false]]; + $apbct = (object) ['data' => ['bot_detector_enabled' => false]]; $result = SubmitTimeHandler::isCalculationDisabled(); diff --git a/tests/Inc/TestCleantalkSettings.php b/tests/Inc/TestCleantalkSettings.php new file mode 100644 index 000000000..c0e04e939 --- /dev/null +++ b/tests/Inc/TestCleantalkSettings.php @@ -0,0 +1,43 @@ +assertArrayHasKey('data_processing', $fields); + + $data_processing_options = $fields['data_processing']['fields']; + + $this->assertArrayNotHasKey('data__bot_detector_enabled', $data_processing_options); + $this->assertArrayHasKey('bot_detector_state', $data_processing_options); + $this->assertArrayHasKey('callback', $data_processing_options['bot_detector_state']); + $this->assertArrayHasKey('long_description', $data_processing_options['bot_detector_state']); + $this->assertArrayHasKey('display', $data_processing_options['bot_detector_state']); + $this->assertArrayNotHasKey('parent', $data_processing_options['exclusions__bot_detector']); + } + + public function testApbctSettingsSetFieldsEmailCheckReadMore() + { + $fields = apbct_settings__set_fields(); + + $this->assertArrayHasKey('data_processing', $fields); + + $data_processing_options = $fields['data_processing']['fields']; + + $this->assertArrayHasKey('data__email_check_exist_post', $data_processing_options); + $this->assertArrayHasKey('description', $data_processing_options['data__email_check_exist_post']); + $this->assertStringContainsString('https://cleantalk.org/help/show-email-existence-alert', $data_processing_options['data__email_check_exist_post']['description']); + $this->assertStringContainsString('Read more', $data_processing_options['data__email_check_exist_post']['description']); + } +} \ No newline at end of file diff --git a/tests/StandaloneFunctions/TestBotDetectorLogGathering.php b/tests/StandaloneFunctions/TestBotDetectorLogGathering.php index e67f8094f..133e0a9a3 100644 --- a/tests/StandaloneFunctions/TestBotDetectorLogGathering.php +++ b/tests/StandaloneFunctions/TestBotDetectorLogGathering.php @@ -11,7 +11,7 @@ class TestBotDetectorLogGathering extends TestCase public function test_returnsFrontendDataLog() { global $apbct; - $apbct->settings['data__bot_detector_enabled'] = '1'; + $apbct->data['bot_detector_enabled'] = '1'; AltSessions::set('ct_bot_detector_frontend_data_log', json_encode(['log' => 'data'])); $result = apbct__bot_detector_get_fd_log(); @@ -27,7 +27,7 @@ public function test_returnsFrontendDataLog() public function test_returnsErrorWhenDisabled() { global $apbct; - $apbct->settings['data__bot_detector_enabled'] = '0'; + $apbct->data['bot_detector_enabled'] = '0'; $result = apbct__bot_detector_get_fd_log(); $expected = json_encode([ @@ -42,7 +42,7 @@ public function test_returnsErrorWhenDisabled() public function test_returnsErrorWhenNoLogFound() { global $apbct; - $apbct->settings['data__bot_detector_enabled'] = '1'; + $apbct->data['bot_detector_enabled'] = '1'; AltSessions::wipe(); $result = apbct__bot_detector_get_fd_log(); @@ -58,7 +58,7 @@ public function test_returnsErrorWhenNoLogFound() public function test_returnsErrorWhenLogNotString() { global $apbct; - $apbct->settings['data__bot_detector_enabled'] = '1'; + $apbct->data['bot_detector_enabled'] = '1'; AltSessions::set('ct_bot_detector_frontend_data_log', false); $result = apbct__bot_detector_get_fd_log(); @@ -74,7 +74,7 @@ public function test_returnsErrorWhenLogNotString() public function test_returnsErrorWhenLogNotJson() { global $apbct; - $apbct->settings['data__bot_detector_enabled'] = '1'; + $apbct->data['bot_detector_enabled'] = '1'; AltSessions::set('ct_bot_detector_frontend_data_log', 'invalid json'); $result = apbct__bot_detector_get_fd_log(); diff --git a/tests/StandaloneFunctions/TestSettingsFooterLinks.php b/tests/StandaloneFunctions/TestSettingsFooterLinks.php index 883565ed3..737ff0906 100644 --- a/tests/StandaloneFunctions/TestSettingsFooterLinks.php +++ b/tests/StandaloneFunctions/TestSettingsFooterLinks.php @@ -28,10 +28,6 @@ public function testBlock2LinksJsonStructureIsValid(): void $this->assertArrayHasKey('text', $decoded[0]); $this->assertArrayHasKey('url', $decoded[0]); $this->assertEquals('Security plugin by CleanTalk', $decoded[0]['text']); - - $this->assertArrayHasKey('text', $decoded[1]); - $this->assertArrayHasKey('url', $decoded[1]); - $this->assertStringContainsString('Gravity Add-On', $decoded[1]['text']); } else { $this->fail('JSON for Recommended plugins not found'); } diff --git a/tests/StandaloneFunctions/TestWPAdminBarTitleNodes.php b/tests/StandaloneFunctions/TestWPAdminBarTitleNodes.php index 849284a03..d5e1d54c5 100644 --- a/tests/StandaloneFunctions/TestWPAdminBarTitleNodes.php +++ b/tests/StandaloneFunctions/TestWPAdminBarTitleNodes.php @@ -161,4 +161,20 @@ function testArrayContentSPBC($array, $test) $this->assertStringContainsString('product_id=4', $title); $this->assertStringNotContainsString('apbct-icon-attention-alt', $title); } + + public function testProjectManagerNodeIndependentOfGf2dbNode() + { + + $project_manager_node = apbct__admin_bar__get_title_for_project_manager(); + $gf2db_node = apbct__admin_bar__add_gf2db_title(); + + $this->assertFalse($project_manager_node ); + $this->assertFalse($gf2db_node); + + $shouldAddParentNode = (bool) $project_manager_node; + $shouldAddChildNode = (bool) $gf2db_node; + + $this->assertFalse($shouldAddParentNode); + $this->assertFalse($shouldAddChildNode); + } }