iThemes Security (formerly Better WP Security) - Version 7.9.0

Version Description

  • Important: iThemes Security requires WordPress 5.4 or later.
  • Enhancement: Add a setting for configuring the number of bans added to the server config files (.htaccess/nginx.conf).
  • Enhancement: Store the time a ban was added, and the lockout module responsible for the ban.
  • Enhancement: Overwrite Restrict Content Pro's detected IP address with the IP detected by iThemes Security.
  • Tweak: Disable SSL verification when performing the Security Check Loopback test. Some hosts can't properly verify loopback requests. This verification is unnecessary in this circumstance, and disabling SSL verification aligns iThemes Security with default WordPress loopback behavior.
  • Bug Fix: PHP warnings when invalid entries are stored in the WordPress Cron storage.
  • Bug Fix: Update the list of tables added to wpdb.
  • Bug Fix: Remove default value for text columns. This caused an issue on MySQL 8 and is unnecessary.
  • Bug Fix: Missing borders in the sidebar widgets on WordPress 5.5.
  • Bug Fix: Notice actions didn't trigger when "Hide Admin Bar" is enabled.
  • Bug Fix: Some users would be force to choose a strong password twice in a row.
  • Bug Fix: Warning when saving the Ban Users module outside of the Settings Page without passing the legacy host_list setting.
  • Bug Fix: Passwords Requirements compatibility with Restrict Content Pro.
  • Bug Fix: PHP warnings that may occur when initializing default user groups on a new installation.
Download this release

Release Info

Developer TimothyBlynJacobs
Plugin Icon 128x128 iThemes Security (formerly Better WP Security)
Version 7.9.0
Comparing to
See all releases

Code changes from version 7.8.0 to 7.9.0

Files changed (131) hide show
  1. better-wp-security.php +4 -4
  2. core/admin-pages/page-logs.php +3 -1
  3. core/admin-pages/page-settings.php +3 -1
  4. core/container.php +51 -1
  5. core/core.php +28 -18
  6. core/history.txt +17 -0
  7. core/integrations/index.php +1 -0
  8. core/integrations/rcp.php +25 -0
  9. core/lib.php +229 -23
  10. core/lib/actor/Actor.php +29 -0
  11. core/lib/actor/Actor_Factory.php +44 -0
  12. core/lib/actor/Lockout_Module.php +37 -0
  13. core/lib/actor/Lockout_Module_Factory.php +38 -0
  14. core/lib/actor/Multi_Actor_Factory.php +43 -0
  15. core/lib/actor/User.php +28 -0
  16. core/lib/actor/User_Factory.php +38 -0
  17. core/lib/actor/index.php +1 -0
  18. core/lib/ban-hosts/Ban.php +50 -0
  19. core/lib/ban-hosts/Chain_Source.php +28 -0
  20. core/lib/ban-hosts/Creatable.php +13 -0
  21. core/lib/ban-hosts/Cursor.php +108 -0
  22. core/lib/ban-hosts/Deletable.php +13 -0
  23. core/lib/ban-hosts/Deprecated_Filter_Source.php +44 -0
  24. core/lib/ban-hosts/Filters.php +234 -0
  25. core/lib/ban-hosts/Legacy_Ban.php +36 -0
  26. core/lib/ban-hosts/Malformed_Cursor.php +9 -0
  27. core/lib/ban-hosts/Multi_Cursor.php +117 -0
  28. core/lib/ban-hosts/Multi_Repository.php +321 -0
  29. core/lib/ban-hosts/Multi_Repository_Results.php +41 -0
  30. core/lib/ban-hosts/Persistable.php +28 -0
  31. core/lib/ban-hosts/REST.php +504 -0
  32. core/lib/ban-hosts/Repository.php +60 -0
  33. core/lib/ban-hosts/Repository_Ban.php +27 -0
  34. core/lib/ban-hosts/Source.php +19 -0
  35. core/lib/ban-hosts/Unknown_Source.php +9 -0
  36. core/lib/ban-hosts/Unsupported_Operation.php +9 -0
  37. core/lib/ban-hosts/Updatable.php +13 -0
  38. core/lib/ban-hosts/index.php +1 -0
  39. core/lib/class-itsec-lib-login-interstitial.php +2 -0
  40. core/lib/class-itsec-lib-rest.php +149 -0
  41. core/lib/class-itsec-mail.php +1 -1
  42. core/lib/class-itsec-scheduler-cron.php +6 -2
  43. core/lib/schema.php +21 -11
  44. core/lib/validator.php +17 -0
  45. core/lockout.php +38 -29
  46. core/modules.php +1 -1
  47. core/modules/404-detection/class-itsec-four-oh-four.php +1 -0
  48. core/modules/admin-user/active.php +101 -0
  49. core/modules/admin-user/validator.php +7 -118
  50. core/modules/ban-users/Ban.php +78 -0
  51. core/modules/ban-users/Database_Repository.php +425 -0
  52. core/modules/ban-users/Module/Validator.php +154 -0
  53. core/modules/ban-users/Module/index.php +1 -0
  54. core/modules/ban-users/class-itsec-ban-users.php +64 -33
  55. core/modules/ban-users/config-generators.php +10 -7
  56. core/modules/ban-users/container.php +37 -0
  57. core/modules/ban-users/init.php +25 -7
  58. core/modules/ban-users/settings-page.php +12 -2
  59. core/modules/ban-users/settings.php +14 -4
  60. core/modules/ban-users/setup.php +98 -100
  61. core/modules/ban-users/validator.php +0 -70
  62. core/modules/brute-force/class-itsec-brute-force.php +4 -2
  63. core/modules/core/class-itsec-admin-notices.php +23 -3
  64. core/modules/core/class-itsec-core-active.php +7 -0
  65. core/modules/core/class-itsec-rest-actor-types-controller.php +94 -0
  66. core/modules/core/class-itsec-rest-actors-controller.php +130 -0
  67. core/modules/core/js/admin-notices.js +3 -2
  68. core/modules/core/notices.php +9 -18
  69. core/modules/file-change/admin.php +1 -1
  70. core/modules/notification-center/settings-page.php +2 -2
  71. core/modules/password-requirements/class-itsec-password-requirements.php +6 -0
  72. core/modules/pro/settings-page.php +4 -4
  73. core/modules/security-check/scanner.php +2 -1
  74. core/modules/site-scanner/mail.php +1 -1
  75. core/modules/site-scanner/settings-page.php +1 -1
  76. core/modules/user-groups/Module/Module.php +4 -3
  77. core/modules/user-groups/Module/Settings.php +3 -3
  78. core/modules/user-groups/REST/User_Groups.php +2 -2
  79. core/modules/user-groups/Repository/DB_Repository.php +5 -3
  80. core/modules/user-groups/Repository/Decorator.php +2 -2
  81. core/modules/user-groups/Repository/Eager_Loading_Decorator.php +2 -2
  82. core/modules/user-groups/Repository/In_Memory_Repository.php +3 -3
  83. core/modules/user-groups/Repository/Object_Caching_Decorator.php +2 -2
  84. core/modules/user-groups/Repository/Repository.php +2 -1
  85. core/modules/user-groups/Upgrader.php +1 -1
  86. core/package.json +2 -0
  87. core/packages/components/src/index.js +1 -0
  88. core/packages/components/src/select-control/index.js +76 -0
  89. core/packages/components/src/select-control/index.php +1 -0
  90. core/packages/data/src/actions.js +17 -0
  91. core/packages/data/src/bans/actions.js +236 -0
  92. core/packages/data/src/bans/index.js +21 -0
  93. core/packages/data/src/bans/index.php +1 -0
  94. core/packages/data/src/bans/reducers.js +149 -0
  95. core/packages/data/src/bans/resolvers.js +8 -0
  96. core/packages/data/src/bans/selectors.js +132 -0
  97. core/packages/data/src/controls.js +24 -1
  98. core/packages/data/src/index.js +1 -0
  99. core/packages/data/src/reducers.js +24 -1
  100. core/packages/data/src/resolvers.js +39 -3
  101. core/packages/data/src/selectors.js +8 -0
  102. core/packages/rjsf-theme/index.php +1 -0
  103. core/packages/rjsf-theme/src/error-list/index.js +21 -0
  104. core/packages/rjsf-theme/src/error-list/index.php +1 -0
  105. core/packages/rjsf-theme/src/field-template/index.js +77 -0
  106. core/packages/rjsf-theme/src/field-template/index.php +1 -0
  107. core/packages/rjsf-theme/src/index.js +14 -0
  108. core/packages/rjsf-theme/src/index.php +1 -0
  109. core/packages/rjsf-theme/src/widgets/base-input/index.js +81 -0
  110. core/packages/rjsf-theme/src/widgets/base-input/index.php +1 -0
  111. core/packages/rjsf-theme/src/widgets/checkbox-widget/index.js +39 -0
  112. core/packages/rjsf-theme/src/widgets/checkbox-widget/index.php +1 -0
  113. core/packages/rjsf-theme/src/widgets/index.js +11 -0
  114. core/packages/rjsf-theme/src/widgets/index.php +1 -0
  115. core/packages/rjsf-theme/src/widgets/select-widget/index.js +112 -0
  116. core/packages/rjsf-theme/src/widgets/select-widget/index.php +1 -0
  117. core/packages/rjsf-theme/src/widgets/textarea-widget/index.js +38 -0
  118. core/packages/rjsf-theme/src/widgets/textarea-widget/index.php +1 -0
  119. core/packages/utils/src/index.js +46 -1
  120. core/packages/webpack/src/config/index.js +1 -0
  121. core/rest.php +1 -0
  122. core/setup.php +1 -0
  123. dist/core/admin-notices-api.min.js +1 -1
  124. dist/manifest.php +13 -13
  125. dist/user-groups/api.min.js +1 -1
  126. dist/user-groups/settings.min.js +2 -2
  127. history.txt +15 -0
  128. package.json +2 -0
  129. readme.txt +22 -6
  130. vendor-prod/composer/autoload_classmap.php +32 -1
  131. vendor-prod/composer/autoload_static.php +32 -1
better-wp-security.php CHANGED
@@ -6,12 +6,12 @@
6
  * Description: Take the guesswork out of WordPress security. iThemes Security offers 30+ ways to lock down WordPress in an easy-to-use WordPress security plugin.
7
  * Author: iThemes
8
  * Author URI: https://ithemes.com
9
- * Version: 7.8.0
10
  * Text Domain: better-wp-security
11
  * Network: True
12
  * License: GPLv2
13
  * Requires PHP: 5.6
14
- * Requires at least: 5.2
15
  */
16
 
17
  if ( version_compare( phpversion(), '5.6.0', '<' ) ) {
@@ -24,9 +24,9 @@ if ( version_compare( phpversion(), '5.6.0', '<' ) ) {
24
  return;
25
  }
26
 
27
- if ( version_compare( $GLOBALS['wp_version'], '5.2.0', '<' ) ) {
28
  function itsec_minimum_wp_version_notice() {
29
- echo '<div class="notice notice-error"><p>' . esc_html__( 'iThemes Security Pro requires WordPress 5.2 or later.', 'better-wp-security' ) . '</p></div>';
30
  }
31
 
32
  add_action( 'admin_notices', 'itsec_minimum_wp_version_notice' );
6
  * Description: Take the guesswork out of WordPress security. iThemes Security offers 30+ ways to lock down WordPress in an easy-to-use WordPress security plugin.
7
  * Author: iThemes
8
  * Author URI: https://ithemes.com
9
+ * Version: 7.9.0
10
  * Text Domain: better-wp-security
11
  * Network: True
12
  * License: GPLv2
13
  * Requires PHP: 5.6
14
+ * Requires at least: 5.4
15
  */
16
 
17
  if ( version_compare( phpversion(), '5.6.0', '<' ) ) {
24
  return;
25
  }
26
 
27
+ if ( version_compare( $GLOBALS['wp_version'], '5.4.0', '<' ) ) {
28
  function itsec_minimum_wp_version_notice() {
29
+ echo '<div class="notice notice-error"><p>' . esc_html__( 'iThemes Security Pro requires WordPress 5.4 or later.', 'better-wp-security' ) . '</p></div>';
30
  }
31
 
32
  add_action( 'admin_notices', 'itsec_minimum_wp_version_notice' );
core/admin-pages/page-logs.php CHANGED
@@ -525,7 +525,9 @@ final class ITSEC_Logs_Page {
525
  <?php $form->add_nonce( 'itsec-logs-page' ); ?>
526
  <?php $form->add_hidden( 'widget-id', $id ); ?>
527
  <div id="itsec-sidebar-widget-<?php echo $id; ?>" class="postbox itsec-sidebar-widget">
528
- <h3 class="hndle ui-sortable-handle"><span><?php echo esc_html( $widget->title ); ?></span></h3>
 
 
529
  <div class="inside">
530
  <?php $this->get_widget_settings( $id, $form, true ); ?>
531
  </div>
525
  <?php $form->add_nonce( 'itsec-logs-page' ); ?>
526
  <?php $form->add_hidden( 'widget-id', $id ); ?>
527
  <div id="itsec-sidebar-widget-<?php echo $id; ?>" class="postbox itsec-sidebar-widget">
528
+ <div class="postbox-header">
529
+ <h2 class="hndle ui-sortable-handle"><span><?php echo esc_html( $widget->title ); ?></span></h2>
530
+ </div>
531
  <div class="inside">
532
  <?php $this->get_widget_settings( $id, $form, true ); ?>
533
  </div>
core/admin-pages/page-settings.php CHANGED
@@ -500,7 +500,9 @@ final class ITSEC_Settings_Page {
500
  <?php $form->add_hidden( 'widget-id', $id ); ?>
501
  <?php endif; ?>
502
  <div id="itsec-sidebar-widget-<?php echo $id; ?>" class="postbox itsec-sidebar-widget">
503
- <h3 class="hndle ui-sortable-handle"><span><?php echo esc_html( $widget->title ); ?></span></h3>
 
 
504
  <div class="inside">
505
  <?php if ( $messages = ITSEC_Lib_Remote_Messages::get_messages_for_placement( array( 'widget' => $id ) ) ) : ?>
506
  <div class="itsec-widgets-service-status">
500
  <?php $form->add_hidden( 'widget-id', $id ); ?>
501
  <?php endif; ?>
502
  <div id="itsec-sidebar-widget-<?php echo $id; ?>" class="postbox itsec-sidebar-widget">
503
+ <div class="postbox-header">
504
+ <h2 class="hndle ui-sortable-handle"><span><?php echo esc_html( $widget->title ); ?></span></h2>
505
+ </div>
506
  <div class="inside">
507
  <?php if ( $messages = ITSEC_Lib_Remote_Messages::get_messages_for_placement( array( 'widget' => $id ) ) ) : ?>
508
  <div class="itsec-widgets-service-status">
core/container.php CHANGED
@@ -1,7 +1,57 @@
1
  <?php
2
 
3
- return static function ( \Pimple\Container $c ) {
 
 
 
 
 
 
 
 
 
 
4
  $c[ ITSEC_Lib_Upgrader::class ] = static function () {
5
  return new ITSEC_Lib_Upgrader();
6
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  };
1
  <?php
2
 
3
+ namespace iThemesSecurity;
4
+
5
+ use ITSEC_Lib_Upgrader;
6
+ use Pimple\Container;
7
+ use wpdb;
8
+
9
+ return static function ( Container $c ) {
10
+ $c[ wpdb::class ] = static function () {
11
+ return $GLOBALS['wpdb'];
12
+ };
13
+
14
  $c[ ITSEC_Lib_Upgrader::class ] = static function () {
15
  return new ITSEC_Lib_Upgrader();
16
  };
17
+
18
+ $c[ Actor\Multi_Actor_Factory::class ] = static function ( Container $c ) {
19
+ return new Actor\Multi_Actor_Factory( ...$c['actor.factories'] );
20
+ };
21
+
22
+ $c['actor.factories'] = static function () {
23
+ return [
24
+ new Actor\User_Factory(),
25
+ new Actor\Lockout_Module_Factory(),
26
+ ];
27
+ };
28
+
29
+ $c['ban-hosts.sources'] = static function () {
30
+ return [];
31
+ };
32
+
33
+ $c['ban-hosts.repositories'] = static function () {
34
+ return [];
35
+ };
36
+
37
+ $c[ Ban_Hosts\Multi_Repository::class ] = static function ( Container $c ) {
38
+ return new Ban_Hosts\Multi_Repository(
39
+ ...array_map( [ $c, 'offsetGet' ], $c['ban-hosts.repositories'] )
40
+ );
41
+ };
42
+
43
+ $c[ Ban_Hosts\Source::class ] = static function ( Container $c ) {
44
+ return new Ban_Hosts\Chain_Source(
45
+ ...array_map( [ $c, 'offsetGet' ], $c['ban-hosts.repositories'] ),
46
+ ...array_map( [ $c, 'offsetGet' ], $c['ban-hosts.sources'] )
47
+ );
48
+ };
49
+
50
+ $c[ Ban_Hosts\REST::class ] = static function ( Container $c ) {
51
+ return new Ban_Hosts\REST(
52
+ $c[ Ban_Hosts\Multi_Repository::class ],
53
+ $c[ Actor\Multi_Actor_Factory::class ]
54
+ );
55
+ };
56
+
57
  };
core/core.php CHANGED
@@ -26,7 +26,7 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
26
  *
27
  * @access private
28
  */
29
- private $plugin_build = 4119;
30
 
31
  /**
32
  * Used to distinguish between a user modifying settings and the API modifying settings (such as from Sync
@@ -274,6 +274,7 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
274
  do_action( 'itsec_initialized' );
275
 
276
  ITSEC_Lib_Remote_Messages::init();
 
277
  }
278
 
279
  /**
@@ -282,15 +283,7 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
282
  private function setup_tables() {
283
  global $wpdb;
284
 
285
- $wpdb->global_tables[] = 'itsec_logs';
286
- $wpdb->global_tables[] = 'itsec_log';
287
- $wpdb->global_tables[] = 'itsec_lockouts';
288
- $wpdb->global_tables[] = 'itsec_temp';
289
- $wpdb->global_tables[] = 'itsec_distributed_storage';
290
- $wpdb->global_tables[] = 'itsec_geolocation_cache';
291
- $wpdb->global_tables[] = 'itsec_fingerprints';
292
- $wpdb->global_tables[] = 'itsec_user_groups';
293
- $wpdb->global_tables[] = 'itsec_mutexes';
294
  }
295
 
296
  private function setup_scheduler() {
@@ -507,6 +500,15 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
507
  }
508
  }
509
 
 
 
 
 
 
 
 
 
 
510
  /**
511
  * Add action link to plugin page.
512
  *
@@ -744,7 +746,7 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
744
  return '';
745
  }
746
 
747
- if ( ithemes_updater_is_licensed_site_url_confirmed() ) {
748
  return '';
749
  }
750
 
@@ -800,21 +802,29 @@ if ( ! class_exists( 'ITSEC_Core' ) ) {
800
  return $url;
801
  }
802
 
803
- public static function get_logs_page_url( $module = false, $type = false ) {
804
  $url = network_admin_url( 'admin.php?page=itsec-logs' );
805
 
806
- $filters = array();
 
807
 
808
- if ( $module ) {
809
- $filters[] = rawurlencode( "module|{$module}" );
810
  }
811
 
812
- if ( $type ) {
813
- $filters[] = rawurlencode( "type|{$type}" );
 
814
  }
815
 
816
  if ( $filters ) {
817
- $url = add_query_arg( array( 'filters' => $filters ), $url );
 
 
 
 
 
 
818
  }
819
 
820
  return $url;
26
  *
27
  * @access private
28
  */
29
+ private $plugin_build = 4121;
30
 
31
  /**
32
  * Used to distinguish between a user modifying settings and the API modifying settings (such as from Sync
274
  do_action( 'itsec_initialized' );
275
 
276
  ITSEC_Lib_Remote_Messages::init();
277
+ $this->run_integrations();
278
  }
279
 
280
  /**
283
  private function setup_tables() {
284
  global $wpdb;
285
 
286
+ $wpdb->global_tables = array_merge( $wpdb->global_tables, ITSEC_Schema::TABLES );
 
 
 
 
 
 
 
 
287
  }
288
 
289
  private function setup_scheduler() {
500
  }
501
  }
502
 
503
+ /**
504
+ * Runs any global ITSEC integrations.
505
+ */
506
+ private function run_integrations() {
507
+ if ( function_exists( 'restrict_content_pro' ) ) {
508
+ require_once self::get_core_dir() . '/integrations/rcp.php';
509
+ }
510
+ }
511
+
512
  /**
513
  * Add action link to plugin page.
514
  *
746
  return '';
747
  }
748
 
749
+ if ( ! ithemes_updater_is_licensed_site_url_confirmed() ) {
750
  return '';
751
  }
752
 
802
  return $url;
803
  }
804
 
805
+ public static function get_logs_page_url( $filters = false, $deprecated = false ) {
806
  $url = network_admin_url( 'admin.php?page=itsec-logs' );
807
 
808
+ if ( is_string( $filters ) ) {
809
+ _deprecated_argument( __METHOD__, '6.7.0', __( 'Passing a module as a single parameter is no longer supported. Pass a filters array instead.', 'better-wp-security' ) );
810
 
811
+ $filters = array();
812
+ $filters['module'] = $filters;
813
  }
814
 
815
+ if ( $deprecated ) {
816
+ _deprecated_argument( __METHOD__, '6.7.0', __( 'Passing the log type as the second parameter is no longer supported. Pass a filters array instead.', 'better-wp-security' ) );
817
+ $filters['type'] = $deprecated;
818
  }
819
 
820
  if ( $filters ) {
821
+ $formatted = array();
822
+
823
+ foreach ( $filters as $filter => $value ) {
824
+ $formatted[] = rawurlencode( "{$filter}|{$value}" );
825
+ }
826
+
827
+ $url = add_query_arg( array( 'filters' => $formatted ), $url );
828
  }
829
 
830
  return $url;
core/history.txt CHANGED
@@ -900,3 +900,20 @@
900
  Tweak: Check if a licensed user is defined when checking license status.
901
  Tweak: Use an opaque token for site scan verification to reduce invalid secret errors.
902
  Bug Fix: Error when trying to run Security Check on new installations.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
900
  Tweak: Check if a licensed user is defined when checking license status.
901
  Tweak: Use an opaque token for site scan verification to reduce invalid secret errors.
902
  Bug Fix: Error when trying to run Security Check on new installations.
903
+ 5.9.0 - 2020-09-16 - Timothy Jacobs
904
+ Important: iThemes Security requires WordPress 5.4 or later.
905
+ Enhancement: Add a setting for configuring the number of bans added to the server config files (.htaccess/nginx.conf).
906
+ Enhancement: Store the time a ban was added, and the lockout module responsible for the ban.
907
+ Bug Fix: PHP warnings when invalid entries are stored in the WordPress Cron storage.
908
+ Bug Fix: Update the list of tables added to wpdb.
909
+ Bug Fix: Remove default value for text columns. This caused an issue on MySQL 8 and is unnecessary.
910
+ Bug Fix: Missing borders in the sidebar widgets on WordPress 5.5.
911
+ Bug Fix: Notice actions didn't trigger when "Hide Admin Bar" is enabled.
912
+ 5.9.1 - 2020-09-24 - Timothy Jacobs
913
+ Tweak: Disable SSL verification when performing the Security Check Loopback test. Some hosts can't properly verify loopback requests. This verification is unnecessary in this circumstance, and disabling SSL verification aligns iThemes Security with default WordPress loopback behavior.
914
+ Bug Fix: Some users would be force to choose a strong password twice in a row.
915
+ Bug Fix: Warning when saving the Ban Users module outside of the Settings Page without passing the legacy host_list setting.
916
+ 6.0.0 - 2020-10-13 - Timothy Jacobs
917
+ Enhancement: Overwrite Restrict Content Pro's detected IP address with the IP detected by iThemes Security.
918
+ Bug Fix: Passwords Requirements compatibility with Restrict Content Pro.
919
+ Bug Fix: PHP warnings that may occur when initializing default user groups on a new installation.
core/integrations/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/integrations/rcp.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Overrides the RCP IP address to use iThemes Security.
5
+ *
6
+ * @return string
7
+ */
8
+ function itsec_rcp_get_ip() {
9
+ return ITSEC_Lib::get_ip();
10
+ }
11
+
12
+ add_filter( 'rcp_get_ip', 'itsec_rcp_get_ip' );
13
+
14
+ /**
15
+ * Adds the RCP login redirect to the session.
16
+ *
17
+ * @param ITSEC_Login_Interstitial_Session $session
18
+ */
19
+ function itsec_rcp_initialize_interstitial( ITSEC_Login_Interstitial_Session $session ) {
20
+ if ( isset( $_REQUEST['rcp_redirect'] ) ) {
21
+ $session->set_redirect_to( $_REQUEST['rcp_redirect'] );
22
+ }
23
+ }
24
+
25
+ add_action( 'itsec_initialize_login_interstitial_session_from_global_state', 'itsec_rcp_initialize_interstitial' );
core/lib.php CHANGED
@@ -162,7 +162,7 @@ final class ITSEC_Lib {
162
  *
163
  * @param bool $use_cache Whether to check the cache, or force the retrieval of a new value.
164
  *
165
- * @return String The IP address of the user
166
  */
167
  public static function get_ip( $use_cache = true ) {
168
  if ( isset( $GLOBALS['__itsec_remote_ip'] ) && $use_cache ) {
@@ -264,12 +264,53 @@ final class ITSEC_Lib {
264
 
265
  }
266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  public static function get_blacklisted_ips() {
268
- return apply_filters( 'itsec_filter_blacklisted_ips', array() );
 
 
 
 
 
 
 
 
 
 
 
 
269
  }
270
 
271
  /**
272
- * Determines whether a given IP address is blacklisted
 
 
273
  *
274
  * @param string $ip ip to check (can be in CIDR notation)
275
  * @param array $blacklisted_ips ip list to compare to if not yet saved to options
@@ -277,27 +318,19 @@ final class ITSEC_Lib {
277
  * @return boolean true if blacklisted or false
278
  */
279
  public static function is_ip_blacklisted( $ip = null, $blacklisted_ips = null ) {
280
- $ip = sanitize_text_field( $ip );
281
-
282
- if ( empty( $ip ) ) {
283
- $ip = ITSEC_Lib::get_ip();
284
- }
285
-
286
- if ( ! class_exists( 'ITSEC_Lib_IP_Tools' ) ) {
287
- require_once( ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php' );
288
- }
289
-
290
- if ( is_null( $blacklisted_ips ) ) {
291
- $blacklisted_ips = self::get_blacklisted_ips();
292
- }
293
 
294
- foreach ( $blacklisted_ips as $blacklisted_ip ) {
295
- if ( ITSEC_Lib_IP_Tools::intersect( $ip, ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $blacklisted_ip ) ) ) {
296
- return true;
 
 
297
  }
 
 
298
  }
299
 
300
- return false;
301
  }
302
 
303
  /**
@@ -1283,6 +1316,96 @@ final class ITSEC_Lib {
1283
  return $array;
1284
  }
1285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1286
  /**
1287
  * Array unique implementation that allows for non-scalar values.
1288
  *
@@ -1343,7 +1466,7 @@ final class ITSEC_Lib {
1343
 
1344
  $attrs = array();
1345
  $parts = explode( ';', trim( $value ) );
1346
- $main = $parts[0];
1347
 
1348
  foreach ( $parts as $part ) {
1349
  if ( false === strpos( $part, '=' ) ) {
@@ -1352,7 +1475,7 @@ final class ITSEC_Lib {
1352
 
1353
  list( $key, $value ) = array_map( 'trim', explode( '=', $part, 2 ) );
1354
 
1355
- $attrs[ $key ] = $value;
1356
  }
1357
 
1358
  $parsed[ $main ] = $attrs;
@@ -1705,13 +1828,15 @@ final class ITSEC_Lib {
1705
  /**
1706
  * Format as a ISO 8601 date.
1707
  *
1708
- * @param int|string $date Epoch or strtotime compatible date.
1709
  *
1710
  * @return string|false
1711
  */
1712
  public static function to_rest_date( $date = 0 ) {
1713
  if ( ! $date ) {
1714
  $date = ITSEC_Core::get_current_time_gmt();
 
 
1715
  } elseif ( ! is_int( $date ) ) {
1716
  $date = strtotime( $date );
1717
  }
@@ -2112,4 +2237,85 @@ final class ITSEC_Lib {
2112
 
2113
  return $error;
2114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2115
  }
162
  *
163
  * @param bool $use_cache Whether to check the cache, or force the retrieval of a new value.
164
  *
165
+ * @return string The IP address of the user
166
  */
167
  public static function get_ip( $use_cache = true ) {
168
  if ( isset( $GLOBALS['__itsec_remote_ip'] ) && $use_cache ) {
264
 
265
  }
266
 
267
+ /**
268
+ * Checks if the given IP is banned.
269
+ *
270
+ * @param string $ip IP address to check.
271
+ *
272
+ * @return bool
273
+ */
274
+ public static function is_ip_banned( $ip = '' ) {
275
+ $ip = $ip ?: ITSEC_Lib::get_ip();
276
+
277
+ if ( ! ITSEC_Lib_IP_Tools::validate( $ip ) ) {
278
+ return false;
279
+ }
280
+
281
+ $source = ITSEC_Modules::get_container()->get( \iThemesSecurity\Ban_Hosts\Source::class );
282
+ $source = new \iThemesSecurity\Ban_Hosts\Deprecated_Filter_Source( $source );
283
+
284
+ return (bool) $source->find_ban_for_host( $ip );
285
+ }
286
+
287
+ /**
288
+ * Gets the list of banned IPs.
289
+ *
290
+ * @deprecated 6.7.0
291
+ *
292
+ * @return string[]
293
+ */
294
  public static function get_blacklisted_ips() {
295
+ _deprecated_function( __METHOD__, '6.7.0', \iThemesSecurity\Ban_Hosts\Multi_Repository::class );
296
+
297
+ if (
298
+ ITSEC_Modules::get_container()->has( \iThemesSecurity\Ban_Users\Database_Repository::class ) &&
299
+ ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' )
300
+ ) {
301
+ $repo = ITSEC_Modules::get_container()->get( \iThemesSecurity\Ban_Users\Database_Repository::class );
302
+ $ips = $repo->get_legacy_hosts();
303
+ } else {
304
+ $ips = [];
305
+ }
306
+
307
+ return apply_filters( 'itsec_filter_blacklisted_ips', $ips );
308
  }
309
 
310
  /**
311
+ * Determines whether a given IP address is blacklisted.
312
+ *
313
+ * @deprecated 6.7.0
314
  *
315
  * @param string $ip ip to check (can be in CIDR notation)
316
  * @param array $blacklisted_ips ip list to compare to if not yet saved to options
318
  * @return boolean true if blacklisted or false
319
  */
320
  public static function is_ip_blacklisted( $ip = null, $blacklisted_ips = null ) {
321
+ _deprecated_function( __METHOD__, '6.7.0', 'ITSEC_Lib::is_ip_banned' );
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
+ if ( null !== $blacklisted_ips ) {
324
+ foreach ( $blacklisted_ips as $blacklisted_ip ) {
325
+ if ( ITSEC_Lib_IP_Tools::intersect( $ip, $blacklisted_ip ) ) {
326
+ return true;
327
+ }
328
  }
329
+
330
+ return false;
331
  }
332
 
333
+ return self::is_ip_banned( $ip );
334
  }
335
 
336
  /**
1316
  return $array;
1317
  }
1318
 
1319
+ /**
1320
+ * Gets the first key in an array.
1321
+ *
1322
+ * @param array $arr
1323
+ *
1324
+ * @return int|string|null
1325
+ */
1326
+ public static function array_key_first( array $arr ) {
1327
+ if ( function_exists( 'array_key_first' ) ) {
1328
+ return array_key_first( $arr );
1329
+ }
1330
+
1331
+ foreach ( $arr as $key => $value ) {
1332
+ return $key;
1333
+ }
1334
+
1335
+ return null;
1336
+ }
1337
+
1338
+ /**
1339
+ * Gets the last ket in an array.
1340
+ *
1341
+ * @param array $arr
1342
+ *
1343
+ * @return int|string|null
1344
+ */
1345
+ public static function array_key_last( array $arr ) {
1346
+ if ( function_exists( 'array_key_last' ) ) {
1347
+ return array_key_last( $arr );
1348
+ }
1349
+
1350
+ end( $arr );
1351
+
1352
+ return key( $arr );
1353
+ }
1354
+
1355
+ /**
1356
+ * Plucks a certain field out of each item in the list.
1357
+ *
1358
+ * Similar to {@see wp_list_pluck()} but it supports using methods.
1359
+ *
1360
+ * @param array $list The list of items.
1361
+ * @param string $field The field or method name to use.
1362
+ * @param string $index_key Field from the item to use as keys for the new array.
1363
+ *
1364
+ * @return array
1365
+ */
1366
+ public static function pluck( array $list, $field, $index_key = '' ) {
1367
+ $output = [];
1368
+
1369
+ foreach ( $list as $i => $item ) {
1370
+ $key = $index_key ? static::get( $item, $index_key ) : $i;
1371
+
1372
+ $value = static::get( $item, $field );
1373
+
1374
+ if ( null === $key ) {
1375
+ $output[] = $value;
1376
+ } else {
1377
+ $output[ $key ] = $value;
1378
+ }
1379
+ }
1380
+
1381
+ return $output;
1382
+ }
1383
+
1384
+ /**
1385
+ * Get's a value from an array or object.
1386
+ *
1387
+ * @param array|object $item The item to retrieve the value from.
1388
+ * @param string $field The field or method name to use.
1389
+ * @param null $default The default value to return if no value is found.
1390
+ *
1391
+ * @return mixed|null
1392
+ */
1393
+ public static function get( $item, $field, $default = null ) {
1394
+ if ( is_array( $item ) ) {
1395
+ return isset( $item[ $field ] ) ? $item[ $field ] : $default;
1396
+ }
1397
+
1398
+ if ( is_object( $item ) ) {
1399
+ if ( is_callable( [ $item, $field ] ) ) {
1400
+ return $item->{$field}();
1401
+ }
1402
+
1403
+ return isset( $item->{$field} ) ? $item->{$field} : $default;
1404
+ }
1405
+
1406
+ return $default;
1407
+ }
1408
+
1409
  /**
1410
  * Array unique implementation that allows for non-scalar values.
1411
  *
1466
 
1467
  $attrs = array();
1468
  $parts = explode( ';', trim( $value ) );
1469
+ $main = trim( $parts[0], ' <>' );
1470
 
1471
  foreach ( $parts as $part ) {
1472
  if ( false === strpos( $part, '=' ) ) {
1475
 
1476
  list( $key, $value ) = array_map( 'trim', explode( '=', $part, 2 ) );
1477
 
1478
+ $attrs[ $key ] = trim( $value, '" ' );
1479
  }
1480
 
1481
  $parsed[ $main ] = $attrs;
1828
  /**
1829
  * Format as a ISO 8601 date.
1830
  *
1831
+ * @param int|string|\DateTimeInterface $date Epoch or strtotime compatible date.
1832
  *
1833
  * @return string|false
1834
  */
1835
  public static function to_rest_date( $date = 0 ) {
1836
  if ( ! $date ) {
1837
  $date = ITSEC_Core::get_current_time_gmt();
1838
+ } elseif ( $date instanceof \DateTimeInterface ) {
1839
+ $date = $date->getTimestamp();
1840
  } elseif ( ! is_int( $date ) ) {
1841
  $date = strtotime( $date );
1842
  }
2237
 
2238
  return $error;
2239
  }
2240
+
2241
+ /**
2242
+ * Converts a JSON Schema to a WP-CLI synopsis.
2243
+ *
2244
+ * @param array $schema
2245
+ *
2246
+ * @return array
2247
+ */
2248
+ public static function convert_schema_to_cli_synopsis( array $schema ) {
2249
+ $synopsis = [];
2250
+
2251
+ $required = isset( $schema['required'] ) ? $schema['required'] : [];
2252
+
2253
+ if ( isset( $schema['properties'] ) ) {
2254
+ foreach ( $schema['properties'] as $property => $config ) {
2255
+ $param = [
2256
+ 'name' => $property,
2257
+ ];
2258
+
2259
+ if ( 'boolean' === $config['type'] ) {
2260
+ $param['type'] = 'flag';
2261
+ } else {
2262
+ $param['type'] = 'assoc';
2263
+ }
2264
+
2265
+ if ( array_key_exists( 'default', $config ) ) {
2266
+ $param['default'] = $config['default'];
2267
+ }
2268
+
2269
+ if ( isset( $config['enum'] ) ) {
2270
+ $param['options'] = $config['enum'];
2271
+ }
2272
+
2273
+ if ( ( ! isset( $config['required'] ) || true !== $config['required'] ) && ! in_array( $property, $required, true ) ) {
2274
+ $param['optional'] = true;
2275
+ }
2276
+
2277
+ if ( isset( $config['description'] ) ) {
2278
+ $param['description'] = $config['description'];
2279
+ }
2280
+
2281
+ $synopsis[] = $param;
2282
+ }
2283
+ }
2284
+
2285
+ if ( ! empty( $schema['additionalProperties'] ) ) {
2286
+ $synopsis[] = [
2287
+ 'type' => 'generic',
2288
+ ];
2289
+ }
2290
+
2291
+ return $synopsis;
2292
+ }
2293
+
2294
+ /**
2295
+ * Decode a string with URL-safe Base64.
2296
+ *
2297
+ * @param string $input A Base64 encoded string
2298
+ *
2299
+ * @return string A decoded string
2300
+ */
2301
+ public static function url_safe_b64_decode( $input ) {
2302
+ $remainder = strlen( $input ) % 4;
2303
+ if ( $remainder ) {
2304
+ $padlen = 4 - $remainder;
2305
+ $input .= str_repeat( '=', $padlen );
2306
+ }
2307
+
2308
+ return base64_decode( strtr( $input, '-_', '+/' ) );
2309
+ }
2310
+
2311
+ /**
2312
+ * Encode a string with URL-safe Base64.
2313
+ *
2314
+ * @param string $input The string you want encoded
2315
+ *
2316
+ * @return string The base64 encode of what you passed in
2317
+ */
2318
+ public static function url_safe_b64_encode( $input ) {
2319
+ return str_replace( '=', '', strtr( base64_encode( $input ), '+/', '-_' ) );
2320
+ }
2321
  }
core/lib/actor/Actor.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ interface Actor {
6
+
7
+ /**
8
+ * Gets the type of this actor.
9
+ *
10
+ * @return string
11
+ */
12
+ public function get_type();
13
+
14
+ /**
15
+ * Gets the identifier for this particular actor instance.
16
+ *
17
+ * This must be unique to the actor type.
18
+ *
19
+ * @return string
20
+ */
21
+ public function get_identifier();
22
+
23
+ /**
24
+ * Gets a description of this actor.
25
+ *
26
+ * @return string
27
+ */
28
+ public function __toString();
29
+ }
core/lib/actor/Actor_Factory.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ interface Actor_Factory {
6
+ /**
7
+ * Makes an Actor.
8
+ *
9
+ * @param string|int $identifier
10
+ *
11
+ * @return Actor|null
12
+ */
13
+ public function make( $identifier );
14
+
15
+ /**
16
+ * Gets the actor type slug.
17
+ *
18
+ * @return string
19
+ */
20
+ public function get_slug();
21
+
22
+ /**
23
+ * Gets the label
24
+ *
25
+ * @return string
26
+ */
27
+ public function get_label();
28
+
29
+ /**
30
+ * Does this have a pre-determined list of Actors, or is the list infinite.
31
+ *
32
+ * @return bool
33
+ */
34
+ public function is_determinate();
35
+
36
+ /**
37
+ * Gets the list of Actors.
38
+ *
39
+ * @param string $query An optional search query.
40
+ *
41
+ * @return Actor[]
42
+ */
43
+ public function get_actors( $query = '' );
44
+ }
core/lib/actor/Lockout_Module.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ final class Lockout_Module implements Actor {
6
+
7
+ /** @var string */
8
+ private $module;
9
+
10
+ /**
11
+ * Lockout_Module constructor.
12
+ *
13
+ * @param string $module
14
+ */
15
+ public function __construct( $module ) { $this->module = $module; }
16
+
17
+ public function get_type() {
18
+ return 'lockout_module';
19
+ }
20
+
21
+ public function get_identifier() {
22
+ return $this->module;
23
+ }
24
+
25
+ public function __toString() {
26
+ /** @var \ITSEC_Lockout $itsec_lockout */
27
+ global $itsec_lockout;
28
+
29
+ $modules = $itsec_lockout->get_lockout_modules();
30
+
31
+ if ( ! isset( $modules[ $this->module ] ) ) {
32
+ return sprintf( esc_html__( 'Inactive lockout module %s', 'better-wp-security' ), $this->module );
33
+ }
34
+
35
+ return isset( $modules[ $this->module ]['label'] ) ? (string) $modules[ $this->module ]['label'] : (string) $modules[ $this->module ]['reason'];
36
+ }
37
+ }
core/lib/actor/Lockout_Module_Factory.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ final class Lockout_Module_Factory implements Actor_Factory {
6
+ public function make( $identifier ) {
7
+ return new Lockout_Module( $identifier );
8
+ }
9
+
10
+ public function get_slug() {
11
+ return 'lockout_module';
12
+ }
13
+
14
+ public function get_label() {
15
+ return __( 'Lockout Module', 'better-wp-security' );
16
+ }
17
+
18
+ public function is_determinate() {
19
+ return true;
20
+ }
21
+
22
+ public function get_actors( $query = '' ) {
23
+ /** @var \ITSEC_Lockout $itsec_lockout */
24
+ global $itsec_lockout;
25
+
26
+ $modules = $itsec_lockout->get_lockout_modules();
27
+
28
+ if ( $query ) {
29
+ $modules = array_filter( $modules, static function ( $module ) use ( $query ) {
30
+ return stripos( $module['type'], $query ) !== false || stripos( $module['reason'], $query ) !== false || stripos( $module['label'], $query ) !== false;
31
+ } );
32
+ }
33
+
34
+ return array_map( function ( $module ) {
35
+ return $this->make( $module['type'] );
36
+ }, $modules );
37
+ }
38
+ }
core/lib/actor/Multi_Actor_Factory.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ final class Multi_Actor_Factory {
6
+
7
+ /** @var Actor_Factory[] */
8
+ private $factories;
9
+
10
+ /**
11
+ * Multi_Actor_Factory constructor.
12
+ *
13
+ * @param Actor_Factory[] $factories
14
+ */
15
+ public function __construct( Actor_Factory ...$factories ) { $this->factories = $factories; }
16
+
17
+ /**
18
+ * Makes an Actor instance.
19
+ *
20
+ * @param string $type
21
+ * @param string|int $identifier
22
+ *
23
+ * @return Actor|null
24
+ */
25
+ public function make( $type, $identifier ) {
26
+ foreach ( $this->factories as $factory ) {
27
+ if ( $factory->get_slug() === $type ) {
28
+ return $factory->make( $identifier );
29
+ }
30
+ }
31
+
32
+ return null;
33
+ }
34
+
35
+ /**
36
+ * Gets the list of supported actor types.
37
+ *
38
+ * @return Actor_Factory[]
39
+ */
40
+ public function get_supported_factories() {
41
+ return $this->factories;
42
+ }
43
+ }
core/lib/actor/User.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ final class User implements Actor {
6
+
7
+ /** @var \WP_User */
8
+ private $user;
9
+
10
+ /**
11
+ * User constructor.
12
+ *
13
+ * @param \WP_User $user
14
+ */
15
+ public function __construct( \WP_User $user ) { $this->user = $user; }
16
+
17
+ public function get_type() {
18
+ return 'user';
19
+ }
20
+
21
+ public function get_identifier() {
22
+ return (string) $this->user->ID;
23
+ }
24
+
25
+ public function __toString() {
26
+ return $this->user->display_name;
27
+ }
28
+ }
core/lib/actor/User_Factory.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Actor;
4
+
5
+ final class User_Factory implements Actor_Factory {
6
+ public function make( $identifier ) {
7
+ $user = get_userdata( $identifier );
8
+
9
+ if ( ! $user ) {
10
+ return null;
11
+ }
12
+
13
+ return new User( $user );
14
+ }
15
+
16
+ public function get_slug() {
17
+ return 'user';
18
+ }
19
+
20
+ public function get_label() {
21
+ return __( 'User', 'better-wp-security' );
22
+ }
23
+
24
+ public function is_determinate() {
25
+ return false;
26
+ }
27
+
28
+ public function get_actors( $query = '' ) {
29
+ $user_query = new \WP_User_Query( [
30
+ 'search' => $query,
31
+ 'number' => 500,
32
+ ] );
33
+
34
+ return array_map( function ( $user ) {
35
+ return new User( $user );
36
+ }, $user_query->get_results() );
37
+ }
38
+ }
core/lib/actor/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/lib/ban-hosts/Ban.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Actor\Actor;
6
+
7
+ interface Ban {
8
+
9
+ /**
10
+ * Does this ban entry match the given IP address.
11
+ *
12
+ * @param string $ip The IP address.
13
+ *
14
+ * @return bool
15
+ */
16
+ public function matches( $ip );
17
+
18
+ /**
19
+ * Gets the time this entry was created.
20
+ *
21
+ * @return \DateTimeImmutable|null
22
+ */
23
+ public function get_created_at();
24
+
25
+ /**
26
+ * Gets the actor who added this ban entry.
27
+ *
28
+ * @return Actor|null
29
+ */
30
+ public function get_created_by();
31
+
32
+ /**
33
+ * Gets the comment describing the ban entry.
34
+ *
35
+ * @return string
36
+ */
37
+ public function get_comment();
38
+
39
+ /**
40
+ * Human facing label of what is banned.
41
+ *
42
+ * This should be as short as possible. For example:
43
+ *
44
+ * - 192.168.1.1
45
+ * - 192.168.1/8
46
+ *
47
+ * @return string
48
+ */
49
+ public function __toString();
50
+ }
core/lib/ban-hosts/Chain_Source.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ final class Chain_Source implements Source {
6
+
7
+ /** @var Source[] */
8
+ private $sources;
9
+
10
+ /**
11
+ * Chain_Source constructor.
12
+ *
13
+ * @param Source ...$sources List of sources to pull from.
14
+ */
15
+ public function __construct( Source ...$sources ) {
16
+ $this->sources = $sources;
17
+ }
18
+
19
+ public function find_ban_for_host( $host ) {
20
+ foreach ( $this->sources as $source ) {
21
+ if ( $ban = $source->find_ban_for_host( $host ) ) {
22
+ return $ban;
23
+ }
24
+ }
25
+
26
+ return null;
27
+ }
28
+ }
core/lib/ban-hosts/Creatable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ interface Creatable extends Persistable {
6
+
7
+ /**
8
+ * Gets the JSON Schema used to describe a new ban record.
9
+ *
10
+ * @return array
11
+ */
12
+ public function get_creation_schema();
13
+ }
core/lib/ban-hosts/Cursor.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ final class Cursor {
6
+
7
+ /** @var \DateTimeImmutable */
8
+ private $last_date;
9
+
10
+ /** @var int */
11
+ private $last_id;
12
+
13
+ /** @var int */
14
+ private $last_count;
15
+
16
+ /**
17
+ * Cursor constructor.
18
+ *
19
+ * @param \DateTimeImmutable $last_date
20
+ * @param int $last_id
21
+ * @param int $last_count
22
+ */
23
+ public function __construct( \DateTimeImmutable $last_date = null, $last_id = 0, $last_count = 0 ) {
24
+ $this->last_date = $last_date;
25
+ $this->last_id = $last_id;
26
+ $this->last_count = $last_count;
27
+ }
28
+
29
+ /**
30
+ * Parses a formatted value into a cursor.
31
+ *
32
+ * @param string $formatted
33
+ *
34
+ * @return static
35
+ */
36
+ public static function parse( $formatted ) {
37
+ $parts = explode( '-', $formatted );
38
+
39
+ if ( count( $parts ) !== 3 ) {
40
+ throw new Malformed_Cursor( esc_html__( 'Cursor definition for repository is malformed.', 'better-wp-security' ) );
41
+ }
42
+
43
+ list( $last_date, $last_id, $last_count ) = $parts;
44
+
45
+ return new static(
46
+ $last_date ? new \DateTimeImmutable( "@{$last_date}" ) : null,
47
+ (int) $last_id,
48
+ (int) $last_count
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Creates a new cursor from a results array.
54
+ *
55
+ * @param array $results
56
+ *
57
+ * @return static
58
+ */
59
+ public static function from_results( array $results ) {
60
+ $last = \ITSEC_Lib::array_key_last( $results );
61
+
62
+ if ( $last !== null ) {
63
+ $last_id = $results[ $last ]->get_id();
64
+ $date = $results[ $last ]->get_created_at();
65
+ } else {
66
+ $last_id = 0;
67
+ $date = null;
68
+ }
69
+
70
+ return new static( $date, $last_id, count( $results ) );
71
+ }
72
+
73
+ /**
74
+ * Gets the date results must be before.
75
+ *
76
+ * @return \DateTimeImmutable|null
77
+ */
78
+ public function get_last_date() {
79
+ return $this->last_date;
80
+ }
81
+
82
+ /**
83
+ * Gets the id results must be before.
84
+ *
85
+ * @return int
86
+ */
87
+ public function get_last_id() {
88
+ return $this->last_id;
89
+ }
90
+
91
+ /**
92
+ * Gets the count of results from the previous page.
93
+ *
94
+ * @return int
95
+ */
96
+ public function get_last_count() {
97
+ return $this->last_count;
98
+ }
99
+
100
+ /**
101
+ * Converts the cursor to a string.
102
+ *
103
+ * @return string
104
+ */
105
+ public function __toString() {
106
+ return implode( '-', [ $this->get_last_date()->getTimestamp(), $this->get_last_id(), $this->get_last_count() ] );
107
+ }
108
+ }
core/lib/ban-hosts/Deletable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ interface Deletable extends Repository {
6
+
7
+ /**
8
+ * Deletes a Ban.
9
+ *
10
+ * @param Repository_Ban $ban
11
+ */
12
+ public function delete( Repository_Ban $ban );
13
+ }
core/lib/ban-hosts/Deprecated_Filter_Source.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ final class Deprecated_Filter_Source implements Source {
6
+
7
+ /** @var Source */
8
+ private $source;
9
+
10
+ /**
11
+ * Deprecated_Filter_Source constructor.
12
+ *
13
+ * @param Source $source
14
+ */
15
+ public function __construct( Source $source ) { $this->source = $source; }
16
+
17
+ public function find_ban_for_host( $host ) {
18
+ $ban = $this->source->find_ban_for_host( $host );
19
+
20
+ if ( ! has_filter( 'itsec_filter_blacklisted_ips' ) ) {
21
+ return $ban;
22
+ }
23
+
24
+ if ( $ban ) {
25
+ $hosts = [ $host ];
26
+ } else {
27
+ $hosts = [];
28
+ }
29
+
30
+ $hosts = apply_filters_deprecated( 'itsec_filter_blacklisted_ips', [ $hosts ], '6.7.0' );
31
+
32
+ if ( ! $hosts ) {
33
+ return null;
34
+ }
35
+
36
+ foreach ( $hosts as $maybe_host ) {
37
+ if ( \ITSEC_Lib_IP_Tools::intersect( $host, $maybe_host ) ) {
38
+ return $ban ?: new Legacy_Ban( $maybe_host );
39
+ }
40
+ }
41
+
42
+ return null;
43
+ }
44
+ }
core/lib/ban-hosts/Filters.php ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Actor\Actor;
6
+
7
+ final class Filters {
8
+
9
+ const ACTOR_TYPE = 'actor_type';
10
+ const ACTOR_IDENTIFIER = 'actor_id';
11
+ const SEARCH = 'search';
12
+ const CREATED_AFTER = 'created_after';
13
+ const CREATED_BEFORE = 'created_before';
14
+
15
+ const ALL = [
16
+ self::ACTOR_TYPE,
17
+ self::ACTOR_IDENTIFIER,
18
+ self::SEARCH,
19
+ self::CREATED_AFTER,
20
+ self::CREATED_BEFORE,
21
+ ];
22
+
23
+ /** @var int */
24
+ private $limit;
25
+
26
+ /** @var Cursor */
27
+ private $after_cursor;
28
+
29
+ /** @var Cursor */
30
+ private $before_cursor;
31
+
32
+ /** @var string */
33
+ private $actor_type;
34
+
35
+ /** @var string */
36
+ private $actor_identifier;
37
+
38
+ /** @var string */
39
+ private $search;
40
+
41
+ /** @var \DateTimeImmutable */
42
+ private $created_after;
43
+
44
+ /** @var \DateTimeImmutable */
45
+ private $created_before;
46
+
47
+ /**
48
+ * Limits to results occurring after the given cursor.
49
+ *
50
+ * @param Cursor $cursor
51
+ *
52
+ * @return Filters
53
+ */
54
+ public function with_after_cursor( Cursor $cursor ) {
55
+ $clone = clone $this;
56
+ $clone->after_cursor = $cursor;
57
+
58
+ return $clone;
59
+ }
60
+
61
+ /**
62
+ * Get the after cursor.
63
+ *
64
+ * @return Cursor|null
65
+ */
66
+ public function get_after_cursor() {
67
+ return $this->after_cursor;
68
+ }
69
+
70
+ /**
71
+ * Limits to results occurring before the given cursor.
72
+ *
73
+ * @param Cursor $cursor
74
+ *
75
+ * @return Filters
76
+ */
77
+ public function with_before_cursor( Cursor $cursor ) {
78
+ $clone = clone $this;
79
+ $clone->before_cursor = $cursor;
80
+
81
+ return $clone;
82
+ }
83
+
84
+ /**
85
+ * Get the before cursor.
86
+ *
87
+ * @return Cursor|null
88
+ */
89
+ public function get_before_cursor() {
90
+ return $this->before_cursor;
91
+ }
92
+
93
+ /**
94
+ * Gets the number of bans to return.
95
+ *
96
+ * @return int
97
+ */
98
+ public function get_limit() {
99
+ return $this->limit;
100
+ }
101
+
102
+ /**
103
+ * Returns a limited number of results.
104
+ *
105
+ * @param int $limit
106
+ *
107
+ * @return Filters
108
+ */
109
+ public function with_limit( $limit ) {
110
+ $clone = clone $this;
111
+ $clone->limit = $limit;
112
+
113
+ return $clone;
114
+ }
115
+
116
+ /**
117
+ * Gets the actor type.
118
+ *
119
+ * @return string
120
+ */
121
+ public function get_actor_type() {
122
+ return $this->actor_type;
123
+ }
124
+
125
+ /**
126
+ * Limits to bans with the given actor type.
127
+ *
128
+ * @see Actor::get_type()
129
+ *
130
+ * @param string $actor_type
131
+ *
132
+ * @return Filters
133
+ */
134
+ public function with_actor_type( $actor_type ) {
135
+ $clone = clone $this;
136
+ $clone->actor_type = $actor_type;
137
+
138
+ return $clone;
139
+ }
140
+
141
+ /**
142
+ * Gets the actor identifier.
143
+ *
144
+ * @return string
145
+ */
146
+ public function get_actor_identifier() {
147
+ return $this->actor_identifier;
148
+ }
149
+
150
+ /**
151
+ * Limits to bans with the given actor identifier.
152
+ *
153
+ * @see Actor::get_identifier()
154
+ *
155
+ * @param string $actor_identifier
156
+ *
157
+ * @return Filters
158
+ */
159
+ public function with_actor_identifier( $actor_identifier ) {
160
+ $clone = clone $this;
161
+ $clone->actor_identifier = $actor_identifier;
162
+
163
+ return $clone;
164
+ }
165
+
166
+ /**
167
+ * Gets the comment.
168
+ *
169
+ * @return string
170
+ */
171
+ public function get_search() {
172
+ return $this->search;
173
+ }
174
+
175
+ /**
176
+ * Limits to bans that have comments containing the given substring.
177
+ *
178
+ * @param string $search
179
+ *
180
+ * @return Filters
181
+ */
182
+ public function with_search( $search ) {
183
+ $clone = clone $this;
184
+ $clone->search = $search;
185
+
186
+ return $clone;
187
+ }
188
+
189
+ /**
190
+ * Gets the created after date.
191
+ *
192
+ * @return \DateTimeImmutable
193
+ */
194
+ public function get_created_after() {
195
+ return $this->created_after;
196
+ }
197
+
198
+ /**
199
+ * Limits to bans that occur after the given date.
200
+ *
201
+ * @param \DateTimeImmutable $created_after
202
+ *
203
+ * @return Filters
204
+ */
205
+ public function with_created_after( \DateTimeImmutable $created_after = null ) {
206
+ $clone = clone $this;
207
+ $clone->created_after = $created_after;
208
+
209
+ return $clone;
210
+ }
211
+
212
+ /**
213
+ * Gets the created before date.
214
+ *
215
+ * @return \DateTimeImmutable
216
+ */
217
+ public function get_created_before() {
218
+ return $this->created_before;
219
+ }
220
+
221
+ /**
222
+ * Limits to bans that occur before the given date.
223
+ *
224
+ * @param \DateTimeImmutable $created_before
225
+ *
226
+ * @return Filters
227
+ */
228
+ public function with_created_before( \DateTimeImmutable $created_before = null ) {
229
+ $clone = clone $this;
230
+ $clone->created_before = $created_before;
231
+
232
+ return $clone;
233
+ }
234
+ }
core/lib/ban-hosts/Legacy_Ban.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ final class Legacy_Ban implements Ban {
6
+
7
+ /** @var string */
8
+ private $host;
9
+
10
+ /**
11
+ * Legacy_Ban constructor.
12
+ *
13
+ * @param string $host
14
+ */
15
+ public function __construct( $host ) { $this->host = $host; }
16
+
17
+ public function matches( $ip ) {
18
+ return \ITSEC_Lib_IP_Tools::intersect( $ip, $this->host );
19
+ }
20
+
21
+ public function get_created_at() {
22
+ return null;
23
+ }
24
+
25
+ public function get_created_by() {
26
+ return null;
27
+ }
28
+
29
+ public function get_comment() {
30
+ return __( 'Dynamic ban added with the deprecated itsec_filter_blacklisted_ips filter.', 'better-wp-security' );
31
+ }
32
+
33
+ public function __toString() {
34
+ return $this->host;
35
+ }
36
+ }
core/lib/ban-hosts/Malformed_Cursor.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Exception\Invalid_Argument_Exception;
6
+
7
+ final class Malformed_Cursor extends Invalid_Argument_Exception {
8
+
9
+ }
core/lib/ban-hosts/Multi_Cursor.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ final class Multi_Cursor {
6
+
7
+ /** @var Repository[] */
8
+ private $repositories;
9
+
10
+ /** @var Cursor[] */
11
+ private $cursors = [];
12
+
13
+ /**
14
+ * Cursor constructor.
15
+ *
16
+ * @param string $formatted
17
+ * @param Repository ...$repositories
18
+ */
19
+ public function __construct( $formatted = '', Repository ...$repositories ) {
20
+ $this->repositories = $repositories;
21
+
22
+ if ( $formatted ) {
23
+ $parts = explode( ',', $formatted );
24
+
25
+ foreach ( $this->repositories as $i => $repository ) {
26
+ if ( ! isset( $parts[ $i ] ) ) {
27
+ throw new Malformed_Cursor( esc_html__( 'Cursor missing definition for repository.', 'better-wp-security' ) );
28
+ }
29
+
30
+ $part = $parts[ $i ];
31
+
32
+ if ( '' === $part ) {
33
+ continue;
34
+ }
35
+
36
+ $this->cursors[ $repository->get_slug() ] = Cursor::parse( $part );
37
+ }
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Adds a cursor for a repository's results.
43
+ *
44
+ * @param Repository $repository
45
+ * @param Cursor $cursor
46
+ *
47
+ * @return Multi_Cursor
48
+ */
49
+ public function with_cursor( Repository $repository, Cursor $cursor ) {
50
+ $clone = clone $this;
51
+
52
+ $clone->cursors[ $repository->get_slug() ] = $cursor;
53
+
54
+ return $clone;
55
+ }
56
+
57
+ /**
58
+ * Gets the cursor for a single repository.
59
+ *
60
+ * @param Repository $repository
61
+ *
62
+ * @return Cursor|null
63
+ */
64
+ public function get_cursor( Repository $repository ) {
65
+ return isset( $this->cursors[ $repository->get_slug() ] ) ? $this->cursors[ $repository->get_slug() ] : null;
66
+ }
67
+
68
+ /**
69
+ * Gets the last count for a repository.
70
+ *
71
+ * @param Repository $repository
72
+ *
73
+ * @return int|null
74
+ */
75
+ public function get_last_count( Repository $repository ) {
76
+ return $this->get_cursor( $repository ) ? $this->get_cursor( $repository )->get_last_count() : null;
77
+ }
78
+
79
+ /**
80
+ * Checks if more results are available.
81
+ *
82
+ * @param int $page_size
83
+ *
84
+ * @return bool
85
+ */
86
+ public function has_more( $page_size ) {
87
+ foreach ( $this->cursors as $cursor ) {
88
+ if ( $cursor->get_last_count() >= $page_size ) {
89
+ return true;
90
+ }
91
+ }
92
+
93
+ return false;
94
+ }
95
+
96
+ /**
97
+ * Converts the cursor to a string representation.
98
+ *
99
+ * @return string
100
+ */
101
+ public function __toString() {
102
+ $parts = [];
103
+
104
+ foreach ( $this->repositories as $repository ) {
105
+ $cursor = isset( $this->cursors[ $repository->get_slug() ] ) ? $this->cursors[ $repository->get_slug() ] : null;
106
+
107
+ if ( ! $cursor ) {
108
+ $parts[] = '';
109
+ continue;
110
+ }
111
+
112
+ $parts[] = (string) $cursor;
113
+ }
114
+
115
+ return implode( ',', $parts );
116
+ }
117
+ }
core/lib/ban-hosts/Multi_Repository.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Exception\Invalid_Argument_Exception;
6
+ use iThemesSecurity\Exception\WP_Error;
7
+
8
+ final class Multi_Repository implements Source {
9
+
10
+ /** @var Repository[] */
11
+ private $repositories = [];
12
+
13
+ /**
14
+ * Multi_Repository constructor.
15
+ *
16
+ * @param Repository ...$repositories
17
+ */
18
+ public function __construct( Repository ...$repositories ) {
19
+ foreach ( $repositories as $repository ) {
20
+ $this->repositories[ $repository->get_slug() ] = $repository;
21
+ }
22
+ }
23
+
24
+ public function find_ban_for_host( $host ) {
25
+ return ( new Chain_Source( ...array_values( $this->repositories ) ) )->find_ban_for_host( $host );
26
+ }
27
+
28
+ /**
29
+ * Gets a list of bans.
30
+ *
31
+ * @param Filters $filters
32
+ * @param Multi_Cursor $cursor
33
+ * @param string $source
34
+ *
35
+ * @return Multi_Repository_Results
36
+ */
37
+ public function get_bans( Filters $filters, Multi_Cursor $cursor = null, $source = '' ) {
38
+ if ( $source ) {
39
+ $repository = $this->repository( $source );
40
+
41
+ if ( $filters->get_limit() && $cursor && $repo_cursor = $cursor->get_cursor( $repository ) ) {
42
+ $filters = $filters->with_before_cursor( $repo_cursor );
43
+ }
44
+
45
+ $next_cursor = null;
46
+ $results = $repository->get_bans( $filters );
47
+
48
+ if ( $filters->get_limit() ) {
49
+ $next_cursor = $this->cursor();
50
+ $next_cursor->with_cursor( $repository, Cursor::from_results( $results ) );
51
+ }
52
+
53
+ return new Multi_Repository_Results( $results, $next_cursor );
54
+ }
55
+
56
+ if ( ! $this->repositories ) {
57
+ return new Multi_Repository_Results( [] );
58
+ }
59
+
60
+ if ( ! $filters->get_limit() ) {
61
+ return new Multi_Repository_Results( array_merge( ...array_map( static function ( Repository $repository ) use ( $filters ) {
62
+ return $repository->get_bans( $filters );
63
+ }, $this->repositories, [] ) ) );
64
+ }
65
+
66
+ $count_per_repo = $filters->get_limit() / count( $this->repositories );
67
+ $populated_repos = $cursor ? array_filter( $this->repositories, static function ( Repository $repository ) use ( $cursor, $count_per_repo ) {
68
+ return $cursor->get_last_count( $repository ) >= $count_per_repo;
69
+ } ) : $this->repositories;
70
+ $count_per_repo = floor( $filters->get_limit() / count( $populated_repos ) );
71
+ $extra = $filters->get_limit() - $count_per_repo * count( $populated_repos );
72
+
73
+ $next_cursor = $this->cursor();
74
+ $results = [];
75
+
76
+ foreach ( $populated_repos as $repository ) {
77
+ $limit = $count_per_repo;
78
+
79
+ if ( $extra ) {
80
+ $limit += $extra;
81
+ $extra = 0;
82
+ }
83
+
84
+ $repo_filters = $filters->with_limit( $limit );
85
+
86
+ if ( $cursor && $repo_cursor = $cursor->get_cursor( $repository ) ) {
87
+ $repo_filters = $repo_filters->with_before_cursor( $repo_cursor );
88
+ }
89
+
90
+ $result = $repository->get_bans( $repo_filters );
91
+ $next_cursor = $next_cursor->with_cursor( $repository, Cursor::from_results( $result ) );
92
+ $results[] = $result;
93
+ }
94
+
95
+ $bans = $results ? array_merge( ...$results ) : [];
96
+
97
+ usort( $bans, static function ( Repository_Ban $a, Repository_Ban $b ) {
98
+ $a = $a->get_created_at();
99
+ $b = $b->get_created_at();
100
+
101
+ return $b->getTimestamp() - $a->getTimestamp();
102
+ } );
103
+
104
+ return new Multi_Repository_Results( $bans, $next_cursor );
105
+ }
106
+
107
+ /**
108
+ * Counts the list of bans.
109
+ *
110
+ * @param Filters $filters
111
+ * @param string $source
112
+ *
113
+ * @return int
114
+ */
115
+ public function count_bans( Filters $filters, $source = '' ) {
116
+ if ( $source ) {
117
+ return $this->repository( $source )->count_bans( $filters );
118
+ }
119
+
120
+ $count = 0;
121
+
122
+ foreach ( $this->repositories as $repository ) {
123
+ $count += $repository->count_bans( $filters );
124
+ }
125
+
126
+ return $count;
127
+ }
128
+
129
+ /**
130
+ * Gets the list of supported query filters.
131
+ *
132
+ * A list of {@see Filters} constants declaring the available options.
133
+ *
134
+ * @param string $source
135
+ *
136
+ * @return string[]
137
+ */
138
+ public function get_supported_filters( $source = '' ) {
139
+ if ( $source ) {
140
+ return $this->repository( $source )->get_supported_filters();
141
+ }
142
+
143
+ $supported = [];
144
+
145
+ foreach ( $this->repositories as $repository ) {
146
+ $supported[] = $repository->get_supported_filters();
147
+ }
148
+
149
+ return $supported ? array_intersect( Filters::ALL, ...$supported ) : [];
150
+ }
151
+
152
+ /**
153
+ * Gets a Ban from the given source.
154
+ *
155
+ * @param string $source
156
+ * @param int $id
157
+ *
158
+ * @return Repository_Ban|null
159
+ */
160
+ public function get( $source, $id ) {
161
+ return $this->repository( $source )->get( $id );
162
+ }
163
+
164
+ /**
165
+ * Checks if creates are supported by the given repository.
166
+ *
167
+ * @param string $source
168
+ *
169
+ * @return bool
170
+ */
171
+ public function supports_create( $source ) {
172
+ return $this->repository( $source ) instanceof Creatable;
173
+ }
174
+
175
+ /**
176
+ * Gets the JSON Schema for creating a new ban.
177
+ *
178
+ * @param string $source
179
+ *
180
+ * @return array
181
+ */
182
+ public function get_creation_schema( $source ) {
183
+ $repository = $this->repository( $source );
184
+
185
+ if ( ! $repository instanceof Creatable ) {
186
+ throw new Unsupported_Operation( sprintf( esc_html__( 'The ban source "%s" does not support creating a ban.', 'better-wp-security' ), $source ) );
187
+ }
188
+
189
+ return $repository->get_creation_schema();
190
+ }
191
+
192
+ /**
193
+ * Checks if updates are supported by the given repository.
194
+ *
195
+ * @param string $source
196
+ *
197
+ * @return bool
198
+ */
199
+ public function supports_update( $source ) {
200
+ return $this->repository( $source ) instanceof Updatable;
201
+ }
202
+
203
+ /**
204
+ * Gets the JSON Schema for creating a new ban.
205
+ *
206
+ * @param string $source
207
+ *
208
+ * @return array
209
+ */
210
+ public function get_update_schema( $source ) {
211
+ $repository = $this->repository( $source );
212
+
213
+ if ( ! $repository instanceof Updatable ) {
214
+ throw new Unsupported_Operation( sprintf( esc_html__( 'The ban source "%s" does not support updating a ban.', 'better-wp-security' ), $source ) );
215
+ }
216
+
217
+ return $repository->get_update_schema();
218
+ }
219
+
220
+ /**
221
+ * Fills a ban from request data.
222
+ *
223
+ * @param string $source
224
+ * @param array $data
225
+ * @param Repository_Ban|null $ban
226
+ *
227
+ * @return Repository_Ban
228
+ */
229
+ public function fill( $source, array $data, Repository_Ban $ban = null ) {
230
+ $repository = $this->repository( $source );
231
+
232
+ if ( ! $repository instanceof Persistable ) {
233
+ throw new Unsupported_Operation( sprintf( esc_html__( 'The ban source "%s" does not support saving bans.', 'better-wp-security' ), $source ) );
234
+ }
235
+
236
+ if ( $ban && $ban->get_source() !== $source ) {
237
+ throw new Invalid_Argument_Exception( sprintf( esc_html__( 'The source "%1$s" does not match the previous ban source "%2$s".', 'better-wp-security' ), $source, $ban->get_source() ) );
238
+ }
239
+
240
+ return $repository->fill( $data, $ban );
241
+ }
242
+
243
+ /**
244
+ * Persists a ban to the repository.
245
+ *
246
+ * @param Repository_Ban $ban
247
+ *
248
+ * @return Repository_Ban
249
+ * @throws WP_Error
250
+ */
251
+ public function persist( Repository_Ban $ban ) {
252
+ $repository = $this->repository( $ban->get_source() );
253
+
254
+ if ( ! $repository instanceof Persistable ) {
255
+ throw new Unsupported_Operation( sprintf( esc_html__( 'The ban source "%s" does not support saving bans.', 'better-wp-security' ), $ban->get_source() ) );
256
+ }
257
+
258
+ return $repository->persist( $ban );
259
+ }
260
+
261
+ /**
262
+ * Checks if deletes are supported by the given repository.
263
+ *
264
+ * @param string $source
265
+ *
266
+ * @return bool
267
+ */
268
+ public function supports_delete( $source ) {
269
+ return $this->repository( $source ) instanceof Deletable;
270
+ }
271
+
272
+ /**
273
+ * Deletes a ban.
274
+ *
275
+ * @param Repository_Ban $ban
276
+ */
277
+ public function delete( Repository_Ban $ban ) {
278
+ $repository = $this->repository( $ban->get_source() );
279
+
280
+ if ( ! $repository instanceof Deletable ) {
281
+ throw new Unsupported_Operation( sprintf( esc_html__( 'The ban source "%s" does not support deleting a ban.', 'better-wp-security' ), $ban->get_source() ) );
282
+ }
283
+
284
+ $repository->delete( $ban );
285
+ }
286
+
287
+ /**
288
+ * Gets the list of repository slugs this object proxies.
289
+ *
290
+ * @return string[]
291
+ */
292
+ public function get_sources() {
293
+ return array_keys( $this->repositories );
294
+ }
295
+
296
+ /**
297
+ * Creates a cursor instance.
298
+ *
299
+ * @param string $formatted
300
+ *
301
+ * @return Multi_Cursor
302
+ */
303
+ public function cursor( $formatted = '' ) {
304
+ return new Multi_Cursor( $formatted, ...array_values( $this->repositories ) );
305
+ }
306
+
307
+ /**
308
+ * Gets the repository with the given slug.
309
+ *
310
+ * @param string $slug
311
+ *
312
+ * @return Repository
313
+ */
314
+ private function repository( $slug ) {
315
+ if ( ! isset( $this->repositories[ $slug ] ) ) {
316
+ throw new Unknown_Source( sprintf( esc_html__( 'Unknown ban source "%s".', 'better-wp-security' ), $slug ) );
317
+ }
318
+
319
+ return $this->repositories[ $slug ];
320
+ }
321
+ }
core/lib/ban-hosts/Multi_Repository_Results.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ final class Multi_Repository_Results {
6
+
7
+ /** @var Repository_Ban[] */
8
+ private $bans;
9
+
10
+ /** @var Multi_Cursor|null */
11
+ private $cursor;
12
+
13
+ /**
14
+ * Multi_Repository_Results constructor.
15
+ *
16
+ * @param Repository_Ban[] $bans
17
+ * @param Multi_Cursor|null $cursor
18
+ */
19
+ public function __construct( array $bans, Multi_Cursor $cursor = null ) {
20
+ $this->bans = $bans;
21
+ $this->cursor = $cursor;
22
+ }
23
+
24
+ /**
25
+ * Gets the list of bans from the multi repository.
26
+ *
27
+ * @return Repository_Ban[]
28
+ */
29
+ public function get_bans() {
30
+ return $this->bans;
31
+ }
32
+
33
+ /**
34
+ * Gets the cursor if this was a paginated request.
35
+ *
36
+ * @return Multi_Cursor|null
37
+ */
38
+ public function get_cursor() {
39
+ return $this->cursor;
40
+ }
41
+ }
core/lib/ban-hosts/Persistable.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Exception\WP_Error;
6
+
7
+ interface Persistable extends Repository {
8
+
9
+ /**
10
+ * Persists a ban to the repository.
11
+ *
12
+ * @param Repository_Ban $ban
13
+ *
14
+ * @return Repository_Ban
15
+ * @throws WP_Error
16
+ */
17
+ public function persist( Repository_Ban $ban );
18
+
19
+ /**
20
+ * Fills a ban from request data.
21
+ *
22
+ * @param array $data
23
+ * @param Repository_Ban|null $ban
24
+ *
25
+ * @return Repository_Ban
26
+ */
27
+ public function fill( array $data, Repository_Ban $ban = null );
28
+ }
core/lib/ban-hosts/REST.php ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Actor\Multi_Actor_Factory;
6
+ use iThemesSecurity\Exception\WP_Error;
7
+
8
+ class REST extends \WP_REST_Controller {
9
+
10
+ /** @var Multi_Repository */
11
+ private $repository;
12
+
13
+ /** @var Multi_Actor_Factory */
14
+ private $actor_factory;
15
+
16
+ /**
17
+ * REST constructor.
18
+ *
19
+ * @param Multi_Repository $repository
20
+ * @param Multi_Actor_Factory $actor_factory
21
+ */
22
+ public function __construct( Multi_Repository $repository, Multi_Actor_Factory $actor_factory ) {
23
+ $this->repository = $repository;
24
+ $this->actor_factory = $actor_factory;
25
+ $this->rest_base = 'bans';
26
+ $this->namespace = 'ithemes-security/v1';
27
+ }
28
+
29
+ public function register_routes() {
30
+ register_rest_route( $this->namespace, $this->rest_base, [
31
+ [
32
+ 'methods' => \WP_REST_Server::READABLE,
33
+ 'callback' => [ $this, 'get_items' ],
34
+ 'permission_callback' => [ $this, 'get_items_permissions_check' ],
35
+ 'args' => $this->get_collection_params(),
36
+ ],
37
+ 'schema' => [ $this, 'get_public_item_schema' ],
38
+ ] );
39
+
40
+ foreach ( $this->repository->get_sources() as $source ) {
41
+ $collection = [
42
+ [
43
+ 'methods' => \WP_REST_Server::READABLE,
44
+ 'callback' => [ $this, 'get_items' ],
45
+ 'permission_callback' => [ $this, 'get_items_permissions_check' ],
46
+ 'args' => $this->get_collection_params( $source ),
47
+ ],
48
+ ];
49
+
50
+ $item = [
51
+ [
52
+ 'methods' => \WP_REST_Server::READABLE,
53
+ 'callback' => [ $this, 'get_item' ],
54
+ 'permission_callback' => [ $this, 'get_item_permissions_check' ],
55
+ ],
56
+ ];
57
+
58
+ if ( $this->repository->supports_create( $source ) ) {
59
+ $collection[] = [
60
+ 'methods' => \WP_REST_Server::CREATABLE,
61
+ 'callback' => [ $this, 'create_item' ],
62
+ 'permission_callback' => [ $this, 'create_item_permissions_check' ],
63
+ 'args' => \ITSEC_Lib_REST::get_endpoint_args_for_schema( $this->repository->get_creation_schema( $source ) ),
64
+ ];
65
+ }
66
+
67
+ if ( $this->repository->supports_update( $source ) ) {
68
+ $item[] = [
69
+ 'methods' => 'PUT',
70
+ 'callback' => [ $this, 'update_item' ],
71
+ 'permission_callback' => [ $this, 'update_item_permissions_check' ],
72
+ 'args' => \ITSEC_Lib_REST::get_endpoint_args_for_schema( $this->repository->get_update_schema( $source ), 'PUT' ),
73
+ ];
74
+ }
75
+
76
+ if ( $this->repository->supports_delete( $source ) ) {
77
+ $item[] = [
78
+ 'methods' => \WP_REST_Server::DELETABLE,
79
+ 'callback' => [ $this, 'delete_item' ],
80
+ 'permission_callback' => [ $this, 'delete_item_permissions_check' ],
81
+ ];
82
+ }
83
+
84
+ $collection['schema'] = [ $this, 'get_public_item_schema' ];
85
+ $item['schema'] = [ $this, 'get_public_item_schema' ];
86
+ $item['args'] = [
87
+ 'id' => [
88
+ 'type' => 'integer',
89
+ ],
90
+ ];
91
+
92
+ register_rest_route( $this->namespace, sprintf( "%s/(?P<source>%s)", $this->rest_base, $source ), $collection );
93
+ register_rest_route( $this->namespace, sprintf( "%s/(?P<source>%s)/(?P<id>\d+)", $this->rest_base, $source ), $item );
94
+ }
95
+ }
96
+
97
+ public function get_items_permissions_check( $request ) {
98
+ if ( \ITSEC_Core::current_user_can_manage() ) {
99
+ return true;
100
+ }
101
+
102
+ if ( class_exists( 'ITSEC_Dashboard_Util' ) && \ITSEC_Dashboard_Util::can_access_card( 'banned-users-list' ) ) {
103
+ return true;
104
+ }
105
+
106
+ return new \WP_Error( 'rest_cannot_view', __( 'Sorry, you do not have permission to view bans.', 'better-wp-security' ), [ 'status' => rest_authorization_required_code() ] );
107
+ }
108
+
109
+ public function get_items( $request ) {
110
+ $source = $request['source'] ?: '';
111
+ $cursor = null;
112
+ $filters = new Filters();
113
+ $allowed = $this->get_collection_params( $source );
114
+
115
+ if ( ! empty( $request['after'] ) ) {
116
+ try {
117
+ $cursor = $this->repository->cursor( \ITSEC_Lib::url_safe_b64_decode( $request['after'] ) );
118
+ } catch ( Malformed_Cursor $e ) {
119
+ return new \WP_Error( 'itsec_malformed_cursor', $e->getMessage(), [ 'status' => \WP_Http::BAD_REQUEST ] );
120
+ }
121
+ }
122
+
123
+ if ( $request->has_param( 'search' ) ) {
124
+ $search = trim( $request['search'] );
125
+
126
+ if ( \ITSEC_Lib_IP_Tools::validate( $search ) ) {
127
+ $ban = $this->repository->find_ban_for_host( $search );
128
+
129
+ if ( ! $ban instanceof Repository_Ban || ( $source && $source !== $ban->get_source() ) ) {
130
+ return new \WP_REST_Response( [] );
131
+ }
132
+
133
+ return new \WP_REST_Response( [
134
+ $this->prepare_response_for_collection( $this->prepare_item_for_response( $ban, $request ) )
135
+ ] );
136
+ }
137
+
138
+ if ( in_array( Filters::SEARCH, $this->repository->get_supported_filters( $source ), true ) ) {
139
+ $filters = $filters->with_search( $search );
140
+ }
141
+ }
142
+
143
+ if ( isset( $allowed[ Filters::ACTOR_TYPE ] ) && $request->has_param( Filters::ACTOR_TYPE ) ) {
144
+ $filters = $filters->with_actor_type( $request[ Filters::ACTOR_TYPE ] );
145
+ }
146
+
147
+ if ( isset( $allowed[ Filters::ACTOR_IDENTIFIER ] ) && $request->has_param( Filters::ACTOR_IDENTIFIER ) ) {
148
+ $filters = $filters->with_actor_identifier( $request[ Filters::ACTOR_IDENTIFIER ] );
149
+ }
150
+
151
+ if ( isset( $allowed[ Filters::CREATED_BEFORE ] ) && $request->has_param( Filters::CREATED_BEFORE ) ) {
152
+ $filters = $filters->with_created_before( new \DateTimeImmutable( $request[ Filters::CREATED_BEFORE ] ) );
153
+ }
154
+
155
+ if ( isset( $allowed[ Filters::CREATED_AFTER ] ) && $request->has_param( Filters::CREATED_AFTER ) ) {
156
+ $filters = $filters->with_created_after( new \DateTimeImmutable( $request[ Filters::CREATED_AFTER ] ) );
157
+ }
158
+
159
+ if ( $request->has_param( 'per_page' ) ) {
160
+ $filters = $filters->with_limit( (int) $request['per_page'] );
161
+ }
162
+
163
+ $results = $this->repository->get_bans( $filters, $cursor, $source );
164
+ $bans = [];
165
+
166
+ foreach ( $results->get_bans() as $ban ) {
167
+ $bans[] = $this->prepare_response_for_collection(
168
+ $this->prepare_item_for_response( $ban, $request )
169
+ );
170
+ }
171
+
172
+ $response = new \WP_REST_Response( $bans );
173
+ $this->add_collection_links( $response, $request );
174
+
175
+ if ( ( $cursor = $results->get_cursor() ) && $cursor->has_more( (int) $request['per_page'] ) ) {
176
+ $path = sprintf( '%s/%s', $this->namespace, $this->rest_base );
177
+
178
+ if ( $source ) {
179
+ $path .= '/' . $source;
180
+ }
181
+
182
+ $base = add_query_arg( urlencode_deep( $request->get_query_params() ), rest_url( $path ) );
183
+ $response->link_header( 'next', add_query_arg( 'after', \ITSEC_Lib::url_safe_b64_encode( (string) $cursor ), $base ) );
184
+ }
185
+
186
+ return $response;
187
+ }
188
+
189
+ public function get_item_permissions_check( $request ) {
190
+ return $this->get_items_permissions_check( $request );
191
+ }
192
+
193
+ public function get_item( $request ) {
194
+ $ban = $this->repository->get( $request['source'], (int) $request['id'] );
195
+
196
+ if ( ! $ban ) {
197
+ return new \WP_Error( 'itsec_ban_not_found', __( 'No ban found with that id.', 'better-wp-security' ), [ 'status' => \WP_Http::NOT_FOUND ] );
198
+ }
199
+
200
+ return $this->prepare_item_for_response( $ban, $request );
201
+ }
202
+
203
+ public function create_item_permissions_check( $request ) {
204
+ if ( \ITSEC_Core::current_user_can_manage() ) {
205
+ return true;
206
+ }
207
+
208
+ return new \WP_Error( 'rest_cannot_create', __( 'Sorry, you do not have permission to create bans.', 'better-wp-security' ), [ 'status' => rest_authorization_required_code() ] );
209
+ }
210
+
211
+ public function create_item( $request ) {
212
+ $params = $request->get_params();
213
+ unset( $params['source'], $params['context'] );
214
+
215
+ try {
216
+ $ban = $this->repository->fill( $request['source'], $params );
217
+
218
+ if ( $ban->matches( \ITSEC_Lib::get_ip() ) ) {
219
+ return new \WP_Error( 'itsec_cannot_ban_self', esc_html__( 'The host matches your current IP and cannot be banned.', 'better-wp-security' ), [ 'status' => \WP_Http::BAD_REQUEST ] );
220
+ }
221
+
222
+ $ban = $this->repository->persist( $ban );
223
+ } catch ( WP_Error $e ) {
224
+ return $e->get_error();
225
+ }
226
+
227
+ $request['context'] = 'edit';
228
+
229
+ $response = $this->prepare_item_for_response( $ban, $request );
230
+ $response->set_status( \WP_Http::CREATED );
231
+ $response->header( 'Location', $response->get_links()['self'][0]['href'] );
232
+
233
+ return $response;
234
+ }
235
+
236
+ public function update_item_permissions_check( $request ) {
237
+ if ( \ITSEC_Core::current_user_can_manage() ) {
238
+ return true;
239
+ }
240
+
241
+ return new \WP_Error( 'rest_cannot_edit', __( 'Sorry, you do not have permission to update bans.', 'better-wp-security' ), [ 'status' => rest_authorization_required_code() ] );
242
+ }
243
+
244
+ public function update_item( $request ) {
245
+ $ban = $this->repository->get( $request['source'], (int) $request['id'] );
246
+
247
+ if ( ! $ban ) {
248
+ return new \WP_Error( 'itsec_ban_not_found', __( 'No ban found with that id.', 'better-wp-security' ), [ 'status' => \WP_Http::NOT_FOUND ] );
249
+ }
250
+
251
+ try {
252
+ $updated = $this->repository->fill( $request['source'], $request->get_params(), $ban );
253
+ $updated = $this->repository->persist( $updated );
254
+ } catch ( WP_Error $e ) {
255
+ return $e->get_error();
256
+ }
257
+
258
+ $request['context'] = 'edit';
259
+
260
+ return $this->prepare_item_for_response( $updated, $request );
261
+ }
262
+
263
+ public function delete_item_permissions_check( $request ) {
264
+ if ( \ITSEC_Core::current_user_can_manage() ) {
265
+ return true;
266
+ }
267
+
268
+ return new \WP_Error( 'rest_cannot_delete', __( 'Sorry, you do not have permission to delete bans.', 'better-wp-security' ), [ 'status' => rest_authorization_required_code() ] );
269
+ }
270
+
271
+ public function delete_item( $request ) {
272
+ $ban = $this->repository->get( $request['source'], (int) $request['id'] );
273
+
274
+ if ( ! $ban ) {
275
+ return new \WP_Error( 'itsec_ban_not_found', __( 'No ban found with that id.', 'better-wp-security' ), [ 'status' => \WP_Http::NOT_FOUND ] );
276
+ }
277
+
278
+ $this->repository->delete( $ban );
279
+
280
+ return new \WP_REST_Response( null, \WP_Http::NO_CONTENT );
281
+ }
282
+
283
+ /**
284
+ * Formats a Ban for the REST response.
285
+ *
286
+ * @param Repository_Ban $item
287
+ * @param \WP_REST_Request $request
288
+ *
289
+ * @return \WP_Error|\WP_REST_Response
290
+ */
291
+ public function prepare_item_for_response( $item, $request ) {
292
+ if ( $actor = $item->get_created_by() ) {
293
+ $actor = [
294
+ 'id' => $actor->get_identifier(),
295
+ 'type' => $actor->get_type(),
296
+ 'label' => (string) $actor,
297
+ ];
298
+ }
299
+
300
+ $response = new \WP_REST_Response( [
301
+ 'id' => $item->get_id(),
302
+ 'source' => $item->get_source(),
303
+ 'label' => (string) $item,
304
+ 'created_by' => $actor,
305
+ 'created_at' => \ITSEC_Lib::to_rest_date( $item->get_created_at() ),
306
+ 'comment' => $item->get_comment(),
307
+ ] );
308
+
309
+ $response->add_links( $this->prepare_links( $item, $request ) );
310
+
311
+ /**
312
+ * Filters the prepared response for a Ban object in the REST API.
313
+ *
314
+ * @param \WP_REST_Response $response
315
+ * @param Repository_Ban $item
316
+ * @param \WP_REST_Request $request
317
+ */
318
+ $response = apply_filters( 'itsec_rest_prepare_ban_for_response', $response, $item, $request );
319
+
320
+ return $response;
321
+ }
322
+
323
+ /**
324
+ * Prepares the list of links for the item.
325
+ *
326
+ * @param Repository_Ban $item
327
+ * @param \WP_REST_Request $request
328
+ *
329
+ * @return array[]
330
+ */
331
+ protected function prepare_links( Repository_Ban $item, \WP_REST_Request $request ) {
332
+ $href = rest_url( sprintf( '%s/%s/%s/%s', $this->namespace, $this->rest_base, $item->get_source(), $item->get_id() ) );
333
+
334
+ return [
335
+ 'self' => [
336
+ 'href' => $href,
337
+ 'targetHints' => [
338
+ 'allow' => $this->get_allowed_headers( $item, $request ),
339
+ ],
340
+ ],
341
+ ];
342
+ }
343
+
344
+ /**
345
+ * Add links to the collection response.
346
+ *
347
+ * @param \WP_REST_Response $response
348
+ * @param \WP_REST_Request $request
349
+ */
350
+ protected function add_collection_links( \WP_REST_Response $response, \WP_REST_Request $request ) {
351
+ if ( ! $request['source'] ) {
352
+ foreach ( $this->repository->get_sources() as $source ) {
353
+ if ( $this->repository->supports_create( $source ) && \ITSEC_Core::current_user_can_manage() ) {
354
+ $href = rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $source ) );
355
+ $response->link_header( 'create-form', $href );
356
+ }
357
+ }
358
+ }
359
+ }
360
+
361
+ /**
362
+ * Gets the list of allowed headers.
363
+ *
364
+ * @param Repository_Ban $ban
365
+ * @param \WP_REST_Request $request
366
+ *
367
+ * @return string[]
368
+ */
369
+ protected function get_allowed_headers( Repository_Ban $ban, \WP_REST_Request $request ) {
370
+ $allow = [
371
+ 'GET',
372
+ ];
373
+
374
+ if ( $this->repository->supports_update( $ban->get_source() ) && true === $this->update_item_permissions_check( $request ) ) {
375
+ $allow[] = 'PUT';
376
+ }
377
+
378
+ if ( $this->repository->supports_delete( $ban->get_source() ) && true === $this->delete_item_permissions_check( $request ) ) {
379
+ $allow[] = 'DELETE';
380
+ }
381
+
382
+ return $allow;
383
+ }
384
+
385
+ public function get_item_schema() {
386
+ if ( $this->schema ) {
387
+ return $this->schema;
388
+ }
389
+
390
+ $links = [];
391
+
392
+ foreach ( $this->repository->get_sources() as $source ) {
393
+ if ( $this->repository->supports_create( $source ) ) {
394
+ $links[] = [
395
+ 'rel' => 'create-form',
396
+ 'href' => rest_url( sprintf( '%s/%s/%s', $this->namespace, $this->rest_base, $source ) ),
397
+ 'submissionSchema' => \ITSEC_Lib_REST::sanitize_schema_for_output( $this->repository->get_creation_schema( $source ) ),
398
+ ];
399
+ }
400
+
401
+ if ( $this->repository->supports_update( $source ) ) {
402
+ $links[] = [
403
+ 'rel' => 'edit-form',
404
+ 'href' => rest_url( sprintf( '%s/%s/%s/{id}', $this->namespace, $this->rest_base, $source ) ),
405
+ 'targetSchema' => \ITSEC_Lib_REST::sanitize_schema_for_output( $this->repository->get_update_schema( $source ), 'PUT' ),
406
+ ];
407
+ }
408
+ }
409
+
410
+ return $this->schema = [
411
+ '$schema' => 'http://json-schema.org/draft-04/schema#',
412
+ 'title' => 'ithemes-security-ban',
413
+ 'type' => 'object',
414
+ 'properties' => [
415
+ 'id' => [
416
+ 'type' => 'integer',
417
+ 'context' => [ 'view', 'edit', 'embed' ],
418
+ ],
419
+ 'source' => [
420
+ 'type' => 'string',
421
+ 'enum' => $this->repository->get_sources(),
422
+ 'context' => [ 'view', 'edit', 'embed' ],
423
+ ],
424
+ 'label' => [
425
+ 'type' => 'string',
426
+ 'context' => [ 'view', 'edit', 'embed' ],
427
+ ],
428
+ 'created_by' => [
429
+ 'type' => [ 'object', 'null' ],
430
+ 'context' => [ 'view', 'edit', 'embed' ],
431
+ 'properties' => [
432
+ 'id' => [
433
+ 'type' => [ 'integer', 'string' ],
434
+ ],
435
+ 'type' => [
436
+ 'type' => 'string',
437
+ 'enum' => \ITSEC_Lib::pluck( $this->actor_factory->get_supported_factories(), 'get_slug' ),
438
+ ],
439
+ 'label' => [
440
+ 'type' => 'string',
441
+ ],
442
+ ],
443
+ ],
444
+ 'created_at' => [
445
+ 'type' => 'string',
446
+ 'format' => 'date-time',
447
+ 'context' => [ 'view', 'edit', 'embed' ],
448
+ ],
449
+ 'comment' => [
450
+ 'type' => 'string',
451
+ 'context' => [ 'view', 'edit', 'embed' ],
452
+ ],
453
+ ],
454
+ 'links' => $links,
455
+ ];
456
+ }
457
+
458
+ public function get_collection_params( $source = '' ) {
459
+ $params = parent::get_collection_params();
460
+
461
+ $params['context']['default'] = 'view';
462
+ unset( $params['page'] );
463
+
464
+ $filters = $this->repository->get_supported_filters( $source );
465
+
466
+ foreach ( $filters as $filter ) {
467
+ switch ( $filter ) {
468
+ case Filters::ACTOR_TYPE:
469
+ $params[ $filter ] = [
470
+ 'title' => __( 'Actor Type', 'better-wp-security' ),
471
+ 'description' => __( 'The type of actor that created the ban.', 'better-wp-security' ),
472
+ 'type' => 'string',
473
+ 'enum' => \ITSEC_Lib::pluck( $this->actor_factory->get_supported_factories(), 'get_slug' ),
474
+ ];
475
+ break;
476
+ case Filters::ACTOR_IDENTIFIER:
477
+ $params[ $filter ] = [
478
+ 'title' => __( 'Actor Identifier', 'better-wp-security' ),
479
+ 'description' => __( 'The particular actor that caused the ban.', 'better-wp-security' ),
480
+ 'type' => 'string',
481
+ ];
482
+ break;
483
+ case Filters::CREATED_AFTER:
484
+ $params[ $filter ] = [
485
+ 'title' => __( 'Banned After', 'better-wp-security' ),
486
+ 'description' => __( 'Limit to bans added after the given date.', 'better-wp-security' ),
487
+ 'type' => 'string',
488
+ 'format' => 'date-time',
489
+ ];
490
+ break;
491
+ case Filters::CREATED_BEFORE:
492
+ $params[ $filter ] = [
493
+ 'title' => __( 'Banned Before', 'better-wp-security' ),
494
+ 'description' => __( 'Limit to bans added before the given date.', 'better-wp-security' ),
495
+ 'type' => 'string',
496
+ 'format' => 'date-time',
497
+ ];
498
+ break;
499
+ }
500
+ }
501
+
502
+ return $params;
503
+ }
504
+ }
core/lib/ban-hosts/Repository.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ interface Repository extends Source {
6
+
7
+ /**
8
+ * Gets the slug uniquely identifying this repository.
9
+ *
10
+ * @return string
11
+ */
12
+ public function get_slug();
13
+
14
+ /**
15
+ * Gets a list of all bans in the repository.
16
+ *
17
+ * Results must be ordered in reverse chronological order.
18
+ *
19
+ * @param Filters $filters
20
+ *
21
+ * @return Repository_Ban[]
22
+ */
23
+ public function get_bans( Filters $filters );
24
+
25
+ /**
26
+ * Counts the number of bans that match the given filters.
27
+ *
28
+ * @param Filters $filters
29
+ *
30
+ * @return int
31
+ */
32
+ public function count_bans( Filters $filters );
33
+
34
+ /**
35
+ * Gets the list of supported query filters.
36
+ *
37
+ * A list of {@see Filters} constants declaring the available options.
38
+ *
39
+ * @return string[]
40
+ */
41
+ public function get_supported_filters();
42
+
43
+ /**
44
+ * Retrieves a Ban object identified by the given uuid.
45
+ *
46
+ * @param int $id The ban's id.
47
+ *
48
+ * @return Repository_Ban|null
49
+ */
50
+ public function get( $id );
51
+
52
+ /**
53
+ * Finds a ban for the given host.
54
+ *
55
+ * @param string $host The host to find a ban for.
56
+ *
57
+ * @return Repository_Ban|null
58
+ */
59
+ public function find_ban_for_host( $host );
60
+ }
core/lib/ban-hosts/Repository_Ban.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ interface Repository_Ban extends Ban {
6
+
7
+ /**
8
+ * Gets the id for the ban.
9
+ *
10
+ * @return int
11
+ */
12
+ public function get_id();
13
+
14
+ /**
15
+ * Gets the source
16
+ *
17
+ * @return string
18
+ */
19
+ public function get_source();
20
+
21
+ /**
22
+ * Gets the time this entry was created.
23
+ *
24
+ * @return \DateTimeImmutable
25
+ */
26
+ public function get_created_at();
27
+ }
core/lib/ban-hosts/Source.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ /**
6
+ * Interface Source
7
+ *
8
+ * @package iThemesSecurity\Ban_Hosts
9
+ */
10
+ interface Source {
11
+ /**
12
+ * Finds a ban for the given host.
13
+ *
14
+ * @param string $host The host to find a ban for.
15
+ *
16
+ * @return Ban|null
17
+ */
18
+ public function find_ban_for_host( $host );
19
+ }
core/lib/ban-hosts/Unknown_Source.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Exception\Invalid_Argument_Exception;
6
+
7
+ final class Unknown_Source extends Invalid_Argument_Exception {
8
+
9
+ }
core/lib/ban-hosts/Unsupported_Operation.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ use iThemesSecurity\Exception\Exception;
6
+
7
+ final class Unsupported_Operation extends \BadMethodCallException implements Exception {
8
+
9
+ }
core/lib/ban-hosts/Updatable.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Hosts;
4
+
5
+ interface Updatable extends Persistable {
6
+
7
+ /**
8
+ * Gets the schema specifying what fields can be updated.
9
+ *
10
+ * @return array
11
+ */
12
+ public function get_update_schema();
13
+ }
core/lib/ban-hosts/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/lib/class-itsec-lib-login-interstitial.php CHANGED
@@ -901,7 +901,9 @@ class ITSEC_Lib_Login_Interstitial {
901
  * @return string
902
  */
903
  private function get_base_wp_login_url() {
 
904
  $wp_login_url = set_url_scheme( wp_login_url(), 'login_post' );
 
905
 
906
  if ( ( defined( 'WPE_PLUGIN_URL' ) || isset( $_GET['wpe-login'] ) ) && ! preg_match( '/[&?]wpe-login=/', $wp_login_url ) ) {
907
  $wpe_login = isset( $_GET['wpe-login'] ) ? $_GET['wpe-login'] : 'true';
901
  * @return string
902
  */
903
  private function get_base_wp_login_url() {
904
+ add_filter( 'rcp_do_login_hijack', '__return_false', 100 );
905
  $wp_login_url = set_url_scheme( wp_login_url(), 'login_post' );
906
+ remove_filter( 'rcp_do_login_hijack', '__return_false', 100 );
907
 
908
  if ( ( defined( 'WPE_PLUGIN_URL' ) || isset( $_GET['wpe-login'] ) ) && ! preg_match( '/[&?]wpe-login=/', $wp_login_url ) ) {
909
  $wpe_login = isset( $_GET['wpe-login'] ) ? $_GET['wpe-login'] : 'true';
core/lib/class-itsec-lib-rest.php CHANGED
@@ -115,4 +115,153 @@ class ITSEC_Lib_REST {
115
 
116
  return $user instanceof WP_User && $user->exists() ? 403 : 401;
117
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  }
115
 
116
  return $user instanceof WP_User && $user->exists() ? 403 : 401;
117
  }
118
+
119
+ /**
120
+ * Validates an IP address.
121
+ *
122
+ * @param string $ip The IP address.
123
+ * @param WP_REST_Request $request The request object.
124
+ * @param string $param The parameter name.
125
+ *
126
+ * @return true|WP_Error
127
+ */
128
+ public static function validate_ip( $ip, $request, $param ) {
129
+ if ( ! is_string( $ip ) || ! ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $ip ) ) {
130
+ /* translators: %s: Parameter name. */
131
+ return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $param ) );
132
+ }
133
+
134
+ return true;
135
+ }
136
+
137
+ /**
138
+ * Sanitizes an IP address.
139
+ *
140
+ * @param string $ip The IP address.
141
+ *
142
+ * @return string|false
143
+ */
144
+ public static function sanitize_ip( $ip ) {
145
+ return ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $ip );
146
+ }
147
+
148
+ /**
149
+ * Retrieves an array of endpoint arguments from the item schema for the controller.
150
+ *
151
+ * @param array $schema The JSON schema to use.
152
+ * @param string $method Optional. HTTP method of the request. The arguments for `CREATABLE` requests are
153
+ * checked for required values and may fall-back to a given default, this is not done
154
+ * on `EDITABLE` requests. Default WP_REST_Server::CREATABLE.
155
+ *
156
+ * @return array Endpoint arguments.
157
+ */
158
+ public static function get_endpoint_args_for_schema( $schema, $method = WP_REST_Server::CREATABLE ) {
159
+ $schema_properties = ! empty( $schema['properties'] ) ? $schema['properties'] : array();
160
+ $endpoint_args = array();
161
+ $valid_schema_properties = array(
162
+ 'title',
163
+ 'description',
164
+ 'type',
165
+ 'format',
166
+ 'enum',
167
+ 'items',
168
+ 'properties',
169
+ 'additionalProperties',
170
+ 'minimum',
171
+ 'maximum',
172
+ 'exclusiveMinimum',
173
+ 'exclusiveMaximum',
174
+ 'minLength',
175
+ 'maxLength',
176
+ 'pattern',
177
+ 'minItems',
178
+ 'maxItems',
179
+ 'uniqueItems',
180
+ );
181
+
182
+ foreach ( $schema_properties as $field_id => $params ) {
183
+
184
+ // Arguments specified as `readonly` are not allowed to be set.
185
+ if ( ! empty( $params['readonly'] ) ) {
186
+ continue;
187
+ }
188
+
189
+ $endpoint_args[ $field_id ] = [
190
+ 'validate_callback' => 'rest_validate_request_arg',
191
+ 'sanitize_callback' => 'rest_sanitize_request_arg',
192
+ ];
193
+
194
+ if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) {
195
+ $endpoint_args[ $field_id ]['default'] = $params['default'];
196
+ }
197
+
198
+ if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) {
199
+ $endpoint_args[ $field_id ]['required'] = $params['required'];
200
+ }
201
+
202
+ foreach ( $valid_schema_properties as $schema_prop ) {
203
+ if ( isset( $params[ $schema_prop ] ) ) {
204
+ $endpoint_args[ $field_id ][ $schema_prop ] = $params[ $schema_prop ];
205
+ }
206
+ }
207
+
208
+ // Merge in any options provided by the schema property.
209
+ if ( isset( $params['arg_options'] ) ) {
210
+
211
+ // Only use required / default from arg_options on CREATABLE endpoints.
212
+ if ( WP_REST_Server::CREATABLE !== $method ) {
213
+ $params['arg_options'] = array_diff_key(
214
+ $params['arg_options'],
215
+ array(
216
+ 'required' => '',
217
+ 'default' => '',
218
+ )
219
+ );
220
+ }
221
+
222
+ $endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] );
223
+ }
224
+ }
225
+
226
+ return $endpoint_args;
227
+ }
228
+
229
+ /**
230
+ * Retrieves an array of endpoint arguments from the item schema for the controller.
231
+ *
232
+ * @param array $schema The JSON schema to use.
233
+ * @param string $method Optional. HTTP method of the request. The arguments for `CREATABLE` requests are
234
+ * checked for required values and may fall-back to a given default, this is not done
235
+ * on `EDITABLE` requests. Default WP_REST_Server::CREATABLE.
236
+ *
237
+ * @return array The sanitized schema.
238
+ */
239
+ public static function sanitize_schema_for_output( $schema, $method = WP_REST_Server::CREATABLE ) {
240
+ $args = static::get_endpoint_args_for_schema( $schema, $method );
241
+
242
+ foreach ( $args as $arg => $arg_schema ) {
243
+ unset( $arg_schema['validate_callback'], $arg_schema['sanitize_callback'] );
244
+
245
+ $schema['properties'][ $arg ] = $arg_schema;
246
+ }
247
+
248
+ return $schema;
249
+ }
250
+
251
+ /**
252
+ * Gets the HTTP method used with the REST API.
253
+ *
254
+ * @return string
255
+ */
256
+ public static function get_http_method() {
257
+ if ( isset( $_GET['_method'] ) ) {
258
+ return strtoupper( $_GET['_method'] );
259
+ }
260
+
261
+ if ( isset( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ) {
262
+ return strtoupper( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] );
263
+ }
264
+
265
+ return strtoupper( $_SERVER['REQUEST_METHOD'] );
266
+ }
267
  }
core/lib/class-itsec-mail.php CHANGED
@@ -46,7 +46,7 @@ final class ITSEC_Mail {
46
  $callout = $this->get_template( 'pro-callout.html' );
47
 
48
  $replacements = array(
49
- 'two_factor' => esc_html__( 'Want two-factor authentication, scheduled malware scanning, ticketed support and more?', 'better-wp-security' ),
50
  'get_pro' => esc_html__( 'Get iThemes Security Pro', 'better-wp-security' ),
51
  'why_pro' => sprintf( wp_kses( __( 'Why go Pro? <a href="%s">Check out the Free/Pro comparison chart.</a>', 'better-wp-security' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( 'https://ithemes.com/security/why-go-pro/' ) ),
52
  );
46
  $callout = $this->get_template( 'pro-callout.html' );
47
 
48
  $replacements = array(
49
+ 'two_factor' => esc_html__( 'Want two-factor authentication, scheduled site scanning, ticketed support and more?', 'better-wp-security' ),
50
  'get_pro' => esc_html__( 'Get iThemes Security Pro', 'better-wp-security' ),
51
  'why_pro' => sprintf( wp_kses( __( 'Why go Pro? <a href="%s">Check out the Free/Pro comparison chart.</a>', 'better-wp-security' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( 'https://ithemes.com/security/why-go-pro/' ) ),
52
  );
core/lib/class-itsec-scheduler-cron.php CHANGED
@@ -117,7 +117,7 @@ class ITSEC_Scheduler_Cron extends ITSEC_Scheduler {
117
  $now = $now ? $now : ITSEC_Core::get_current_time_gmt();
118
 
119
  foreach ( $crons as $timestamp => $hooks ) {
120
- if ( $timestamp > $now || ! isset( $hooks[ self::HOOK ] ) ) {
121
  continue;
122
  }
123
 
@@ -277,7 +277,7 @@ class ITSEC_Scheduler_Cron extends ITSEC_Scheduler {
277
  $found = false;
278
 
279
  foreach ( $crons as $timestamp => $hooks ) {
280
- if ( isset( $hooks[ self::HOOK ][ $hash ] ) ) {
281
  $found = true;
282
  unset( $crons[ $timestamp ][ self::HOOK ][ $hash ] );
283
  break;
@@ -463,6 +463,10 @@ class ITSEC_Scheduler_Cron extends ITSEC_Scheduler {
463
  $crons = _get_cron_array();
464
 
465
  foreach ( $crons as $timestamp => $args ) {
 
 
 
 
466
  unset( $crons[ $timestamp ][ self::HOOK ] );
467
 
468
  if ( empty( $crons[ $timestamp ] ) ) {
117
  $now = $now ? $now : ITSEC_Core::get_current_time_gmt();
118
 
119
  foreach ( $crons as $timestamp => $hooks ) {
120
+ if ( ! is_array( $hooks ) || $timestamp > $now || ! isset( $hooks[ self::HOOK ] ) ) {
121
  continue;
122
  }
123
 
277
  $found = false;
278
 
279
  foreach ( $crons as $timestamp => $hooks ) {
280
+ if ( is_array( $hooks ) && isset( $hooks[ self::HOOK ][ $hash ] ) ) {
281
  $found = true;
282
  unset( $crons[ $timestamp ][ self::HOOK ][ $hash ] );
283
  break;
463
  $crons = _get_cron_array();
464
 
465
  foreach ( $crons as $timestamp => $args ) {
466
+ if ( ! is_array( $args ) ) {
467
+ continue;
468
+ }
469
+
470
  unset( $crons[ $timestamp ][ self::HOOK ] );
471
 
472
  if ( empty( $crons[ $timestamp ] ) ) {
core/lib/schema.php CHANGED
@@ -11,6 +11,7 @@ final class ITSEC_Schema {
11
  'itsec_opaque_tokens',
12
  'itsec_user_groups',
13
  'itsec_mutexes',
 
14
  ];
15
 
16
  /**
@@ -33,7 +34,7 @@ CREATE TABLE {$wpdb->base_prefix}itsec_logs (
33
  parent_id bigint(20) unsigned NOT NULL default '0',
34
  module varchar(50) NOT NULL default '',
35
  code varchar(100) NOT NULL default '',
36
- data longtext NOT NULL default '',
37
  type varchar(20) NOT NULL default 'notice',
38
  timestamp datetime NOT NULL default '0000-00-00 00:00:00',
39
  init_timestamp datetime NOT NULL default '0000-00-00 00:00:00',
@@ -55,7 +56,7 @@ CREATE TABLE {$wpdb->base_prefix}itsec_logs (
55
 
56
  CREATE TABLE {$wpdb->base_prefix}itsec_lockouts (
57
  lockout_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
58
- lockout_type varchar(20) NOT NULL,
59
  lockout_start datetime NOT NULL,
60
  lockout_start_gmt datetime NOT NULL,
61
  lockout_expire datetime NOT NULL,
@@ -75,7 +76,7 @@ CREATE TABLE {$wpdb->base_prefix}itsec_lockouts (
75
 
76
  CREATE TABLE {$wpdb->base_prefix}itsec_temp (
77
  temp_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
78
- temp_type varchar(20) NOT NULL,
79
  temp_date datetime NOT NULL,
80
  temp_date_gmt datetime NOT NULL,
81
  temp_host varchar(40),
@@ -157,6 +158,19 @@ CREATE TABLE {$wpdb->base_prefix}itsec_mutexes (
157
  PRIMARY KEY (mutex_id),
158
  UNIQUE KEY mutex_name (mutex_name)
159
  ) $charset_collate;
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  ";
161
 
162
  $wp_error = new WP_Error();
@@ -188,14 +202,10 @@ CREATE TABLE {$wpdb->base_prefix}itsec_mutexes (
188
  public static function remove_database_tables() {
189
  global $wpdb;
190
 
191
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_logs;" );
 
 
 
192
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_log;" );
193
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_lockouts;" );
194
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_temp;" );
195
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_distributed_storage;" );
196
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_geolocation_cache;" );
197
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_fingerprints;" );
198
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_user_groups;" );
199
- $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_mutexes;" );
200
  }
201
  }
11
  'itsec_opaque_tokens',
12
  'itsec_user_groups',
13
  'itsec_mutexes',
14
+ 'itsec_bans',
15
  ];
16
 
17
  /**
34
  parent_id bigint(20) unsigned NOT NULL default '0',
35
  module varchar(50) NOT NULL default '',
36
  code varchar(100) NOT NULL default '',
37
+ data longtext NOT NULL,
38
  type varchar(20) NOT NULL default 'notice',
39
  timestamp datetime NOT NULL default '0000-00-00 00:00:00',
40
  init_timestamp datetime NOT NULL default '0000-00-00 00:00:00',
56
 
57
  CREATE TABLE {$wpdb->base_prefix}itsec_lockouts (
58
  lockout_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
59
+ lockout_type varchar(25) NOT NULL,
60
  lockout_start datetime NOT NULL,
61
  lockout_start_gmt datetime NOT NULL,
62
  lockout_expire datetime NOT NULL,
76
 
77
  CREATE TABLE {$wpdb->base_prefix}itsec_temp (
78
  temp_id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
79
+ temp_type varchar(25) NOT NULL,
80
  temp_date datetime NOT NULL,
81
  temp_date_gmt datetime NOT NULL,
82
  temp_host varchar(40),
158
  PRIMARY KEY (mutex_id),
159
  UNIQUE KEY mutex_name (mutex_name)
160
  ) $charset_collate;
161
+
162
+ CREATE TABLE {$wpdb->base_prefix}itsec_bans (
163
+ id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
164
+ host varchar(64) NOT NULL,
165
+ type varchar(20) NOT NULL default 'ip',
166
+ created_at datetime NOT NULL,
167
+ actor_type varchar(20),
168
+ actor_id varchar(128),
169
+ comment varchar(255) NOT NULL default '',
170
+ PRIMARY KEY (id),
171
+ UNIQUE KEY host (host),
172
+ KEY actor (actor_type,actor_id)
173
+ ) $charset_collate;
174
  ";
175
 
176
  $wp_error = new WP_Error();
202
  public static function remove_database_tables() {
203
  global $wpdb;
204
 
205
+ foreach ( self::TABLES as $table ) {
206
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}{$table};" );
207
+ }
208
+
209
  $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->base_prefix}itsec_log;" );
 
 
 
 
 
 
 
210
  }
211
  }
core/lib/validator.php CHANGED
@@ -116,6 +116,18 @@ abstract class ITSEC_Validator {
116
  }
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  final protected function sanitize_setting( $type, $var, $name, $prevent_save_on_error = true, $trim_value = true, $custom_error = '' ) {
120
  $id = $this->get_id();
121
 
@@ -553,6 +565,11 @@ abstract class ITSEC_Validator {
553
  return $array;
554
  }
555
 
 
 
 
 
 
556
  final protected function add_error( $error ) {
557
  $this->errors[] = $error;
558
  }
116
  }
117
  }
118
 
119
+ /**
120
+ * Sanitizes a setting.
121
+ *
122
+ * @param string|callable $type The sanitization to apply.
123
+ * @param string $var The variable name.
124
+ * @param string $name The human facing label for the setting.
125
+ * @param bool $prevent_save_on_error Whether to prevent the module from saving if sanitization fails.
126
+ * @param bool $trim_value Whether to trim the value if it is a string.
127
+ * @param string $custom_error A custom error message to use instead of the default.
128
+ *
129
+ * @return bool Whether sanitization passed or not.
130
+ */
131
  final protected function sanitize_setting( $type, $var, $name, $prevent_save_on_error = true, $trim_value = true, $custom_error = '' ) {
132
  $id = $this->get_id();
133
 
565
  return $array;
566
  }
567
 
568
+ /**
569
+ * Adds an error to be displayed to the user.
570
+ *
571
+ * @param \WP_Error $error
572
+ */
573
  final protected function add_error( $error ) {
574
  $this->errors[] = $error;
575
  }
core/lockout.php CHANGED
@@ -142,7 +142,7 @@ final class ITSEC_Lockout {
142
 
143
  $host = ITSEC_Lib::get_ip();
144
 
145
- if ( ITSEC_Lib::is_ip_blacklisted() ) {
146
  $this->execute_lock( new Execute_Lock\Host_Context( new Configurable( 'blacklist' ), $host ) );
147
  }
148
 
@@ -582,7 +582,7 @@ final class ITSEC_Lockout {
582
  if ( $whitelisted ) {
583
  ITSEC_Log::add_notice( 'lockout', 'whitelisted-host-triggered-blacklist', array_merge( $log_data, compact( 'blacklist_period', 'blacklist_count', 'host_count' ) ) );
584
  } else {
585
- $this->blacklist_ip( $host );
586
  ITSEC_Log::add_action( 'lockout', 'host-triggered-blacklist', array_merge( $log_data, compact( 'blacklist_period', 'blacklist_count', 'host_count' ) ) );
587
  }
588
  }
@@ -1061,40 +1061,20 @@ final class ITSEC_Lockout {
1061
  update_site_option( 'itsec_temp_whitelist_ip', array() );
1062
  }
1063
 
1064
- /**
1065
- * Check if the current user is temporarily whitelisted.
1066
- *
1067
- * @return bool
1068
- */
1069
- public function is_visitor_temp_whitelisted() {
1070
-
1071
- if ( defined( 'ITSEC_DISABLE_TEMP_WHITELIST' ) && ITSEC_DISABLE_TEMP_WHITELIST ) {
1072
- return false;
1073
- }
1074
-
1075
- $whitelist = $this->get_temp_whitelist();
1076
- $ip = ITSEC_Lib::get_ip();
1077
-
1078
- if ( isset( $whitelist[ $ip ] ) && $whitelist[ $ip ] > ITSEC_Core::get_current_time() ) {
1079
- return true;
1080
- }
1081
-
1082
- return false;
1083
- }
1084
-
1085
  /**
1086
  * Inserts an IP address into the htaccess ban list.
1087
  *
1088
  * @since 4.0
1089
  *
1090
- * @param $ip
 
1091
  *
1092
  * @return boolean False if the IP is whitelisted, true otherwise.
1093
  */
1094
- public function blacklist_ip( $ip ) {
1095
  $ip = sanitize_text_field( $ip );
1096
 
1097
- if ( ITSEC_Lib::is_ip_blacklisted( $ip ) ) {
1098
  // Already blacklisted.
1099
  return true;
1100
  }
@@ -1104,13 +1084,42 @@ final class ITSEC_Lockout {
1104
  return false;
1105
  }
1106
 
1107
- // The following action allows modules to handle the blacklist as needed. This is primarily useful for the Ban
1108
- // Users module.
1109
- do_action( 'itsec-new-blacklisted-ip', $ip );
 
 
 
 
 
 
 
 
1110
 
1111
  return true;
1112
  }
1113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1114
  /**
1115
  * Register the purge lockout event.
1116
  *
142
 
143
  $host = ITSEC_Lib::get_ip();
144
 
145
+ if ( ITSEC_Lib::is_ip_banned() ) {
146
  $this->execute_lock( new Execute_Lock\Host_Context( new Configurable( 'blacklist' ), $host ) );
147
  }
148
 
582
  if ( $whitelisted ) {
583
  ITSEC_Log::add_notice( 'lockout', 'whitelisted-host-triggered-blacklist', array_merge( $log_data, compact( 'blacklist_period', 'blacklist_count', 'host_count' ) ) );
584
  } else {
585
+ $this->blacklist_ip( $host, $context );
586
  ITSEC_Log::add_action( 'lockout', 'host-triggered-blacklist', array_merge( $log_data, compact( 'blacklist_period', 'blacklist_count', 'host_count' ) ) );
587
  }
588
  }
1061
  update_site_option( 'itsec_temp_whitelist_ip', array() );
1062
  }
1063
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1064
  /**
1065
  * Inserts an IP address into the htaccess ban list.
1066
  *
1067
  * @since 4.0
1068
  *
1069
+ * @param string $ip The IP address to ban.
1070
+ * @param Lockout\Context|null $context The lockout context that caused the ban.
1071
  *
1072
  * @return boolean False if the IP is whitelisted, true otherwise.
1073
  */
1074
+ public function blacklist_ip( $ip, Lockout\Context $context = null ) {
1075
  $ip = sanitize_text_field( $ip );
1076
 
1077
+ if ( ITSEC_Lib::is_ip_banned( $ip ) ) {
1078
  // Already blacklisted.
1079
  return true;
1080
  }
1084
  return false;
1085
  }
1086
 
1087
+ do_action_deprecated( 'itsec-new-blacklisted-ip', array( $ip ), '6.7.0', 'itsec_new_banned_ip' );
1088
+
1089
+ /**
1090
+ * Fires when a new IP has been banned.
1091
+ *
1092
+ * This is primarily used by the Ban Users module.
1093
+ *
1094
+ * @param string $ip The IP address.
1095
+ * @param Lockout\Context|null $context The lockout context that caused the ban.
1096
+ */
1097
+ do_action( 'itsec_new_banned_ip', $ip, $context );
1098
 
1099
  return true;
1100
  }
1101
 
1102
+ /**
1103
+ * Check if the current user is temporarily whitelisted.
1104
+ *
1105
+ * @return bool
1106
+ */
1107
+ public function is_visitor_temp_whitelisted() {
1108
+
1109
+ if ( defined( 'ITSEC_DISABLE_TEMP_WHITELIST' ) && ITSEC_DISABLE_TEMP_WHITELIST ) {
1110
+ return false;
1111
+ }
1112
+
1113
+ $whitelist = $this->get_temp_whitelist();
1114
+ $ip = ITSEC_Lib::get_ip();
1115
+
1116
+ if ( isset( $whitelist[ $ip ] ) && $whitelist[ $ip ] > ITSEC_Core::get_current_time() ) {
1117
+ return true;
1118
+ }
1119
+
1120
+ return false;
1121
+ }
1122
+
1123
  /**
1124
  * Register the purge lockout event.
1125
  *
core/modules.php CHANGED
@@ -660,7 +660,7 @@ final class ITSEC_Modules {
660
  public static function initialize_container() {
661
  $load = require __DIR__ . '/container.php';
662
 
663
- if ( is_callable( $load ) ) {
664
  $load( self::get_instance()->pimple );
665
  }
666
 
660
  public static function initialize_container() {
661
  $load = require __DIR__ . '/container.php';
662
 
663
+ if ( is_callable( $load ) && ! self::get_instance()->initialized_container ) {
664
  $load( self::get_instance()->pimple );
665
  }
666
 
core/modules/404-detection/class-itsec-four-oh-four.php CHANGED
@@ -54,6 +54,7 @@ class ITSEC_Four_Oh_Four {
54
  $lockout_modules['four_oh_four'] = array(
55
  'type' => 'four_oh_four',
56
  'reason' => __( 'too many attempts to access a file that does not exist', 'better-wp-security' ),
 
57
  'host' => $this->settings['error_threshold'],
58
  'period' => $this->settings['check_period']
59
  );
54
  $lockout_modules['four_oh_four'] = array(
55
  'type' => 'four_oh_four',
56
  'reason' => __( 'too many attempts to access a file that does not exist', 'better-wp-security' ),
57
+ 'label' => __( '404', 'better-wp-security' ),
58
  'host' => $this->settings['error_threshold'],
59
  'period' => $this->settings['check_period']
60
  );
core/modules/admin-user/active.php CHANGED
@@ -1 +1,102 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
+
3
+ /**
4
+ * Changes Admin User.
5
+ *
6
+ * Changes the username and id of the 1st user
7
+ *
8
+ * @param string $username The username to change.
9
+ * @param bool $id Whether to change the id.
10
+ *
11
+ * @return bool
12
+ */
13
+ function itsec_change_admin_user( $username = null, $id = false ) {
14
+ global $wpdb;
15
+
16
+ if ( ! ITSEC_Lib::get_lock( 'admin_user', 180 ) ) {
17
+ return false;
18
+ }
19
+
20
+ //sanitize the username
21
+ $new_user = sanitize_text_field( $username );
22
+
23
+ //Get the full user object
24
+ $user_object = get_user_by( 'id', '1' );
25
+
26
+ if ( ! is_null( $username ) && validate_username( $new_user ) && false === username_exists( $new_user ) ) { //there is a valid username to change
27
+ if ( $id === true ) { //we're changing the id too so we'll set the username
28
+ $user_login = $new_user;
29
+ } else { // we're only changing the username
30
+
31
+ //query main user table
32
+ $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->users}` SET user_login = %s WHERE user_login = %s", $new_user, 'admin' ) );
33
+
34
+ if ( is_multisite() ) { //process sitemeta if we're in a multi-site situation
35
+
36
+ $old_admins = $wpdb->get_var( "SELECT meta_value FROM `" . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" );
37
+ // No need to escape the new username. It is already safe via validate_userame() which will check for quotes
38
+ $new_admins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . $new_user . '"', $old_admins );
39
+ $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->sitemeta}` SET meta_value = %s WHERE meta_key = 'site_admins'", $new_admins ) );
40
+
41
+ }
42
+
43
+ ITSEC_Lib::release_lock( 'admin_user' );
44
+
45
+ return true;
46
+ }
47
+ } elseif ( $username !== null ) { //username didn't validate
48
+ ITSEC_Lib::release_lock( 'admin_user' );
49
+
50
+ return false;
51
+ } else { //only changing the id
52
+ $user_login = $user_object->user_login;
53
+ }
54
+
55
+ if ( $id === true ) { //change the user id
56
+
57
+ $wpdb->query( "DELETE FROM `" . $wpdb->users . "` WHERE ID = 1;" );
58
+
59
+ $wpdb->insert( $wpdb->users, array(
60
+ 'user_login' => $user_login,
61
+ 'user_pass' => $user_object->user_pass,
62
+ 'user_nicename' => $user_object->user_nicename,
63
+ 'user_email' => $user_object->user_email,
64
+ 'user_url' => $user_object->user_url,
65
+ 'user_registered' => $user_object->user_registered,
66
+ 'user_activation_key' => $user_object->user_activation_key,
67
+ 'user_status' => $user_object->user_status,
68
+ 'display_name' => $user_object->display_name
69
+ ) );
70
+
71
+ if ( is_multisite() && $username !== null && validate_username( $new_user ) ) { //process sitemeta if we're in a multi-site situation
72
+
73
+ $old_admins = $wpdb->get_var( "SELECT meta_value FROM `{$wpdb->sitemeta}` WHERE meta_key = 'site_admins'" );
74
+ // No need to escape the new username. It is already safe via validate_userame() which will check for quotes
75
+ $new_admins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . $new_user . '"', $old_admins );
76
+ $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->sitemeta}` SET meta_value = %s WHERE meta_key = 'site_admins'", $new_admins ) );
77
+
78
+ }
79
+
80
+ $new_user = $wpdb->insert_id;
81
+
82
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_author = %d WHERE post_author = 1", $new_user ) );
83
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->usermeta} SET user_id = %d WHERE user_id = 1", $new_user ) );
84
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->comments} SET user_id = %d WHERE user_id = 1", $new_user ) );
85
+ $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->links} SET link_owner = %d WHERE link_owner = 1", $new_user ) );
86
+
87
+ /**
88
+ * Fires when the admin user with id of #1 has been changed.
89
+ *
90
+ * @since 6.3.0
91
+ *
92
+ * @param int $new_user The new user's ID.
93
+ */
94
+ do_action( 'itsec_change_admin_user_id', $new_user );
95
+
96
+ ITSEC_Lib::release_lock( 'admin_user' );
97
+
98
+ return true;
99
+ }
100
+
101
+ return false;
102
+ }
core/modules/admin-user/validator.php CHANGED
@@ -4,7 +4,6 @@ final class ITSEC_Admin_User_Validator extends ITSEC_Validator {
4
  protected $run_validate_matching_fields = false;
5
  protected $run_validate_matching_types = false;
6
 
7
-
8
  public function get_id() {
9
  return 'admin-user';
10
  }
@@ -22,27 +21,26 @@ final class ITSEC_Admin_User_Validator extends ITSEC_Validator {
22
  $this->sanitize_setting( 'bool', 'change_id', __( 'Change User ID 1', 'better-wp-security' ) );
23
  }
24
  }
25
-
26
  protected function validate_settings() {
27
  if ( ! $this->can_save() ) {
28
  return;
29
  }
30
-
31
  if ( empty( $this->settings['new_username'] ) || 'admin' === $this->settings['new_username'] ) {
32
  $this->settings['new_username'] = null;
33
  }
34
-
35
  if ( is_null( $this->settings['new_username'] ) && false === $this->settings['change_id'] ) {
36
  return;
37
  }
38
-
39
-
40
- $result = $this->change_admin_user( $this->settings['new_username'], $this->settings['change_id'] );
41
-
42
  if ( $result ) {
43
  $this->add_message( __( 'The user was successfully updated.', 'better-wp-security' ) );
44
  ITSEC_Response::set_show_default_success_message( false );
45
-
46
  ITSEC_Response::force_logout();
47
  } else {
48
  $this->set_can_save( false );
@@ -50,115 +48,6 @@ final class ITSEC_Admin_User_Validator extends ITSEC_Validator {
50
  ITSEC_Response::set_show_default_error_message( false );
51
  }
52
  }
53
-
54
- /**
55
- * Changes Admin User
56
- *
57
- * Changes the username and id of the 1st user
58
- *
59
- * @param string $username the username to change if changing at the same time
60
- * @param bool $id whether to change the id as well
61
- *
62
- * @return bool success or failure
63
- *
64
- **/
65
- private function change_admin_user( $username = null, $id = false ) {
66
-
67
- global $wpdb;
68
-
69
- if ( ITSEC_Lib::get_lock( 'admin_user', 180 ) ) { //make sure it isn't already running
70
-
71
- //sanitize the username
72
- $new_user = sanitize_text_field( $username );
73
-
74
- //Get the full user object
75
- $user_object = get_user_by( 'id', '1' );
76
-
77
- if ( ! is_null( $username ) && validate_username( $new_user ) && false === username_exists( $new_user ) ) { //there is a valid username to change
78
-
79
- if ( $id === true ) { //we're changing the id too so we'll set the username
80
-
81
- $user_login = $new_user;
82
-
83
- } else { // we're only changing the username
84
-
85
- //query main user table
86
- $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->users}` SET user_login = %s WHERE user_login = %s", $new_user, 'admin' ) );
87
-
88
- if ( is_multisite() ) { //process sitemeta if we're in a multi-site situation
89
-
90
- $old_admins = $wpdb->get_var( "SELECT meta_value FROM `" . $wpdb->sitemeta . "` WHERE meta_key = 'site_admins'" );
91
- // No need to escape the new username. It is already safe via validate_userame() which will check for quotes
92
- $new_admins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . $new_user . '"', $old_admins );
93
- $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->sitemeta}` SET meta_value = %s WHERE meta_key = 'site_admins'", $new_admins ) );
94
-
95
- }
96
-
97
- ITSEC_Lib::release_lock( 'admin_user' );
98
-
99
- return true;
100
-
101
- }
102
-
103
- } elseif ( $username !== null ) { //username didn't validate
104
- ITSEC_Lib::release_lock( 'admin_user' );
105
-
106
- return false;
107
-
108
- } else { //only changing the id
109
-
110
- $user_login = $user_object->user_login;
111
-
112
- }
113
-
114
- if ( $id === true ) { //change the user id
115
-
116
- $wpdb->query( "DELETE FROM `" . $wpdb->users . "` WHERE ID = 1;" );
117
-
118
- $wpdb->insert( $wpdb->users, array(
119
- 'user_login' => $user_login, 'user_pass' => $user_object->user_pass,
120
- 'user_nicename' => $user_object->user_nicename, 'user_email' => $user_object->user_email,
121
- 'user_url' => $user_object->user_url, 'user_registered' => $user_object->user_registered,
122
- 'user_activation_key' => $user_object->user_activation_key,
123
- 'user_status' => $user_object->user_status, 'display_name' => $user_object->display_name
124
- ) );
125
-
126
- if ( is_multisite() && $username !== null && validate_username( $new_user ) ) { //process sitemeta if we're in a multi-site situation
127
-
128
- $old_admins = $wpdb->get_var( "SELECT meta_value FROM `{$wpdb->sitemeta}` WHERE meta_key = 'site_admins'" );
129
- // No need to escape the new username. It is already safe via validate_userame() which will check for quotes
130
- $new_admins = str_replace( '5:"admin"', strlen( $new_user ) . ':"' . $new_user . '"', $old_admins );
131
- $wpdb->query( $wpdb->prepare( "UPDATE `{$wpdb->sitemeta}` SET meta_value = %s WHERE meta_key = 'site_admins'", $new_admins ) );
132
-
133
- }
134
-
135
- $new_user = $wpdb->insert_id;
136
-
137
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_author = %d WHERE post_author = 1", $new_user ) );
138
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->usermeta} SET user_id = %d WHERE user_id = 1", $new_user ) );
139
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->comments} SET user_id = %d WHERE user_id = 1", $new_user ) );
140
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->links} SET link_owner = %d WHERE link_owner = 1", $new_user ) );
141
-
142
- /**
143
- * Fires when the admin user with id of #1 has been changed.
144
- *
145
- * @since 6.3.0
146
- *
147
- * @param int $new_user The new user's ID.
148
- */
149
- do_action( 'itsec_change_admin_user_id', $new_user );
150
-
151
- ITSEC_Lib::release_lock( 'admin_user' );
152
-
153
- return true;
154
-
155
- }
156
-
157
- }
158
-
159
- return false;
160
-
161
- }
162
  }
163
 
164
  ITSEC_Modules::register_validator( new ITSEC_Admin_User_Validator() );
4
  protected $run_validate_matching_fields = false;
5
  protected $run_validate_matching_types = false;
6
 
 
7
  public function get_id() {
8
  return 'admin-user';
9
  }
21
  $this->sanitize_setting( 'bool', 'change_id', __( 'Change User ID 1', 'better-wp-security' ) );
22
  }
23
  }
24
+
25
  protected function validate_settings() {
26
  if ( ! $this->can_save() ) {
27
  return;
28
  }
29
+
30
  if ( empty( $this->settings['new_username'] ) || 'admin' === $this->settings['new_username'] ) {
31
  $this->settings['new_username'] = null;
32
  }
33
+
34
  if ( is_null( $this->settings['new_username'] ) && false === $this->settings['change_id'] ) {
35
  return;
36
  }
37
+
38
+ $result = itsec_change_admin_user( $this->settings['new_username'], $this->settings['change_id'] );
39
+
 
40
  if ( $result ) {
41
  $this->add_message( __( 'The user was successfully updated.', 'better-wp-security' ) );
42
  ITSEC_Response::set_show_default_success_message( false );
43
+
44
  ITSEC_Response::force_logout();
45
  } else {
46
  $this->set_can_save( false );
48
  ITSEC_Response::set_show_default_error_message( false );
49
  }
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
  ITSEC_Modules::register_validator( new ITSEC_Admin_User_Validator() );
core/modules/ban-users/Ban.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Users;
4
+
5
+ use iThemesSecurity\Actor\Actor;
6
+ use iThemesSecurity\Ban_Hosts\Repository_Ban;
7
+
8
+ final class Ban implements Repository_Ban {
9
+
10
+ /** @var int */
11
+ private $id;
12
+
13
+ /** @var string */
14
+ private $host;
15
+
16
+ /** @var \DateTimeImmutable|null */
17
+ private $created_at;
18
+
19
+ /** @var Actor|null */
20
+ private $created_by;
21
+
22
+ /** @var string */
23
+ private $comment;
24
+
25
+ /**
26
+ * Host constructor.
27
+ *
28
+ * @param string $host The host, can be given in CIDR notation.
29
+ * @param Actor|null $created_by The actor who created the ban.
30
+ * @param string $comment The comment providing context for the ban.
31
+ * @param \DateTimeImmutable|null $created_at The date the ban was created.
32
+ * @param int $id The ban's id.
33
+ */
34
+ public function __construct( $host, Actor $created_by = null, $comment = '', \DateTimeImmutable $created_at = null, $id = 0 ) {
35
+ $this->host = $host;
36
+ $this->created_by = $created_by;
37
+ $this->comment = $comment;
38
+ $this->created_at = $created_at ?: new \DateTimeImmutable( 'now', new \DateTimeZone( 'UTC' ) );
39
+ $this->id = $id;
40
+ }
41
+
42
+ public function get_id() {
43
+ return $this->id;
44
+ }
45
+
46
+ public function get_source() {
47
+ return 'database';
48
+ }
49
+
50
+ public function matches( $ip ) {
51
+ return \ITSEC_Lib_IP_Tools::intersect( $ip, $this->host );
52
+ }
53
+
54
+ public function get_created_at() {
55
+ return $this->created_at;
56
+ }
57
+
58
+ public function get_created_by() {
59
+ return $this->created_by;
60
+ }
61
+
62
+ public function get_comment() {
63
+ return $this->comment;
64
+ }
65
+
66
+ public function __toString() {
67
+ return $this->host;
68
+ }
69
+
70
+ /**
71
+ * Gets the banned host.
72
+ *
73
+ * @return string
74
+ */
75
+ public function get_host() {
76
+ return $this->host;
77
+ }
78
+ }
core/modules/ban-users/Database_Repository.php ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Users;
4
+
5
+ use iThemesSecurity\Actor\Multi_Actor_Factory;
6
+ use iThemesSecurity\Actor\User;
7
+ use iThemesSecurity\Ban_Hosts\Creatable;
8
+ use iThemesSecurity\Ban_Hosts\Deletable;
9
+ use iThemesSecurity\Ban_Hosts\Filters;
10
+ use iThemesSecurity\Ban_Hosts\Repository;
11
+ use iThemesSecurity\Ban_Hosts\Repository_Ban;
12
+ use iThemesSecurity\Ban_Hosts\Updatable;
13
+ use iThemesSecurity\Exception\WP_Error;
14
+
15
+ final class Database_Repository implements Repository, Creatable, Updatable, Deletable {
16
+ const CACHE_GROUP = 'itsec_database_bans';
17
+
18
+ /** @var Multi_Actor_Factory */
19
+ private $actor_factory;
20
+
21
+ /** @var \wpdb */
22
+ private $wpdb;
23
+
24
+ /** @var string[] */
25
+ private $ranges;
26
+
27
+ /**
28
+ * Database_Repository constructor.
29
+ *
30
+ * @param Multi_Actor_Factory $actor_factory
31
+ * @param \wpdb $wpdb
32
+ */
33
+ public function __construct( Multi_Actor_Factory $actor_factory, \wpdb $wpdb ) {
34
+ $this->actor_factory = $actor_factory;
35
+ $this->wpdb = $wpdb;
36
+ }
37
+
38
+ public function get_slug() {
39
+ return 'database';
40
+ }
41
+
42
+ public function get_bans( Filters $filters ) {
43
+ list( $where, $prepare ) = $this->build_where_clause( $filters );
44
+
45
+ $query = "SELECT * FROM {$this->wpdb->base_prefix}itsec_bans";
46
+
47
+ if ( $where ) {
48
+ $query .= ' WHERE ' . implode( ' AND ', $where );
49
+ }
50
+
51
+ $query .= ' ORDER BY created_at DESC, id DESC';
52
+
53
+ if ( $limit = $filters->get_limit() ) {
54
+ $query .= ' LIMIT ' . absint( $limit );
55
+ }
56
+
57
+ $prepared = $prepare ? $this->wpdb->prepare( $query, $prepare ) : $query;
58
+ $rows = $this->wpdb->get_results( $prepared, ARRAY_A );
59
+
60
+ if ( $this->wpdb->last_error ) {
61
+ throw new WP_Error( new \WP_Error(
62
+ 'itsec_get_bans_failed',
63
+ sprintf( __( 'Failed to get bans: %s', 'better-wp-security' ), $this->wpdb->last_error )
64
+ ) );
65
+ }
66
+
67
+ return array_map( [ $this, 'hydrate' ], $rows );
68
+ }
69
+
70
+ public function count_bans( Filters $filters ) {
71
+ list( $where, $prepare ) = $this->build_where_clause( $filters );
72
+
73
+ $query = "SELECT count(*) FROM {$this->wpdb->base_prefix}itsec_bans";
74
+
75
+ if ( $where ) {
76
+ $query .= ' WHERE ' . implode( ' AND ', $where );
77
+ }
78
+
79
+ $prepared = $prepare ? $this->wpdb->prepare( $query, $prepare ) : $query;
80
+
81
+ return (int) $this->wpdb->get_var( $prepared );
82
+ }
83
+
84
+ /**
85
+ * Builds the where clause based on the given filters.
86
+ *
87
+ * @param Filters $filters
88
+ *
89
+ * @return array
90
+ */
91
+ protected function build_where_clause( Filters $filters ) {
92
+ $where = [];
93
+ $prepare = [];
94
+
95
+ if ( ( $after_cursor = $filters->get_after_cursor() ) && $after_cursor->get_last_date() ) {
96
+ $where[] = '(created_at, id) > (%s, %d)';
97
+ $prepare[] = $after_cursor->get_last_date()->format( 'Y-m-d H:i:s' );
98
+ $prepare[] = $after_cursor->get_last_id();
99
+ }
100
+
101
+ if ( ( $before_cursor = $filters->get_before_cursor() ) && $before_cursor->get_last_date() ) {
102
+ $where[] = '(created_at, id) < (%s, %d)';
103
+ $prepare[] = $before_cursor->get_last_date()->format( 'Y-m-d H:i:s' );
104
+ $prepare[] = $before_cursor->get_last_id();
105
+ }
106
+
107
+ if ( $actor_type = $filters->get_actor_type() ) {
108
+ $where[] = 'actor_type = %s';
109
+ $prepare[] = $actor_type;
110
+ }
111
+
112
+ if ( $actor_id = $filters->get_actor_identifier() ) {
113
+ $where[] = 'actor_id = %s';
114
+ $prepare[] = $actor_id;
115
+ }
116
+
117
+ if ( $comment = $filters->get_search() ) {
118
+ $like = '%' . $this->wpdb->esc_like( $comment ) . '%';
119
+ $where[] = '( comment LIKE %s OR host LIKE %s )';
120
+ $prepare[] = $like;
121
+ $prepare[] = $like;
122
+ }
123
+
124
+ if ( $created_after = $filters->get_created_after() ) {
125
+ $where[] = 'created_at > %s';
126
+ $prepare[] = $created_after->format( 'Y-m-d H:i:s' );
127
+ }
128
+
129
+ if ( $created_before = $filters->get_created_before() ) {
130
+ $where[] = 'created_at < %s';
131
+ $prepare[] = $created_before->format( 'Y-m-d H:i:s' );
132
+ }
133
+
134
+ return [ $where, $prepare ];
135
+ }
136
+
137
+ public function get_supported_filters() {
138
+ return [
139
+ Filters::ACTOR_TYPE,
140
+ Filters::ACTOR_IDENTIFIER,
141
+ Filters::SEARCH,
142
+ Filters::CREATED_AFTER,
143
+ Filters::CREATED_BEFORE,
144
+ ];
145
+ }
146
+
147
+ public function find_ban_for_host( $host ) {
148
+ $row = $this->wpdb->get_row( $this->wpdb->prepare(
149
+ "SELECT * FROM {$this->wpdb->base_prefix}itsec_bans WHERE host = %s",
150
+ $host
151
+ ), ARRAY_A );
152
+
153
+ if ( $row && ( $ban = $this->hydrate( $row ) ) && $ban->matches( $host ) ) {
154
+ return $ban;
155
+ }
156
+
157
+ $ranges = $this->get_ranges();
158
+
159
+ foreach ( $ranges as $id => $range ) {
160
+ if ( \ITSEC_Lib_IP_Tools::intersect( $host, $range ) ) {
161
+ $ban = $this->get( $id );
162
+
163
+ if ( $ban && $ban->matches( $host ) ) {
164
+ return $ban;
165
+ }
166
+ }
167
+ }
168
+
169
+ return null;
170
+ }
171
+
172
+ public function get( $id ) {
173
+ if ( ! $row = wp_cache_get( $id, self::CACHE_GROUP ) ) {
174
+ $row = $this->wpdb->get_row( $this->wpdb->prepare(
175
+ "SELECT * FROM {$this->wpdb->base_prefix}itsec_bans WHERE id = %d",
176
+ $id
177
+ ), ARRAY_A );
178
+
179
+ if ( $row ) {
180
+ wp_cache_set( $id, $row, self::CACHE_GROUP );
181
+ }
182
+ }
183
+
184
+ if ( ! $row ) {
185
+ return null;
186
+ }
187
+
188
+ return $this->hydrate( $row );
189
+ }
190
+
191
+ public function get_creation_schema() {
192
+ return [
193
+ 'type' => 'object',
194
+ 'title' => __( 'Manually Ban', 'better-wp-security' ),
195
+ 'required' => [ 'host' ],
196
+ 'properties' => [
197
+ 'host' => [
198
+ 'type' => 'string',
199
+ 'title' => __( 'Host', 'better-wp-security' ),
200
+ 'description' => __( 'The IP address to ban.', 'better-wp-security' ),
201
+ 'arg_options' => [
202
+ 'validate_callback' => 'ITSEC_Lib_REST::validate_ip',
203
+ 'sanitize_callback' => 'ITSEC_Lib_REST::sanitize_ip',
204
+ ],
205
+ ],
206
+ 'created_by' => [
207
+ 'title' => __( 'Created By', 'better-wp-security' ),
208
+ 'type' => 'object',
209
+ 'required' => [ 'type', 'id' ],
210
+ 'properties' => [
211
+ 'type' => [
212
+ 'type' => 'string',
213
+ 'enum' => \ITSEC_Lib::pluck( $this->actor_factory->get_supported_factories(), 'get_slug' ),
214
+ 'description' => __( 'The type of the actor.', 'better-wp-security' ),
215
+ ],
216
+ 'id' => [
217
+ 'type' => 'string',
218
+ 'description' => __( 'The identifier for the actor.', 'better-wp-security' ),
219
+ ],
220
+ ],
221
+ 'description' => __( 'The actor who added the ban.', 'better-wp-security' ),
222
+ ],
223
+ 'comment' => [
224
+ 'type' => 'string',
225
+ 'maxLength' => 255,
226
+ 'title' => __( 'Notes', 'better-wp-security' ),
227
+ 'description' => __( 'A comment describing the ban.', 'better-wp-security' ),
228
+ ]
229
+ ],
230
+ 'uiSchema' => [
231
+ 'created_by' => [
232
+ 'ui:widget' => 'hidden',
233
+ ],
234
+ 'comment' => [
235
+ 'ui:widget' => 'textarea',
236
+ 'ui:options' => [
237
+ 'rows' => 4,
238
+ ],
239
+ ],
240
+ ],
241
+ ];
242
+ }
243
+
244
+ public function get_update_schema() {
245
+ return [
246
+ 'type' => 'object',
247
+ 'title' => __( 'Update Ban', 'better-wp-security' ),
248
+ 'properties' => [
249
+ 'comment' => [
250
+ 'type' => 'string',
251
+ 'maxLength' => 255,
252
+ 'title' => __( 'Notes', 'better-wp-security' ),
253
+ 'description' => __( 'A comment describing the ban.', 'better-wp-security' ),
254
+ ]
255
+ ],
256
+ 'uiSchema' => [
257
+ 'comment' => [
258
+ 'ui:widget' => 'textarea',
259
+ 'ui:options' => [
260
+ 'rows' => 4,
261
+ ],
262
+ ],
263
+ ],
264
+ ];
265
+ }
266
+
267
+ public function fill( array $data, Repository_Ban $ban = null ) {
268
+ if ( $ban ) {
269
+ if ( ! $ban instanceof Ban ) {
270
+ throw new \BadMethodCallException( __( 'The "database" repository only accepts Ban instances.', 'better-wp-security' ) );
271
+ }
272
+
273
+ return new Ban(
274
+ $ban->get_host(),
275
+ $ban->get_created_by(),
276
+ isset( $data['comment'] ) ? $data['comment'] : $ban->get_comment(),
277
+ $ban->get_created_at(),
278
+ $ban->get_id()
279
+ );
280
+ }
281
+
282
+ if ( isset( $data['created_by'] ) ) {
283
+ $actor = $this->actor_factory->make( $data['created_by']['type'], $data['created_by']['id'] );
284
+ } elseif ( is_user_logged_in() ) {
285
+ $actor = new User( wp_get_current_user() );
286
+ } else {
287
+ $actor = null;
288
+ }
289
+
290
+ $comment = isset( $data['comment'] ) ? $data['comment'] : '';
291
+
292
+ return new Ban( $data['host'], $actor, $comment );
293
+ }
294
+
295
+ public function persist( Repository_Ban $ban ) {
296
+ if ( ! $ban instanceof Ban ) {
297
+ throw new \BadMethodCallException( __( 'The "database" repository only accepts Host instances.', 'better-wp-security' ) );
298
+ }
299
+
300
+ if ( ! $ban->get_id() ) {
301
+ if ( \ITSEC_Lib::is_ip_whitelisted( $ban->get_host() ) ) {
302
+ throw new WP_Error( new \WP_Error(
303
+ 'itsec_cannot_ban_authorized_host',
304
+ __( 'Cannot ban an authorized host.', 'better-wp-security' )
305
+ ) );
306
+ }
307
+
308
+ $record = [
309
+ 'host' => $ban->get_host(),
310
+ 'created_at' => $ban->get_created_at()->format( 'Y-m-d H:i:s' ),
311
+ 'comment' => $ban->get_comment(),
312
+ 'type' => \ITSEC_Lib_IP_Tools::is_range( $ban->get_host() ) ? 'range' : 'ip',
313
+ ];
314
+
315
+ if ( $actor = $ban->get_created_by() ) {
316
+ $record['actor_type'] = $actor->get_type();
317
+ $record['actor_id'] = $actor->get_identifier();
318
+ }
319
+
320
+ $suppress = $this->wpdb->suppress_errors();
321
+ $r = $this->wpdb->insert( $this->wpdb->base_prefix . 'itsec_bans', $record );
322
+ $id = $this->wpdb->insert_id;
323
+ $this->wpdb->suppress_errors( $suppress );
324
+ } else {
325
+ $r = $this->wpdb->update( $this->wpdb->base_prefix . 'itsec_bans', [
326
+ 'comment' => $ban->get_comment()
327
+ ], [ 'id' => $ban->get_id() ] );
328
+ $id = $ban->get_id();
329
+ wp_cache_delete( $ban->get_id(), self::CACHE_GROUP );
330
+ }
331
+
332
+ if ( false === $r ) {
333
+ if ( false !== stripos( $this->wpdb->last_error, 'Duplicate entry' ) ) {
334
+ throw new WP_Error( new \WP_Error(
335
+ 'itsec_duplicate_ban',
336
+ __( 'This IP address is already banned.', 'better-wp-security' )
337
+ ) );
338
+ }
339
+
340
+ throw new WP_Error( new \WP_Error(
341
+ 'itsec_save_ban_failed',
342
+ sprintf( __( 'Failed to save the ban: %s', 'better-wp-security' ), $this->wpdb->last_error )
343
+ ) );
344
+ }
345
+
346
+ if ( ! $ban->get_id() && \ITSEC_Lib_IP_Tools::is_range( $ban->get_host() ) ) {
347
+ wp_cache_delete( 'ranges', self::CACHE_GROUP );
348
+ $this->ranges = null;
349
+ }
350
+
351
+ return $this->get( $id );
352
+ }
353
+
354
+ public function delete( Repository_Ban $ban ) {
355
+ $r = $this->wpdb->delete( $this->wpdb->base_prefix . 'itsec_bans', [
356
+ 'id' => $ban->get_id(),
357
+ ] );
358
+
359
+ if ( false === $r ) {
360
+ throw new WP_Error( new \WP_Error(
361
+ 'itsec_delete_ban_failed',
362
+ sprintf( __( 'Failed to delete the ban: %s', 'better-wp-security' ), $this->wpdb->last_error )
363
+ ) );
364
+ }
365
+
366
+ wp_cache_delete( $ban->get_id(), self::CACHE_GROUP );
367
+ }
368
+
369
+ /**
370
+ * Gets the raw list of all banned IP addresses.
371
+ *
372
+ * @internal This should almost never be used. It exists to polyfill data for legacy APIs.
373
+ *
374
+ * @return string[]
375
+ */
376
+ public function get_legacy_hosts() {
377
+ $tn = $this->wpdb->base_prefix . 'itsec_bans';
378
+ $rows = $this->wpdb->get_results( "SELECT `id`, `host` FROM {$tn}" );
379
+
380
+ return wp_list_pluck( $rows, 'host', 'id' );
381
+ }
382
+
383
+ /**
384
+ * Hydrates a row from the database to a Ban object.
385
+ *
386
+ * @param array $row
387
+ *
388
+ * @return Ban
389
+ */
390
+ protected function hydrate( $row ) {
391
+ $actor = $this->actor_factory->make( $row['actor_type'], $row['actor_id'] );
392
+ $created_at = null;
393
+
394
+ if ( $row['created_at'] ) {
395
+ try {
396
+ $created_at = new \DateTimeImmutable( $row['created_at'], new \DateTimeZone( 'UTC' ) );
397
+ } catch ( \Exception $e ) {
398
+ }
399
+ }
400
+
401
+ return new Ban( $row['host'], $actor, $row['comment'], $created_at, (int) $row['id'] );
402
+ }
403
+
404
+ /**
405
+ * Gets the list of IP ranges that are banned.
406
+ *
407
+ * @return string[]
408
+ */
409
+ protected function get_ranges() {
410
+ if ( ! is_array( $this->ranges ) ) {
411
+ $rows = wp_cache_get( 'ranges', self::CACHE_GROUP );
412
+
413
+ if ( ! is_array( $rows ) ) {
414
+ $rows = $this->wpdb->get_results( "SELECT `id`, `host` FROM {$this->wpdb->base_prefix}itsec_bans WHERE `type` = 'range'", ARRAY_A );
415
+ if ( is_array( $rows ) ) {
416
+ wp_cache_set( 'ranges', $rows, self::CACHE_GROUP );
417
+ }
418
+ }
419
+
420
+ $this->ranges = wp_list_pluck( $rows, 'host', 'id' );
421
+ }
422
+
423
+ return $this->ranges;
424
+ }
425
+ }
core/modules/ban-users/Module/Validator.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Users;
4
+
5
+ use iThemesSecurity\Actor\User;
6
+ use iThemesSecurity\Ban_Users\Ban;
7
+ use iThemesSecurity\Contracts\Runnable;
8
+
9
+ class Validator extends \ITSEC_Validator implements Runnable {
10
+
11
+ /** @var Database_Repository */
12
+ private $repository;
13
+
14
+ /**
15
+ * ITSEC_Ban_Users_Validator constructor.
16
+ *
17
+ * @param Database_Repository $repository
18
+ */
19
+ public function __construct( Database_Repository $repository ) {
20
+ $this->repository = $repository;
21
+
22
+ parent::__construct();
23
+ }
24
+
25
+ public function run() {
26
+ \ITSEC_Modules::register_validator( $this );
27
+ }
28
+
29
+ public function get_id() {
30
+ return 'ban-users';
31
+ }
32
+
33
+ protected function sanitize_settings() {
34
+ $this->vars_to_skip_validate_matching_fields[] = 'host_list';
35
+
36
+ $this->sanitize_setting( 'bool', 'default', __( 'Default Ban List', 'better-wp-security' ) );
37
+ $this->sanitize_setting( 'bool', 'enable_ban_lists', __( 'Ban Lists', 'better-wp-security' ) );
38
+ $this->sanitize_setting( 'positive-int', 'server_config_limit', __( 'Limit Banned IPs in Server Config', 'better-wp-security' ) );
39
+
40
+ if ( isset( $this->settings['host_list'] ) && is_array( $this->settings['host_list'] ) ) {
41
+ $this->sanitize_setting( 'newline-separated-ips', 'host_list', __( 'Ban Hosts', 'better-wp-security' ) );
42
+ require_once( \ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php' );
43
+
44
+ $whitelisted_hosts = array();
45
+ $current_ip = \ITSEC_Lib::get_ip();
46
+
47
+ foreach ( $this->settings['host_list'] as $host ) {
48
+ if ( is_user_logged_in() && \ITSEC_Lib_IP_Tools::intersect( $current_ip, \ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $host ) ) ) {
49
+ $this->set_can_save( false );
50
+
51
+ /* translators: 1: input name, 2: invalid host */
52
+ $this->add_error( sprintf( __( 'The following host in %1$s matches your current IP and cannot be banned: %2$s', 'better-wp-security' ), __( 'Ban Hosts', 'better-wp-security' ), $host ) );
53
+
54
+ continue;
55
+ }
56
+
57
+ if ( \ITSEC_Lib::is_ip_whitelisted( $host ) ) {
58
+ $whitelisted_hosts[] = $host;
59
+ }
60
+ }
61
+
62
+ if ( ! empty( $whitelisted_hosts ) ) {
63
+ $this->set_can_save( false );
64
+
65
+ /* translators: 1: input name, 2: invalid host list */
66
+ $this->add_error( wp_sprintf( _n( 'The following IP in %1$s is on the authorized hosts list and cannot be banned: %2$l', 'The following IPs in %1$s are on the authorized hosts list and cannot be banned: %2$l', count( $whitelisted_hosts ), 'better-wp-security' ), __( 'Ban Hosts', 'better-wp-security' ), $whitelisted_hosts ) );
67
+ }
68
+ }
69
+
70
+ $this->sanitize_setting( array( $this, 'sanitize_agent_list_entry' ), 'agent_list', __( 'Ban User Agents', 'better-wp-security' ) );
71
+ }
72
+
73
+ protected function sanitize_agent_list_entry( $entry ) {
74
+ return trim( sanitize_text_field( $entry ) );
75
+ }
76
+
77
+ protected function validate_settings() {
78
+ if ( ! $this->can_save() ) {
79
+ return;
80
+ }
81
+
82
+ if ( isset( $this->settings['host_list'] ) ) {
83
+ $this->sync_host_list( $this->settings['host_list'] );
84
+ unset( $this->settings['host_list'] );
85
+ }
86
+
87
+ if ( ! \ITSEC_Core::is_interactive() ) {
88
+ return;
89
+ }
90
+
91
+ $previous_settings = \ITSEC_Modules::get_settings( $this->get_id() );
92
+
93
+ foreach ( $this->settings as $key => $val ) {
94
+ if ( ! isset( $previous_settings[ $key ] ) || $previous_settings[ $key ] !== $val ) {
95
+ \ITSEC_Response::regenerate_server_config();
96
+ break;
97
+ }
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Syncs the list of hosts to the Database Repository.
103
+ *
104
+ * @param string[] $new_hosts List of IP addresses.
105
+ */
106
+ protected function sync_host_list( $new_hosts ) {
107
+ $old_hosts = $this->repository->get_legacy_hosts();
108
+
109
+ foreach ( $old_hosts as $id => $host ) {
110
+ if ( in_array( $host, $new_hosts, true ) ) {
111
+ continue;
112
+ }
113
+
114
+ $this->delete_host( $id );
115
+ }
116
+
117
+ foreach ( $new_hosts as $host ) {
118
+ if ( in_array( $host, $old_hosts, true ) ) {
119
+ continue;
120
+ }
121
+
122
+ $this->add_host( $host );
123
+ }
124
+ }
125
+
126
+ protected function delete_host( $id ) {
127
+ if ( ! $ban = $this->repository->get( (int) $id ) ) {
128
+ return;
129
+ }
130
+
131
+ try {
132
+ $this->repository->delete( $ban );
133
+ } catch ( \iThemesSecurity\Exception\WP_Error $e ) {
134
+ $this->add_error( $e->get_error() );
135
+ }
136
+ }
137
+
138
+ protected function add_host( $host ) {
139
+ $actor = null;
140
+ $comment = '';
141
+
142
+ if ( is_user_logged_in() ) {
143
+ $actor = new User( wp_get_current_user() );
144
+ } elseif ( defined( 'WP_CLI' ) && WP_CLI ) {
145
+ $comment = __( 'Added via WP CLI', 'better-wp-security' );
146
+ }
147
+
148
+ try {
149
+ $this->repository->persist( new Ban( $host, $actor, $comment ) );
150
+ } catch ( \iThemesSecurity\Exception\WP_Error $e ) {
151
+ $this->add_error( $e->get_error() );
152
+ }
153
+ }
154
+ }
core/modules/ban-users/Module/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/modules/ban-users/class-itsec-ban-users.php CHANGED
@@ -2,116 +2,147 @@
2
 
3
  class ITSEC_Ban_Users {
4
  private static $instance = false;
5
-
6
  private $hooks_added = false;
7
-
8
-
9
  private function __construct() {
10
  $this->init();
11
  }
12
-
13
  public static function get_instance() {
14
  if ( ! self::$instance ) {
15
  self::$instance = new self;
16
  }
17
-
18
  return self::$instance;
19
  }
20
-
21
  public static function activate() {
22
  $self = self::get_instance();
23
-
24
  $self->add_hooks();
25
  ITSEC_Response::regenerate_server_config();
26
  }
27
-
28
  public static function deactivate() {
29
  $self = self::get_instance();
30
-
31
  $self->remove_hooks();
32
  ITSEC_Response::regenerate_server_config();
33
  }
34
-
35
  public function add_hooks() {
36
  if ( $this->hooks_added ) {
37
  return;
38
  }
39
-
40
- add_filter( 'itsec_filter_blacklisted_ips', array( $this, 'filter_blacklisted_ips' ) );
41
-
42
  add_filter( 'itsec_filter_apache_server_config_modification', array( $this, 'filter_apache_server_config_modification' ) );
43
  add_filter( 'itsec_filter_nginx_server_config_modification', array( $this, 'filter_nginx_server_config_modification' ) );
44
  add_filter( 'itsec_filter_litespeed_server_config_modification', array( $this, 'filter_litespeed_server_config_modification' ) );
45
-
 
46
  $this->hooks_added = true;
47
  }
48
-
49
  public function remove_hooks() {
50
- remove_filter( 'itsec_filter_blacklisted_ips', array( $this, 'filter_blacklisted_ips' ) );
51
-
52
  remove_filter( 'itsec_filter_apache_server_config_modification', array( $this, 'filter_apache_server_config_modification' ) );
53
  remove_filter( 'itsec_filter_nginx_server_config_modification', array( $this, 'filter_nginx_server_config_modification' ) );
54
  remove_filter( 'itsec_filter_litespeed_server_config_modification', array( $this, 'filter_litespeed_server_config_modification' ) );
55
-
 
56
  $this->hooks_added = false;
57
  }
58
-
59
  public function init() {
60
  $this->add_hooks();
61
  }
62
-
63
  public function filter_blacklisted_ips( $blacklisted_ips ) {
 
 
64
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
65
  $blacklisted_ips = array_merge( $blacklisted_ips, ITSEC_Modules::get_setting( 'ban-users', 'host_list', array() ) );
66
  }
67
-
68
  return $blacklisted_ips;
69
  }
70
-
71
  public function filter_apache_server_config_modification( $modification ) {
72
  require_once( dirname( __FILE__ ) . '/config-generators.php' );
73
-
74
  if ( ITSEC_Modules::get_setting( 'ban-users', 'default' ) ) {
75
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_default_blacklist_rules( 'apache' );
76
  }
77
-
78
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
79
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_hosts_rules( 'apache' );
80
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_user_agents_rules( 'apache' );
81
  }
82
-
83
  return $modification;
84
  }
85
-
86
  public function filter_nginx_server_config_modification( $modification ) {
87
  require_once( dirname( __FILE__ ) . '/config-generators.php' );
88
-
89
  if ( ITSEC_Modules::get_setting( 'ban-users', 'default' ) ) {
90
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_default_blacklist_rules( 'nginx' );
91
  }
92
-
93
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
94
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_hosts_rules( 'nginx' );
95
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_user_agents_rules( 'nginx' );
96
  }
97
-
98
  return $modification;
99
  }
100
-
101
  public function filter_litespeed_server_config_modification( $modification ) {
102
  require_once( dirname( __FILE__ ) . '/config-generators.php' );
103
-
104
  if ( ITSEC_Modules::get_setting( 'ban-users', 'default' ) ) {
105
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_default_blacklist_rules( 'litespeed' );
106
  }
107
-
108
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
109
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_hosts_rules( 'litespeed' );
110
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_user_agents_rules( 'litespeed' );
111
  }
112
-
113
  return $modification;
114
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
 
117
 
2
 
3
  class ITSEC_Ban_Users {
4
  private static $instance = false;
5
+
6
  private $hooks_added = false;
7
+
8
+
9
  private function __construct() {
10
  $this->init();
11
  }
12
+
13
  public static function get_instance() {
14
  if ( ! self::$instance ) {
15
  self::$instance = new self;
16
  }
17
+
18
  return self::$instance;
19
  }
20
+
21
  public static function activate() {
22
  $self = self::get_instance();
23
+
24
  $self->add_hooks();
25
  ITSEC_Response::regenerate_server_config();
26
  }
27
+
28
  public static function deactivate() {
29
  $self = self::get_instance();
30
+
31
  $self->remove_hooks();
32
  ITSEC_Response::regenerate_server_config();
33
  }
34
+
35
  public function add_hooks() {
36
  if ( $this->hooks_added ) {
37
  return;
38
  }
39
+
 
 
40
  add_filter( 'itsec_filter_apache_server_config_modification', array( $this, 'filter_apache_server_config_modification' ) );
41
  add_filter( 'itsec_filter_nginx_server_config_modification', array( $this, 'filter_nginx_server_config_modification' ) );
42
  add_filter( 'itsec_filter_litespeed_server_config_modification', array( $this, 'filter_litespeed_server_config_modification' ) );
43
+ add_filter( 'itsec_rest_prepare_ban_for_response', [ $this, 'prepare_ban_for_response' ], 10, 2 );
44
+
45
  $this->hooks_added = true;
46
  }
47
+
48
  public function remove_hooks() {
 
 
49
  remove_filter( 'itsec_filter_apache_server_config_modification', array( $this, 'filter_apache_server_config_modification' ) );
50
  remove_filter( 'itsec_filter_nginx_server_config_modification', array( $this, 'filter_nginx_server_config_modification' ) );
51
  remove_filter( 'itsec_filter_litespeed_server_config_modification', array( $this, 'filter_litespeed_server_config_modification' ) );
52
+ remove_filter( 'itsec_rest_prepare_ban_for_response', [ $this, 'prepare_ban_for_response' ] );
53
+
54
  $this->hooks_added = false;
55
  }
56
+
57
  public function init() {
58
  $this->add_hooks();
59
  }
60
+
61
  public function filter_blacklisted_ips( $blacklisted_ips ) {
62
+ _deprecated_function( __METHOD__, '6.7.0' );
63
+
64
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
65
  $blacklisted_ips = array_merge( $blacklisted_ips, ITSEC_Modules::get_setting( 'ban-users', 'host_list', array() ) );
66
  }
67
+
68
  return $blacklisted_ips;
69
  }
70
+
71
  public function filter_apache_server_config_modification( $modification ) {
72
  require_once( dirname( __FILE__ ) . '/config-generators.php' );
73
+
74
  if ( ITSEC_Modules::get_setting( 'ban-users', 'default' ) ) {
75
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_default_blacklist_rules( 'apache' );
76
  }
77
+
78
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
79
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_hosts_rules( 'apache' );
80
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_user_agents_rules( 'apache' );
81
  }
82
+
83
  return $modification;
84
  }
85
+
86
  public function filter_nginx_server_config_modification( $modification ) {
87
  require_once( dirname( __FILE__ ) . '/config-generators.php' );
88
+
89
  if ( ITSEC_Modules::get_setting( 'ban-users', 'default' ) ) {
90
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_default_blacklist_rules( 'nginx' );
91
  }
92
+
93
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
94
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_hosts_rules( 'nginx' );
95
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_user_agents_rules( 'nginx' );
96
  }
97
+
98
  return $modification;
99
  }
100
+
101
  public function filter_litespeed_server_config_modification( $modification ) {
102
  require_once( dirname( __FILE__ ) . '/config-generators.php' );
103
+
104
  if ( ITSEC_Modules::get_setting( 'ban-users', 'default' ) ) {
105
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_default_blacklist_rules( 'litespeed' );
106
  }
107
+
108
  if ( ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
109
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_hosts_rules( 'litespeed' );
110
  $modification .= ITSEC_Ban_Users_Config_Generators::get_server_config_ban_user_agents_rules( 'litespeed' );
111
  }
112
+
113
  return $modification;
114
  }
115
+
116
+ /**
117
+ * Modifies the ban response to include links to the logs page.
118
+ *
119
+ * @param WP_REST_Response $response
120
+ * @param \iThemesSecurity\Ban_Hosts\Repository_Ban $ban
121
+ *
122
+ * @return WP_REST_Response
123
+ */
124
+ public function prepare_ban_for_response( $response, $ban ) {
125
+ if ( ! $ban instanceof \iThemesSecurity\Ban_Users\Ban ) {
126
+ return $response;
127
+ }
128
+
129
+ if ( ITSEC_Modules::get_setting( 'global', 'log_type' ) === 'file' ) {
130
+ return $response;
131
+ }
132
+
133
+ if ( ITSEC_Lib_IP_Tools::is_range( $ban->get_host() ) ) {
134
+ return $response;
135
+ }
136
+
137
+ if ( ITSEC_Core::current_user_can_manage() ) {
138
+ $response->add_link( 'related', ITSEC_Core::get_logs_page_url( [ 'remote_ip' => $ban->get_host(), 'type' => 'all' ] ), [
139
+ 'media' => 'text/html',
140
+ 'title' => __( 'View Activity', 'better-wp-security' ),
141
+ ] );
142
+ }
143
+
144
+ return $response;
145
+ }
146
  }
147
 
148
 
core/modules/ban-users/config-generators.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php
2
 
 
 
 
3
  final class ITSEC_Ban_Users_Config_Generators {
4
  public static function get_server_config_default_blacklist_rules( $server_type ) {
5
  $rules = '';
@@ -24,18 +27,18 @@ final class ITSEC_Ban_Users_Config_Generators {
24
  }
25
 
26
  public static function get_server_config_ban_hosts_rules( $server_type ) {
27
- $host_list = ITSEC_Modules::get_setting( 'ban-users', 'host_list', array() );
28
-
29
- if ( ! is_array( $host_list ) || empty( $host_list ) ) {
30
- return '';
31
- }
32
-
33
  /**
34
  * Filters the maximum number of IPs to include in the server config file.
35
  *
36
  * @param int $max_hosts The maximum IPs. Defaults to 100.
37
  */
38
- $max_hosts = apply_filters( 'itsec_ban_users_max_hosts_for_server_config', 100 );
 
 
 
 
 
 
39
 
40
  $hosts = array_slice( $host_list, -$max_hosts, $max_hosts );
41
 
1
  <?php
2
 
3
+ use iThemesSecurity\Ban_Users\Database_Repository;
4
+ use \iThemesSecurity\Ban_Hosts\Filters;
5
+
6
  final class ITSEC_Ban_Users_Config_Generators {
7
  public static function get_server_config_default_blacklist_rules( $server_type ) {
8
  $rules = '';
27
  }
28
 
29
  public static function get_server_config_ban_hosts_rules( $server_type ) {
 
 
 
 
 
 
30
  /**
31
  * Filters the maximum number of IPs to include in the server config file.
32
  *
33
  * @param int $max_hosts The maximum IPs. Defaults to 100.
34
  */
35
+ $max_hosts = apply_filters( 'itsec_ban_users_max_hosts_for_server_config', ITSEC_Modules::get_setting( 'ban-users', 'server_config_limit' ) );
36
+
37
+ $host_list = ITSEC_Modules::get_container()->get( Database_Repository::class )->get_bans( ( new Filters() )->with_limit( $max_hosts ) );
38
+
39
+ if ( ! $host_list ) {
40
+ return '';
41
+ }
42
 
43
  $hosts = array_slice( $host_list, -$max_hosts, $max_hosts );
44
 
core/modules/ban-users/container.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace iThemesSecurity\Ban_Users;
4
+
5
+ use iThemesSecurity\Actor\Multi_Actor_Factory;
6
+ use Pimple\Container;
7
+ use Pimple\Exception\FrozenServiceException;
8
+
9
+ return static function ( Container $c ) {
10
+ $c['module.ban-users.files'] = [
11
+ 'validator.php' => Validator::class,
12
+ ];
13
+
14
+ try {
15
+ $c->extend( 'ban-hosts.repositories', static function ( $repositories ) {
16
+ if ( \ITSEC_Modules::get_setting( 'ban-users', 'enable_ban_lists' ) ) {
17
+ $repositories[] = Database_Repository::class;
18
+ }
19
+
20
+ return $repositories;
21
+ } );
22
+ } catch ( FrozenServiceException $e ) {
23
+
24
+ }
25
+
26
+ $c[ Validator::class ] = static function ( Container $c ) {
27
+ return new Validator( $c[ Database_Repository::class ] );
28
+ };
29
+
30
+ $c[ Database_Repository::class ] = static function ( Container $c ) {
31
+ return new Database_Repository(
32
+ $c[ Multi_Actor_Factory::class ],
33
+ $c[ \wpdb::class ]
34
+ );
35
+ };
36
+
37
+ };
core/modules/ban-users/init.php CHANGED
@@ -1,14 +1,32 @@
1
  <?php
2
 
3
- function itsec_ban_users_handle_new_blacklisted_ip( $ip ) {
4
- $host_list = ITSEC_Modules::get_setting( 'ban-users', 'host_list', array() );
 
 
5
 
6
- if ( ! is_array( $host_list ) ) {
7
- $host_list = array();
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
9
 
10
- $host_list[] = $ip;
11
 
12
- ITSEC_Modules::set_setting( 'ban-users', 'host_list', $host_list );
 
 
 
13
  }
14
- add_action( 'itsec-new-blacklisted-ip', 'itsec_ban_users_handle_new_blacklisted_ip' );
 
1
  <?php
2
 
3
+ use iThemesSecurity\Actor\Lockout_Module;
4
+ use iThemesSecurity\Ban_Users\Ban;
5
+ use iThemesSecurity\Ban_Users\Database_Repository;
6
+ use iThemesSecurity\Lib\Lockout\Context;
7
 
8
+ /**
9
+ * Listens to the new banned IP hook and persists the IP to the module's settings.
10
+ *
11
+ * @param string $ip The IP address.
12
+ * @param Context $context The lockout context.
13
+ */
14
+ function itsec_ban_users_handle_new_banned_ip( $ip, $context = null ) {
15
+ ITSEC_Modules::load_module_file( 'labels.php' );
16
+ $repository = ITSEC_Modules::get_container()->get( Database_Repository::class );
17
+
18
+ if ( $context instanceof Context && $lockout = $context->get_lockout_module() ) {
19
+ $actor = new Lockout_Module( $lockout );
20
+ } else {
21
+ $actor = null;
22
  }
23
 
24
+ $ban = new Ban( $ip, $actor );
25
 
26
+ try {
27
+ $repository->persist( $ban );
28
+ } catch ( \iThemesSecurity\Exception\WP_Error $e ) {
29
+ }
30
  }
31
+
32
+ add_action( 'itsec_new_banned_ip', 'itsec_ban_users_handle_new_banned_ip', 10, 2 );
core/modules/ban-users/settings-page.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
 
3
- final class ITSEC_Ban_Users_Settings_Page extends ITSEC_Module_Settings_Page {
4
- private $script_version = 1;
5
 
 
6
 
7
  public function __construct() {
8
  $this->id = 'ban-users';
@@ -22,6 +22,8 @@ final class ITSEC_Ban_Users_Settings_Page extends ITSEC_Module_Settings_Page {
22
  }
23
 
24
  protected function render_settings( $form ) {
 
 
25
 
26
  ?>
27
  <table class="form-table itsec-settings-section">
@@ -60,6 +62,14 @@ final class ITSEC_Ban_Users_Settings_Page extends ITSEC_Module_Settings_Page {
60
  <p><a href="<?php echo esc_url( ITSEC_Lib::get_trace_ip_link() ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Lookup IP Address.', 'better-wp-security' ); ?></a></p>
61
  </td>
62
  </tr>
 
 
 
 
 
 
 
 
63
  <tr class="itsec-ban-users-enable_ban_lists-content">
64
  <th scope="row"><label for="itsec-ban-users-agent_list"><?php _e( 'Ban User Agents', 'better-wp-security' ); ?></label></th>
65
  <td>
1
  <?php
2
 
3
+ use iThemesSecurity\Ban_Users\Database_Repository;
 
4
 
5
+ final class ITSEC_Ban_Users_Settings_Page extends ITSEC_Module_Settings_Page {
6
 
7
  public function __construct() {
8
  $this->id = 'ban-users';
22
  }
23
 
24
  protected function render_settings( $form ) {
25
+ $hosts = ITSEC_Modules::get_container()->get( Database_Repository::class )->get_legacy_hosts();
26
+ $form->set_option( 'host_list', $hosts );
27
 
28
  ?>
29
  <table class="form-table itsec-settings-section">
62
  <p><a href="<?php echo esc_url( ITSEC_Lib::get_trace_ip_link() ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Lookup IP Address.', 'better-wp-security' ); ?></a></p>
63
  </td>
64
  </tr>
65
+ <tr class="itsec-ban-users-enable_ban_lists-content">
66
+ <th scope="row"><label for="itsec-ban-users-server_config_limit"><?php esc_html_e( 'Limit Banned IPs in Server Configuration Files', 'better-wp-security'); ?></label></th>
67
+ <td>
68
+ <?php $form->add_html5_input( 'server_config_limit', 'number', [ 'min' => 0, 'max' => 9999, 'step' => 1 ] ); ?>
69
+ <p><?php esc_html_e( 'Limiting the number of IPs blocked by the Server Configuration Files (.htaccess and nginx.conf) will help reduce the risk of a server timeout when updating the configuration file.', 'better-wp-security' ); ?></p>
70
+ <p><?php esc_html_e( 'If the number of IPs in the banned list exceeds the Server Configuration File limit, the additional IPs will be blocked using PHP. Blocking IPs at the server level is more efficient than blocking IPs at the application level using PHP.', 'better-wp-security' ); ?></p>
71
+ </td>
72
+ </tr>
73
  <tr class="itsec-ban-users-enable_ban_lists-content">
74
  <th scope="row"><label for="itsec-ban-users-agent_list"><?php _e( 'Ban User Agents', 'better-wp-security' ); ?></label></th>
75
  <td>
core/modules/ban-users/settings.php CHANGED
@@ -1,16 +1,26 @@
1
  <?php
2
 
 
 
3
  final class ITSEC_Ban_Users_Settings extends ITSEC_Settings {
4
  public function get_id() {
5
  return 'ban-users';
6
  }
7
 
 
 
 
 
 
 
 
 
8
  public function get_defaults() {
9
  return array(
10
- 'default' => false,
11
- 'enable_ban_lists' => true,
12
- 'host_list' => array(),
13
- 'agent_list' => array(),
14
  );
15
  }
16
  }
1
  <?php
2
 
3
+ use iThemesSecurity\Ban_Users\Database_Repository;
4
+
5
  final class ITSEC_Ban_Users_Settings extends ITSEC_Settings {
6
  public function get_id() {
7
  return 'ban-users';
8
  }
9
 
10
+ public function get( $name, $default = null ) {
11
+ if ( $name === 'host_list' ) {
12
+ return ITSEC_Modules::get_container()->get( Database_Repository::class )->get_legacy_hosts();
13
+ }
14
+
15
+ return parent::get( $name, $default );
16
+ }
17
+
18
  public function get_defaults() {
19
  return array(
20
+ 'default' => false,
21
+ 'enable_ban_lists' => true,
22
+ 'agent_list' => array(),
23
+ 'server_config_limit' => 100,
24
  );
25
  }
26
  }
core/modules/ban-users/setup.php CHANGED
@@ -1,146 +1,144 @@
1
  <?php
2
 
3
- if ( ! class_exists( 'ITSEC_Ban_Users_Setup' ) ) {
4
 
5
- class ITSEC_Ban_Users_Setup {
6
-
7
- private
8
- $defaults;
9
-
10
- public function __construct() {
11
- add_action( 'itsec_modules_do_plugin_activation', array( $this, 'execute_activate' ) );
12
- add_action( 'itsec_modules_do_plugin_deactivation', array( $this, 'execute_deactivate' ) );
13
- add_action( 'itsec_modules_do_plugin_uninstall', array( $this, 'execute_uninstall' ) );
14
- add_action( 'itsec_modules_do_plugin_upgrade', array( $this, 'execute_upgrade' ), null, 2 );
15
- }
16
 
17
- /**
18
- * Execute module activation.
19
- *
20
- * @since 4.0
21
- *
22
- * @return void
23
- */
24
- public function execute_activate() {
25
- }
26
 
27
- /**
28
- * Execute module deactivation
29
- *
30
- * @return void
31
- */
32
- public function execute_deactivate() {
 
 
33
 
34
- }
35
 
36
- /**
37
- * Execute module uninstall
38
- *
39
- * @return void
40
- */
41
- public function execute_uninstall() {
42
 
43
- $this->execute_deactivate();
44
 
45
- delete_site_option( 'itsec_ban_users' );
 
46
 
47
- }
 
48
 
49
- /**
50
- * Execute module upgrade
51
- *
52
- * @return void
53
- */
54
- public function execute_upgrade( $itsec_old_version ) {
55
 
56
- if ( $itsec_old_version < 4000 ) {
57
 
58
- global $itsec_bwps_options;
59
 
60
- $current_options = get_site_option( 'itsec_ban_users' );
 
 
61
 
62
- // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
63
- if ( false !== $current_options ) {
64
 
65
- $current_options['enabled'] = isset( $itsec_bwps_options['bu_enabled'] ) && $itsec_bwps_options['bu_enabled'] == 1 ? true : false;
66
- $current_options['default'] = isset( $itsec_bwps_options['bu_blacklist'] ) && $itsec_bwps_options['bu_blacklist'] == 1 ? true : false;
67
 
68
- if ( isset( $itsec_bwps_options['bu_banlist'] ) && ! is_array( $itsec_bwps_options['bu_banlist'] ) && strlen( $itsec_bwps_options['bu_banlist'] ) > 1 ) {
69
 
70
- $raw_hosts = explode( PHP_EOL, $itsec_bwps_options['bu_banlist'] );
71
 
72
- foreach ( $raw_hosts as $host ) {
73
 
74
- if ( strlen( $host ) > 1 ) {
75
- $current_options['host_list'][] = $host;
76
- }
77
 
 
 
78
  }
79
 
80
  }
81
 
82
- if ( isset( $itsec_bwps_options['bu_banagent'] ) && ! is_array( $itsec_bwps_options['bu_banagent'] ) && strlen( $itsec_bwps_options['bu_banagent'] ) > 1 ) {
83
-
84
- $current_options['agent_list'] = explode( PHP_EOL, $itsec_bwps_options['bu_banagent'] );
85
 
86
- $raw_agents = explode( PHP_EOL, $itsec_bwps_options['bu_banagent'] );
 
 
87
 
88
- foreach ( $raw_agents as $agent ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
- if ( strlen( $agent ) > 1 ) {
91
- $current_options['agent_list'][] = $agent;
92
- }
93
 
94
- }
 
 
95
 
 
 
 
96
  }
97
-
98
- update_site_option( 'itsec_ban_users', $current_options );
99
  }
 
 
100
  }
 
101
 
102
- if ( $itsec_old_version < 4041 ) {
103
- $current_options = get_site_option( 'itsec_ban_users' );
104
-
105
- // If there are no current options, go with the new defaults by not saving anything
106
- if ( is_array( $current_options ) ) {
107
- $itsec_modules = ITSEC_Modules::get_instance();
108
-
109
- // 'enable_ban_lists' was previously just 'enabled'
110
- // Make sure the new module is properly activated or deactivated
111
- if ( $current_options['enabled'] ) {
112
- ITSEC_Modules::activate( 'backup' );
113
- $current_options['enable_ban_lists'] = true;
114
- } else {
115
- ITSEC_Modules::deactivate( 'backup' );
116
- $current_options['enable_ban_lists'] = false;
117
- }
118
- unset( $current_options['enabled'] );
119
 
120
- // Filter out invalid IPs
121
- $current_options['host_list'] = array_map( 'trim', $current_options['host_list'] );
 
 
122
 
123
- if ( ! class_exists( 'ITSEC_Lib_IP_Tools' ) ) {
124
- require_once( ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php' );
125
- }
 
 
126
 
127
- foreach ( $current_options['host_list'] as $index => $ip ) {
128
- if ( '' === $ip || false === ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $ip ) ) {
129
- unset( $current_options['host_list'][ $index ] );
130
- }
131
- }
132
 
133
- $itsec_modules->set_settings( 'ban-users', $current_options );
134
- }
135
- }
 
 
 
 
136
 
137
- if ( $itsec_old_version < 4069 ) {
138
- delete_site_option( 'itsec_ban_users' );
139
  }
140
  }
141
 
 
 
142
  }
143
-
144
  }
145
 
146
  new ITSEC_Ban_Users_Setup();
1
  <?php
2
 
3
+ class ITSEC_Ban_Users_Setup {
4
 
5
+ public function __construct() {
6
+ add_action( 'itsec_modules_do_plugin_uninstall', array( $this, 'execute_uninstall' ) );
7
+ add_action( 'itsec_modules_do_plugin_upgrade', array( $this, 'execute_upgrade' ), 0, 2 );
8
+ }
 
 
 
 
 
 
 
9
 
10
+ /**
11
+ * Execute module uninstall
12
+ *
13
+ * @return void
14
+ */
15
+ public function execute_uninstall() {
16
+ delete_site_option( 'itsec_ban_users' );
17
+ }
 
18
 
19
+ /**
20
+ * Execute module upgrade
21
+ *
22
+ * @param int $itsec_old_version
23
+ *
24
+ * @return void
25
+ */
26
+ public function execute_upgrade( $itsec_old_version ) {
27
 
28
+ if ( $itsec_old_version < 4000 ) {
29
 
30
+ global $itsec_bwps_options;
 
 
 
 
 
31
 
32
+ $current_options = get_site_option( 'itsec_ban_users' );
33
 
34
+ // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
35
+ if ( false !== $current_options ) {
36
 
37
+ $current_options['enabled'] = isset( $itsec_bwps_options['bu_enabled'] ) && $itsec_bwps_options['bu_enabled'] == 1 ? true : false;
38
+ $current_options['default'] = isset( $itsec_bwps_options['bu_blacklist'] ) && $itsec_bwps_options['bu_blacklist'] == 1 ? true : false;
39
 
40
+ if ( isset( $itsec_bwps_options['bu_banlist'] ) && ! is_array( $itsec_bwps_options['bu_banlist'] ) && strlen( $itsec_bwps_options['bu_banlist'] ) > 1 ) {
 
 
 
 
 
41
 
42
+ $raw_hosts = explode( PHP_EOL, $itsec_bwps_options['bu_banlist'] );
43
 
44
+ foreach ( $raw_hosts as $host ) {
45
 
46
+ if ( strlen( $host ) > 1 ) {
47
+ $current_options['host_list'][] = $host;
48
+ }
49
 
50
+ }
 
51
 
52
+ }
 
53
 
54
+ if ( isset( $itsec_bwps_options['bu_banagent'] ) && ! is_array( $itsec_bwps_options['bu_banagent'] ) && strlen( $itsec_bwps_options['bu_banagent'] ) > 1 ) {
55
 
56
+ $current_options['agent_list'] = explode( PHP_EOL, $itsec_bwps_options['bu_banagent'] );
57
 
58
+ $raw_agents = explode( PHP_EOL, $itsec_bwps_options['bu_banagent'] );
59
 
60
+ foreach ( $raw_agents as $agent ) {
 
 
61
 
62
+ if ( strlen( $agent ) > 1 ) {
63
+ $current_options['agent_list'][] = $agent;
64
  }
65
 
66
  }
67
 
68
+ }
 
 
69
 
70
+ update_site_option( 'itsec_ban_users', $current_options );
71
+ }
72
+ }
73
 
74
+ if ( $itsec_old_version < 4041 ) {
75
+ $current_options = get_site_option( 'itsec_ban_users' );
76
+
77
+ // If there are no current options, go with the new defaults by not saving anything
78
+ if ( is_array( $current_options ) ) {
79
+ $itsec_modules = ITSEC_Modules::get_instance();
80
+
81
+ // 'enable_ban_lists' was previously just 'enabled'
82
+ // Make sure the new module is properly activated or deactivated
83
+ if ( $current_options['enabled'] ) {
84
+ ITSEC_Modules::activate( 'backup' );
85
+ $current_options['enable_ban_lists'] = true;
86
+ } else {
87
+ ITSEC_Modules::deactivate( 'backup' );
88
+ $current_options['enable_ban_lists'] = false;
89
+ }
90
+ unset( $current_options['enabled'] );
91
 
92
+ // Filter out invalid IPs
93
+ $current_options['host_list'] = array_map( 'trim', $current_options['host_list'] );
 
94
 
95
+ if ( ! class_exists( 'ITSEC_Lib_IP_Tools' ) ) {
96
+ require_once( ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php' );
97
+ }
98
 
99
+ foreach ( $current_options['host_list'] as $index => $ip ) {
100
+ if ( '' === $ip || false === ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $ip ) ) {
101
+ unset( $current_options['host_list'][ $index ] );
102
  }
 
 
103
  }
104
+
105
+ $itsec_modules->set_settings( 'ban-users', $current_options );
106
  }
107
+ }
108
 
109
+ if ( $itsec_old_version < 4069 ) {
110
+ delete_site_option( 'itsec_ban_users' );
111
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
+ if ( $itsec_old_version < 4121 ) {
114
+ $this->migrate_bans();
115
+ }
116
+ }
117
 
118
+ /**
119
+ * Migrate the bans to the database.
120
+ */
121
+ protected function migrate_bans() {
122
+ $settings = ITSEC_Modules::get_settings( 'ban-users' );
123
 
124
+ if ( empty( $settings['host_list'] ) ) {
125
+ return;
126
+ }
 
 
127
 
128
+ $repository = ITSEC_Modules::get_container()->get( \iThemesSecurity\Ban_Users\Database_Repository::class );
129
+
130
+ foreach ( $settings['host_list'] as $host ) {
131
+ try {
132
+ $ban = new \iThemesSecurity\Ban_Users\Ban( $host );
133
+ $repository->persist( $ban );
134
+ } catch ( \iThemesSecurity\Exception\Exception $e ) {
135
 
 
 
136
  }
137
  }
138
 
139
+ unset( $settings['host_list'] );
140
+ ITSEC_Modules::set_settings( 'ban-users', $settings );
141
  }
 
142
  }
143
 
144
  new ITSEC_Ban_Users_Setup();
core/modules/ban-users/validator.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- class ITSEC_Ban_Users_Validator extends ITSEC_Validator {
4
- public function get_id() {
5
- return 'ban-users';
6
- }
7
-
8
- protected function sanitize_settings() {
9
- $this->sanitize_setting( 'bool', 'default', __( 'Default Ban List', 'better-wp-security' ) );
10
- $this->sanitize_setting( 'bool', 'enable_ban_lists', __( 'Ban Lists', 'better-wp-security' ) );
11
-
12
- $this->sanitize_setting( 'newline-separated-ips', 'host_list', __( 'Ban Hosts', 'better-wp-security' ) );
13
-
14
- if ( is_array( $this->settings['host_list'] ) ) {
15
- require_once( ITSEC_Core::get_core_dir() . '/lib/class-itsec-lib-ip-tools.php' );
16
-
17
- $whitelisted_hosts = array();
18
- $current_ip = ITSEC_Lib::get_ip();
19
-
20
- foreach ( $this->settings['host_list'] as $host ) {
21
- if ( is_user_logged_in() && ITSEC_Lib_IP_Tools::intersect( $current_ip, ITSEC_Lib_IP_Tools::ip_wild_to_ip_cidr( $host ) ) ) {
22
- $this->set_can_save( false );
23
-
24
- /* translators: 1: input name, 2: invalid host */
25
- $this->add_error( sprintf( __( 'The following host in %1$s matches your current IP and cannot be banned: %2$s', 'better-wp-security' ), __( 'Ban Hosts', 'better-wp-security' ), $host ) );
26
-
27
- continue;
28
- }
29
-
30
- if ( ITSEC_Lib::is_ip_whitelisted( $host ) ) {
31
- $whitelisted_hosts[] = $host;
32
- }
33
- }
34
-
35
- if ( ! empty( $whitelisted_hosts ) ) {
36
- $this->set_can_save( false );
37
-
38
- /* translators: 1: input name, 2: invalid host list */
39
- $this->add_error( wp_sprintf( _n( 'The following IP in %1$s is on the authorized hosts list and cannot be banned: %2$l', 'The following IPs in %1$s are on the authorized hosts list and cannot be banned: %2$l', count( $whitelisted_hosts ), 'better-wp-security' ), __( 'Ban Hosts', 'better-wp-security' ), $whitelisted_hosts ) );
40
- }
41
- }
42
-
43
- $this->sanitize_setting( array( $this, 'sanitize_agent_list_entry' ), 'agent_list', __( 'Ban User Agents', 'better-wp-security' ) );
44
- }
45
-
46
- protected function sanitize_agent_list_entry( $entry ) {
47
- return trim( sanitize_text_field( $entry ) );
48
- }
49
-
50
- protected function validate_settings() {
51
- if ( ! $this->can_save() ) {
52
- return;
53
- }
54
-
55
- if ( ! ITSEC_Core::is_interactive() ) {
56
- return;
57
- }
58
-
59
- $previous_settings = ITSEC_Modules::get_settings( $this->get_id() );
60
-
61
- foreach ( $this->settings as $key => $val ) {
62
- if ( ! isset( $previous_settings[$key] ) || $previous_settings[$key] != $val ) {
63
- ITSEC_Response::regenerate_server_config();
64
- break;
65
- }
66
- }
67
- }
68
- }
69
-
70
- ITSEC_Modules::register_validator( new ITSEC_Ban_Users_Validator() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
core/modules/brute-force/class-itsec-brute-force.php CHANGED
@@ -57,7 +57,7 @@ class ITSEC_Brute_Force {
57
  } else {
58
  ITSEC_Lib::load( 'login' );
59
  $found_user = ITSEC_Lib_Login::get_user( $username );
60
- $user_id = $found_user ? $found_user->ID : 0;
61
 
62
  if ( ! $user_id ) {
63
  $context->set_login_username( $username );
@@ -97,14 +97,16 @@ class ITSEC_Brute_Force {
97
  $lockout_modules['brute_force'] = array(
98
  'type' => 'brute_force',
99
  'reason' => __( 'too many bad login attempts', 'better-wp-security' ),
 
100
  'host' => $this->settings['max_attempts_host'],
101
  'user' => $this->settings['max_attempts_user'],
102
  'period' => $this->settings['check_period'],
103
  );
104
 
105
  $lockout_modules['brute_force_admin_user'] = array(
106
- 'type' => 'brute_force',
107
  'reason' => __( 'user tried to login as "admin."', 'better-wp-security' ),
 
108
  'host' => 1,
109
  'user' => 1,
110
  'period' => $this->settings['check_period']
57
  } else {
58
  ITSEC_Lib::load( 'login' );
59
  $found_user = ITSEC_Lib_Login::get_user( $username );
60
+ $user_id = $found_user ? $found_user->ID : 0;
61
 
62
  if ( ! $user_id ) {
63
  $context->set_login_username( $username );
97
  $lockout_modules['brute_force'] = array(
98
  'type' => 'brute_force',
99
  'reason' => __( 'too many bad login attempts', 'better-wp-security' ),
100
+ 'label' => __( 'Brute Force', 'better-wp-security' ),
101
  'host' => $this->settings['max_attempts_host'],
102
  'user' => $this->settings['max_attempts_user'],
103
  'period' => $this->settings['check_period'],
104
  );
105
 
106
  $lockout_modules['brute_force_admin_user'] = array(
107
+ 'type' => 'brute_force_admin_user',
108
  'reason' => __( 'user tried to login as "admin."', 'better-wp-security' ),
109
+ 'label' => __( 'Brute Force "admin" Username', 'better-wp-security' ),
110
  'host' => 1,
111
  'user' => 1,
112
  'period' => $this->settings['check_period']
core/modules/core/class-itsec-admin-notices.php CHANGED
@@ -14,7 +14,7 @@ class ITSEC_Admin_Notices {
14
  add_action( 'admin_init', array( $this, 'handle_admin_action' ) );
15
  }
16
 
17
- if ( ITSEC_Modules::get_setting( 'global', 'hide_admin_bar' ) || version_compare( get_bloginfo( 'version' ), '5.0', '<' ) ) {
18
  if ( is_multisite() ) {
19
  add_action( 'network_admin_notices', array( $this, 'display_notices' ) );
20
  } else {
@@ -50,7 +50,7 @@ class ITSEC_Admin_Notices {
50
 
51
  $nonce = wp_create_nonce( self::ACTION );
52
 
53
- wp_enqueue_script( 'itsec-admin-notices', plugin_dir_url( __FILE__ ) . 'js/admin-notices.js', array( 'jquery', 'wp-util' ) );
54
  wp_localize_script( 'itsec-admin-notices', 'ITSECAdminNotices', array(
55
  'nonce' => $nonce,
56
  ) );
@@ -72,7 +72,7 @@ class ITSEC_Admin_Notices {
72
  }
73
 
74
  echo '<div class="' . implode( ' ', $classes ) . '"' . $data . '>';
75
- $html = trim( $notice->get_title() . ' ' . $notice->get_message() );
76
 
77
  foreach ( $notice->get_actions() as $slug => $action ) {
78
  if ( ITSEC_Admin_Notice_Action::S_CLOSE === $action->get_style() ) {
@@ -132,6 +132,26 @@ class ITSEC_Admin_Notices {
132
  }
133
  }
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  public function handle_ajax() {
136
  $error = $this->handle_action( $_POST );
137
 
14
  add_action( 'admin_init', array( $this, 'handle_admin_action' ) );
15
  }
16
 
17
+ if ( ITSEC_Modules::get_setting( 'global', 'hide_admin_bar' ) ) {
18
  if ( is_multisite() ) {
19
  add_action( 'network_admin_notices', array( $this, 'display_notices' ) );
20
  } else {
50
 
51
  $nonce = wp_create_nonce( self::ACTION );
52
 
53
+ wp_enqueue_script( 'itsec-admin-notices', plugin_dir_url( __FILE__ ) . 'js/admin-notices.js', array( 'jquery', 'wp-util' ), 2 );
54
  wp_localize_script( 'itsec-admin-notices', 'ITSECAdminNotices', array(
55
  'nonce' => $nonce,
56
  ) );
72
  }
73
 
74
  echo '<div class="' . implode( ' ', $classes ) . '"' . $data . '>';
75
+ $html = $this->format_message( trim( $notice->get_title() . ' ' . $notice->get_message() ), $notice );
76
 
77
  foreach ( $notice->get_actions() as $slug => $action ) {
78
  if ( ITSEC_Admin_Notice_Action::S_CLOSE === $action->get_style() ) {
132
  }
133
  }
134
 
135
+ /**
136
+ * Formats a message replacing action variables.
137
+ *
138
+ * @param string $message
139
+ * @param ITSEC_Admin_Notice $notice
140
+ *
141
+ * @return string
142
+ */
143
+ private function format_message( $message, $notice ) {
144
+ foreach ( $notice->get_actions() as $slug => $action ) {
145
+ if ( ! $action->get_uri() ) {
146
+ continue;
147
+ }
148
+
149
+ $message = str_replace( "{{ \$${slug} }}", $action->get_uri(), $message );
150
+ }
151
+
152
+ return $message;
153
+ }
154
+
155
  public function handle_ajax() {
156
  $error = $this->handle_action( $_POST );
157
 
core/modules/core/class-itsec-core-active.php CHANGED
@@ -3,11 +3,18 @@
3
  class ITSEC_Core_Active {
4
 
5
  public function run() {
 
6
  add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ), 0 );
7
  add_action( 'login_enqueue_scripts', array( $this, 'register_scripts' ), 0 );
8
  add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ), 0 );
9
  }
10
 
 
 
 
 
 
 
11
  public function register_scripts() {
12
  $dir = ITSEC_Core::get_plugin_dir() . 'dist/';
13
  $script_debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
3
  class ITSEC_Core_Active {
4
 
5
  public function run() {
6
+ add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
7
  add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ), 0 );
8
  add_action( 'login_enqueue_scripts', array( $this, 'register_scripts' ), 0 );
9
  add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ), 0 );
10
  }
11
 
12
+ public function rest_api_init() {
13
+ $factory = ITSEC_Modules::get_container()->get( \iThemesSecurity\Actor\Multi_Actor_Factory::class );
14
+ ( new ITSEC_REST_Actor_Types_Controller( $factory ) )->register_routes();
15
+ ( new ITSEC_REST_Actors_Controller( $factory ) )->register_routes();
16
+ }
17
+
18
  public function register_scripts() {
19
  $dir = ITSEC_Core::get_plugin_dir() . 'dist/';
20
  $script_debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
core/modules/core/class-itsec-rest-actor-types-controller.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use iThemesSecurity\Actor\Actor_Factory;
4
+ use iThemesSecurity\Actor\Multi_Actor_Factory;
5
+
6
+ class ITSEC_REST_Actor_Types_Controller extends WP_REST_Controller {
7
+
8
+ /** @var Multi_Actor_Factory */
9
+ private $factory;
10
+
11
+ /**
12
+ * ITSEC_REST_Actors_Controller constructor.
13
+ *
14
+ * @param Multi_Actor_Factory $factory
15
+ */
16
+ public function __construct( Multi_Actor_Factory $factory ) {
17
+ $this->factory = $factory;
18
+ $this->namespace = 'ithemes-security/v1';
19
+ $this->rest_base = 'actors';
20
+ }
21
+
22
+ public function register_routes() {
23
+ register_rest_route( $this->namespace, $this->rest_base, [
24
+ 'methods' => WP_REST_Server::READABLE,
25
+ 'callback' => [ $this, 'get_items' ],
26
+ 'permission_callback' => [ $this, 'get_items_permissions_check' ],
27
+ 'schema' => [ $this, 'get_public_item_schema' ],
28
+ ] );
29
+ }
30
+
31
+ public function get_items_permissions_check( $request ) {
32
+ return ITSEC_Core::current_user_can_manage();
33
+ }
34
+
35
+ public function get_items( $request ) {
36
+ $items = [];
37
+
38
+ foreach ( $this->factory->get_supported_factories() as $factory ) {
39
+ $items[] = $this->prepare_response_for_collection(
40
+ $this->prepare_item_for_response( $factory, $request )
41
+ );
42
+ }
43
+
44
+ return new WP_REST_Response( $items );
45
+ }
46
+
47
+ /**
48
+ * Prepares an Actor Factory for a response.
49
+ *
50
+ * @param Actor_Factory $item
51
+ * @param WP_REST_Request $request
52
+ *
53
+ * @return WP_Error|WP_REST_Response
54
+ */
55
+ public function prepare_item_for_response( $item, $request ) {
56
+ $response = new WP_REST_Response( [
57
+ 'slug' => $item->get_slug(),
58
+ 'label' => $item->get_label(),
59
+ ] );
60
+
61
+ $response->add_link(
62
+ 'https://api.w.org/items',
63
+ rest_url( sprintf( '%s/%s/%s/search', $this->namespace, $this->rest_base, $item->get_slug() ) ),
64
+ [
65
+ 'embeddable' => $item->is_determinate(),
66
+ ]
67
+ );
68
+
69
+ return $response;
70
+ }
71
+
72
+ public function get_item_schema() {
73
+ if ( $this->schema ) {
74
+ return $this->schema;
75
+ }
76
+
77
+ $this->schema = [
78
+ '$schema' => 'http://json-schema.org/draft-04/schema#',
79
+ 'type' => 'object',
80
+ 'properties' => [
81
+ 'slug' => [
82
+ 'type' => 'string',
83
+ 'context' => [ 'view', 'edit', 'embed' ],
84
+ ],
85
+ 'label' => [
86
+ 'type' => 'string',
87
+ 'context' => [ 'view', 'edit', 'embed' ],
88
+ ],
89
+ ],
90
+ ];
91
+
92
+ return $this->schema;
93
+ }
94
+ }
core/modules/core/class-itsec-rest-actors-controller.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use iThemesSecurity\Actor\Actor;
4
+ use iThemesSecurity\Actor\Actor_Factory;
5
+ use iThemesSecurity\Actor\Multi_Actor_Factory;
6
+
7
+ class ITSEC_REST_Actors_Controller extends WP_REST_Controller {
8
+
9
+ /** @var Multi_Actor_Factory */
10
+ private $factory;
11
+
12
+ /**
13
+ * ITSEC_REST_Actors_Controller constructor.
14
+ *
15
+ * @param Multi_Actor_Factory $factory
16
+ */
17
+ public function __construct( Multi_Actor_Factory $factory ) {
18
+ $this->factory = $factory;
19
+ $this->namespace = 'ithemes-security/v1';
20
+ $this->rest_base = 'actors';
21
+ }
22
+
23
+ public function register_routes() {
24
+ register_rest_route( $this->namespace, $this->rest_base . '/(?P<type>[\w\-\_]+)/search', [
25
+ 'methods' => WP_REST_Server::READABLE,
26
+ 'callback' => [ $this, 'get_items' ],
27
+ 'permission_callback' => [ $this, 'get_items_permissions_check' ],
28
+ 'schema' => [ $this, 'get_public_item_schema' ],
29
+ ] );
30
+ }
31
+
32
+ public function get_items_permissions_check( $request ) {
33
+ return ITSEC_Core::current_user_can_manage();
34
+ }
35
+
36
+ public function get_items( $request ) {
37
+ if ( ! $factory = $this->get_requested_factory( $request ) ) {
38
+ return new \WP_Error(
39
+ 'itsec_invalid_actor_type',
40
+ __( 'That actor type is not supported.', 'better-wp-security' ),
41
+ [ 'status' => WP_Http::NOT_FOUND ]
42
+ );
43
+ }
44
+
45
+ $items = [];
46
+
47
+ foreach ( $factory->get_actors( $request['search'] ) as $actor ) {
48
+ $items[] = $this->prepare_response_for_collection(
49
+ $this->prepare_item_for_response( $actor, $request )
50
+ );
51
+ }
52
+
53
+ return new WP_REST_Response( $items );
54
+ }
55
+
56
+ /**
57
+ * Gets the requested actor factory.
58
+ *
59
+ * @param WP_REST_Request $request
60
+ *
61
+ * @return Actor_Factory|null
62
+ */
63
+ protected function get_requested_factory( $request ) {
64
+ foreach ( $this->factory->get_supported_factories() as $factory ) {
65
+ if ( $factory->get_slug() === $request['type'] ) {
66
+ return $factory;
67
+ }
68
+ }
69
+
70
+ return null;
71
+ }
72
+
73
+ /**
74
+ * Prepares an Actor Factory for a response.
75
+ *
76
+ * @param Actor $item
77
+ * @param WP_REST_Request $request
78
+ *
79
+ * @return WP_Error|WP_REST_Response
80
+ */
81
+ public function prepare_item_for_response( $item, $request ) {
82
+ return new WP_REST_Response( [
83
+ 'id' => $item->get_identifier(),
84
+ 'label' => (string) $item,
85
+ ] );
86
+ }
87
+
88
+ public function get_collection_params() {
89
+ $params = parent::get_collection_params();
90
+ unset( $params['page'], $params['per_page'] );
91
+ $params['context']['default'] = 'view';
92
+ $params['search']['default'] = '';
93
+ $params['search']['validate_callback'] = function ( $value, $request ) {
94
+ if ( ! $factory = $this->get_requested_factory( $request ) ) {
95
+ return true;
96
+ }
97
+
98
+ if ( $factory->is_determinate() || trim( $value ) ) {
99
+ return true;
100
+ }
101
+
102
+ return new WP_Error( 'rest_invalid_param', __( 'A search term is required when querying this actor type.', 'better-wp-security' ) );
103
+ };
104
+
105
+ return $params;
106
+ }
107
+
108
+ public function get_item_schema() {
109
+ if ( $this->schema ) {
110
+ return $this->schema;
111
+ }
112
+
113
+ $this->schema = [
114
+ '$schema' => 'http://json-schema.org/draft-04/schema#',
115
+ 'type' => 'object',
116
+ 'properties' => [
117
+ 'id' => [
118
+ 'type' => [ 'integer', 'string' ],
119
+ 'context' => [ 'view', 'edit', 'embed' ],
120
+ ],
121
+ 'label' => [
122
+ 'type' => 'string',
123
+ 'context' => [ 'view', 'edit', 'embed' ],
124
+ ],
125
+ ],
126
+ ];
127
+
128
+ return $this->schema;
129
+ }
130
+ }
core/modules/core/js/admin-notices.js CHANGED
@@ -4,7 +4,7 @@
4
 
5
  $( document ).on( 'click', '.itsec-notice .notice-dismiss', function( e ) {
6
  const $this = $( this ),
7
- $notice = $this.parent( '.itsec-notice' );
8
 
9
  $notice.fadeTo( 100, 0, function() {
10
  $notice.slideUp( 100 );
@@ -15,7 +15,8 @@
15
 
16
  $( document ).on( 'click', '.itsec-notice [data-action]', function( e ) {
17
  const $this = $( this ),
18
- $notice = $this.parent( '.itsec-notice' );
 
19
 
20
  $this.prop( 'disabled', true );
21
 
4
 
5
  $( document ).on( 'click', '.itsec-notice .notice-dismiss', function( e ) {
6
  const $this = $( this ),
7
+ $notice = $this.closest( '.itsec-notice' );
8
 
9
  $notice.fadeTo( 100, 0, function() {
10
  $notice.slideUp( 100 );
15
 
16
  $( document ).on( 'click', '.itsec-notice [data-action]', function( e ) {
17
  const $this = $( this ),
18
+ $notice = $this.closest( '.itsec-notice' ),
19
+ action = $this.data( 'action' );
20
 
21
  $this.prop( 'disabled', true );
22
 
core/modules/core/notices.php CHANGED
@@ -3,7 +3,7 @@
3
  class ITSEC_Admin_Notice_New_Feature_Core implements ITSEC_Admin_Notice {
4
 
5
  public function get_id() {
6
- return 'release-site-scanner';
7
  }
8
 
9
  public function get_title() {
@@ -11,19 +11,7 @@ class ITSEC_Admin_Notice_New_Feature_Core implements ITSEC_Admin_Notice {
11
  }
12
 
13
  public function get_message() {
14
- if ( ITSEC_Core::is_pro() ) {
15
- return sprintf(
16
- esc_html__( 'The new, improved %1$sWordPress Security Site Scan%2$s powered by iThemes performs automatic checks for known website vulnerabilities and, if a patch is available, iThemes Security Pro will now automatically apply the fix for you.', 'better-wp-security' ),
17
- '<a href="{{ $blog }}">',
18
- '</a>'
19
- );
20
- }
21
-
22
- return sprintf(
23
- esc_html__( 'The new, improved %1$sWordPress Security Site Scan powered by iThemes checks if Google has detected malware and added your site to their threat list', 'better-wp-security' ),
24
- '<a href="{{ $blog }}">',
25
- '</a>'
26
- );
27
  }
28
 
29
  public function get_meta() {
@@ -41,13 +29,13 @@ class ITSEC_Admin_Notice_New_Feature_Core implements ITSEC_Admin_Notice {
41
  public function get_actions() {
42
  return array(
43
  'blog' => new ITSEC_Admin_Notice_Action_Link(
44
- add_query_arg( 'itsec_view_release_post', 'user-groups', admin_url( 'index.php' ) ),
45
- esc_html__( 'See How It Works', 'better-wp-security' ),
46
  ITSEC_Admin_Notice_Action::S_PRIMARY,
47
  function () {
48
  $this->handle_dismiss();
49
 
50
- wp_redirect( 'https://ithemes.com/new-protect-your-wordpress-website-with-the-ithemes-security-site-scan/' );
51
  die;
52
  }
53
  )
@@ -77,4 +65,7 @@ class ITSEC_Admin_Notice_New_Feature_Core implements ITSEC_Admin_Notice {
77
  }
78
  }
79
 
80
- ITSEC_Lib_Admin_Notices::register( new ITSEC_Admin_Notice_Globally_Dismissible( new ITSEC_Admin_Notice_Managers_Only( new ITSEC_Admin_Notice_New_Feature_Core() ) ) );
 
 
 
3
  class ITSEC_Admin_Notice_New_Feature_Core implements ITSEC_Admin_Notice {
4
 
5
  public function get_id() {
6
+ return 'release-rcp';
7
  }
8
 
9
  public function get_title() {
11
  }
12
 
13
  public function get_message() {
14
+ return esc_html__( 'iThemes Security Pro Now Integrates with Restrict Content Pro.', 'better-wp-security' );
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
 
17
  public function get_meta() {
29
  public function get_actions() {
30
  return array(
31
  'blog' => new ITSEC_Admin_Notice_Action_Link(
32
+ add_query_arg( 'itsec_view_release_post', 'release-ban-users', admin_url( 'index.php' ) ),
33
+ esc_html__( 'See what’s new', 'better-wp-security' ),
34
  ITSEC_Admin_Notice_Action::S_PRIMARY,
35
  function () {
36
  $this->handle_dismiss();
37
 
38
+ wp_redirect( 'https://ithemes.com/?p=59484' );
39
  die;
40
  }
41
  )
65
  }
66
  }
67
 
68
+ if ( time() > 1603206000 ) {
69
+ ITSEC_Lib_Admin_Notices::register( new ITSEC_Admin_Notice_Globally_Dismissible( new ITSEC_Admin_Notice_Managers_Only( new ITSEC_Admin_Notice_New_Feature_Core() ) ) );
70
+ }
71
+
core/modules/file-change/admin.php CHANGED
@@ -3,7 +3,7 @@
3
  final class ITSEC_File_Change_Admin {
4
 
5
  public static function enqueue_scanner() {
6
- $logs_page_url = ITSEC_Core::get_logs_page_url( 'file_change' );
7
 
8
  ITSEC_Lib::enqueue_util();
9
  wp_enqueue_script( 'itsec-file-change-scanner', plugins_url( 'js/file-scanner.js', __FILE__ ), array( 'jquery', 'heartbeat', 'itsec-util' ), ITSEC_Core::get_plugin_build(), true );
3
  final class ITSEC_File_Change_Admin {
4
 
5
  public static function enqueue_scanner() {
6
+ $logs_page_url = ITSEC_Core::get_logs_page_url( array( 'module' => 'file_change' ) );
7
 
8
  ITSEC_Lib::enqueue_util();
9
  wp_enqueue_script( 'itsec-file-change-scanner', plugins_url( 'js/file-scanner.js', __FILE__ ), array( 'jquery', 'heartbeat', 'itsec-util' ), ITSEC_Core::get_plugin_build(), true );
core/modules/notification-center/settings-page.php CHANGED
@@ -107,7 +107,7 @@ class ITSEC_Notification_Center_Settings_Page extends ITSEC_Module_Settings_Page
107
  return;
108
  }
109
 
110
- $link = esc_url( ITSEC_Core::get_logs_page_url( 'notification_center', 'error' ) );
111
  ?>
112
  <div class="itsec-notification-center-mail-errors-container">
113
  <div class="notice notice-alt notice-error below-h2 itsec-is-dismissible itsec-notification-center-mail-error">
@@ -345,4 +345,4 @@ class ITSEC_Notification_Center_Settings_Page extends ITSEC_Module_Settings_Page
345
  }
346
  }
347
 
348
- new ITSEC_Notification_Center_Settings_Page();
107
  return;
108
  }
109
 
110
+ $link = esc_url( ITSEC_Core::get_logs_page_url( array( 'module' => 'notification_center', 'type' => 'error' ) ) );
111
  ?>
112
  <div class="itsec-notification-center-mail-errors-container">
113
  <div class="notice notice-alt notice-error below-h2 itsec-is-dismissible itsec-notification-center-mail-error">
345
  }
346
  }
347
 
348
+ new ITSEC_Notification_Center_Settings_Page();
core/modules/password-requirements/class-itsec-password-requirements.php CHANGED
@@ -202,6 +202,10 @@ class ITSEC_Password_Requirements {
202
  protected function handle_password_updated( $user ) {
203
  delete_user_meta( $user->ID, 'itsec_password_change_required' );
204
  update_user_meta( $user->ID, 'itsec_last_password_change', ITSEC_Core::get_current_time_gmt() );
 
 
 
 
205
  }
206
 
207
  /**
@@ -470,6 +474,8 @@ class ITSEC_Password_Requirements {
470
  return $error;
471
  }
472
 
 
 
473
  return null;
474
  }
475
  }
202
  protected function handle_password_updated( $user ) {
203
  delete_user_meta( $user->ID, 'itsec_password_change_required' );
204
  update_user_meta( $user->ID, 'itsec_last_password_change', ITSEC_Core::get_current_time_gmt() );
205
+
206
+ foreach ( ITSEC_Lib_Password_Requirements::get_registered() as $code => $requirement ) {
207
+ delete_user_meta( $user->ID, $requirement['meta'] );
208
+ }
209
  }
210
 
211
  /**
474
  return $error;
475
  }
476
 
477
+ $this->handle_plain_text_password_available( $user, $data['pass1'] );
478
+
479
  return null;
480
  }
481
  }
core/modules/pro/settings-page.php CHANGED
@@ -12,7 +12,7 @@ final class ITSEC_Magic_Links_Settings_Page extends ITSEC_Module_Settings_Page {
12
  $this->type = 'recommended';
13
  $this->pro = true;
14
  $this->upsell = true;
15
- $this->upsell_url = 'http://ithemes.com/security/?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=itsecfreecta';
16
 
17
  parent::__construct();
18
  }
@@ -23,12 +23,12 @@ new ITSEC_Magic_Links_Settings_Page();
23
  final class ITSEC_Malware_Scheduling_Settings_Page extends ITSEC_Module_Settings_Page {
24
  public function __construct() {
25
  $this->id = 'malware-scheduling';
26
- $this->title = __( 'Malware Scan Scheduling', 'better-wp-security' );
27
- $this->description = __( 'Protect your site with automated malware scans. When this feature is enabled, the site will be automatically scanned each day. If a problem is found, an email is sent to select users.', 'better-wp-security' );
28
  $this->type = 'recommended';
29
  $this->pro = true;
30
  $this->upsell = true;
31
- $this->upsell_url = 'http://ithemes.com/security/wordpress-malware-scan/?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=itsecfreecta';
32
 
33
  parent::__construct();
34
  }
12
  $this->type = 'recommended';
13
  $this->pro = true;
14
  $this->upsell = true;
15
+ $this->upsell_url = 'https://ithemes.com/security/?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=itsecfreecta';
16
 
17
  parent::__construct();
18
  }
23
  final class ITSEC_Malware_Scheduling_Settings_Page extends ITSEC_Module_Settings_Page {
24
  public function __construct() {
25
  $this->id = 'malware-scheduling';
26
+ $this->title = __( 'Site Scan Scheduling', 'better-wp-security' );
27
+ $this->description = __( 'Protect your site with automated site scans. When this feature is enabled, the site will be automatically scanned each day. If a problem is found, an email is sent to select users.', 'better-wp-security' );
28
  $this->type = 'recommended';
29
  $this->pro = true;
30
  $this->upsell = true;
31
+ $this->upsell_url = 'https://ithemes.com/security/wordpress-malware-scan/?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=itsecfreecta';
32
 
33
  parent::__construct();
34
  }
core/modules/security-check/scanner.php CHANGED
@@ -261,7 +261,8 @@ final class ITSEC_Security_Check_Scanner {
261
  $hash = hash_hmac( 'sha1', "{$action}|{$exp}", wp_salt() );
262
 
263
  $response = wp_remote_post( admin_url( 'admin-post.php' ), array(
264
- 'body' => array(
 
265
  'action' => $action,
266
  'hash' => $hash,
267
  'exp' => $exp,
261
  $hash = hash_hmac( 'sha1', "{$action}|{$exp}", wp_salt() );
262
 
263
  $response = wp_remote_post( admin_url( 'admin-post.php' ), array(
264
+ 'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
265
+ 'body' => array(
266
  'action' => $action,
267
  'hash' => $hash,
268
  'exp' => $exp,
core/modules/site-scanner/mail.php CHANGED
@@ -82,7 +82,7 @@ class ITSEC_Site_Scanner_Mail {
82
  $log_url = '';
83
 
84
  if ( $scan->get_id() ) {
85
- $log_url = add_query_arg( 'id', $scan->get_id(), ITSEC_Core::get_logs_page_url() );
86
  $log_url = ITSEC_Mail::filter_admin_page_url( $log_url );
87
  }
88
 
82
  $log_url = '';
83
 
84
  if ( $scan->get_id() ) {
85
+ $log_url = ITSEC_Core::get_logs_page_url( [ 'id' => $scan->get_id() ] );
86
  $log_url = ITSEC_Mail::filter_admin_page_url( $log_url );
87
  }
88
 
core/modules/site-scanner/settings-page.php CHANGED
@@ -32,7 +32,7 @@ class ITSEC_Settings_Page_Sidebar_Widget_Site_Scanner extends ITSEC_Settings_Pag
32
 
33
  ?>
34
  <p><?php echo $description; ?></p>
35
- <p><?php printf( __( 'Results of previous scans can be found on the <a href="%s">logs page</a>.', 'better-wp-security' ), ITSEC_Core::get_logs_page_url( $module ) ); ?></p>
36
  <div class="itsec-site-scanner-scan-results-wrapper"></div>
37
  <?php $form->add_button( 'start', array( 'value' => $button, 'class' => 'button-primary' ) ); ?>
38
  <?php
32
 
33
  ?>
34
  <p><?php echo $description; ?></p>
35
+ <p><?php printf( __( 'Results of previous scans can be found on the <a href="%s">logs page</a>.', 'better-wp-security' ), ITSEC_Core::get_logs_page_url( array( 'module' => $module ) ) ); ?></p>
36
  <div class="itsec-site-scanner-scan-results-wrapper"></div>
37
  <?php $form->add_button( 'start', array( 'value' => $button, 'class' => 'button-primary' ) ); ?>
38
  <?php
core/modules/user-groups/Module/Module.php CHANGED
@@ -36,7 +36,7 @@ class Module implements Runnable {
36
  public function run() {
37
  add_action( 'itsec_initialized', [ $this, 'trigger_setting_registration' ] );
38
  add_filter( 'map_meta_cap', [ $this, 'map_meta_cap' ], 10, 4 );
39
- add_action( 'itsec_create_user_group', [ $this, 'initialize_settings' ] );
40
  }
41
 
42
  public function trigger_setting_registration() {
@@ -76,9 +76,10 @@ class Module implements Runnable {
76
  * Initialize a new user group's settings to use the configuration for the Everybody Else group.
77
  *
78
  * @param User_Group $user_group
 
79
  */
80
- public function initialize_settings( User_Group $user_group ) {
81
- if ( \ITSEC_Core::is_importing() ) {
82
  // During an import, there is no need to initialize these groups as "new" since we'll
83
  // be importing their settings shortly.
84
  return;
36
  public function run() {
37
  add_action( 'itsec_initialized', [ $this, 'trigger_setting_registration' ] );
38
  add_filter( 'map_meta_cap', [ $this, 'map_meta_cap' ], 10, 4 );
39
+ add_action( 'itsec_create_user_group', [ $this, 'initialize_settings' ], 10, 2 );
40
  }
41
 
42
  public function trigger_setting_registration() {
76
  * Initialize a new user group's settings to use the configuration for the Everybody Else group.
77
  *
78
  * @param User_Group $user_group
79
+ * @param array $args
80
  */
81
+ public function initialize_settings( User_Group $user_group, array $args = [] ) {
82
+ if ( \ITSEC_Core::is_importing() || ! empty( $args['is_default'] ) ) {
83
  // During an import, there is no need to initialize these groups as "new" since we'll
84
  // be importing their settings shortly.
85
  return;
core/modules/user-groups/Module/Settings.php CHANGED
@@ -40,7 +40,7 @@ class Settings extends ITSEC_Settings implements Runnable {
40
  /**
41
  * Get the default user group.
42
  *
43
- * @param string $name The name of the gorup.
44
  * @param bool $recreate Whether to recreate the group if it was deleted.
45
  *
46
  * @return string
@@ -77,7 +77,7 @@ class Settings extends ITSEC_Settings implements Runnable {
77
  }
78
 
79
  if ( $recreate ) {
80
- $this->repository->persist( $prototype );
81
  $defaults[ $name ] = $prototype->get_id();
82
 
83
  $this->set( 'default_groups', $defaults );
@@ -118,7 +118,7 @@ class Settings extends ITSEC_Settings implements Runnable {
118
  if ( ! isset( $defaults[ $role ] ) ) {
119
  $group = new User_Group( $this->repository->next_id() );
120
  $this->configure_group( $group, $role );
121
- $this->repository->persist( $group );
122
  $defaults[ $role ] = $group->get_id();
123
 
124
  $save = true;
40
  /**
41
  * Get the default user group.
42
  *
43
+ * @param string $name The name of the group.
44
  * @param bool $recreate Whether to recreate the group if it was deleted.
45
  *
46
  * @return string
77
  }
78
 
79
  if ( $recreate ) {
80
+ $this->repository->persist( $prototype, [ 'is_default' => $name ] );
81
  $defaults[ $name ] = $prototype->get_id();
82
 
83
  $this->set( 'default_groups', $defaults );
118
  if ( ! isset( $defaults[ $role ] ) ) {
119
  $group = new User_Group( $this->repository->next_id() );
120
  $this->configure_group( $group, $role );
121
+ $this->repository->persist( $group, [ 'is_default' => $role ] );
122
  $defaults[ $role ] = $group->get_id();
123
 
124
  $save = true;
core/modules/user-groups/REST/User_Groups.php CHANGED
@@ -142,7 +142,7 @@ class User_Groups extends \WP_REST_Controller {
142
  return $response;
143
  }
144
 
145
- $this->repository->persist( $user_group );
146
  $request['context'] = 'edit';
147
 
148
  $response = $this->prepare_item_for_response( $user_group, $request );
@@ -203,7 +203,7 @@ class User_Groups extends \WP_REST_Controller {
203
  return $user_group;
204
  }
205
 
206
- $this->repository->persist( $user_group );
207
  $request['context'] = 'edit';
208
 
209
  return $this->prepare_item_for_response( $user_group, $request );
142
  return $response;
143
  }
144
 
145
+ $this->repository->persist( $user_group, [] );
146
  $request['context'] = 'edit';
147
 
148
  $response = $this->prepare_item_for_response( $user_group, $request );
203
  return $user_group;
204
  }
205
 
206
+ $this->repository->persist( $user_group, [] );
207
  $request['context'] = 'edit';
208
 
209
  return $this->prepare_item_for_response( $user_group, $request );
core/modules/user-groups/Repository/DB_Repository.php CHANGED
@@ -50,7 +50,7 @@ final class DB_Repository implements Repository {
50
  ) );
51
  }
52
 
53
- public function persist( User_Group $user_group ) {
54
  $this->wpdb->query( $this->wpdb->prepare(
55
  "INSERT INTO {$this->tn()} (group_id, group_label, group_roles, group_canonical, group_users, group_min_role, group_created_at) VALUES (%s, %s, %s, %s, %s, %s, %s)" .
56
  'ON DUPLICATE KEY UPDATE group_label = VALUES(group_label), group_roles = VALUES(group_roles), group_canonical = VALUES(group_canonical), group_users = VALUES(group_users), group_min_role = VALUES(group_min_role)',
@@ -73,8 +73,9 @@ final class DB_Repository implements Repository {
73
  * @since 6.4.0
74
  *
75
  * @param User_Group $user_group
 
76
  */
77
- do_action( 'itsec_create_user_group', $user_group );
78
  } else {
79
  /**
80
  * Fires when a user group is updated.
@@ -82,8 +83,9 @@ final class DB_Repository implements Repository {
82
  * @since 6.4.0
83
  *
84
  * @param User_Group $user_group
 
85
  */
86
- do_action( 'itsec_update_user_group', $user_group );
87
  }
88
  }
89
 
50
  ) );
51
  }
52
 
53
+ public function persist( User_Group $user_group, array $args = [] ) {
54
  $this->wpdb->query( $this->wpdb->prepare(
55
  "INSERT INTO {$this->tn()} (group_id, group_label, group_roles, group_canonical, group_users, group_min_role, group_created_at) VALUES (%s, %s, %s, %s, %s, %s, %s)" .
56
  'ON DUPLICATE KEY UPDATE group_label = VALUES(group_label), group_roles = VALUES(group_roles), group_canonical = VALUES(group_canonical), group_users = VALUES(group_users), group_min_role = VALUES(group_min_role)',
73
  * @since 6.4.0
74
  *
75
  * @param User_Group $user_group
76
+ * @param array $args
77
  */
78
+ do_action( 'itsec_create_user_group', $user_group, $args );
79
  } else {
80
  /**
81
  * Fires when a user group is updated.
83
  * @since 6.4.0
84
  *
85
  * @param User_Group $user_group
86
+ * @param array $args
87
  */
88
+ do_action( 'itsec_update_user_group', $user_group, $args );
89
  }
90
  }
91
 
core/modules/user-groups/Repository/Decorator.php CHANGED
@@ -21,8 +21,8 @@ trait Decorator {
21
  return $this->decorates->has( $id );
22
  }
23
 
24
- public function persist( User_Group $user_group ) {
25
- $this->decorates->persist( $user_group );
26
  }
27
 
28
  public function delete( User_Group $user_group ) {
21
  return $this->decorates->has( $id );
22
  }
23
 
24
+ public function persist( User_Group $user_group, array $args = [] ) {
25
+ $this->decorates->persist( $user_group, $args );
26
  }
27
 
28
  public function delete( User_Group $user_group ) {
core/modules/user-groups/Repository/Eager_Loading_Decorator.php CHANGED
@@ -39,8 +39,8 @@ final class Eager_Loading_Decorator implements Repository {
39
  return isset( $this->all[ $id ] );
40
  }
41
 
42
- public function persist( User_Group $user_group ) {
43
- $this->decorates->persist( $user_group );
44
 
45
  if ( null !== $this->all ) {
46
  $this->all[ $user_group->get_id() ] = $user_group;
39
  return isset( $this->all[ $id ] );
40
  }
41
 
42
+ public function persist( User_Group $user_group, array $args = [] ) {
43
+ $this->decorates->persist( $user_group, $args );
44
 
45
  if ( null !== $this->all ) {
46
  $this->all[ $user_group->get_id() ] = $user_group;
core/modules/user-groups/Repository/In_Memory_Repository.php CHANGED
@@ -36,7 +36,7 @@ final class In_Memory_Repository implements Repository {
36
  return isset( $this->memory[ $id ] );
37
  }
38
 
39
- public function persist( User_Group $user_group ) {
40
  $created = empty( $this->memory[ $user_group->get_id() ] );
41
 
42
  $this->memory[ $user_group->get_id() ] = $user_group;
@@ -49,7 +49,7 @@ final class In_Memory_Repository implements Repository {
49
  *
50
  * @param User_Group $user_group
51
  */
52
- do_action( 'itsec_create_user_group', $user_group );
53
  } else {
54
  /**
55
  * Fires when a user group is updated.
@@ -58,7 +58,7 @@ final class In_Memory_Repository implements Repository {
58
  *
59
  * @param User_Group $user_group
60
  */
61
- do_action( 'itsec_update_user_group', $user_group );
62
  }
63
  }
64
 
36
  return isset( $this->memory[ $id ] );
37
  }
38
 
39
+ public function persist( User_Group $user_group, array $args = [] ) {
40
  $created = empty( $this->memory[ $user_group->get_id() ] );
41
 
42
  $this->memory[ $user_group->get_id() ] = $user_group;
49
  *
50
  * @param User_Group $user_group
51
  */
52
+ do_action( 'itsec_create_user_group', $user_group, $args );
53
  } else {
54
  /**
55
  * Fires when a user group is updated.
58
  *
59
  * @param User_Group $user_group
60
  */
61
+ do_action( 'itsec_update_user_group', $user_group, $args );
62
  }
63
  }
64
 
core/modules/user-groups/Repository/Object_Caching_Decorator.php CHANGED
@@ -47,8 +47,8 @@ final class Object_Caching_Decorator implements Repository {
47
  return $this->decorates->has( $id );
48
  }
49
 
50
- public function persist( User_Group $user_group ) {
51
- $this->decorates->persist( $user_group );
52
  $this->cache( $user_group );
53
  }
54
 
47
  return $this->decorates->has( $id );
48
  }
49
 
50
+ public function persist( User_Group $user_group, array $args = [] ) {
51
+ $this->decorates->persist( $user_group, $args );
52
  $this->cache( $user_group );
53
  }
54
 
core/modules/user-groups/Repository/Repository.php CHANGED
@@ -37,12 +37,13 @@ interface Repository {
37
  * Persist a user group.
38
  *
39
  * @param User_Group $user_group
 
40
  *
41
  * @return void
42
  *
43
  * @throws WP_Error
44
  */
45
- public function persist( User_Group $user_group );
46
 
47
  /**
48
  * Delete a user group.
37
  * Persist a user group.
38
  *
39
  * @param User_Group $user_group
40
+ * @param array $args
41
  *
42
  * @return void
43
  *
44
  * @throws WP_Error
45
  */
46
+ public function persist( User_Group $user_group, array $args = [] );
47
 
48
  /**
49
  * Delete a user group.
core/modules/user-groups/Upgrader.php CHANGED
@@ -44,7 +44,7 @@ final class Upgrader {
44
  }
45
 
46
  $user_group->set_label( $label );
47
- $this->user_groups->persist( $user_group );
48
 
49
  return $user_group;
50
  }
44
  }
45
 
46
  $user_group->set_label( $label );
47
+ $this->user_groups->persist( $user_group, [] );
48
 
49
  return $user_group;
50
  }
core/package.json CHANGED
@@ -7,6 +7,8 @@
7
  "extends @wordpress/browserslist-config"
8
  ],
9
  "dependencies": {
 
 
10
  "@wordpress/a11y": "^2.11.0",
11
  "@wordpress/api-fetch": "^3.18.0",
12
  "@wordpress/autop": "^2.9.0",
7
  "extends @wordpress/browserslist-config"
8
  ],
9
  "dependencies": {
10
+ "@react-hook/debounce": "^3.0.0",
11
+ "@rjsf/core": "^2.3.0",
12
  "@wordpress/a11y": "^2.11.0",
13
  "@wordpress/api-fetch": "^3.18.0",
14
  "@wordpress/autop": "^2.9.0",
core/packages/components/src/index.js CHANGED
@@ -12,4 +12,5 @@ export { default as NoticeList } from './notice-list';
12
  export { default as ModuleSettingsNoticeList } from './module-settings-notice-list';
13
  export { default as ToggleControl } from './toggle-control';
14
  export { default as CheckboxControl } from './checkbox-control';
 
15
  export { default as TabPanel, ControlledTabPanel, ControlledMultiTabPanel } from './tab-panel';
12
  export { default as ModuleSettingsNoticeList } from './module-settings-notice-list';
13
  export { default as ToggleControl } from './toggle-control';
14
  export { default as CheckboxControl } from './checkbox-control';
15
+ export { default as SelectControl } from './select-control';
16
  export { default as TabPanel, ControlledTabPanel, ControlledMultiTabPanel } from './tab-panel';
core/packages/components/src/select-control/index.js ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { isEmpty, groupBy, map } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useInstanceId } from '@wordpress/compose';
10
+ import { BaseControl } from '@wordpress/components';
11
+
12
+ export default function SelectControl( {
13
+ help,
14
+ label,
15
+ multiple = false,
16
+ onChange,
17
+ options = [],
18
+ className,
19
+ hideLabelFromVision,
20
+ ...props
21
+ } ) {
22
+ const instanceId = useInstanceId( SelectControl );
23
+ const id = `inspector-select-control-${ instanceId }`;
24
+ const onChangeValue = ( event ) => {
25
+ if ( multiple ) {
26
+ const selectedOptions = [ ...event.target.options ].filter(
27
+ ( { selected } ) => selected
28
+ );
29
+ const newValues = selectedOptions.map( ( { value } ) => value );
30
+ onChange( newValues );
31
+ return;
32
+ }
33
+ onChange( event.target.value );
34
+ };
35
+
36
+ const grouped = groupBy( options, 'optgroup' );
37
+
38
+ // Disable reason: A select with an onchange throws a warning
39
+
40
+ /* eslint-disable jsx-a11y/no-onchange */
41
+ return (
42
+ ! isEmpty( options ) && (
43
+ <BaseControl
44
+ label={ label }
45
+ hideLabelFromVision={ hideLabelFromVision }
46
+ id={ id }
47
+ help={ help }
48
+ className={ className }
49
+ >
50
+ <select
51
+ id={ id }
52
+ className="components-select-control__input"
53
+ onChange={ onChangeValue }
54
+ aria-describedby={ !! help ? `${ id }__help` : undefined }
55
+ multiple={ multiple }
56
+ { ...props }
57
+ >
58
+ { map( grouped, ( perGroup, optgroup ) => {
59
+ const optionList = perGroup.map( ( option, index ) => (
60
+ <option
61
+ key={ `${ option.label }-${ option.value }-${ index }` }
62
+ value={ option.value }
63
+ disabled={ option.disabled }
64
+ >
65
+ { option.label }
66
+ </option>
67
+ ) );
68
+
69
+ return optgroup === 'undefined' ? optionList : <optgroup label={ optgroup } key={ optgroup }>{ optionList }</optgroup>;
70
+ } ) }
71
+ </select>
72
+ </BaseControl>
73
+ )
74
+ );
75
+ /* eslint-enable jsx-a11y/no-onchange */
76
+ }
core/packages/components/src/select-control/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/data/src/actions.js CHANGED
@@ -36,5 +36,22 @@ export function receiveUser( user ) {
36
  };
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  export const RECEIVE_INDEX = 'RECEIVE_INDEX';
40
  export const RECEIVE_USER = 'RECEIVE_USER';
 
 
36
  };
37
  }
38
 
39
+ export function receiveActorTypes( types ) {
40
+ return {
41
+ type: RECEIVE_ACTOR_TYPES,
42
+ types,
43
+ };
44
+ }
45
+
46
+ export function receiveActors( type, actors ) {
47
+ return {
48
+ type: RECEIVE_ACTORS,
49
+ actorType: type,
50
+ actors: actors,
51
+ };
52
+ }
53
+
54
  export const RECEIVE_INDEX = 'RECEIVE_INDEX';
55
  export const RECEIVE_USER = 'RECEIVE_USER';
56
+ export const RECEIVE_ACTOR_TYPES = 'RECEIVE_ACTOR_TYPES';
57
+ export const RECEIVE_ACTORS = 'RECEIVE_ACTORS';
core/packages/data/src/bans/actions.js ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { isObject } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { isURL, addQueryArgs, getQueryArg } from '@wordpress/url';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { select, apiFetch, parseFetchResponse } from '../controls';
15
+ import { getSelf } from 'core/packages/utils/src';
16
+
17
+ export const path = '/ithemes-security/v1/bans';
18
+
19
+ export function* query( queryId, queryParams = {} ) {
20
+ let response, items;
21
+
22
+ yield { type: START_QUERY, queryId, queryParams };
23
+
24
+ try {
25
+ response = yield apiFetch( {
26
+ path: addQueryArgs( path, queryParams ),
27
+ parse: false,
28
+ } );
29
+ items = yield parseFetchResponse( response );
30
+ } catch ( error ) {
31
+ yield { type: FAILED_QUERY, queryId, queryParams, error };
32
+
33
+ return error;
34
+ }
35
+
36
+ yield receiveQuery( queryId, queryParams.context || 'view', response, items, 'replace' );
37
+ yield { type: FINISH_QUERY, queryId, queryParams, response };
38
+
39
+ return response;
40
+ }
41
+
42
+ export function* fetchQueryNextPage( queryId, mode = 'append' ) {
43
+ const link = yield select( 'ithemes-security/bans', 'getQueryHeaderLink', queryId, 'next' );
44
+
45
+ if ( ! link ) {
46
+ return [];
47
+ }
48
+
49
+ let response, items;
50
+
51
+ yield { type: START_QUERY, queryId };
52
+
53
+ try {
54
+ response = yield apiFetch( {
55
+ url: link.link,
56
+ parse: false,
57
+ } );
58
+ items = yield parseFetchResponse( response );
59
+ } catch ( error ) {
60
+ yield { type: FAILED_QUERY, queryId, error };
61
+
62
+ return error;
63
+ }
64
+
65
+ const context = getQueryArg( link.link, 'context' ) || 'view';
66
+ yield receiveQuery( queryId, context, response, items, mode );
67
+ yield { type: FINISH_QUERY, queryId, response };
68
+
69
+ return response;
70
+ }
71
+
72
+ export function receiveQuery( queryId, context, response, items, mode ) {
73
+ return {
74
+ type: RECEIVE_QUERY,
75
+ queryId,
76
+ context,
77
+ response,
78
+ items,
79
+ mode,
80
+ };
81
+ }
82
+
83
+ export function receiveBan( ban ) {
84
+ return {
85
+ type: RECEIVE_BAN,
86
+ ban,
87
+ };
88
+ }
89
+
90
+ export function startCreateBan( ban ) {
91
+ return { type: START_CREATE_BAN, ban };
92
+ }
93
+
94
+ export function failedCreateBan( ban, error ) {
95
+ return { type: FAILED_CREATE_BAN, ban, error };
96
+ }
97
+
98
+ export function finishCreateBan( ban, response ) {
99
+ return { type: FINISH_CREATE_BAN, ban, response };
100
+ }
101
+
102
+ export function startUpdateBan( self, ban ) {
103
+ return { type: START_UPDATE_BAN, self, ban };
104
+ }
105
+
106
+ export function failedUpdateBan( self, error ) {
107
+ return { type: FAILED_UPDATE_BAN, self, error };
108
+ }
109
+
110
+ export function finishUpdateBan( self, response ) {
111
+ return { type: FINISH_UPDATE_BAN, self, response };
112
+ }
113
+
114
+ export function startDeleteBan( self ) {
115
+ return { type: START_DELETE_BAN, self };
116
+ }
117
+
118
+ export function failedDeleteBan( self, error ) {
119
+ return { type: FAILED_DELETE_BAN, self, error };
120
+ }
121
+
122
+ export function finishDeleteBan( self ) {
123
+ return { type: FINISH_DELETE_BAN, self };
124
+ }
125
+
126
+ /**
127
+ * Creates a new ban.
128
+ *
129
+ * @param {string} source The ban source or URL to the ban endpoint.
130
+ * @param {Object} ban Ban data.
131
+ * @return {IterableIterator<*>} Iterator
132
+ */
133
+ export function* createBan( source, ban ) {
134
+ const request = {
135
+ method: 'POST',
136
+ data: ban,
137
+ };
138
+
139
+ if ( isURL( source ) ) {
140
+ request.url = source;
141
+ } else {
142
+ request.path = `${ path }/${ source }`;
143
+ }
144
+
145
+ yield startCreateBan( ban );
146
+
147
+ let response;
148
+
149
+ try {
150
+ response = yield apiFetch( request );
151
+ } catch ( e ) {
152
+ yield failedCreateBan( ban, e );
153
+ return e;
154
+ }
155
+
156
+ yield finishCreateBan( ban, response );
157
+ yield receiveBan( response );
158
+
159
+ return response;
160
+ }
161
+
162
+ /**
163
+ * Updates a ban.
164
+ *
165
+ * @param {Object|string} banOrSelf Ban object self link.
166
+ * @param {Object} update Ban data.
167
+ * @return {IterableIterator<*>} Iterator
168
+ */
169
+ export function* updateBan( banOrSelf, update ) {
170
+ const self = isObject( banOrSelf ) ? getSelf( banOrSelf ) : banOrSelf;
171
+ yield startUpdateBan( self, update );
172
+
173
+ let response;
174
+
175
+ try {
176
+ response = yield apiFetch( {
177
+ url: self,
178
+ method: 'PUT',
179
+ data: update,
180
+ } );
181
+ } catch ( e ) {
182
+ yield failedUpdateBan( self, e );
183
+ return e;
184
+ }
185
+
186
+ yield finishUpdateBan( self, response );
187
+ yield receiveBan( response );
188
+
189
+ return response;
190
+ }
191
+
192
+ /**
193
+ * Deletes a ban.
194
+ *
195
+ * @param {Object|string} banOrSelf Ban object or self link.
196
+ * @return {IterableIterator<*>} Iterator
197
+ */
198
+ export function* deleteBan( banOrSelf ) {
199
+ const self = isObject( banOrSelf ) ? getSelf( banOrSelf ) : banOrSelf;
200
+
201
+ yield startDeleteBan( self );
202
+
203
+ try {
204
+ yield apiFetch( {
205
+ url: self,
206
+ method: 'DELETE',
207
+ } );
208
+ } catch ( e ) {
209
+ yield failedDeleteBan( self, e );
210
+ return e;
211
+ }
212
+
213
+ yield finishDeleteBan( self );
214
+
215
+ return null;
216
+ }
217
+
218
+ export const RECEIVE_QUERY = 'RECEIVE_QUERY';
219
+
220
+ export const START_QUERY = 'START_QUERY';
221
+ export const FINISH_QUERY = 'FINISH_QUERY';
222
+ export const FAILED_QUERY = 'FAILED_QUERY';
223
+
224
+ export const START_CREATE_BAN = 'START_CREATE_BAN';
225
+ export const FINISH_CREATE_BAN = 'FINISH_CREATE_BAN';
226
+ export const FAILED_CREATE_BAN = 'FAILED_CREATE_BAN';
227
+
228
+ export const RECEIVE_BAN = 'RECEIVE_BAN';
229
+
230
+ export const START_UPDATE_BAN = 'START_UPDATE_BAN';
231
+ export const FINISH_UPDATE_BAN = 'FINISH_UPDATE_BAN';
232
+ export const FAILED_UPDATE_BAN = 'FAILED_UPDATE_BAN';
233
+
234
+ export const START_DELETE_BAN = 'START_DELETE_BAN';
235
+ export const FINISH_DELETE_BAN = 'FINISH_DELETE_BAN';
236
+ export const FAILED_DELETE_BAN = 'FAILED_DELETE_BAN';
core/packages/data/src/bans/index.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { registerStore } from '@wordpress/data';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import controls from '../controls';
10
+ import * as actions from './actions';
11
+ import * as selectors from './selectors';
12
+ import * as resolvers from './resolvers';
13
+ import reducer from './reducers';
14
+
15
+ registerStore( 'ithemes-security/bans', {
16
+ controls,
17
+ actions,
18
+ selectors,
19
+ resolvers,
20
+ reducer,
21
+ } );
core/packages/data/src/bans/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/data/src/bans/reducers.js ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { get, map, fromPairs, omit } from 'lodash';
5
+ import { parse } from 'li';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { getSelf } from '@ithemes/security-utils';
11
+ import {
12
+ RECEIVE_QUERY,
13
+ RECEIVE_BAN,
14
+ START_QUERY,
15
+ FINISH_QUERY,
16
+ FAILED_QUERY,
17
+ START_CREATE_BAN,
18
+ FINISH_CREATE_BAN,
19
+ FAILED_CREATE_BAN,
20
+ START_UPDATE_BAN,
21
+ FINISH_UPDATE_BAN,
22
+ FAILED_UPDATE_BAN,
23
+ START_DELETE_BAN,
24
+ FINISH_DELETE_BAN,
25
+ FAILED_DELETE_BAN,
26
+ } from './actions';
27
+
28
+ const DEFAULT_STATE = {
29
+ bySelf: {},
30
+ queries: {},
31
+ querying: [],
32
+ creating: [],
33
+ updating: [],
34
+ deleting: [],
35
+ };
36
+
37
+ export default function bans( state = DEFAULT_STATE, action ) {
38
+ switch ( action.type ) {
39
+ case RECEIVE_QUERY:
40
+ return {
41
+ ...state,
42
+ queries: {
43
+ ...state.queries,
44
+ [ action.queryId ]: {
45
+ selves: action.mode === 'replace' ? map( action.items, getSelf ) : [
46
+ ...get( state, [ 'queries', action.queryId, 'selves' ], [] ),
47
+ ...map( action.items, getSelf ),
48
+ ],
49
+ headers: fromPairs( Array.from( action.response.headers.entries() ) ),
50
+ links: parse( action.response.headers.get( 'link' ), { extended: true } ).map( ( link ) => ( {
51
+ ...link,
52
+ rel: link.rel[ 0 ],
53
+ } ) ),
54
+ },
55
+ },
56
+ bySelf: {
57
+ ...state.bySelf,
58
+ ...fromPairs( action.items
59
+ .filter( ( item ) => {
60
+ const self = getSelf( item );
61
+
62
+ if ( ! state.bySelf[ self ] ) {
63
+ return true;
64
+ }
65
+
66
+ return state.bySelf[ self ].context === 'embed' || state.bySelf[ self ].context === action.context;
67
+ } )
68
+ .map( ( item ) => ( [
69
+ getSelf( item ),
70
+ {
71
+ context: action.context,
72
+ item,
73
+ },
74
+ ] ) )
75
+ ),
76
+ },
77
+ };
78
+ case START_QUERY:
79
+ return {
80
+ ...state,
81
+ querying: [
82
+ ...state.querying,
83
+ action.queryId,
84
+ ],
85
+ };
86
+ case FINISH_QUERY:
87
+ case FAILED_QUERY:
88
+ return {
89
+ ...state,
90
+ querying: state.querying.filter( ( queryId ) => queryId !== action.queryId ),
91
+ };
92
+ case RECEIVE_BAN:
93
+ return {
94
+ ...state,
95
+ bySelf: {
96
+ ...state.bySelf,
97
+ [ getSelf( action.ban ) ]: {
98
+ context: 'edit',
99
+ item: action.ban,
100
+ },
101
+ },
102
+ };
103
+ case START_CREATE_BAN:
104
+ return {
105
+ ...state,
106
+ creating: [
107
+ ...state.creating,
108
+ action.ban,
109
+ ],
110
+ };
111
+ case FINISH_CREATE_BAN:
112
+ case FAILED_CREATE_BAN:
113
+ return {
114
+ ...state,
115
+ creating: state.creating.filter( ( ban ) => ban !== action.ban ),
116
+ };
117
+ case START_UPDATE_BAN:
118
+ return {
119
+ ...state,
120
+ updating: [
121
+ ...state.updating,
122
+ action.self,
123
+ ],
124
+ };
125
+ case FINISH_UPDATE_BAN:
126
+ case FAILED_UPDATE_BAN:
127
+ return {
128
+ ...state,
129
+ updating: state.updating.filter( ( self ) => self !== action.self ),
130
+ };
131
+ case START_DELETE_BAN:
132
+ return {
133
+ ...state,
134
+ deleting: [
135
+ ...state.deleting,
136
+ action.self,
137
+ ],
138
+ bySelf: omit( state.bySelf, [ action.self ] ),
139
+ };
140
+ case FINISH_DELETE_BAN:
141
+ case FAILED_DELETE_BAN:
142
+ return {
143
+ ...state,
144
+ deleting: state.deleting.filter( ( self ) => self !== action.self ),
145
+ };
146
+ default:
147
+ return state;
148
+ }
149
+ }
core/packages/data/src/bans/resolvers.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { dispatch } from '../controls';
5
+
6
+ export function *getBans() {
7
+ yield dispatch( 'ithemes-security/bans', 'query', 'main', { per_page: 100 } );
8
+ }
core/packages/data/src/bans/selectors.js ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import createSelector from 'rememo';
5
+ import { find, get, isObject, filter } from 'lodash';
6
+
7
+ /**
8
+ * WordPres dependencies
9
+ */
10
+ import { createRegistrySelector } from '@wordpress/data';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { getSelf } from '@ithemes/security-utils';
16
+
17
+ /**
18
+ * Gets the list of all bans.
19
+ * @type {selector}
20
+ */
21
+ export const getBans = createRegistrySelector( ( select ) => () => select( 'ithemes-security/bans' ).getQueryResults( 'main' ) );
22
+
23
+ /**
24
+ * Gets the items returned by a query.
25
+ *
26
+ * @param {Object} state State object.
27
+ * @param {string} queryId Query id.
28
+ * @return {Array<Object>}
29
+ */
30
+ export const getQueryResults = createSelector(
31
+ ( state, queryId ) => {
32
+ const selves = get( state, [ 'queries', queryId, 'selves' ], [] );
33
+ const bySelf = state.bySelf;
34
+
35
+ const length = selves.length;
36
+ const items = new Array( length );
37
+ let index = -1;
38
+
39
+ while ( ++index < length ) {
40
+ const entry = bySelf[ selves[ index ] ];
41
+
42
+ if ( entry ) {
43
+ items[ index ] = entry.item;
44
+ }
45
+ }
46
+
47
+ return items;
48
+ },
49
+ ( state, queryId ) => [ state.queries[ queryId ], state.bySelf ]
50
+ );
51
+
52
+ /**
53
+ * Gets the link header from a query result.
54
+ *
55
+ * @param {Object} state State object.
56
+ * @param {string} queryId Query id.
57
+ * @param {string} rel Rel to search for.
58
+ * @return {{link: string, rel: string}} Link object or undefined if not found.
59
+ */
60
+ export function getQueryHeaderLink( state, queryId, rel ) {
61
+ return find( get( state, [ 'queries', queryId, 'links' ], [] ), { rel } );
62
+ }
63
+
64
+ /**
65
+ * Gets the link headers from a query result.
66
+ *
67
+ * @param {Object} state State object.
68
+ * @param {string} queryId Query id.
69
+ * @param {string} rel Rel to search for.
70
+ * @return {Array<{link: string, rel: string}>} Link object or undefined if not found.
71
+ */
72
+ export function getQueryHeaderLinks( state, queryId, rel ) {
73
+ return filter( get( state, [ 'queries', queryId, 'links' ], [] ), { rel } );
74
+ }
75
+
76
+ /**
77
+ * Get a response header from a query.
78
+ *
79
+ * @param {Object} state State object.
80
+ * @param {string} queryId Query id.
81
+ * @param {string} header Normalized header name.
82
+ * @return {string|undefined} The header value, or undefined if it does not exist.
83
+ */
84
+ export function getQueryHeader( state, queryId, header ) {
85
+ return get( state, [ 'queries', queryId, 'headers', header ] );
86
+ }
87
+
88
+ /**
89
+ * Gets a ban by its self link.
90
+ *
91
+ * @param {Object} state Store data.
92
+ * @param {string} self Self link.
93
+ * @return {Object|undefined}
94
+ */
95
+ export function getBan( state, self ) {
96
+ return state.bySelf[ self ];
97
+ }
98
+
99
+ /**
100
+ * Checks if the given ban is being updated.
101
+ * @param {Object} state Store data.
102
+ * @param {string} banOrSelf Ban object or self link.
103
+ * @return {boolean}
104
+ */
105
+ export function isUpdating( state, banOrSelf ) {
106
+ const self = isObject( banOrSelf ) ? getSelf( banOrSelf ) : banOrSelf;
107
+
108
+ return state.updating.includes( self );
109
+ }
110
+
111
+ /**
112
+ * Checks if the given ban is being deleted.
113
+ * @param {Object} state Store data.
114
+ * @param {string} banOrSelf Ban object or self link.
115
+ * @return {boolean}
116
+ */
117
+ export function isDeleting( state, banOrSelf ) {
118
+ const self = isObject( banOrSelf ) ? getSelf( banOrSelf ) : banOrSelf;
119
+
120
+ return state.deleting.includes( self );
121
+ }
122
+
123
+ /**
124
+ * Checks if a query is in progress.
125
+ *
126
+ * @param {Object} state Store data.
127
+ * @param {string} queryId The query id.
128
+ * @return {boolean}
129
+ */
130
+ export function isQuerying( state, queryId ) {
131
+ return state.querying.includes( queryId );
132
+ }
core/packages/data/src/controls.js CHANGED
@@ -80,7 +80,7 @@ export function select( storeKey, selectorName, ...args ) {
80
  *
81
  * @param {string} storeKey The key for the store the action belongs to
82
  * @param {string} actionName The name of the action to dispatch
83
- * @param {Array} args Arguments for the dispatch action.
84
  *
85
  * @example
86
  * ```js
@@ -103,6 +103,28 @@ export function dispatch( storeKey, actionName, ...args ) {
103
  args,
104
  };
105
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  /**
108
  * Yields action objects used in signalling that a notice is to be created.
@@ -159,6 +181,7 @@ const controls = {
159
  DISPATCH( { storeKey, actionName, args } ) {
160
  return dispatchData( storeKey )[ actionName ]( ...args );
161
  },
 
162
  CREATE_NOTICE( { status, content, options } ) {
163
  if ( options.autoDismiss ) {
164
  options.id = options.id || uniqueId( 'itsec-auto-dismiss-' );
80
  *
81
  * @param {string} storeKey The key for the store the action belongs to
82
  * @param {string} actionName The name of the action to dispatch
83
+ * @param {...*} args Arguments for the dispatch action.
84
  *
85
  * @example
86
  * ```js
103
  args,
104
  };
105
  }
106
+ /**
107
+ * Parses the fetch response.
108
+ *
109
+ * @param {Response} response The response object from apiFetch.
110
+ * @return {{response: *, type: string}} Data control.
111
+ */
112
+ export function parseFetchResponse( response ) {
113
+ return {
114
+ type: 'PARSE_FETCH_RESPONSE',
115
+ response,
116
+ };
117
+ }
118
+
119
+ /**
120
+ * Parse the fetch response into an object with data and headers.
121
+ *
122
+ * @param {Response} response The response object from apiFetch.
123
+ * @return {Promise<*>} Parsed response object.
124
+ */
125
+ async function PARSE_FETCH_RESPONSE( { response } ) {
126
+ return await response.json();
127
+ }
128
 
129
  /**
130
  * Yields action objects used in signalling that a notice is to be created.
181
  DISPATCH( { storeKey, actionName, args } ) {
182
  return dispatchData( storeKey )[ actionName ]( ...args );
183
  },
184
+ PARSE_FETCH_RESPONSE,
185
  CREATE_NOTICE( { status, content, options } ) {
186
  if ( options.autoDismiss ) {
187
  options.id = options.id || uniqueId( 'itsec-auto-dismiss-' );
core/packages/data/src/index.js CHANGED
@@ -6,6 +6,7 @@ import { registerStore } from '@wordpress/data';
6
  /**
7
  * Internal dependencies
8
  */
 
9
  import controls from './controls';
10
  import * as selectors from './selectors';
11
  import * as resolvers from './resolvers';
6
  /**
7
  * Internal dependencies
8
  */
9
+ import './bans';
10
  import controls from './controls';
11
  import * as selectors from './selectors';
12
  import * as resolvers from './resolvers';
core/packages/data/src/reducers.js CHANGED
@@ -1,13 +1,17 @@
1
  /**
2
  * Internal dependencies
3
  */
4
- import { RECEIVE_INDEX, RECEIVE_USER } from './actions';
5
 
6
  const DEFAULT_STATE = {
7
  users: {
8
  byId: {},
9
  },
10
  index: null,
 
 
 
 
11
  };
12
 
13
  export default function reducer( state = DEFAULT_STATE, action ) {
@@ -28,6 +32,25 @@ export default function reducer( state = DEFAULT_STATE, action ) {
28
  },
29
  },
30
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  default:
32
  return state;
33
  }
1
  /**
2
  * Internal dependencies
3
  */
4
+ import { RECEIVE_ACTOR_TYPES, RECEIVE_ACTORS, RECEIVE_INDEX, RECEIVE_USER } from './actions';
5
 
6
  const DEFAULT_STATE = {
7
  users: {
8
  byId: {},
9
  },
10
  index: null,
11
+ actors: {
12
+ types: [],
13
+ byType: {},
14
+ },
15
  };
16
 
17
  export default function reducer( state = DEFAULT_STATE, action ) {
32
  },
33
  },
34
  };
35
+ case RECEIVE_ACTOR_TYPES:
36
+ return {
37
+ ...state,
38
+ actors: {
39
+ ...state.actors,
40
+ types: action.types,
41
+ },
42
+ };
43
+ case RECEIVE_ACTORS:
44
+ return {
45
+ ...state,
46
+ actors: {
47
+ ...state.actors,
48
+ byType: {
49
+ ...state.actors.byType,
50
+ [ action.actorType ]: action.actors,
51
+ },
52
+ },
53
+ };
54
  default:
55
  return state;
56
  }
core/packages/data/src/resolvers.js CHANGED
@@ -1,8 +1,13 @@
 
 
 
 
 
1
  /**
2
  * Internal dependencies
3
  */
4
- import { apiFetch } from './controls';
5
- import { receiveIndex, receiveUser } from './actions';
6
 
7
  export function* getIndex() {
8
  const index = yield apiFetch( { path: '/ithemes-security/v1?context=help' } );
@@ -10,7 +15,7 @@ export function* getIndex() {
10
  }
11
 
12
  export const getUser = {
13
- *fulfill( userId ) {
14
  const user = yield apiFetch( {
15
  path: `/wp/v2/users/${ userId }`,
16
  } );
@@ -22,3 +27,34 @@ export const getUser = {
22
  },
23
  };
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { get } from 'lodash';
5
+
6
  /**
7
  * Internal dependencies
8
  */
9
+ import { apiFetch, select } from './controls';
10
+ import { receiveActors, receiveActorTypes, receiveIndex, receiveUser } from './actions';
11
 
12
  export function* getIndex() {
13
  const index = yield apiFetch( { path: '/ithemes-security/v1?context=help' } );
15
  }
16
 
17
  export const getUser = {
18
+ * fulfill( userId ) {
19
  const user = yield apiFetch( {
20
  path: `/wp/v2/users/${ userId }`,
21
  } );
27
  },
28
  };
29
 
30
+ export const getActorTypes = {
31
+ * fulfill() {
32
+ const response = yield apiFetch( {
33
+ path: '/ithemes-security/v1/actors?_embed=1',
34
+ } );
35
+
36
+ const types = [];
37
+
38
+ for ( const type of response ) {
39
+ const actors = get( type, [ '_embedded', 'wp:items', 0 ], [] );
40
+
41
+ yield receiveActors( type.slug, actors );
42
+ types.push( { slug: type.slug, label: type.label } );
43
+ }
44
+
45
+ yield receiveActorTypes( types );
46
+ },
47
+
48
+ isFulfilled( state ) {
49
+ return state.actors.types.length > 0;
50
+ },
51
+ };
52
+
53
+ export const getActors = {
54
+ *fulfill() {
55
+ yield select( 'ithemes-security/core', 'getActorTypes' );
56
+ },
57
+ isFulfilled( state, type ) {
58
+ return !! state.actors.byType[ type ];
59
+ },
60
+ };
core/packages/data/src/selectors.js CHANGED
@@ -54,3 +54,11 @@ export function getRoles() {
54
 
55
  return index.roles;
56
  }
 
 
 
 
 
 
 
 
54
 
55
  return index.roles;
56
  }
57
+
58
+ export function getActorTypes( state ) {
59
+ return state.actors.types;
60
+ }
61
+
62
+ export function getActors( state, type ) {
63
+ return state.actors.byType[ type ];
64
+ }
core/packages/rjsf-theme/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/error-list/index.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ export default function ErrorList( { errors } ) {
7
+ return (
8
+ <div className="itsec-rjsf-error-list">
9
+ <h3>{ __( 'Errors', 'better-wp-security' ) }</h3>
10
+ <ul>
11
+ { errors.map( ( error, i ) => {
12
+ return (
13
+ <li key={ i }>
14
+ { error.stack }
15
+ </li>
16
+ );
17
+ } ) }
18
+ </ul>
19
+ </div>
20
+ );
21
+ }
core/packages/rjsf-theme/src/error-list/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/field-template/index.js ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { utils } from '@rjsf/core';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { Button, TextControl } from '@wordpress/components';
10
+
11
+ const { ADDITIONAL_PROPERTY_FLAG } = utils;
12
+
13
+ export default function FieldTemplate( props ) {
14
+ const {
15
+ children,
16
+ errors,
17
+ hidden,
18
+ } = props;
19
+
20
+ if ( hidden ) {
21
+ /*return <div className="hidden">{ children }</div>;*/
22
+ return null;
23
+ }
24
+
25
+ return (
26
+ <WrapIfAdditional { ...props }>
27
+ { children }
28
+ { ( ! props.formContext || ! props.formContext.disableInlineErrors ) && errors }
29
+ </WrapIfAdditional>
30
+ );
31
+ }
32
+
33
+ function WrapIfAdditional( props ) {
34
+ const {
35
+ id,
36
+ classNames,
37
+ disabled,
38
+ label,
39
+ onKeyChange,
40
+ onDropPropertyClick,
41
+ readonly,
42
+ required,
43
+ schema,
44
+ } = props;
45
+ const keyLabel = `${ label } Key`; // i18n ?
46
+ const additional = schema.hasOwnProperty( ADDITIONAL_PROPERTY_FLAG );
47
+
48
+ if ( ! additional ) {
49
+ return <div className={ classNames }>{ props.children }</div>;
50
+ }
51
+
52
+ return (
53
+ <div className={ classNames }>
54
+ <div className="row">
55
+ <div className="col-xs-5 form-additional">
56
+ <TextControl
57
+ label={ keyLabel }
58
+ required={ required }
59
+ id={ `${ id }-key` }
60
+ onBlur={ ( e ) => onKeyChange( e.target.value ) }
61
+ />
62
+ </div>
63
+ <div className="form-additional form-group col-xs-5">
64
+ { props.children }
65
+ </div>
66
+ <div className="col-xs-2">
67
+ <Button
68
+ icon="no-alt"
69
+ isDestrictuve
70
+ disabled={ disabled || readonly }
71
+ onClick={ onDropPropertyClick( label ) }
72
+ />
73
+ </div>
74
+ </div>
75
+ </div>
76
+ );
77
+ }
core/packages/rjsf-theme/src/field-template/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/index.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import widgets from './widgets';
5
+ import FieldTemplate from './field-template';
6
+ import ErrorList from './error-list';
7
+
8
+ const theme = {
9
+ FieldTemplate,
10
+ ErrorList,
11
+ widgets,
12
+ };
13
+
14
+ export default theme;
core/packages/rjsf-theme/src/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/widgets/base-input/index.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { without } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { TextControl } from '@wordpress/components';
10
+
11
+ function BaseInput( props ) {
12
+ const {
13
+ id,
14
+ label,
15
+ value,
16
+ readonly,
17
+ disabled,
18
+ onBlur,
19
+ onFocus,
20
+ options,
21
+ onChange,
22
+ schema,
23
+ uiSchema = {},
24
+ ...inputProps
25
+ } = props;
26
+
27
+ // If options.inputType is set use that as the input type
28
+ if ( options.inputType ) {
29
+ inputProps.type = options.inputType;
30
+ } else if ( ! inputProps.type ) {
31
+ // If the schema is of type number or integer, set the input type to number
32
+ if ( schema.type === 'number' ) {
33
+ inputProps.type = 'number';
34
+ // Setting step to 'any' fixes a bug in Safari where decimals are not
35
+ // allowed in number inputs
36
+ inputProps.step = 'any';
37
+ } else if ( schema.type === 'integer' ) {
38
+ inputProps.type = 'number';
39
+ // Since this is integer, you always want to step up or down in multiples
40
+ // of 1
41
+ inputProps.step = '1';
42
+ } else {
43
+ inputProps.type = 'text';
44
+ }
45
+ }
46
+
47
+ if ( options.autocomplete ) {
48
+ inputProps.autoComplete = options.autocomplete;
49
+ }
50
+
51
+ // If multipleOf is defined, use this as the step value. This mainly improves
52
+ // the experience for keyboard users (who can use the up/down KB arrows).
53
+ if ( schema.multipleOf ) {
54
+ inputProps.step = schema.multipleOf;
55
+ }
56
+
57
+ if ( typeof schema.minimum !== 'undefined' ) {
58
+ inputProps.min = schema.minimum;
59
+ }
60
+
61
+ if ( typeof schema.maximum !== 'undefined' ) {
62
+ inputProps.max = schema.maximum;
63
+ }
64
+
65
+ return (
66
+ <TextControl
67
+ id={ id }
68
+ label={ label }
69
+ help={ uiSchema[ 'ui:description' ] || schema.description }
70
+ readOnly={ readonly }
71
+ disabled={ disabled }
72
+ value={ value ? value : '' }
73
+ { ...without( inputProps, [ 'autofocus', 'formContext', 'registry', 'rawErrors' ] ) }
74
+ onChange={ ( newValue ) => onChange( newValue === '' ? options.emptyValue : newValue ) }
75
+ onBlur={ onBlur && ( ( e ) => onBlur( inputProps.id, e.target.value ) ) }
76
+ onFocus={ onFocus && ( ( e ) => onFocus( inputProps.id, e.target.value ) ) }
77
+ />
78
+ );
79
+ }
80
+
81
+ export default BaseInput;
core/packages/rjsf-theme/src/widgets/base-input/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/widgets/checkbox-widget/index.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { utils } from '@rjsf/core';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { CheckboxControl } from '@wordpress/components';
10
+
11
+ export default function CheckboxWidget( {
12
+ schema,
13
+ uiSchema = {},
14
+ id,
15
+ value,
16
+ disabled,
17
+ readonly,
18
+ label,
19
+ onBlur,
20
+ onFocus,
21
+ onChange,
22
+ } ) {
23
+ const required = utils.schemaRequiresTrueValue( schema );
24
+
25
+ return (
26
+ <CheckboxControl
27
+ id={ id }
28
+ value={ value }
29
+ onChange={ onChange }
30
+ required={ required }
31
+ disabled={ disabled }
32
+ readonly={ readonly }
33
+ label={ label }
34
+ help={ uiSchema[ 'ui:description' ] || schema.description }
35
+ onBlur={ onBlur && ( ( e ) => onBlur( id, e.target.checked ) ) }
36
+ onFocus={ onFocus && ( ( e ) => onFocus( id, e.target.checked ) ) }
37
+ />
38
+ );
39
+ }
core/packages/rjsf-theme/src/widgets/checkbox-widget/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/widgets/index.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import BaseInput from './base-input';
2
+ import CheckboxWidget from './checkbox-widget';
3
+ import SelectWidget from './select-widget';
4
+ import TextareaWidget from './textarea-widget';
5
+
6
+ export default {
7
+ BaseInput,
8
+ CheckboxWidget,
9
+ SelectWidget,
10
+ TextareaWidget,
11
+ };
core/packages/rjsf-theme/src/widgets/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/widgets/select-widget/index.js ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { utils } from '@rjsf/core';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { SelectControl } from '@wordpress/components';
10
+
11
+ const { asNumber, guessType } = utils;
12
+ const nums = new Set( [ 'number', 'integer' ] );
13
+
14
+ /**
15
+ * This is a silly limitation in the DOM where option change event values are
16
+ * always retrieved as strings.
17
+ *
18
+ * @param {Object} schema
19
+ * @param {string} schema.type
20
+ * @param {Array} schema.enum
21
+ * @param {*} value
22
+ *
23
+ * @return {*}
24
+ */
25
+ function processValue( schema, value ) {
26
+ // "enum" is a reserved word, so only "type" and "items" can be destructured
27
+ const { type, items } = schema;
28
+ if ( value === '' ) {
29
+ return undefined;
30
+ } else if ( type === 'array' && items && nums.has( items.type ) ) {
31
+ return value.map( asNumber );
32
+ } else if ( type === 'boolean' ) {
33
+ return value === 'true';
34
+ } else if ( type === 'number' ) {
35
+ return asNumber( value );
36
+ }
37
+
38
+ // If type is undefined, but an enum is present, try and infer the type from
39
+ // the enum values
40
+ if ( schema.enum ) {
41
+ if ( schema.enum.every( ( x ) => guessType( x ) === 'number' ) ) {
42
+ return asNumber( value );
43
+ } else if ( schema.enum.every( ( x ) => guessType( x ) === 'boolean' ) ) {
44
+ return value === 'true';
45
+ }
46
+ }
47
+
48
+ return value;
49
+ }
50
+
51
+ function getValue( event, multiple ) {
52
+ if ( multiple ) {
53
+ return [].slice
54
+ .call( event.target.options )
55
+ .filter( ( o ) => o.selected )
56
+ .map( ( o ) => o.value );
57
+ }
58
+ return event.target.value;
59
+ }
60
+
61
+ function SelectWidget( props ) {
62
+ const {
63
+ schema,
64
+ uiSchema = {},
65
+ id,
66
+ options,
67
+ value,
68
+ label,
69
+ required,
70
+ disabled,
71
+ readonly,
72
+ multiple,
73
+ onChange,
74
+ onBlur,
75
+ onFocus,
76
+ placeholder,
77
+ } = props;
78
+ const { enumOptions, enumDisabled } = options;
79
+ const emptyValue = multiple ? [] : '';
80
+
81
+ const optionsList = [];
82
+
83
+ if ( ! multiple && schema.default === undefined ) {
84
+ optionsList.push( { value: '', label: placeholder } );
85
+ }
86
+
87
+ for ( const option of enumOptions ) {
88
+ optionsList.push( {
89
+ ...option,
90
+ disabled: enumDisabled && enumDisabled.includes( option.value ),
91
+ } );
92
+ }
93
+
94
+ return (
95
+ <SelectControl
96
+ id={ id }
97
+ multiple={ multiple }
98
+ options={ optionsList }
99
+ value={ typeof value === 'undefined' ? emptyValue : value }
100
+ label={ label }
101
+ help={ uiSchema[ 'ui:description' ] || schema.description }
102
+ required={ required }
103
+ disabled={ disabled }
104
+ readOnly={ readonly }
105
+ onChange={ ( newValue ) => onChange( processValue( schema, newValue ) ) }
106
+ onBlur={ onBlur && ( ( e ) => onBlur( id, processValue( schema, getValue( e, multiple ) ) ) ) }
107
+ onFocus={ onFocus && ( ( e ) => onFocus( id, processValue( schema, getValue( e, multiple ) ) ) ) }
108
+ />
109
+ );
110
+ }
111
+
112
+ export default SelectWidget;
core/packages/rjsf-theme/src/widgets/select-widget/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/rjsf-theme/src/widgets/textarea-widget/index.js ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { without } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { TextareaControl } from '@wordpress/components';
10
+
11
+ export default function TextareaWidget( {
12
+ schema,
13
+ uiSchema = {},
14
+ id,
15
+ value,
16
+ disabled,
17
+ readonly,
18
+ label,
19
+ onBlur,
20
+ onFocus,
21
+ onChange,
22
+ ...inputProps
23
+ } ) {
24
+ return (
25
+ <TextareaControl
26
+ id={ id }
27
+ value={ typeof value === 'undefined' ? '' : value }
28
+ onChange={ onChange }
29
+ disabled={ disabled }
30
+ readOnly={ readonly }
31
+ label={ label }
32
+ help={ uiSchema[ 'ui:description' ] || schema.description }
33
+ onBlur={ onBlur && ( ( e ) => onBlur( id, e.target.value ) ) }
34
+ onFocus={ onFocus && ( ( e ) => onFocus( id, e.target.value ) ) }
35
+ { ...without( inputProps, [ 'autofocus', 'formContext', 'registry', 'rawErrors' ] ) }
36
+ />
37
+ );
38
+ }
core/packages/rjsf-theme/src/widgets/textarea-widget/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden.
core/packages/utils/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
  /**
2
  * External dependencies
3
  */
4
- import { get, isPlainObject } from 'lodash';
5
 
6
  /**
7
  * Internal dependencies
@@ -180,6 +180,18 @@ export function responseToError( response ) {
180
 
181
  export const MYSTERY_MAN_AVATAR = 'https://secure.gravatar.com/avatar/d7a973c7dab26985da5f961be7b74480?s=96&d=mm&f=y&r=g';
182
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  /**
184
  * Get the "self" link for a REST API object.
185
  *
@@ -220,3 +232,36 @@ export function getSchemaLink( schema, rel ) {
220
  }
221
  }
222
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /**
2
  * External dependencies
3
  */
4
+ import { get, isPlainObject, cloneDeep } from 'lodash';
5
 
6
  /**
7
  * Internal dependencies
180
 
181
  export const MYSTERY_MAN_AVATAR = 'https://secure.gravatar.com/avatar/d7a973c7dab26985da5f961be7b74480?s=96&d=mm&f=y&r=g';
182
 
183
+ /**
184
+ * Gets a targetHint from an object.
185
+ *
186
+ * @param {Object} object
187
+ * @param {string} header
188
+ * @param {boolean} undefinedIfEmpty
189
+ * @return {Array<string>|undefined}
190
+ */
191
+ export function getTargetHint( object, header, undefinedIfEmpty = true ) {
192
+ return get( object, [ '_links', 'self', 0, 'targetHints', header ], undefinedIfEmpty ? undefined : [] );
193
+ }
194
+
195
  /**
196
  * Get the "self" link for a REST API object.
197
  *
232
  }
233
  }
234
  }
235
+
236
+ /**
237
+ * Modifies a schema by its ui schema.
238
+ *
239
+ * This will remove any hidden fields from the actual schema document.
240
+ *
241
+ * @param {Object} schema
242
+ * @param {Object} uiSchema
243
+ * @return {Object}
244
+ */
245
+ export function modifySchemaByUiSchema( schema, uiSchema ) {
246
+ if ( schema.type !== 'object' ) {
247
+ return schema;
248
+ }
249
+
250
+ let modified;
251
+
252
+ for ( const property in uiSchema ) {
253
+ if ( ! uiSchema.hasOwnProperty( property ) ) {
254
+ continue;
255
+ }
256
+
257
+ if ( uiSchema[ property ][ 'ui:widget' ] === 'hidden' ) {
258
+ if ( ! modified ) {
259
+ modified = cloneDeep( schema );
260
+ }
261
+
262
+ delete modified.properties[ property ];
263
+ }
264
+ }
265
+
266
+ return modified || schema;
267
+ }
core/packages/webpack/src/config/index.js CHANGED
@@ -177,6 +177,7 @@ module.exports = function makeConfig( directory, pro ) {
177
  '@ithemes/security-components': path.resolve( directory, './core/packages/components/src/index.js' ),
178
  '@ithemes/security-i18n': path.resolve( directory, './core/packages/i18n/src/index.js' ),
179
  '@ithemes/security-data': path.resolve( directory, './core/packages/data/src/index.js' ),
 
180
  ...Object.keys( entries ).reduce( function( acc, entry ) {
181
  const parts = entry.split( '/' );
182
  const alias = `@ithemes/security.${ parts[ 0 ] }.${ parts[ 1 ] }`;
177
  '@ithemes/security-components': path.resolve( directory, './core/packages/components/src/index.js' ),
178
  '@ithemes/security-i18n': path.resolve( directory, './core/packages/i18n/src/index.js' ),
179
  '@ithemes/security-data': path.resolve( directory, './core/packages/data/src/index.js' ),
180
+ '@ithemes/security-rjsf-theme': path.resolve( directory, './core/packages/rjsf-theme/src/index.js' ),
181
  ...Object.keys( entries ).reduce( function( acc, entry ) {
182
  const parts = entry.split( '/' );
183
  const alias = `@ithemes/security.${ parts[ 0 ] }.${ parts[ 1 ] }`;
core/rest.php CHANGED
@@ -17,6 +17,7 @@ class ITSEC_REST {
17
  */
18
  public function rest_api_init() {
19
  ITSEC_Modules::load_module_file( 'rest.php', ':active' );
 
20
  }
21
 
22
  /**
17
  */
18
  public function rest_api_init() {
19
  ITSEC_Modules::load_module_file( 'rest.php', ':active' );
20
+ ITSEC_Modules::get_container()->get( \iThemesSecurity\Ban_Hosts\REST::class )->register_routes();
21
  }
22
 
23
  /**
core/setup.php CHANGED
@@ -9,6 +9,7 @@
9
  final class ITSEC_Setup {
10
  private static $protected = [
11
  4117,
 
12
  ];
13
 
14
  /**
9
  final class ITSEC_Setup {
10
  private static $protected = [
11
  4117,
12
+ 4121,
13
  ];
14
 
15
  /**
dist/core/admin-notices-api.min.js CHANGED
@@ -1 +1 @@
1
- this.itsec=this.itsec||{},this.itsec.core=this.itsec.core||{},this.itsec.core["admin-notices-api"]=function(t){function e(e){for(var r,u,c=e[0],a=e[1],s=e[2],l=0,d=[];l<c.length;l++)u=c[l],i[u]&&d.push(i[u][0]),i[u]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r]);for(f&&f(e);d.length;)d.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var t,e=0;e<o.length;e++){for(var n=o[e],r=!0,c=1;c<n.length;c++){var a=n[c];0!==i[a]&&(r=!1)}r&&(o.splice(e--,1),t=u(u.s=n[0]))}return t}var r={},i={2:0},o=[];function u(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=t,u.c=r,u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},u.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(t,e){if(1&e&&(t=u(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)u.d(n,r,function(e){return t[e]}.bind(null,r));return n},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="";var c=window.itsecWebpackJsonP=window.itsecWebpackJsonP||[],a=c.push.bind(c);c.push=e,c=c.slice();for(var s=0;s<c.length;s++)e(c[s]);var f=a;return o.push(["M/oR",0]),n()}({"1ZqX":function(t,e){!function(){t.exports=this.wp.data}()},"M/oR":function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"receiveNotices",function(){return O}),n.d(r,"startNoticeAction",function(){return E}),n.d(r,"finishNoticeAction",function(){return _}),n.d(r,"failedNoticeAction",function(){return A}),n.d(r,"receiveMutedHighlights",function(){return T}),n.d(r,"startUpdateMutedHighlight",function(){return w}),n.d(r,"finishUpdateMutedHighlight",function(){return H}),n.d(r,"failedUpdateMutedHighlight",function(){return j}),n.d(r,"doNoticeAction",function(){return S}),n.d(r,"updateMutedHighlight",function(){return P}),n.d(r,"RECEIVE_NOTICES",function(){return N}),n.d(r,"START_NOTICE_ACTION",function(){return x}),n.d(r,"FINISH_NOTICE_ACTION",function(){return M}),n.d(r,"FAILED_NOTICE_ACTION",function(){return C}),n.d(r,"RECEIVE_MUTED_HIGHLIGHTS",function(){return U}),n.d(r,"START_UPDATE_MUTED_HIGHLIGHT",function(){return D}),n.d(r,"FINISH_UPDATE_MUTED_HIGHLIGHT",function(){return k}),n.d(r,"FAILED_UPDATE_MUTED_HIGHLIGHT",function(){return R});var i={};n.r(i),n.d(i,"isResolving",function(){return F}),n.d(i,"isResolved",function(){return G}),n.d(i,"getNotices",function(){return L}),n.d(i,"areNoticesLoaded",function(){return q}),n.d(i,"isDoingAction",function(){return W}),n.d(i,"getInProgressActions",function(){return V}),n.d(i,"getMutedHighlights",function(){return Y}),n.d(i,"getMutedHighlightUpdatesInFlight",function(){return Z});var o={};n.r(o),n.d(o,"getNotices",function(){return K}),n.d(o,"getMutedHighlights",function(){return Q});var u=n("1ZqX"),c=n("RIqP"),a=n.n(c),s=n("lSNA"),f=n.n(s),l=n("YLtl"),d=n("ywyh"),h=n.n(d),g=n("Td6G");function p(t){return{type:"API_FETCH",request:t}}var v={API_FETCH:function(t){var e=t.request;return h()(e).catch(g.e)},SELECT:function(t){var e,n=t.selectorName,r=t.args;return(e=Object(u.select)("ithemes-security/admin-notices"))[n].apply(e,a()(r))},CREATE_NOTICE:function(t){var e=t.status,n=t.content,r=t.options;r.autoDismiss&&(r.id=r.id||Object(l.uniqueId)("itsec-auto-dismiss-"),setTimeout(function(){return Object(u.dispatch)("core/notices").removeNotice(r.id,r.context)},r.autoDismiss)),Object(u.dispatch)("core/notices").createNotice(e,n,r)}},y=n("o0o1"),m=n.n(y),b=m.a.mark(S),I=m.a.mark(P);function O(t){return{type:N,notices:t}}function E(t,e){return{type:x,noticeId:t,actionId:e}}function _(t,e,n){return{type:M,noticeId:t,actionId:e,response:n}}function A(t,e,n){return{type:C,noticeId:t,actionId:e,error:n}}function T(t){return{type:U,mutedHighlights:t}}function w(t,e){return{type:D,slug:t,mute:e}}function H(t,e){return{type:k,slug:t,mute:e}}function j(t,e,n){return{type:R,slug:t,mute:e,error:n}}function S(t,e){var n,r,i=arguments;return m.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:{},o.next=3,E(t,e);case 3:return o.prev=3,o.next=6,p({path:"/ithemes-security/v1/admin-notices/".concat(t,"/").concat(e),method:"POST",data:n});case 6:r=o.sent,o.next=14;break;case 9:return o.prev=9,o.t0=o.catch(3),o.next=13,A(t,e,o.t0);case 13:return o.abrupt("return",o.t0);case 14:return o.next=16,_(t,e,r);case 16:return o.abrupt("return",r);case 17:case"end":return o.stop()}},b,null,[[3,9]])}function P(t,e){var n;return m.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,w(t,e);case 2:return r.prev=2,r.next=5,p({path:"/ithemes-security/v1/admin-notices/settings",method:"PUT",data:{muted_highlights:f()({},t,e)}});case 5:n=r.sent,r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(2),r.next=12,j(t,e,r.t0);case 12:return r.abrupt("return",r.t0);case 13:return r.next=15,H(t,e);case 15:return r.abrupt("return",n);case 16:case"end":return r.stop()}},I,null,[[2,8]])}var N="RECEIVE_NOTICES",x="START_NOTICE_ACTION",M="FINISH_NOTICE_ACTION",C="FAILED_NOTICE_ACTION",U="RECEIVE_MUTED_HIGHLIGHTS",D="START_UPDATE_MUTED_HIGHLIGHT",k="FINISH_UPDATE_MUTED_HIGHLIGHT",R="FAILED_UPDATE_MUTED_HIGHLIGHT";function F(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Object(u.select)("core/data").isResolving("ithemes-security/admin-notices",t,n)}function G(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Object(u.select)("core/data").hasFinishedResolution("ithemes-security/admin-notices",t,n)}function L(t){return t.notices}function q(){return G("getNotices")}function W(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return!!t.doingActions[e]&&(""===n||t.doingActions[e].includes(n))}var J=[];function V(t,e){return t.doingActions[e]||J}function Y(t){return t.mutedHighlights}function Z(t){return t.mutedHighlightUpdatesInFlight}function X(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function $(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?X(Object(n),!0).forEach(function(e){f()(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var z={notices:[],doingActions:{},mutedHighlights:{},mutedHighlightUpdatesInFlight:{}};var B=m.a.mark(Q),K={fulfill:m.a.mark(function t(){var e;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p({path:"/ithemes-security/v1/admin-notices"});case 2:return e=t.sent,t.next=5,O(e);case 5:case"end":return t.stop()}},t)}),shouldInvalidate:function(t){return t.type===M||t.type===k}};function Q(){var t;return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p({path:"/ithemes-security/v1/admin-notices/settings"});case 2:return t=e.sent,e.next=5,T(Object(l.isEmpty)(t.muted_highlights)?{}:t.muted_highlights);case 5:case"end":return e.stop()}},B)}Object(u.registerStore)("ithemes-security/admin-notices",{controls:v,actions:r,selectors:i,resolvers:o,reducer:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case N:return $($({},t),{},{notices:a()(e.notices)});case x:return $($({},t),{},{doingActions:$($({},t.doingActions),{},f()({},e.noticeId,[].concat(a()(t.doingActions[e.noticeId]||[]),[e.actionId])))});case M:case C:return $($({},t),{},{doingActions:$($({},t.doingActions),{},f()({},e.noticeId,(t.doingActions[e.noticeId]||[]).filter(function(t){return t!==e.actionId})))});case U:return $($({},t),{},{mutedHighlights:e.mutedHighlights});case D:return $($({},t),{},{mutedHighlightUpdatesInFlight:$($({},t.mutedHighlightUpdatesInFlight),{},f()({},e.slug,{mute:e.mute}))});case k:return $($({},t),{},{mutedHighlightUpdatesInFlight:Object(l.omit)(t.mutedHighlightUpdatesInFlight,e.slug),mutedHighlights:$($({},t.mutedHighlights),{},f()({},e.slug,e.mute))});case R:return $($({},t),{},{mutedHighlightUpdatesInFlight:Object(l.omit)(t.mutedHighlightUpdatesInFlight,e.slug)});default:return t}}});n.p=window.itsecWebpackPublicPath},Td6G:function(t,e,n){"use strict";n("J4zp");var r=n("YLtl"),i=n("RIqP"),o=n.n(i),u=n("lwsE"),c=n.n(u),a=n("W8MJ"),s=n.n(a),f=n("lSNA"),l=n.n(f),d=n("92Nh"),h=n.n(d),g=n("tmk3"),p=n.n(g);function v(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw o}}}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var m=new WeakMap,b=new WeakMap,I=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;c()(this,t),m.set(this,{writable:!0,value:{}}),b.set(this,{writable:!0,value:{}}),l()(this,"getErrorCodes",function(){return Object.keys(p()(e,m))}),l()(this,"getErrorCode",function(){return e.getErrorCodes()[0]}),l()(this,"getErrorMessages",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(t)return p()(e,m)[t];var n=[];for(var r in p()(e,m))p()(e,m).hasOwnProperty(r)&&n.concat(p()(e,m)[r]);return n}),l()(this,"getErrorMessage",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return t=t||e.getErrorCode(),e.getErrorMessages(t)[0]}),l()(this,"getErrorData",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return t=t||e.getErrorCode(),p()(e,b)[t]}),l()(this,"getAllErrorMessages",function(){var t=[];for(var n in p()(e,m))p()(e,m).hasOwnProperty(n)&&t.push.apply(t,o()(p()(e,m)[n]));return t}),n&&(r&&(p()(this,m)[n]=[r]),i&&(p()(this,b)[n]=i))}return s()(t,null,[{key:"fromPHPObject",value:function(e){var n=new t;return h()(n,m,e.errors),h()(n,b,e.error_data),n}},{key:"fromApiError",value:function(e){var n=new t;if(p()(n,m)[e.code]=[e.message],p()(n,b)[e.code]=e.data,e.additional_errors){var r,i=v(e.additional_errors);try{for(i.s();!(r=i.n()).done;){var o=r.value;p()(n,m)[o.code]=[o.message],p()(n,b)[o.code]=o.data}}catch(t){i.e(t)}finally{i.f()}}return n}}]),t}(),O=n("PJYZ"),E=n.n(O),_=n("7W2i"),A=n.n(_),T=n("a1gu"),w=n.n(T),H=n("Nsbk"),j=n.n(H),S=n("oShl"),P=n.n(S),N=n("l3Sj");function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=j()(t);if(e){var i=j()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w()(this,n)}}var M=function(t){A()(n,t);var e=x(n);function n(t){var r;c()(this,n);for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];for(var a in r=e.call.apply(e,[this,t.message||Object(N.__)("An unknown error occurred.","better-wp-security")].concat(o)),Error.captureStackTrace&&Error.captureStackTrace(E()(r),n),r.__response=t,t)t.hasOwnProperty(a)&&Object.defineProperty(E()(r),a,{value:t[a],configurable:!0,enumerable:!0,writable:!0});return r}return s()(n,[{key:"toString",value:function(){return this.__response.toString()}},{key:"getResponse",value:function(){return this.__response}}]),n}(P()(Error));function C(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw o}}}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t){if(!Object(r.isPlainObject)(t))return!1;var e=Object.keys(t);return 2===e.length&&(e.includes("errors")&&e.includes("error_data"))}function k(t){return D(t)?I.fromPHPObject(t):function(t){if(!Object(r.isPlainObject)(t))return!1;var e=Object.keys(t);return(3===e.length||4===e.length)&&!(4===e.length&&!e.includes("additional_errors"))&&e.includes("code")&&e.includes("message")&&e.includes("data")}(t)?I.fromApiError(t):new I}function R(t,e){var n,r=[[],[]],i=C(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;r[e(o)?0:1].push(o)}}catch(t){i.e(t)}finally{i.f()}return r}function F(t){if(t instanceof Error)throw t;throw new M(t)}n.d(e,"d",function(){return D}),n.d(e,"b",function(){return k}),n.d(e,"a",function(){return R}),n.d(e,"e",function(){return F}),n.d(e,"c",function(){return G});function G(t,e){if(t&&t.links){var n,r=C(t.links);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.rel===e)return i}}catch(t){r.e(t)}finally{r.f()}}}},YLtl:function(t,e){!function(){t.exports=this.lodash}()},l3Sj:function(t,e){!function(){t.exports=this.wp.i18n}()},ywyh:function(t,e){!function(){t.exports=this.wp.apiFetch}()}});
1
+ this.itsec=this.itsec||{},this.itsec.core=this.itsec.core||{},this.itsec.core["admin-notices-api"]=function(t){function e(e){for(var r,u,c=e[0],a=e[1],s=e[2],l=0,d=[];l<c.length;l++)u=c[l],i[u]&&d.push(i[u][0]),i[u]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r]);for(f&&f(e);d.length;)d.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var t,e=0;e<o.length;e++){for(var n=o[e],r=!0,c=1;c<n.length;c++){var a=n[c];0!==i[a]&&(r=!1)}r&&(o.splice(e--,1),t=u(u.s=n[0]))}return t}var r={},i={2:0},o=[];function u(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=t,u.c=r,u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},u.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(t,e){if(1&e&&(t=u(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)u.d(n,r,function(e){return t[e]}.bind(null,r));return n},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="";var c=window.itsecWebpackJsonP=window.itsecWebpackJsonP||[],a=c.push.bind(c);c.push=e,c=c.slice();for(var s=0;s<c.length;s++)e(c[s]);var f=a;return o.push(["M/oR",0]),n()}({"1ZqX":function(t,e){!function(){t.exports=this.wp.data}()},"M/oR":function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"receiveNotices",function(){return O}),n.d(r,"startNoticeAction",function(){return E}),n.d(r,"finishNoticeAction",function(){return _}),n.d(r,"failedNoticeAction",function(){return A}),n.d(r,"receiveMutedHighlights",function(){return T}),n.d(r,"startUpdateMutedHighlight",function(){return w}),n.d(r,"finishUpdateMutedHighlight",function(){return H}),n.d(r,"failedUpdateMutedHighlight",function(){return j}),n.d(r,"doNoticeAction",function(){return S}),n.d(r,"updateMutedHighlight",function(){return P}),n.d(r,"RECEIVE_NOTICES",function(){return N}),n.d(r,"START_NOTICE_ACTION",function(){return x}),n.d(r,"FINISH_NOTICE_ACTION",function(){return M}),n.d(r,"FAILED_NOTICE_ACTION",function(){return C}),n.d(r,"RECEIVE_MUTED_HIGHLIGHTS",function(){return U}),n.d(r,"START_UPDATE_MUTED_HIGHLIGHT",function(){return D}),n.d(r,"FINISH_UPDATE_MUTED_HIGHLIGHT",function(){return k}),n.d(r,"FAILED_UPDATE_MUTED_HIGHLIGHT",function(){return R});var i={};n.r(i),n.d(i,"isResolving",function(){return F}),n.d(i,"isResolved",function(){return G}),n.d(i,"getNotices",function(){return L}),n.d(i,"areNoticesLoaded",function(){return q}),n.d(i,"isDoingAction",function(){return W}),n.d(i,"getInProgressActions",function(){return V}),n.d(i,"getMutedHighlights",function(){return Y}),n.d(i,"getMutedHighlightUpdatesInFlight",function(){return Z});var o={};n.r(o),n.d(o,"getNotices",function(){return K}),n.d(o,"getMutedHighlights",function(){return Q});var u=n("1ZqX"),c=n("RIqP"),a=n.n(c),s=n("lSNA"),f=n.n(s),l=n("YLtl"),d=n("ywyh"),h=n.n(d),g=n("Td6G");function p(t){return{type:"API_FETCH",request:t}}var v={API_FETCH:function(t){var e=t.request;return h()(e).catch(g.f)},SELECT:function(t){var e,n=t.selectorName,r=t.args;return(e=Object(u.select)("ithemes-security/admin-notices"))[n].apply(e,a()(r))},CREATE_NOTICE:function(t){var e=t.status,n=t.content,r=t.options;r.autoDismiss&&(r.id=r.id||Object(l.uniqueId)("itsec-auto-dismiss-"),setTimeout(function(){return Object(u.dispatch)("core/notices").removeNotice(r.id,r.context)},r.autoDismiss)),Object(u.dispatch)("core/notices").createNotice(e,n,r)}},y=n("o0o1"),m=n.n(y),b=m.a.mark(S),I=m.a.mark(P);function O(t){return{type:N,notices:t}}function E(t,e){return{type:x,noticeId:t,actionId:e}}function _(t,e,n){return{type:M,noticeId:t,actionId:e,response:n}}function A(t,e,n){return{type:C,noticeId:t,actionId:e,error:n}}function T(t){return{type:U,mutedHighlights:t}}function w(t,e){return{type:D,slug:t,mute:e}}function H(t,e){return{type:k,slug:t,mute:e}}function j(t,e,n){return{type:R,slug:t,mute:e,error:n}}function S(t,e){var n,r,i=arguments;return m.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return n=i.length>2&&void 0!==i[2]?i[2]:{},o.next=3,E(t,e);case 3:return o.prev=3,o.next=6,p({path:"/ithemes-security/v1/admin-notices/".concat(t,"/").concat(e),method:"POST",data:n});case 6:r=o.sent,o.next=14;break;case 9:return o.prev=9,o.t0=o.catch(3),o.next=13,A(t,e,o.t0);case 13:return o.abrupt("return",o.t0);case 14:return o.next=16,_(t,e,r);case 16:return o.abrupt("return",r);case 17:case"end":return o.stop()}},b,null,[[3,9]])}function P(t,e){var n;return m.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,w(t,e);case 2:return r.prev=2,r.next=5,p({path:"/ithemes-security/v1/admin-notices/settings",method:"PUT",data:{muted_highlights:f()({},t,e)}});case 5:n=r.sent,r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(2),r.next=12,j(t,e,r.t0);case 12:return r.abrupt("return",r.t0);case 13:return r.next=15,H(t,e);case 15:return r.abrupt("return",n);case 16:case"end":return r.stop()}},I,null,[[2,8]])}var N="RECEIVE_NOTICES",x="START_NOTICE_ACTION",M="FINISH_NOTICE_ACTION",C="FAILED_NOTICE_ACTION",U="RECEIVE_MUTED_HIGHLIGHTS",D="START_UPDATE_MUTED_HIGHLIGHT",k="FINISH_UPDATE_MUTED_HIGHLIGHT",R="FAILED_UPDATE_MUTED_HIGHLIGHT";function F(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Object(u.select)("core/data").isResolving("ithemes-security/admin-notices",t,n)}function G(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Object(u.select)("core/data").hasFinishedResolution("ithemes-security/admin-notices",t,n)}function L(t){return t.notices}function q(){return G("getNotices")}function W(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return!!t.doingActions[e]&&(""===n||t.doingActions[e].includes(n))}var J=[];function V(t,e){return t.doingActions[e]||J}function Y(t){return t.mutedHighlights}function Z(t){return t.mutedHighlightUpdatesInFlight}function X(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function $(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?X(Object(n),!0).forEach(function(e){f()(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var z={notices:[],doingActions:{},mutedHighlights:{},mutedHighlightUpdatesInFlight:{}};var B=m.a.mark(Q),K={fulfill:m.a.mark(function t(){var e;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p({path:"/ithemes-security/v1/admin-notices"});case 2:return e=t.sent,t.next=5,O(e);case 5:case"end":return t.stop()}},t)}),shouldInvalidate:function(t){return t.type===M||t.type===k}};function Q(){var t;return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p({path:"/ithemes-security/v1/admin-notices/settings"});case 2:return t=e.sent,e.next=5,T(Object(l.isEmpty)(t.muted_highlights)?{}:t.muted_highlights);case 5:case"end":return e.stop()}},B)}Object(u.registerStore)("ithemes-security/admin-notices",{controls:v,actions:r,selectors:i,resolvers:o,reducer:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z,e=arguments.length>1?arguments[1]:void 0;switch(e.type){case N:return $($({},t),{},{notices:a()(e.notices)});case x:return $($({},t),{},{doingActions:$($({},t.doingActions),{},f()({},e.noticeId,[].concat(a()(t.doingActions[e.noticeId]||[]),[e.actionId])))});case M:case C:return $($({},t),{},{doingActions:$($({},t.doingActions),{},f()({},e.noticeId,(t.doingActions[e.noticeId]||[]).filter(function(t){return t!==e.actionId})))});case U:return $($({},t),{},{mutedHighlights:e.mutedHighlights});case D:return $($({},t),{},{mutedHighlightUpdatesInFlight:$($({},t.mutedHighlightUpdatesInFlight),{},f()({},e.slug,{mute:e.mute}))});case k:return $($({},t),{},{mutedHighlightUpdatesInFlight:Object(l.omit)(t.mutedHighlightUpdatesInFlight,e.slug),mutedHighlights:$($({},t.mutedHighlights),{},f()({},e.slug,e.mute))});case R:return $($({},t),{},{mutedHighlightUpdatesInFlight:Object(l.omit)(t.mutedHighlightUpdatesInFlight,e.slug)});default:return t}}});n.p=window.itsecWebpackPublicPath},Td6G:function(t,e,n){"use strict";n("J4zp");var r=n("YLtl"),i=n("RIqP"),o=n.n(i),u=n("lwsE"),c=n.n(u),a=n("W8MJ"),s=n.n(a),f=n("lSNA"),l=n.n(f),d=n("92Nh"),h=n.n(d),g=n("tmk3"),p=n.n(g);function v(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return y(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw o}}}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var m=new WeakMap,b=new WeakMap,I=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;c()(this,t),m.set(this,{writable:!0,value:{}}),b.set(this,{writable:!0,value:{}}),l()(this,"getErrorCodes",function(){return Object.keys(p()(e,m))}),l()(this,"getErrorCode",function(){return e.getErrorCodes()[0]}),l()(this,"getErrorMessages",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(t)return p()(e,m)[t];var n=[];for(var r in p()(e,m))p()(e,m).hasOwnProperty(r)&&n.concat(p()(e,m)[r]);return n}),l()(this,"getErrorMessage",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return t=t||e.getErrorCode(),e.getErrorMessages(t)[0]}),l()(this,"getErrorData",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return t=t||e.getErrorCode(),p()(e,b)[t]}),l()(this,"getAllErrorMessages",function(){var t=[];for(var n in p()(e,m))p()(e,m).hasOwnProperty(n)&&t.push.apply(t,o()(p()(e,m)[n]));return t}),n&&(r&&(p()(this,m)[n]=[r]),i&&(p()(this,b)[n]=i))}return s()(t,null,[{key:"fromPHPObject",value:function(e){var n=new t;return h()(n,m,e.errors),h()(n,b,e.error_data),n}},{key:"fromApiError",value:function(e){var n=new t;if(p()(n,m)[e.code]=[e.message],p()(n,b)[e.code]=e.data,e.additional_errors){var r,i=v(e.additional_errors);try{for(i.s();!(r=i.n()).done;){var o=r.value;p()(n,m)[o.code]=[o.message],p()(n,b)[o.code]=o.data}}catch(t){i.e(t)}finally{i.f()}}return n}}]),t}(),O=n("PJYZ"),E=n.n(O),_=n("7W2i"),A=n.n(_),T=n("a1gu"),w=n.n(T),H=n("Nsbk"),j=n.n(H),S=n("oShl"),P=n.n(S),N=n("l3Sj");function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,r=j()(t);if(e){var i=j()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w()(this,n)}}var M=function(t){A()(n,t);var e=x(n);function n(t){var r;c()(this,n);for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];for(var a in r=e.call.apply(e,[this,t.message||Object(N.__)("An unknown error occurred.","better-wp-security")].concat(o)),Error.captureStackTrace&&Error.captureStackTrace(E()(r),n),r.__response=t,t)t.hasOwnProperty(a)&&Object.defineProperty(E()(r),a,{value:t[a],configurable:!0,enumerable:!0,writable:!0});return r}return s()(n,[{key:"toString",value:function(){return this.__response.toString()}},{key:"getResponse",value:function(){return this.__response}}]),n}(P()(Error));function C(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,c=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){c=!0,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw o}}}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t){if(!Object(r.isPlainObject)(t))return!1;var e=Object.keys(t);return 2===e.length&&(e.includes("errors")&&e.includes("error_data"))}function k(t){return D(t)?I.fromPHPObject(t):function(t){if(!Object(r.isPlainObject)(t))return!1;var e=Object.keys(t);return(3===e.length||4===e.length)&&!(4===e.length&&!e.includes("additional_errors"))&&e.includes("code")&&e.includes("message")&&e.includes("data")}(t)?I.fromApiError(t):new I}function R(t,e){var n,r=[[],[]],i=C(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;r[e(o)?0:1].push(o)}}catch(t){i.e(t)}finally{i.f()}return r}function F(t){if(t instanceof Error)throw t;throw new M(t)}n.d(e,"e",function(){return D}),n.d(e,"b",function(){return k}),n.d(e,"a",function(){return R}),n.d(e,"f",function(){return F}),n.d(e,"d",function(){return G}),n.d(e,"c",function(){return L});function G(t){return function(t,e){return Object(r.get)(t,["_links",e,0,"href"])}(t,"self")}function L(t,e){if(t&&t.links){var n,r=C(t.links);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.rel===e)return i}}catch(t){r.e(t)}finally{r.f()}}}},YLtl:function(t,e){!function(){t.exports=this.lodash}()},l3Sj:function(t,e){!function(){t.exports=this.wp.i18n}()},ywyh:function(t,e){!function(){t.exports=this.wp.apiFetch}()}});
dist/manifest.php CHANGED
@@ -7,11 +7,11 @@
7
  0 => 'core/admin-notices.css',
8
  1 => 'core/admin-notices.js',
9
  ),
10
- 'hash' => '20ed2bcbb93fed6fa1c83ba00be71557',
11
  'contentHash' =>
12
  array (
13
- 'css/mini-extract' => '6fb57999347c20cedea4',
14
- 'javascript' => 'b63492c857a2d1f804f1',
15
  ),
16
  'vendors' =>
17
  array (
@@ -36,11 +36,11 @@
36
  array (
37
  0 => 'core/admin-notices-api.js',
38
  ),
39
- 'hash' => '38449dfb0b067a051e6a0546ad9ebcf1',
40
  'contentHash' =>
41
  array (
42
  'css/mini-extract' => '31d6cfe0d16ae931b73c',
43
- 'javascript' => 'e7fc0106c45d5775d6c9',
44
  ),
45
  'vendors' =>
46
  array (
@@ -62,11 +62,11 @@
62
  0 => 'core/admin-notices-dashboard-admin-bar.css',
63
  1 => 'core/admin-notices-dashboard-admin-bar.js',
64
  ),
65
- 'hash' => 'dfc4e70cdcd8e2f938a5762365eeee47',
66
  'contentHash' =>
67
  array (
68
- 'css/mini-extract' => '830c959459f819ff3391',
69
- 'javascript' => '1716c2402b7e2da76b40',
70
  ),
71
  'vendors' =>
72
  array (
@@ -133,11 +133,11 @@
133
  array (
134
  0 => 'user-groups/api.js',
135
  ),
136
- 'hash' => '5ac8c93545e4077dba504622a3005ef5',
137
  'contentHash' =>
138
  array (
139
  'css/mini-extract' => '31d6cfe0d16ae931b73c',
140
- 'javascript' => 'da615ce1b1e259231621',
141
  ),
142
  'vendors' =>
143
  array (
@@ -160,11 +160,11 @@
160
  0 => 'user-groups/settings.css',
161
  1 => 'user-groups/settings.js',
162
  ),
163
- 'hash' => 'ac0d0617c9024eada52ad99bb5ab2356',
164
  'contentHash' =>
165
  array (
166
- 'css/mini-extract' => '1c9a81c56b3886010b20',
167
- 'javascript' => 'a1309a2b4d0fd8b7e89a',
168
  ),
169
  'vendors' =>
170
  array (
7
  0 => 'core/admin-notices.css',
8
  1 => 'core/admin-notices.js',
9
  ),
10
+ 'hash' => '874902b54682d9c5e9a456c8d57b5564',
11
  'contentHash' =>
12
  array (
13
+ 'css/mini-extract' => 'd035a754e0e995d7f2a8',
14
+ 'javascript' => '2cf1a195a17e8ff8a47d',
15
  ),
16
  'vendors' =>
17
  array (
36
  array (
37
  0 => 'core/admin-notices-api.js',
38
  ),
39
+ 'hash' => 'd7095373cba6e51875e5ca6af8f4327a',
40
  'contentHash' =>
41
  array (
42
  'css/mini-extract' => '31d6cfe0d16ae931b73c',
43
+ 'javascript' => '347f2aa808de04b456c5',
44
  ),
45
  'vendors' =>
46
  array (
62
  0 => 'core/admin-notices-dashboard-admin-bar.css',
63
  1 => 'core/admin-notices-dashboard-admin-bar.js',
64
  ),
65
+ 'hash' => '7ad1e530a1dced5b2d17c039059fbec2',
66
  'contentHash' =>
67
  array (
68
+ 'css/mini-extract' => '14d26d2c760fcc5ad39d',
69
+ 'javascript' => '8ab1e1779ca446184154',
70
  ),
71
  'vendors' =>
72
  array (
133
  array (
134
  0 => 'user-groups/api.js',
135
  ),
136
+ 'hash' => '2e4966910e20a866183e58353d04e5b4',
137
  'contentHash' =>
138
  array (
139
  'css/mini-extract' => '31d6cfe0d16ae931b73c',
140
+ 'javascript' => '2981162f2bdd211218d7',
141
  ),
142
  'vendors' =>
143
  array (
160
  0 => 'user-groups/settings.css',
161
  1 => 'user-groups/settings.js',
162
  ),
163
+ 'hash' => 'decbf0dd99a8ea2ca1f2b66d3c5e6770',
164
  'contentHash' =>
165
  array (
166
+ 'css/mini-extract' => 'b40b58f3d12028ecdcbd',
167
+ 'javascript' => '24506cc6c5871b56d31c',
168
  ),
169
  'vendors' =>
170
  array (
dist/user-groups/api.min.js CHANGED
@@ -1 +1 @@
1
- this.itsec=this.itsec||{},this.itsec["user-groups"]=this.itsec["user-groups"]||{},this.itsec["user-groups"].api=function(e){function t(t){for(var n,a,o=t[0],c=t[1],s=t[2],l=0,d=[];l<o.length;l++)a=o[l],u[a]&&d.push(u[a][0]),u[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return i.push.apply(i,s||[]),r()}function r(){for(var e,t=0;t<i.length;t++){for(var r=i[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==u[c]&&(n=!1)}n&&(i.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},u={6:0},i=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var o=window.itsecWebpackJsonP=window.itsecWebpackJsonP||[],c=o.push.bind(o);o.push=t,o=o.slice();for(var s=0;s<o.length;s++)t(o[s]);var f=c;return i.push(["Ntz8",0]),r()}({"1ZqX":function(e,t){!function(){e.exports=this.wp.data}()},Mmq9:function(e,t){!function(){e.exports=this.wp.url}()},Ntz8:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"path",function(){return R}),r.d(n,"query",function(){return j}),r.d(n,"appendToQuery",function(){return k}),r.d(n,"receiveQuery",function(){return C}),r.d(n,"processItem",function(){return D}),r.d(n,"receiveGroup",function(){return N}),r.d(n,"receiveMatchables",function(){return F}),r.d(n,"startCreateGroup",function(){return B}),r.d(n,"failedCreateGroup",function(){return H}),r.d(n,"finishCreateGroup",function(){return L}),r.d(n,"startUpdateGroup",function(){return q}),r.d(n,"failedUpdateGroup",function(){return M}),r.d(n,"finishUpdateGroup",function(){return Y}),r.d(n,"startDeleteGroup",function(){return Q}),r.d(n,"failedDeleteGroup",function(){return W}),r.d(n,"finishDeleteGroup",function(){return K}),r.d(n,"receiveGroupSettings",function(){return V}),r.d(n,"startUpdateGroupSettings",function(){return J}),r.d(n,"failedUpdateGroupSettings",function(){return $}),r.d(n,"finishUpdateGroupSettings",function(){return z}),r.d(n,"createGroup",function(){return Z}),r.d(n,"updateGroup",function(){return X}),r.d(n,"deleteGroup",function(){return ee}),r.d(n,"updateGroupSettings",function(){return te}),r.d(n,"fetchGroupsSettings",function(){return re}),r.d(n,"startFetchGroupsSettings",function(){return ne}),r.d(n,"finishFetchGroupsSettings",function(){return ue}),r.d(n,"failedFetchGroupsSettings",function(){return ie}),r.d(n,"patchBulkGroupSettings",function(){return ae}),r.d(n,"startPatchBulkGroupSettings",function(){return oe}),r.d(n,"finishPatchBulkGroupSettings",function(){return ce}),r.d(n,"failedPatchBulkGroupSettings",function(){return se}),r.d(n,"RECEIVE_QUERY",function(){return de}),r.d(n,"APPEND_TO_QUERY",function(){return pe}),r.d(n,"RECEIVE_MATCHABLES",function(){return he}),r.d(n,"START_CREATE_GROUP",function(){return ge}),r.d(n,"FINISH_CREATE_GROUP",function(){return be}),r.d(n,"FAILED_CREATE_GROUP",function(){return ye}),r.d(n,"RECEIVE_GROUP",function(){return ve}),r.d(n,"START_UPDATE_GROUP",function(){return me}),r.d(n,"FINISH_UPDATE_GROUP",function(){return Se}),r.d(n,"FAILED_UPDATE_GROUP",function(){return Ie}),r.d(n,"START_DELETE_GROUP",function(){return Ee}),r.d(n,"FINISH_DELETE_GROUP",function(){return _e}),r.d(n,"FAILED_DELETE_GROUP",function(){return Oe}),r.d(n,"RECEIVE_GROUP_SETTINGS",function(){return Te}),r.d(n,"START_UPDATE_GROUP_SETTINGS",function(){return Pe}),r.d(n,"FINISH_UPDATE_GROUP_SETTINGS",function(){return xe}),r.d(n,"FAILED_UPDATE_GROUP_SETTINGS",function(){return Ae}),r.d(n,"START_FETCH_GROUPS_SETTINGS",function(){return Ge}),r.d(n,"FINISH_FETCH_GROUPS_SETTINGS",function(){return Ue}),r.d(n,"FAILED_FETCH_GROUPS_SETTINGS",function(){return we}),r.d(n,"START_PATCH_BULK_GROUP_SETTINGS",function(){return Re}),r.d(n,"FINISH_PATCH_BULK_GROUP_SETTINGS",function(){return je}),r.d(n,"FAILED_PATCH_BULK_GROUP_SETTINGS",function(){return ke});var u={};r.r(u),r.d(u,"getMatchables",function(){return Be}),r.d(u,"getMatchableType",function(){return He}),r.d(u,"getMatchableLabel",function(){return Le}),r.d(u,"getGroups",function(){return qe}),r.d(u,"getQueriedObjectIds",function(){return Ye}),r.d(u,"getGroup",function(){return Qe}),r.d(u,"getGroupAttribute",function(){return We}),r.d(u,"isUpdating",function(){return Ke}),r.d(u,"isDeleting",function(){return Ve}),r.d(u,"getGroupSettings",function(){return Je}),r.d(u,"getGroupSetting",function(){return $e}),r.d(u,"isUpdatingSettings",function(){return ze}),r.d(u,"isBulkPatchingSettings",function(){return Ze}),r.d(u,"getGroupsBySetting",function(){return Xe});var i={};r.r(i),r.d(i,"getGroup",function(){return ot}),r.d(i,"getMatchables",function(){return ct}),r.d(i,"getGroupSettings",function(){return st});var a=r("1ZqX"),o=r("RIqP"),c=r.n(o),s=r("ywyh"),f=r.n(s),l=r("Td6G");function d(e){return{type:"API_FETCH",request:e}}function p(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),u=2;u<r;u++)n[u-2]=arguments[u];return{type:"DISPATCH",storeKey:e,actionName:t,args:n}}var h={API_FETCH:function(e){var t=e.request;return f()(t).catch(l.e)},SELECT:function(e){var t,r=e.storeKey,n=e.selectorName,u=e.args;return(t=Object(a.select)(r))[n].apply(t,c()(u))},DISPATCH:function(e){var t,r=e.storeKey,n=e.actionName,u=e.args;return(t=Object(a.dispatch)(r))[n].apply(t,c()(u))}},g=r("o0o1"),b=r.n(g),y=r("YLtl"),v=r("qPad"),m=r.n(v),S=r("Mmq9"),I=b.a.mark(j),E=b.a.mark(k),_=b.a.mark(D),O=b.a.mark(Z),T=b.a.mark(X),P=b.a.mark(ee),x=b.a.mark(te),A=b.a.mark(re),G=b.a.mark(ae);function U(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var R="/ithemes-security/v1/user-groups";function j(e,t){var r,n,u,i;return b.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,d({path:Object(S.addQueryArgs)(R,t)});case 2:return r=a.sent,a.next=5,C(e,r);case 5:n=U(r),a.prev=6,n.s();case 8:if((u=n.n()).done){a.next=13;break}return i=u.value,a.delegateYield(D(i),"t0",11);case 11:a.next=8;break;case 13:a.next=18;break;case 15:a.prev=15,a.t1=a.catch(6),n.e(a.t1);case 18:return a.prev=18,n.f(),a.finish(18);case 21:return a.abrupt("return",r);case 22:case"end":return a.stop()}},I,null,[[6,15,18,21]])}function k(e,t){return b.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,{type:pe,queryId:e,item:t};case 2:return r.delegateYield(D(t),"t0",3);case 3:case"end":return r.stop()}},E)}function C(e,t){return{type:de,queryId:e,items:t}}function D(e){var t,r,n,u,i;return b.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:t=Object(y.get)(e,["_embedded","ithemes-security:user-group-member"],[]),r=Object(y.get)(e,["_embedded","ithemes-security:user-matchable-settings",0]),n=U(t),a.prev=3,n.s();case 5:if((u=n.n()).done){a.next=11;break}return i=u.value,a.next=9,p("ithemes-security/core","receiveUser",i);case 9:a.next=5;break;case 11:a.next=16;break;case 13:a.prev=13,a.t0=a.catch(3),n.e(a.t0);case 16:return a.prev=16,n.f(),a.finish(16);case 19:if(!r){a.next=22;break}return a.next=22,V(e.id,r);case 22:case"end":return a.stop()}},_,null,[[3,13,16,19]])}function N(e){return{type:ve,group:e}}function F(e){return{type:he,matchables:e}}function B(e){return{type:ge,group:e}}function H(e,t){return{type:ye,group:e,error:t}}function L(e,t){return{type:be,group:e,response:t}}function q(e,t){return{type:me,id:e,group:t}}function M(e,t){return{type:Ie,id:e,error:t}}function Y(e,t){return{type:Se,id:e,response:t}}function Q(e){return{type:Ee,id:e}}function W(e,t){return{type:Oe,id:e,error:t}}function K(e){return{type:_e,id:e}}function V(e,t){return{type:Te,id:e,settings:t}}function J(e,t){return{type:Pe,id:e,settings:t}}function $(e,t){return{type:Ae,id:e,error:t}}function z(e,t){return{type:xe,id:e,response:t}}function Z(e){var t;return b.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,B(e);case 2:return r.prev=2,r.next=5,d({path:Object(S.addQueryArgs)(R,{_embed:1}),method:"POST",data:e});case 5:t=r.sent,r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(2),r.next=12,H(e,r.t0);case 12:return r.abrupt("return",r.t0);case 13:return r.next=15,L(e,t);case 15:return r.next=17,N(t);case 17:return r.delegateYield(D(t),"t1",18);case 18:return r.abrupt("return",t);case 19:case"end":return r.stop()}},O,null,[[2,8]])}function X(e,t){var r;return b.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,q(e,t);case 2:return n.prev=2,n.next=5,d({path:R+"/"+e,method:"PUT",data:t});case 5:r=n.sent,n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(2),n.next=12,M(e,n.t0);case 12:return n.abrupt("return",n.t0);case 13:return n.next=15,Y(e,r);case 15:return n.next=17,N(r);case 17:return n.abrupt("return",r);case 18:case"end":return n.stop()}},T,null,[[2,8]])}function ee(e){return b.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Q(e);case 2:return t.prev=2,t.next=5,d({path:"".concat(R,"/").concat(e),method:"DELETE"});case 5:t.next=12;break;case 7:return t.prev=7,t.t0=t.catch(2),t.next=11,W(e,t.t0);case 11:return t.abrupt("return",t.t0);case 12:return t.next=14,K(e);case 14:return t.abrupt("return",null);case 15:case"end":return t.stop()}},P,null,[[2,7]])}function te(e,t){var r;return b.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,J(e,t);case 2:return n.prev=2,n.next=5,d({path:"ithemes-security/v1/user-matchable-settings/".concat(e),method:"PUT",data:t});case 5:r=n.sent,n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(2),n.next=12,$(e,n.t0);case 12:return n.abrupt("return",n.t0);case 13:return n.next=15,z(e,r);case 15:return n.next=17,V(e,r);case 17:return n.abrupt("return",r);case 18:case"end":return n.stop()}},x,null,[[2,8]])}function re(){var e,t,r,n,u=arguments;return b.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=u.length>0&&void 0!==u[0]?u[0]:[],i.next=3,ne(e);case 3:return i.prev=3,r="ithemes-security/v1/user-matchable-settings",e.length>0&&(r=Object(S.addQueryArgs)(r,{include:e})),i.next=8,d({path:r});case 8:t=i.sent,i.next=16;break;case 11:return i.prev=11,i.t0=i.catch(3),i.next=15,ie(e,i.t0);case 15:return i.abrupt("return",i.t0);case 16:return i.next=18,ue(e,t);case 18:i.t1=b.a.keys(t);case 19:if((i.t2=i.t1()).done){i.next=27;break}if(n=i.t2.value,t.hasOwnProperty(n)){i.next=23;break}return i.abrupt("continue",19);case 23:return i.next=25,V(n,t[n]);case 25:i.next=19;break;case 27:return i.abrupt("return",t);case 28:case"end":return i.stop()}},A,null,[[3,11]])}function ne(e){return{type:Ge,groupIds:e}}function ue(e,t){return{type:Ue,groupIds:e,response:t}}function ie(e,t){return{type:we,groupIds:e,error:t}}function ae(e,t){var r,n,u,i,o,c,s,f;return b.a.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,oe(e,t);case 2:return p.prev=2,p.next=5,d({path:Object(S.addQueryArgs)("ithemes-security/v1/user-matchable-settings",{include:e}),method:"PATCH",data:t});case 5:r=p.sent,p.next=13;break;case 8:return p.prev=8,p.t0=p.catch(2),p.next=12,se(e,t,p.t0);case 12:return p.abrupt("return",p.t0);case 13:return p.next=15,ce(e,t,r);case 15:if(n=Object(a.select)("ithemes-security/core").getSchema("ithemes-security-user-group-settings"),u=Object(l.c)(n,"self")){p.next=19;break}return p.abrupt("return",r);case 19:i=new m.a(u.href),o=U(r),p.prev=21,o.s();case 23:if((c=o.n()).done){p.next=34;break}if(200===(s=c.value).status){p.next=27;break}return p.abrupt("continue",32);case 27:if((f=i.fromUri(s.href)).id){p.next=30;break}return p.abrupt("continue",32);case 30:return p.next=32,V(f.id,s.response);case 32:p.next=23;break;case 34:p.next=39;break;case 36:p.prev=36,p.t1=p.catch(21),o.e(p.t1);case 39:return p.prev=39,o.f(),p.finish(39);case 42:return p.abrupt("return",r);case 43:case"end":return p.stop()}},G,null,[[2,8],[21,36,39,42]])}function oe(e,t){return{type:Re,groupIds:e,patch:t}}function ce(e,t,r){return{type:je,groupIds:e,patch:t,response:r}}function se(e,t,r){return{type:ke,groupIds:e,patch:t,error:r}}var fe,le,de="RECEIVE_QUERY",pe="APPEND_TO_QUERY",he="RECEIVE_MATCHABLES",ge="START_CREATE_GROUP",be="FINISH_CREATE_GROUP",ye="FAILED_CREATE_GROUP",ve="RECEIVE_GROUP",me="START_UPDATE_GROUP",Se="FINISH_UPDATE_GROUP",Ie="FAILED_UPDATE_GROUP",Ee="START_DELETE_GROUP",_e="FINISH_DELETE_GROUP",Oe="FAILED_DELETE_GROUP",Te="RECEIVE_GROUP_SETTINGS",Pe="START_UPDATE_GROUP_SETTINGS",xe="FINISH_UPDATE_GROUP_SETTINGS",Ae="FAILED_UPDATE_GROUP_SETTINGS",Ge="START_FETCH_GROUPS_SETTINGS",Ue="FINISH_FETCH_GROUPS_SETTINGS",we="FAILED_FETCH_GROUPS_SETTINGS",Re="START_PATCH_BULK_GROUP_SETTINGS",je="FINISH_PATCH_BULK_GROUP_SETTINGS",ke="FAILED_PATCH_BULK_GROUP_SETTINGS";function Ce(e){return[e]}function De(){var e={clear:function(){e.head=null}};return e}function Ne(e,t,r){var n;if(e.length!==t.length)return!1;for(n=r;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}fe={},le="undefined"!=typeof WeakMap;var Fe=function(e,t){var r,n;function u(){r=le?new WeakMap:De()}function i(){var r,u,i,a,o,c=arguments.length;for(a=new Array(c),i=0;i<c;i++)a[i]=arguments[i];for(o=t.apply(null,a),(r=n(o)).isUniqueByDependants||(r.lastDependants&&!Ne(o,r.lastDependants,0)&&r.clear(),r.lastDependants=o),u=r.head;u;){if(Ne(u.args,a,1))return u!==r.head&&(u.prev.next=u.next,u.next&&(u.next.prev=u.prev),u.next=r.head,u.prev=null,r.head.prev=u,r.head=u),u.val;u=u.next}return u={val:e.apply(null,a)},a[0]=null,u.args=a,r.head&&(r.head.prev=u,u.next=r.head),r.head=u,u.val}return t||(t=Ce),n=le?function(e){var t,n,u,i,a,o=r,c=!0;for(t=0;t<e.length;t++){if(n=e[t],!(a=n)||"object"!=typeof a){c=!1;break}o.has(n)?o=o.get(n):(u=new WeakMap,o.set(n,u),o=u)}return o.has(fe)||((i=De()).isUniqueByDependants=c,o.set(fe,i)),o.get(fe)}:function(){return r},i.getDependants=t,i.clear=u,u(),i},Be=Fe(function(e){return Object(y.filter)(Object(y.map)(e.matchableIds,function(t){return e.matchablesById[t]}),y.isObject)},function(e){return[e.matchablesById,e.matchableIds]});function He(e,t){return(e.matchablesById[t]||{}).type}function Le(e,t){return(e.matchablesById[t]||{}).label}var qe=Fe(function(e,t){return Object(y.filter)(Object(y.map)(e.queries[t],function(t){return e.byId[t]}),y.isObject)},function(e,t){return[e.queries[t],e.byId]}),Me=[];function Ye(e,t){return e.queries[t]||Me}function Qe(e,t){return e.byId[t]}function We(e,t,r){var n=Object(a.select)("ithemes-security/user-groups").getGroup(t);return n?n[r]:void 0}function Ke(e,t){return e.updating.includes(t)}function Ve(e,t){return e.deleting.includes(t)}function Je(e,t){return e.settings[t]}function $e(e,t,r,n){var u=Object(a.select)("ithemes-security/user-groups").getGroupSettings(t);return Object(y.get)(u,[r,n])}function ze(e,t){return e.updatingSettings.includes(t)}function Ze(e,t,r){var n=t.join("_");return e.bulkPatchingSettings[n]===r}function Xe(e){var t={};for(var r in e.settings)if(e.settings.hasOwnProperty(r))for(var n in e.settings[r])if(e.settings[r].hasOwnProperty(n))for(var u in e.settings[r][n])e.settings[r][n].hasOwnProperty(u)&&(t[n]||(t[n]={}),t[n][u]||(t[n][u]=[]),e.settings[r][n][u]&&t[n][u].push(r));return t}var et=r("lSNA"),tt=r.n(et);function rt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function nt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(r),!0).forEach(function(t){tt()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ut={matchablesById:{},matchableIds:[],byId:{},queries:{},creating:[],updating:[],deleting:[],settings:{},updatingSettings:[],bulkPatchingSettings:{}};function it(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return at(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return at(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ot={fulfill:b.a.mark(function e(t){var r;return b.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({path:"".concat(R,"/").concat(t,"?_embed=1")});case 2:return r=e.sent,e.next=5,N(r);case 5:return e.delegateYield(D(r),"t0",6);case 6:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return e.byId.hasOwnProperty(t)}},ct={fulfill:b.a.mark(function e(){var t,r,n,u,i,a;return b.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({path:"/ithemes-security/v1/user-matchables?_embed=1"});case 2:return t=e.sent,e.next=5,F(t);case 5:r=it(t),e.prev=6,r.s();case 8:if((n=r.n()).done){e.next=20;break}if(u=n.value,i=Object(y.get)(u,["_embedded","self",0]),a=Object(y.get)(u,["_embedded","ithemes-security:user-matchable-settings",0]),!i){e.next=15;break}return e.next=15,N(i);case 15:if(!a){e.next=18;break}return e.next=18,V(u.id,a);case 18:e.next=8;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(6),r.e(e.t0);case 25:return e.prev=25,r.f(),e.finish(25);case 28:case"end":return e.stop()}},e,null,[[6,22,25,28]])}),isFulfilled:function(e){return!Object(y.isEmpty)(e.matchablesById)}},st={fulfill:b.a.mark(function e(t){var r;return b.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({path:"ithemes-security/v1/user-matchable-settings/".concat(t)});case 2:return r=e.sent,e.next=5,V(t,r);case 5:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return e.settings.hasOwnProperty(t)}},ft=Object(a.registerStore)("ithemes-security/user-groups",{controls:h,actions:n,selectors:u,resolvers:i,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ut,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case he:return nt(nt({},e),{},{matchableIds:Object(y.map)(t.matchables,"id"),matchablesById:Object(y.keyBy)(t.matchables,"id")});case de:return nt(nt({},e),{},{byId:nt(nt({},e.byId),Object(y.keyBy)(t.items,"id")),queries:nt(nt({},e.queries),{},tt()({},t.queryId,Object(y.map)(t.items,"id")))});case pe:return nt(nt({},e),{},{byId:nt(nt({},e.byId),{},tt()({},t.item.id,t.item)),queries:nt(nt({},e.queries),{},tt()({},t.queryId,[].concat(c()(e.queries[t.queryId]||[]),[t.item.id])))});case ve:return nt(nt({},e),{},{byId:nt(nt({},e.byId),{},tt()({},t.group.id,t.group)),matchablesById:e.matchablesById[t.group.id]?nt(nt({},e.matchablesById),{},tt()({},t.group.id,nt(nt({},e.matchablesById[t.group.id]),{},{label:t.group.label}))):e.matchablesById});case ge:return nt(nt({},e),{},{creating:[].concat(c()(e.creating),[t.group])});case be:return nt(nt({},e),{},{creating:e.creating.filter(function(e){return e!==t.group}),matchablesById:nt(nt({},e.matchablesById),{},tt()({},t.response.id,{id:t.response.id,label:t.response.label,type:"user-group"})),matchableIds:[].concat(c()(e.matchableIds),[[t.response.id]])});case ye:return nt(nt({},e),{},{creating:e.creating.filter(function(e){return e!==t.group})});case me:return nt(nt({},e),{},{updating:[].concat(c()(e.updating),[t.id])});case Se:case Ie:return nt(nt({},e),{},{updating:e.updating.filter(function(e){return e!==t.id})});case Ee:return nt(nt({},e),{},{deleting:[].concat(c()(e.deleting),[t.id])});case _e:return nt(nt({},e),{},{deleting:e.deleting.filter(function(e){return e!==t.id}),byId:Object(y.omit)(e.byId,[t.id]),matchablesById:Object(y.omit)(e.matchablesById,[t.id]),matchableIds:e.matchableIds.filter(function(e){return e!==t.id}),settings:Object(y.omit)(e.settings,[t.id])});case Oe:return nt(nt({},e),{},{deleting:e.deleting.filter(function(e){return e!==t.id})});case Te:return nt(nt({},e),{},{settings:nt(nt({},e.settings),{},tt()({},t.id,t.settings))});case Pe:return nt(nt({},e),{},{updatingSettings:[].concat(c()(e.updatingSettings),[t.id])});case xe:case Ae:return nt(nt({},e),{},{updatingSettings:e.updatingSettings.filter(function(e){return e!==t.id})});case Re:return nt(nt({},e),{},{bulkPatchingSettings:nt(nt({},e.bulkPatchingSettings),{},tt()({},t.groupIds.join("_"),t.patch))});case je:case ke:return nt(nt({},e),{},{bulkPatchingSettings:Object(y.omit)(e.bulkPatchingSettings,[t.groupIds.join("_")])});default:return e}}});r.d(t,"store",function(){return ft}),r.p=window.itsecWebpackPublicPath},Td6G:function(e,t,r){"use strict";r("J4zp");var n=r("YLtl"),u=r("RIqP"),i=r.n(u),a=r("lwsE"),o=r.n(a),c=r("W8MJ"),s=r.n(c),f=r("lSNA"),l=r.n(f),d=r("92Nh"),p=r.n(d),h=r("tmk3"),g=r.n(h);function b(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var v=new WeakMap,m=new WeakMap,S=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;o()(this,e),v.set(this,{writable:!0,value:{}}),m.set(this,{writable:!0,value:{}}),l()(this,"getErrorCodes",function(){return Object.keys(g()(t,v))}),l()(this,"getErrorCode",function(){return t.getErrorCodes()[0]}),l()(this,"getErrorMessages",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(e)return g()(t,v)[e];var r=[];for(var n in g()(t,v))g()(t,v).hasOwnProperty(n)&&r.concat(g()(t,v)[n]);return r}),l()(this,"getErrorMessage",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),t.getErrorMessages(e)[0]}),l()(this,"getErrorData",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),g()(t,m)[e]}),l()(this,"getAllErrorMessages",function(){var e=[];for(var r in g()(t,v))g()(t,v).hasOwnProperty(r)&&e.push.apply(e,i()(g()(t,v)[r]));return e}),r&&(n&&(g()(this,v)[r]=[n]),u&&(g()(this,m)[r]=u))}return s()(e,null,[{key:"fromPHPObject",value:function(t){var r=new e;return p()(r,v,t.errors),p()(r,m,t.error_data),r}},{key:"fromApiError",value:function(t){var r=new e;if(g()(r,v)[t.code]=[t.message],g()(r,m)[t.code]=t.data,t.additional_errors){var n,u=b(t.additional_errors);try{for(u.s();!(n=u.n()).done;){var i=n.value;g()(r,v)[i.code]=[i.message],g()(r,m)[i.code]=i.data}}catch(e){u.e(e)}finally{u.f()}}return r}}]),e}(),I=r("PJYZ"),E=r.n(I),_=r("7W2i"),O=r.n(_),T=r("a1gu"),P=r.n(T),x=r("Nsbk"),A=r.n(x),G=r("oShl"),U=r.n(G),w=r("l3Sj");function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=A()(e);if(t){var u=A()(this).constructor;r=Reflect.construct(n,arguments,u)}else r=n.apply(this,arguments);return P()(this,r)}}var j=function(e){O()(r,e);var t=R(r);function r(e){var n;o()(this,r);for(var u=arguments.length,i=new Array(u>1?u-1:0),a=1;a<u;a++)i[a-1]=arguments[a];for(var c in n=t.call.apply(t,[this,e.message||Object(w.__)("An unknown error occurred.","better-wp-security")].concat(i)),Error.captureStackTrace&&Error.captureStackTrace(E()(n),r),n.__response=e,e)e.hasOwnProperty(c)&&Object.defineProperty(E()(n),c,{value:e[c],configurable:!0,enumerable:!0,writable:!0});return n}return s()(r,[{key:"toString",value:function(){return this.__response.toString()}},{key:"getResponse",value:function(){return this.__response}}]),r}(U()(Error));function k(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return C(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function D(e){if(!Object(n.isPlainObject)(e))return!1;var t=Object.keys(e);return 2===t.length&&(t.includes("errors")&&t.includes("error_data"))}function N(e){return D(e)?S.fromPHPObject(e):function(e){if(!Object(n.isPlainObject)(e))return!1;var t=Object.keys(e);return(3===t.length||4===t.length)&&!(4===t.length&&!t.includes("additional_errors"))&&t.includes("code")&&t.includes("message")&&t.includes("data")}(e)?S.fromApiError(e):new S}function F(e,t){var r,n=[[],[]],u=k(e);try{for(u.s();!(r=u.n()).done;){var i=r.value;n[t(i)?0:1].push(i)}}catch(e){u.e(e)}finally{u.f()}return n}function B(e){if(e instanceof Error)throw e;throw new j(e)}r.d(t,"d",function(){return D}),r.d(t,"b",function(){return N}),r.d(t,"a",function(){return F}),r.d(t,"e",function(){return B}),r.d(t,"c",function(){return H});function H(e,t){if(e&&e.links){var r,n=k(e.links);try{for(n.s();!(r=n.n()).done;){var u=r.value;if(u.rel===t)return u}}catch(e){n.e(e)}finally{n.f()}}}},YLtl:function(e,t){!function(){e.exports=this.lodash}()},l3Sj:function(e,t){!function(){e.exports=this.wp.i18n}()},qPad:function(e,t,r){var n,u;n=this,u=function(){var e={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},t={"*":!0};function r(e){return encodeURI(e).replace(/%25[0-9][0-9]/g,function(e){return"%"+e.substring(3)})}function n(e){return e=e.replace(/%../g,""),encodeURIComponent(e)===e}function u(u){var i="";e[u.charAt(0)]&&(i=u.charAt(0),u=u.substring(1));var a="",o="",c=!0,s=!1,f=!1;"+"==i?c=!1:"."==i?(o=".",a="."):"/"==i?(o="/",a="/"):"#"==i?(o="#",c=!1):";"==i?(o=";",a=";",s=!0,f=!0):"?"==i?(o="?",a="&",s=!0):"&"==i&&(o="&",a="&",s=!0);for(var l=[],d=u.split(","),p=[],h={},g=0;g<d.length;g++){var b=d[g],y=null;if(-1!=b.indexOf(":")){var v=b.split(":");b=v[0],y=parseInt(v[1])}for(var m={};t[b.charAt(b.length-1)];)m[b.charAt(b.length-1)]=!0,b=b.substring(0,b.length-1);var S={truncate:y,name:b,suffices:m};p.push(S),h[b]=S,l.push(b)}return{varNames:l,prefix:o,substitution:function(e){for(var t="",n=0,u=0;u<p.length;u++){var i=p[u],l=e(i.name);if(null==l||Array.isArray(l)&&0==l.length||"object"==typeof l&&0==Object.keys(l).length)n++;else if(t+=u==n?o:a||",",Array.isArray(l)){s&&(t+=i.name+"=");for(var d=0;d<l.length;d++)d>0&&(t+=i.suffices["*"]&&a||",",i.suffices["*"]&&s&&(t+=i.name+"=")),t+=c?encodeURIComponent(l[d]).replace(/!/g,"%21"):r(l[d])}else if("object"==typeof l){s&&!i.suffices["*"]&&(t+=i.name+"=");var h=!0;for(var g in l)h||(t+=i.suffices["*"]&&a||","),h=!1,t+=c?encodeURIComponent(g).replace(/!/g,"%21"):r(g),t+=i.suffices["*"]?"=":",",t+=c?encodeURIComponent(l[g]).replace(/!/g,"%21"):r(l[g])}else s&&(t+=i.name,f&&""==l||(t+="=")),null!=i.truncate&&(l=l.substring(0,i.truncate)),t+=c?encodeURIComponent(l).replace(/!/g,"%21"):r(l)}return t},unSubstitution:function(e,t,r){if(o&&(e=e.substring(o.length)),1==p.length&&p[0].suffices["*"]){for(var u=(_=p[0]).name,i=_.suffices["*"]?e.split(a||","):[e],f=c&&-1!=e.indexOf("="),l=1;l<i.length;l++)e=i[l],f&&-1==e.indexOf("=")&&(i[l-1]+=(a||",")+e,i.splice(l,1),l--);for(l=0;l<i.length;l++)e=i[l],c&&-1!=e.indexOf("=")&&(f=!0),1==(v=e.split(",")).length?i[l]=v[0]:i[l]=v;if(s||f){for(var d=t[u]||{},g=0;g<i.length;g++){var b=e;if(!s||b){if("string"==typeof i[g]){var y=(e=i[g]).split("=",1)[0];if(e=e.substring(y.length+1),c){if(r&&!n(e))return;e=decodeURIComponent(e)}b=e}else{if(y=(e=i[g][0]).split("=",1)[0],e=e.substring(y.length+1),c){if(r&&!n(e))return;e=decodeURIComponent(e)}i[g][0]=e,b=i[g]}if(c){if(r&&!n(y))return;y=decodeURIComponent(y)}void 0!==d[y]?Array.isArray(d[y])?d[y].push(b):d[y]=[d[y],b]:d[y]=b}}1==Object.keys(d).length&&void 0!==d[u]?t[u]=d[u]:t[u]=d}else{if(c)for(g=0;g<i.length;g++){var v=i[g];if(Array.isArray(v))for(var m=0;m<v.length;m++){if(r&&!n(v[m]))return;v[m]=decodeURIComponent(v[m])}else{if(r&&!n(v))return;i[g]=decodeURIComponent(v)}}void 0!==t[u]?Array.isArray(t[u])?t[u]=t[u].concat(i):t[u]=[t[u]].concat(i):1!=i.length||_.suffices["*"]?t[u]=i:t[u]=i[0]}}else{i=1==p.length?[e]:e.split(a||",");var S={};for(l=0;l<i.length;l++){for(var I=0;I<p.length-1&&I<l&&!p[I].suffices["*"];I++);if(I!=l){for(var E=p.length-1;E>0&&p.length-E<i.length-l&&!p[E].suffices["*"];E--);p.length-E!=i.length-l?S[l]=I:S[l]=E}else S[l]=l}for(l=0;l<i.length;l++)if((e=i[l])||!s){if(v=e.split(","),f=!1,s){u=(e=v[0]).split("=",1)[0],e=e.substring(u.length+1),v[0]=e;var _=h[u]||p[0]}else u=(_=p[S[l]]).name;for(g=0;g<v.length;g++)if(c){if(r&&!n(v[g]))return;v[g]=decodeURIComponent(v[g])}(s||_.suffices["*"])&&void 0!==t[u]?Array.isArray(t[u])?t[u]=t[u].concat(v):t[u]=[t[u]].concat(v):1!=v.length||_.suffices["*"]?t[u]=v:t[u]=v[0]}}return 1}}}function i(e){if(!(this instanceof i))return new i(e);for(var t=e.split("{"),r=[t.shift()],n=[],a=[],o=[],c=[];t.length>0;){var s=t.shift(),f=s.split("}")[0],l=s.substring(f.length+1),d=u(f);a.push(d.substitution),o.push(d.unSubstitution),n.push(d.prefix),r.push(l),c=c.concat(d.varNames)}this.fill=function(e){if(e&&"function"!=typeof e){var t=e;e=function(e){return t[e]}}for(var n=r[0],u=0;u<a.length;u++){n+=(0,a[u])(e),n+=r[u+1]}return n},this.fromUri=function(e,t){t=t||{};for(var u={},i=0;i<r.length;i++){var a=r[i];if(e.substring(0,a.length)!==a)return;if(e=e.substring(a.length),i>=r.length-1){if(""==e)break;return}var c=n[i];if(!c||e.substring(0,c.length)===c){for(var s=r[i+1],f=i;;){if(f==r.length-2){var l=e.substring(e.length-s.length);if(l!==s)return;var d=e.substring(0,e.length-s.length);e=l}else if(s){var p=e.indexOf(s);d=e.substring(0,p);e=e.substring(p)}else if(n[f+1]){-1===(p=e.indexOf(n[f+1]))&&(p=e.length);d=e.substring(0,p);e=e.substring(p)}else{if(r.length>f+2){s=r[++f+1];continue}d=e;e=""}break}if(!o[i](d,u,t.strict))return}}return u},this.varNames=c,this.template=e}return i.prototype={toString:function(){return this.template},fillFromObject:function(e){return this.fill(e)},test:function(e,t){return!!this.fromUri(e,t)}},i},"function"==typeof define&&define.amd?define("uri-templates",[],u):e.exports?e.exports=u():n.UriTemplate=u()},ywyh:function(e,t){!function(){e.exports=this.wp.apiFetch}()}});
1
+ this.itsec=this.itsec||{},this.itsec["user-groups"]=this.itsec["user-groups"]||{},this.itsec["user-groups"].api=function(e){function t(t){for(var n,a,o=t[0],c=t[1],s=t[2],l=0,d=[];l<o.length;l++)a=o[l],u[a]&&d.push(u[a][0]),u[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return i.push.apply(i,s||[]),r()}function r(){for(var e,t=0;t<i.length;t++){for(var r=i[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==u[c]&&(n=!1)}n&&(i.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},u={6:0},i=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var o=window.itsecWebpackJsonP=window.itsecWebpackJsonP||[],c=o.push.bind(o);o.push=t,o=o.slice();for(var s=0;s<o.length;s++)t(o[s]);var f=c;return i.push(["Ntz8",0]),r()}({"1ZqX":function(e,t){!function(){e.exports=this.wp.data}()},Mmq9:function(e,t){!function(){e.exports=this.wp.url}()},Ntz8:function(e,t,r){"use strict";r.r(t);var n={};r.r(n),r.d(n,"path",function(){return R}),r.d(n,"query",function(){return j}),r.d(n,"appendToQuery",function(){return k}),r.d(n,"receiveQuery",function(){return C}),r.d(n,"processItem",function(){return D}),r.d(n,"receiveGroup",function(){return N}),r.d(n,"receiveMatchables",function(){return F}),r.d(n,"startCreateGroup",function(){return B}),r.d(n,"failedCreateGroup",function(){return H}),r.d(n,"finishCreateGroup",function(){return L}),r.d(n,"startUpdateGroup",function(){return q}),r.d(n,"failedUpdateGroup",function(){return M}),r.d(n,"finishUpdateGroup",function(){return Y}),r.d(n,"startDeleteGroup",function(){return Q}),r.d(n,"failedDeleteGroup",function(){return W}),r.d(n,"finishDeleteGroup",function(){return K}),r.d(n,"receiveGroupSettings",function(){return V}),r.d(n,"startUpdateGroupSettings",function(){return J}),r.d(n,"failedUpdateGroupSettings",function(){return $}),r.d(n,"finishUpdateGroupSettings",function(){return z}),r.d(n,"createGroup",function(){return Z}),r.d(n,"updateGroup",function(){return X}),r.d(n,"deleteGroup",function(){return ee}),r.d(n,"updateGroupSettings",function(){return te}),r.d(n,"fetchGroupsSettings",function(){return re}),r.d(n,"startFetchGroupsSettings",function(){return ne}),r.d(n,"finishFetchGroupsSettings",function(){return ue}),r.d(n,"failedFetchGroupsSettings",function(){return ie}),r.d(n,"patchBulkGroupSettings",function(){return ae}),r.d(n,"startPatchBulkGroupSettings",function(){return oe}),r.d(n,"finishPatchBulkGroupSettings",function(){return ce}),r.d(n,"failedPatchBulkGroupSettings",function(){return se}),r.d(n,"RECEIVE_QUERY",function(){return fe}),r.d(n,"APPEND_TO_QUERY",function(){return le}),r.d(n,"RECEIVE_MATCHABLES",function(){return de}),r.d(n,"START_CREATE_GROUP",function(){return pe}),r.d(n,"FINISH_CREATE_GROUP",function(){return he}),r.d(n,"FAILED_CREATE_GROUP",function(){return ge}),r.d(n,"RECEIVE_GROUP",function(){return be}),r.d(n,"START_UPDATE_GROUP",function(){return ye}),r.d(n,"FINISH_UPDATE_GROUP",function(){return ve}),r.d(n,"FAILED_UPDATE_GROUP",function(){return me}),r.d(n,"START_DELETE_GROUP",function(){return Se}),r.d(n,"FINISH_DELETE_GROUP",function(){return Ie}),r.d(n,"FAILED_DELETE_GROUP",function(){return Ee}),r.d(n,"RECEIVE_GROUP_SETTINGS",function(){return Oe}),r.d(n,"START_UPDATE_GROUP_SETTINGS",function(){return _e}),r.d(n,"FINISH_UPDATE_GROUP_SETTINGS",function(){return Te}),r.d(n,"FAILED_UPDATE_GROUP_SETTINGS",function(){return Pe}),r.d(n,"START_FETCH_GROUPS_SETTINGS",function(){return xe}),r.d(n,"FINISH_FETCH_GROUPS_SETTINGS",function(){return Ae}),r.d(n,"FAILED_FETCH_GROUPS_SETTINGS",function(){return Ge}),r.d(n,"START_PATCH_BULK_GROUP_SETTINGS",function(){return Ue}),r.d(n,"FINISH_PATCH_BULK_GROUP_SETTINGS",function(){return we}),r.d(n,"FAILED_PATCH_BULK_GROUP_SETTINGS",function(){return Re});var u={};r.r(u),r.d(u,"getMatchables",function(){return ke}),r.d(u,"getMatchableType",function(){return Ce}),r.d(u,"getMatchableLabel",function(){return De}),r.d(u,"getGroups",function(){return Ne}),r.d(u,"getQueriedObjectIds",function(){return Be}),r.d(u,"getGroup",function(){return He}),r.d(u,"getGroupAttribute",function(){return Le}),r.d(u,"isUpdating",function(){return qe}),r.d(u,"isDeleting",function(){return Me}),r.d(u,"getGroupSettings",function(){return Ye}),r.d(u,"getGroupSetting",function(){return Qe}),r.d(u,"isUpdatingSettings",function(){return We}),r.d(u,"isBulkPatchingSettings",function(){return Ke}),r.d(u,"getGroupsBySetting",function(){return Ve});var i={};r.r(i),r.d(i,"getGroup",function(){return rt}),r.d(i,"getMatchables",function(){return nt}),r.d(i,"getGroupSettings",function(){return ut});var a=r("1ZqX"),o=r("RIqP"),c=r.n(o),s=r("ywyh"),f=r.n(s),l=r("Td6G");function d(e){return{type:"API_FETCH",request:e}}function p(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),u=2;u<r;u++)n[u-2]=arguments[u];return{type:"DISPATCH",storeKey:e,actionName:t,args:n}}var h={API_FETCH:function(e){var t=e.request;return f()(t).catch(l.f)},SELECT:function(e){var t,r=e.storeKey,n=e.selectorName,u=e.args;return(t=Object(a.select)(r))[n].apply(t,c()(u))},DISPATCH:function(e){var t,r=e.storeKey,n=e.actionName,u=e.args;return(t=Object(a.dispatch)(r))[n].apply(t,c()(u))}},g=r("o0o1"),b=r.n(g),y=r("YLtl"),v=r("qPad"),m=r.n(v),S=r("Mmq9"),I=b.a.mark(j),E=b.a.mark(k),O=b.a.mark(D),_=b.a.mark(Z),T=b.a.mark(X),P=b.a.mark(ee),x=b.a.mark(te),A=b.a.mark(re),G=b.a.mark(ae);function U(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var R="/ithemes-security/v1/user-groups";function j(e,t){var r,n,u,i;return b.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,d({path:Object(S.addQueryArgs)(R,t)});case 2:return r=a.sent,a.next=5,C(e,r);case 5:n=U(r),a.prev=6,n.s();case 8:if((u=n.n()).done){a.next=13;break}return i=u.value,a.delegateYield(D(i),"t0",11);case 11:a.next=8;break;case 13:a.next=18;break;case 15:a.prev=15,a.t1=a.catch(6),n.e(a.t1);case 18:return a.prev=18,n.f(),a.finish(18);case 21:return a.abrupt("return",r);case 22:case"end":return a.stop()}},I,null,[[6,15,18,21]])}function k(e,t){return b.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,{type:le,queryId:e,item:t};case 2:return r.delegateYield(D(t),"t0",3);case 3:case"end":return r.stop()}},E)}function C(e,t){return{type:fe,queryId:e,items:t}}function D(e){var t,r,n,u,i;return b.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:t=Object(y.get)(e,["_embedded","ithemes-security:user-group-member"],[]),r=Object(y.get)(e,["_embedded","ithemes-security:user-matchable-settings",0]),n=U(t),a.prev=3,n.s();case 5:if((u=n.n()).done){a.next=11;break}return i=u.value,a.next=9,p("ithemes-security/core","receiveUser",i);case 9:a.next=5;break;case 11:a.next=16;break;case 13:a.prev=13,a.t0=a.catch(3),n.e(a.t0);case 16:return a.prev=16,n.f(),a.finish(16);case 19:if(!r){a.next=22;break}return a.next=22,V(e.id,r);case 22:case"end":return a.stop()}},O,null,[[3,13,16,19]])}function N(e){return{type:be,group:e}}function F(e){return{type:de,matchables:e}}function B(e){return{type:pe,group:e}}function H(e,t){return{type:ge,group:e,error:t}}function L(e,t){return{type:he,group:e,response:t}}function q(e,t){return{type:ye,id:e,group:t}}function M(e,t){return{type:me,id:e,error:t}}function Y(e,t){return{type:ve,id:e,response:t}}function Q(e){return{type:Se,id:e}}function W(e,t){return{type:Ee,id:e,error:t}}function K(e){return{type:Ie,id:e}}function V(e,t){return{type:Oe,id:e,settings:t}}function J(e,t){return{type:_e,id:e,settings:t}}function $(e,t){return{type:Pe,id:e,error:t}}function z(e,t){return{type:Te,id:e,response:t}}function Z(e){var t;return b.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,B(e);case 2:return r.prev=2,r.next=5,d({path:Object(S.addQueryArgs)(R,{_embed:1}),method:"POST",data:e});case 5:t=r.sent,r.next=13;break;case 8:return r.prev=8,r.t0=r.catch(2),r.next=12,H(e,r.t0);case 12:return r.abrupt("return",r.t0);case 13:return r.next=15,L(e,t);case 15:return r.next=17,N(t);case 17:return r.delegateYield(D(t),"t1",18);case 18:return r.abrupt("return",t);case 19:case"end":return r.stop()}},_,null,[[2,8]])}function X(e,t){var r;return b.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,q(e,t);case 2:return n.prev=2,n.next=5,d({path:R+"/"+e,method:"PUT",data:t});case 5:r=n.sent,n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(2),n.next=12,M(e,n.t0);case 12:return n.abrupt("return",n.t0);case 13:return n.next=15,Y(e,r);case 15:return n.next=17,N(r);case 17:return n.abrupt("return",r);case 18:case"end":return n.stop()}},T,null,[[2,8]])}function ee(e){return b.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Q(e);case 2:return t.prev=2,t.next=5,d({path:"".concat(R,"/").concat(e),method:"DELETE"});case 5:t.next=12;break;case 7:return t.prev=7,t.t0=t.catch(2),t.next=11,W(e,t.t0);case 11:return t.abrupt("return",t.t0);case 12:return t.next=14,K(e);case 14:return t.abrupt("return",null);case 15:case"end":return t.stop()}},P,null,[[2,7]])}function te(e,t){var r;return b.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,J(e,t);case 2:return n.prev=2,n.next=5,d({path:"ithemes-security/v1/user-matchable-settings/".concat(e),method:"PUT",data:t});case 5:r=n.sent,n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(2),n.next=12,$(e,n.t0);case 12:return n.abrupt("return",n.t0);case 13:return n.next=15,z(e,r);case 15:return n.next=17,V(e,r);case 17:return n.abrupt("return",r);case 18:case"end":return n.stop()}},x,null,[[2,8]])}function re(){var e,t,r,n,u=arguments;return b.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=u.length>0&&void 0!==u[0]?u[0]:[],i.next=3,ne(e);case 3:return i.prev=3,r="ithemes-security/v1/user-matchable-settings",e.length>0&&(r=Object(S.addQueryArgs)(r,{include:e})),i.next=8,d({path:r});case 8:t=i.sent,i.next=16;break;case 11:return i.prev=11,i.t0=i.catch(3),i.next=15,ie(e,i.t0);case 15:return i.abrupt("return",i.t0);case 16:return i.next=18,ue(e,t);case 18:i.t1=b.a.keys(t);case 19:if((i.t2=i.t1()).done){i.next=27;break}if(n=i.t2.value,t.hasOwnProperty(n)){i.next=23;break}return i.abrupt("continue",19);case 23:return i.next=25,V(n,t[n]);case 25:i.next=19;break;case 27:return i.abrupt("return",t);case 28:case"end":return i.stop()}},A,null,[[3,11]])}function ne(e){return{type:xe,groupIds:e}}function ue(e,t){return{type:Ae,groupIds:e,response:t}}function ie(e,t){return{type:Ge,groupIds:e,error:t}}function ae(e,t){var r,n,u,i,o,c,s,f;return b.a.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,oe(e,t);case 2:return p.prev=2,p.next=5,d({path:Object(S.addQueryArgs)("ithemes-security/v1/user-matchable-settings",{include:e}),method:"PATCH",data:t});case 5:r=p.sent,p.next=13;break;case 8:return p.prev=8,p.t0=p.catch(2),p.next=12,se(e,t,p.t0);case 12:return p.abrupt("return",p.t0);case 13:return p.next=15,ce(e,t,r);case 15:if(n=Object(a.select)("ithemes-security/core").getSchema("ithemes-security-user-group-settings"),u=Object(l.c)(n,"self")){p.next=19;break}return p.abrupt("return",r);case 19:i=new m.a(u.href),o=U(r),p.prev=21,o.s();case 23:if((c=o.n()).done){p.next=34;break}if(200===(s=c.value).status){p.next=27;break}return p.abrupt("continue",32);case 27:if((f=i.fromUri(s.href)).id){p.next=30;break}return p.abrupt("continue",32);case 30:return p.next=32,V(f.id,s.response);case 32:p.next=23;break;case 34:p.next=39;break;case 36:p.prev=36,p.t1=p.catch(21),o.e(p.t1);case 39:return p.prev=39,o.f(),p.finish(39);case 42:return p.abrupt("return",r);case 43:case"end":return p.stop()}},G,null,[[2,8],[21,36,39,42]])}function oe(e,t){return{type:Ue,groupIds:e,patch:t}}function ce(e,t,r){return{type:we,groupIds:e,patch:t,response:r}}function se(e,t,r){return{type:Re,groupIds:e,patch:t,error:r}}var fe="RECEIVE_QUERY",le="APPEND_TO_QUERY",de="RECEIVE_MATCHABLES",pe="START_CREATE_GROUP",he="FINISH_CREATE_GROUP",ge="FAILED_CREATE_GROUP",be="RECEIVE_GROUP",ye="START_UPDATE_GROUP",ve="FINISH_UPDATE_GROUP",me="FAILED_UPDATE_GROUP",Se="START_DELETE_GROUP",Ie="FINISH_DELETE_GROUP",Ee="FAILED_DELETE_GROUP",Oe="RECEIVE_GROUP_SETTINGS",_e="START_UPDATE_GROUP_SETTINGS",Te="FINISH_UPDATE_GROUP_SETTINGS",Pe="FAILED_UPDATE_GROUP_SETTINGS",xe="START_FETCH_GROUPS_SETTINGS",Ae="FINISH_FETCH_GROUPS_SETTINGS",Ge="FAILED_FETCH_GROUPS_SETTINGS",Ue="START_PATCH_BULK_GROUP_SETTINGS",we="FINISH_PATCH_BULK_GROUP_SETTINGS",Re="FAILED_PATCH_BULK_GROUP_SETTINGS",je=r("pPDe"),ke=Object(je.a)(function(e){return Object(y.filter)(Object(y.map)(e.matchableIds,function(t){return e.matchablesById[t]}),y.isObject)},function(e){return[e.matchablesById,e.matchableIds]});function Ce(e,t){return(e.matchablesById[t]||{}).type}function De(e,t){return(e.matchablesById[t]||{}).label}var Ne=Object(je.a)(function(e,t){return Object(y.filter)(Object(y.map)(e.queries[t],function(t){return e.byId[t]}),y.isObject)},function(e,t){return[e.queries[t],e.byId]}),Fe=[];function Be(e,t){return e.queries[t]||Fe}function He(e,t){return e.byId[t]}function Le(e,t,r){var n=Object(a.select)("ithemes-security/user-groups").getGroup(t);return n?n[r]:void 0}function qe(e,t){return e.updating.includes(t)}function Me(e,t){return e.deleting.includes(t)}function Ye(e,t){return e.settings[t]}function Qe(e,t,r,n){var u=Object(a.select)("ithemes-security/user-groups").getGroupSettings(t);return Object(y.get)(u,[r,n])}function We(e,t){return e.updatingSettings.includes(t)}function Ke(e,t,r){var n=t.join("_");return e.bulkPatchingSettings[n]===r}function Ve(e){var t={};for(var r in e.settings)if(e.settings.hasOwnProperty(r))for(var n in e.settings[r])if(e.settings[r].hasOwnProperty(n))for(var u in e.settings[r][n])e.settings[r][n].hasOwnProperty(u)&&(t[n]||(t[n]={}),t[n][u]||(t[n][u]=[]),e.settings[r][n][u]&&t[n][u].push(r));return t}var Je=r("lSNA"),$e=r.n(Je);function ze(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ze(Object(r),!0).forEach(function(t){$e()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ze(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Xe={matchablesById:{},matchableIds:[],byId:{},queries:{},creating:[],updating:[],deleting:[],settings:{},updatingSettings:[],bulkPatchingSettings:{}};function et(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return tt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tt(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var rt={fulfill:b.a.mark(function e(t){var r;return b.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({path:"".concat(R,"/").concat(t,"?_embed=1")});case 2:return r=e.sent,e.next=5,N(r);case 5:return e.delegateYield(D(r),"t0",6);case 6:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return e.byId.hasOwnProperty(t)}},nt={fulfill:b.a.mark(function e(){var t,r,n,u,i,a;return b.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({path:"/ithemes-security/v1/user-matchables?_embed=1"});case 2:return t=e.sent,e.next=5,F(t);case 5:r=et(t),e.prev=6,r.s();case 8:if((n=r.n()).done){e.next=20;break}if(u=n.value,i=Object(y.get)(u,["_embedded","self",0]),a=Object(y.get)(u,["_embedded","ithemes-security:user-matchable-settings",0]),!i){e.next=15;break}return e.next=15,N(i);case 15:if(!a){e.next=18;break}return e.next=18,V(u.id,a);case 18:e.next=8;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(6),r.e(e.t0);case 25:return e.prev=25,r.f(),e.finish(25);case 28:case"end":return e.stop()}},e,null,[[6,22,25,28]])}),isFulfilled:function(e){return!Object(y.isEmpty)(e.matchablesById)}},ut={fulfill:b.a.mark(function e(t){var r;return b.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({path:"ithemes-security/v1/user-matchable-settings/".concat(t)});case 2:return r=e.sent,e.next=5,V(t,r);case 5:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return e.settings.hasOwnProperty(t)}},it=Object(a.registerStore)("ithemes-security/user-groups",{controls:h,actions:n,selectors:u,resolvers:i,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xe,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case de:return Ze(Ze({},e),{},{matchableIds:Object(y.map)(t.matchables,"id"),matchablesById:Object(y.keyBy)(t.matchables,"id")});case fe:return Ze(Ze({},e),{},{byId:Ze(Ze({},e.byId),Object(y.keyBy)(t.items,"id")),queries:Ze(Ze({},e.queries),{},$e()({},t.queryId,Object(y.map)(t.items,"id")))});case le:return Ze(Ze({},e),{},{byId:Ze(Ze({},e.byId),{},$e()({},t.item.id,t.item)),queries:Ze(Ze({},e.queries),{},$e()({},t.queryId,[].concat(c()(e.queries[t.queryId]||[]),[t.item.id])))});case be:return Ze(Ze({},e),{},{byId:Ze(Ze({},e.byId),{},$e()({},t.group.id,t.group)),matchablesById:e.matchablesById[t.group.id]?Ze(Ze({},e.matchablesById),{},$e()({},t.group.id,Ze(Ze({},e.matchablesById[t.group.id]),{},{label:t.group.label}))):e.matchablesById});case pe:return Ze(Ze({},e),{},{creating:[].concat(c()(e.creating),[t.group])});case he:return Ze(Ze({},e),{},{creating:e.creating.filter(function(e){return e!==t.group}),matchablesById:Ze(Ze({},e.matchablesById),{},$e()({},t.response.id,{id:t.response.id,label:t.response.label,type:"user-group"})),matchableIds:[].concat(c()(e.matchableIds),[[t.response.id]])});case ge:return Ze(Ze({},e),{},{creating:e.creating.filter(function(e){return e!==t.group})});case ye:return Ze(Ze({},e),{},{updating:[].concat(c()(e.updating),[t.id])});case ve:case me:return Ze(Ze({},e),{},{updating:e.updating.filter(function(e){return e!==t.id})});case Se:return Ze(Ze({},e),{},{deleting:[].concat(c()(e.deleting),[t.id])});case Ie:return Ze(Ze({},e),{},{deleting:e.deleting.filter(function(e){return e!==t.id}),byId:Object(y.omit)(e.byId,[t.id]),matchablesById:Object(y.omit)(e.matchablesById,[t.id]),matchableIds:e.matchableIds.filter(function(e){return e!==t.id}),settings:Object(y.omit)(e.settings,[t.id])});case Ee:return Ze(Ze({},e),{},{deleting:e.deleting.filter(function(e){return e!==t.id})});case Oe:return Ze(Ze({},e),{},{settings:Ze(Ze({},e.settings),{},$e()({},t.id,t.settings))});case _e:return Ze(Ze({},e),{},{updatingSettings:[].concat(c()(e.updatingSettings),[t.id])});case Te:case Pe:return Ze(Ze({},e),{},{updatingSettings:e.updatingSettings.filter(function(e){return e!==t.id})});case Ue:return Ze(Ze({},e),{},{bulkPatchingSettings:Ze(Ze({},e.bulkPatchingSettings),{},$e()({},t.groupIds.join("_"),t.patch))});case we:case Re:return Ze(Ze({},e),{},{bulkPatchingSettings:Object(y.omit)(e.bulkPatchingSettings,[t.groupIds.join("_")])});default:return e}}});r.d(t,"store",function(){return it}),r.p=window.itsecWebpackPublicPath},Td6G:function(e,t,r){"use strict";r("J4zp");var n=r("YLtl"),u=r("RIqP"),i=r.n(u),a=r("lwsE"),o=r.n(a),c=r("W8MJ"),s=r.n(c),f=r("lSNA"),l=r.n(f),d=r("92Nh"),p=r.n(d),h=r("tmk3"),g=r.n(h);function b(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var v=new WeakMap,m=new WeakMap,S=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;o()(this,e),v.set(this,{writable:!0,value:{}}),m.set(this,{writable:!0,value:{}}),l()(this,"getErrorCodes",function(){return Object.keys(g()(t,v))}),l()(this,"getErrorCode",function(){return t.getErrorCodes()[0]}),l()(this,"getErrorMessages",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(e)return g()(t,v)[e];var r=[];for(var n in g()(t,v))g()(t,v).hasOwnProperty(n)&&r.concat(g()(t,v)[n]);return r}),l()(this,"getErrorMessage",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),t.getErrorMessages(e)[0]}),l()(this,"getErrorData",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),g()(t,m)[e]}),l()(this,"getAllErrorMessages",function(){var e=[];for(var r in g()(t,v))g()(t,v).hasOwnProperty(r)&&e.push.apply(e,i()(g()(t,v)[r]));return e}),r&&(n&&(g()(this,v)[r]=[n]),u&&(g()(this,m)[r]=u))}return s()(e,null,[{key:"fromPHPObject",value:function(t){var r=new e;return p()(r,v,t.errors),p()(r,m,t.error_data),r}},{key:"fromApiError",value:function(t){var r=new e;if(g()(r,v)[t.code]=[t.message],g()(r,m)[t.code]=t.data,t.additional_errors){var n,u=b(t.additional_errors);try{for(u.s();!(n=u.n()).done;){var i=n.value;g()(r,v)[i.code]=[i.message],g()(r,m)[i.code]=i.data}}catch(e){u.e(e)}finally{u.f()}}return r}}]),e}(),I=r("PJYZ"),E=r.n(I),O=r("7W2i"),_=r.n(O),T=r("a1gu"),P=r.n(T),x=r("Nsbk"),A=r.n(x),G=r("oShl"),U=r.n(G),w=r("l3Sj");function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=A()(e);if(t){var u=A()(this).constructor;r=Reflect.construct(n,arguments,u)}else r=n.apply(this,arguments);return P()(this,r)}}var j=function(e){_()(r,e);var t=R(r);function r(e){var n;o()(this,r);for(var u=arguments.length,i=new Array(u>1?u-1:0),a=1;a<u;a++)i[a-1]=arguments[a];for(var c in n=t.call.apply(t,[this,e.message||Object(w.__)("An unknown error occurred.","better-wp-security")].concat(i)),Error.captureStackTrace&&Error.captureStackTrace(E()(n),r),n.__response=e,e)e.hasOwnProperty(c)&&Object.defineProperty(E()(n),c,{value:e[c],configurable:!0,enumerable:!0,writable:!0});return n}return s()(r,[{key:"toString",value:function(){return this.__response.toString()}},{key:"getResponse",value:function(){return this.__response}}]),r}(U()(Error));function k(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return C(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,u=function(){};return{s:u,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,o=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function D(e){if(!Object(n.isPlainObject)(e))return!1;var t=Object.keys(e);return 2===t.length&&(t.includes("errors")&&t.includes("error_data"))}function N(e){return D(e)?S.fromPHPObject(e):function(e){if(!Object(n.isPlainObject)(e))return!1;var t=Object.keys(e);return(3===t.length||4===t.length)&&!(4===t.length&&!t.includes("additional_errors"))&&t.includes("code")&&t.includes("message")&&t.includes("data")}(e)?S.fromApiError(e):new S}function F(e,t){var r,n=[[],[]],u=k(e);try{for(u.s();!(r=u.n()).done;){var i=r.value;n[t(i)?0:1].push(i)}}catch(e){u.e(e)}finally{u.f()}return n}function B(e){if(e instanceof Error)throw e;throw new j(e)}r.d(t,"e",function(){return D}),r.d(t,"b",function(){return N}),r.d(t,"a",function(){return F}),r.d(t,"f",function(){return B}),r.d(t,"d",function(){return H}),r.d(t,"c",function(){return L});function H(e){return function(e,t){return Object(n.get)(e,["_links",t,0,"href"])}(e,"self")}function L(e,t){if(e&&e.links){var r,n=k(e.links);try{for(n.s();!(r=n.n()).done;){var u=r.value;if(u.rel===t)return u}}catch(e){n.e(e)}finally{n.f()}}}},YLtl:function(e,t){!function(){e.exports=this.lodash}()},l3Sj:function(e,t){!function(){e.exports=this.wp.i18n}()},pPDe:function(e,t,r){"use strict";var n,u;function i(e){return[e]}function a(){var e={clear:function(){e.head=null}};return e}function o(e,t,r){var n;if(e.length!==t.length)return!1;for(n=r;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}n={},u="undefined"!=typeof WeakMap,t.a=function(e,t){var r,c;function s(){r=u?new WeakMap:a()}function f(){var r,n,u,i,a,s=arguments.length;for(i=new Array(s),u=0;u<s;u++)i[u]=arguments[u];for(a=t.apply(null,i),(r=c(a)).isUniqueByDependants||(r.lastDependants&&!o(a,r.lastDependants,0)&&r.clear(),r.lastDependants=a),n=r.head;n;){if(o(n.args,i,1))return n!==r.head&&(n.prev.next=n.next,n.next&&(n.next.prev=n.prev),n.next=r.head,n.prev=null,r.head.prev=n,r.head=n),n.val;n=n.next}return n={val:e.apply(null,i)},i[0]=null,n.args=i,r.head&&(r.head.prev=n,n.next=r.head),r.head=n,n.val}return t||(t=i),c=u?function(e){var t,u,i,o,c,s=r,f=!0;for(t=0;t<e.length;t++){if(u=e[t],!(c=u)||"object"!=typeof c){f=!1;break}s.has(u)?s=s.get(u):(i=new WeakMap,s.set(u,i),s=i)}return s.has(n)||((o=a()).isUniqueByDependants=f,s.set(n,o)),s.get(n)}:function(){return r},f.getDependants=t,f.clear=s,s(),f}},qPad:function(e,t,r){var n,u;n=this,u=function(){var e={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},t={"*":!0};function r(e){return encodeURI(e).replace(/%25[0-9][0-9]/g,function(e){return"%"+e.substring(3)})}function n(e){return e=e.replace(/%../g,""),encodeURIComponent(e)===e}function u(u){var i="";e[u.charAt(0)]&&(i=u.charAt(0),u=u.substring(1));var a="",o="",c=!0,s=!1,f=!1;"+"==i?c=!1:"."==i?(o=".",a="."):"/"==i?(o="/",a="/"):"#"==i?(o="#",c=!1):";"==i?(o=";",a=";",s=!0,f=!0):"?"==i?(o="?",a="&",s=!0):"&"==i&&(o="&",a="&",s=!0);for(var l=[],d=u.split(","),p=[],h={},g=0;g<d.length;g++){var b=d[g],y=null;if(-1!=b.indexOf(":")){var v=b.split(":");b=v[0],y=parseInt(v[1])}for(var m={};t[b.charAt(b.length-1)];)m[b.charAt(b.length-1)]=!0,b=b.substring(0,b.length-1);var S={truncate:y,name:b,suffices:m};p.push(S),h[b]=S,l.push(b)}return{varNames:l,prefix:o,substitution:function(e){for(var t="",n=0,u=0;u<p.length;u++){var i=p[u],l=e(i.name);if(null==l||Array.isArray(l)&&0==l.length||"object"==typeof l&&0==Object.keys(l).length)n++;else if(t+=u==n?o:a||",",Array.isArray(l)){s&&(t+=i.name+"=");for(var d=0;d<l.length;d++)d>0&&(t+=i.suffices["*"]&&a||",",i.suffices["*"]&&s&&(t+=i.name+"=")),t+=c?encodeURIComponent(l[d]).replace(/!/g,"%21"):r(l[d])}else if("object"==typeof l){s&&!i.suffices["*"]&&(t+=i.name+"=");var h=!0;for(var g in l)h||(t+=i.suffices["*"]&&a||","),h=!1,t+=c?encodeURIComponent(g).replace(/!/g,"%21"):r(g),t+=i.suffices["*"]?"=":",",t+=c?encodeURIComponent(l[g]).replace(/!/g,"%21"):r(l[g])}else s&&(t+=i.name,f&&""==l||(t+="=")),null!=i.truncate&&(l=l.substring(0,i.truncate)),t+=c?encodeURIComponent(l).replace(/!/g,"%21"):r(l)}return t},unSubstitution:function(e,t,r){if(o&&(e=e.substring(o.length)),1==p.length&&p[0].suffices["*"]){for(var u=(O=p[0]).name,i=O.suffices["*"]?e.split(a||","):[e],f=c&&-1!=e.indexOf("="),l=1;l<i.length;l++)e=i[l],f&&-1==e.indexOf("=")&&(i[l-1]+=(a||",")+e,i.splice(l,1),l--);for(l=0;l<i.length;l++)e=i[l],c&&-1!=e.indexOf("=")&&(f=!0),1==(v=e.split(",")).length?i[l]=v[0]:i[l]=v;if(s||f){for(var d=t[u]||{},g=0;g<i.length;g++){var b=e;if(!s||b){if("string"==typeof i[g]){var y=(e=i[g]).split("=",1)[0];if(e=e.substring(y.length+1),c){if(r&&!n(e))return;e=decodeURIComponent(e)}b=e}else{if(y=(e=i[g][0]).split("=",1)[0],e=e.substring(y.length+1),c){if(r&&!n(e))return;e=decodeURIComponent(e)}i[g][0]=e,b=i[g]}if(c){if(r&&!n(y))return;y=decodeURIComponent(y)}void 0!==d[y]?Array.isArray(d[y])?d[y].push(b):d[y]=[d[y],b]:d[y]=b}}1==Object.keys(d).length&&void 0!==d[u]?t[u]=d[u]:t[u]=d}else{if(c)for(g=0;g<i.length;g++){var v=i[g];if(Array.isArray(v))for(var m=0;m<v.length;m++){if(r&&!n(v[m]))return;v[m]=decodeURIComponent(v[m])}else{if(r&&!n(v))return;i[g]=decodeURIComponent(v)}}void 0!==t[u]?Array.isArray(t[u])?t[u]=t[u].concat(i):t[u]=[t[u]].concat(i):1!=i.length||O.suffices["*"]?t[u]=i:t[u]=i[0]}}else{i=1==p.length?[e]:e.split(a||",");var S={};for(l=0;l<i.length;l++){for(var I=0;I<p.length-1&&I<l&&!p[I].suffices["*"];I++);if(I!=l){for(var E=p.length-1;E>0&&p.length-E<i.length-l&&!p[E].suffices["*"];E--);p.length-E!=i.length-l?S[l]=I:S[l]=E}else S[l]=l}for(l=0;l<i.length;l++)if((e=i[l])||!s){if(v=e.split(","),f=!1,s){u=(e=v[0]).split("=",1)[0],e=e.substring(u.length+1),v[0]=e;var O=h[u]||p[0]}else u=(O=p[S[l]]).name;for(g=0;g<v.length;g++)if(c){if(r&&!n(v[g]))return;v[g]=decodeURIComponent(v[g])}(s||O.suffices["*"])&&void 0!==t[u]?Array.isArray(t[u])?t[u]=t[u].concat(v):t[u]=[t[u]].concat(v):1!=v.length||O.suffices["*"]?t[u]=v:t[u]=v[0]}}return 1}}}function i(e){if(!(this instanceof i))return new i(e);for(var t=e.split("{"),r=[t.shift()],n=[],a=[],o=[],c=[];t.length>0;){var s=t.shift(),f=s.split("}")[0],l=s.substring(f.length+1),d=u(f);a.push(d.substitution),o.push(d.unSubstitution),n.push(d.prefix),r.push(l),c=c.concat(d.varNames)}this.fill=function(e){if(e&&"function"!=typeof e){var t=e;e=function(e){return t[e]}}for(var n=r[0],u=0;u<a.length;u++){n+=(0,a[u])(e),n+=r[u+1]}return n},this.fromUri=function(e,t){t=t||{};for(var u={},i=0;i<r.length;i++){var a=r[i];if(e.substring(0,a.length)!==a)return;if(e=e.substring(a.length),i>=r.length-1){if(""==e)break;return}var c=n[i];if(!c||e.substring(0,c.length)===c){for(var s=r[i+1],f=i;;){if(f==r.length-2){var l=e.substring(e.length-s.length);if(l!==s)return;var d=e.substring(0,e.length-s.length);e=l}else if(s){var p=e.indexOf(s);d=e.substring(0,p);e=e.substring(p)}else if(n[f+1]){-1===(p=e.indexOf(n[f+1]))&&(p=e.length);d=e.substring(0,p);e=e.substring(p)}else{if(r.length>f+2){s=r[++f+1];continue}d=e;e=""}break}if(!o[i](d,u,t.strict))return}}return u},this.varNames=c,this.template=e}return i.prototype={toString:function(){return this.template},fillFromObject:function(e){return this.fill(e)},test:function(e,t){return!!this.fromUri(e,t)}},i},"function"==typeof define&&define.amd?define("uri-templates",[],u):e.exports?e.exports=u():n.UriTemplate=u()},ywyh:function(e,t){!function(){e.exports=this.wp.apiFetch}()}});
dist/user-groups/settings.min.js CHANGED
@@ -1,7 +1,7 @@
1
- this.itsec=this.itsec||{},this.itsec["user-groups"]=this.itsec["user-groups"]||{},this.itsec["user-groups"].settings=function(e){function t(t){for(var r,c,s=t[0],a=t[1],u=t[2],d=0,p=[];d<s.length;d++)c=s[d],i[c]&&p.push(i[c][0]),i[c]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(l&&l(t);p.length;)p.shift()();return o.push.apply(o,u||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,s=1;s<n.length;s++){var a=n[s];0!==i[a]&&(r=!1)}r&&(o.splice(t--,1),e=c(c.s=n[0]))}return e}var r={},i={7:0,4:0},o=[];function c(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,c),n.l=!0,n.exports}c.e=function(e){var t=[],n=i[e];if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o,s=document.createElement("script");s.charset="utf-8",s.timeout=120,c.nc&&s.setAttribute("nonce",c.nc),s.src=function(e){return c.p+""+({}[e]||e)+".min.js"}(e),o=function(t){s.onerror=s.onload=null,clearTimeout(a);var n=i[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src,c=new Error("Loading chunk "+e+" failed.\n("+r+": "+o+")");c.type=r,c.request=o,n[1](c)}i[e]=void 0}};var a=setTimeout(function(){o({type:"timeout",target:s})},12e4);s.onerror=s.onload=o,document.head.appendChild(s)}return Promise.all(t)},c.m=e,c.c=r,c.d=function(e,t,n){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,t){if(1&t&&(e=c(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(c.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)c.d(n,r,function(t){return e[t]}.bind(null,r));return n},c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="",c.oe=function(e){throw console.error(e),e};var s=window.itsecWebpackJsonP=window.itsecWebpackJsonP||[],a=s.push.bind(s);s.push=t,s=s.slice();for(var u=0;u<s.length;u++)t(s[u]);var l=a;return o.push(["epig",0]),n()}({"+VN0":function(e,t,n){},"16Al":function(e,t,n){"use strict";var r=n("WbBG");function i(){}e.exports=function(){function e(e,t,n,i,o,c){if(c!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=i,n.PropTypes=n,n}},"17x9":function(e,t,n){e.exports=n("16Al")()},"1ZqX":function(e,t){!function(){e.exports=this.wp.data}()},"31KZ":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withErrorBoundary=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n("cDcd"),o=s(i),c=s(n("Xvx9"));function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=n("cDcd").babelPluginFlowReactPropTypes_proptype_ComponentType||n("17x9").any,l=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Array(i),c=0;c<i;c++)o[c]=arguments[c];return n=r=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),r.state={error:null,info:null},a(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"componentDidCatch",value:function(e,t){var n=this.props.onError;if("function"==typeof n)try{n.call(this,e,t?t.componentStack:"")}catch(e){}this.setState({error:e,info:t})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.FallbackComponent,r=this.state,i=r.error,c=r.info;return null!==i?o.default.createElement(n,{componentStack:c?c.componentStack:"",error:i}):t}}]),t}();l.defaultProps={FallbackComponent:c.default},l.propTypes={error:"function"==typeof Error?n("17x9").instanceOf(Error):n("17x9").any,info:n("17x9").shape({componentStack:n("17x9").string.isRequired})},(t.withErrorBoundary=function(e,t,n){return function(r){return o.default.createElement(l,{FallbackComponent:t,onError:n},o.default.createElement(e,r))}}).propTypes=u===n("17x9").any?{}:u,t.default=l},"4eJC":function(e,t,n){e.exports=function(e,t){var n,r,i,o=0;function c(){var t,c,s=r,a=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(c=0;c<a;c++)if(s.args[c]!==arguments[c]){s=s.next;continue e}return s!==r&&(s===i&&(i=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=r,s.prev=null,r.prev=s,r=s),s.val}s=s.next}for(t=new Array(a),c=0;c<a;c++)t[c]=arguments[c];return s={args:t,val:e.apply(null,t)},r?(r.prev=s,s.next=r):i=s,o===n?(i=i.prev).next=null:o++,r=s,s.val}return t&&t.maxSize&&(n=t.maxSize),c.clear=function(){r=null,i=null,o=0},c}},"6ECA":function(e,t,n){},"8OQS":function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}},A6yB:function(e,t,n){},DfSy:function(e,t,n){},Dfre:function(e,t,n){},ELjz:function(e,t,n){},GRId:function(e,t){!function(){e.exports=this.wp.element}()},"GjY+":function(e,t,n){},GrEf:function(e,t,n){},IXp0:function(e,t,n){},JVTk:function(e,t,n){var r=n("cDcd");function i(e){return r.createElement("svg",e,[r.createElement("defs",{key:0},r.createElement("style",null,".itsec-icon-logo-12f8d__path{fill:#1072ba;}.itsec-icon-logo-12f8d__path{fill:#69c;}")),r.createElement("g",{key:1},r.createElement("g",null,[r.createElement("path",{className:"itsec-icon-logo-12f8d__path",d:"M203.28,95V14.26a1.73,1.73,0,0,0-1.11-1.55c-4.38-1.44-21.5-6.6-46.22-8a1.1,1.1,0,0,0-1.17,1.11V20.1a1,1,0,0,1-1.16,1c-8-1.24-16.88-2.29-26.39-3a1.27,1.27,0,0,1-1.17-1.25V3a1.37,1.37,0,0,0-1.16-1.32A211.61,211.61,0,0,0,101,0,178.14,178.14,0,0,0,78.51,1.87a1.4,1.4,0,0,0-1.16,1.35V16.91a1.28,1.28,0,0,1-1.16,1.26c-9.51.72-18.34,1.78-26.38,3a1,1,0,0,1-1.16-1V5.79a1.1,1.1,0,0,0-1.17-1.11c-24.74,1.43-41.94,6.59-46.34,8A1.73,1.73,0,0,0,0,14.26V95s-2.3,54.32,34.61,97.07c32.69,37.86,60,46.91,65.84,48.5a5.16,5.16,0,0,0,2.28,0c5.82-1.58,33.16-10.63,65.83-48.5C205.51,149.35,203.28,95,203.28,95Z",key:0}),r.createElement("path",{className:"itsec-icon-logo-12f8d__path",d:"M101.38,68.5a21.75,21.75,0,1,0,21.7,21.81A21.77,21.77,0,0,0,101.38,68.5Z",key:1}),r.createElement("path",{className:"itsec-icon-logo-12f8d__path",d:"M182.44,87V42.75A1.92,1.92,0,0,0,181,41a385.2,385.2,0,0,0-78.26-8.05h-1.66a398.43,398.43,0,0,0-78.71,8.21,1.9,1.9,0,0,0-1.45,1.78l0,44.2v.24c0,3.27.09,54.82,33.38,93.35,18.71,21.67,35,33.81,46.15,40.44a2.79,2.79,0,0,0,2.56,0c11.14-6.61,27.36-18.74,46.12-40.45C183.22,141.12,182.46,87.63,182.44,87Zm-50.57,79.1c-2.69,3.13-5.32,6-7.87,8.69-.59.61-1.07.41-1.07-.44V155.78c0-14.05,13.64-21.19,18.14-23.17a2.49,2.49,0,0,0,1.42-2.11V116.39a1,1,0,0,0-1.41-.94c-37.93,15.49-72.25,3-79.51,0a.93.93,0,0,0-1.41.91V130.5a2.37,2.37,0,0,0,1.44,2.06c14.94,5.72,18,15.46,18,23.4v18.25c0,.85-.48,1-1.06.43-2.51-2.63-5.09-5.46-7.76-8.53-28.11-32.58-27.95-78.24-27.93-78.7V61.47a1.86,1.86,0,0,1,1.51-1.77,374.15,374.15,0,0,1,56.51-4.51h1.69a364.08,364.08,0,0,1,55.75,4.32,1.86,1.86,0,0,1,1.52,1.78v25.3C159.83,87.44,160.12,133.44,131.87,166.11Z",key:2})]))])}i.defaultProps={width:"200px",viewBox:"0 0 203.31 240.72"},e.exports=i,i.default=i},K9lf:function(e,t){!function(){e.exports=this.wp.compose}()},Mmq9:function(e,t){!function(){e.exports=this.wp.url}()},QILm:function(e,t,n){var r=n("8OQS");e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;i<c.length;i++)n=c[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},QmYb:function(e,t,n){},QxRw:function(e,t,n){},TSYQ:function(e,t,n){
2
  /*!
3
  Copyright (c) 2017 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
  */
7
- !function(){"use strict";var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var c=n.apply(null,i);c&&e.push(c)}else if("object"===o)for(var s in i)t.call(i,s)&&i[s]&&e.push(s)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()},Td6G:function(e,t,n){"use strict";n("J4zp");var r=n("YLtl"),i=n("RIqP"),o=n.n(i),c=n("lwsE"),s=n.n(c),a=n("W8MJ"),u=n.n(a),l=n("lSNA"),d=n.n(l),p=n("92Nh"),f=n.n(p),h=n("tmk3"),b=n.n(h);function m(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var g=new WeakMap,y=new WeakMap,O=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;s()(this,e),g.set(this,{writable:!0,value:{}}),y.set(this,{writable:!0,value:{}}),d()(this,"getErrorCodes",function(){return Object.keys(b()(t,g))}),d()(this,"getErrorCode",function(){return t.getErrorCodes()[0]}),d()(this,"getErrorMessages",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(e)return b()(t,g)[e];var n=[];for(var r in b()(t,g))b()(t,g).hasOwnProperty(r)&&n.concat(b()(t,g)[r]);return n}),d()(this,"getErrorMessage",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),t.getErrorMessages(e)[0]}),d()(this,"getErrorData",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),b()(t,y)[e]}),d()(this,"getAllErrorMessages",function(){var e=[];for(var n in b()(t,g))b()(t,g).hasOwnProperty(n)&&e.push.apply(e,o()(b()(t,g)[n]));return e}),n&&(r&&(b()(this,g)[n]=[r]),i&&(b()(this,y)[n]=i))}return u()(e,null,[{key:"fromPHPObject",value:function(t){var n=new e;return f()(n,g,t.errors),f()(n,y,t.error_data),n}},{key:"fromApiError",value:function(t){var n=new e;if(b()(n,g)[t.code]=[t.message],b()(n,y)[t.code]=t.data,t.additional_errors){var r,i=m(t.additional_errors);try{for(i.s();!(r=i.n()).done;){var o=r.value;b()(n,g)[o.code]=[o.message],b()(n,y)[o.code]=o.data}}catch(e){i.e(e)}finally{i.f()}}return n}}]),e}(),j=n("PJYZ"),E=n.n(j),_=n("7W2i"),w=n.n(_),S=n("a1gu"),I=n.n(S),k=n("Nsbk"),x=n.n(k),N=n("oShl"),C=n.n(N),R=n("l3Sj");function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=x()(e);if(t){var i=x()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return I()(this,n)}}var T=function(e){w()(n,e);var t=P(n);function n(e){var r;s()(this,n);for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];for(var a in r=t.call.apply(t,[this,e.message||Object(R.__)("An unknown error occurred.","better-wp-security")].concat(o)),Error.captureStackTrace&&Error.captureStackTrace(E()(r),n),r.__response=e,e)e.hasOwnProperty(a)&&Object.defineProperty(E()(r),a,{value:e[a],configurable:!0,enumerable:!0,writable:!0});return r}return u()(n,[{key:"toString",value:function(){return this.__response.toString()}},{key:"getResponse",value:function(){return this.__response}}]),n}(C()(Error));function D(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function L(e){if(!Object(r.isPlainObject)(e))return!1;var t=Object.keys(e);return 2===t.length&&(t.includes("errors")&&t.includes("error_data"))}function G(e){return L(e)?O.fromPHPObject(e):function(e){if(!Object(r.isPlainObject)(e))return!1;var t=Object.keys(e);return(3===t.length||4===t.length)&&!(4===t.length&&!t.includes("additional_errors"))&&t.includes("code")&&t.includes("message")&&t.includes("data")}(e)?O.fromApiError(e):new O}function M(e,t){var n,r=[[],[]],i=D(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r[t(o)?0:1].push(o)}}catch(e){i.e(e)}finally{i.f()}return r}function B(e){if(e instanceof Error)throw e;throw new T(e)}n.d(t,"d",function(){return L}),n.d(t,"b",function(){return G}),n.d(t,"a",function(){return M}),n.d(t,"e",function(){return B}),n.d(t,"c",function(){return U});function U(e,t){if(e&&e.links){var n,r=D(e.links);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.rel===t)return i}}catch(e){r.e(e)}finally{r.f()}}}},WbBG:function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},XO7p:function(e,t,n){},Xvx9:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n("cDcd"),o=(r=i)&&r.__esModule?r:{default:r};var c=function(e,t){return e.toString()+"\n\nThis is located at:"+t},s=function(e){var t=e.componentStack,n=e.error;return o.default.createElement("div",{style:a,title:c(n,t)},o.default.createElement("svg",{style:u,viewBox:"0 0 24 24",preserveAspectRatio:"xMidYMid"},o.default.createElement("path",{d:"M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,\n 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,\n 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,\n 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,\n 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,\n 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,\n 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"})))};s.propTypes={componentStack:n("17x9").string.isRequired,error:"function"==typeof Error?n("17x9").instanceOf(Error).isRequired:n("17x9").any.isRequired};var a={height:"100%",maxHeight:"100vh",width:"100%",maxWidth:"100vw",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",backgroundColor:"#C00",color:"#FFF",boxSizing:"border-box",cursor:"help"},u={fill:"currentColor",flex:"1 1 auto"};t.default=s},Y0od:function(e,t,n){},Y8OO:function(e,t){!function(){e.exports=this.wp.domReady}()},YLtl:function(e,t){!function(){e.exports=this.lodash}()},ZRc3:function(e,t,n){},"bJT+":function(e,t,n){},cDcd:function(e,t){!function(){e.exports=this.React}()},epig:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"getUser",function(){return w}),n.d(r,"getIndex",function(){return S}),n.d(r,"getSchema",function(){return I}),n.d(r,"getRoles",function(){return k});var i={};n.r(i),n.d(i,"fetchIndex",function(){return R}),n.d(i,"receiveIndex",function(){return P}),n.d(i,"receiveUser",function(){return T}),n.d(i,"RECEIVE_INDEX",function(){return D}),n.d(i,"RECEIVE_USER",function(){return A});var o={};n.r(o),n.d(o,"getIndex",function(){return G}),n.d(o,"getUser",function(){return M});var c={};n.r(c),n.d(c,"selectGroup",function(){return bt}),n.d(c,"editGroup",function(){return mt}),n.d(c,"saveGroup",function(){return vt}),n.d(c,"resetEdits",function(){return gt}),n.d(c,"createGroup",function(){return yt}),n.d(c,"editGroupSetting",function(){return Ot}),n.d(c,"saveGroupSettings",function(){return jt}),n.d(c,"bulkEditGroupSetting",function(){return Et}),n.d(c,"resetBulkGroupSettingEdit",function(){return _t}),n.d(c,"resetBulkGroupSettingEdits",function(){return wt}),n.d(c,"saveBulkEdits",function(){return St}),n.d(c,"SELECT_GROUP",function(){return It}),n.d(c,"EDIT_GROUP",function(){return kt}),n.d(c,"RESET_EDITS",function(){return xt}),n.d(c,"START_SAVE_GROUP",function(){return Nt}),n.d(c,"FINISH_SAVE_GROUP",function(){return Ct}),n.d(c,"FAILED_SAVE_GROUP",function(){return Rt}),n.d(c,"START_CREATE_GROUP",function(){return Pt}),n.d(c,"FINISH_CREATE_GROUP",function(){return Tt}),n.d(c,"FAILED_CREATE_GROUP",function(){return Dt}),n.d(c,"EDIT_GROUP_SETTING",function(){return At}),n.d(c,"START_SAVE_GROUP_SETTINGS",function(){return Lt}),n.d(c,"FINISH_SAVE_GROUP_SETTINGS",function(){return Gt}),n.d(c,"FAILED_SAVE_GROUP_SETTINGS",function(){return Mt}),n.d(c,"BULK_EDIT_GROUP_SETTING",function(){return Bt}),n.d(c,"RESET_BULK_GROUP_SETTING_EDIT",function(){return Ut}),n.d(c,"RESET_BULK_GROUP_SETTING_EDITS",function(){return Ht});var s={};n.r(s),n.d(s,"getSelectedGroup",function(){return Kt}),n.d(s,"isCreating",function(){return Ft}),n.d(s,"getEditedGroup",function(){return Vt}),n.d(s,"getEditedGroupAttribute",function(){return Wt}),n.d(s,"hasEdits",function(){return $t}),n.d(s,"settingHasEdits",function(){return qt}),n.d(s,"getEditedGroupSettings",function(){return zt}),n.d(s,"getEditedGroupSetting",function(){return Yt}),n.d(s,"hasBulkSettingEdits",function(){return Jt}),n.d(s,"getBulkSettingEdits",function(){return Zt}),n.d(s,"getBulkSettingEdit",function(){return Qt}),n.d(s,"getBulkSettingValue",function(){return Xt}),n.d(s,"isSavingBulkEdits",function(){return en}),n.d(s,"getAvailableGroups",function(){return tn});var a={};n.r(a),n.d(a,"getAvailableGroups",function(){return rn});var u=n("GRId"),l=n("l3Sj"),d=n("Y8OO"),p=n.n(d),f=(n("onLe"),n("1ZqX")),h=n("RIqP"),b=n.n(h),m=n("lSNA"),v=n.n(m),g=n("YLtl"),y=n("ywyh"),O=n.n(y),j=n("Td6G");function E(e){return{type:"API_FETCH",request:e}}var _={API_FETCH:function(e){var t=e.request;return O()(t).catch(j.e)},SELECT:function(e){var t=e.storeKey,n=e.selectorName,r=e.args,i=Object(f.select)(t)[n];return i.hasResolver?function(e){var t=e.storeKey,n=e.selectorName,r=e.args;return new Promise(function(e){var i=function(){return Object(f.select)("core/data").hasFinishedResolution(t,n,r)},o=function(){return Object(f.select)(t)[n].apply(null,r)},c=o();if(i())return e(c);var s=Object(f.subscribe)(function(){i()&&(s(),e(o()))})})}({storeKey:t,selectorName:n,args:r}):i.apply(void 0,b()(r))},DISPATCH:function(e){var t,n=e.storeKey,r=e.actionName,i=e.args;return(t=Object(f.dispatch)(n))[r].apply(t,b()(i))},CREATE_NOTICE:function(e){var t=e.status,n=e.content,r=e.options;r.autoDismiss&&(r.id=r.id||Object(g.uniqueId)("itsec-auto-dismiss-"),setTimeout(function(){return Object(f.dispatch)("core/notices").removeNotice(r.id,r.context)},r.autoDismiss)),Object(f.dispatch)("core/notices").createNotice(t,n,r)}};function w(e,t){return e.users.byId[t]}function S(e){return e.index}function I(e,t){var n=Object(f.select)("ithemes-security/core").getIndex();if(!n)return null;for(var r in n.routes)if(n.routes.hasOwnProperty(r)){var i=n.routes[r].schema;if(i&&i.title===t)return i}return null}function k(){var e=Object(f.select)("ithemes-security/core").getIndex();return e?e.roles:null}var x=n("o0o1"),N=n.n(x),C=N.a.mark(R);function R(){var e,t,n,r=arguments;return N.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=r.length>0&&void 0!==r[0]&&r[0],t="/ithemes-security/v1?context=help",e&&(t+="&_="+Date.now()),i.next=5,E({path:t});case 5:return n=i.sent,i.next=8,P(n);case 8:return i.abrupt("return",n);case 9:case"end":return i.stop()}},C)}function P(e){return{type:D,index:e}}function T(e){return{type:A,user:e}}var D="RECEIVE_INDEX",A="RECEIVE_USER",L=N.a.mark(G);function G(){var e;return N.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,E({path:"/ithemes-security/v1?context=help"});case 2:return e=t.sent,t.next=5,P(e);case 5:case"end":return t.stop()}},L)}var M={fulfill:N.a.mark(function e(t){var n;return N.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E({path:"/wp/v2/users/".concat(t)});case 2:return n=e.sent,e.next=5,T(n);case 5:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return!!e.users.byId[t]}};function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(t){v()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var H={users:{byId:{}},index:null};Object(f.registerStore)("ithemes-security/core",{controls:_,selectors:r,resolvers:o,actions:i,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:H,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case D:return U(U({},e),{},{index:t.index});case A:return U(U({},e),{},{users:U(U({},e.users),{},{byId:U(U({},e.users.byId),{},v()({},t.user.id,t.user))})});default:return e}}});n("sPxh");var K=n("lwsE"),F=n.n(K),V=n("W8MJ"),W=n.n(V),$=n("PJYZ"),q=n.n($),z=n("7W2i"),Y=n.n(z),J=n("a1gu"),Z=n.n(J),Q=n("Nsbk"),X=n.n(Q),ee=n("tI+e");n("6ECA");function te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}function ne(e,t,n){if(e!==t)throw new TypeError("Private static access of wrong provenance");return n.get?n.get.call(e):n.value}u.Component;var re={writable:!0,value:{}},ie=n("TSYQ"),oe=n.n(ie),ce=n("K9lf");Object(ce.compose)([Object(ce.withState)({isShowing:!1}),ce.withInstanceId])(function(e){var t,n=e.type,r=e.status,i=e.description,o=e.isShowing,c=e.setState,s=e.instanceId,a=e.children;switch(r){case"clean":t=Object(l.__)("Clean","better-wp-security");break;case"warn":t=Object(l.__)("Warn","better-wp-security");break;case"error":t=Object(l.__)("Error","better-wp-security");break;default:t=r}var d=Object(u.createElement)("span",{className:"itsec-malware-scan-".concat(r)},t);return Object(u.createElement)("div",{className:oe()("itsec-malware-scan-results-section","itsec-malware-scan-results-".concat(n,"-section"))},Object(g.isEmpty)(a)?Object(u.createElement)("p",null,d," ",i):Object(u.createElement)(u.Fragment,null,Object(u.createElement)("p",null,d,i,Object(u.createElement)(ee.Button,{isLink:!0,className:"itsec-malware-scan-toggle-details",onClick:function(){return c({isShowing:!o})},"aria-expanded":o,"aria-controls":"itsec-malware-scan-details--".concat(s)},o?Object(l.__)("Hide Details","better-wp-security"):Object(l.__)("Show Details","better-wp-security"))),Object(u.createElement)("div",{className:"itsec-malware-scan-details",id:"itsec-malware-scan-details--".concat(s),style:{display:o?"block":"none"}},a)))});var se=n("J4zp"),ae=n.n(se);n("rmEH");n("A6yB");function ue(e){var t=e.id,n=e.isVisible,r=e.children;return Object(u.createElement)("div",{className:"itsec-site-scan__details",id:t,style:{display:n?"block":"none"}},Object(u.createElement)("ul",null,r))}Object(ce.compose)([Object(ce.withState)({isShowing:!1}),ce.withInstanceId])(function(e){var t,n=e.type,r=e.status,i=e.description,o=e.isShowing,c=e.setState,s=e.instanceId,a=e.children;switch(r){case"clean":t=Object(l.__)("Clean","better-wp-security");break;case"warn":t=Object(l.__)("Warn","better-wp-security");break;case"error":t=Object(l.__)("Error","better-wp-security");break;default:t=r}var d=Object(u.createElement)("span",{className:"itsec-site-scan__status itsec-site-scan__status--".concat(r)},t);return Object(u.createElement)("div",{className:oe()("itsec-site-scan-results-section","itsec-site-scan-results-".concat(n,"-section"))},Object(g.isEmpty)(a)?Object(u.createElement)("p",null,d," ",i):Object(u.createElement)(u.Fragment,null,Object(u.createElement)("p",null,d,i,Object(u.createElement)(ee.Button,{isLink:!0,className:"itsec-site-scan-toggle-details",onClick:function(){return c({isShowing:!o})},"aria-expanded":o,"aria-controls":"itsec-site-scan__details--".concat(s)},o?Object(l.__)("Hide Details","better-wp-security"):Object(l.__)("Show Details","better-wp-security"))),Object(u.createElement)(ue,{id:"itsec-site-scan__details--".concat(s),isVisible:o},a)))});n("oaS/");n("bJT+");var le=n("QILm"),de=n.n(le),pe=n("cDcd"),fe=n("urxu"),he=n.n(fe),be=Object(pe.lazy)(function(){return n.e(8).then(n.bind(null,"YK1D"))});function me(){return Object(u.createElement)("span",null,Object(l.__)("Error when loading. Please refresh.","better-wp-security"))}function ve(e){var t=e.addErrorBoundary,n=void 0===t||t,r=de()(e,["addErrorBoundary"]),i=Object(u.createElement)(pe.Suspense,{fallback:Object(u.createElement)(ee.Spinner,null)},Object(u.createElement)(be,r));return n?Object(u.createElement)(he.a,{FallbackComponent:me},i):i}function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}var ye=function(){},Oe=function(e){Y()(n,e);var t=ge(n);function n(e){var r;return F()(this,n),(r=t.call(this,e)).state={isHovering:!1},r.onMouseEnter=r.onMouseEnter.bind(q()(r)),r.onMouseLeave=r.onMouseLeave.bind(q()(r)),r.onMouseOver=r.onMouseOver.bind(q()(r)),r.onMouseOut=r.onMouseOut.bind(q()(r)),r.setIsHovering=r.setIsHovering.bind(q()(r)),r.unsetIsHovering=r.unsetIsHovering.bind(q()(r)),r.componentWillUnmount=r.componentWillUnmount.bind(q()(r)),r.timerIds=[],r}return W()(n,[{key:"onMouseEnter",value:function(e){this.props.onMouseEnter({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"onMouseLeave",value:function(e){this.props.onMouseLeave({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"onMouseOver",value:function(e){this.props.onMouseOver({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"onMouseOut",value:function(e){this.props.onMouseOut({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"componentWillUnmount",value:function(){this.clearTimers()}},{key:"setIsHovering",value:function(){var e=this;this.clearTimers();var t=setTimeout(function(){var t={isHovering:!0};e.setState(t,function(){e.props.onHoverChanged(t)})},this.props.hoverDelayInMs);this.timerIds.push(t)}},{key:"unsetIsHovering",value:function(){var e=this;this.clearTimers();var t=setTimeout(function(){var t={isHovering:!1};e.setState(t,function(){e.props.onHoverChanged(t)})},this.props.hoverOffDelayInMs);this.timerIds.push(t)}},{key:"clearTimers",value:function(){for(var e=this.timerIds;e.length;)clearTimeout(e.pop())}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.className;return Object(u.createElement)("div",{className:n,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut},t)}}]),n}(u.Component);v()(Oe,"displayName","HoverDetector"),v()(Oe,"defaultProps",{hoverDelayInMs:0,hoverOffDelayInMs:0,onHoverChanged:ye,onMouseEnter:function(e){return(0,e.setIsHovering)()},onMouseLeave:function(e){return(0,e.unsetIsHovering)()},onMouseOver:ye,onMouseOut:ye,shouldDecorateChildren:!0});n("QxRw");n("JVTk"),n("lSb6");var je=n("pVnL"),Ee=n.n(je);var _e,we,Se=n("4eJC"),Ie=n.n(Se);n("Dfre");function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach(function(t){v()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}function Ce(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Re(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Re(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function Re(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}_e=Symbol.iterator;var Pe=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];F()(this,e),v()(this,"tree",void 0),v()(this,"name",void 0),v()(this,"data",void 0),v()(this,"parent",void 0),v()(this,"children",void 0),this.tree=t,this.name=n,this.data=r,this.parent=i,this.children=o}return W()(e,[{key:"getParent",value:function(){return this.parent?this.tree.nodes[this.parent]:null}},{key:"getAllParents",value:function(){for(var e=[],t=this.getParent();t;)e.push(t.name),t=t.getParent();return e}},{key:"hasChildren",value:function(){return this.children.length>0}},{key:"getAllChildren",value:function(){var e=[];if(!this.hasChildren())return e;var t,n=Ce(this);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.push.apply(e,[r.name].concat(b()(r.getAllChildren())))}}catch(e){n.e(e)}finally{n.f()}return e}},{key:_e,value:N.a.mark(function e(){var t,n;return N.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<this.children.length)){e.next=8;break}return n=this.children[t],e.next=5,this.tree.nodes[n];case 5:t++,e.next=1;break;case 8:case"end":return e.stop()}},e,this)})}]),e}();we=Symbol.iterator;var Te=function(){function e(){F()(this,e),v()(this,"nodes",{}),v()(this,"ordered",[])}return W()(e,[{key:"add",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.ordered.push(e),this.nodes[e]?(this.nodes[e].data=t,this.nodes[e].parent=n):this.nodes[e]=new Pe(this,e,t,n),n&&(this.nodes[n]?this.nodes[n].children.push(e):this.nodes[n]=new Pe(this,n))}},{key:we,value:N.a.mark(function e(){var t,n;return N.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<this.ordered.length)){e.next=9;break}if(n=this.ordered[t],this.nodes[n].parent){e.next=6;break}return e.next=6,this.nodes[n];case 6:t++,e.next=1;break;case 9:case"end":return e.stop()}},e,this)})}]),e}(),De=Ie()(function(e){var t,n=new Te,r=Ce(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;n.add(i.value,i,i.parent)}}catch(e){r.e(e)}finally{r.f()}return n}),Ae=function(e){Y()(n,e);var t=Ne(n);function n(){var e;return F()(this,n),e=t.apply(this,arguments),v()(q()(e),"props",void 0),e.renderOption=e.renderOption.bind(q()(e)),e.isChecked=e.isChecked.bind(q()(e)),e.isIndeterminate=e.isIndeterminate.bind(q()(e)),e.onChange=e.onChange.bind(q()(e)),e}return W()(n,[{key:"indeterminate",value:function(e){e.indeterminate=!0}},{key:"isChecked",value:function(e){return!!e&&(Object(g.isArray)(this.props.value)?this.props.value.includes(e.name)||this.isChecked(e.getParent()):this.props.value[e.name]||this.isChecked(e.getParent()))}},{key:"isIndeterminate",value:function(e){if(!e.hasChildren())return!1;var t,n=Ce(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(this.isChecked(r))return!0;if(this.isIndeterminate(r))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"onChange",value:function(e,t){var n,r=[e.name].concat(b()(e.getAllChildren())),i=t?[]:e.getAllParents();Object(g.isArray)(this.props.value)?(n=t?[].concat(b()(this.props.value),b()(r)):this.props.value.filter(function(e){return!r.includes(e)&&!i.includes(e)}),this.props.onChange(n)):this.props.onChange(xe(xe(xe({},this.props.value),r.reduce(function(e,n){return e[n]=t},{})),i.reduce(function(e,t){return e[t]=!1},{})))}},{key:"render",value:function(){var e=this.props,t=e.label,n=e.help,r=e.options,i=De(r);return Object(u.createElement)("fieldset",{className:"components-base-control"},Object(u.createElement)("div",{className:"components-base-control__field"},Object(u.createElement)("legend",{className:"components-base-control__label"},t),n&&Object(u.createElement)("p",{className:"components-base-control__help"},n)),Object(u.createElement)("ul",{className:"components-hierarchical-checkbox-control__group"},Array.from(i,this.renderOption)))}},{key:"renderOption",value:function(e){var t=this,n=e.data,r=n.value,i=n.selectable,o=void 0===i||i,c=de()(n,["value","selectable"]),s=this.isChecked(e),a=!s&&this.isIndeterminate(e);return Object(u.createElement)("li",{key:r,className:oe()("components-hierarchical-checkbox-control__option",{"components-hierarchical-checkbox-control__option--has-children":e.hasChildren()})},Object(u.createElement)(Ke,Ee()({},c,{checked:!!o&&s,disabled:!o||this.props.disabled,indeterminate:a,onChange:function(n){return t.onChange(e,n)}})),e.hasChildren()&&Object(u.createElement)("ul",{className:"components-hierarchical-checkbox-control__group"},Array.from(e,this.renderOption)))}}]),n}(u.Component);Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{notices:e("core/notices").getNotices(r)}}),Object(f.withDispatch)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{onRemove:function(t){return e("core/notices").removeNotice(t,r)}}})])(function(e){var t=e.notices,n=e.onRemove,r=Object(g.filter)(t,function(e){return e.isDismissible&&(!e.type||"default"===e.type)}),i=Object(g.filter)(t,function(e){return!(e.isDismissible||e.type&&"default"!==e.type)}),o=ee.SnackbarList?Object(g.filter)(t,{type:"snackbar"}):[];return Object(u.createElement)(u.Fragment,null,Object(u.createElement)(ee.NoticeList,{notices:i,className:"components-editor-notices__pinned"}),Object(u.createElement)(ee.NoticeList,{notices:r,className:"components-editor-notices__dismissible",onRemove:n}),ee.SnackbarList&&Object(u.createElement)(ee.SnackbarList,{notices:o,className:"components-editor-notices__snackbar",onRemove:n}))});var Le=function(e){var t=e.className,n=e.status,r=e.children,i=e.onRemove,o=void 0===i?g.noop:i,c=e.isDismissible,s=void 0===c||c,a=e.actions,d=void 0===a?[]:a,p=oe()(t,"notice","notice-alt","notice-"+n,{"is-dismissible":s});return Object(u.createElement)("div",{className:p},Object(u.createElement)("p",null,r,d.map(function(e,t){var n=e.className,r=e.label,i=e.onClick,c=e.url,s=e.isLink,a=void 0!==s&&s;return Object(u.createElement)(ee.Button,{key:t,href:c,isSmall:!a&&!c,isLink:a||c,onClick:c?void 0:function(){o(),i()},className:oe()("notice__action",n)},r)})),s&&Object(u.createElement)("button",{type:"button",className:"notice-dismiss",onClick:o},Object(u.createElement)("span",{className:"screen-reader-text"},Object(l.__)("Dismiss this notice","better-wp-security"))))};n("+VN0");function Ge(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Me(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Be=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{notices:e("core/notices").getNotices(r)}}),Object(f.withDispatch)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{onRemove:function(t){return e("core/notices").removeNotice(t,r)}}})])(function(e){var t,n,r=e.notices,i=e.onRemove,o=function(e){if(!ee.SnackbarList)return e.length;var t,n=0,r=Ge(e);try{for(r.s();!(t=r.n()).done;)"snackbar"!==t.value.type&&n++}catch(e){r.e(e)}finally{r.f()}return n}(r),c=(t=o,n=Object(u.useRef)(),Object(u.useEffect)(function(){n.current=t}),n.current);Object(u.useEffect)(function(){o>c&&window.itsecSettingsPage&&window.itsecSettingsPage.scrollTop()},[o,c]);var s=ee.SnackbarList?Object(g.filter)(r,{type:"snackbar"}):[];return Object(u.createElement)(u.Fragment,null,Object(u.createElement)("div",{className:"itsec-module-settings-notice-list"},r.map(function(e){return"snackbar"===e.type&&ee.SnackbarList?null:Object(u.createElement)(Le,Ee()({},Object(g.omit)(e,["content"]),{key:e.id,onRemove:(t=e.id,function(){return i(t)})}),e.content);var t})),ee.SnackbarList&&Object(u.createElement)(ee.SnackbarList,{notices:s,className:"components-editor-notices__snackbar",onRemove:i}))});n("DfSy");function Ue(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}var He=function(e){Y()(n,e);var t=Ue(n);function n(){var e;return F()(this,n),(e=t.apply(this,arguments)).onChange=e.onChange.bind(q()(e)),e}return W()(n,[{key:"onChange",value:function(e){this.props.onChange&&this.props.onChange(e.target.checked)}},{key:"render",value:function(){var e,t,n=this.props,r=n.label,i=n.checked,o=n.help,c=n.instanceId,s=de()(n,["label","checked","help","instanceId"]),a="inspector-toggle-control-".concat(c);return o&&(e=a+"__help",t=Object(g.isFunction)(o)?o(i):o),Object(u.createElement)(ee.BaseControl,{id:a,help:t,className:"components-toggle-control"},Object(u.createElement)(ee.FormToggle,Ee()({},s,{id:a,checked:i,onChange:this.onChange,"aria-describedby":e})),Object(u.createElement)("label",{htmlFor:a,className:"components-toggle-control__label"},r))}}]),n}(u.Component);Object(ce.withInstanceId)(He),n("IXp0");var Ke=Object(ce.withInstanceId)(function(e){var t=e.label,n=e.className,r=e.heading,i=e.checked,o=e.help,c=e.instanceId,s=e.onChange,a=e.indeterminate,l=de()(e,["label","className","heading","checked","help","instanceId","onChange","indeterminate"]),d="inspector-checkbox-control-".concat(c);return Object(u.createElement)(ee.BaseControl,{label:r,id:d,help:o,className:n},Object(u.createElement)("span",{className:"components-checkbox-control__input-container"},Object(u.createElement)("input",Ee()({id:d,className:"components-checkbox-control__input",type:"checkbox",value:"1",onChange:function(e){return s(e.target.checked)},checked:i,"aria-describedby":o?d+"__help":void 0,ref:function(e){e&&(e.indeterminate=a)}},l)),i?Object(u.createElement)(ee.Dashicon,{icon:"yes",className:"components-checkbox-control__checked",role:"presentation"}):null,a?Object(u.createElement)(ee.Dashicon,{icon:"minus",className:"components-checkbox-control__checked components-checkbox-control__checked--indeterminate",role:"presentation"}):null),Object(u.createElement)("label",{className:"components-checkbox-control__label",htmlFor:d},t))});function Fe(e){var t=e.tabId,n=e.onClick,r=e.children,i=e.selected,o=de()(e,["tabId","onClick","children","selected"]);return Object(u.createElement)(ee.Button,Ee()({role:"tab",tabIndex:i?null:-1,"aria-selected":i,id:t,onClick:n},o),r)}function Ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}var We=function(e){Y()(n,e);var t=Ve(n);function n(){var e;return F()(this,n),(e=t.apply(this,arguments)).handleClick=e.handleClick.bind(q()(e)),e.onNavigate=e.onNavigate.bind(q()(e)),e.onKeyDown=e.onKeyDown.bind(q()(e)),e}return W()(n,[{key:"handleClick",value:function(e){var t=this.props.onSelect;(void 0===t?g.noop:t)(e)}},{key:"onNavigate",value:function(e,t){var n=this.event;n&&"tab"===n.target.getAttribute("role")&&n.preventDefault(),t.click()}},{key:"onKeyDown",value:function(e){this.event=e}},{key:"render",value:function(){var e=this,t=this.props,n=t.activeClass,r=void 0===n?"is-active":n,i=t.className,o=t.instanceId,c=t.orientation,s=void 0===c?"horizontal":c,a=t.tabs,l=t.selected,d=Object(g.find)(a,{name:l})||a[0],p=o+"-"+d.name;return Object(u.createElement)("div",{className:i},Object(u.createElement)(ee.NavigableMenu,{role:"tablist",orientation:s,onNavigate:this.onNavigate,onKeyDown:this.onKeyDown,className:"components-tab-panel__tabs"},a.map(function(t){return Object(u.createElement)(Fe,{className:oe()(t.className,v()({},r,t.name===d.name)),tabId:o+"-"+t.name,"aria-controls":o+"-"+t.name+"-view",selected:t.name===d.name,key:t.name,onClick:Object(g.partial)(e.handleClick,t.name)},t.title)})),d&&Object(u.createElement)("div",{"aria-labelledby":p,role:"tabpanel",id:p+"-view",className:"components-tab-panel__tab-content",tabIndex:"0"},this.props.children(d)))}}]),n}(u.Component),$e=Object(ce.withInstanceId)(We),qe=n("rl8x"),ze=n.n(qe);function Ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}Object(ce.createHigherOrderComponent)(function(e){var t,n;return n=t=function(t){Y()(r,t);var n=Ye(r);function r(){var e;F()(this,r);for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return e=n.call.apply(n,[this].concat(i)),v()(q()(e),"state",{width:1280}),v()(q()(e),"mounted",!1),v()(q()(e),"ref",null),v()(q()(e),"onWindowResize",function(){if(e.mounted){var t=Object(u.findDOMNode)(q()(e));if(t instanceof window.HTMLElement){var n=t.offsetWidth;e.setState({width:n})}}}),e}return W()(r,[{key:"componentDidMount",value:function(){this.mounted=!0,window.addEventListener("resize",this.onWindowResize),document.getElementById("collapse-button").addEventListener("click",this.onWindowResize),this.onWindowResize()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,window.removeEventListener("resize",this.onWindowResize),document.getElementById("collapse-button").removeEventListener("click",this.onWindowResize)}},{key:"render",value:function(){var t=this.props,n=t.measureBeforeMount,r=de()(t,["measureBeforeMount"]);return n&&!this.mounted?Object(u.createElement)("div",{className:this.props.className,style:this.props.style}):Object(u.createElement)(e,Ee()({},r,{width:this.state.width+20}))}}]),r}(u.Component),v()(t,"defaultProps",{measureBeforeMount:!1}),n},"withWidth");function Je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}var Ze=Object(ce.createHigherOrderComponent)(function(e){return function(t){Y()(r,t);var n=Je(r);function r(){var e;return F()(this,r),e=n.apply(this,arguments),v()(q()(e),"state",{pressed:{shift:!1,ctrl:!1,meta:!1,alt:!1}}),v()(q()(e),"mounted",!1),e.listener=e.listener.bind(q()(e)),e.onBlur=e.onBlur.bind(q()(e)),e}return W()(r,[{key:"componentDidMount",value:function(){this.mounted=!0,window.addEventListener("keydown",this.listener),window.addEventListener("keyup",this.listener),window.addEventListener("click",this.listener),window.addEventListener("blur",this.onBlur)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,window.removeEventListener("keydown",this.listener),window.removeEventListener("keyup",this.listener),window.removeEventListener("click",this.listener),window.removeEventListener("blur",this.onBlur)}},{key:"listener",value:function(e){this.mounted&&this.setState({pressed:{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}})}},{key:"onBlur",value:function(){this.setState({pressed:{shift:!1,ctrl:!1,meta:!1,alt:!1}})}},{key:"render",value:function(){return Object(u.createElement)(e,Ee()({pressedModifierKeys:this.state.pressed},this.props))}}]),r}(u.Component)},"withPressedModifierKeys");function Qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}var Xe=function(e){Y()(n,e);var t=Qe(n);function n(){var e;return F()(this,n),(e=t.apply(this,arguments)).handleClick=e.handleClick.bind(q()(e)),e.onNavigate=e.onNavigate.bind(q()(e)),e.onKeyDown=e.onKeyDown.bind(q()(e)),e.toggleTab=e.toggleTab.bind(q()(e)),e.getSelectedTabs=e.getSelectedTabs.bind(q()(e)),e.isSelected=e.isSelected.bind(q()(e)),e.getSelectedId=e.getSelectedId.bind(q()(e)),e.getLabelledBy=e.getLabelledBy.bind(q()(e)),e.getTabId=e.getTabId.bind(q()(e)),e.getTabPanelId=e.getTabPanelId.bind(q()(e)),e.isTabDisabled=e.isTabDisabled.bind(q()(e)),e.isNonMultiSelectableTabSelected=e.isNonMultiSelectableTabSelected.bind(q()(e)),e}return W()(n,[{key:"handleClick",value:function(e,t){t.metaKey||t.ctrlKey?this.toggleTab(e):this.props.onSelect([e])}},{key:"onNavigate",value:function(e,t){var n=this.event;if(n){if("tab"===n.target.getAttribute("role")&&n.preventDefault(),n.ctrlKey)return;if(n.shiftKey){if(this.isTabDisabled(this.props.tabs[e]))return;var r=this.props.tabs[e].name;return void this.toggleTab(r)}}t.click()}},{key:"onKeyDown",value:function(e){if(!e.nativeEvent&&(this.event=e,e.ctrlKey&&("Space"===e.code||32===e.keyCode))){e.preventDefault();var t=e.target.dataset.tabname;t&&this.toggleTab(t)}}},{key:"toggleTab",value:function(e){var t=Object(g.find)(this.props.tabs,{name:e});t&&!1===t.allowMultiple||(this.props.selected.includes(e)?this.props.onSelect(this.props.selected.filter(function(t){return t!==e})):this.props.onSelect([].concat(b()(this.props.selected),[e])))}},{key:"getSelectedTabs",value:function(){var e=this,t=this.props.selected;!t.length&&this.props.initialTab&&t.push(this.props.initialTab);var n=[];return this.props.tabs.forEach(function(t){e.props.selected.includes(t.name)&&n.push(t)}),n}},{key:"isSelected",value:function(e,t){return e.some(function(e){return e.name===t.name})}},{key:"isTabDisabled",value:function(e){var t=this.props.pressedModifierKeys;if(this.props.selected.includes(e.name))return!1;if(!1!==e.allowMultiple&&!this.isNonMultiSelectableTabSelected())return!1;if(t.meta||t.ctrl)return!0;if(t.shift){var n=document.activeElement;if(n.parentElement&&n.parentElement.id==="components-tab-panel__tabs-".concat(this.props.instanceId))return!0}return!1}},{key:"isNonMultiSelectableTabSelected",value:function(){if(1!==this.props.selected.length)return!1;var e=Object(g.find)(this.props.tabs,{name:this.props.selected[0]});return e&&!1===e.allowMultiple}},{key:"getSelectedId",value:function(e){return 1===e.length?this.getTabPanelId(e[0].name):"components-tab-panel__panel-".concat(this.props.instanceId,"-").concat(Object(g.map)(e,"name").join("-"))}},{key:"getLabelledBy",value:function(e){var t=this;return e.map(function(e){return t.getTabId(e.name)}).join(",")}},{key:"getTabId",value:function(e){return"components-tab-panel__tab-".concat(this.props.instanceId,"-").concat(e)}},{key:"getTabPanelId",value:function(e){return"components-tab-panel__panel-".concat(this.props.instanceId,"-").concat(e)}},{key:"componentDidUpdate",value:function(e){if(1===this.props.selected.length&&ze()(this.props.selected,e.selected)){var t=this.props.selected[0];if(!Object(g.find)(this.props.tabs,{name:t})){var n=Object(g.findIndex)(e.tabs,{name:t});if(-1!==n){var r=Math.max(n-1,0),i=this.props.tabs[r];i&&this.props.onSelect([i.name])}}}}},{key:"render",value:function(){var e=this,t=this.props,n=t.tabs,r=t.className,i=t.activeClass,o=void 0===i?"is-active":i,c=t.orientation,s=void 0===c?"horizontal":c,a=this.getSelectedTabs(),l=this.getSelectedId(a);return Object(u.createElement)("div",{className:r},Object(u.createElement)(ee.NavigableMenu,{role:"tablist","aria-multiselectable":!0,orientation:s,onNavigate:this.onNavigate,onKeyDown:this.onKeyDown,className:"components-tab-panel__tabs",id:"components-tab-panel__tabs-".concat(this.props.instanceId)},n.map(function(t){var n=e.isSelected(a,t),r=n&&a.length>1?l:e.getTabPanelId(t.name);return Object(u.createElement)(Fe,{className:oe()(t.className,v()({},o,n)),tabId:e.getTabId(t.name),"aria-controls":r,selected:n,disabled:e.isTabDisabled(t),key:t.name,onClick:Object(g.partial)(e.handleClick,t.name),"data-tabname":t.name},t.title)})),a.length>0&&Object(u.createElement)("div",{"aria-labelledby":this.getLabelledBy(a),role:"tabpanel",id:l,className:"components-tab-panel__tab-content",tabIndex:"0"},this.props.children(a)))}}]),n}(u.Component),et=Object(ce.compose)([ce.withInstanceId,Ze])(Xe);function tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=X()(e);if(t){var i=X()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Z()(this,n)}}var nt=function(e){Y()(n,e);var t=tt(n);function n(){var e;return F()(this,n),e=t.apply(this,arguments),v()(q()(e),"onSelect",function(t){e.setState({selected:t})}),e.state={selected:e.props.initialTab||""},e}return W()(n,[{key:"render",value:function(){return Object(u.createElement)($e,Ee()({},this.props,{selected:this.state.selected,onSelect:this.onSelect}))}}]),n}(u.Component);function rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function it(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach(function(t){v()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ot(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return{type:"SELECT",storeKey:e,selectorName:t,args:r}}function ct(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return{type:"DISPATCH",storeKey:e,actionName:t,args:r}}function st(){return{type:"CREATE_NOTICE",status:arguments.length>0&&void 0!==arguments[0]?arguments[0]:"info",content:arguments.length>1?arguments[1]:void 0,options:it({context:"ithemes-security"},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}}var at={API_FETCH:function(e){var t=e.request;return O()(t).catch(j.e)},SELECT:function(e){var t,n=e.storeKey,r=e.selectorName,i=e.args;return(t=Object(f.select)(n))[r].apply(t,b()(i))},DISPATCH:function(e){var t,n=e.storeKey,r=e.actionName,i=e.args;return(t=Object(f.dispatch)(n))[r].apply(t,b()(i))},CREATE_NOTICE:function(e){var t=e.status,n=e.content,r=e.options;r.autoDismiss&&(r.id=r.id||Object(g.uniqueId)("itsec-auto-dismiss-"),setTimeout(function(){return Object(f.dispatch)("core/notices").removeNotice(r.id,r.context)},r.autoDismiss)),Object(f.dispatch)("core/notices").createNotice(t,n,r)}};function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach(function(t){v()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var dt=N.a.mark(vt),pt=N.a.mark(yt),ft=N.a.mark(jt),ht=N.a.mark(St);function bt(e){return{type:It,ids:e}}function mt(e,t){return{type:kt,id:e,edit:t}}function vt(e){var t,n;return N.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,ot("ithemes-security/user-groups-editor","getEditedGroup",e);case 2:if(t=r.sent){r.next=5;break}return r.abrupt("return");case 5:return r.next=7,{type:Nt,id:e};case 7:return r.next=9,ct("ithemes-security/user-groups","updateGroup",e,t);case 9:if(!((n=r.sent)instanceof Error)){r.next=17;break}return r.next=13,st("error",n.message);case 13:return r.next=15,{type:Rt,id:e,error:n};case 15:r.next=21;break;case 17:return r.next=19,{type:Ct,id:e,updated:n};case 19:return r.next=21,st("success",Object(l.__)("Updated group.","better-wp-security"),{type:"snackbar"});case 21:return r.abrupt("return",n);case 22:case"end":return r.stop()}},dt)}function gt(e){return{type:xt,id:e}}function yt(){var e,t,n,r=arguments;return N.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},i.next=3,ot("ithemes-security/user-groups-editor","getEditedGroup","new");case 3:if(t=i.sent){i.next=6;break}return i.abrupt("return");case 6:return i.next=8,{type:Pt};case 8:return i.next=10,ct("ithemes-security/user-groups","createGroup",lt(lt({},t),e));case 10:if(!((n=i.sent)instanceof Error)){i.next=23;break}if("rest_duplicate_user_group"!==n.code){i.next=17;break}return i.next=15,st("error",n.message,{actions:[{label:Object(l.__)("View Duplicate","better-wp-security"),isLink:!0,onClick:function(){var e=Object(g.get)(n,["_links","duplicate",0,"href"]).split("/").pop();Object(f.dispatch)("ithemes-security/user-groups-editor").selectGroup([e])}},{label:Object(l.__)("Create Anyway","better-wp-security"),onClick:function(){Object(f.dispatch)("ithemes-security/user-groups-editor").createGroup({ignore_duplicate:!0})}}]});case 15:i.next=19;break;case 17:return i.next=19,st("error",n.message);case 19:return i.next=21,{type:Dt,error:n};case 21:i.next=31;break;case 23:return i.next=25,gt("new");case 25:return i.next=27,{type:Tt,created:n};case 27:return i.next=29,ct("ithemes-security/user-groups-editor","selectGroup",n.id);case 29:return i.next=31,st("success",Object(l.__)("Created group.","better-wp-security"),{type:"snackbar"});case 31:return i.abrupt("return",n);case 32:case"end":return i.stop()}},pt)}function Ot(e,t,n,r){return{type:At,id:e,module:t,setting:n,value:r}}function jt(e){var t,n;return N.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,ot("ithemes-security/user-groups-editor","getEditedGroupSettings",e);case 2:if(t=r.sent){r.next=5;break}return r.abrupt("return");case 5:return r.next=7,{type:Lt,id:e};case 7:return r.next=9,ct("ithemes-security/user-groups","updateGroupSettings",e,t);case 9:if(!((n=r.sent)instanceof Error)){r.next=17;break}return r.next=13,st("error",n.message);case 13:return r.next=15,{type:Mt,id:e,error:n};case 15:r.next=21;break;case 17:return r.next=19,{type:Gt,id:e,updated:n};case 19:return r.next=21,st("success",Object(l.__)("Updated group settings.","better-wp-security"),{type:"snackbar"});case 21:return r.abrupt("return",n);case 22:case"end":return r.stop()}},ft)}function Et(e,t,n){return{type:Bt,module:e,setting:t,value:n}}function _t(e,t){return{type:Ut,module:e,setting:t}}function wt(){return{type:Ht}}function St(e){var t,n,r,i;return N.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,ot("ithemes-security/user-groups-editor","getBulkSettingEdits");case 2:return t=o.sent,o.next=5,ct("ithemes-security/user-groups","patchBulkGroupSettings",e,t);case 5:if(!((n=o.sent)instanceof Error)){o.next=11;break}return o.next=9,st("error",n.message);case 9:o.next=25;break;case 11:if(!Object(g.map)(n,"status").every(function(e){return 200===e})){o.next=16;break}return o.next=14,st("success",Object(l.__)("Updated group settings.","better-wp-security"),{type:"snackbar"});case 14:o.next=25;break;case 16:if(r=n.filter(function(e){return 200!==e.status}).map(function(e){var t=e.error;return Object(j.b)(t)}),i=r.map(function(e){return e.getAllErrorMessages().join(" ")}).join(" "),r.length!==n.length){o.next=23;break}return o.next=21,st("error",i);case 21:o.next=25;break;case 23:return o.next=25,st("warning",Object(l.sprintf)(Object(l._n)("%1$d group was not updated: %2$s","%1$d groups were not updated: %2$s",r.length,"better-wp-security"),r.length,i));case 25:return o.next=27,wt();case 27:return o.abrupt("return",n);case 28:case"end":return o.stop()}},ht)}var It="SELECT_GROUP",kt="EDIT_GROUP",xt="RESET_EDITS",Nt="START_SAVE_GROUP",Ct="FINISH_SAVE_GROUP",Rt="FAILED_SAVE_GROUP",Pt="START_CREATE_GROUP",Tt="FINISH_CREATE_GROUP",Dt="FAILED_CREATE_GROUP",At="EDIT_GROUP_SETTING",Lt="START_SAVE_GROUP_SETTINGS",Gt="FINISH_SAVE_GROUP_SETTINGS",Mt="FAILED_SAVE_GROUP_SETTINGS",Bt="BULK_EDIT_GROUP_SETTING",Ut="RESET_BULK_GROUP_SETTING_EDIT",Ht="RESET_BULK_GROUP_SETTING_EDITS";function Kt(e){return e.selectedGroup}function Ft(e){return e.creating}function Vt(e,t){return e.edits[t]}function Wt(e,t,n){var r=Object(g.get)(e,["edits",t,n]);return void 0!==r?r:"new"!==t?Object(f.select)("ithemes-security/user-groups").getGroupAttribute(t,n):void 0}function $t(e,t){return!!e.edits[t]}function qt(e,t){return!!e.settingEdits[t]}function zt(e,t){return e.settingEdits[t]}function Yt(e,t,n,r){var i=Object(g.get)(e,["settingEdits",t,n,r]);return void 0!==i?i:Object(f.select)("ithemes-security/user-groups").getGroupSetting(t,n,r)}function Jt(e){return!Object(g.isEmpty)(e.bulkSettingEdits)}function Zt(e){return e.bulkSettingEdits}function Qt(e,t,n){return Object(g.get)(e,["bulkSettingEdits",t,n])}function Xt(e,t,n,r){var i=Qt(e,n,r);if(void 0!==i)return i;var o=function(e){return Object(f.select)("ithemes-security/user-groups").getGroupSetting(e,n,r)},c=o(t[0]);return t.every(function(e){return o(e)===c})?c:null}function en(e,t){var n=Zt(e);return Object(f.select)("ithemes-security/user-groups").isBulkPatchingSettings(t,n)}function tn(){return Object(f.select)("ithemes-security/user-groups").getGroups("available")}var nn=N.a.mark(rn);function rn(){var e;return N.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ct("ithemes-security/user-groups","query","available",{_embed:1});case 2:if(!((e=t.sent).length>0)){t.next=6;break}return t.next=6,ct("ithemes-security/user-groups-editor","selectGroup",[e[0].id]);case 6:return t.abrupt("return",e);case 7:case"end":return t.stop()}},nn)}function on(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?on(Object(n),!0).forEach(function(t){v()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):on(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var sn={edits:{},settingEdits:{},bulkSettingEdits:{},creating:!1,selectedGroup:[]};Object(f.registerStore)("ithemes-security/user-groups-editor",{controls:at,actions:c,selectors:s,resolvers:a,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:sn,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case It:return cn(cn({},e),{},{selectedGroup:t.ids});case kt:return cn(cn({},e),{},{edits:cn(cn({},e.edits),{},v()({},t.id,cn(cn({},e.edits[t.id]||{}),t.edit)))});case Ct:return cn(cn({},e),{},{edits:Object(g.omit)(e.edits,[t.id])});case At:return cn(cn({},e),{},{settingEdits:cn(cn({},e.settingEdits),{},v()({},t.id,cn(cn({},Object(g.get)(e,["settingEdits",t.id],{})),{},v()({},t.module,cn(cn({},Object(g.get)(e,["settingEdits",t.id,t.module],{})),{},v()({},t.setting,t.value))))))});case Gt:return cn(cn({},e),{},{settingEdits:Object(g.omit)(e.settingEdits,[t.id])});case Pt:return cn(cn({},e),{},{creating:!0});case Dt:case Tt:return cn(cn({},e),{},{creating:!1});case xt:return cn(cn({},e),{},{edits:Object(g.omit)(e.edits,[t.id])});case Bt:return cn(cn({},e),{},{bulkSettingEdits:cn(cn({},e.bulkSettingEdits),{},v()({},t.module,cn(cn({},e.bulkSettingEdits[t.module]||{}),{},v()({},t.setting,t.value))))});case Ut:return cn(cn({},e),{},{bulkSettingEdits:Object(g.omit)(e.bulkSettingEdits,"".concat(t.module,".").concat(t.setting))});case Ht:return cn(cn({},e),{},{bulkSettingEdits:{}});default:return e}}});function an(){return Object(u.createElement)("div",null,Object(u.createElement)(ln,null))}n("GjY+");var un=Ie()(function(e){return e.sort(function(e,t){return e.type===t.type?0:"user-group"===e.type?-1:"user-group"===t.type?1:0}).map(function(e){return{name:e.id,title:e.label,className:"itsec-user-groups-list__item",group:e}}).concat({name:"new",title:Object(u.createElement)(u.Fragment,null,Object(u.createElement)(ee.Icon,{icon:"plus"}),Object(l.__)("New Group","better-wp-security")),className:"itsec-user-groups-list__item itsec-user-groups-list__item--new",allowMultiple:!1})});var ln=Object(ce.compose)([Object(f.withSelect)(function(e){return{matchables:e("ithemes-security/user-groups").getMatchables(),resolvingMatchables:e("core/data").isResolving("ithemes-security/user-groups","getMatchables"),selectedGroup:e("ithemes-security/user-groups-editor").getSelectedGroup()}}),Object(f.withDispatch)(function(e){return{selectGroup:e("ithemes-security/user-groups-editor").selectGroup}})])(function(e){var t=e.matchables,n=e.resolvingMatchables,r=e.selectedGroup,i=e.selectGroup;if(Object(u.useEffect)(function(){!n&&t.length&&0===r.length&&i([t[0].id])},[n]),n&&!t.length)return null;var o=un(t);return Object(u.createElement)(et,{tabs:o,selected:r,onSelect:i,allowMultiple:!0,orientation:"vertical",className:"itsec-user-groups-list"},function(e){if(e.length>1){var t=Object(g.filter)(e.map(function(e){var t=e.group;return t&&t.id}));return Object(u.createElement)(hn,{groupIds:t})}return e[0]?Object(u.createElement)(pn,{groupId:e[0].name,isNew:"new"===e[0].name}):null})}),dn=(n("Y0od"),Ie()(function(e,t){if("new"===e)return[{name:"create",title:Object(l.__)("Edit Group","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:vn}];var n=[{name:"settings",title:Object(l.__)("Features","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:On}];return"user-group"===t&&n.push({name:"edit",title:Object(l.__)("Edit Group","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:gn}),n}));var pn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId;return{type:e("ithemes-security/user-groups").getMatchableType(n)}})])(function(e){var t=e.groupId,n=e.type,r=e.isNew;return Object(u.createElement)("div",{className:"itsec-manage-user-group"},r?Object(u.createElement)(Cn,null):Object(u.createElement)(Nn,{groupId:t}),Object(u.createElement)(nt,{tabs:dn(t,n),className:"itsec-manage-user-group-tabs"},function(e){var n=e.Component;return Object(u.createElement)(n,{groupId:t})}))}),fn=Ie()(function(){return[{name:"settings",title:Object(l.__)("Features","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:En}]});var hn=function(e){var t=e.groupIds;return Object(u.createElement)("div",{className:"itsec-manage-multiple-user-groups"},Object(u.createElement)(Rn,{groupIds:t}),Object(u.createElement)(nt,{tabs:fn(),className:"itsec-manage-user-group-tabs"},function(e){var n=e.Component;return Object(u.createElement)(n,{groupIds:t})}))};n("QmYb");var bn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId;return{label:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"label")||""}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{edit:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}})])(function(e){var t=e.label,n=e.edit,r=e.disabled,i=void 0!==r&&r;return Object(u.createElement)(ee.TextControl,{label:Object(l.__)("Group Name","better-wp-security"),value:t,maxLength:50,disabled:i,onChange:function(e){return n({label:e})}})});n("ZRc3");function mn(e){var t,n=e.name,r=e.isLoading,i=e.children,o=oe()("itsec-user-groups-group-tab",(t={},v()(t,"itsec-user-groups-group-tab--".concat(n),n),v()(t,"itsec-user-groups-group-tab--is-loading",r),t));return Object(u.createElement)("div",{className:o},i)}mn.Row=function(e){var t=e.name,n=e.children;return Object(u.createElement)("div",{className:"itsec-user-groups-group-tab__row itsec-user-groups-group-tab__row--".concat(t)},n)};var vn=Object(ce.compose)([Object(f.withSelect)(function(e){return{hasEdits:e("ithemes-security/user-groups-editor").hasEdits("new"),isSaving:e("ithemes-security/user-groups-editor").isCreating("new")}}),Object(f.withDispatch)(function(e){return{save:function(){e("ithemes-security/user-groups-editor").createGroup()}}})])(function(e){var t=e.hasEdits,n=e.save,r=e.isSaving;return Object(u.createElement)(mn,{name:"create-group"},Object(u.createElement)(Tn,{groupId:"new"}),Object(u.createElement)(mn.Row,{name:"save"},Object(u.createElement)(ee.Button,{disabled:!t,isPrimary:!0,onClick:n,isBusy:r},Object(l.__)("Create","better-wp-security"))))});var gn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId;return{isLoading:e("core/data").isResolving("ithemes-security/user-groups","getGroup",[n])||e("core/data").isResolving("ithemes-security/core","getIndex"),hasEdits:e("ithemes-security/user-groups-editor").hasEdits(n),isSaving:e("ithemes-security/user-groups").isUpdating(n)}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{save:function(){return e("ithemes-security/user-groups-editor").saveGroup(n)}}})])(function(e){var t=e.groupId,n=e.hasEdits,r=e.save,i=e.isSaving,o=e.isLoading;return Object(u.createElement)(mn,{name:"edit-group",isLoading:o},Object(u.createElement)(Tn,{groupId:t,disabled:o}),Object(u.createElement)(mn.Row,{name:"save"},Object(u.createElement)(ee.Button,{disabled:!n,isPrimary:!0,onClick:r,isBusy:i},Object(l.__)("Save","better-wp-security"))))});var yn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId,r=t.module,i=t.setting;return{value:e("ithemes-security/user-groups-editor").getEditedGroupSetting(n,r,i)}}),Object(f.withDispatch)(function(e,t){var n=t.groupId,r=t.module,i=t.setting;return{edit:function(t){return e("ithemes-security/user-groups-editor").editGroupSetting(n,r,i,t)}}})])(function(e){var t=e.schema,n=e.value,r=e.edit,i=e.disabled,o=void 0!==i&&i;return Object(u.createElement)(ee.ToggleControl,{checked:!0===n,label:t.title,help:t.description,disabled:o,onChange:function(e){return r(e)}})});n("GrEf");var On=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId;return{groupSettings:e("ithemes-security/user-groups").getGroupSettings(n),isLoading:e("core/data").isResolving("ithemes-security/user-groups","getGroupSettings",[n]),schema:e("ithemes-security/core").getSchema("ithemes-security-user-group-settings"),hasEdits:e("ithemes-security/user-groups-editor").settingHasEdits(n),isSaving:e("ithemes-security/user-groups").isUpdatingSettings(n)}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{save:function(){return e("ithemes-security/user-groups-editor").saveGroupSettings(n)}}})])(function(e){var t=e.schema,n=e.groupId,r=e.hasEdits,i=e.save,o=e.isSaving,c=e.isLoading;return t?Object(u.createElement)(mn,{name:"settings",isLoading:c},Object(u.createElement)(mn.Row,null,Object(u.createElement)(Dn,{schema:t,settingComponent:yn,groupId:n,disabled:c})),Object(u.createElement)(mn.Row,{name:"save"},Object(u.createElement)(ee.Button,{disabled:!r,isPrimary:!0,onClick:i,isBusy:o},Object(l.__)("Save","better-wp-security")))):null});var jn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.module,r=t.setting,i=t.groupIds;return{value:e("ithemes-security/user-groups-editor").getBulkSettingValue(i,n,r)}}),Object(f.withDispatch)(function(e,t){var n=t.module,r=t.setting;return{edit:function(t){return e("ithemes-security/user-groups-editor").bulkEditGroupSetting(n,r,t)}}})])(function(e){var t=e.schema,n=e.value,r=e.edit,i=e.disabled,o=void 0!==i&&i;return Object(u.createElement)(Ke,{checked:!0===n,indeterminate:null==n,label:t.title,help:t.description,disabled:o,onChange:function(e){return r(e)}})});var En=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupIds;return{schema:e("ithemes-security/core").getSchema("ithemes-security-user-group-settings"),hasEdits:e("ithemes-security/user-groups-editor").hasBulkSettingEdits(),isSaving:e("ithemes-security/user-groups-editor").isSavingBulkEdits(n)}}),Object(f.withDispatch)(function(e,t){var n=t.groupIds;return{save:function(){return e("ithemes-security/user-groups-editor").saveBulkEdits(n)}}})])(function(e){var t=e.schema,n=e.hasEdits,r=e.save,i=e.isSaving,o=e.groupIds;return t?Object(u.createElement)(mn,{name:"settings"},Object(u.createElement)(mn.Row,null,Object(u.createElement)(Dn,{schema:t,settingComponent:jn,groupIds:o})),Object(u.createElement)(mn.Row,{name:"save"},Object(u.createElement)(ee.Button,{disabled:!n,isPrimary:!0,onClick:r,isBusy:i},Object(l.__)("Save","better-wp-security")))):null});Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId;return{minRole:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"min_role")}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{onChange:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}})])(function(e){var t=e.minRole,n=e.onChange;return Object(u.createElement)("div",null,Object(u.createElement)(ee.SelectControl,{options:[{value:"administrator",label:Object(l._x)("Administrator","User role","default")},{value:"editor",label:Object(l._x)("Editor","User role","default")},{value:"author",label:Object(l._x)("Author","User role","default")},{value:"contributor",label:Object(l._x)("Contributor","User role","default")},{value:"subscriber",label:Object(l._x)("Subscriber","User role","default")}],label:Object(l.__)("Minimum Role","better-wp-security"),value:t,onChange:function(e){return n({min_role:e})},help:Object(l.__)("Add users with the selected minimum role to this group. To edit roles, go to Users in your WordPress Dashboard.","better-wp-security")}))});var _n=Ie()(function(e,t){var n=[{value:"$administrator$",label:Object(l.__)("Administrator Capabilities","better-wp-security")},{value:"$editor$",label:Object(l.__)("Editor Capabilities","better-wp-security")},{value:"$author$",label:Object(l.__)("Author Capabilities","better-wp-security")},{value:"$contributor$",label:Object(l.__)("Contributor Capabilities","better-wp-security")},{value:"$subscriber$",label:Object(l.__)("Subscriber Capabilities","better-wp-security")}];for(var r in t&&n.unshift({value:"$super-admin$",label:Object(l.__)("Super Admin","better-wp-security")}),Object(g.some)(e,function(e){return""===e.canonical})&&n.push({value:"$other$",label:Object(l.__)("Other","better-wp-security"),selectable:!1}),e)if(e.hasOwnProperty(r)){var i=e[r],o=i.canonical,c=i.label;n.push({value:r,parent:o.length>0?"$".concat(o,"$"):"$other$",label:c})}return Object.values(n)});var wn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n=t.groupId;return{roles:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"roles")||[],canonical:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"canonical")||[],available:e("ithemes-security/core").getRoles(),schema:e("ithemes-security/core").getSchema("ithemes-security-user-group")}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{onChange:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}})])(function(e){var t=e.canonical,n=e.roles,r=e.onChange,i=e.available,o=e.schema,c=e.disabled,s=void 0!==c&&c,a=Object(g.get)(o,["properties","canonical","items","enum"],[]).includes("super-admin"),d=[].concat(b()(n),b()(t.map(function(e){return"$".concat(e,"$")})));return Object(u.createElement)(Ae,{label:Object(l.__)("Select Roles","better-wp-security"),help:Object(l.__)("Add users with the selected roles to this group.","better-wp-security"),value:d,disabled:s,options:_n(i,a),onChange:function(e){var t=Object(j.a)(e,function(e){return e.startsWith("$")&&e.endsWith("$")}),n=ae()(t,2),i=n[0],o=n[1];r({roles:o,canonical:Object(g.without)(i.map(function(e){return e.slice(1,-1)}),"other")})}})}),Sn=n("Mmq9");n("ELjz");function In(e){return{value:e.id,label:e.name,user:e}}var kn=function(e){return new Promise(function(t,n){O()({path:Object(Sn.addQueryArgs)("/wp/v2/users",{search:e,per_page:100,context:"embed",itsec_global:!0})}).then(function(e){return e.forEach(Object(f.dispatch)("ithemes-security/core").receiveUser),e}).then(function(e){return t(e.map(In))}).catch(n)})};var xn=Object(ce.compose)([Object(ce.withState)({selectSearch:""}),Object(f.withSelect)(function(e,t){var n=t.groupId,r=e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"users")||[],i=[],o=!1;return r.forEach(function(t){var n=e("ithemes-security/core").getUser(t);n?i.push(n):e("core/data").isResolving("ithemes-security/core","getUser",[t])&&(o=!0)}),{users:i,userIds:r,loading:o}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{receiveUser:e("ithemes-security/core").receiveUser,onChange:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}}),ce.withInstanceId])(function(e){var t=e.instanceId,n=e.users,r=e.loading,i=e.onChange,o=e.disabled,c=void 0!==o&&o,s=e.selectSearch,a=e.setState,d="itsec-user-group-panel-users__select-".concat(t),p=r?[]:n.map(In);return Object(u.createElement)(ee.BaseControl,{className:"itsec-user-group-panel-users__select-control",label:Object(l.__)("Select Users","better-wp-security"),help:Object(l.__)("Select specific users to add to this group.","better-wp-security"),id:d},Object(u.createElement)(ve,{classNamePrefix:"components-itsec-async-select-control",inputId:d,isDisabled:c||r,isLoading:r,isMulti:!0,cacheOptions:!0,defaultOptions:!0,loadOptions:kn,value:p,onChange:function(e){return i({users:Object(g.map)(e,"value")})},inputValue:s,onInputChange:function(e){return a({selectSearch:e})}}))});n("mzAq");var Nn=Object(ce.compose)([Object(f.withSelect)(function(e,t){var n,r=t.groupId,i=e("ithemes-security/user-groups").getMatchableType(r),o="user-group"===i&&e("ithemes-security/user-groups").isDeleting(r);return"user-group"===i&&(n=e("ithemes-security/user-groups-editor").getEditedGroupAttribute(r,"label")),void 0===n&&(n=e("ithemes-security/user-groups").getMatchableLabel(r)),{type:i,label:n,isDeleting:o}}),Object(f.withDispatch)(function(e,t){var n=t.groupId;return{deleteGroup:function(){return e("ithemes-security/user-groups").deleteGroup(n)}}})])(function(e){var t=e.type,n=e.label,r=e.isDeleting,i=e.deleteGroup,o="user-group"===t;return n&&n.length||(n=Object(l.__)("Untitled","better-wp-security")),Object(u.createElement)(Pn,{label:n},o&&Object(u.createElement)(ee.Button,{onClick:i,isBusy:r,isLink:!0,isDestructive:!0},Object(l.__)("Delete Group","better-wp-security")))});var Cn=Object(ce.compose)([Object(f.withSelect)(function(e){return{label:e("ithemes-security/user-groups-editor").getEditedGroupAttribute("new","label")}})])(function(e){var t=e.label;return t&&t.length||(t=Object(l.__)("New Group","better-wp-security")),Object(u.createElement)(Pn,{label:t})});var Rn=Object(ce.compose)([Object(f.withSelect)(function(e,t){return{label:t.groupIds.map(e("ithemes-security/user-groups").getMatchableLabel).join(", ")}})])(function(e){var t=e.label;return Object(u.createElement)(Pn,{label:t})});function Pn(e){var t=e.label,n=e.children;return Object(u.createElement)("div",{className:"itsec-user-group-header"},Object(u.createElement)("h4",{className:"itsec-user-group-header__label"},t),n)}n("XO7p");var Tn=function(e){var t=e.groupId,n=e.disabled;return Object(u.createElement)(mn.Row,{name:"edit-fields"},Object(u.createElement)(bn,{groupId:t,disabled:n}),Object(u.createElement)(wn,{groupId:t,disabled:n}),Object(u.createElement)(xn,{groupId:t,disabled:n}))};function Dn(e){var t=e.schema,n=e.settingComponent,r=de()(e,["schema","settingComponent"]);return Object(u.createElement)("ul",{className:"itsec-user-groups-group-tab__modules-list"},Object(g.map)(t.properties,function(e,t){return Object(u.createElement)("li",{key:t},Object(u.createElement)("fieldset",null,Object(u.createElement)("legend",null,e.title),Object(u.createElement)("ul",null,Object(g.map)(e.properties,function(e,i){return Object(u.createElement)("li",{key:i},Object(u.createElement)(n,Ee()({schema:e,module:t,setting:i},r)))}))))}))}n("wM0a");var An=function(e){var t=e.noticeEl;return Object(u.createElement)("div",{className:"itsec-user-groups-app"},Object(u.createPortal)(Object(u.createElement)(Be,null),t),Object(u.createElement)(an,null))};function Ln(){var e=document.getElementById("itsec-user-groups-settings-root"),t=document.getElementById("itsec-module-messages-container-user-groups");return Object(u.render)(Object(u.createElement)(An,{noticeEl:t}),e)}n.p=window.itsecWebpackPublicPath,Object(l.setLocaleData)({"":{}},"ithemes-security-pro"),p()(function(){Ln(),window.itsecSettingsPage&&(window.itsecSettingsPage.events.on("modulesReloaded",Ln),window.itsecSettingsPage.events.on("moduleReloaded",function(e,t){"user-groups"===t&&Ln()}))})},faye:function(e,t){!function(){e.exports=this.ReactDOM}()},l3Sj:function(e,t){!function(){e.exports=this.wp.i18n}()},lSb6:function(e,t,n){},mzAq:function(e,t,n){},"oaS/":function(e,t,n){},onLe:function(e,t){!function(){e.exports=this.wp.notices}()},pVnL:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},rl8x:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},rmEH:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},sPxh:function(e,t){!function(){e.exports=this.itsec["user-groups"].api}()},"tI+e":function(e,t){!function(){e.exports=this.wp.components}()},urxu:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundaryFallbackComponent=t.withErrorBoundary=t.ErrorBoundary=void 0;var r=c(n("Xvx9")),i=n("31KZ"),o=c(i);function c(e){return e&&e.__esModule?e:{default:e}}t.default=o.default,t.ErrorBoundary=o.default,t.withErrorBoundary=i.withErrorBoundary,t.ErrorBoundaryFallbackComponent=r.default},wM0a:function(e,t,n){},ywyh:function(e,t){!function(){e.exports=this.wp.apiFetch}()}});
1
+ this.itsec=this.itsec||{},this.itsec["user-groups"]=this.itsec["user-groups"]||{},this.itsec["user-groups"].settings=function(e){function t(t){for(var r,c,s=t[0],a=t[1],u=t[2],f=0,p=[];f<s.length;f++)c=s[f],i[c]&&p.push(i[c][0]),i[c]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(l&&l(t);p.length;)p.shift()();return o.push.apply(o,u||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,s=1;s<n.length;s++){var a=n[s];0!==i[a]&&(r=!1)}r&&(o.splice(t--,1),e=c(c.s=n[0]))}return e}var r={},i={7:0,4:0},o=[];function c(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,c),n.l=!0,n.exports}c.e=function(e){var t=[],n=i[e];if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o,s=document.createElement("script");s.charset="utf-8",s.timeout=120,c.nc&&s.setAttribute("nonce",c.nc),s.src=function(e){return c.p+""+({}[e]||e)+".min.js"}(e),o=function(t){s.onerror=s.onload=null,clearTimeout(a);var n=i[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src,c=new Error("Loading chunk "+e+" failed.\n("+r+": "+o+")");c.type=r,c.request=o,n[1](c)}i[e]=void 0}};var a=setTimeout(function(){o({type:"timeout",target:s})},12e4);s.onerror=s.onload=o,document.head.appendChild(s)}return Promise.all(t)},c.m=e,c.c=r,c.d=function(e,t,n){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,t){if(1&t&&(e=c(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(c.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)c.d(n,r,function(t){return e[t]}.bind(null,r));return n},c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="",c.oe=function(e){throw console.error(e),e};var s=window.itsecWebpackJsonP=window.itsecWebpackJsonP||[],a=s.push.bind(s);s.push=t,s=s.slice();for(var u=0;u<s.length;u++)t(s[u]);var l=a;return o.push(["epig",0]),n()}({"+VN0":function(e,t,n){},"/fTC":function(e,t,n){var r,i;r=function(){var e=/^;\s*([^"=]+)=(?:"([^"]+)"|([^";,]+)(?:[;,]|$))/,t=/^<([^>]*)>/,n=/^\s*,\s*/;return{parse:function(r,i){for(var o,c,s,a=i&&i.extended||!1,u=[];r&&(r=r.trim(),c=t.exec(r));){for(var l={link:c[1]},f=(r=r.slice(c[0].length)).match(n);r&&(!f||f.index>0)&&(o=e.exec(r));)f=(r=r.slice(o[0].length)).match(n),"rel"===o[1]||"rev"===o[1]?(s=(o[2]||o[3]).split(/\s+/),l[o[1]]=s):l[o[1]]=o[2]||o[3];u.push(l),r=r.replace(n,"")}return a?u:u.reduce(function(e,t){return t.rel&&t.rel.forEach(function(n){e[n]=t.link}),e},{})},stringify:function(e){var t=Object.keys(e).reduce(function(t,n){return t[e[n]]=t[e[n]]||[],t[e[n]].push(n),t},{});return Object.keys(t).reduce(function(e,n){return e.concat("<"+n+'>; rel="'+t[n].join(" ")+'"')},[]).join(", ")}}},i=this,e.exports?e.exports=r():"function"==typeof i.define&&i.define.amd?define(r):i.li=r()},"16Al":function(e,t,n){"use strict";var r=n("WbBG");function i(){}e.exports=function(){function e(e,t,n,i,o,c){if(c!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=i,n.PropTypes=n,n}},"17x9":function(e,t,n){e.exports=n("16Al")()},"1ZqX":function(e,t){!function(){e.exports=this.wp.data}()},"31KZ":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.withErrorBoundary=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n("cDcd"),o=s(i),c=s(n("Xvx9"));function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var u=n("cDcd").babelPluginFlowReactPropTypes_proptype_ComponentType||n("17x9").any,l=function(e){function t(){var e,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=Array(i),c=0;c<i;c++)o[c]=arguments[c];return n=r=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o))),r.state={error:null,info:null},a(r,n)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.Component),r(t,[{key:"componentDidCatch",value:function(e,t){var n=this.props.onError;if("function"==typeof n)try{n.call(this,e,t?t.componentStack:"")}catch(e){}this.setState({error:e,info:t})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.FallbackComponent,r=this.state,i=r.error,c=r.info;return null!==i?o.default.createElement(n,{componentStack:c?c.componentStack:"",error:i}):t}}]),t}();l.defaultProps={FallbackComponent:c.default},l.propTypes={error:"function"==typeof Error?n("17x9").instanceOf(Error):n("17x9").any,info:n("17x9").shape({componentStack:n("17x9").string.isRequired})},(t.withErrorBoundary=function(e,t,n){return function(r){return o.default.createElement(l,{FallbackComponent:t,onError:n},o.default.createElement(e,r))}}).propTypes=u===n("17x9").any?{}:u,t.default=l},"4eJC":function(e,t,n){e.exports=function(e,t){var n,r,i,o=0;function c(){var t,c,s=r,a=arguments.length;e:for(;s;){if(s.args.length===arguments.length){for(c=0;c<a;c++)if(s.args[c]!==arguments[c]){s=s.next;continue e}return s!==r&&(s===i&&(i=s.prev),s.prev.next=s.next,s.next&&(s.next.prev=s.prev),s.next=r,s.prev=null,r.prev=s,r=s),s.val}s=s.next}for(t=new Array(a),c=0;c<a;c++)t[c]=arguments[c];return s={args:t,val:e.apply(null,t)},r?(r.prev=s,s.next=r):i=s,o===n?(i=i.prev).next=null:o++,r=s,s.val}return t&&t.maxSize&&(n=t.maxSize),c.clear=function(){r=null,i=null,o=0},c}},"6ECA":function(e,t,n){},"8OQS":function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}},A6yB:function(e,t,n){},DfSy:function(e,t,n){},Dfre:function(e,t,n){},ELjz:function(e,t,n){},GRId:function(e,t){!function(){e.exports=this.wp.element}()},"GjY+":function(e,t,n){},GrEf:function(e,t,n){},IXp0:function(e,t,n){},JVTk:function(e,t,n){var r=n("cDcd");function i(e){return r.createElement("svg",e,[r.createElement("defs",{key:0},r.createElement("style",null,".itsec-icon-logo-12f8d__path{fill:#1072ba;}.itsec-icon-logo-12f8d__path{fill:#69c;}")),r.createElement("g",{key:1},r.createElement("g",null,[r.createElement("path",{className:"itsec-icon-logo-12f8d__path",d:"M203.28,95V14.26a1.73,1.73,0,0,0-1.11-1.55c-4.38-1.44-21.5-6.6-46.22-8a1.1,1.1,0,0,0-1.17,1.11V20.1a1,1,0,0,1-1.16,1c-8-1.24-16.88-2.29-26.39-3a1.27,1.27,0,0,1-1.17-1.25V3a1.37,1.37,0,0,0-1.16-1.32A211.61,211.61,0,0,0,101,0,178.14,178.14,0,0,0,78.51,1.87a1.4,1.4,0,0,0-1.16,1.35V16.91a1.28,1.28,0,0,1-1.16,1.26c-9.51.72-18.34,1.78-26.38,3a1,1,0,0,1-1.16-1V5.79a1.1,1.1,0,0,0-1.17-1.11c-24.74,1.43-41.94,6.59-46.34,8A1.73,1.73,0,0,0,0,14.26V95s-2.3,54.32,34.61,97.07c32.69,37.86,60,46.91,65.84,48.5a5.16,5.16,0,0,0,2.28,0c5.82-1.58,33.16-10.63,65.83-48.5C205.51,149.35,203.28,95,203.28,95Z",key:0}),r.createElement("path",{className:"itsec-icon-logo-12f8d__path",d:"M101.38,68.5a21.75,21.75,0,1,0,21.7,21.81A21.77,21.77,0,0,0,101.38,68.5Z",key:1}),r.createElement("path",{className:"itsec-icon-logo-12f8d__path",d:"M182.44,87V42.75A1.92,1.92,0,0,0,181,41a385.2,385.2,0,0,0-78.26-8.05h-1.66a398.43,398.43,0,0,0-78.71,8.21,1.9,1.9,0,0,0-1.45,1.78l0,44.2v.24c0,3.27.09,54.82,33.38,93.35,18.71,21.67,35,33.81,46.15,40.44a2.79,2.79,0,0,0,2.56,0c11.14-6.61,27.36-18.74,46.12-40.45C183.22,141.12,182.46,87.63,182.44,87Zm-50.57,79.1c-2.69,3.13-5.32,6-7.87,8.69-.59.61-1.07.41-1.07-.44V155.78c0-14.05,13.64-21.19,18.14-23.17a2.49,2.49,0,0,0,1.42-2.11V116.39a1,1,0,0,0-1.41-.94c-37.93,15.49-72.25,3-79.51,0a.93.93,0,0,0-1.41.91V130.5a2.37,2.37,0,0,0,1.44,2.06c14.94,5.72,18,15.46,18,23.4v18.25c0,.85-.48,1-1.06.43-2.51-2.63-5.09-5.46-7.76-8.53-28.11-32.58-27.95-78.24-27.93-78.7V61.47a1.86,1.86,0,0,1,1.51-1.77,374.15,374.15,0,0,1,56.51-4.51h1.69a364.08,364.08,0,0,1,55.75,4.32,1.86,1.86,0,0,1,1.52,1.78v25.3C159.83,87.44,160.12,133.44,131.87,166.11Z",key:2})]))])}i.defaultProps={width:"200px",viewBox:"0 0 203.31 240.72"},e.exports=i,i.default=i},K9lf:function(e,t){!function(){e.exports=this.wp.compose}()},Mmq9:function(e,t){!function(){e.exports=this.wp.url}()},QILm:function(e,t,n){var r=n("8OQS");e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(i=0;i<c.length;i++)n=c[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},QmYb:function(e,t,n){},QxRw:function(e,t,n){},TSYQ:function(e,t,n){
2
  /*!
3
  Copyright (c) 2017 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
  */
7
+ !function(){"use strict";var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i)&&i.length){var c=n.apply(null,i);c&&e.push(c)}else if("object"===o)for(var s in i)t.call(i,s)&&i[s]&&e.push(s)}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()},Td6G:function(e,t,n){"use strict";n("J4zp");var r=n("YLtl"),i=n("RIqP"),o=n.n(i),c=n("lwsE"),s=n.n(c),a=n("W8MJ"),u=n.n(a),l=n("lSNA"),f=n.n(l),p=n("92Nh"),d=n.n(p),b=n("tmk3"),h=n.n(b);function m(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var g=new WeakMap,y=new WeakMap,O=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;s()(this,e),g.set(this,{writable:!0,value:{}}),y.set(this,{writable:!0,value:{}}),f()(this,"getErrorCodes",function(){return Object.keys(h()(t,g))}),f()(this,"getErrorCode",function(){return t.getErrorCodes()[0]}),f()(this,"getErrorMessages",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(e)return h()(t,g)[e];var n=[];for(var r in h()(t,g))h()(t,g).hasOwnProperty(r)&&n.concat(h()(t,g)[r]);return n}),f()(this,"getErrorMessage",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),t.getErrorMessages(e)[0]}),f()(this,"getErrorData",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return e=e||t.getErrorCode(),h()(t,y)[e]}),f()(this,"getAllErrorMessages",function(){var e=[];for(var n in h()(t,g))h()(t,g).hasOwnProperty(n)&&e.push.apply(e,o()(h()(t,g)[n]));return e}),n&&(r&&(h()(this,g)[n]=[r]),i&&(h()(this,y)[n]=i))}return u()(e,null,[{key:"fromPHPObject",value:function(t){var n=new e;return d()(n,g,t.errors),d()(n,y,t.error_data),n}},{key:"fromApiError",value:function(t){var n=new e;if(h()(n,g)[t.code]=[t.message],h()(n,y)[t.code]=t.data,t.additional_errors){var r,i=m(t.additional_errors);try{for(i.s();!(r=i.n()).done;){var o=r.value;h()(n,g)[o.code]=[o.message],h()(n,y)[o.code]=o.data}}catch(e){i.e(e)}finally{i.f()}}return n}}]),e}(),E=n("PJYZ"),j=n.n(E),_=n("7W2i"),w=n.n(_),S=n("a1gu"),I=n.n(S),k=n("Nsbk"),x=n.n(k),N=n("oShl"),T=n.n(N),C=n("l3Sj");function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=x()(e);if(t){var i=x()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return I()(this,n)}}var A=function(e){w()(n,e);var t=R(n);function n(e){var r;s()(this,n);for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];for(var a in r=t.call.apply(t,[this,e.message||Object(C.__)("An unknown error occurred.","better-wp-security")].concat(o)),Error.captureStackTrace&&Error.captureStackTrace(j()(r),n),r.__response=e,e)e.hasOwnProperty(a)&&Object.defineProperty(j()(r),a,{value:e[a],configurable:!0,enumerable:!0,writable:!0});return r}return u()(n,[{key:"toString",value:function(){return this.__response.toString()}},{key:"getResponse",value:function(){return this.__response}}]),n}(T()(Error));function P(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function D(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function L(e){if(!Object(r.isPlainObject)(e))return!1;var t=Object.keys(e);return 2===t.length&&(t.includes("errors")&&t.includes("error_data"))}function G(e){return L(e)?O.fromPHPObject(e):function(e){if(!Object(r.isPlainObject)(e))return!1;var t=Object.keys(e);return(3===t.length||4===t.length)&&!(4===t.length&&!t.includes("additional_errors"))&&t.includes("code")&&t.includes("message")&&t.includes("data")}(e)?O.fromApiError(e):new O}function B(e,t){var n,r=[[],[]],i=P(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;r[t(o)?0:1].push(o)}}catch(e){i.e(e)}finally{i.f()}return r}function M(e){if(e instanceof Error)throw e;throw new A(e)}n.d(t,"e",function(){return L}),n.d(t,"b",function(){return G}),n.d(t,"a",function(){return B}),n.d(t,"f",function(){return M}),n.d(t,"d",function(){return U}),n.d(t,"c",function(){return H});function U(e){return function(e,t){return Object(r.get)(e,["_links",t,0,"href"])}(e,"self")}function H(e,t){if(e&&e.links){var n,r=P(e.links);try{for(r.s();!(n=r.n()).done;){var i=n.value;if(i.rel===t)return i}}catch(e){r.e(e)}finally{r.f()}}}},WbBG:function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},XO7p:function(e,t,n){},Xvx9:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n("cDcd"),o=(r=i)&&r.__esModule?r:{default:r};var c=function(e,t){return e.toString()+"\n\nThis is located at:"+t},s=function(e){var t=e.componentStack,n=e.error;return o.default.createElement("div",{style:a,title:c(n,t)},o.default.createElement("svg",{style:u,viewBox:"0 0 24 24",preserveAspectRatio:"xMidYMid"},o.default.createElement("path",{d:"M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,\n 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,\n 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,\n 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,\n 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,\n 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,\n 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"})))};s.propTypes={componentStack:n("17x9").string.isRequired,error:"function"==typeof Error?n("17x9").instanceOf(Error).isRequired:n("17x9").any.isRequired};var a={height:"100%",maxHeight:"100vh",width:"100%",maxWidth:"100vw",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",backgroundColor:"#C00",color:"#FFF",boxSizing:"border-box",cursor:"help"},u={fill:"currentColor",flex:"1 1 auto"};t.default=s},Y0od:function(e,t,n){},Y8OO:function(e,t){!function(){e.exports=this.wp.domReady}()},YLtl:function(e,t){!function(){e.exports=this.lodash}()},ZRc3:function(e,t,n){},"bJT+":function(e,t,n){},cDcd:function(e,t){!function(){e.exports=this.React}()},epig:function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"path",function(){return H}),n.d(r,"query",function(){return F}),n.d(r,"fetchQueryNextPage",function(){return q}),n.d(r,"receiveQuery",function(){return V}),n.d(r,"receiveBan",function(){return K}),n.d(r,"startCreateBan",function(){return W}),n.d(r,"failedCreateBan",function(){return $}),n.d(r,"finishCreateBan",function(){return Q}),n.d(r,"startUpdateBan",function(){return Y}),n.d(r,"failedUpdateBan",function(){return z}),n.d(r,"finishUpdateBan",function(){return J}),n.d(r,"startDeleteBan",function(){return X}),n.d(r,"failedDeleteBan",function(){return Z}),n.d(r,"finishDeleteBan",function(){return ee}),n.d(r,"createBan",function(){return te}),n.d(r,"updateBan",function(){return ne}),n.d(r,"deleteBan",function(){return re}),n.d(r,"RECEIVE_QUERY",function(){return ie}),n.d(r,"START_QUERY",function(){return oe}),n.d(r,"FINISH_QUERY",function(){return ce}),n.d(r,"FAILED_QUERY",function(){return se}),n.d(r,"START_CREATE_BAN",function(){return ae}),n.d(r,"FINISH_CREATE_BAN",function(){return ue}),n.d(r,"FAILED_CREATE_BAN",function(){return le}),n.d(r,"RECEIVE_BAN",function(){return fe}),n.d(r,"START_UPDATE_BAN",function(){return pe}),n.d(r,"FINISH_UPDATE_BAN",function(){return de}),n.d(r,"FAILED_UPDATE_BAN",function(){return be}),n.d(r,"START_DELETE_BAN",function(){return he}),n.d(r,"FINISH_DELETE_BAN",function(){return me}),n.d(r,"FAILED_DELETE_BAN",function(){return ve});var i={};n.r(i),n.d(i,"getBans",function(){return ye}),n.d(i,"getQueryResults",function(){return Oe}),n.d(i,"getQueryHeaderLink",function(){return Ee}),n.d(i,"getQueryHeaderLinks",function(){return je}),n.d(i,"getQueryHeader",function(){return _e}),n.d(i,"getBan",function(){return we}),n.d(i,"isUpdating",function(){return Se}),n.d(i,"isDeleting",function(){return Ie}),n.d(i,"isQuerying",function(){return ke});var o={};n.r(o),n.d(o,"getBans",function(){return Ne});var c={};n.r(c),n.d(c,"getUser",function(){return Pe}),n.d(c,"getIndex",function(){return De}),n.d(c,"getSchema",function(){return Le}),n.d(c,"getRoles",function(){return Ge}),n.d(c,"getActorTypes",function(){return Be}),n.d(c,"getActors",function(){return Me});var s={};n.r(s),n.d(s,"fetchIndex",function(){return He}),n.d(s,"receiveIndex",function(){return Fe}),n.d(s,"receiveUser",function(){return qe}),n.d(s,"receiveActorTypes",function(){return Ve}),n.d(s,"receiveActors",function(){return Ke}),n.d(s,"RECEIVE_INDEX",function(){return We}),n.d(s,"RECEIVE_USER",function(){return $e}),n.d(s,"RECEIVE_ACTOR_TYPES",function(){return Qe}),n.d(s,"RECEIVE_ACTORS",function(){return Ye});var a={};n.r(a),n.d(a,"getIndex",function(){return Ze}),n.d(a,"getUser",function(){return et}),n.d(a,"getActorTypes",function(){return tt}),n.d(a,"getActors",function(){return nt});var u={};n.r(u),n.d(u,"selectGroup",function(){return Pn}),n.d(u,"editGroup",function(){return Dn}),n.d(u,"saveGroup",function(){return Ln}),n.d(u,"resetEdits",function(){return Gn}),n.d(u,"createGroup",function(){return Bn}),n.d(u,"editGroupSetting",function(){return Mn}),n.d(u,"saveGroupSettings",function(){return Un}),n.d(u,"bulkEditGroupSetting",function(){return Hn}),n.d(u,"resetBulkGroupSettingEdit",function(){return Fn}),n.d(u,"resetBulkGroupSettingEdits",function(){return qn}),n.d(u,"saveBulkEdits",function(){return Vn}),n.d(u,"SELECT_GROUP",function(){return Kn}),n.d(u,"EDIT_GROUP",function(){return Wn}),n.d(u,"RESET_EDITS",function(){return $n}),n.d(u,"START_SAVE_GROUP",function(){return Qn}),n.d(u,"FINISH_SAVE_GROUP",function(){return Yn}),n.d(u,"FAILED_SAVE_GROUP",function(){return zn}),n.d(u,"START_CREATE_GROUP",function(){return Jn}),n.d(u,"FINISH_CREATE_GROUP",function(){return Xn}),n.d(u,"FAILED_CREATE_GROUP",function(){return Zn}),n.d(u,"EDIT_GROUP_SETTING",function(){return er}),n.d(u,"START_SAVE_GROUP_SETTINGS",function(){return tr}),n.d(u,"FINISH_SAVE_GROUP_SETTINGS",function(){return nr}),n.d(u,"FAILED_SAVE_GROUP_SETTINGS",function(){return rr}),n.d(u,"BULK_EDIT_GROUP_SETTING",function(){return ir}),n.d(u,"RESET_BULK_GROUP_SETTING_EDIT",function(){return or}),n.d(u,"RESET_BULK_GROUP_SETTING_EDITS",function(){return cr});var l={};n.r(l),n.d(l,"getSelectedGroup",function(){return sr}),n.d(l,"isCreating",function(){return ar}),n.d(l,"getEditedGroup",function(){return ur}),n.d(l,"getEditedGroupAttribute",function(){return lr}),n.d(l,"hasEdits",function(){return fr}),n.d(l,"settingHasEdits",function(){return pr}),n.d(l,"getEditedGroupSettings",function(){return dr}),n.d(l,"getEditedGroupSetting",function(){return br}),n.d(l,"hasBulkSettingEdits",function(){return hr}),n.d(l,"getBulkSettingEdits",function(){return mr}),n.d(l,"getBulkSettingEdit",function(){return vr}),n.d(l,"getBulkSettingValue",function(){return gr}),n.d(l,"isSavingBulkEdits",function(){return yr}),n.d(l,"getAvailableGroups",function(){return Or});var f={};n.r(f),n.d(f,"getAvailableGroups",function(){return jr});var p=n("GRId"),d=n("l3Sj"),b=n("Y8OO"),h=n.n(b),m=(n("onLe"),n("1ZqX")),v=n("o0o1"),g=n.n(v),y=n("RIqP"),O=n.n(y),E=n("lSNA"),j=n.n(E),_=n("yXPU"),w=n.n(_),S=n("YLtl"),I=n("ywyh"),k=n.n(I),x=n("Td6G");function N(e){return{type:"API_FETCH",request:e}}function T(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return{type:"SELECT",storeKey:e,selectorName:t,args:r}}function C(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return{type:"DISPATCH",storeKey:e,actionName:t,args:r}}function R(e){return{type:"PARSE_FETCH_RESPONSE",response:e}}function A(){return(A=w()(g.a.mark(function e(t){var n;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.response,e.next=3,n.json();case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}var P={API_FETCH:function(e){var t=e.request;return k()(t).catch(x.f)},SELECT:function(e){var t=e.storeKey,n=e.selectorName,r=e.args,i=Object(m.select)(t)[n];return i.hasResolver?function(e){var t=e.storeKey,n=e.selectorName,r=e.args;return new Promise(function(e){var i=function(){return Object(m.select)("core/data").hasFinishedResolution(t,n,r)},o=function(){return Object(m.select)(t)[n].apply(null,r)},c=o();if(i())return e(c);var s=Object(m.subscribe)(function(){i()&&(s(),e(o()))})})}({storeKey:t,selectorName:n,args:r}):i.apply(void 0,O()(r))},DISPATCH:function(e){var t,n=e.storeKey,r=e.actionName,i=e.args;return(t=Object(m.dispatch)(n))[r].apply(t,O()(i))},PARSE_FETCH_RESPONSE:function(e){return A.apply(this,arguments)},CREATE_NOTICE:function(e){var t=e.status,n=e.content,r=e.options;r.autoDismiss&&(r.id=r.id||Object(S.uniqueId)("itsec-auto-dismiss-"),setTimeout(function(){return Object(m.dispatch)("core/notices").removeNotice(r.id,r.context)},r.autoDismiss)),Object(m.dispatch)("core/notices").createNotice(t,n,r)}},D=n("Mmq9"),L=g.a.mark(F),G=g.a.mark(q),B=g.a.mark(te),M=g.a.mark(ne),U=g.a.mark(re),H="/ithemes-security/v1/bans";function F(e){var t,n,r,i=arguments;return g.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return t=i.length>1&&void 0!==i[1]?i[1]:{},o.next=3,{type:oe,queryId:e,queryParams:t};case 3:return o.prev=3,o.next=6,N({path:Object(D.addQueryArgs)(H,t),parse:!1});case 6:return n=o.sent,o.next=9,R(n);case 9:r=o.sent,o.next=17;break;case 12:return o.prev=12,o.t0=o.catch(3),o.next=16,{type:se,queryId:e,queryParams:t,error:o.t0};case 16:return o.abrupt("return",o.t0);case 17:return o.next=19,V(e,t.context||"view",n,r,"replace");case 19:return o.next=21,{type:ce,queryId:e,queryParams:t,response:n};case 21:return o.abrupt("return",n);case 22:case"end":return o.stop()}},L,null,[[3,12]])}function q(e){var t,n,r,i,o,c=arguments;return g.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return t=c.length>1&&void 0!==c[1]?c[1]:"append",s.next=3,T("ithemes-security/bans","getQueryHeaderLink",e,"next");case 3:if(n=s.sent){s.next=6;break}return s.abrupt("return",[]);case 6:return s.next=8,{type:oe,queryId:e};case 8:return s.prev=8,s.next=11,N({url:n.link,parse:!1});case 11:return r=s.sent,s.next=14,R(r);case 14:i=s.sent,s.next=22;break;case 17:return s.prev=17,s.t0=s.catch(8),s.next=21,{type:se,queryId:e,error:s.t0};case 21:return s.abrupt("return",s.t0);case 22:return o=Object(D.getQueryArg)(n.link,"context")||"view",s.next=25,V(e,o,r,i,t);case 25:return s.next=27,{type:ce,queryId:e,response:r};case 27:return s.abrupt("return",r);case 28:case"end":return s.stop()}},G,null,[[8,17]])}function V(e,t,n,r,i){return{type:ie,queryId:e,context:t,response:n,items:r,mode:i}}function K(e){return{type:fe,ban:e}}function W(e){return{type:ae,ban:e}}function $(e,t){return{type:le,ban:e,error:t}}function Q(e,t){return{type:ue,ban:e,response:t}}function Y(e,t){return{type:pe,self:e,ban:t}}function z(e,t){return{type:be,self:e,error:t}}function J(e,t){return{type:de,self:e,response:t}}function X(e){return{type:he,self:e}}function Z(e,t){return{type:ve,self:e,error:t}}function ee(e){return{type:me,self:e}}function te(e,t){var n,r;return g.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return n={method:"POST",data:t},Object(D.isURL)(e)?n.url=e:n.path="".concat(H,"/").concat(e),i.next=4,W(t);case 4:return i.prev=4,i.next=7,N(n);case 7:r=i.sent,i.next=15;break;case 10:return i.prev=10,i.t0=i.catch(4),i.next=14,$(t,i.t0);case 14:return i.abrupt("return",i.t0);case 15:return i.next=17,Q(t,r);case 17:return i.next=19,K(r);case 19:return i.abrupt("return",r);case 20:case"end":return i.stop()}},B,null,[[4,10]])}function ne(e,t){var n,r;return g.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return n=Object(S.isObject)(e)?Object(x.d)(e):e,i.next=3,Y(n,t);case 3:return i.prev=3,i.next=6,N({url:n,method:"PUT",data:t});case 6:r=i.sent,i.next=14;break;case 9:return i.prev=9,i.t0=i.catch(3),i.next=13,z(n,i.t0);case 13:return i.abrupt("return",i.t0);case 14:return i.next=16,J(n,r);case 16:return i.next=18,K(r);case 18:return i.abrupt("return",r);case 19:case"end":return i.stop()}},M,null,[[3,9]])}function re(e){var t;return g.a.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return t=Object(S.isObject)(e)?Object(x.d)(e):e,n.next=3,X(t);case 3:return n.prev=3,n.next=6,N({url:t,method:"DELETE"});case 6:n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(3),n.next=12,Z(t,n.t0);case 12:return n.abrupt("return",n.t0);case 13:return n.next=15,ee(t);case 15:return n.abrupt("return",null);case 16:case"end":return n.stop()}},U,null,[[3,8]])}var ie="RECEIVE_QUERY",oe="START_QUERY",ce="FINISH_QUERY",se="FAILED_QUERY",ae="START_CREATE_BAN",ue="FINISH_CREATE_BAN",le="FAILED_CREATE_BAN",fe="RECEIVE_BAN",pe="START_UPDATE_BAN",de="FINISH_UPDATE_BAN",be="FAILED_UPDATE_BAN",he="START_DELETE_BAN",me="FINISH_DELETE_BAN",ve="FAILED_DELETE_BAN",ge=n("pPDe"),ye=Object(m.createRegistrySelector)(function(e){return function(){return e("ithemes-security/bans").getQueryResults("main")}}),Oe=Object(ge.a)(function(e,t){for(var n=Object(S.get)(e,["queries",t,"selves"],[]),r=e.bySelf,i=n.length,o=new Array(i),c=-1;++c<i;){var s=r[n[c]];s&&(o[c]=s.item)}return o},function(e,t){return[e.queries[t],e.bySelf]});function Ee(e,t,n){return Object(S.find)(Object(S.get)(e,["queries",t,"links"],[]),{rel:n})}function je(e,t,n){return Object(S.filter)(Object(S.get)(e,["queries",t,"links"],[]),{rel:n})}function _e(e,t,n){return Object(S.get)(e,["queries",t,"headers",n])}function we(e,t){return e.bySelf[t]}function Se(e,t){var n=Object(S.isObject)(t)?Object(x.d)(t):t;return e.updating.includes(n)}function Ie(e,t){var n=Object(S.isObject)(t)?Object(x.d)(t):t;return e.deleting.includes(n)}function ke(e,t){return e.querying.includes(t)}var xe=g.a.mark(Ne);function Ne(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C("ithemes-security/bans","query","main",{per_page:100});case 2:case"end":return e.stop()}},xe)}var Te=n("/fTC");function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach(function(t){j()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ae={bySelf:{},queries:{},querying:[],creating:[],updating:[],deleting:[]};function Pe(e,t){return e.users.byId[t]}function De(e){return e.index}function Le(e,t){var n=Object(m.select)("ithemes-security/core").getIndex();if(!n)return null;for(var r in n.routes)if(n.routes.hasOwnProperty(r)){var i=n.routes[r].schema;if(i&&i.title===t)return i}return null}function Ge(){var e=Object(m.select)("ithemes-security/core").getIndex();return e?e.roles:null}function Be(e){return e.actors.types}function Me(e,t){return e.actors.byType[t]}Object(m.registerStore)("ithemes-security/bans",{controls:P,actions:r,selectors:i,resolvers:o,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ae,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case ie:return Re(Re({},e),{},{queries:Re(Re({},e.queries),{},j()({},t.queryId,{selves:"replace"===t.mode?Object(S.map)(t.items,x.d):[].concat(O()(Object(S.get)(e,["queries",t.queryId,"selves"],[])),O()(Object(S.map)(t.items,x.d))),headers:Object(S.fromPairs)(Array.from(t.response.headers.entries())),links:Object(Te.parse)(t.response.headers.get("link"),{extended:!0}).map(function(e){return Re(Re({},e),{},{rel:e.rel[0]})})})),bySelf:Re(Re({},e.bySelf),Object(S.fromPairs)(t.items.filter(function(n){var r=Object(x.d)(n);return!e.bySelf[r]||"embed"===e.bySelf[r].context||e.bySelf[r].context===t.context}).map(function(e){return[Object(x.d)(e),{context:t.context,item:e}]})))});case oe:return Re(Re({},e),{},{querying:[].concat(O()(e.querying),[t.queryId])});case ce:case se:return Re(Re({},e),{},{querying:e.querying.filter(function(e){return e!==t.queryId})});case fe:return Re(Re({},e),{},{bySelf:Re(Re({},e.bySelf),{},j()({},Object(x.d)(t.ban),{context:"edit",item:t.ban}))});case ae:return Re(Re({},e),{},{creating:[].concat(O()(e.creating),[t.ban])});case ue:case le:return Re(Re({},e),{},{creating:e.creating.filter(function(e){return e!==t.ban})});case pe:return Re(Re({},e),{},{updating:[].concat(O()(e.updating),[t.self])});case de:case be:return Re(Re({},e),{},{updating:e.updating.filter(function(e){return e!==t.self})});case he:return Re(Re({},e),{},{deleting:[].concat(O()(e.deleting),[t.self]),bySelf:Object(S.omit)(e.bySelf,[t.self])});case me:case ve:return Re(Re({},e),{},{deleting:e.deleting.filter(function(e){return e!==t.self})});default:return e}}});var Ue=g.a.mark(He);function He(){var e,t,n,r=arguments;return g.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=r.length>0&&void 0!==r[0]&&r[0],t="/ithemes-security/v1?context=help",e&&(t+="&_="+Date.now()),i.next=5,N({path:t});case 5:return n=i.sent,i.next=8,Fe(n);case 8:return i.abrupt("return",n);case 9:case"end":return i.stop()}},Ue)}function Fe(e){return{type:We,index:e}}function qe(e){return{type:$e,user:e}}function Ve(e){return{type:Qe,types:e}}function Ke(e,t){return{type:Ye,actorType:e,actors:t}}var We="RECEIVE_INDEX",$e="RECEIVE_USER",Qe="RECEIVE_ACTOR_TYPES",Ye="RECEIVE_ACTORS";function ze(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Je(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Je(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function Je(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Xe=g.a.mark(Ze);function Ze(){var e;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,N({path:"/ithemes-security/v1?context=help"});case 2:return e=t.sent,t.next=5,Fe(e);case 5:case"end":return t.stop()}},Xe)}var et={fulfill:g.a.mark(function e(t){var n;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N({path:"/wp/v2/users/".concat(t)});case 2:return n=e.sent,e.next=5,qe(n);case 5:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return!!e.users.byId[t]}},tt={fulfill:g.a.mark(function e(){var t,n,r,i,o,c;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N({path:"/ithemes-security/v1/actors?_embed=1"});case 2:t=e.sent,n=[],r=ze(t),e.prev=5,r.s();case 7:if((i=r.n()).done){e.next=15;break}return o=i.value,c=Object(S.get)(o,["_embedded","wp:items",0],[]),e.next=12,Ke(o.slug,c);case 12:n.push({slug:o.slug,label:o.label});case 13:e.next=7;break;case 15:e.next=20;break;case 17:e.prev=17,e.t0=e.catch(5),r.e(e.t0);case 20:return e.prev=20,r.f(),e.finish(20);case 23:return e.next=25,Ve(n);case 25:case"end":return e.stop()}},e,null,[[5,17,20,23]])}),isFulfilled:function(e){return e.actors.types.length>0}},nt={fulfill:g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T("ithemes-security/core","getActorTypes");case 2:case"end":return e.stop()}},e)}),isFulfilled:function(e,t){return!!e.actors.byType[t]}};function rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function it(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach(function(t){j()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ot={users:{byId:{}},index:null,actors:{types:[],byType:{}}};Object(m.registerStore)("ithemes-security/core",{controls:P,selectors:c,resolvers:a,actions:s,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ot,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case We:return it(it({},e),{},{index:t.index});case $e:return it(it({},e),{},{users:it(it({},e.users),{},{byId:it(it({},e.users.byId),{},j()({},t.user.id,t.user))})});case Qe:return it(it({},e),{},{actors:it(it({},e.actors),{},{types:t.types})});case Ye:return it(it({},e),{},{actors:it(it({},e.actors),{},{byType:it(it({},e.actors.byType),{},j()({},t.actorType,t.actors))})});default:return e}}});n("sPxh");var ct=n("lwsE"),st=n.n(ct),at=n("W8MJ"),ut=n.n(at),lt=n("PJYZ"),ft=n.n(lt),pt=n("7W2i"),dt=n.n(pt),bt=n("a1gu"),ht=n.n(bt),mt=n("Nsbk"),vt=n.n(mt),gt=n("tI+e");n("6ECA");function yt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}function Ot(e,t,n){if(e!==t)throw new TypeError("Private static access of wrong provenance");return n.get?n.get.call(e):n.value}p.Component;var Et={writable:!0,value:{}},jt=n("TSYQ"),_t=n.n(jt),wt=n("K9lf");Object(wt.compose)([Object(wt.withState)({isShowing:!1}),wt.withInstanceId])(function(e){var t,n=e.type,r=e.status,i=e.description,o=e.isShowing,c=e.setState,s=e.instanceId,a=e.children;switch(r){case"clean":t=Object(d.__)("Clean","better-wp-security");break;case"warn":t=Object(d.__)("Warn","better-wp-security");break;case"error":t=Object(d.__)("Error","better-wp-security");break;default:t=r}var u=Object(p.createElement)("span",{className:"itsec-malware-scan-".concat(r)},t);return Object(p.createElement)("div",{className:_t()("itsec-malware-scan-results-section","itsec-malware-scan-results-".concat(n,"-section"))},Object(S.isEmpty)(a)?Object(p.createElement)("p",null,u," ",i):Object(p.createElement)(p.Fragment,null,Object(p.createElement)("p",null,u,i,Object(p.createElement)(gt.Button,{isLink:!0,className:"itsec-malware-scan-toggle-details",onClick:function(){return c({isShowing:!o})},"aria-expanded":o,"aria-controls":"itsec-malware-scan-details--".concat(s)},o?Object(d.__)("Hide Details","better-wp-security"):Object(d.__)("Show Details","better-wp-security"))),Object(p.createElement)("div",{className:"itsec-malware-scan-details",id:"itsec-malware-scan-details--".concat(s),style:{display:o?"block":"none"}},a)))});var St=n("J4zp"),It=n.n(St);n("rmEH");n("A6yB");function kt(e){var t=e.id,n=e.isVisible,r=e.children;return Object(p.createElement)("div",{className:"itsec-site-scan__details",id:t,style:{display:n?"block":"none"}},Object(p.createElement)("ul",null,r))}Object(wt.compose)([Object(wt.withState)({isShowing:!1}),wt.withInstanceId])(function(e){var t,n=e.type,r=e.status,i=e.description,o=e.isShowing,c=e.setState,s=e.instanceId,a=e.children;switch(r){case"clean":t=Object(d.__)("Clean","better-wp-security");break;case"warn":t=Object(d.__)("Warn","better-wp-security");break;case"error":t=Object(d.__)("Error","better-wp-security");break;default:t=r}var u=Object(p.createElement)("span",{className:"itsec-site-scan__status itsec-site-scan__status--".concat(r)},t);return Object(p.createElement)("div",{className:_t()("itsec-site-scan-results-section","itsec-site-scan-results-".concat(n,"-section"))},Object(S.isEmpty)(a)?Object(p.createElement)("p",null,u," ",i):Object(p.createElement)(p.Fragment,null,Object(p.createElement)("p",null,u,i,Object(p.createElement)(gt.Button,{isLink:!0,className:"itsec-site-scan-toggle-details",onClick:function(){return c({isShowing:!o})},"aria-expanded":o,"aria-controls":"itsec-site-scan__details--".concat(s)},o?Object(d.__)("Hide Details","better-wp-security"):Object(d.__)("Show Details","better-wp-security"))),Object(p.createElement)(kt,{id:"itsec-site-scan__details--".concat(s),isVisible:o},a)))});n("oaS/");n("bJT+");var xt=n("QILm"),Nt=n.n(xt),Tt=n("cDcd"),Ct=n("urxu"),Rt=n.n(Ct),At=Object(Tt.lazy)(function(){return n.e(8).then(n.bind(null,"YK1D"))});function Pt(){return Object(p.createElement)("span",null,Object(d.__)("Error when loading. Please refresh.","better-wp-security"))}function Dt(e){var t=e.addErrorBoundary,n=void 0===t||t,r=Nt()(e,["addErrorBoundary"]),i=Object(p.createElement)(Tt.Suspense,{fallback:Object(p.createElement)(gt.Spinner,null)},Object(p.createElement)(At,r));return n?Object(p.createElement)(Rt.a,{FallbackComponent:Pt},i):i}function Lt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}var Gt=function(){},Bt=function(e){dt()(n,e);var t=Lt(n);function n(e){var r;return st()(this,n),(r=t.call(this,e)).state={isHovering:!1},r.onMouseEnter=r.onMouseEnter.bind(ft()(r)),r.onMouseLeave=r.onMouseLeave.bind(ft()(r)),r.onMouseOver=r.onMouseOver.bind(ft()(r)),r.onMouseOut=r.onMouseOut.bind(ft()(r)),r.setIsHovering=r.setIsHovering.bind(ft()(r)),r.unsetIsHovering=r.unsetIsHovering.bind(ft()(r)),r.componentWillUnmount=r.componentWillUnmount.bind(ft()(r)),r.timerIds=[],r}return ut()(n,[{key:"onMouseEnter",value:function(e){this.props.onMouseEnter({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"onMouseLeave",value:function(e){this.props.onMouseLeave({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"onMouseOver",value:function(e){this.props.onMouseOver({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"onMouseOut",value:function(e){this.props.onMouseOut({e:e,setIsHovering:this.setIsHovering,unsetIsHovering:this.unsetIsHovering})}},{key:"componentWillUnmount",value:function(){this.clearTimers()}},{key:"setIsHovering",value:function(){var e=this;this.clearTimers();var t=setTimeout(function(){var t={isHovering:!0};e.setState(t,function(){e.props.onHoverChanged(t)})},this.props.hoverDelayInMs);this.timerIds.push(t)}},{key:"unsetIsHovering",value:function(){var e=this;this.clearTimers();var t=setTimeout(function(){var t={isHovering:!1};e.setState(t,function(){e.props.onHoverChanged(t)})},this.props.hoverOffDelayInMs);this.timerIds.push(t)}},{key:"clearTimers",value:function(){for(var e=this.timerIds;e.length;)clearTimeout(e.pop())}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.className;return Object(p.createElement)("div",{className:n,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut},t)}}]),n}(p.Component);j()(Bt,"displayName","HoverDetector"),j()(Bt,"defaultProps",{hoverDelayInMs:0,hoverOffDelayInMs:0,onHoverChanged:Gt,onMouseEnter:function(e){return(0,e.setIsHovering)()},onMouseLeave:function(e){return(0,e.unsetIsHovering)()},onMouseOver:Gt,onMouseOut:Gt,shouldDecorateChildren:!0});n("QxRw");n("JVTk"),n("lSb6");var Mt=n("pVnL"),Ut=n.n(Mt);var Ht,Ft,qt=n("4eJC"),Vt=n.n(qt);n("Dfre");function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kt(Object(n),!0).forEach(function(t){j()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $t(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}function Qt(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yt(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Ht=Symbol.iterator;var zt=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];st()(this,e),j()(this,"tree",void 0),j()(this,"name",void 0),j()(this,"data",void 0),j()(this,"parent",void 0),j()(this,"children",void 0),this.tree=t,this.name=n,this.data=r,this.parent=i,this.children=o}return ut()(e,[{key:"getParent",value:function(){return this.parent?this.tree.nodes[this.parent]:null}},{key:"getAllParents",value:function(){for(var e=[],t=this.getParent();t;)e.push(t.name),t=t.getParent();return e}},{key:"hasChildren",value:function(){return this.children.length>0}},{key:"getAllChildren",value:function(){var e=[];if(!this.hasChildren())return e;var t,n=Qt(this);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.push.apply(e,[r.name].concat(O()(r.getAllChildren())))}}catch(e){n.e(e)}finally{n.f()}return e}},{key:Ht,value:g.a.mark(function e(){var t,n;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<this.children.length)){e.next=8;break}return n=this.children[t],e.next=5,this.tree.nodes[n];case 5:t++,e.next=1;break;case 8:case"end":return e.stop()}},e,this)})}]),e}();Ft=Symbol.iterator;var Jt=function(){function e(){st()(this,e),j()(this,"nodes",{}),j()(this,"ordered",[])}return ut()(e,[{key:"add",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this.ordered.push(e),this.nodes[e]?(this.nodes[e].data=t,this.nodes[e].parent=n):this.nodes[e]=new zt(this,e,t,n),n&&(this.nodes[n]?this.nodes[n].children.push(e):this.nodes[n]=new zt(this,n))}},{key:Ft,value:g.a.mark(function e(){var t,n;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<this.ordered.length)){e.next=9;break}if(n=this.ordered[t],this.nodes[n].parent){e.next=6;break}return e.next=6,this.nodes[n];case 6:t++,e.next=1;break;case 9:case"end":return e.stop()}},e,this)})}]),e}(),Xt=Vt()(function(e){var t,n=new Jt,r=Qt(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;n.add(i.value,i,i.parent)}}catch(e){r.e(e)}finally{r.f()}return n}),Zt=function(e){dt()(n,e);var t=$t(n);function n(){var e;return st()(this,n),e=t.apply(this,arguments),j()(ft()(e),"props",void 0),e.renderOption=e.renderOption.bind(ft()(e)),e.isChecked=e.isChecked.bind(ft()(e)),e.isIndeterminate=e.isIndeterminate.bind(ft()(e)),e.onChange=e.onChange.bind(ft()(e)),e}return ut()(n,[{key:"indeterminate",value:function(e){e.indeterminate=!0}},{key:"isChecked",value:function(e){return!!e&&(Object(S.isArray)(this.props.value)?this.props.value.includes(e.name)||this.isChecked(e.getParent()):this.props.value[e.name]||this.isChecked(e.getParent()))}},{key:"isIndeterminate",value:function(e){if(!e.hasChildren())return!1;var t,n=Qt(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(this.isChecked(r))return!0;if(this.isIndeterminate(r))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"onChange",value:function(e,t){var n,r=[e.name].concat(O()(e.getAllChildren())),i=t?[]:e.getAllParents();Object(S.isArray)(this.props.value)?(n=t?[].concat(O()(this.props.value),O()(r)):this.props.value.filter(function(e){return!r.includes(e)&&!i.includes(e)}),this.props.onChange(n)):this.props.onChange(Wt(Wt(Wt({},this.props.value),r.reduce(function(e,n){return e[n]=t},{})),i.reduce(function(e,t){return e[t]=!1},{})))}},{key:"render",value:function(){var e=this.props,t=e.label,n=e.help,r=e.options,i=Xt(r);return Object(p.createElement)("fieldset",{className:"components-base-control"},Object(p.createElement)("div",{className:"components-base-control__field"},Object(p.createElement)("legend",{className:"components-base-control__label"},t),n&&Object(p.createElement)("p",{className:"components-base-control__help"},n)),Object(p.createElement)("ul",{className:"components-hierarchical-checkbox-control__group"},Array.from(i,this.renderOption)))}},{key:"renderOption",value:function(e){var t=this,n=e.data,r=n.value,i=n.selectable,o=void 0===i||i,c=Nt()(n,["value","selectable"]),s=this.isChecked(e),a=!s&&this.isIndeterminate(e);return Object(p.createElement)("li",{key:r,className:_t()("components-hierarchical-checkbox-control__option",{"components-hierarchical-checkbox-control__option--has-children":e.hasChildren()})},Object(p.createElement)(sn,Ut()({},c,{checked:!!o&&s,disabled:!o||this.props.disabled,indeterminate:a,onChange:function(n){return t.onChange(e,n)}})),e.hasChildren()&&Object(p.createElement)("ul",{className:"components-hierarchical-checkbox-control__group"},Array.from(e,this.renderOption)))}}]),n}(p.Component);Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{notices:e("core/notices").getNotices(r)}}),Object(m.withDispatch)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{onRemove:function(t){return e("core/notices").removeNotice(t,r)}}})])(function(e){var t=e.notices,n=e.onRemove,r=Object(S.filter)(t,function(e){return e.isDismissible&&(!e.type||"default"===e.type)}),i=Object(S.filter)(t,function(e){return!(e.isDismissible||e.type&&"default"!==e.type)}),o=gt.SnackbarList?Object(S.filter)(t,{type:"snackbar"}):[];return Object(p.createElement)(p.Fragment,null,Object(p.createElement)(gt.NoticeList,{notices:i,className:"components-editor-notices__pinned"}),Object(p.createElement)(gt.NoticeList,{notices:r,className:"components-editor-notices__dismissible",onRemove:n}),gt.SnackbarList&&Object(p.createElement)(gt.SnackbarList,{notices:o,className:"components-editor-notices__snackbar",onRemove:n}))});var en=function(e){var t=e.className,n=e.status,r=e.children,i=e.onRemove,o=void 0===i?S.noop:i,c=e.isDismissible,s=void 0===c||c,a=e.actions,u=void 0===a?[]:a,l=_t()(t,"notice","notice-alt","notice-"+n,{"is-dismissible":s});return Object(p.createElement)("div",{className:l},Object(p.createElement)("p",null,r,u.map(function(e,t){var n=e.className,r=e.label,i=e.onClick,c=e.url,s=e.isLink,a=void 0!==s&&s;return Object(p.createElement)(gt.Button,{key:t,href:c,isSmall:!a&&!c,isLink:a||c,onClick:c?void 0:function(){o(),i()},className:_t()("notice__action",n)},r)})),s&&Object(p.createElement)("button",{type:"button",className:"notice-dismiss",onClick:o},Object(p.createElement)("span",{className:"screen-reader-text"},Object(d.__)("Dismiss this notice","better-wp-security"))))};n("+VN0");function tn(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,c=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){s=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(s)throw o}}}}function nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var rn=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{notices:e("core/notices").getNotices(r)}}),Object(m.withDispatch)(function(e,t){var n=t.context,r=void 0===n?"ithemes-security":n;return{onRemove:function(t){return e("core/notices").removeNotice(t,r)}}})])(function(e){var t,n,r=e.notices,i=e.onRemove,o=function(e){if(!gt.SnackbarList)return e.length;var t,n=0,r=tn(e);try{for(r.s();!(t=r.n()).done;)"snackbar"!==t.value.type&&n++}catch(e){r.e(e)}finally{r.f()}return n}(r),c=(t=o,n=Object(p.useRef)(),Object(p.useEffect)(function(){n.current=t}),n.current);Object(p.useEffect)(function(){o>c&&window.itsecSettingsPage&&window.itsecSettingsPage.scrollTop()},[o,c]);var s=gt.SnackbarList?Object(S.filter)(r,{type:"snackbar"}):[];return Object(p.createElement)(p.Fragment,null,Object(p.createElement)("div",{className:"itsec-module-settings-notice-list"},r.map(function(e){return"snackbar"===e.type&&gt.SnackbarList?null:Object(p.createElement)(en,Ut()({},Object(S.omit)(e,["content"]),{key:e.id,onRemove:(t=e.id,function(){return i(t)})}),e.content);var t})),gt.SnackbarList&&Object(p.createElement)(gt.SnackbarList,{notices:s,className:"components-editor-notices__snackbar",onRemove:i}))});n("DfSy");function on(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}var cn=function(e){dt()(n,e);var t=on(n);function n(){var e;return st()(this,n),(e=t.apply(this,arguments)).onChange=e.onChange.bind(ft()(e)),e}return ut()(n,[{key:"onChange",value:function(e){this.props.onChange&&this.props.onChange(e.target.checked)}},{key:"render",value:function(){var e,t,n=this.props,r=n.label,i=n.checked,o=n.help,c=n.instanceId,s=Nt()(n,["label","checked","help","instanceId"]),a="inspector-toggle-control-".concat(c);return o&&(e=a+"__help",t=Object(S.isFunction)(o)?o(i):o),Object(p.createElement)(gt.BaseControl,{id:a,help:t,className:"components-toggle-control"},Object(p.createElement)(gt.FormToggle,Ut()({},s,{id:a,checked:i,onChange:this.onChange,"aria-describedby":e})),Object(p.createElement)("label",{htmlFor:a,className:"components-toggle-control__label"},r))}}]),n}(p.Component);Object(wt.withInstanceId)(cn),n("IXp0");var sn=Object(wt.withInstanceId)(function(e){var t=e.label,n=e.className,r=e.heading,i=e.checked,o=e.help,c=e.instanceId,s=e.onChange,a=e.indeterminate,u=Nt()(e,["label","className","heading","checked","help","instanceId","onChange","indeterminate"]),l="inspector-checkbox-control-".concat(c);return Object(p.createElement)(gt.BaseControl,{label:r,id:l,help:o,className:n},Object(p.createElement)("span",{className:"components-checkbox-control__input-container"},Object(p.createElement)("input",Ut()({id:l,className:"components-checkbox-control__input",type:"checkbox",value:"1",onChange:function(e){return s(e.target.checked)},checked:i,"aria-describedby":o?l+"__help":void 0,ref:function(e){e&&(e.indeterminate=a)}},u)),i?Object(p.createElement)(gt.Dashicon,{icon:"yes",className:"components-checkbox-control__checked",role:"presentation"}):null,a?Object(p.createElement)(gt.Dashicon,{icon:"minus",className:"components-checkbox-control__checked components-checkbox-control__checked--indeterminate",role:"presentation"}):null),Object(p.createElement)("label",{className:"components-checkbox-control__label",htmlFor:l},t))});function an(e){var t=e.tabId,n=e.onClick,r=e.children,i=e.selected,o=Nt()(e,["tabId","onClick","children","selected"]);return Object(p.createElement)(gt.Button,Ut()({role:"tab",tabIndex:i?null:-1,"aria-selected":i,id:t,onClick:n},o),r)}function un(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}var ln=function(e){dt()(n,e);var t=un(n);function n(){var e;return st()(this,n),(e=t.apply(this,arguments)).handleClick=e.handleClick.bind(ft()(e)),e.onNavigate=e.onNavigate.bind(ft()(e)),e.onKeyDown=e.onKeyDown.bind(ft()(e)),e}return ut()(n,[{key:"handleClick",value:function(e){var t=this.props.onSelect;(void 0===t?S.noop:t)(e)}},{key:"onNavigate",value:function(e,t){var n=this.event;n&&"tab"===n.target.getAttribute("role")&&n.preventDefault(),t.click()}},{key:"onKeyDown",value:function(e){this.event=e}},{key:"render",value:function(){var e=this,t=this.props,n=t.activeClass,r=void 0===n?"is-active":n,i=t.className,o=t.instanceId,c=t.orientation,s=void 0===c?"horizontal":c,a=t.tabs,u=t.selected,l=Object(S.find)(a,{name:u})||a[0],f=o+"-"+l.name;return Object(p.createElement)("div",{className:i},Object(p.createElement)(gt.NavigableMenu,{role:"tablist",orientation:s,onNavigate:this.onNavigate,onKeyDown:this.onKeyDown,className:"components-tab-panel__tabs"},a.map(function(t){return Object(p.createElement)(an,{className:_t()(t.className,j()({},r,t.name===l.name)),tabId:o+"-"+t.name,"aria-controls":o+"-"+t.name+"-view",selected:t.name===l.name,key:t.name,onClick:Object(S.partial)(e.handleClick,t.name)},t.title)})),l&&Object(p.createElement)("div",{"aria-labelledby":f,role:"tabpanel",id:f+"-view",className:"components-tab-panel__tab-content",tabIndex:"0"},this.props.children(l)))}}]),n}(p.Component),fn=Object(wt.withInstanceId)(ln),pn=n("rl8x"),dn=n.n(pn);function bn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}Object(wt.createHigherOrderComponent)(function(e){var t,n;return n=t=function(t){dt()(r,t);var n=bn(r);function r(){var e;st()(this,r);for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return e=n.call.apply(n,[this].concat(i)),j()(ft()(e),"state",{width:1280}),j()(ft()(e),"mounted",!1),j()(ft()(e),"ref",null),j()(ft()(e),"onWindowResize",function(){if(e.mounted){var t=Object(p.findDOMNode)(ft()(e));if(t instanceof window.HTMLElement){var n=t.offsetWidth;e.setState({width:n})}}}),e}return ut()(r,[{key:"componentDidMount",value:function(){this.mounted=!0,window.addEventListener("resize",this.onWindowResize),document.getElementById("collapse-button").addEventListener("click",this.onWindowResize),this.onWindowResize()}},{key:"componentWillUnmount",value:function(){this.mounted=!1,window.removeEventListener("resize",this.onWindowResize),document.getElementById("collapse-button").removeEventListener("click",this.onWindowResize)}},{key:"render",value:function(){var t=this.props,n=t.measureBeforeMount,r=Nt()(t,["measureBeforeMount"]);return n&&!this.mounted?Object(p.createElement)("div",{className:this.props.className,style:this.props.style}):Object(p.createElement)(e,Ut()({},r,{width:this.state.width+20}))}}]),r}(p.Component),j()(t,"defaultProps",{measureBeforeMount:!1}),n},"withWidth");function hn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}var mn=Object(wt.createHigherOrderComponent)(function(e){return function(t){dt()(r,t);var n=hn(r);function r(){var e;return st()(this,r),e=n.apply(this,arguments),j()(ft()(e),"state",{pressed:{shift:!1,ctrl:!1,meta:!1,alt:!1}}),j()(ft()(e),"mounted",!1),e.listener=e.listener.bind(ft()(e)),e.onBlur=e.onBlur.bind(ft()(e)),e}return ut()(r,[{key:"componentDidMount",value:function(){this.mounted=!0,window.addEventListener("keydown",this.listener),window.addEventListener("keyup",this.listener),window.addEventListener("click",this.listener),window.addEventListener("blur",this.onBlur)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,window.removeEventListener("keydown",this.listener),window.removeEventListener("keyup",this.listener),window.removeEventListener("click",this.listener),window.removeEventListener("blur",this.onBlur)}},{key:"listener",value:function(e){this.mounted&&this.setState({pressed:{shift:e.shiftKey,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey}})}},{key:"onBlur",value:function(){this.setState({pressed:{shift:!1,ctrl:!1,meta:!1,alt:!1}})}},{key:"render",value:function(){return Object(p.createElement)(e,Ut()({pressedModifierKeys:this.state.pressed},this.props))}}]),r}(p.Component)},"withPressedModifierKeys");function vn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}var gn=function(e){dt()(n,e);var t=vn(n);function n(){var e;return st()(this,n),(e=t.apply(this,arguments)).handleClick=e.handleClick.bind(ft()(e)),e.onNavigate=e.onNavigate.bind(ft()(e)),e.onKeyDown=e.onKeyDown.bind(ft()(e)),e.toggleTab=e.toggleTab.bind(ft()(e)),e.getSelectedTabs=e.getSelectedTabs.bind(ft()(e)),e.isSelected=e.isSelected.bind(ft()(e)),e.getSelectedId=e.getSelectedId.bind(ft()(e)),e.getLabelledBy=e.getLabelledBy.bind(ft()(e)),e.getTabId=e.getTabId.bind(ft()(e)),e.getTabPanelId=e.getTabPanelId.bind(ft()(e)),e.isTabDisabled=e.isTabDisabled.bind(ft()(e)),e.isNonMultiSelectableTabSelected=e.isNonMultiSelectableTabSelected.bind(ft()(e)),e}return ut()(n,[{key:"handleClick",value:function(e,t){t.metaKey||t.ctrlKey?this.toggleTab(e):this.props.onSelect([e])}},{key:"onNavigate",value:function(e,t){var n=this.event;if(n){if("tab"===n.target.getAttribute("role")&&n.preventDefault(),n.ctrlKey)return;if(n.shiftKey){if(this.isTabDisabled(this.props.tabs[e]))return;var r=this.props.tabs[e].name;return void this.toggleTab(r)}}t.click()}},{key:"onKeyDown",value:function(e){if(!e.nativeEvent&&(this.event=e,e.ctrlKey&&("Space"===e.code||32===e.keyCode))){e.preventDefault();var t=e.target.dataset.tabname;t&&this.toggleTab(t)}}},{key:"toggleTab",value:function(e){var t=Object(S.find)(this.props.tabs,{name:e});t&&!1===t.allowMultiple||(this.props.selected.includes(e)?this.props.onSelect(this.props.selected.filter(function(t){return t!==e})):this.props.onSelect([].concat(O()(this.props.selected),[e])))}},{key:"getSelectedTabs",value:function(){var e=this,t=this.props.selected;!t.length&&this.props.initialTab&&t.push(this.props.initialTab);var n=[];return this.props.tabs.forEach(function(t){e.props.selected.includes(t.name)&&n.push(t)}),n}},{key:"isSelected",value:function(e,t){return e.some(function(e){return e.name===t.name})}},{key:"isTabDisabled",value:function(e){var t=this.props.pressedModifierKeys;if(this.props.selected.includes(e.name))return!1;if(!1!==e.allowMultiple&&!this.isNonMultiSelectableTabSelected())return!1;if(t.meta||t.ctrl)return!0;if(t.shift){var n=document.activeElement;if(n.parentElement&&n.parentElement.id==="components-tab-panel__tabs-".concat(this.props.instanceId))return!0}return!1}},{key:"isNonMultiSelectableTabSelected",value:function(){if(1!==this.props.selected.length)return!1;var e=Object(S.find)(this.props.tabs,{name:this.props.selected[0]});return e&&!1===e.allowMultiple}},{key:"getSelectedId",value:function(e){return 1===e.length?this.getTabPanelId(e[0].name):"components-tab-panel__panel-".concat(this.props.instanceId,"-").concat(Object(S.map)(e,"name").join("-"))}},{key:"getLabelledBy",value:function(e){var t=this;return e.map(function(e){return t.getTabId(e.name)}).join(",")}},{key:"getTabId",value:function(e){return"components-tab-panel__tab-".concat(this.props.instanceId,"-").concat(e)}},{key:"getTabPanelId",value:function(e){return"components-tab-panel__panel-".concat(this.props.instanceId,"-").concat(e)}},{key:"componentDidUpdate",value:function(e){if(1===this.props.selected.length&&dn()(this.props.selected,e.selected)){var t=this.props.selected[0];if(!Object(S.find)(this.props.tabs,{name:t})){var n=Object(S.findIndex)(e.tabs,{name:t});if(-1!==n){var r=Math.max(n-1,0),i=this.props.tabs[r];i&&this.props.onSelect([i.name])}}}}},{key:"render",value:function(){var e=this,t=this.props,n=t.tabs,r=t.className,i=t.activeClass,o=void 0===i?"is-active":i,c=t.orientation,s=void 0===c?"horizontal":c,a=this.getSelectedTabs(),u=this.getSelectedId(a);return Object(p.createElement)("div",{className:r},Object(p.createElement)(gt.NavigableMenu,{role:"tablist","aria-multiselectable":!0,orientation:s,onNavigate:this.onNavigate,onKeyDown:this.onKeyDown,className:"components-tab-panel__tabs",id:"components-tab-panel__tabs-".concat(this.props.instanceId)},n.map(function(t){var n=e.isSelected(a,t),r=n&&a.length>1?u:e.getTabPanelId(t.name);return Object(p.createElement)(an,{className:_t()(t.className,j()({},o,n)),tabId:e.getTabId(t.name),"aria-controls":r,selected:n,disabled:e.isTabDisabled(t),key:t.name,onClick:Object(S.partial)(e.handleClick,t.name),"data-tabname":t.name},t.title)})),a.length>0&&Object(p.createElement)("div",{"aria-labelledby":this.getLabelledBy(a),role:"tabpanel",id:u,className:"components-tab-panel__tab-content",tabIndex:"0"},this.props.children(a)))}}]),n}(p.Component),yn=Object(wt.compose)([wt.withInstanceId,mn])(gn);function On(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=vt()(e);if(t){var i=vt()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ht()(this,n)}}var En=function(e){dt()(n,e);var t=On(n);function n(){var e;return st()(this,n),e=t.apply(this,arguments),j()(ft()(e),"onSelect",function(t){e.setState({selected:t})}),e.state={selected:e.props.initialTab||""},e}return ut()(n,[{key:"render",value:function(){return Object(p.createElement)(fn,Ut()({},this.props,{selected:this.state.selected,onSelect:this.onSelect}))}}]),n}(p.Component);function jn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jn(Object(n),!0).forEach(function(t){j()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wn(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return{type:"SELECT",storeKey:e,selectorName:t,args:r}}function Sn(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return{type:"DISPATCH",storeKey:e,actionName:t,args:r}}function In(){return{type:"CREATE_NOTICE",status:arguments.length>0&&void 0!==arguments[0]?arguments[0]:"info",content:arguments.length>1?arguments[1]:void 0,options:_n({context:"ithemes-security"},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}}var kn={API_FETCH:function(e){var t=e.request;return k()(t).catch(x.f)},SELECT:function(e){var t,n=e.storeKey,r=e.selectorName,i=e.args;return(t=Object(m.select)(n))[r].apply(t,O()(i))},DISPATCH:function(e){var t,n=e.storeKey,r=e.actionName,i=e.args;return(t=Object(m.dispatch)(n))[r].apply(t,O()(i))},CREATE_NOTICE:function(e){var t=e.status,n=e.content,r=e.options;r.autoDismiss&&(r.id=r.id||Object(S.uniqueId)("itsec-auto-dismiss-"),setTimeout(function(){return Object(m.dispatch)("core/notices").removeNotice(r.id,r.context)},r.autoDismiss)),Object(m.dispatch)("core/notices").createNotice(t,n,r)}};function xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xn(Object(n),!0).forEach(function(t){j()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Tn=g.a.mark(Ln),Cn=g.a.mark(Bn),Rn=g.a.mark(Un),An=g.a.mark(Vn);function Pn(e){return{type:Kn,ids:e}}function Dn(e,t){return{type:Wn,id:e,edit:t}}function Ln(e){var t,n;return g.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,wn("ithemes-security/user-groups-editor","getEditedGroup",e);case 2:if(t=r.sent){r.next=5;break}return r.abrupt("return");case 5:return r.next=7,{type:Qn,id:e};case 7:return r.next=9,Sn("ithemes-security/user-groups","updateGroup",e,t);case 9:if(!((n=r.sent)instanceof Error)){r.next=17;break}return r.next=13,In("error",n.message);case 13:return r.next=15,{type:zn,id:e,error:n};case 15:r.next=21;break;case 17:return r.next=19,{type:Yn,id:e,updated:n};case 19:return r.next=21,In("success",Object(d.__)("Updated group.","better-wp-security"),{type:"snackbar"});case 21:return r.abrupt("return",n);case 22:case"end":return r.stop()}},Tn)}function Gn(e){return{type:$n,id:e}}function Bn(){var e,t,n,r=arguments;return g.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:{},i.next=3,wn("ithemes-security/user-groups-editor","getEditedGroup","new");case 3:if(t=i.sent){i.next=6;break}return i.abrupt("return");case 6:return i.next=8,{type:Jn};case 8:return i.next=10,Sn("ithemes-security/user-groups","createGroup",Nn(Nn({},t),e));case 10:if(!((n=i.sent)instanceof Error)){i.next=23;break}if("rest_duplicate_user_group"!==n.code){i.next=17;break}return i.next=15,In("error",n.message,{actions:[{label:Object(d.__)("View Duplicate","better-wp-security"),isLink:!0,onClick:function(){var e=Object(S.get)(n,["_links","duplicate",0,"href"]).split("/").pop();Object(m.dispatch)("ithemes-security/user-groups-editor").selectGroup([e])}},{label:Object(d.__)("Create Anyway","better-wp-security"),onClick:function(){Object(m.dispatch)("ithemes-security/user-groups-editor").createGroup({ignore_duplicate:!0})}}]});case 15:i.next=19;break;case 17:return i.next=19,In("error",n.message);case 19:return i.next=21,{type:Zn,error:n};case 21:i.next=31;break;case 23:return i.next=25,Gn("new");case 25:return i.next=27,{type:Xn,created:n};case 27:return i.next=29,Sn("ithemes-security/user-groups-editor","selectGroup",n.id);case 29:return i.next=31,In("success",Object(d.__)("Created group.","better-wp-security"),{type:"snackbar"});case 31:return i.abrupt("return",n);case 32:case"end":return i.stop()}},Cn)}function Mn(e,t,n,r){return{type:er,id:e,module:t,setting:n,value:r}}function Un(e){var t,n;return g.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,wn("ithemes-security/user-groups-editor","getEditedGroupSettings",e);case 2:if(t=r.sent){r.next=5;break}return r.abrupt("return");case 5:return r.next=7,{type:tr,id:e};case 7:return r.next=9,Sn("ithemes-security/user-groups","updateGroupSettings",e,t);case 9:if(!((n=r.sent)instanceof Error)){r.next=17;break}return r.next=13,In("error",n.message);case 13:return r.next=15,{type:rr,id:e,error:n};case 15:r.next=21;break;case 17:return r.next=19,{type:nr,id:e,updated:n};case 19:return r.next=21,In("success",Object(d.__)("Updated group settings.","better-wp-security"),{type:"snackbar"});case 21:return r.abrupt("return",n);case 22:case"end":return r.stop()}},Rn)}function Hn(e,t,n){return{type:ir,module:e,setting:t,value:n}}function Fn(e,t){return{type:or,module:e,setting:t}}function qn(){return{type:cr}}function Vn(e){var t,n,r,i;return g.a.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,wn("ithemes-security/user-groups-editor","getBulkSettingEdits");case 2:return t=o.sent,o.next=5,Sn("ithemes-security/user-groups","patchBulkGroupSettings",e,t);case 5:if(!((n=o.sent)instanceof Error)){o.next=11;break}return o.next=9,In("error",n.message);case 9:o.next=25;break;case 11:if(!Object(S.map)(n,"status").every(function(e){return 200===e})){o.next=16;break}return o.next=14,In("success",Object(d.__)("Updated group settings.","better-wp-security"),{type:"snackbar"});case 14:o.next=25;break;case 16:if(r=n.filter(function(e){return 200!==e.status}).map(function(e){var t=e.error;return Object(x.b)(t)}),i=r.map(function(e){return e.getAllErrorMessages().join(" ")}).join(" "),r.length!==n.length){o.next=23;break}return o.next=21,In("error",i);case 21:o.next=25;break;case 23:return o.next=25,In("warning",Object(d.sprintf)(Object(d._n)("%1$d group was not updated: %2$s","%1$d groups were not updated: %2$s",r.length,"better-wp-security"),r.length,i));case 25:return o.next=27,qn();case 27:return o.abrupt("return",n);case 28:case"end":return o.stop()}},An)}var Kn="SELECT_GROUP",Wn="EDIT_GROUP",$n="RESET_EDITS",Qn="START_SAVE_GROUP",Yn="FINISH_SAVE_GROUP",zn="FAILED_SAVE_GROUP",Jn="START_CREATE_GROUP",Xn="FINISH_CREATE_GROUP",Zn="FAILED_CREATE_GROUP",er="EDIT_GROUP_SETTING",tr="START_SAVE_GROUP_SETTINGS",nr="FINISH_SAVE_GROUP_SETTINGS",rr="FAILED_SAVE_GROUP_SETTINGS",ir="BULK_EDIT_GROUP_SETTING",or="RESET_BULK_GROUP_SETTING_EDIT",cr="RESET_BULK_GROUP_SETTING_EDITS";function sr(e){return e.selectedGroup}function ar(e){return e.creating}function ur(e,t){return e.edits[t]}function lr(e,t,n){var r=Object(S.get)(e,["edits",t,n]);return void 0!==r?r:"new"!==t?Object(m.select)("ithemes-security/user-groups").getGroupAttribute(t,n):void 0}function fr(e,t){return!!e.edits[t]}function pr(e,t){return!!e.settingEdits[t]}function dr(e,t){return e.settingEdits[t]}function br(e,t,n,r){var i=Object(S.get)(e,["settingEdits",t,n,r]);return void 0!==i?i:Object(m.select)("ithemes-security/user-groups").getGroupSetting(t,n,r)}function hr(e){return!Object(S.isEmpty)(e.bulkSettingEdits)}function mr(e){return e.bulkSettingEdits}function vr(e,t,n){return Object(S.get)(e,["bulkSettingEdits",t,n])}function gr(e,t,n,r){var i=vr(e,n,r);if(void 0!==i)return i;var o=function(e){return Object(m.select)("ithemes-security/user-groups").getGroupSetting(e,n,r)},c=o(t[0]);return t.every(function(e){return o(e)===c})?c:null}function yr(e,t){var n=mr(e);return Object(m.select)("ithemes-security/user-groups").isBulkPatchingSettings(t,n)}function Or(){return Object(m.select)("ithemes-security/user-groups").getGroups("available")}var Er=g.a.mark(jr);function jr(){var e;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Sn("ithemes-security/user-groups","query","available",{_embed:1});case 2:if(!((e=t.sent).length>0)){t.next=6;break}return t.next=6,Sn("ithemes-security/user-groups-editor","selectGroup",[e[0].id]);case 6:return t.abrupt("return",e);case 7:case"end":return t.stop()}},Er)}function _r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_r(Object(n),!0).forEach(function(t){j()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Sr={edits:{},settingEdits:{},bulkSettingEdits:{},creating:!1,selectedGroup:[]};Object(m.registerStore)("ithemes-security/user-groups-editor",{controls:kn,actions:u,selectors:l,resolvers:f,reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Sr,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case Kn:return wr(wr({},e),{},{selectedGroup:t.ids});case Wn:return wr(wr({},e),{},{edits:wr(wr({},e.edits),{},j()({},t.id,wr(wr({},e.edits[t.id]||{}),t.edit)))});case Yn:return wr(wr({},e),{},{edits:Object(S.omit)(e.edits,[t.id])});case er:return wr(wr({},e),{},{settingEdits:wr(wr({},e.settingEdits),{},j()({},t.id,wr(wr({},Object(S.get)(e,["settingEdits",t.id],{})),{},j()({},t.module,wr(wr({},Object(S.get)(e,["settingEdits",t.id,t.module],{})),{},j()({},t.setting,t.value))))))});case nr:return wr(wr({},e),{},{settingEdits:Object(S.omit)(e.settingEdits,[t.id])});case Jn:return wr(wr({},e),{},{creating:!0});case Zn:case Xn:return wr(wr({},e),{},{creating:!1});case $n:return wr(wr({},e),{},{edits:Object(S.omit)(e.edits,[t.id])});case ir:return wr(wr({},e),{},{bulkSettingEdits:wr(wr({},e.bulkSettingEdits),{},j()({},t.module,wr(wr({},e.bulkSettingEdits[t.module]||{}),{},j()({},t.setting,t.value))))});case or:return wr(wr({},e),{},{bulkSettingEdits:Object(S.omit)(e.bulkSettingEdits,"".concat(t.module,".").concat(t.setting))});case cr:return wr(wr({},e),{},{bulkSettingEdits:{}});default:return e}}});function Ir(){return Object(p.createElement)("div",null,Object(p.createElement)(xr,null))}n("GjY+");var kr=Vt()(function(e){return e.sort(function(e,t){return e.type===t.type?0:"user-group"===e.type?-1:"user-group"===t.type?1:0}).map(function(e){return{name:e.id,title:e.label,className:"itsec-user-groups-list__item",group:e}}).concat({name:"new",title:Object(p.createElement)(p.Fragment,null,Object(p.createElement)(gt.Icon,{icon:"plus"}),Object(d.__)("New Group","better-wp-security")),className:"itsec-user-groups-list__item itsec-user-groups-list__item--new",allowMultiple:!1})});var xr=Object(wt.compose)([Object(m.withSelect)(function(e){return{matchables:e("ithemes-security/user-groups").getMatchables(),resolvingMatchables:e("core/data").isResolving("ithemes-security/user-groups","getMatchables"),selectedGroup:e("ithemes-security/user-groups-editor").getSelectedGroup()}}),Object(m.withDispatch)(function(e){return{selectGroup:e("ithemes-security/user-groups-editor").selectGroup}})])(function(e){var t=e.matchables,n=e.resolvingMatchables,r=e.selectedGroup,i=e.selectGroup;if(Object(p.useEffect)(function(){!n&&t.length&&0===r.length&&i([t[0].id])},[n]),n&&!t.length)return null;var o=kr(t);return Object(p.createElement)(yn,{tabs:o,selected:r,onSelect:i,allowMultiple:!0,orientation:"vertical",className:"itsec-user-groups-list"},function(e){if(e.length>1){var t=Object(S.filter)(e.map(function(e){var t=e.group;return t&&t.id}));return Object(p.createElement)(Rr,{groupIds:t})}return e[0]?Object(p.createElement)(Tr,{groupId:e[0].name,isNew:"new"===e[0].name}):null})}),Nr=(n("Y0od"),Vt()(function(e,t){if("new"===e)return[{name:"create",title:Object(d.__)("Edit Group","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:Dr}];var n=[{name:"settings",title:Object(d.__)("Features","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:Br}];return"user-group"===t&&n.push({name:"edit",title:Object(d.__)("Edit Group","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:Lr}),n}));var Tr=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId;return{type:e("ithemes-security/user-groups").getMatchableType(n)}})])(function(e){var t=e.groupId,n=e.type,r=e.isNew;return Object(p.createElement)("div",{className:"itsec-manage-user-group"},r?Object(p.createElement)($r,null):Object(p.createElement)(Wr,{groupId:t}),Object(p.createElement)(En,{tabs:Nr(t,n),className:"itsec-manage-user-group-tabs"},function(e){var n=e.Component;return Object(p.createElement)(n,{groupId:t})}))}),Cr=Vt()(function(){return[{name:"settings",title:Object(d.__)("Features","better-wp-security"),className:"itsec-manage-user-group-tabs__tab",Component:Ur}]});var Rr=function(e){var t=e.groupIds;return Object(p.createElement)("div",{className:"itsec-manage-multiple-user-groups"},Object(p.createElement)(Qr,{groupIds:t}),Object(p.createElement)(En,{tabs:Cr(),className:"itsec-manage-user-group-tabs"},function(e){var n=e.Component;return Object(p.createElement)(n,{groupIds:t})}))};n("QmYb");var Ar=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId;return{label:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"label")||""}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{edit:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}})])(function(e){var t=e.label,n=e.edit,r=e.disabled,i=void 0!==r&&r;return Object(p.createElement)(gt.TextControl,{label:Object(d.__)("Group Name","better-wp-security"),value:t,maxLength:50,disabled:i,onChange:function(e){return n({label:e})}})});n("ZRc3");function Pr(e){var t,n=e.name,r=e.isLoading,i=e.children,o=_t()("itsec-user-groups-group-tab",(t={},j()(t,"itsec-user-groups-group-tab--".concat(n),n),j()(t,"itsec-user-groups-group-tab--is-loading",r),t));return Object(p.createElement)("div",{className:o},i)}Pr.Row=function(e){var t=e.name,n=e.children;return Object(p.createElement)("div",{className:"itsec-user-groups-group-tab__row itsec-user-groups-group-tab__row--".concat(t)},n)};var Dr=Object(wt.compose)([Object(m.withSelect)(function(e){return{hasEdits:e("ithemes-security/user-groups-editor").hasEdits("new"),isSaving:e("ithemes-security/user-groups-editor").isCreating("new")}}),Object(m.withDispatch)(function(e){return{save:function(){e("ithemes-security/user-groups-editor").createGroup()}}})])(function(e){var t=e.hasEdits,n=e.save,r=e.isSaving;return Object(p.createElement)(Pr,{name:"create-group"},Object(p.createElement)(zr,{groupId:"new"}),Object(p.createElement)(Pr.Row,{name:"save"},Object(p.createElement)(gt.Button,{disabled:!t,isPrimary:!0,onClick:n,isBusy:r},Object(d.__)("Create","better-wp-security"))))});var Lr=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId;return{isLoading:e("core/data").isResolving("ithemes-security/user-groups","getGroup",[n])||e("core/data").isResolving("ithemes-security/core","getIndex"),hasEdits:e("ithemes-security/user-groups-editor").hasEdits(n),isSaving:e("ithemes-security/user-groups").isUpdating(n)}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{save:function(){return e("ithemes-security/user-groups-editor").saveGroup(n)}}})])(function(e){var t=e.groupId,n=e.hasEdits,r=e.save,i=e.isSaving,o=e.isLoading;return Object(p.createElement)(Pr,{name:"edit-group",isLoading:o},Object(p.createElement)(zr,{groupId:t,disabled:o}),Object(p.createElement)(Pr.Row,{name:"save"},Object(p.createElement)(gt.Button,{disabled:!n,isPrimary:!0,onClick:r,isBusy:i},Object(d.__)("Save","better-wp-security"))))});var Gr=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId,r=t.module,i=t.setting;return{value:e("ithemes-security/user-groups-editor").getEditedGroupSetting(n,r,i)}}),Object(m.withDispatch)(function(e,t){var n=t.groupId,r=t.module,i=t.setting;return{edit:function(t){return e("ithemes-security/user-groups-editor").editGroupSetting(n,r,i,t)}}})])(function(e){var t=e.schema,n=e.value,r=e.edit,i=e.disabled,o=void 0!==i&&i;return Object(p.createElement)(gt.ToggleControl,{checked:!0===n,label:t.title,help:t.description,disabled:o,onChange:function(e){return r(e)}})});n("GrEf");var Br=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId;return{groupSettings:e("ithemes-security/user-groups").getGroupSettings(n),isLoading:e("core/data").isResolving("ithemes-security/user-groups","getGroupSettings",[n]),schema:e("ithemes-security/core").getSchema("ithemes-security-user-group-settings"),hasEdits:e("ithemes-security/user-groups-editor").settingHasEdits(n),isSaving:e("ithemes-security/user-groups").isUpdatingSettings(n)}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{save:function(){return e("ithemes-security/user-groups-editor").saveGroupSettings(n)}}})])(function(e){var t=e.schema,n=e.groupId,r=e.hasEdits,i=e.save,o=e.isSaving,c=e.isLoading;return t?Object(p.createElement)(Pr,{name:"settings",isLoading:c},Object(p.createElement)(Pr.Row,null,Object(p.createElement)(Jr,{schema:t,settingComponent:Gr,groupId:n,disabled:c})),Object(p.createElement)(Pr.Row,{name:"save"},Object(p.createElement)(gt.Button,{disabled:!r,isPrimary:!0,onClick:i,isBusy:o},Object(d.__)("Save","better-wp-security")))):null});var Mr=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.module,r=t.setting,i=t.groupIds;return{value:e("ithemes-security/user-groups-editor").getBulkSettingValue(i,n,r)}}),Object(m.withDispatch)(function(e,t){var n=t.module,r=t.setting;return{edit:function(t){return e("ithemes-security/user-groups-editor").bulkEditGroupSetting(n,r,t)}}})])(function(e){var t=e.schema,n=e.value,r=e.edit,i=e.disabled,o=void 0!==i&&i;return Object(p.createElement)(sn,{checked:!0===n,indeterminate:null==n,label:t.title,help:t.description,disabled:o,onChange:function(e){return r(e)}})});var Ur=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupIds;return{schema:e("ithemes-security/core").getSchema("ithemes-security-user-group-settings"),hasEdits:e("ithemes-security/user-groups-editor").hasBulkSettingEdits(),isSaving:e("ithemes-security/user-groups-editor").isSavingBulkEdits(n)}}),Object(m.withDispatch)(function(e,t){var n=t.groupIds;return{save:function(){return e("ithemes-security/user-groups-editor").saveBulkEdits(n)}}})])(function(e){var t=e.schema,n=e.hasEdits,r=e.save,i=e.isSaving,o=e.groupIds;return t?Object(p.createElement)(Pr,{name:"settings"},Object(p.createElement)(Pr.Row,null,Object(p.createElement)(Jr,{schema:t,settingComponent:Mr,groupIds:o})),Object(p.createElement)(Pr.Row,{name:"save"},Object(p.createElement)(gt.Button,{disabled:!n,isPrimary:!0,onClick:r,isBusy:i},Object(d.__)("Save","better-wp-security")))):null});Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId;return{minRole:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"min_role")}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{onChange:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}})])(function(e){var t=e.minRole,n=e.onChange;return Object(p.createElement)("div",null,Object(p.createElement)(gt.SelectControl,{options:[{value:"administrator",label:Object(d._x)("Administrator","User role","default")},{value:"editor",label:Object(d._x)("Editor","User role","default")},{value:"author",label:Object(d._x)("Author","User role","default")},{value:"contributor",label:Object(d._x)("Contributor","User role","default")},{value:"subscriber",label:Object(d._x)("Subscriber","User role","default")}],label:Object(d.__)("Minimum Role","better-wp-security"),value:t,onChange:function(e){return n({min_role:e})},help:Object(d.__)("Add users with the selected minimum role to this group. To edit roles, go to Users in your WordPress Dashboard.","better-wp-security")}))});var Hr=Vt()(function(e,t){var n=[{value:"$administrator$",label:Object(d.__)("Administrator Capabilities","better-wp-security")},{value:"$editor$",label:Object(d.__)("Editor Capabilities","better-wp-security")},{value:"$author$",label:Object(d.__)("Author Capabilities","better-wp-security")},{value:"$contributor$",label:Object(d.__)("Contributor Capabilities","better-wp-security")},{value:"$subscriber$",label:Object(d.__)("Subscriber Capabilities","better-wp-security")}];for(var r in t&&n.unshift({value:"$super-admin$",label:Object(d.__)("Super Admin","better-wp-security")}),Object(S.some)(e,function(e){return""===e.canonical})&&n.push({value:"$other$",label:Object(d.__)("Other","better-wp-security"),selectable:!1}),e)if(e.hasOwnProperty(r)){var i=e[r],o=i.canonical,c=i.label;n.push({value:r,parent:o.length>0?"$".concat(o,"$"):"$other$",label:c})}return Object.values(n)});var Fr=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n=t.groupId;return{roles:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"roles")||[],canonical:e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"canonical")||[],available:e("ithemes-security/core").getRoles(),schema:e("ithemes-security/core").getSchema("ithemes-security-user-group")}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{onChange:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}})])(function(e){var t=e.canonical,n=e.roles,r=e.onChange,i=e.available,o=e.schema,c=e.disabled,s=void 0!==c&&c,a=Object(S.get)(o,["properties","canonical","items","enum"],[]).includes("super-admin"),u=[].concat(O()(n),O()(t.map(function(e){return"$".concat(e,"$")})));return Object(p.createElement)(Zt,{label:Object(d.__)("Select Roles","better-wp-security"),help:Object(d.__)("Add users with the selected roles to this group.","better-wp-security"),value:u,disabled:s,options:Hr(i,a),onChange:function(e){var t=Object(x.a)(e,function(e){return e.startsWith("$")&&e.endsWith("$")}),n=It()(t,2),i=n[0],o=n[1];r({roles:o,canonical:Object(S.without)(i.map(function(e){return e.slice(1,-1)}),"other")})}})});n("ELjz");function qr(e){return{value:e.id,label:e.name,user:e}}var Vr=function(e){return new Promise(function(t,n){k()({path:Object(D.addQueryArgs)("/wp/v2/users",{search:e,per_page:100,context:"embed",itsec_global:!0})}).then(function(e){return e.forEach(Object(m.dispatch)("ithemes-security/core").receiveUser),e}).then(function(e){return t(e.map(qr))}).catch(n)})};var Kr=Object(wt.compose)([Object(wt.withState)({selectSearch:""}),Object(m.withSelect)(function(e,t){var n=t.groupId,r=e("ithemes-security/user-groups-editor").getEditedGroupAttribute(n,"users")||[],i=[],o=!1;return r.forEach(function(t){var n=e("ithemes-security/core").getUser(t);n?i.push(n):e("core/data").isResolving("ithemes-security/core","getUser",[t])&&(o=!0)}),{users:i,userIds:r,loading:o}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{receiveUser:e("ithemes-security/core").receiveUser,onChange:function(t){return e("ithemes-security/user-groups-editor").editGroup(n,t)}}}),wt.withInstanceId])(function(e){var t=e.instanceId,n=e.users,r=e.loading,i=e.onChange,o=e.disabled,c=void 0!==o&&o,s=e.selectSearch,a=e.setState,u="itsec-user-group-panel-users__select-".concat(t),l=r?[]:n.map(qr);return Object(p.createElement)(gt.BaseControl,{className:"itsec-user-group-panel-users__select-control",label:Object(d.__)("Select Users","better-wp-security"),help:Object(d.__)("Select specific users to add to this group.","better-wp-security"),id:u},Object(p.createElement)(Dt,{classNamePrefix:"components-itsec-async-select-control",inputId:u,isDisabled:c||r,isLoading:r,isMulti:!0,cacheOptions:!0,defaultOptions:!0,loadOptions:Vr,value:l,onChange:function(e){return i({users:Object(S.map)(e,"value")})},inputValue:s,onInputChange:function(e){return a({selectSearch:e})}}))});n("mzAq");var Wr=Object(wt.compose)([Object(m.withSelect)(function(e,t){var n,r=t.groupId,i=e("ithemes-security/user-groups").getMatchableType(r),o="user-group"===i&&e("ithemes-security/user-groups").isDeleting(r);return"user-group"===i&&(n=e("ithemes-security/user-groups-editor").getEditedGroupAttribute(r,"label")),void 0===n&&(n=e("ithemes-security/user-groups").getMatchableLabel(r)),{type:i,label:n,isDeleting:o}}),Object(m.withDispatch)(function(e,t){var n=t.groupId;return{deleteGroup:function(){return e("ithemes-security/user-groups").deleteGroup(n)}}})])(function(e){var t=e.type,n=e.label,r=e.isDeleting,i=e.deleteGroup,o="user-group"===t;return n&&n.length||(n=Object(d.__)("Untitled","better-wp-security")),Object(p.createElement)(Yr,{label:n},o&&Object(p.createElement)(gt.Button,{onClick:i,isBusy:r,isLink:!0,isDestructive:!0},Object(d.__)("Delete Group","better-wp-security")))});var $r=Object(wt.compose)([Object(m.withSelect)(function(e){return{label:e("ithemes-security/user-groups-editor").getEditedGroupAttribute("new","label")}})])(function(e){var t=e.label;return t&&t.length||(t=Object(d.__)("New Group","better-wp-security")),Object(p.createElement)(Yr,{label:t})});var Qr=Object(wt.compose)([Object(m.withSelect)(function(e,t){return{label:t.groupIds.map(e("ithemes-security/user-groups").getMatchableLabel).join(", ")}})])(function(e){var t=e.label;return Object(p.createElement)(Yr,{label:t})});function Yr(e){var t=e.label,n=e.children;return Object(p.createElement)("div",{className:"itsec-user-group-header"},Object(p.createElement)("h4",{className:"itsec-user-group-header__label"},t),n)}n("XO7p");var zr=function(e){var t=e.groupId,n=e.disabled;return Object(p.createElement)(Pr.Row,{name:"edit-fields"},Object(p.createElement)(Ar,{groupId:t,disabled:n}),Object(p.createElement)(Fr,{groupId:t,disabled:n}),Object(p.createElement)(Kr,{groupId:t,disabled:n}))};function Jr(e){var t=e.schema,n=e.settingComponent,r=Nt()(e,["schema","settingComponent"]);return Object(p.createElement)("ul",{className:"itsec-user-groups-group-tab__modules-list"},Object(S.map)(t.properties,function(e,t){return Object(p.createElement)("li",{key:t},Object(p.createElement)("fieldset",null,Object(p.createElement)("legend",null,e.title),Object(p.createElement)("ul",null,Object(S.map)(e.properties,function(e,i){return Object(p.createElement)("li",{key:i},Object(p.createElement)(n,Ut()({schema:e,module:t,setting:i},r)))}))))}))}n("wM0a");var Xr=function(e){var t=e.noticeEl;return Object(p.createElement)("div",{className:"itsec-user-groups-app"},Object(p.createPortal)(Object(p.createElement)(rn,null),t),Object(p.createElement)(Ir,null))};function Zr(){var e=document.getElementById("itsec-user-groups-settings-root"),t=document.getElementById("itsec-module-messages-container-user-groups");return Object(p.render)(Object(p.createElement)(Xr,{noticeEl:t}),e)}n.p=window.itsecWebpackPublicPath,Object(d.setLocaleData)({"":{}},"ithemes-security-pro"),h()(function(){Zr(),window.itsecSettingsPage&&(window.itsecSettingsPage.events.on("modulesReloaded",Zr),window.itsecSettingsPage.events.on("moduleReloaded",function(e,t){"user-groups"===t&&Zr()}))})},faye:function(e,t){!function(){e.exports=this.ReactDOM}()},l3Sj:function(e,t){!function(){e.exports=this.wp.i18n}()},lSb6:function(e,t,n){},mzAq:function(e,t,n){},"oaS/":function(e,t,n){},onLe:function(e,t){!function(){e.exports=this.wp.notices}()},pPDe:function(e,t,n){"use strict";var r,i;function o(e){return[e]}function c(){var e={clear:function(){e.head=null}};return e}function s(e,t,n){var r;if(e.length!==t.length)return!1;for(r=n;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}r={},i="undefined"!=typeof WeakMap,t.a=function(e,t){var n,a;function u(){n=i?new WeakMap:c()}function l(){var n,r,i,o,c,u=arguments.length;for(o=new Array(u),i=0;i<u;i++)o[i]=arguments[i];for(c=t.apply(null,o),(n=a(c)).isUniqueByDependants||(n.lastDependants&&!s(c,n.lastDependants,0)&&n.clear(),n.lastDependants=c),r=n.head;r;){if(s(r.args,o,1))return r!==n.head&&(r.prev.next=r.next,r.next&&(r.next.prev=r.prev),r.next=n.head,r.prev=null,n.head.prev=r,n.head=r),r.val;r=r.next}return r={val:e.apply(null,o)},o[0]=null,r.args=o,n.head&&(n.head.prev=r,r.next=n.head),n.head=r,r.val}return t||(t=o),a=i?function(e){var t,i,o,s,a,u=n,l=!0;for(t=0;t<e.length;t++){if(i=e[t],!(a=i)||"object"!=typeof a){l=!1;break}u.has(i)?u=u.get(i):(o=new WeakMap,u.set(i,o),u=o)}return u.has(r)||((s=c()).isUniqueByDependants=l,u.set(r,s)),u.get(r)}:function(){return n},l.getDependants=t,l.clear=u,u(),l}},pVnL:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},rl8x:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},rmEH:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},sPxh:function(e,t){!function(){e.exports=this.itsec["user-groups"].api}()},"tI+e":function(e,t){!function(){e.exports=this.wp.components}()},urxu:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundaryFallbackComponent=t.withErrorBoundary=t.ErrorBoundary=void 0;var r=c(n("Xvx9")),i=n("31KZ"),o=c(i);function c(e){return e&&e.__esModule?e:{default:e}}t.default=o.default,t.ErrorBoundary=o.default,t.withErrorBoundary=i.withErrorBoundary,t.ErrorBoundaryFallbackComponent=r.default},wM0a:function(e,t,n){},yXPU:function(e,t){function n(e,t,n,r,i,o,c){try{var s=e[o](c),a=s.value}catch(e){return void n(e)}s.done?t(a):Promise.resolve(a).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise(function(i,o){var c=e.apply(t,r);function s(e){n(c,i,o,s,a,"next",e)}function a(e){n(c,i,o,s,a,"throw",e)}s(void 0)})}}},ywyh:function(e,t){!function(){e.exports=this.wp.apiFetch}()}});
history.txt CHANGED
@@ -898,3 +898,18 @@
898
  Bug Fix: PHP warning when checking opaque tokens.
899
  Bug Fix: PHP warning after successfully connecting a site to iThemes Sync via the login connection flow.
900
  Bug Fix: File Change Security Message would not appear for new installs.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
898
  Bug Fix: PHP warning when checking opaque tokens.
899
  Bug Fix: PHP warning after successfully connecting a site to iThemes Sync via the login connection flow.
900
  Bug Fix: File Change Security Message would not appear for new installs.
901
+ 7.9.0 - 2020-10-13 - Timothy Jacobs
902
+ Important: iThemes Security requires WordPress 5.4 or later.
903
+ Enhancement: Add a setting for configuring the number of bans added to the server config files (.htaccess/nginx.conf).
904
+ Enhancement: Store the time a ban was added, and the lockout module responsible for the ban.
905
+ Enhancement: Overwrite Restrict Content Pro's detected IP address with the IP detected by iThemes Security.
906
+ Tweak: Disable SSL verification when performing the Security Check Loopback test. Some hosts can't properly verify loopback requests. This verification is unnecessary in this circumstance, and disabling SSL verification aligns iThemes Security with default WordPress loopback behavior.
907
+ Bug Fix: PHP warnings when invalid entries are stored in the WordPress Cron storage.
908
+ Bug Fix: Update the list of tables added to wpdb.
909
+ Bug Fix: Remove default value for text columns. This caused an issue on MySQL 8 and is unnecessary.
910
+ Bug Fix: Missing borders in the sidebar widgets on WordPress 5.5.
911
+ Bug Fix: Notice actions didn't trigger when "Hide Admin Bar" is enabled.
912
+ Bug Fix: Some users would be force to choose a strong password twice in a row.
913
+ Bug Fix: Warning when saving the Ban Users module outside of the Settings Page without passing the legacy host_list setting.
914
+ Bug Fix: Passwords Requirements compatibility with Restrict Content Pro.
915
+ Bug Fix: PHP warnings that may occur when initializing default user groups on a new installation.
package.json CHANGED
@@ -7,6 +7,8 @@
7
  "extends @wordpress/browserslist-config"
8
  ],
9
  "dependencies": {
 
 
10
  "@wordpress/a11y": "^2.11.0",
11
  "@wordpress/api-fetch": "^3.18.0",
12
  "@wordpress/autop": "^2.9.0",
7
  "extends @wordpress/browserslist-config"
8
  ],
9
  "dependencies": {
10
+ "@react-hook/debounce": "^3.0.0",
11
+ "@rjsf/core": "^2.3.0",
12
  "@wordpress/a11y": "^2.11.0",
13
  "@wordpress/api-fetch": "^3.18.0",
14
  "@wordpress/autop": "^2.9.0",
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === iThemes Security (formerly Better WP Security) ===
2
  Contributors: ithemes, chrisjean, mattdanner, timothyblynjacobs
3
- Tags: security, security plugin, malware, hack, secure, block, SSL, admin, htaccess, lockdown, login, protect, protection, anti virus, attack, injection, login security, maintenance, permissions, prevention, authentication, administration, password, brute force, ban, permissions, bots, user agents, xml rpc, security log
4
- Requires at least: 5.2
5
- Tested up to: 5.5
6
- Stable tag: 7.8.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -189,6 +189,22 @@ Free support may be available with the help of the community in the <a href="htt
189
 
190
  == Changelog ==
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  = 7.8.0 =
193
  * New Feature: The new, improved WordPress Security Site Scan powered by iThemes checks if Google has detected malware and added your site to their threat list.
194
  * Enhancement: Remove quick bans. Persist banned hosts to .htaccess or nginx.conf on an hourly schedule.
@@ -606,5 +622,5 @@ Free support may be available with the help of the community in the <a href="htt
606
 
607
  == Upgrade Notice ==
608
 
609
- = 7.8.0 =
610
- Version 7.8.0 contains new features and bug fixes. It is recommended for all users.
1
  === iThemes Security (formerly Better WP Security) ===
2
  Contributors: ithemes, chrisjean, mattdanner, timothyblynjacobs
3
+ Tags: security plugin, malware scanner, login security, malware prevention, hack prevention, brute force protection, anti-virus, secure, password protection, ban, bad bots, audit log
4
+ Requires at least: 5.4
5
+ Tested up to: 5.6
6
+ Stable tag: 7.9.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
189
 
190
  == Changelog ==
191
 
192
+ = 7.9.0 =
193
+ * Important: iThemes Security requires WordPress 5.4 or later.
194
+ * Enhancement: Add a setting for configuring the number of bans added to the server config files (.htaccess/nginx.conf).
195
+ * Enhancement: Store the time a ban was added, and the lockout module responsible for the ban.
196
+ * Enhancement: Overwrite Restrict Content Pro's detected IP address with the IP detected by iThemes Security.
197
+ * Tweak: Disable SSL verification when performing the Security Check Loopback test. Some hosts can't properly verify loopback requests. This verification is unnecessary in this circumstance, and disabling SSL verification aligns iThemes Security with default WordPress loopback behavior.
198
+ * Bug Fix: PHP warnings when invalid entries are stored in the WordPress Cron storage.
199
+ * Bug Fix: Update the list of tables added to wpdb.
200
+ * Bug Fix: Remove default value for text columns. This caused an issue on MySQL 8 and is unnecessary.
201
+ * Bug Fix: Missing borders in the sidebar widgets on WordPress 5.5.
202
+ * Bug Fix: Notice actions didn't trigger when "Hide Admin Bar" is enabled.
203
+ * Bug Fix: Some users would be force to choose a strong password twice in a row.
204
+ * Bug Fix: Warning when saving the Ban Users module outside of the Settings Page without passing the legacy host_list setting.
205
+ * Bug Fix: Passwords Requirements compatibility with Restrict Content Pro.
206
+ * Bug Fix: PHP warnings that may occur when initializing default user groups on a new installation.
207
+
208
  = 7.8.0 =
209
  * New Feature: The new, improved WordPress Security Site Scan powered by iThemes checks if Google has detected malware and added your site to their threat list.
210
  * Enhancement: Remove quick bans. Persist banned hosts to .htaccess or nginx.conf on an hourly schedule.
622
 
623
  == Upgrade Notice ==
624
 
625
+ = 7.9.0 =
626
+ Version 7.9.0 contains new features and bug fixes. It is recommended for all users.
vendor-prod/composer/autoload_classmap.php CHANGED
@@ -46,7 +46,6 @@ return array(
46
  'ITSEC_Ban_Users_Settings' => $baseDir . '/core/modules/ban-users/settings.php',
47
  'ITSEC_Ban_Users_Settings_Page' => $baseDir . '/core/modules/ban-users/settings-page.php',
48
  'ITSEC_Ban_Users_Setup' => $baseDir . '/core/modules/ban-users/setup.php',
49
- 'ITSEC_Ban_Users_Validator' => $baseDir . '/core/modules/ban-users/validator.php',
50
  'ITSEC_Brute_Force' => $baseDir . '/core/modules/brute-force/class-itsec-brute-force.php',
51
  'ITSEC_Brute_Force_Logs' => $baseDir . '/core/modules/brute-force/logs.php',
52
  'ITSEC_Brute_Force_Settings' => $baseDir . '/core/modules/brute-force/settings.php',
@@ -177,6 +176,8 @@ return array(
177
  'ITSEC_Password_Requirements_Validator' => $baseDir . '/core/modules/password-requirements/validator.php',
178
  'ITSEC_Privacy' => $baseDir . '/core/modules/privacy/class-itsec-privacy.php',
179
  'ITSEC_Privacy_Util' => $baseDir . '/core/modules/privacy/util.php',
 
 
180
  'ITSEC_REST_Core_Admin_Notices_Controller' => $baseDir . '/core/modules/core/class-rest-core-admin-notices-controller.php',
181
  'ITSEC_SSL' => $baseDir . '/core/modules/ssl/class-itsec-ssl.php',
182
  'ITSEC_SSL_Admin' => $baseDir . '/core/modules/ssl/class-itsec-ssl-admin.php',
@@ -277,6 +278,36 @@ return array(
277
  'Wikimedia\\Composer\\Merge\\NestedArray' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php',
278
  'Wikimedia\\Composer\\Merge\\PluginState' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/PluginState.php',
279
  'Wikimedia\\Composer\\Merge\\StabilityFlags' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  'iThemesSecurity\\Contracts\\Runnable' => $baseDir . '/core/Contracts/Runnable.php',
281
  'iThemesSecurity\\Exception\\Exception' => $baseDir . '/core/Exception/Exception.php',
282
  'iThemesSecurity\\Exception\\Invalid_Argument_Exception' => $baseDir . '/core/Exception/Invalid_Argument_Exception.php',
46
  'ITSEC_Ban_Users_Settings' => $baseDir . '/core/modules/ban-users/settings.php',
47
  'ITSEC_Ban_Users_Settings_Page' => $baseDir . '/core/modules/ban-users/settings-page.php',
48
  'ITSEC_Ban_Users_Setup' => $baseDir . '/core/modules/ban-users/setup.php',
 
49
  'ITSEC_Brute_Force' => $baseDir . '/core/modules/brute-force/class-itsec-brute-force.php',
50
  'ITSEC_Brute_Force_Logs' => $baseDir . '/core/modules/brute-force/logs.php',
51
  'ITSEC_Brute_Force_Settings' => $baseDir . '/core/modules/brute-force/settings.php',
176
  'ITSEC_Password_Requirements_Validator' => $baseDir . '/core/modules/password-requirements/validator.php',
177
  'ITSEC_Privacy' => $baseDir . '/core/modules/privacy/class-itsec-privacy.php',
178
  'ITSEC_Privacy_Util' => $baseDir . '/core/modules/privacy/util.php',
179
+ 'ITSEC_REST_Actor_Types_Controller' => $baseDir . '/core/modules/core/class-itsec-rest-actor-types-controller.php',
180
+ 'ITSEC_REST_Actors_Controller' => $baseDir . '/core/modules/core/class-itsec-rest-actors-controller.php',
181
  'ITSEC_REST_Core_Admin_Notices_Controller' => $baseDir . '/core/modules/core/class-rest-core-admin-notices-controller.php',
182
  'ITSEC_SSL' => $baseDir . '/core/modules/ssl/class-itsec-ssl.php',
183
  'ITSEC_SSL_Admin' => $baseDir . '/core/modules/ssl/class-itsec-ssl-admin.php',
278
  'Wikimedia\\Composer\\Merge\\NestedArray' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php',
279
  'Wikimedia\\Composer\\Merge\\PluginState' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/PluginState.php',
280
  'Wikimedia\\Composer\\Merge\\StabilityFlags' => $vendorDir . '/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php',
281
+ 'iThemesSecurity\\Actor\\Actor' => $baseDir . '/core/lib/actor/Actor.php',
282
+ 'iThemesSecurity\\Actor\\Actor_Factory' => $baseDir . '/core/lib/actor/Actor_Factory.php',
283
+ 'iThemesSecurity\\Actor\\Lockout_Module' => $baseDir . '/core/lib/actor/Lockout_Module.php',
284
+ 'iThemesSecurity\\Actor\\Lockout_Module_Factory' => $baseDir . '/core/lib/actor/Lockout_Module_Factory.php',
285
+ 'iThemesSecurity\\Actor\\Multi_Actor_Factory' => $baseDir . '/core/lib/actor/Multi_Actor_Factory.php',
286
+ 'iThemesSecurity\\Actor\\User' => $baseDir . '/core/lib/actor/User.php',
287
+ 'iThemesSecurity\\Actor\\User_Factory' => $baseDir . '/core/lib/actor/User_Factory.php',
288
+ 'iThemesSecurity\\Ban_Hosts\\Ban' => $baseDir . '/core/lib/ban-hosts/Ban.php',
289
+ 'iThemesSecurity\\Ban_Hosts\\Chain_Source' => $baseDir . '/core/lib/ban-hosts/Chain_Source.php',
290
+ 'iThemesSecurity\\Ban_Hosts\\Creatable' => $baseDir . '/core/lib/ban-hosts/Creatable.php',
291
+ 'iThemesSecurity\\Ban_Hosts\\Cursor' => $baseDir . '/core/lib/ban-hosts/Cursor.php',
292
+ 'iThemesSecurity\\Ban_Hosts\\Deletable' => $baseDir . '/core/lib/ban-hosts/Deletable.php',
293
+ 'iThemesSecurity\\Ban_Hosts\\Deprecated_Filter_Source' => $baseDir . '/core/lib/ban-hosts/Deprecated_Filter_Source.php',
294
+ 'iThemesSecurity\\Ban_Hosts\\Filters' => $baseDir . '/core/lib/ban-hosts/Filters.php',
295
+ 'iThemesSecurity\\Ban_Hosts\\Legacy_Ban' => $baseDir . '/core/lib/ban-hosts/Legacy_Ban.php',
296
+ 'iThemesSecurity\\Ban_Hosts\\Malformed_Cursor' => $baseDir . '/core/lib/ban-hosts/Malformed_Cursor.php',
297
+ 'iThemesSecurity\\Ban_Hosts\\Multi_Cursor' => $baseDir . '/core/lib/ban-hosts/Multi_Cursor.php',
298
+ 'iThemesSecurity\\Ban_Hosts\\Multi_Repository' => $baseDir . '/core/lib/ban-hosts/Multi_Repository.php',
299
+ 'iThemesSecurity\\Ban_Hosts\\Multi_Repository_Results' => $baseDir . '/core/lib/ban-hosts/Multi_Repository_Results.php',
300
+ 'iThemesSecurity\\Ban_Hosts\\Persistable' => $baseDir . '/core/lib/ban-hosts/Persistable.php',
301
+ 'iThemesSecurity\\Ban_Hosts\\REST' => $baseDir . '/core/lib/ban-hosts/REST.php',
302
+ 'iThemesSecurity\\Ban_Hosts\\Repository' => $baseDir . '/core/lib/ban-hosts/Repository.php',
303
+ 'iThemesSecurity\\Ban_Hosts\\Repository_Ban' => $baseDir . '/core/lib/ban-hosts/Repository_Ban.php',
304
+ 'iThemesSecurity\\Ban_Hosts\\Source' => $baseDir . '/core/lib/ban-hosts/Source.php',
305
+ 'iThemesSecurity\\Ban_Hosts\\Unknown_Source' => $baseDir . '/core/lib/ban-hosts/Unknown_Source.php',
306
+ 'iThemesSecurity\\Ban_Hosts\\Unsupported_Operation' => $baseDir . '/core/lib/ban-hosts/Unsupported_Operation.php',
307
+ 'iThemesSecurity\\Ban_Hosts\\Updatable' => $baseDir . '/core/lib/ban-hosts/Updatable.php',
308
+ 'iThemesSecurity\\Ban_Users\\Ban' => $baseDir . '/core/modules/ban-users/Ban.php',
309
+ 'iThemesSecurity\\Ban_Users\\Database_Repository' => $baseDir . '/core/modules/ban-users/Database_Repository.php',
310
+ 'iThemesSecurity\\Ban_Users\\Validator' => $baseDir . '/core/modules/ban-users/Module/Validator.php',
311
  'iThemesSecurity\\Contracts\\Runnable' => $baseDir . '/core/Contracts/Runnable.php',
312
  'iThemesSecurity\\Exception\\Exception' => $baseDir . '/core/Exception/Exception.php',
313
  'iThemesSecurity\\Exception\\Invalid_Argument_Exception' => $baseDir . '/core/Exception/Invalid_Argument_Exception.php',
vendor-prod/composer/autoload_static.php CHANGED
@@ -79,7 +79,6 @@ class ComposerStaticInit35a2bd4feb347da0d3ea2d8ef023082f
79
  'ITSEC_Ban_Users_Settings' => __DIR__ . '/../..' . '/core/modules/ban-users/settings.php',
80
  'ITSEC_Ban_Users_Settings_Page' => __DIR__ . '/../..' . '/core/modules/ban-users/settings-page.php',
81
  'ITSEC_Ban_Users_Setup' => __DIR__ . '/../..' . '/core/modules/ban-users/setup.php',
82
- 'ITSEC_Ban_Users_Validator' => __DIR__ . '/../..' . '/core/modules/ban-users/validator.php',
83
  'ITSEC_Brute_Force' => __DIR__ . '/../..' . '/core/modules/brute-force/class-itsec-brute-force.php',
84
  'ITSEC_Brute_Force_Logs' => __DIR__ . '/../..' . '/core/modules/brute-force/logs.php',
85
  'ITSEC_Brute_Force_Settings' => __DIR__ . '/../..' . '/core/modules/brute-force/settings.php',
@@ -210,6 +209,8 @@ class ComposerStaticInit35a2bd4feb347da0d3ea2d8ef023082f
210
  'ITSEC_Password_Requirements_Validator' => __DIR__ . '/../..' . '/core/modules/password-requirements/validator.php',
211
  'ITSEC_Privacy' => __DIR__ . '/../..' . '/core/modules/privacy/class-itsec-privacy.php',
212
  'ITSEC_Privacy_Util' => __DIR__ . '/../..' . '/core/modules/privacy/util.php',
 
 
213
  'ITSEC_REST_Core_Admin_Notices_Controller' => __DIR__ . '/../..' . '/core/modules/core/class-rest-core-admin-notices-controller.php',
214
  'ITSEC_SSL' => __DIR__ . '/../..' . '/core/modules/ssl/class-itsec-ssl.php',
215
  'ITSEC_SSL_Admin' => __DIR__ . '/../..' . '/core/modules/ssl/class-itsec-ssl-admin.php',
@@ -310,6 +311,36 @@ class ComposerStaticInit35a2bd4feb347da0d3ea2d8ef023082f
310
  'Wikimedia\\Composer\\Merge\\NestedArray' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php',
311
  'Wikimedia\\Composer\\Merge\\PluginState' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/PluginState.php',
312
  'Wikimedia\\Composer\\Merge\\StabilityFlags' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  'iThemesSecurity\\Contracts\\Runnable' => __DIR__ . '/../..' . '/core/Contracts/Runnable.php',
314
  'iThemesSecurity\\Exception\\Exception' => __DIR__ . '/../..' . '/core/Exception/Exception.php',
315
  'iThemesSecurity\\Exception\\Invalid_Argument_Exception' => __DIR__ . '/../..' . '/core/Exception/Invalid_Argument_Exception.php',
79
  'ITSEC_Ban_Users_Settings' => __DIR__ . '/../..' . '/core/modules/ban-users/settings.php',
80
  'ITSEC_Ban_Users_Settings_Page' => __DIR__ . '/../..' . '/core/modules/ban-users/settings-page.php',
81
  'ITSEC_Ban_Users_Setup' => __DIR__ . '/../..' . '/core/modules/ban-users/setup.php',
 
82
  'ITSEC_Brute_Force' => __DIR__ . '/../..' . '/core/modules/brute-force/class-itsec-brute-force.php',
83
  'ITSEC_Brute_Force_Logs' => __DIR__ . '/../..' . '/core/modules/brute-force/logs.php',
84
  'ITSEC_Brute_Force_Settings' => __DIR__ . '/../..' . '/core/modules/brute-force/settings.php',
209
  'ITSEC_Password_Requirements_Validator' => __DIR__ . '/../..' . '/core/modules/password-requirements/validator.php',
210
  'ITSEC_Privacy' => __DIR__ . '/../..' . '/core/modules/privacy/class-itsec-privacy.php',
211
  'ITSEC_Privacy_Util' => __DIR__ . '/../..' . '/core/modules/privacy/util.php',
212
+ 'ITSEC_REST_Actor_Types_Controller' => __DIR__ . '/../..' . '/core/modules/core/class-itsec-rest-actor-types-controller.php',
213
+ 'ITSEC_REST_Actors_Controller' => __DIR__ . '/../..' . '/core/modules/core/class-itsec-rest-actors-controller.php',
214
  'ITSEC_REST_Core_Admin_Notices_Controller' => __DIR__ . '/../..' . '/core/modules/core/class-rest-core-admin-notices-controller.php',
215
  'ITSEC_SSL' => __DIR__ . '/../..' . '/core/modules/ssl/class-itsec-ssl.php',
216
  'ITSEC_SSL_Admin' => __DIR__ . '/../..' . '/core/modules/ssl/class-itsec-ssl-admin.php',
311
  'Wikimedia\\Composer\\Merge\\NestedArray' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/NestedArray.php',
312
  'Wikimedia\\Composer\\Merge\\PluginState' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/PluginState.php',
313
  'Wikimedia\\Composer\\Merge\\StabilityFlags' => __DIR__ . '/..' . '/wikimedia/composer-merge-plugin/src/Merge/StabilityFlags.php',
314
+ 'iThemesSecurity\\Actor\\Actor' => __DIR__ . '/../..' . '/core/lib/actor/Actor.php',
315
+ 'iThemesSecurity\\Actor\\Actor_Factory' => __DIR__ . '/../..' . '/core/lib/actor/Actor_Factory.php',
316
+ 'iThemesSecurity\\Actor\\Lockout_Module' => __DIR__ . '/../..' . '/core/lib/actor/Lockout_Module.php',
317
+ 'iThemesSecurity\\Actor\\Lockout_Module_Factory' => __DIR__ . '/../..' . '/core/lib/actor/Lockout_Module_Factory.php',
318
+ 'iThemesSecurity\\Actor\\Multi_Actor_Factory' => __DIR__ . '/../..' . '/core/lib/actor/Multi_Actor_Factory.php',
319
+ 'iThemesSecurity\\Actor\\User' => __DIR__ . '/../..' . '/core/lib/actor/User.php',
320
+ 'iThemesSecurity\\Actor\\User_Factory' => __DIR__ . '/../..' . '/core/lib/actor/User_Factory.php',
321
+ 'iThemesSecurity\\Ban_Hosts\\Ban' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Ban.php',
322
+ 'iThemesSecurity\\Ban_Hosts\\Chain_Source' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Chain_Source.php',
323
+ 'iThemesSecurity\\Ban_Hosts\\Creatable' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Creatable.php',
324
+ 'iThemesSecurity\\Ban_Hosts\\Cursor' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Cursor.php',
325
+ 'iThemesSecurity\\Ban_Hosts\\Deletable' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Deletable.php',
326
+ 'iThemesSecurity\\Ban_Hosts\\Deprecated_Filter_Source' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Deprecated_Filter_Source.php',
327
+ 'iThemesSecurity\\Ban_Hosts\\Filters' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Filters.php',
328
+ 'iThemesSecurity\\Ban_Hosts\\Legacy_Ban' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Legacy_Ban.php',
329
+ 'iThemesSecurity\\Ban_Hosts\\Malformed_Cursor' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Malformed_Cursor.php',
330
+ 'iThemesSecurity\\Ban_Hosts\\Multi_Cursor' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Multi_Cursor.php',
331
+ 'iThemesSecurity\\Ban_Hosts\\Multi_Repository' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Multi_Repository.php',
332
+ 'iThemesSecurity\\Ban_Hosts\\Multi_Repository_Results' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Multi_Repository_Results.php',
333
+ 'iThemesSecurity\\Ban_Hosts\\Persistable' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Persistable.php',
334
+ 'iThemesSecurity\\Ban_Hosts\\REST' => __DIR__ . '/../..' . '/core/lib/ban-hosts/REST.php',
335
+ 'iThemesSecurity\\Ban_Hosts\\Repository' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Repository.php',
336
+ 'iThemesSecurity\\Ban_Hosts\\Repository_Ban' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Repository_Ban.php',
337
+ 'iThemesSecurity\\Ban_Hosts\\Source' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Source.php',
338
+ 'iThemesSecurity\\Ban_Hosts\\Unknown_Source' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Unknown_Source.php',
339
+ 'iThemesSecurity\\Ban_Hosts\\Unsupported_Operation' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Unsupported_Operation.php',
340
+ 'iThemesSecurity\\Ban_Hosts\\Updatable' => __DIR__ . '/../..' . '/core/lib/ban-hosts/Updatable.php',
341
+ 'iThemesSecurity\\Ban_Users\\Ban' => __DIR__ . '/../..' . '/core/modules/ban-users/Ban.php',
342
+ 'iThemesSecurity\\Ban_Users\\Database_Repository' => __DIR__ . '/../..' . '/core/modules/ban-users/Database_Repository.php',
343
+ 'iThemesSecurity\\Ban_Users\\Validator' => __DIR__ . '/../..' . '/core/modules/ban-users/Module/Validator.php',
344
  'iThemesSecurity\\Contracts\\Runnable' => __DIR__ . '/../..' . '/core/Contracts/Runnable.php',
345
  'iThemesSecurity\\Exception\\Exception' => __DIR__ . '/../..' . '/core/Exception/Exception.php',
346
  'iThemesSecurity\\Exception\\Invalid_Argument_Exception' => __DIR__ . '/../..' . '/core/Exception/Invalid_Argument_Exception.php',