SiteGround Security - Version 1.3.2

Version Description

Download this release

Release Info

Developer elenachavdarova
Plugin Icon 128x128 SiteGround Security
Version 1.3.2
Comparing to
See all releases

Version 1.3.2

Files changed (69) hide show
  1. assets/css/main.min.css +63 -0
  2. assets/images/icon.svg +1 -0
  3. assets/images/logo.gif +0 -0
  4. assets/js/admin.js +15 -0
  5. assets/js/main.min.js +2 -0
  6. core/Activator/Activator.php +60 -0
  7. core/Activity_Log/Activity_Log.php +231 -0
  8. core/Activity_Log/Activity_Log_Attachments.php +87 -0
  9. core/Activity_Log/Activity_Log_Comments.php +177 -0
  10. core/Activity_Log/Activity_Log_Core.php +23 -0
  11. core/Activity_Log/Activity_Log_Export.php +23 -0
  12. core/Activity_Log/Activity_Log_Helper.php +283 -0
  13. core/Activity_Log/Activity_Log_Options.php +133 -0
  14. core/Activity_Log/Activity_Log_Plugins.php +181 -0
  15. core/Activity_Log/Activity_Log_Posts.php +120 -0
  16. core/Activity_Log/Activity_Log_Taxonomies.php +87 -0
  17. core/Activity_Log/Activity_Log_Themes.php +235 -0
  18. core/Activity_Log/Activity_Log_Unknown.php +326 -0
  19. core/Activity_Log/Activity_Log_Users.php +146 -0
  20. core/Activity_Log/Activity_Log_Weekly_Emails.php +322 -0
  21. core/Activity_Log/Activity_Log_Widgets.php +85 -0
  22. core/Admin/Admin.php +304 -0
  23. core/Block_Service/Block_Service.php +281 -0
  24. core/Cli/Cli.php +32 -0
  25. core/Cli/Cli_2fa.php +77 -0
  26. core/Cli/Cli_Limit_Login_Attempts.php +69 -0
  27. core/Cli/Cli_List.php +245 -0
  28. core/Cli/Cli_Log.php +272 -0
  29. core/Cli/Cli_Login_Access.php +183 -0
  30. core/Cli/Cli_Secure.php +133 -0
  31. core/Custom_Login_Url/Custom_Login_Url.php +432 -0
  32. core/Deactivator/Deactivator.php +34 -0
  33. core/Editors_Service/Editors_Service.php +24 -0
  34. core/Feed_Service/Feed_Service.php +17 -0
  35. core/Headers_Service/Headers_Service.php +105 -0
  36. core/Helper/Helper.php +189 -0
  37. core/Htaccess_Service/Abstract_Htaccess_Service.php +227 -0
  38. core/Htaccess_Service/Directory_Service.php +161 -0
  39. core/Htaccess_Service/Headers_Service.php +30 -0
  40. core/Htaccess_Service/Hsts_Service.php +30 -0
  41. core/Htaccess_Service/Xmlrpc_Service.php +76 -0
  42. core/Install_Service/Install.php +38 -0
  43. core/Install_Service/Install_1_0_1.php +60 -0
  44. core/Install_Service/Install_1_1_0.php +53 -0
  45. core/Install_Service/Install_1_1_1.php +51 -0
  46. core/Install_Service/Install_1_2_0.php +38 -0
  47. core/Install_Service/Install_1_2_1.php +52 -0
  48. core/Install_Service/Install_1_2_2.php +33 -0
  49. core/Install_Service/Install_1_2_3.php +33 -0
  50. core/Install_Service/Install_1_2_5.php +48 -0
  51. core/Install_Service/Install_1_3_2.php +108 -0
  52. core/Install_Service/Install_Service.php +115 -0
  53. core/Loader/Loader.php +543 -0
  54. core/Login_Service/Login_Service.php +258 -0
  55. core/Message_Service/Message_Service.php +149 -0
  56. core/Options_Service/Options_Service.php +167 -0
  57. core/Password_Service/Password_Service.php +173 -0
  58. core/Plugins_Service/Plugins_Service.php +159 -0
  59. core/Readme_Service/Readme_Service.php +50 -0
  60. core/Rest/Rest.php +366 -0
  61. core/Rest/Rest_Helper.php +92 -0
  62. core/Rest/Rest_Helper_Activity.php +784 -0
  63. core/Rest/Rest_Helper_Dashboard.php +146 -0
  64. core/Rest/Rest_Helper_Login.php +205 -0
  65. core/Rest/Rest_Helper_Options.php +106 -0
  66. core/Rest/Rest_Helper_Post_Hack_Actions.php +69 -0
  67. core/Rest/Rest_Helper_Site_Security.php +141 -0
  68. core/Salt_Shaker/Salt_Shaker.php +185 -0
  69. core/Sg_2fa/Sg_2fa.php +160 -0
assets/css/main.min.css ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root{--padding-responsive: 30px}@media(max-width: 1500px){:root{--padding-responsive: 20px}}:root,.sg-theme-light{--color-primary: #5645f5;--color-primary-hovered: #1b0aa7;--color-primary-active: #9287fc;--color-secondary: #ebe9fa;--color-secondary-hovered: #d7d1f9;--color-secondary-active: #e8e7f4;--color-tertiary: #e8f0fb;--color-error: #e01e56;--color-success: #21ab61;--color-warning: #d78a33;--color-instruction: #2888b5;--color-info: #9b50d7;--color-hint: #868585}:root,.sg-theme-light{--background-main: #f9f9f9;--background-component-primary: #fff;--background-component-secondary: #efefef;--background-component-tertiary: var(--color-tertiary);--background-disabled: #ddd;--background-white: #fff;--background-slider: #ddd;--background-overlay: rgba(54, 54, 54, 0.8);--background-button-primary: var(--color-primary);--background-button-primary-hovered: var(--color-primary-hovered);--background-button-primary-active: var(--color-primary-active);--background-button-secondary: var(--color-secondary);--background-button-secondary-hovered: var(--color-secondary-hovered);--background-button-secondary-active: var(--color-secondary-active);--backround-popover-image-hover: rgba(0, 0, 0, 0.3)}:root,.sg-theme-light{--typography-white: #fff;--typography-light: #a4a4a4;--typography-dark: #363636;--typography-field-label-size: 14px;--typography-table-label-size: 14px}:root{--font-family-default: Roboto, Arial, Helvetica, sans-serif;--font-family-component: Poppins, Century Gothic, CenturyGothic, sans-serif}:root,.sg-theme-light{--color-scrollbar: #f2f2f2;--color-scrollbar-thumb: #ddd;--color-scrollbar-thumb-hover: #c2c2c2;--color-button-white: #fff;--color-icon-button: var(--color-primary);--color-editor-icon: var(--typography-light);--color-disabled: var(--typography-light);--border-color-outer: #ddd;--border-color-inner: #f2f2f2;--border-color-focus: #ddd;--border-color-default: #666;--component-background-hover: var(--color-tertiary);--component-color-hover: currentColor;--avatar-color: var(--color-primary);--avatar-background: var(--color-secondary);--context-menu-background: var(--background-component-primary);--chart-color-first: #2888b5;--chart-color-second: #d78a33;--chart-color-third: #21ab61;--chart-color-fourth: #4343f0;--chart-color-fifth: #86c87f;--chart-color-sixth: #9b50d7;--chart-color-seventh: #432667;--chart-color-eighth: #e01e56;--icon-color: #807d7d;--icon-color-light: var(--color-tertiary);--icon-color-lighter: var(--color-tertiary);--loader-spinner-background-primary: #0d1939;--loader-spinner-background-secondary: #4343f0;--loader-spinner-background-tertiary: #98b7ff;--loader-background: rgba(255, 255, 255, 0.75);--loader-background-dark: rgba(71, 67, 64, 0.8);--drawer-background: var(--background-main);--drawer-icon-color: var(--color-icon-button);--drawer-icon-background-hover: var(--color-tertiary);--header-background: #0d1939;--footer-background: transparent;--navigation-background: transparent;--navigation-background-hover: var(--color-tertiary);--navigation-list-color: var(--typography-dark);--navigation-list-color-selected: var(--typography-dark);--navigation-list-background: transparent;--navigation-list-background-opened: transparent;--navigation-list-background-hovered: var(--color-tertiary);--navigation-list-background-selected: #cce0fc;--navigation-icon-color: var(--icon-color);--navigation-icon-color-selected: var(--icon-color);--navigation-button-color: var(--typography-dark);--navigation-group-title-color: #c1aa95;--header-navigation-color: #fff;--header-navigation-color-hover: var(--typography-dark);--header-navigation-color-selected: var(--typography-dark);--header-navigation-background: transparent;--header-navigation-background-hover: var(--background-button-secondary);--header-navigation-background-selected: #fff;--header-second-navigation-background-selected: #fff;--header-support-navigation-background-selected: #fff;--section-background-white: var(--background-component-primary);--section-background-yellow: var(--header-second-navigation-background-selected);--section-background-light: var(--background-component-secondary);--section-background-dark: var(--header-background);--tooltip-color: #fff;--tooltip-background-light: #fff;--tooltip-background-dark: rgba(54, 54, 54, 0.9);--background-color-error-focused: #d21d22;--text-color-error-focused: #fff;--border-color-input-error-focused: #d21d22;--background-color-error-not-focused: #fae9ea;--text-color-error-not-focused: #d21d22;--border-color-input-error-not-focused: #fc8181}:root,.sg-theme-light{--first-level-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05), 0 1px 5px 0 rgba(0, 0, 0, 0.05);--second-level-box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.06), 0 4px 12px 0 rgba(0, 0, 0, 0.1);--third-level-box-shadow: 0 17px 40px 0 rgba(0, 0, 0, 0.17), 0 12px 15px 0 rgba(0, 0, 0, 0.2);--fourth-level-box-shadow: 0 25px 45px 0 rgba(0, 0, 0, 0.2), 0 16px 24px 0 rgba(0, 0, 0, 0.22);--fifth-level-box-shadow: 0 40px 60px 0 rgba(0, 0, 0, 0.22), 0 27px 22px 0 rgba(0, 0, 0, 0.2);--focus-shadow: inset 1px 1px 0 #24b8d2, inset -1px -1px 0 #24b8d2}.sg-theme-dark{--color-primary: #b2b2f8;--color-primary-hovered: #8c8cf9;--color-primary-active: #ceceff;--color-secondary: #484662;--color-secondary-hovered: #4c4a69;--color-secondary-active: #7b7995;--color-tertiary: #464e5b;--color-error: #fe7099;--color-success: #27c671;--color-warning: #f4a54a;--color-instruction: #3db7f0;--color-info: #ca8cfb;--color-hint: #a9a9a9}.sg-theme-dark{--background-main: #121212;--background-component-primary: #363636;--background-component-secondary: #444;--background-component-tertiary: var(--color-tertiary);--background-disabled: #666;--background-slider: #858484;--background-overlay: rgba(102, 102, 102, 0.95);--background-button-primary: var(--color-primary);--background-button-primary-hovered: var(--color-primary-hovered);--background-button-primary-active: var(--color-primary-active);--background-button-secondary: var(--color-secondary);--background-button-secondary-hovered: var(--color-secondary-hovered);--background-button-secondary-active: var(--color-secondary-active);--backround-popover-image-hover: rgba(0, 0, 0, 0.3)}.sg-theme-dark{--typography-white: #fff;--typography-light: #c2c2c2;--typography-dark: #fff}.sg-theme-dark{--color-scrollbar: #f2f2f2;--color-scrollbar-thumb: #ddd;--color-scrollbar-thumb-hover: #c2c2c2;--color-button-white: #363636;--color-icon-button: var(--color-primary);--color-disabled: #888;--border-color-outer: #858484;--border-color-inner: #444;--border-color-focus: #fff;--border-color-default: #858484;--component-background-hover: var(--color-tertiary);--component-color-hover: currentColor;--avatar-color: var(--color-primary);--avatar-background: var(--color-secondary);--context-menu-background: var(--background-component-primary);--chart-color-first: var(--color-instruction);--chart-color-second: var(--color-warning);--chart-color-third: var(--color-success);--chart-color-fourth: #7c7cee;--chart-color-fifth: #86c87f;--chart-color-sixth: var(--color-info);--chart-color-seventh: #c12aee;--chart-color-eighth: var(--color-error);--icon-color: #b9b9b9;--icon-color-light: var(--color-tertiary);--icon-color-lighter: var(--color-tertiary);--loader-background: rgba(54, 54, 54, 0.75);--loader-background-dark: rgba(54, 54, 54, 0.75);--drawer-background: var(--background-main);--drawer-icon-color: var(--color-icon-button);--drawer-icon-background-hover: var(--color-tertiary);--header-background: #363636;--footer-background: transparent;--navigation-background: transparent;--navigation-background-hover: var(--color-tertiary);--navigation-list-color: var(--typography-dark);--navigation-list-color-selected: var(--typography-dark);--navigation-list-background: transparent;--navigation-list-background-opened: transparent;--navigation-list-background-hovered: var(--color-tertiary);--navigation-list-background-selected: #44556e;--navigation-icon-color: var(--icon-color);--navigation-icon-color-selected: var(--icon-color);--navigation-button-color: var(--typography-dark);--navigation-group-title-color: #c1aa95;--header-navigation-color: #fff;--header-navigation-color-hover: var(--typography-dark);--header-navigation-color-selected: var(--typography-dark);--header-navigation-background: transparent;--header-navigation-background-hover: var(--background-button-secondary);--header-navigation-background-selected: #444;--header-second-navigation-background-selected: #444;--header-support-navigation-background-selected: #858484;--section-background-white: var(--background-component-secondary);--section-background-yellow: var(--background-component-secondary);--section-background-light: var(--background-component-secondary);--section-background-dark: var(--header-background);--tooltip-color: #fff;--tooltip-background-light: #fff;--tooltip-background-dark: #666;--text-color-error-focused: #fff;--background-color-error-focused: #f57d7d;--border-color-input-error-focused: #f57d7d;--background-color-error-not-focused: #3c3030;--text-color-error-not-focused: #f57d7d;--border-color-input-error-not-focused: #ab5b5b}.sg-theme-dark{--first-level-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05), 0 1px 5px 0 rgba(0, 0, 0, 0.05);--second-level-box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.06), 0 4px 12px 0 rgba(0, 0, 0, 0.1);--third-level-box-shadow: 0 17px 40px 0 rgba(0, 0, 0, 0.17), 0 12px 15px 0 rgba(0, 0, 0, 0.2);--fourth-level-box-shadow: 0 25px 45px 0 rgba(0, 0, 0, 0.2), 0 16px 24px 0 rgba(0, 0, 0, 0.22);--fifth-level-box-shadow: 0 40px 60px 0 rgba(0, 0, 0, 0.22), 0 27px 22px 0 rgba(0, 0, 0, 0.2);--focus-shadow: inset 1px 1px 0 #24b8d2, inset -1px -1px 0 #24b8d2}.sg-theme-hcb{--color-primary: #b2b2f8;--color-primary-hovered: #8c8cf9;--color-primary-active: #ceceff;--color-secondary: #484662;--color-secondary-hovered: #4c4a69;--color-secondary-active: #7b7995;--color-tertiary: #464e5b;--color-error: #fe7099;--color-success: #27c671;--color-warning: #f4a54a;--color-instruction: #3db7f0;--color-info: #ca8cfb;--color-hint: #a9a9a9}.sg-theme-hcb{--background-main: #000;--background-component-primary: #000;--background-component-secondary: #000;--background-component-tertiary: var(--color-tertiary);--background-disabled: #888;--background-slider: #fff;--background-overlay: rgba(102, 102, 102, 0.95);--background-highlight: #000;--backround-employee: #000;--backround-client: #000;--backround-popover-image-hover: rgba(0, 0, 0, 0.3)}.sg-theme-hcb{--typography-white: #fff;--typography-light: #fff;--typography-dark: #fff}.sg-theme-hcb{--color-scrollbar: #f2f2f2;--color-scrollbar-thumb: #ddd;--color-scrollbar-thumb-hover: #c2c2c2;--color-button-white: #000;--color-icon-button: #fff;--color-disabled: #888;--border-color-outer: #ececec;--border-color-inner: #ececec;--border-color-focus: #fff;--border-color-default: #fff;--high-contrast-foreground: #fff;--high-contrast-background: #000;--component-background-hover: #1797ae;--component-color-hover: currentColor;--avatar-color: #000;--avatar-background: #fff;--context-menu-background: #000;--icon-color-royal: #ececec;--icon-color-royal-light: transparent;--icon-color-royal-lighter: transparent;--icon-color-ocean: #ececec;--icon-color-ocean-light: transparent;--icon-color-ocean-lighter: transparent;--icon-color-mint: #ececec;--icon-color-mint-light: transparent;--icon-color-mint-lighter: transparent;--icon-color-grassy: #ececec;--icon-color-grassy-light: transparent;--icon-color-grassy-lighter: transparent;--icon-color-salmon: #ececec;--icon-color-salmon-light: transparent;--icon-color-salmon-lighter: transparent;--icon-color-sunset: #ececec;--icon-color-sunset-light: transparent;--icon-color-sunset-lighter: transparent;--icon-color-mango: #ececec;--icon-color-mango-light: transparent;--icon-color-mango-lighter: transparent;--icon-color-bronze: #ececec;--icon-color-bronze-light: transparent;--icon-color-bronze-lighter: transparent;--icon-logo-background-light: #fff;--loader-background: rgba(0, 0, 0, 0.75);--loader-background-dark: rgba(0, 0, 0, 0.75);--drawer-background: #000;--drawer-icon-color: #fff;--drawer-icon-background-hover: #858484;--header-background: #000;--footer-background: #000;--navigation-background: #000;--navigation-background-hover: #363636;--navigation-list-color: #363636;--navigation-list-color-selected: #363636;--navigation-list-background: #000;--navigation-list-background-opened: #000;--navigation-list-background-hovered: #444;--navigation-list-background-selected: #fff;--navigation-icon-color: #fff;--navigation-icon-color-selected: #000;--navigation-button-color: #fff;--navigation-group-title-color: #c1aa95;--header-navigation-color: #fff;--header-navigation-color-hover: #000;--header-navigation-color-selected: #000;--header-navigation-background: transparent;--header-navigation-background-hover: #fff;--header-navigation-background-selected: #fff;--header-second-navigation-background-selected: #000;--header-support-navigation-background-selected: #fff;--section-background-white: var(--background-component-primary);--section-background-yellow: var(--header-second-navigation-background-selected);--section-background-light: var(--background-component-secondary);--section-background-dark: var(--header-background);--tooltip-color: #fff;--tooltip-background-light: #000;--tooltip-background-dark: #000;--background-color-error-focused: #f98f8f;--text-color-error-focused: #000;--border-color-input-error-focused: #f98f8f;--background-color-error-not-focused: #000;--text-color-error-not-focused: #f98f8f;--border-color-input-error-not-focused: #f98f8f}.sg-theme-hcb{--first-level-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05), 0 1px 5px 0 rgba(0, 0, 0, 0.05);--second-level-box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.06), 0 4px 12px 0 rgba(0, 0, 0, 0.1);--third-level-box-shadow: 0 17px 40px 0 rgba(0, 0, 0, 0.17), 0 12px 15px 0 rgba(0, 0, 0, 0.2);--fourth-level-box-shadow: 0 25px 45px 0 rgba(0, 0, 0, 0.2), 0 16px 24px 0 rgba(0, 0, 0, 0.22);--fifth-level-box-shadow: 0 40px 60px 0 rgba(0, 0, 0, 0.22), 0 27px 22px 0 rgba(0, 0, 0, 0.2);--focus-shadow: inset 1px 1px 0 #24b8d2, inset -1px -1px 0 #24b8d2}.sg-theme-hcl{--color-primary: #0000ba;--color-primary-hovered: #1b0aa7;--color-primary-active: #7567f6;--color-secondary: #ebe9fa;--color-secondary-hovered: #d7d1f9;--color-secondary-active: #e8e7f4;--color-tertiary: #e8f0fb;--color-error: #932929;--color-success: #407a2e;--color-warning: #8e6025;--color-instruction: #4f2d61;--color-info: #166e7e;--color-hint: #c2c2c2}.sg-theme-hcl{--background-main: #fff;--background-component-primary: #fff;--background-component-secondary: #fff;--background-component-tertiary: var(--color-tertiary);--background-disabled: #888;--background-slider: #000;--background-overlay: rgba(255, 255, 255, 0.95);--background-highlight: #fff;--background-button-primary: var(--color-primary);--background-button-primary-hovered: var(--color-primary-hovered);--background-button-primary-active: var(--color-primary-active);--background-button-secondary: var(--color-secondary);--background-button-secondary-hovered: var(--color-secondary-hovered);--background-button-secondary-active: var(--color-secondary-active);--backround-popover-image-hover: rgba(0, 0, 0, 0.3)}.sg-theme-hcl{--typography-white: #000;--typography-light: #000;--typography-dark: #000}.sg-theme-hcl{--color-scrollbar: #f2f2f2;--color-scrollbar-thumb: #212121;--color-scrollbar-thumb-hover: #000;--color-button-white: #fff;--color-icon-button: #000;--color-disabled: #888;--border-color-outer: #000;--border-color-inner: #000;--border-color-focus: #000;--border-color-default: #000;--high-contrast-foreground: #000;--high-contrast-background: #fff;--component-background-hover: #1797ae;--component-color-hover: currentColor;--avatar-color: #fff;--avatar-background: #000;--context-menu-background: #fff;--icon-color: #000;--icon-color-light: var(--color-tertiary);--icon-color-lighter: var(--color-tertiary);--loader-background: rgba(255, 255, 255, 0.75);--loader-background-dark: rgba(255, 255, 255, 0.75);--drawer-background: #fff;--drawer-icon-color: #000;--drawer-icon-background-hover: #858484;--header-background: #fff;--footer-background: #fff;--navigation-background: #fff;--navigation-background-hover: #363636;--navigation-list-color: #363636;--navigation-list-color-selected: #fff;--navigation-list-background: #fff;--navigation-list-background-opened: #fff;--navigation-list-background-hovered: #ddd;--navigation-list-background-selected: #000;--navigation-icon-color: #000;--navigation-icon-color-selected: #fff;--navigation-button-color: #000;--navigation-group-title-color: #c1aa95;--header-navigation-color: #000;--header-navigation-color-hover: #fff;--header-navigation-color-selected: #fff;--header-navigation-background: transparent;--header-navigation-background-hover: #000;--header-navigation-background-selected: #000;--header-second-navigation-background-selected: #fff;--header-support-navigation-background-selected: #000;--section-background-white: var(--background-component-primary);--section-background-yellow: var(--header-second-navigation-background-selected);--section-background-light: var(--background-component-secondary);--section-background-dark: var(--header-background);--tooltip-color: #000;--tooltip-background-light: #fff;--tooltip-background-dark: #fff;--background-color-error-focused: #a92222;--text-color-error-focused: #fff;--border-color-input-error-focused: #a92222;--background-color-error-not-focused: #fff;--text-color-error-not-focused: #a92222;--border-color-input-error-not-focused: #a92222}.sg-theme-hcl{--first-level-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.05), 0 1px 5px 0 rgba(0, 0, 0, 0.05);--second-level-box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.06), 0 4px 12px 0 rgba(0, 0, 0, 0.1);--third-level-box-shadow: 0 17px 40px 0 rgba(0, 0, 0, 0.17), 0 12px 15px 0 rgba(0, 0, 0, 0.2);--fourth-level-box-shadow: 0 25px 45px 0 rgba(0, 0, 0, 0.2), 0 16px 24px 0 rgba(0, 0, 0, 0.22);--fifth-level-box-shadow: 0 40px 60px 0 rgba(0, 0, 0, 0.22), 0 27px 22px 0 rgba(0, 0, 0, 0.2);--focus-shadow: inset 1px 1px 0 #24b8d2, inset -1px -1px 0 #24b8d2}@font-face{font-family:"Roboto";font-style:normal;font-weight:400;font-display:swap;src:local("Roboto"),local("Roboto-Regular"),local("sans-serif"),url("https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7GxKKTU1Kvnz.woff2") format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Roboto";font-style:normal;font-weight:400;font-display:swap;src:local("Roboto"),local("Roboto-Regular"),local("sans-serif"),url("https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Roboto";font-style:normal;font-weight:500;font-display:swap;src:local("Roboto Medium"),local("Roboto-Medium"),local("sans-serif-medium"),url("https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fChc4AMP6lbBP.woff2") format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Roboto";font-style:normal;font-weight:500;font-display:swap;src:local("Roboto Medium"),local("Roboto-Medium"),local("sans-serif-medium"),url("https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fBBc4AMP6lQ.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Roboto";font-style:normal;font-weight:700;font-display:swap;src:local("Roboto Bold"),local("Roboto-Bold"),local("sans-serif"),url("https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfChc4AMP6lbBP.woff2") format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Roboto";font-style:normal;font-weight:700;font-display:swap;src:local("Roboto Bold"),local("Roboto-Bold"),local("sans-serif"),url("https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4AMP6lQ.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Poppins";font-style:normal;font-weight:400;font-display:swap;src:local("Poppins"),local("Poppins-Regular"),local("sans-serif"),url("https://fonts.gstatic.com/s/poppins/v19/pxiEyp8kv8JHgFVrJJnecnFHGPezSQ.woff2") format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Poppins";font-style:normal;font-weight:400;font-display:swap;src:local("Poppins"),local("Poppins-Regular"),local("sans-serif"),url("https://fonts.gstatic.com/s/poppins/v19/pxiEyp8kv8JHgFVrJJfecnFHGPc.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Poppins";font-style:normal;font-weight:500;font-display:swap;src:local("Poppins Medium"),local("Poppins-Medium"),local("sans-serif"),url("https://fonts.gstatic.com/s/poppins/v19/pxiByp8kv8JHgFVrLGT9Z1JlFd2JQEl8qw.woff2") format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Poppins";font-style:normal;font-weight:500;font-display:swap;src:local("Poppins Medium"),local("Poppins-Medium"),local("sans-serif"),url("https://fonts.gstatic.com/s/poppins/v19/pxiByp8kv8JHgFVrLGT9Z1xlFd2JQEk.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"Poppins";font-style:normal;font-weight:700;font-display:swap;src:local("Poppins Bold"),local("Poppins-Bold"),local("sans-serif"),url("https://fonts.gstatic.com/s/poppins/v19/pxiByp8kv8JHgFVrLCz7Z1JlFd2JQEl8qw.woff2") format("woff2");unicode-range:U+0100-024F,U+0259,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"Poppins";font-style:normal;font-weight:700;font-display:swap;src:local("Poppins Bold"),local("Poppins-Bold"),local("sans-serif"),url("https://fonts.gstatic.com/s/poppins/v19/pxiByp8kv8JHgFVrLCz7Z1xlFd2JQEk.woff2") format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}*{box-sizing:border-box;margin:0;padding:0;scrollbar-face-color:var(--color-scrollbar);scrollbar-highlight-color:var(--color-scrollbar);scrollbar-shadow-color:var(--color-scrollbar);scrollbar-track-color:var(--color-scrollbar);-webkit-overflow-scrolling:touch}::-webkit-scrollbar{width:8px;height:8px;background-color:var(--color-scrollbar)}::-webkit-scrollbar-thumb{background-color:var(--color-scrollbar-thumb);border-radius:12px}::-webkit-scrollbar-thumb:hover{background-color:var(--color-scrollbar-thumb-hover)}::-webkit-scrollbar-corner{background-color:var(--color-scrollbar)}header,nav,section,main,article,aside,figure,toolbar,iframe,object,svg{display:block}html{background:#fff;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased}body{color:var(--typography-dark);background:var(--background-main);font-weight:400;font-size:16px;font-family:var(--font-family-default);line-height:26px}h1,h2,h3,h4,h5,h6{line-height:normal}dl,dt,dd,ul{list-style:none}ol{padding:0 0 0 20px}form,input,textarea,select{resize:none}form,textarea{width:100%}input,textarea,select{border-radius:0}input:focus,textarea:focus,select:focus{outline:none}input[type=submit]:focus,textarea[type=submit]:focus,select[type=submit]:focus{border:none !important}input:-internal-autofill-selected,textarea:-internal-autofill-selected,select:-internal-autofill-selected{transition:background-color 600000s 0s,color 600000s 0s}button{outline:none;border-radius:0}img{max-width:100%;height:auto;display:block;border:0}table{border-collapse:collapse}a{text-decoration:none;color:#000}:root{--z-index-page: 10;--z-index-pageHeader: 20;--z-index-drawer: 30;--z-index-sgValidation: 40;--z-index-dropdown: 50;--z-index-sticky: 60;--z-index-fixed: 70;--z-index-filter: 80;--z-index-chat: 90;--z-index-loadingModal: 100;--z-index-modalBackground: 110;--z-index-modal: 120;--z-index-contextWraper: 130;--z-index-chatNotificaion: 140;--z-index-notification: 150;--z-index-popover: 160;--z-index-popoverZoomIn: 170;--z-index-tooltip: 180}
2
+ #wpcontent{background:var(--background-main)}#adminmenu .wp-menu-image img{display:inline}.sg-security{min-height:100vh}.sg-security h1,.sg-security h2,.sg-security h3,.sg-security h4,.sg-security h5,.sg-security h6,.sg-security p,.sg-security li{margin:0}.sg-security input[type=checkbox],.sg-security input[type=radio]{display:none}.sg-dialog h1,.sg-dialog h2,.sg-dialog h3,.sg-dialog h4,.sg-dialog h5,.sg-dialog h6,.sg-dialog p,.sg-dialog li{margin:0}.sg-dialog input[type=checkbox],.sg-dialog input[type=radio]{display:none}
3
+ .sg-section{width:100%;transition:-webkit-transform 300ms linear 0ms;transition:transform 300ms linear 0ms;transition:transform 300ms linear 0ms, -webkit-transform 300ms linear 0ms}.sg-section+.sg-section{padding-top:0}.sg-section__content{margin:0 auto;max-width:1440px}.sg-section--expanded .sg-section__content{max-width:none}.sg-section--density-none .sg-section__content{padding-left:0;padding-right:0}.sg-section--density-cozy{padding-top:20px;padding-bottom:20px}.sg-section--density-cozy .sg-section__content{padding-left:20px;padding-right:20px}.sg-section--theme-white{background-color:var(--section-background-white)}.sg-section--theme-dark{background-color:var(--section-background-dark)}.sg-section--theme-light{background-color:var(--section-background-light)}.sg-section--theme-yellow{background-color:var(--section-background-yellow)}
4
+ .sg-grid{display:grid}.sg-grid:focus{outline:none}.sg-keyboard .sg-grid:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-grid>*{min-width:0}.sg-grid--justify-flex-start{justify-content:flex-start}.sg-grid--justify-center{justify-content:center}.sg-grid--justify-flex-end{justify-content:flex-end}.sg-grid--justify-space-between{justify-content:space-between}.sg-grid--justify-space-around{justify-content:space-around}.sg-grid--justify-items-flex-start{justify-items:flex-start}.sg-grid--justify-items-center{justify-items:center}.sg-grid--justify-items-flex-end{justify-items:flex-end}.sg-grid--justify-items-space-between{justify-items:space-between}.sg-grid--justify-items-space-around{justify-items:space-around}.sg-grid--align-self-flex-start{align-self:flex-start}.sg-grid--align-self-center{align-self:center}.sg-grid--align-self-start{align-self:start}.sg-grid--align-self-end{align-self:end}.sg-grid--align-self-self-start{align-self:self-start}.sg-grid--align-self-self-start{align-self:self-end}.sg-grid--align-self-flex-end{align-self:flex-end}.sg-grid--align-self-baseline{align-self:baseline}.sg-grid--align-self-stretch{align-self:stretch}.sg-grid--align-flex-start{align-items:flex-start}.sg-grid--align-center{align-items:center}.sg-grid--align-flex-end{align-items:flex-end}.sg-grid--align-baseline{align-items:baseline}.sg-grid--align-stretch{align-items:stretch}.sg-grid--autoflow-row{grid-auto-flow:row}.sg-grid--autoflow-column{grid-auto-flow:column}.sg-grid--gap-none{grid-gap:0}.sg-grid--gap-xx-small{grid-gap:5px}.sg-grid--gap-x-small{grid-gap:10px}.sg-grid--gap-small{grid-gap:15px}.sg-grid--gap-medium{grid-gap:20px}.sg-grid--gap-large{grid-gap:30px}.sg-grid--gap-x-large{grid-gap:40px}.sg-grid--gap-xx-large{grid-gap:60px}.sg-grid--gap-responsive{grid-gap:30px}@media(max-width: 1500px){.sg-grid--gap-responsive{grid-gap:20px}}.sg-grid--xs-1{grid-template-columns:repeat(1, 1fr)}.sg-grid--xs-2{grid-template-columns:repeat(2, 1fr)}.sg-grid--xs-3{grid-template-columns:repeat(3, 1fr)}.sg-grid--xs-4{grid-template-columns:repeat(4, 1fr)}.sg-grid--xs-5{grid-template-columns:repeat(5, 1fr)}.sg-grid--xs-6{grid-template-columns:repeat(6, 1fr)}.sg-grid--xs-7{grid-template-columns:repeat(7, 1fr)}.sg-grid--xs-8{grid-template-columns:repeat(8, 1fr)}.sg-grid--xs-9{grid-template-columns:repeat(9, 1fr)}.sg-grid--xs-10{grid-template-columns:repeat(10, 1fr)}.sg-grid--xs-11{grid-template-columns:repeat(11, 1fr)}.sg-grid--xs-12{grid-template-columns:repeat(12, 1fr)}.sg-grid--xs-13{grid-template-columns:repeat(13, 1fr)}.sg-grid--xs-14{grid-template-columns:repeat(14, 1fr)}@media(min-width: 801px){.sg-grid--sm-1{grid-template-columns:repeat(1, 1fr)}.sg-grid--sm-2{grid-template-columns:repeat(2, 1fr)}.sg-grid--sm-3{grid-template-columns:repeat(3, 1fr)}.sg-grid--sm-4{grid-template-columns:repeat(4, 1fr)}.sg-grid--sm-5{grid-template-columns:repeat(5, 1fr)}.sg-grid--sm-6{grid-template-columns:repeat(6, 1fr)}.sg-grid--sm-7{grid-template-columns:repeat(7, 1fr)}.sg-grid--sm-8{grid-template-columns:repeat(8, 1fr)}.sg-grid--sm-9{grid-template-columns:repeat(9, 1fr)}.sg-grid--sm-10{grid-template-columns:repeat(10, 1fr)}.sg-grid--sm-11{grid-template-columns:repeat(11, 1fr)}.sg-grid--sm-12{grid-template-columns:repeat(12, 1fr)}.sg-grid--sm-13{grid-template-columns:repeat(13, 1fr)}.sg-grid--sm-14{grid-template-columns:repeat(14, 1fr)}.sg-grid--auto-fit{grid-template-columns:repeat(auto-fit, minmax(0, 1fr))}}@media(min-width: 1024px){.sg-grid--m-1{grid-template-columns:repeat(1, 1fr)}.sg-grid--m-2{grid-template-columns:repeat(2, 1fr)}.sg-grid--m-3{grid-template-columns:repeat(3, 1fr)}.sg-grid--m-4{grid-template-columns:repeat(4, 1fr)}.sg-grid--m-5{grid-template-columns:repeat(5, 1fr)}.sg-grid--m-6{grid-template-columns:repeat(6, 1fr)}.sg-grid--m-7{grid-template-columns:repeat(7, 1fr)}.sg-grid--m-8{grid-template-columns:repeat(8, 1fr)}.sg-grid--m-9{grid-template-columns:repeat(9, 1fr)}.sg-grid--m-10{grid-template-columns:repeat(10, 1fr)}.sg-grid--m-11{grid-template-columns:repeat(11, 1fr)}.sg-grid--m-12{grid-template-columns:repeat(12, 1fr)}.sg-grid--m-13{grid-template-columns:repeat(13, 1fr)}.sg-grid--m-14{grid-template-columns:repeat(14, 1fr)}}@media(min-width: 1501px){.sg-grid--lg-1{grid-template-columns:repeat(1, 1fr)}.sg-grid--lg-2{grid-template-columns:repeat(2, 1fr)}.sg-grid--lg-3{grid-template-columns:repeat(3, 1fr)}.sg-grid--lg-4{grid-template-columns:repeat(4, 1fr)}.sg-grid--lg-5{grid-template-columns:repeat(5, 1fr)}.sg-grid--lg-6{grid-template-columns:repeat(6, 1fr)}.sg-grid--lg-7{grid-template-columns:repeat(7, 1fr)}.sg-grid--lg-8{grid-template-columns:repeat(8, 1fr)}.sg-grid--lg-9{grid-template-columns:repeat(9, 1fr)}.sg-grid--lg-10{grid-template-columns:repeat(10, 1fr)}.sg-grid--lg-11{grid-template-columns:repeat(11, 1fr)}.sg-grid--lg-12{grid-template-columns:repeat(12, 1fr)}.sg-grid--lg-13{grid-template-columns:repeat(13, 1fr)}.sg-grid--lg-14{grid-template-columns:repeat(14, 1fr)}}
5
+ .sg-with-padding.sg-with-padding.sg-with-padding--padding-top-none{padding-top:0}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-none{padding-right:0}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-none{padding-bottom:0}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-none{padding-left:0}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-xx-small{padding-top:5px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-xx-small{padding-right:5px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-xx-small{padding-bottom:5px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-xx-small{padding-left:5px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-x-small{padding-top:10px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-x-small{padding-right:10px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-x-small{padding-bottom:10px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-x-small{padding-left:10px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-small{padding-top:15px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-small{padding-right:15px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-small{padding-bottom:15px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-small{padding-left:15px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-medium{padding-top:20px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-medium{padding-right:20px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-medium{padding-bottom:20px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-medium{padding-left:20px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-large{padding-top:30px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-large{padding-right:30px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-large{padding-bottom:30px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-large{padding-left:30px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-x-large{padding-top:40px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-x-large{padding-right:40px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-x-large{padding-bottom:40px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-x-large{padding-left:40px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-top-xx-large{padding-top:60px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-right-xx-large{padding-right:60px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-bottom-xx-large{padding-bottom:60px}.sg-with-padding.sg-with-padding.sg-with-padding--padding-left-xx-large{padding-left:60px}.sg-with-padding--padding-top-responsive{padding-top:30px}.sg-with-padding--padding-right-responsive{padding-right:30px}.sg-with-padding--padding-bottom-responsive{padding-bottom:30px}.sg-with-padding--padding-left-responsive{padding-left:30px}@media(max-width: 1500px){.sg-with-padding--padding-top-responsive{padding-top:20px}.sg-with-padding--padding-right-responsive{padding-right:20px}.sg-with-padding--padding-bottom-responsive{padding-bottom:20px}.sg-with-padding--padding-left-responsive{padding-left:20px}}
6
+ .sg-with-border--radius-none{border-radius:0}.sg-with-border--radius-inherit{border-radius:inherit}.sg-with-border--radius-default{border-radius:12px}.sg-with-border--border-top-none{border-top:0 solid var(--border-color-outer)}.sg-with-border--border-right-none{border-right:0 solid var(--border-color-outer)}.sg-with-border--border-bottom-none{border-bottom:0 solid var(--border-color-outer)}.sg-with-border--border-left-none{border-left:0 solid var(--border-color-outer)}.sg-with-border--border-top-small{border-top:1px solid var(--border-color-outer)}.sg-with-border--border-right-small{border-right:1px solid var(--border-color-outer)}.sg-with-border--border-bottom-small{border-bottom:1px solid var(--border-color-outer)}.sg-with-border--border-left-small{border-left:1px solid var(--border-color-outer)}.sg-with-border--border-top-medium{border-top:2px solid var(--border-color-outer)}.sg-with-border--border-right-medium{border-right:2px solid var(--border-color-outer)}.sg-with-border--border-bottom-medium{border-bottom:2px solid var(--border-color-outer)}.sg-with-border--border-left-medium{border-left:2px solid var(--border-color-outer)}.sg-with-border--border-top-inherit{border-top:inherit solid var(--border-color-outer)}.sg-with-border--border-right-inherit{border-right:inherit solid var(--border-color-outer)}.sg-with-border--border-bottom-inherit{border-bottom:inherit solid var(--border-color-outer)}.sg-with-border--border-left-inherit{border-left:inherit solid var(--border-color-outer)}
7
+ .sg-title--level-1{font-size:40px;line-height:56px}.sg-title--level-2{font-size:32px;line-height:40px}.sg-title--level-3{font-size:26px;line-height:36px}.sg-title--level-4{font-size:22px;line-height:32px}.sg-title--level-5{font-size:18px;line-height:28px}.sg-title--level-6{font-size:18px;line-height:28px;text-transform:uppercase}.sg-title{font-family:var(--font-family-component);max-width:100%}.sg-title:focus{outline:none}.sg-keyboard .sg-title:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-title--density-airy.sg-title--level-1{padding:32px 0}.sg-title--density-airy.sg-title--level-2{padding:34px 0}.sg-title--density-airy.sg-title--level-3{padding:34px 0}.sg-title--density-airy.sg-title--level-4{padding:36px 0}.sg-title--density-airy.sg-title--level-5{padding:35px 0}.sg-title--density-airy.sg-title--level-6{padding:35px 0}.sg-title--density-comfortable.sg-title--level-1{padding:22px 0}.sg-title--density-comfortable.sg-title--level-2{padding:24px 0}.sg-title--density-comfortable.sg-title--level-3{padding:24px 0}.sg-title--density-comfortable.sg-title--level-4{padding:26px 0}.sg-title--density-comfortable.sg-title--level-5{padding:25px 0}.sg-title--density-comfortable.sg-title--level-6{padding:25px 0}.sg-title--density-cozy.sg-title--level-1{padding:12px 0}.sg-title--density-cozy.sg-title--level-2{padding:14px 0}.sg-title--density-cozy.sg-title--level-3{padding:14px 0}.sg-title--density-cozy.sg-title--level-4{padding:16px 0}.sg-title--density-cozy.sg-title--level-5{padding:15px 0}.sg-title--density-cozy.sg-title--level-6{padding:15px 0}.sg-title--density-compact.sg-title--level-1{padding:2px 0}.sg-title--density-compact.sg-title--level-2{padding:4px 0}.sg-title--density-compact.sg-title--level-3{padding:4px 0}.sg-title--density-compact.sg-title--level-4{padding:6px 0}.sg-title--density-compact.sg-title--level-5{padding:5px 0}.sg-title--density-compact.sg-title--level-6{padding:5px 0}.sg-title--density-none{padding:0}@media(max-width: 1500px){.sg-title--level-1{font-size:30px;line-height:46px}.sg-title--level-2{font-size:28px;line-height:38px}.sg-title--level-3{font-size:24px;line-height:34px}.sg-title--level-4{font-size:20px;line-height:30px}.sg-title--density-airy.sg-title--level-1{padding:16px 0}.sg-title--density-airy.sg-title--level-2{padding:18px 0}.sg-title--density-airy.sg-title--level-3{padding:18px 0}.sg-title--density-airy.sg-title--level-4{padding:20px 0}.sg-title--density-airy.sg-title--level-5{padding:22px 0}.sg-title--density-airy.sg-title--level-6{padding:22px 0}.sg-title--density-comfortable.sg-title--level-1{padding:6px 0}.sg-title--density-comfortable.sg-title--level-2{padding:8px 0}.sg-title--density-comfortable.sg-title--level-3{padding:8px 0}.sg-title--density-comfortable.sg-title--level-4{padding:10px 0}.sg-title--density-comfortable.sg-title--level-5{padding:10px 0}.sg-title--density-comfortable.sg-title--level-6{padding:10px 0}.sg-title--density-cozy.sg-title--level-4{padding:10px 0}.sg-title--density-cozy.sg-title--level-5{padding:10px 0}.sg-title--density-cozy.sg-title--level-6{padding:10px 0}}
8
+ .sg-with-color.sg-with-color--color-primary{color:var(--color-primary)}.sg-with-color.sg-with-color--color-success{color:var(--color-success)}.sg-with-color.sg-with-color--color-error{color:var(--color-error)}.sg-with-color.sg-with-color--color-warning{color:var(--color-warning)}.sg-with-color.sg-with-color--color-info{color:var(--color-info)}.sg-with-color.sg-with-color--color-instruction{color:var(--color-instruction)}.sg-with-color.sg-with-color--color-white{color:var(--typography-white)}.sg-with-color.sg-with-color--color-light{color:var(--typography-light)}.sg-with-color.sg-with-color--color-dark{color:var(--typography-dark)}
9
+ .sg-typography--align-left{text-align:left;align-self:flex-start}.sg-typography--align-center{text-align:center;align-self:center}.sg-typography--align-right{text-align:right;align-self:flex-end}.sg-typography--transform-capitalize{text-transform:capitalize}.sg-typography--transform-lowercase{text-transform:lowercase}.sg-typography--transform-uppercase{text-transform:uppercase}.sg-typography--weight-light{font-weight:300}.sg-typography--weight-regular{font-weight:400}.sg-typography--weight-medium{font-weight:500}.sg-typography--weight-bold{font-weight:600}.sg-typography--weight-extra-bold{font-weight:700}.sg-typography--italic{font-style:italic}.sg-typography--truncate{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sg-typography--break-all{word-break:break-all}.sg-typography--break-word{word-break:break-word}
10
+ .sg-card{border-radius:12px;background:var(--background-component-primary);border:1px solid transparent;position:relative}.sg-card:focus{outline:none}.sg-keyboard .sg-card:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-card__content-wrapper--row{height:100%;grid-auto-flow:row;grid-template-rows:auto 1fr}.sg-card__content-wrapper--row .sg-card__content{text-align:center}.sg-card__content-wrapper--column{grid-auto-flow:column}.sg-card__content-wrapper--column .sg-card__content{text-align:left}.sg-card__content-wrapper--column.sg-card__content-wrapper{grid-template-columns:160px 1fr}.sg-card__content-wrapper--column.sg-card__content-wrapper--divided{grid-template-columns:160px 1px 1fr}.sg-card--outline-shadow{box-shadow:var(--first-level-box-shadow)}.sg-card--outline-shadow:focus{outline:none}.sg-keyboard .sg-card--outline-shadow:focus{outline:none;box-shadow:var(--first-level-box-shadow),var(--focus-shadow)}.sg-card--outline-border{border:1px solid var(--border-color-outer)}.sg-card--selected::before{content:" ";position:absolute;display:block;top:-1px;bottom:-1px;right:-1px;left:-1px;border:2px solid var(--background-button-primary-hovered);border-radius:12px;pointer-events:none}.sg-card__icon-wrapper{text-align:center}.sg-card__divider::before{content:" ";position:absolute;display:block;top:0;bottom:0;border-left:1px solid var(--border-color-outer)}.sg-card__content--vertical{text-align:center;grid-template-rows:auto 1fr}.sg-card__content--vertical .sg-card__actions-wrapper{align-self:flex-end}
11
+ .sg-icon{display:inline-block;flex-grow:0;flex-shrink:0}.sg-icon:focus{outline:none}.sg-keyboard .sg-icon:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-icon svg{fill:currentColor}.sg-icon .theme-foreground{fill:#fff}.sg-theme-hcl .sg-icon .theme-foreground{fill:#000}.sg-icon--presized svg{max-width:100%;max-height:100%}.sg-icon--interactive{cursor:pointer}.sg-icon--use-css-colors path,.sg-icon--use-css-colors polygon,.sg-icon--use-css-colors circle,.sg-icon--use-css-colors rect,.sg-icon--use-css-colors ellipse{fill:currentColor}.sg-icon--color-info path,.sg-icon--color-info polygon,.sg-icon--color-info circle,.sg-icon--color-info rect,.sg-icon--color-info ellipse{fill:var(--icon-color-royal)}.sg-icon--color-info.sg-icon--fill-light .sgmaincolor{fill:var(--icon-color-royal-light)}.sg-icon--color-info.sg-icon--fill-lighter .sgmaincolor{fill:var(--icon-color-royal-lighter)}.sg-icon--color-primary path,.sg-icon--color-primary polygon,.sg-icon--color-primary circle,.sg-icon--color-primary rect,.sg-icon--color-primary ellipse{fill:var(--icon-color)}.sg-icon--color-primary.sg-icon--fill-light .sgmaincolor{fill:var(--icon-color-light)}.sg-icon--color-primary.sg-icon--fill-lighter .sgmaincolor{fill:var(--icon-color-lighter)}.sg-icon--color-success path,.sg-icon--color-success polygon,.sg-icon--color-success circle,.sg-icon--color-success rect,.sg-icon--color-success ellipse{fill:var(--icon-color-mint)}.sg-icon--color-success.sg-icon--fill-light .sgmaincolor{fill:var(--icon-color-mint-light)}.sg-icon--color-success.sg-icon--fill-lighter .sgmaincolor{fill:var(--icon-color-mint-lighter)}.sg-icon--color-warning path,.sg-icon--color-warning polygon,.sg-icon--color-warning circle,.sg-icon--color-warning rect,.sg-icon--color-warning ellipse{fill:var(--icon-color-salmon)}.sg-icon--color-warning.sg-icon--fill-light .sgmaincolor{fill:var(--icon-color-salmon-light)}.sg-icon--color-warning.sg-icon--fill-lighter .sgmaincolor{fill:var(--icon-color-salmon-lighter)}.sg-icon--color-info path,.sg-icon--color-info polygon,.sg-icon--color-info circle,.sg-icon--color-info rect,.sg-icon--color-info ellipse{fill:var(--icon-color-mango)}.sg-icon--color-info.sg-icon--fill-light .sgmaincolor{fill:var(--icon-color-mango-light)}.sg-icon--color-info.sg-icon--fill-lighter .sgmaincolor{fill:var(--icon-color-mango-lighter)}.sg-icon--color-information path,.sg-icon--color-information polygon,.sg-icon--color-information circle,.sg-icon--color-information rect,.sg-icon--color-information ellipse{fill:var(--icon-color-mango)}.sg-icon--color-information.sg-icon--fill-light .sgmaincolor{fill:var(--icon-color-mango-light)}.sg-icon--color-information.sg-icon--fill-lighter .sgmaincolor{fill:var(--icon-color-mango-lighter)}.sg-theme-hcl .sg-icon--color-info path,.sg-theme-hcl .sg-icon--color-info polygon,.sg-theme-hcl .sg-icon--color-info circle,.sg-theme-hcl .sg-icon--color-info rect,.sg-theme-hcl .sg-icon--color-info ellipse,.sg-theme-hcl .sg-icon--color-primary path,.sg-theme-hcl .sg-icon--color-primary polygon,.sg-theme-hcl .sg-icon--color-primary circle,.sg-theme-hcl .sg-icon--color-primary rect,.sg-theme-hcl .sg-icon--color-primary ellipse,.sg-theme-hcl .sg-icon--color-success path,.sg-theme-hcl .sg-icon--color-success polygon,.sg-theme-hcl .sg-icon--color-success circle,.sg-theme-hcl .sg-icon--color-success rect,.sg-theme-hcl .sg-icon--color-success ellipse,.sg-theme-hcl .sg-icon--color-warning path,.sg-theme-hcl .sg-icon--color-warning polygon,.sg-theme-hcl .sg-icon--color-warning circle,.sg-theme-hcl .sg-icon--color-warning rect,.sg-theme-hcl .sg-icon--color-warning ellipse,.sg-theme-hcl .sg-icon--color-info path,.sg-theme-hcl .sg-icon--color-info polygon,.sg-theme-hcl .sg-icon--color-info circle,.sg-theme-hcl .sg-icon--color-info rect,.sg-theme-hcl .sg-icon--color-info ellipse,.sg-theme-hcl .sg-icon--color-information path,.sg-theme-hcl .sg-icon--color-information polygon,.sg-theme-hcl .sg-icon--color-information circle,.sg-theme-hcl .sg-icon--color-information rect,.sg-theme-hcl .sg-icon--color-information ellipse,.sg-theme-hcb .sg-icon--color-info path,.sg-theme-hcb .sg-icon--color-info polygon,.sg-theme-hcb .sg-icon--color-info circle,.sg-theme-hcb .sg-icon--color-info rect,.sg-theme-hcb .sg-icon--color-info ellipse,.sg-theme-hcb .sg-icon--color-primary path,.sg-theme-hcb .sg-icon--color-primary polygon,.sg-theme-hcb .sg-icon--color-primary circle,.sg-theme-hcb .sg-icon--color-primary rect,.sg-theme-hcb .sg-icon--color-primary ellipse,.sg-theme-hcb .sg-icon--color-success path,.sg-theme-hcb .sg-icon--color-success polygon,.sg-theme-hcb .sg-icon--color-success circle,.sg-theme-hcb .sg-icon--color-success rect,.sg-theme-hcb .sg-icon--color-success ellipse,.sg-theme-hcb .sg-icon--color-warning path,.sg-theme-hcb .sg-icon--color-warning polygon,.sg-theme-hcb .sg-icon--color-warning circle,.sg-theme-hcb .sg-icon--color-warning rect,.sg-theme-hcb .sg-icon--color-warning ellipse,.sg-theme-hcb .sg-icon--color-info path,.sg-theme-hcb .sg-icon--color-info polygon,.sg-theme-hcb .sg-icon--color-info circle,.sg-theme-hcb .sg-icon--color-info rect,.sg-theme-hcb .sg-icon--color-info ellipse,.sg-theme-hcb .sg-icon--color-information path,.sg-theme-hcb .sg-icon--color-information polygon,.sg-theme-hcb .sg-icon--color-information circle,.sg-theme-hcb .sg-icon--color-information rect,.sg-theme-hcb .sg-icon--color-information ellipse{fill:var(--high-contrast-foreground)}.sg-theme-hcl .sg-icon--color-info.sg-icon--fill-light .sgmaincolor,.sg-theme-hcl .sg-icon--color-primary.sg-icon--fill-light .sgmaincolor,.sg-theme-hcl .sg-icon--color-success.sg-icon--fill-light .sgmaincolor,.sg-theme-hcl .sg-icon--color-warning.sg-icon--fill-light .sgmaincolor,.sg-theme-hcl .sg-icon--color-info.sg-icon--fill-light .sgmaincolor,.sg-theme-hcl .sg-icon--color-information.sg-icon--fill-light .sgmaincolor,.sg-theme-hcb .sg-icon--color-info.sg-icon--fill-light .sgmaincolor,.sg-theme-hcb .sg-icon--color-primary.sg-icon--fill-light .sgmaincolor,.sg-theme-hcb .sg-icon--color-success.sg-icon--fill-light .sgmaincolor,.sg-theme-hcb .sg-icon--color-warning.sg-icon--fill-light .sgmaincolor,.sg-theme-hcb .sg-icon--color-info.sg-icon--fill-light .sgmaincolor,.sg-theme-hcb .sg-icon--color-information.sg-icon--fill-light .sgmaincolor{fill:transparent}.sg-theme-hcl .sg-icon--color-info.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcl .sg-icon--color-primary.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcl .sg-icon--color-success.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcl .sg-icon--color-warning.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcl .sg-icon--color-info.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcl .sg-icon--color-information.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcb .sg-icon--color-info.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcb .sg-icon--color-primary.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcb .sg-icon--color-success.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcb .sg-icon--color-warning.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcb .sg-icon--color-info.sg-icon--fill-lighter .sgmaincolor,.sg-theme-hcb .sg-icon--color-information.sg-icon--fill-lighter .sgmaincolor{fill:transparent}.sg-icon-loader-circular{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;height:100%;-webkit-transform-origin:center center;transform-origin:center center;width:100%;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto}.sg-icon-loader-path{stroke-dasharray:1,200;stroke-dashoffset:0;-webkit-animation:dash-animation 1.5s ease-in-out infinite,color-animation 2s ease-in-out infinite;animation:dash-animation 1.5s ease-in-out infinite,color-animation 2s ease-in-out infinite;stroke-linecap:round}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes dash-animation{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@keyframes dash-animation{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}100%{stroke-dasharray:89,200;stroke-dashoffset:-124px}}@-webkit-keyframes color-animation{100%,0%{stroke:var(--color-warning)}20%{stroke:var(--color-success)}66%{stroke:var(--color-primary)}}@keyframes color-animation{100%,0%{stroke:var(--color-warning)}20%{stroke:var(--color-success)}66%{stroke:var(--color-primary)}}
12
+ .sg-tooltip{position:absolute;max-width:500px;overflow-wrap:break-word;box-shadow:var(--first-level-box-shadow);border-radius:12px;font-size:14px;line-height:18px;color:var(--tooltip-color);z-index:180}.sg-tooltip--background-black{background-color:var(--tooltip-background-dark)}.sg-tooltip--background-white{background-color:var(--tooltip-background-light)}.sg-tooltip--density-cozy{padding:5px 10px}.sg-tooltip--density-none{padding:0}
13
+ .sg-text{word-break:break-word}.sg-text--size-small{font-size:14px;line-height:18px}.sg-text--size-medium{font-size:16px;line-height:26px}.sg-text--size-large{font-size:18px;line-height:28px}.sg-text--size-x-large{font-size:22px;line-height:32px}.sg-text--size-inherit{font-size:inherit;line-height:inherit}
14
+ .sg-card-notifications{border-top:2px solid var(--color-error)}.sg-card-notification{grid-template-columns:auto 1fr auto}.sg-card-notification:focus{outline:none}.sg-keyboard .sg-card-notification:focus{outline:none;box-shadow:var(--first-level-box-shadow),var(--focus-shadow)}.sg-card-notification:last-child{border:none}@media(max-width: 800px){.sg-card-notification{grid-template-columns:auto}}.sg-card-notification--description a{color:var(--color-primary)}.sg-card-notification--description a:visited{color:var(--color-info)}
15
+ .sg-container{display:flex;flex-direction:column;border-radius:12px;background:var(--background-component-primary)}.sg-theme-hcl .sg-container,.sg-theme-hcb .sg-container{border:1px solid var(--high-contrast-foreground)}.sg-container--elevation-1{box-shadow:var(--first-level-box-shadow)}.sg-container--elevation-1:focus{outline:none}.sg-keyboard .sg-container--elevation-1:focus{outline:none;box-shadow:var(--first-level-box-shadow),var(--focus-shadow)}.sg-container--elevation-2{box-shadow:var(--second-level-box-shadow)}.sg-container--elevation-2:focus{outline:none}.sg-keyboard .sg-container--elevation-2:focus{outline:none;box-shadow:var(--second-level-box-shadow),var(--focus-shadow)}.sg-container--elevation-3{box-shadow:var(--third-level-box-shadow)}.sg-container--elevation-3:focus{outline:none}.sg-keyboard .sg-container--elevation-3:focus{outline:none;box-shadow:var(--third-level-box-shadow),var(--focus-shadow)}.sg-container--elevation-4{box-shadow:var(--fourth-level-box-shadow)}.sg-container--elevation-4:focus{outline:none}.sg-keyboard .sg-container--elevation-4:focus{outline:none;box-shadow:var(--fourth-level-box-shadow),var(--focus-shadow)}.sg-container--elevation-5{box-shadow:var(--fifth-level-box-shadow)}.sg-container--elevation-5:focus{outline:none}.sg-keyboard .sg-container--elevation-5:focus{outline:none;box-shadow:var(--fifth-level-box-shadow),var(--focus-shadow)}
16
+ .sg-grid-column{border-radius:inherit}.sg-grid-column--flex{display:flex}.sg-grid-column--justify-flex-start{justify-content:flex-start}.sg-grid-column--justify-center{justify-content:center}.sg-grid-column--justify-flex-end{justify-content:flex-end}.sg-grid-column--justify-space-between{justify-content:space-between}.sg-grid-column--justify-space-around{justify-content:space-around}.sg-grid-column--justify-self-flex-start{justify-self:flex-start}.sg-grid-column--justify-self-center{justify-self:center}.sg-grid-column--justify-self-flex-end{justify-self:flex-end}.sg-grid-column--justify-self-stretch{justify-self:stretch}.sg-grid-column--align-flex-start{align-items:flex-start}.sg-grid-column--align-center{align-items:center}.sg-grid-column--align-flex-end{align-items:flex-end}.sg-grid-column--align-baseline{align-items:baseline}.sg-grid-column--align-stretch{align-items:stretch}.sg-grid-column--xs-span-1{grid-column-end:span 1}.sg-grid-column--xs-span-2{grid-column-end:span 2}.sg-grid-column--xs-span-3{grid-column-end:span 3}.sg-grid-column--xs-span-4{grid-column-end:span 4}.sg-grid-column--xs-span-5{grid-column-end:span 5}.sg-grid-column--xs-span-6{grid-column-end:span 6}.sg-grid-column--xs-span-7{grid-column-end:span 7}.sg-grid-column--xs-span-8{grid-column-end:span 8}.sg-grid-column--xs-span-9{grid-column-end:span 9}.sg-grid-column--xs-span-10{grid-column-end:span 10}.sg-grid-column--xs-span-11{grid-column-end:span 11}.sg-grid-column--xs-span-12{grid-column-end:span 12}.sg-grid-column--xs-span-13{grid-column-end:span 13}.sg-grid-column--xs-span-14{grid-column-end:span 14}.sg-grid-column--xs-start-1{grid-column-start:1}.sg-grid-column--xs-start-2{grid-column-start:2}.sg-grid-column--xs-start-3{grid-column-start:3}.sg-grid-column--xs-start-4{grid-column-start:4}.sg-grid-column--xs-start-5{grid-column-start:5}.sg-grid-column--xs-start-6{grid-column-start:6}.sg-grid-column--xs-start-7{grid-column-start:7}.sg-grid-column--xs-start-8{grid-column-start:8}.sg-grid-column--xs-start-9{grid-column-start:9}.sg-grid-column--xs-start-10{grid-column-start:10}.sg-grid-column--xs-start-11{grid-column-start:11}.sg-grid-column--xs-start-12{grid-column-start:12}.sg-grid-column--xs-start-13{grid-column-start:13}.sg-grid-column--xs-start-14{grid-column-start:14}@media(min-width: 801px){.sg-grid-column--sm-span-1{grid-column-end:span 1}.sg-grid-column--sm-span-2{grid-column-end:span 2}.sg-grid-column--sm-span-3{grid-column-end:span 3}.sg-grid-column--sm-span-4{grid-column-end:span 4}.sg-grid-column--sm-span-5{grid-column-end:span 5}.sg-grid-column--sm-span-6{grid-column-end:span 6}.sg-grid-column--sm-span-7{grid-column-end:span 7}.sg-grid-column--sm-span-8{grid-column-end:span 8}.sg-grid-column--sm-span-9{grid-column-end:span 9}.sg-grid-column--sm-span-10{grid-column-end:span 10}.sg-grid-column--sm-span-11{grid-column-end:span 11}.sg-grid-column--sm-span-12{grid-column-end:span 12}.sg-grid-column--sm-span-13{grid-column-end:span 13}.sg-grid-column--sm-span-14{grid-column-end:span 14}.sg-grid-column--sm-start-1{grid-column-start:1}.sg-grid-column--sm-start-2{grid-column-start:2}.sg-grid-column--sm-start-3{grid-column-start:3}.sg-grid-column--sm-start-4{grid-column-start:4}.sg-grid-column--sm-start-5{grid-column-start:5}.sg-grid-column--sm-start-6{grid-column-start:6}.sg-grid-column--sm-start-7{grid-column-start:7}.sg-grid-column--sm-start-8{grid-column-start:8}.sg-grid-column--sm-start-9{grid-column-start:9}.sg-grid-column--sm-start-10{grid-column-start:10}.sg-grid-column--sm-start-11{grid-column-start:11}.sg-grid-column--sm-start-12{grid-column-start:12}.sg-grid-column--sm-start-13{grid-column-start:13}.sg-grid-column--sm-start-14{grid-column-start:14}}@media(min-width: 1024px){.sg-grid-column--m-span-1{grid-column-end:span 1}.sg-grid-column--m-span-2{grid-column-end:span 2}.sg-grid-column--m-span-3{grid-column-end:span 3}.sg-grid-column--m-span-4{grid-column-end:span 4}.sg-grid-column--m-span-5{grid-column-end:span 5}.sg-grid-column--m-span-6{grid-column-end:span 6}.sg-grid-column--m-span-7{grid-column-end:span 7}.sg-grid-column--m-span-8{grid-column-end:span 8}.sg-grid-column--m-span-9{grid-column-end:span 9}.sg-grid-column--m-span-10{grid-column-end:span 10}.sg-grid-column--m-span-11{grid-column-end:span 11}.sg-grid-column--m-span-12{grid-column-end:span 12}.sg-grid-column--m-span-13{grid-column-end:span 13}.sg-grid-column--m-span-14{grid-column-end:span 14}.sg-grid-column--m-start-1{grid-column-start:1}.sg-grid-column--m-start-2{grid-column-start:2}.sg-grid-column--m-start-3{grid-column-start:3}.sg-grid-column--m-start-4{grid-column-start:4}.sg-grid-column--m-start-5{grid-column-start:5}.sg-grid-column--m-start-6{grid-column-start:6}.sg-grid-column--m-start-7{grid-column-start:7}.sg-grid-column--m-start-8{grid-column-start:8}.sg-grid-column--m-start-9{grid-column-start:9}.sg-grid-column--m-start-10{grid-column-start:10}.sg-grid-column--m-start-11{grid-column-start:11}.sg-grid-column--m-start-12{grid-column-start:12}.sg-grid-column--m-start-13{grid-column-start:13}.sg-grid-column--m-start-14{grid-column-start:14}}@media(min-width: 1501px){.sg-grid-column--lg-span-1{grid-column-end:span 1}.sg-grid-column--lg-span-2{grid-column-end:span 2}.sg-grid-column--lg-span-3{grid-column-end:span 3}.sg-grid-column--lg-span-4{grid-column-end:span 4}.sg-grid-column--lg-span-5{grid-column-end:span 5}.sg-grid-column--lg-span-6{grid-column-end:span 6}.sg-grid-column--lg-span-7{grid-column-end:span 7}.sg-grid-column--lg-span-8{grid-column-end:span 8}.sg-grid-column--lg-span-9{grid-column-end:span 9}.sg-grid-column--lg-span-10{grid-column-end:span 10}.sg-grid-column--lg-span-11{grid-column-end:span 11}.sg-grid-column--lg-span-12{grid-column-end:span 12}.sg-grid-column--lg-span-13{grid-column-end:span 13}.sg-grid-column--lg-span-14{grid-column-end:span 14}.sg-grid-column--lg-start-1{grid-column-start:1}.sg-grid-column--lg-start-2{grid-column-start:2}.sg-grid-column--lg-start-3{grid-column-start:3}.sg-grid-column--lg-start-4{grid-column-start:4}.sg-grid-column--lg-start-5{grid-column-start:5}.sg-grid-column--lg-start-6{grid-column-start:6}.sg-grid-column--lg-start-7{grid-column-start:7}.sg-grid-column--lg-start-8{grid-column-start:8}.sg-grid-column--lg-start-9{grid-column-start:9}.sg-grid-column--lg-start-10{grid-column-start:10}.sg-grid-column--lg-start-11{grid-column-start:11}.sg-grid-column--lg-start-12{grid-column-start:12}.sg-grid-column--lg-start-13{grid-column-start:13}.sg-grid-column--lg-start-14{grid-column-start:14}}.sg-grid-column--ie11.sg-grid-column--xs-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--ie11.sg-grid-column--xs-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--ie11.sg-grid-column--xs-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--ie11.sg-grid-column--xs-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--ie11.sg-grid-column--xs-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--ie11.sg-grid-column--xs-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--ie11.sg-grid-column--xs-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--ie11.sg-grid-column--xs-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--ie11.sg-grid-column--xs-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--ie11.sg-grid-column--xs-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--ie11.sg-grid-column--xs-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--ie11.sg-grid-column--xs-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--ie11.sg-grid-column--xs-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--ie11.sg-grid-column--xs-span-14{width:calc((100% - 1px) / 14 * 14)}@media(min-width: 801px){.sg-grid-column--ie11.sg-grid-column--sm-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--ie11.sg-grid-column--sm-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--ie11.sg-grid-column--sm-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--ie11.sg-grid-column--sm-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--ie11.sg-grid-column--sm-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--ie11.sg-grid-column--sm-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--ie11.sg-grid-column--sm-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--ie11.sg-grid-column--sm-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--ie11.sg-grid-column--sm-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--ie11.sg-grid-column--sm-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--ie11.sg-grid-column--sm-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--ie11.sg-grid-column--sm-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--ie11.sg-grid-column--sm-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--ie11.sg-grid-column--sm-span-14{width:calc((100% - 1px) / 14 * 14)}}@media(min-width: 1024px){.sg-grid-column--ie11.sg-grid-column--m-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--ie11.sg-grid-column--m-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--ie11.sg-grid-column--m-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--ie11.sg-grid-column--m-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--ie11.sg-grid-column--m-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--ie11.sg-grid-column--m-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--ie11.sg-grid-column--m-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--ie11.sg-grid-column--m-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--ie11.sg-grid-column--m-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--ie11.sg-grid-column--m-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--ie11.sg-grid-column--m-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--ie11.sg-grid-column--m-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--ie11.sg-grid-column--m-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--ie11.sg-grid-column--m-span-14{width:calc((100% - 1px) / 14 * 14)}}@media(min-width: 1501px){.sg-grid-column--ie11.sg-grid-column--lg-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--ie11.sg-grid-column--lg-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--ie11.sg-grid-column--lg-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--ie11.sg-grid-column--lg-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--ie11.sg-grid-column--lg-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--ie11.sg-grid-column--lg-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--ie11.sg-grid-column--lg-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--ie11.sg-grid-column--lg-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--ie11.sg-grid-column--lg-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--ie11.sg-grid-column--lg-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--ie11.sg-grid-column--lg-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--ie11.sg-grid-column--lg-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--ie11.sg-grid-column--lg-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--ie11.sg-grid-column--lg-span-14{width:calc((100% - 1px) / 14 * 14)}}@supports not (grid-gap: 10px){.sg-grid-column--xs-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--xs-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--xs-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--xs-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--xs-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--xs-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--xs-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--xs-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--xs-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--xs-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--xs-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--xs-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--xs-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--xs-span-14{width:calc((100% - 1px) / 14 * 14)}@media(min-width: 801px){.sg-grid-column--sm-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--sm-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--sm-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--sm-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--sm-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--sm-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--sm-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--sm-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--sm-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--sm-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--sm-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--sm-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--sm-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--sm-span-14{width:calc((100% - 1px) / 14 * 14)}}@media(min-width: 1024px){.sg-grid-column--m-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--m-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--m-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--m-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--m-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--m-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--m-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--m-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--m-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--m-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--m-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--m-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--m-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--m-span-14{width:calc((100% - 1px) / 14 * 14)}}@media(min-width: 1501px){.sg-grid-column--lg-span-1{width:calc((100% - 1px) / 14 * 1)}.sg-grid-column--lg-span-2{width:calc((100% - 1px) / 14 * 2)}.sg-grid-column--lg-span-3{width:calc((100% - 1px) / 14 * 3)}.sg-grid-column--lg-span-4{width:calc((100% - 1px) / 14 * 4)}.sg-grid-column--lg-span-5{width:calc((100% - 1px) / 14 * 5)}.sg-grid-column--lg-span-6{width:calc((100% - 1px) / 14 * 6)}.sg-grid-column--lg-span-7{width:calc((100% - 1px) / 14 * 7)}.sg-grid-column--lg-span-8{width:calc((100% - 1px) / 14 * 8)}.sg-grid-column--lg-span-9{width:calc((100% - 1px) / 14 * 9)}.sg-grid-column--lg-span-10{width:calc((100% - 1px) / 14 * 10)}.sg-grid-column--lg-span-11{width:calc((100% - 1px) / 14 * 11)}.sg-grid-column--lg-span-12{width:calc((100% - 1px) / 14 * 12)}.sg-grid-column--lg-span-13{width:calc((100% - 1px) / 14 * 13)}.sg-grid-column--lg-span-14{width:calc((100% - 1px) / 14 * 14)}}}
17
+ .sg-button{display:inline-block;border-radius:3rem;border:none;transition:color .2s linear,border-color .2s linear,background-color .2s linear;color:var(--color-primary);background-color:transparent;font-family:var(--font-family-component);font-weight:600;text-transform:uppercase;flex-shrink:0}.sg-button:focus{outline:none}.sg-keyboard .sg-button:focus{outline:none;box-shadow:var(--first-level-box-shadow)}.sg-button:hover,.sg-button:focus{cursor:pointer}.sg-button::-moz-focus-inner{border:0}.sg-button+.sg-button{margin-left:15px}.sg-theme-hcl .sg-button:hover,.sg-theme-hcb .sg-button:hover{color:var(--high-contrast-background);background-color:var(--high-contrast-foreground)}.sg-button--expanded{width:100%}.sg-button__content{display:inline-flex;justify-content:center;align-items:center;height:100%}.sg-button__text{line-height:1}.sg-button__text:first-child{margin-right:10px}.sg-button__text:last-child{margin-left:10px}.sg-button__text:only-child{margin-right:0;margin-left:0}.sg-button--primary{color:var(--color-button-white);background-color:var(--background-button-primary)}.sg-button--primary:focus{outline:none}.sg-keyboard .sg-button--primary:focus{outline:none;background-color:var(--background-button-primary-hovered)}.sg-button--primary:hover{background-color:var(--background-button-primary-hovered)}.sg-button--secondary{color:var(--color-primary);background-color:var(--background-button-secondary)}.sg-button--secondary:focus{outline:none}.sg-keyboard .sg-button--secondary:focus{outline:none;background-color:var(--background-button-secondary-hovered)}.sg-button--secondary:hover{background-color:var(--background-button-secondary-hovered)}.sg-button--neutral{color:var(--color-primary)}.sg-button--neutral:focus{outline:none}.sg-keyboard .sg-button--neutral:focus{outline:none;background-color:var(--background-button-secondary-hovered)}.sg-button--neutral:hover{background-color:var(--background-button-secondary-hovered)}.sg-button--xx-large{height:60px;padding-left:20px;padding-right:20px;font-size:18px}.sg-button--xx-large .sg-icon{width:22px;height:22px}.sg-button--x-large{height:50px;padding-left:28px;padding-right:28px;font-size:18px}.sg-button--x-large .sg-icon{width:20px;height:20px}.sg-button--large{height:40px;padding-left:23px;padding-right:23px;font-size:16px}.sg-button--large .sg-icon{width:16px;height:16px}.sg-button--medium{height:36px;padding-left:18px;padding-right:18px;font-size:14px}.sg-button--medium .sg-icon{width:16px;height:16px}.sg-button--small{height:30px;padding-left:18px;padding-right:18px;font-size:14px}.sg-button--small .sg-icon{width:12px;height:12px}.sg-button.sg-button--disabled{color:var(--color-disabled);background-color:transparent;border-color:transparent;pointer-events:none}.sg-button.sg-button--disabled:focus{outline:none}.sg-keyboard .sg-button.sg-button--disabled:focus{outline:none;box-shadow:none}.sg-button.sg-button--disabled:hover{color:var(--color-disabled);background-color:transparent;border-color:transparent;box-shadow:none}@media(max-width: 1500px){.sg-button--xx-large{height:50px}}
18
+ .sg-ripple-container{position:relative;overflow:hidden}.sg-ripple{display:inline-block;position:absolute;width:0;height:0;-webkit-transform:scale(0);transform:scale(0);opacity:.4;border-radius:50%;background:currentColor;cursor:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-animation:ripple-animation .4s linear;animation:ripple-animation .4s linear}@-webkit-keyframes ripple-animation{100%{-webkit-transform:scale(2);transform:scale(2);opacity:0}}@keyframes ripple-animation{100%{-webkit-transform:scale(2);transform:scale(2);opacity:0}}
19
+ .sg-security-hardening-column{position:relative;overflow:hidden;display:flex;flex-direction:column}.sg-security-ebook{background-color:#333230;background-repeat:no-repeat;background-size:cover;background-position:50% 0;width:100%;height:100%;box-shadow:var(--first-level-box-shadow);border-radius:12px}@media(max-width: 800px){.sg-security-ebook{min-height:300px;background-size:auto}}
20
+ .rate{position:relative}.rate__wrapper{display:grid;align-items:center;position:relative;grid-template-columns:auto auto 1fr;gap:25px}.rate_wrapper--mobile{gap:10px;text-align:center;grid-template-columns:1fr}.rate__starts{display:flex;justify-content:center}.rate__separator{border-left:1px solid var(--border-color-outer);height:100%}.rate__close-icon-button{position:absolute;right:0;top:0}.rate__close-icon-button--mobile{top:-5px}
21
+ .sg-loader{top:0;left:0}.sg-loader:focus{outline:none}.sg-keyboard .sg-loader:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-loader--background-default{background:var(--loader-background)}.sg-loader--background-dark{background:var(--loader-background-dark)}.sg-loader--density-none{padding:0}.sg-loader--density-medium{padding:40px 0}.sg-loader--position-absolute{position:absolute;right:0;bottom:0;z-index:3}.sg-loader--position-fixed{position:fixed;right:0;bottom:0;z-index:100}.sg-loader--position-relative{position:relative;z-index:100}.sg-loader__content{display:flex;flex-direction:column;align-items:center}.sg-loader__content--position-sticky{position:-webkit-sticky;position:sticky;top:calc(50% - 25px)}@supports not ((position: -webkit-sticky) or (position: sticky)){.sg-loader__content--position-sticky{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}}.sg-loader__content--position-absolute{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.sg-loader__content--transparent{opacity:.6}.sg-loader__message{margin-top:20px;max-width:500px;color:var(--typography-dark);font-size:14px;font-weight:400;font-family:var(--font-family-component);line-height:18px;text-align:center;text-transform:uppercase}.sg-loader__message--color-dark{color:var(--typography-white)}.sg-loader__spinner{position:relative;margin:0 auto;width:50px}
22
+ .sg-star-rating{display:flex;flex-wrap:nowrap;justify-content:space-around}.sg-star-rating:focus{outline:none}.sg-keyboard .sg-star-rating:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-star-rating--size-small{width:100px}.sg-star-rating--size-medium{width:250px}.sg-star-rating--size-large{width:380px}
23
+ .sg-flex{display:flex;flex-wrap:wrap}.sg-flex:focus{outline:none}.sg-keyboard .sg-flex:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-flex>*{min-width:0;max-width:100%}.sg-flex--margin-medium{margin-top:20px}.sg-flex--margin-medium:last-child{margin-bottom:20px}.sg-flex--direction-row{flex-direction:row}.sg-flex--direction-column{flex-direction:column}.sg-flex--direction-row-reverse{flex-direction:row-reverse}.sg-flex--direction-column-reverse{flex-direction:column-reverse}.sg-flex--justify-flex-start{justify-content:flex-start}.sg-flex--justify-center{justify-content:center}.sg-flex--justify-flex-end{justify-content:flex-end}.sg-flex--justify-space-between{justify-content:space-between}.sg-flex--justify-space-around{justify-content:space-around}.sg-flex--align-flex-start{align-items:flex-start}.sg-flex--align-center{align-items:center}.sg-flex--align-flex-end{align-items:flex-end}.sg-flex--align-baseline{align-items:baseline}.sg-flex--align-stretch{align-items:stretch}.sg-flex--align-self-flex-start{align-self:flex-start}.sg-flex--align-self-center{align-self:center}.sg-flex--align-self-flex-end{align-self:flex-end}.sg-flex--align-self-baseline{align-self:baseline}.sg-flex--align-self-stretch{align-self:stretch}.sg-flex--flex-wrap-wrap{flex-wrap:wrap}.sg-flex--flex-wrap-nowrap{flex-wrap:nowrap}.sg-flex--background-white{background-color:var(--background-component-primary)}.sg-flex--gutter-xx-small{padding-left:2.5px;padding-right:2.5px}.sg-flex--gutter-xx-small.sg-flex--expanded{margin-left:-5px;margin-right:-5px}.sg-flex--gutter-x-small{padding-left:5px;padding-right:5px}.sg-flex--gutter-x-small.sg-flex--expanded{margin-left:-10px;margin-right:-10px}.sg-flex--gutter-small{padding-left:7.5px;padding-right:7.5px}.sg-flex--gutter-small.sg-flex--expanded{margin-left:-15px;margin-right:-15px}.sg-flex--gutter-medium{padding-left:10px;padding-right:10px}.sg-flex--gutter-medium.sg-flex--expanded{margin-left:-20px;margin-right:-20px}.sg-flex--gutter-large{padding-left:15px;padding-right:15px}.sg-flex--gutter-large.sg-flex--expanded{margin-left:-30px;margin-right:-30px}.sg-flex--gutter-x-large{padding-left:20px;padding-right:20px}.sg-flex--gutter-x-large.sg-flex--expanded{margin-left:-40px;margin-right:-40px}.sg-flex--gutter-xx-large{padding-left:30px;padding-right:30px}.sg-flex--gutter-xx-large.sg-flex--expanded{margin-left:-60px;margin-right:-60px}.sg-flex--shrink-1{flex-shrink:1}.sg-flex--shrink-none{flex-shrink:0}.sg-flex--grow-1{flex-grow:1}.sg-flex--grow-2{flex-grow:2}.sg-flex--grow-3{flex-grow:3}.sg-flex--gap-none{gap:0}.sg-flex--gap-xx-small{gap:5px}.sg-flex--gap-x-small{gap:10px}.sg-flex--gap-small{gap:15px}.sg-flex--gap-medium{gap:20px}.sg-flex--gap-large{gap:30px}.sg-flex--gap-x-large{gap:40px}.sg-flex--gap-xx-large{gap:60px}.sg-flex--gap-responsive{gap:30px}@media(max-width: 1500px){.sg-flex--gap-responsive{gap:20px}}
24
+ .sg-link{display:inline-block;color:var(--color-primary);cursor:pointer}.sg-link:focus,.sg-link:hover{color:var(--color-primary-hovered);outline:none}.sg-link:focus{text-decoration:underline}.sg-link:active{color:var(--color-primary-active)}.sg-link:visited:not(.sg-link--breadcrumb){color:var(--color-info)}.sg-theme-hcl .sg-link,.sg-theme-hcb .sg-link{text-decoration:underline}.sg-link--decoration-dotted{-webkit-text-decoration:underline dotted currentColor;text-decoration:underline dotted currentColor}.sg-link--disabled{color:var(--color-disabled);cursor:default}.sg-link--disabled:hover,.sg-link--disabled:active,.sg-link--disabled:visited{color:var(--color-disabled)}
25
+ .sg-icon-button{display:inline-flex;justify-content:center;align-items:center;color:var(--color-icon-button);cursor:pointer;flex-shrink:0}.sg-icon-button:focus{outline:none}.sg-keyboard .sg-icon-button:focus{outline:none;box-shadow:var(--first-level-box-shadow)}.sg-icon-button:nth-child(n+2){margin-left:10px}.sg-icon-button--circle{border-radius:50%}.sg-icon-button--small{width:30px;height:30px}.sg-icon-button--medium{width:36px;height:36px}.sg-icon-button--large{width:40px;height:40px}.sg-icon-button--x-large{width:50px;height:50px}.sg-icon-button--xx-large{width:60px;height:60px}.sg-icon-button--neutral{color:var(--color-primary);background-color:transparent}.sg-icon-button--neutral:focus{outline:none}.sg-keyboard .sg-icon-button--neutral:focus{outline:none;background-color:var(--background-button-secondary)}.sg-icon-button--neutral:hover{background-color:var(--background-button-secondary)}.sg-icon-button--neutral:active{background-color:var(--background-button-secondary)}.sg-theme-hcl .sg-icon-button--neutral:hover,.sg-theme-hcl .sg-icon-button--neutral:focus,.sg-theme-hcl .sg-icon-button--neutral:active,.sg-theme-hcb .sg-icon-button--neutral:hover,.sg-theme-hcb .sg-icon-button--neutral:focus,.sg-theme-hcb .sg-icon-button--neutral:active{color:var(--high-contrast-background);background-color:var(--high-contrast-foreground)}.sg-icon-button--disabled{opacity:.3;background-color:transparent;cursor:default}.sg-theme-hcl .sg-icon-button--active.sg-icon-button--neutral,.sg-theme-hcb .sg-icon-button--active.sg-icon-button--neutral{color:var(--high-contrast-background);background-color:var(--high-contrast-foreground)}
26
+ .sg-tabs-wrapper{display:flex;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-width:100%}.sg-tabs-wrapper:focus{outline:none}.sg-keyboard .sg-tabs-wrapper:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-tabs_container{overflow:hidden}.sg-tabs__arrow{display:flex;justify-content:center;align-items:center;width:60px;background:inherit;color:var(--color-icon-button);cursor:pointer}.sg-tabs__arrow:hover{color:var(--typography-dark)}.sg-tabs{display:inline-flex}.sg-tabs__tab{align-items:center;display:flex;position:relative;white-space:nowrap;height:60px;padding:0 30px;color:var(--typography-light);cursor:pointer;text-transform:uppercase}.sg-tabs__tab:focus{outline:none}.sg-keyboard .sg-tabs__tab:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-tabs__tab:hover,.sg-tabs__tab:active,.sg-tabs__tab--active{color:var(--typography-dark)}.sg-tabs__tab:active::after,.sg-tabs__tab--active::after{content:"";display:block;position:absolute;height:2px;left:0;right:0;bottom:0;background-color:currentColor;z-index:1}.sg-tabs__tab a{color:inherit}.sg-tabs--background-transparent{background-color:transparent}.sg-tabs-wrapper--border-light{position:relative}.sg-tabs-wrapper--border-light::before{content:"";display:block;position:absolute;height:1px;left:0;right:0;bottom:0;background-color:var(--border-color-outer)}.sg-tabs--active-color .sg-tabs__tab--active::after,.sg-tabs--active-color .sg-tabs__tab:active::after{background-color:var(--background-button-primary)}.sg-tabs--active-color-dark .sg-tabs__tab--active,.sg-tabs--active-color-dark .sg-tabs__tab:active{color:var(--typography-dark)}.sg-tabs--small{font-family:var(--font-family-component);font-weight:500;font-size:14px;line-height:18px}.sg-tabs--medium{font-family:var(--font-family-component);font-weight:600;font-size:16px;line-height:26px}.sg-tabs--large{font-family:var(--font-family-component);font-weight:600;font-size:18px;line-height:28px}.sg-tabs__tab--disabled{color:var(--color-disabled);pointer-events:none}@media(max-width: 1500px){.sg-tabs__tab{padding:0 20px;height:50px}}
27
+ .sg-spacer{display:inline-block;flex-shrink:0}.sg-spacer--size-expanded{flex:1 1 0}.sg-spacer--size-xx-small{width:5px}.sg-spacer--size-x-small{width:10px}.sg-spacer--size-small{width:15px}.sg-spacer--size-medium{width:20px}.sg-spacer--size-large{width:30px}.sg-spacer--size-x-large{width:40px}.sg-spacer--size-xx-large{width:60px}
28
+ .sg-context-menu{display:inline-block;position:relative;line-height:0}.sg-context-menu:focus{outline:none}.sg-context-menu--click-prevent{position:absolute;top:0;right:0;bottom:0;left:0}
29
+ .sg-context-menu-list--position-absolute{position:absolute}.sg-context-menu-list--position-fixed{position:fixed}.sg-context-menu-list--open{-webkit-animation:menu-list-open-animation .2s forwards;animation:menu-list-open-animation .2s forwards}.sg-context-menu-list--close{-webkit-animation:menu-list-close-animation .2s forwards;animation:menu-list-close-animation .2s forwards}.sg-context-menu-list-wrapper--mobile.sg-context-menu-list-wrapper--open{-webkit-animation:menu-wrapper-mobile-open-animation .2s forwards;animation:menu-wrapper-mobile-open-animation .2s forwards}.sg-context-menu-list-wrapper--mobile.sg-context-menu-list-wrapper--close{-webkit-animation:menu-wrapper-mobile-close-animation .2s forwards;animation:menu-wrapper-mobile-close-animation .2s forwards}.sg-context-menu-list-wrapper--mobile .sg-context-menu-list--open{-webkit-animation:menu-list-mobile-toggle-animation .2s forwards;animation:menu-list-mobile-toggle-animation .2s forwards}@supports(-webkit-overflow-scrolling: touch){.sg-context-menu-list-wrapper--mobile .sg-context-menu-list--open{-webkit-animation:none;animation:none}}.sg-context-menu-list-wrapper--mobile .sg-context-menu-list--close{-webkit-animation:menu-list-mobile-close-animation .2s forwards;animation:menu-list-mobile-close-animation .2s forwards}@supports(-webkit-overflow-scrolling: touch){.sg-context-menu-list-wrapper--mobile .sg-context-menu-list--close{-webkit-animation:none;animation:none}}@-webkit-keyframes menu-list-open-animation{from{-webkit-transform:scale(0, 0);transform:scale(0, 0)}to{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@keyframes menu-list-open-animation{from{-webkit-transform:scale(0, 0);transform:scale(0, 0)}to{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@-webkit-keyframes menu-list-close-animation{to{-webkit-transform:scale(0, 0);transform:scale(0, 0)}}@keyframes menu-list-close-animation{to{-webkit-transform:scale(0, 0);transform:scale(0, 0)}}@-webkit-keyframes menu-list-mobile-toggle-animation{from{-webkit-transform:translateY(100%);transform:translateY(100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes menu-list-mobile-toggle-animation{from{-webkit-transform:translateY(100%);transform:translateY(100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes menu-list-mobile-close-animation{to{-webkit-transform:translateY(100%);transform:translateY(100%)}}@keyframes menu-list-mobile-close-animation{to{-webkit-transform:translateY(100%);transform:translateY(100%)}}@-webkit-keyframes menu-wrapper-mobile-open-animation{from{background-color:var(--background-component-primary)}to{background-color:var(--background-overlay)}}@keyframes menu-wrapper-mobile-open-animation{from{background-color:var(--background-component-primary)}to{background-color:var(--background-overlay)}}@-webkit-keyframes menu-wrapper-mobile-close-animation{from{background-color:var(--background-overlay)}to{background-color:transparent}}@keyframes menu-wrapper-mobile-close-animation{from{background-color:var(--background-overlay)}to{background-color:transparent}}@supports(-webkit-overflow-scrolling: touch){@-webkit-keyframes menu-wrapper-mobile-open-animation{from{opacity:0}to{opacity:1}}@keyframes menu-wrapper-mobile-open-animation{from{opacity:0}to{opacity:1}}@-webkit-keyframes menu-wrapper-mobile-close-animation{from{opacity:1}to{opacity:0}}@keyframes menu-wrapper-mobile-close-animation{from{opacity:1}to{opacity:0}}}
30
+ .sg-menu-wrapper--mobile{position:fixed;top:0;right:0;bottom:0;left:0;z-index:130;display:flex;align-items:flex-end;pointer-events:auto;background-color:var(--background-overlay)}.sg-menu{z-index:50;max-height:calc(100vh - 40px);overflow:auto;display:inline-block;box-shadow:var(--second-level-box-shadow);font-family:var(--font-family-component);font-weight:400;font-size:14px;line-height:18px;color:var(--typography-dark);background-color:var(--context-menu-background);border-radius:12px;cursor:pointer;transform-box:fill-box}.sg-menu:focus{outline:none}.sg-theme-hcl .sg-menu,.sg-theme-hcb .sg-menu{border:1px solid var(--high-contrast-foreground)}.sg-menu--mobile{background-color:var(--background-component-primary);width:100%;border-bottom-right-radius:0;border-bottom-left-radius:0}
31
+ .sg-menu-item{display:flex;align-items:center;min-width:260px;padding:10px 20px;white-space:nowrap;width:100%;text-align:left}.sg-menu-item:focus{outline:none}.sg-menu-item--disabled{color:var(--color-disabled);cursor:default}.sg-menu-item:focus,.sg-menu-item:hover:not(.sg-menu-item--disabled){color:var(--component-color-hover);background-color:var(--component-background-hover)}.sg-menu-item:focus .context-menu__shortcut,.sg-menu-item:hover:not(.sg-menu-item--disabled) .context-menu__shortcut{color:var(--typography-light)}.sg-menu-item__icon{margin-right:10px}.sg-menu-item__text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;text-align:left}.sg-menu-item__shortcut{margin-left:auto;padding-left:10px;font-size:13px;line-height:1}@media(max-width: 800px){.sg-menu-item{padding:15px 20px}}
32
+ .sg-filter-menu{display:flex;flex-direction:column;background:var(--context-menu-background)}.sg-filter-menu .sg-menu{overflow-x:hidden;box-shadow:none}@media(max-width: 800px){.sg-filter-menu{flex-direction:column-reverse}}.sg-filter-menu--position-absolute{position:absolute}.sg-filter-menu-position-fixed{position:fixed}.sg-filter-list__dropdown-field .sg-menu-item__text{overflow:visible}.sg-filter-list__buttons{z-index:80;background-color:var(--context-menu-background)}.sg-filter-menu.sg-filter-menu{z-index:80;box-shadow:var(--second-level-box-shadow);border-radius:12px}.sg-filter-menu-list--open{-webkit-animation:menu-list-open-animation .2s forwards;animation:menu-list-open-animation .2s forwards}.sg-filter-menu-list--close{-webkit-animation:menu-list-close-animation .2s forwards;animation:menu-list-close-animation .2s forwards}.sg-filter-menu--mobile.sg-filter-menu--open{-webkit-animation:menu-wrapper-mobile-open-animation .2s forwards;animation:menu-wrapper-mobile-open-animation .2s forwards}.sg-filter-menu--mobile.sg-filter-menu--close{-webkit-animation:menu-wrapper-mobile-close-animation .2s forwards;animation:menu-wrapper-mobile-close-animation .2s forwards}.sg-filter-menu--mobile .sg-filter-menu-list--open{-webkit-animation:menu-list-mobile-toggle-animation .2s forwards;animation:menu-list-mobile-toggle-animation .2s forwards}@supports(-webkit-overflow-scrolling: touch){.sg-filter-menu--mobile .sg-filter-menu-list--open{-webkit-animation:none;animation:none}}.sg-filter-menu--mobile .sg-filter-menu-list--close{-webkit-animation:menu-list-mobile-close-animation .2s forwards;animation:menu-list-mobile-close-animation .2s forwards}@supports(-webkit-overflow-scrolling: touch){.sg-filter-menu--mobile .sg-filter-menu-list--close{-webkit-animation:none;animation:none}}@-webkit-keyframes menu-list-open-animation{from{-webkit-transform:scale(0, 0);transform:scale(0, 0)}to{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@keyframes menu-list-open-animation{from{-webkit-transform:scale(0, 0);transform:scale(0, 0)}to{-webkit-transform:scale(1, 1);transform:scale(1, 1)}}@-webkit-keyframes menu-list-close-animation{to{-webkit-transform:scale(0, 0);transform:scale(0, 0)}}@keyframes menu-list-close-animation{to{-webkit-transform:scale(0, 0);transform:scale(0, 0)}}@-webkit-keyframes menu-list-mobile-toggle-animation{from{-webkit-transform:translateY(100%);transform:translateY(100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes menu-list-mobile-toggle-animation{from{-webkit-transform:translateY(100%);transform:translateY(100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes menu-list-mobile-close-animation{to{-webkit-transform:translateY(100%);transform:translateY(100%)}}@keyframes menu-list-mobile-close-animation{to{-webkit-transform:translateY(100%);transform:translateY(100%)}}@-webkit-keyframes menu-wrapper-mobile-open-animation{from{background-color:var(--background-component-primary)}to{background-color:var(--background-overlay)}}@keyframes menu-wrapper-mobile-open-animation{from{background-color:var(--background-component-primary)}to{background-color:var(--background-overlay)}}@-webkit-keyframes menu-wrapper-mobile-close-animation{from{background-color:var(--background-overlay)}to{background-color:transparent}}@keyframes menu-wrapper-mobile-close-animation{from{background-color:var(--background-overlay)}to{background-color:transparent}}@supports(-webkit-overflow-scrolling: touch){@-webkit-keyframes menu-wrapper-mobile-open-animation{from{opacity:0}to{opacity:1}}@keyframes menu-wrapper-mobile-open-animation{from{opacity:0}to{opacity:1}}@-webkit-keyframes menu-wrapper-mobile-close-animation{from{opacity:1}to{opacity:0}}@keyframes menu-wrapper-mobile-close-animation{from{opacity:1}to{opacity:0}}}
33
+ .sg-filter--trigger-close-background{position:fixed;top:0;left:0;right:0;bottom:0;z-index:70;display:flex;flex-direction:column;padding:20px;overflow-x:hidden;overflow-y:auto;will-change:transform}.sg-filter--menu{border-bottom-left-radius:0;border-bottom-right-radius:0}.sg-filter{display:inline-block;position:relative}.sg-filter:focus{outline:none}.sg-filter__title.sg-filter__title{padding-top:20px;padding-bottom:20px;border-bottom:1px solid var(--border-color-outer);color:var(--typography-dark);font-family:var(--font-family-component);font-weight:600;font-size:18px}.sg-filter .sg-menu-group--title{color:var(--typography-dark);background-color:var(--background-component-secondary)}.sg-filter__checkbox{pointer-events:none;padding:0}.sg-filter__icon-selected-state{position:relative}.sg-filter__icon-selected-state::after{content:"";position:absolute;top:10px;right:10px;background:var(--color-error);border-radius:50%;width:6px;height:6px}.sg-theme-hcl .sg-filter-list__buttons,.sg-theme-hcb .sg-filter-list__buttons{border:1px solid var(--high-contrast-foreground)}@media(min-width: 801px){.sg-theme-hcl .sg-filter-list__buttons,.sg-theme-hcb .sg-filter-list__buttons{border-top:none}}.sg-theme-hcl .sg-filter-menu .sg-menu,.sg-theme-hcb .sg-filter-menu .sg-menu{border-bottom-left-radius:0;border-bottom-right-radius:0}.sg-theme-dark .sg-filter-menu .sg-menu{border-bottom-left-radius:0;border-bottom-right-radius:0}
34
+ .sg-toolbar{display:flex;width:100%}.sg-toolbar--direction-row{flex-direction:row}.sg-toolbar--direction-column{flex-direction:column}.sg-toolbar--direction-row-reverse{flex-direction:row-reverse}.sg-toolbar--direction-column-reverse{flex-direction:column-reverse}.sg-toolbar--density-none{padding:0}.sg-toolbar--density-compact{padding:10px 30px}.sg-toolbar--density-cozy{padding:20px 30px}.sg-toolbar--density-comfortable{padding:20px 60px}.sg-toolbar--align-flex-start{align-items:flex-start}.sg-toolbar--align-center{align-items:center}.sg-toolbar--align-flex-end{align-items:flex-end}.sg-toolbar--align-baseline{align-items:baseline}.sg-toolbar--align-stretch{align-items:stretch}.sg-toolbar--justify-flex-start{justify-content:flex-start}.sg-toolbar--justify-center{justify-content:center}.sg-toolbar--justify-flex-end{justify-content:flex-end}.sg-toolbar--justify-space-between{justify-content:space-between}.sg-toolbar--justify-space-around{justify-content:space-around}.sg-toolbar--background-default{background-color:var(--background-white)}.sg-toolbar--background-transparent{background-color:transparent}@media(max-width: 1500px){.sg-toolbar--density-compact{padding:10px 15px}.sg-toolbar--density-cozy{padding:15px 20px}.sg-toolbar--density-comfortable{padding:20px}}
35
+ .sg-menu-group--title{color:var(--typography-dark);background-color:var(--background-component-secondary)}
36
+ .sg-date-picker.sg-dialog{padding:0}.sg-date-picker__input,.sg-date-picker__field{cursor:pointer;caret-color:transparent}.sg-date-picker__input.sg-date-picker__input--disabled,.sg-date-picker__input.sg-date-picker__field--disabled,.sg-date-picker__field.sg-date-picker__input--disabled,.sg-date-picker__field.sg-date-picker__field--disabled{cursor:not-allowed}.sg-date-picker__header{border-top-right-radius:12px;border-top-left-radius:12px}.sg-theme-hcl .sg-date-picker__header,.sg-theme-hcb .sg-date-picker__header{border-bottom:1px solid var(--high-contrast-foreground)}.sg-date-picker__header-date{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;padding:5px 0}.sg-date-picker__nav{display:flex;justify-content:space-between;align-items:center;width:100%}.sg-date-picker__content{width:100%;background-color:var(--background-component-primary)}.sg-date-picker__content--grid-view{display:flex;flex-direction:column;align-items:center;padding:15px 40px 30px 40px}.sg-date-picker__content--fixed-height{height:380px}.sg-date-picker__content--scrollable{overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.sg-date-picker-calendar__row{display:flex;justify-content:space-between;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;margin-top:2px}.sg-date-picker__calendar__row--month{margin-top:30px}@media(max-width: 800px){.sg-date-picker__content--grid-view{padding:0}}
37
+ .sg-date-picker-entity{display:flex;justify-content:center;align-items:center;width:40px;height:40px;margin-top:2px;color:var(--typography-dark);border-radius:50%;border:1px solid transparent;cursor:pointer;font-family:var(--font-family-component);font-size:14px;font-weight:500}.sg-date-picker-entity:hover{color:var(--component-color-hover);border:1px solid var(--component-background-hover);background-color:var(--component-background-hover)}.sg-date-picker-entity:focus{outline:none}.sg-date-picker-entity:first-child{margin-left:0}.sg-date-picker-entity--non-selectable{pointer-events:none;color:var(--typography-light)}.sg-date-picker-entity--current{background-color:var(--background-component-primary);border:1px solid var(--background-button-primary)}.sg-date-picker-entity--selected{background-color:var(--background-button-primary);color:var(--color-button-white)}.sg-date-picker-entity--disabled{color:var(--color-disabled);background-color:transparent;pointer-events:none}
38
+ .sg-date-picker-year-entity-wrapper:focus{outline:none}.sg-date-picker-year-entity{cursor:pointer;line-height:36px}.sg-date-picker-year-entity:hover{color:var(--color-secondary)}.sg-date-picker-year-entity--selected{color:var(--color-secondary);font-size:26px}
39
+ .sg-input-addon{display:inline-flex;align-items:center;flex-shrink:0;position:relative;white-space:nowrap;max-width:100%;background-color:var(--background-component-secondary);color:var(--typography-light)}.sg-input-addon:first-child{border-top-left-radius:12px;border-bottom-left-radius:12px}.sg-input-addon:last-child{border-top-right-radius:12px;border-bottom-right-radius:12px}.sg-input-addon .sg-input-text-truncate{display:block;overflow:hidden;text-overflow:ellipsis}.sg-input-addon .sg-tooltip{position:absolute;top:0;left:0;width:100%;height:100%}.sg-input-addon__array{width:100%;padding-right:15px}.sg-theme-hcl .sg-tooltip,.sg-theme-hcb .sg-tooltip{border:1px solid var(--high-contrast-foreground)}.sg-input-addon--component{background-color:transparent}.sg-input-addon__size--small .sg-input-text-truncate{max-width:120.96px;line-height:18px}.sg-input-addon__size--medium .sg-input-text-truncate{max-width:120.96px;line-height:26px}.sg-input-addon__size--large .sg-input-text-truncate{max-width:136.08px;line-height:28px}.sg-input-addon__size--x-large .sg-input-text-truncate{max-width:166.32px;line-height:32px}@media(max-width: 1500px){.sg-input-addon__size--small .sg-input-text-truncate{max-width:90.72px}.sg-input-addon__size--medium .sg-input-text-truncate{max-width:90.72px}.sg-input-addon__size--large .sg-input-text-truncate{max-width:90.72px}.sg-input-addon__size--x-large .sg-input-text-truncate{max-width:110.88px}}.sg-input-addon__size--small{height:28px;padding:0 15px;font-size:14px}.sg-input-addon__size--small.sg-input-addon--component-prefix{padding:0 0 0 15px}.sg-input-addon__size--medium{height:38px;padding:0 15px}.sg-input-addon__size--medium.sg-input-addon--component-prefix{padding:0 0 0 15px}.sg-input-addon__size--medium.sg-input-addon--component-suffix{padding-right:4px}.sg-input-addon__size--medium.sg-input-addon--component-suffix [class*=sg-button]{padding-left:8px;padding-right:8px}.sg-input-addon__size--large{height:48px;padding:0 20px;font-size:18px}.sg-input-addon__size--large.sg-input-addon--component-prefix{padding:0 0 0 20px}.sg-input-addon__size--x-large{height:58px;padding:0 30px;font-size:22px}.sg-input-addon__size--x-large.sg-input-addon--component-prefix{padding:0 0 0 30px}@media(max-width: 800px){.sg-input-addon__size--large,.sg-input-addon__size--x-large{padding:0 15px}.sg-input-addon__size--small,.sg-input-addon__size--medium,.sg-input-addon__size--large,.sg-input-addon__size--x-large{font-size:18px}}@media(max-width: 1500px){.sg-input-addon__size--x-large{height:48px;padding:0 20px;font-size:18px}.sg-input-addon__size--x-large.sg-input-addon--component-prefix{padding:0 0 0 20px}}
40
+ .sg-field-label{display:block;width:100%;position:relative;text-align:left}.sg-field-wrapper{display:flex;width:100%;background-color:var(--background-component-primary);border:1px solid var(--border-color-default);border-radius:12px;overflow:hidden;font-family:var(--font-family-component);font-size:16px;color:var(--typography-dark)}.sg-field-wrapper--disabled{opacity:.5;cursor:not-allowed}.sg-field-wrapper--readonly{word-break:break-all}.sg-field{width:100%;min-width:1px;background-color:transparent;border:none;font-family:var(--font-family-component);color:var(--typography-dark)}.sg-field::-webkit-input-placeholder{font-style:italic;font-weight:300;color:var(--typography-dark)}.sg-field::-moz-placeholder{font-style:italic;font-weight:300;color:var(--typography-dark)}.sg-field:-ms-input-placeholder{font-style:italic;font-weight:300;color:var(--typography-dark)}.sg-field::placeholder{font-style:italic;font-weight:300;color:var(--typography-dark)}.sg-field:only-child{border-radius:12px}.sg-field:first-child{border-top-left-radius:12px;border-bottom-left-radius:12px}.sg-field:last-child{border-top-right-radius:12px;border-bottom-right-radius:12px}.sg-field:focus{box-shadow:none}.sg-field:disabled::-webkit-input-placeholder{background-color:var(--background-component-primary);cursor:not-allowed}.sg-field:disabled::-moz-placeholder{background-color:var(--background-component-primary);cursor:not-allowed}.sg-field:disabled:-ms-input-placeholder{background-color:var(--background-component-primary);cursor:not-allowed}.sg-field:disabled,.sg-field:disabled::placeholder{background-color:var(--background-component-primary);cursor:not-allowed}.sg-field:read-only::-webkit-input-placeholder{background-color:inherit}.sg-field:read-only::-moz-placeholder{background-color:inherit}.sg-field:read-only:-ms-input-placeholder{background-color:inherit}.sg-field:-moz-read-only, .sg-field:-moz-read-only::placeholder{background-color:inherit}.sg-field:read-only,.sg-field:read-only::placeholder{background-color:inherit}.sg-field::-webkit-outer-spin-button,.sg-field::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}.sg-field[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.sg-field::-ms-clear{display:none}.sg-field-wrapper--focused{box-shadow:var(--first-level-box-shadow)}.sg-field-wrapper--has-validation{border-bottom-right-radius:0;border-bottom-left-radius:0}.sg-field-wrapper--success{border-color:var(--color-success)}.sg-field-wrapper--error{border-color:var(--border-color-input-error-not-focused)}.sg-field-wrapper--error-focused{border-color:var(--border-color-input-error-focused);box-shadow:0 0 0 1px var(--border-color-input-error-focused)}.sg-field-wrapper--warning{border-color:var(--color-warning)}.sg-input-wrapper--hint .sg-input{border-color:var(--color-hint)}.sg-field-wrapper--small .sg-field{height:28px;padding:0 15px;font-size:14px}.sg-field-wrapper--medium .sg-field{height:38px;padding:0 15px;font-size:16px}.sg-field-wrapper--large .sg-field{height:48px;padding:0 20px;font-size:18px}.sg-field-wrapper--x-large .sg-field{height:58px;padding:0 30px;font-size:22px}.sg-field-wrapper--x-large .sg-field::-webkit-input-placeholder{font-weight:600}.sg-field-wrapper--x-large .sg-field::-moz-placeholder{font-weight:600}.sg-field-wrapper--x-large .sg-field:-ms-input-placeholder{font-weight:600}.sg-field-wrapper--x-large .sg-field::placeholder{font-weight:600}@media(max-width: 800px){.sg-field-wrapper--large .sg-field,.sg-field-wrapper--x-large .sg-field{padding:0 15px}.sg-field-wrapper--small .sg-field,.sg-field-wrapper--medium .sg-field,.sg-field-wrapper--large .sg-field,.sg-field-wrapper--x-large .sg-field{font-size:18px}}@media(max-width: 1500px){.sg-field-wrapper--x-large .sg-field{height:48px;padding:0 20px;font-size:18px}}
41
+ .sg-form-label{display:block;font-size:var(--typography-field-label-size);font-family:var(--font-family-component)}.sg-form-label-tooltip{display:inline-block;margin-left:5px}
42
+ .sg-validation{display:none;position:absolute;left:0;z-index:40;margin-top:-1px;padding:7px 15px 6px 15px;width:100%;align-items:center;border-bottom-left-radius:12px;border-bottom-right-radius:12px;box-shadow:var(--first-level-box-shadow);color:var(--color-button-white);font-size:14px;word-break:break-word;line-height:16px}@media(max-width: 1500px){.sg-validation{padding:5px 15px 4px 15px}}.sg-validation-icon{margin-right:10px}.sg-validation--success{background-color:var(--color-success)}.sg-validation--error{background-color:var(--background-color-error-not-focused);color:var(--text-color-error-not-focused);border:1px solid var(--border-color-input-error-not-focused);border-top:0;align-items:flex-start;font-weight:600}.sg-validation--error span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sg-validation--error-visible{display:inline-flex}.sg-validation--focused{display:inline-flex}.sg-validation--focused span{overflow:visible;text-overflow:initial;white-space:initial}.sg-validation--error-focused{background-color:var(--background-color-error-focused);box-shadow:0 0 0 1px var(--border-color-input-error-focused);border:none;color:var(--text-color-error-focused);font-weight:600}.sg-validation--warning{background-color:var(--color-warning)}.sg-validation--hint{background-color:var(--color-hint)}
43
+ .sg-page.from-dialog--prevent-scroll{overflow:hidden}.sg-dialog{display:flex;flex-direction:column;flex-shrink:0;margin:auto;max-width:100%;background:var(--background-component-primary);border-radius:12px;box-shadow:var(--second-level-box-shadow);will-change:transform}.sg-dialog:focus{outline:none}.sg-theme-hcl .sg-dialog,.sg-theme-hcb .sg-dialog{border-left:1px solid var(--high-contrast-foreground);border-bottom:1px solid var(--high-contrast-foreground);border-right:1px solid var(--high-contrast-foreground)}.sg-theme-hcl .sg-dialog .sg-toolbar,.sg-theme-hcb .sg-dialog .sg-toolbar{border-top:1px solid var(--high-contrast-foreground)}.sg-theme-hcl .sg-dialog--state-presentational,.sg-theme-hcl .sg-dialog--no-state,.sg-theme-hcb .sg-dialog--state-presentational,.sg-theme-hcb .sg-dialog--no-state{border-top:1px solid var(--high-contrast-foreground)}.sg-dialog__content-wrapper{display:grid;grid-gap:30px;grid-template-columns:minmax(0, 1fr)}.sg-dialog__icon-wrapper{display:flex;justify-content:center}.sg-dialog__icon{width:60px;height:60px;display:flex;align-items:center;justify-content:center;border-radius:50%}.sg-dialog__title-wrapper{width:100%}.sg-dialog__title{width:100%}.sg-dialog__title strong{font-weight:600}.sg-dialog__title em{color:var(--typography-dark);font-style:normal;word-wrap:break-word;word-break:break-all}.sg-dialog--align-left .sg-dialog__content-wrapper{text-align:left}.sg-dialog--align-center .sg-dialog__content-wrapper{text-align:center}.sg-dialog--align-right .sg-dialog__content-wrapper{text-align:right}.sg-dialog--density-none{padding-top:0}.sg-dialog--density-none .sg-dialog__icon-wrapper,.sg-dialog--density-none .sg-dialog__title-wrapper{padding-left:60px;padding-right:60px}.sg-dialog--density-small{padding-top:40px}.sg-dialog--density-small .sg-dialog__icon-wrapper,.sg-dialog--density-small .sg-dialog__title-wrapper{padding-left:60px;padding-right:60px}.sg-dialog--density-medium{padding-top:40px}.sg-dialog--density-medium .sg-dialog__icon-wrapper,.sg-dialog--density-medium .sg-dialog__title-wrapper,.sg-dialog--density-medium .sg-dialog__content{padding-left:60px;padding-right:60px}.sg-dialog--density-medium .sg-dialog__content{padding-bottom:40px}.sg-dialog--size-small{width:380px}.sg-dialog--size-medium{width:470px}.sg-dialog--size-large{width:640px}.sg-dialog--size-x-large{width:870px}.sg-dialog--size-xx-large{width:1440px}.sg-dialog--state-presentational .sg-dialog__icon{width:inherit;height:inherit}.sg-dialog--state-active{border-top:3px solid var(--color-success)}.sg-dialog--state-active .sg-dialog__icon{color:var(--typography-white);background-color:var(--color-success)}.sg-dialog--state-inactive{border-top:3px solid var(--color-error)}.sg-dialog--state-inactive .sg-dialog__icon{color:var(--typography-white);background-color:var(--color-error)}.sg-dialog--state-warning{border-top:3px solid var(--color-warning)}.sg-dialog--state-warning .sg-dialog__icon{color:var(--typography-white);background-color:var(--color-warning)}.sg-dialog--state-info{border-top:3px solid var(--color-instruction)}.sg-dialog--state-info .sg-dialog__icon{color:var(--typography-white);background-color:var(--color-instruction)}.sg-theme-hcl .sg-dialog--state-active .sg-dialog__icon,.sg-theme-hcl .sg-dialog--state-inactive .sg-dialog__icon,.sg-theme-hcl .sg-dialog--state-warning .sg-dialog__icon,.sg-theme-hcl .sg-dialog--state-info .sg-dialog__icon,.sg-theme-hcb .sg-dialog--state-active .sg-dialog__icon,.sg-theme-hcb .sg-dialog--state-inactive .sg-dialog__icon,.sg-theme-hcb .sg-dialog--state-warning .sg-dialog__icon,.sg-theme-hcb .sg-dialog--state-info .sg-dialog__icon{color:var(--high-contrast-background)}@media(max-width: 800px){.sg-dialog{width:100%}}@media(max-width: 1500px){.sg-dialog__content-wrapper{gap:20px}.sg-dialog__icon{width:40px;height:40px}.sg-dialog--density-small{padding-top:20px}.sg-dialog--density-small .sg-dialog__icon-wrapper,.sg-dialog--density-small .sg-dialog__title-wrapper{padding-left:20px;padding-right:20px}.sg-dialog--density-medium{padding-top:20px}.sg-dialog--density-medium .sg-dialog__icon-wrapper,.sg-dialog--density-medium .sg-dialog__title-wrapper,.sg-dialog--density-medium .sg-dialog__content{padding-left:20px;padding-right:20px}.sg-dialog--density-medium .sg-dialog__content{padding-bottom:20px}}@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm){.sg-dialog--state-active,.sg-dialog--state-inactive,.sg-dialog--state-warning,.sg-dialog--state-info{border-right:3px solid transparent;border-bottom:3px solid transparent;border-left:3px solid transparent}}
44
+ .sg-dialog-wrapper{position:fixed;top:0;left:0;right:0;bottom:0;z-index:110;display:flex;flex-direction:column;padding:20px;overflow-x:hidden;overflow-y:auto;will-change:transform}.sg-dialog-wrapper--animation-open{-webkit-animation:dialog-wrapper-open-animation .2s forwards;animation:dialog-wrapper-open-animation .2s forwards}.sg-dialog-wrapper--animation-open .sg-dialog{-webkit-animation:dialog-open-animation .3s forwards;animation:dialog-open-animation .3s forwards}.sg-dialog-wrapper--animation-close{-webkit-animation:dialog-wrapper-close-animation .2s forwards;animation:dialog-wrapper-close-animation .2s forwards}.sg-dialog-wrapper--animation-close .sg-dialog{-webkit-animation:dialog-close-animation .3s forwards;animation:dialog-close-animation .3s forwards}@-webkit-keyframes dialog-wrapper-open-animation{from{background-color:transparent}to{background-color:var(--background-overlay)}}@keyframes dialog-wrapper-open-animation{from{background-color:transparent}to{background-color:var(--background-overlay)}}@-webkit-keyframes dialog-open-animation{from{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes dialog-open-animation{from{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes dialog-wrapper-close-animation{from{background-color:var(--background-overlay)}to{background-color:transparent}}@keyframes dialog-wrapper-close-animation{from{background-color:var(--background-overlay)}to{background-color:transparent}}@-webkit-keyframes dialog-close-animation{from{opacity:1;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}}@keyframes dialog-close-animation{from{opacity:1;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform:scale(0.7);transform:scale(0.7)}}
45
+ .sg-checkbox{display:inline-flex;cursor:pointer;font-family:var(--font-family-component);font-weight:400;text-align:start;color:var(--color-primary)}.sg-checkbox:focus{outline:0}.sg-checkbox:focus .sg-checkbox__icon{box-shadow:var(--first-level-box-shadow)}.sg-checkbox__input{display:none}.sg-checkbox__icon{flex-shrink:0;border-radius:3px;border:1px solid currentColor;color:currentColor;background-color:var(--background-component-primary)}.sg-checkbox__label{max-width:100%;color:var(--typography-dark)}.sg-checkbox--disabled{opacity:.5;pointer-events:none}.sg-checkbox--disabled .sg-checkbox__icon{background-color:transparent}.sg-checkbox__input:focus~.sg-checkbox__icon{box-shadow:var(--first-level-box-shadow)}.sg-checkbox__input:not(:checked):not(:indeterminate)~.sg-checkbox__icon{border:1px solid var(--border-color-default);color:transparent}.sg-checkbox--expand{width:100%}.sg-checkbox--small{padding:7px 0}.sg-checkbox--small .sg-checkbox__icon{width:12px;height:12px;margin-top:1px;padding:1px}.sg-checkbox--small .sg-checkbox__label{padding-right:6px;max-width:calc(100% - 12px);font-size:14px;line-height:18px}.sg-checkbox--small .sg-checkbox__icon+.sg-checkbox__label{padding-left:6px;padding-right:0}.sg-checkbox--medium{padding:9px 0}.sg-checkbox--medium .sg-checkbox__icon{width:18px;height:18px;margin-top:1px;padding:3px}.sg-checkbox--medium .sg-checkbox__label{padding-right:8px;max-width:calc(100% - 18px);font-size:16px;line-height:26px}.sg-checkbox--medium .sg-checkbox__icon+.sg-checkbox__label{padding-left:8px;padding-right:0}.sg-checkbox--large{padding:11px 0}.sg-checkbox--large .sg-checkbox__icon{width:22px;height:22px;margin-top:2px;padding:5px}.sg-checkbox--large .sg-checkbox__label{padding-right:10px;max-width:calc(100% - 22px);font-size:18px;line-height:28px}.sg-checkbox--large .sg-checkbox__icon+.sg-checkbox__label{padding-left:10px;padding-right:0}.sg-checkbox--x-large{padding:15px 0}.sg-checkbox--x-large .sg-checkbox__icon{width:25px;height:25px;margin-top:2px;padding:5px}.sg-checkbox--x-large .sg-checkbox__label{max-width:calc(100% - 25px);padding-right:15px;font-size:22px;line-height:32px}.sg-checkbox--x-large .sg-checkbox__icon+.sg-checkbox__label{padding-left:15px;padding-right:0}.sg-checkbox--align-flex-start{align-items:flex-start}.sg-checkbox--align-center{align-items:center}.sg-checkbox--align-flex-end{align-items:flex-end}.sg-checkbox--align-baseline{align-items:baseline}.sg-checkbox--align-stretch{align-items:stretch}
46
+ .sg-dropdown-wrapper--opened .sg-input-dropdown__placeholder{border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0}.sg-dropdown-wrapper--opened .sg-dropdown--transparent .sg-input-dropdown__placeholder{border-color:var(--border-color-default);border-bottom:transparent}.sg-dropdown--small .sg-input-dropdown__placeholder{padding:0 30px 0 10px}.sg-dropdown--medium .sg-input-dropdown__placeholder{padding:0 40px 0 15px}.sg-dropdown--large .sg-input-dropdown__placeholder{font-size:18px;font-weight:600;padding:0 40px 0 20px}.sg-dropdown--x-large .sg-input-dropdown__placeholder{font-size:20px;font-weight:600;padding:0 60px 0 30px}.sg-input-dropdown__placeholder{position:relative;min-width:100%;border:1px solid var(--border-color-default);border-radius:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sg-input-dropdown__placeholder--selected{color:var(--typography-dark);font-style:italic;font-size:16px}.sg-dropdown--state-success .sg-input-dropdown__placeholder{border-color:var(--color-success)}.sg-dropdown--state-error .sg-input-dropdown__placeholder{border-color:var(--color-error)}.sg-dropdown--state-warning .sg-input-dropdown__placeholder{border-color:var(--color-warning)}.sg-dropdown--theme-dark .sg-input-dropdown__placeholder{border-color:transparent}.sg-dropdown--transparent .sg-input-dropdown__placeholder{border-color:transparent}@media(max-width: 1500px){.sg-dropdown--x-large .sg-input-dropdown__placeholder{font-size:18px;padding:0 60px 0 20px}}
47
+ .sg-dropdown-wrapper{text-align:left}.sg-dropdown-wrapper--opened .sg-dropdown--box-shadow{box-sizing:none}.sg-dropdown-wrapper--opened .sg-dropdown-wrapper__input-wrapper{border-bottom-color:transparent;border-bottom-left-radius:0;border-bottom-right-radius:0}.sg-dropdown-wrapper--opened .sg-dropdown__content{border-top:none;border-top-left-radius:0;border-top-right-radius:0;margin-bottom:20px}.sg-dropdown-wrapper--opened .sg-dropdown__content .sg-dropdown__content__shadow{content:" ";display:block;position:absolute;bottom:-1px;left:-1px;right:-1px;pointer-events:none;box-shadow:var(--first-level-box-shadow);border-radius:4px}.sg-dropdown-wrapper--opened .sg-dropdown__content--without-top-border{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.sg-dropdown-wrapper--opened .sg-dropdown__content--with-top-border{border:1px solid var(--border-color-default);border-top-left-radius:12px;border-top-right-radius:12px}.sg-dropdown-wrapper--opened .sg-dropdown__content--with-box-shadow{box-shadow:var(--first-level-box-shadow)}.sg-dropdown-wrapper--inline{width:auto;display:inline-block}.sg-dropdown-wrapper--expand{width:100%}.sg-dropdown{position:relative;background-color:var(--background-component-primary);border-radius:12px;color:var(--typography-dark);cursor:pointer;font-family:var(--font-family-component);font-size:16px;text-align:left}.sg-dropdown:focus{outline:none;box-shadow:var(--first-level-box-shadow)}.sg-dropdown .sg-dropdown__validation{display:flex;bottom:0;position:relative;border:none}.sg-dropdown--disabled{pointer-events:none;opacity:.5;cursor:not-allowed}.sg-dropdown--has-selection .sg-dropdown-wrapper__input-field::-webkit-input-placeholder{color:var(--typography-dark);opacity:1;cursor:pointer;font-family:var(--font-family-component);font-size:inherit;font-style:normal}.sg-dropdown--has-selection .sg-dropdown-wrapper__input-field::-moz-placeholder{color:var(--typography-dark);opacity:1;cursor:pointer;font-family:var(--font-family-component);font-size:inherit;font-style:normal}.sg-dropdown--has-selection .sg-dropdown-wrapper__input-field:-ms-input-placeholder{color:var(--typography-dark);opacity:1;cursor:pointer;font-family:var(--font-family-component);font-size:inherit;font-style:normal}.sg-dropdown--has-selection .sg-dropdown-wrapper__input-field::placeholder{color:var(--typography-dark);opacity:1;cursor:pointer;font-family:var(--font-family-component);font-size:inherit;font-style:normal}.sg-dropdown__content{position:absolute;bottom:auto;left:0;right:0;z-index:50;border:1px solid var(--border-color-default);border-radius:12px;overflow:hidden;background-color:inherit}.sg-dropdown__nothing-found{display:block;box-shadow:var(--first-level-box-shadow)}.sg-dropdown--small .sg-dropdown__option,.sg-dropdown--small .sg-dropdown__option-group-header{padding:0 10px}.sg-dropdown--small .sg-dropdown__icon{width:30px;height:30px;padding:10px;top:calc(50% - 15px)}.sg-dropdown--small .sg-dropdown-wrapper__input-field::-webkit-input-placeholder{font-weight:400}.sg-dropdown--small .sg-dropdown-wrapper__input-field::-moz-placeholder{font-weight:400}.sg-dropdown--small .sg-dropdown-wrapper__input-field:-ms-input-placeholder{font-weight:400}.sg-dropdown--small .sg-dropdown-wrapper__input-field::placeholder{font-weight:400}.sg-dropdown--medium .sg-dropdown__option,.sg-dropdown--medium .sg-dropdown__option-group-header{padding:0 15px}.sg-dropdown--medium .sg-dropdown__icon{width:40px;height:40px;padding:15px;top:calc(50% - 20px)}.sg-dropdown--medium .sg-dropdown-wrapper__input-field::-webkit-input-placeholder{font-weight:400}.sg-dropdown--medium .sg-dropdown-wrapper__input-field::-moz-placeholder{font-weight:400}.sg-dropdown--medium .sg-dropdown-wrapper__input-field:-ms-input-placeholder{font-weight:400}.sg-dropdown--medium .sg-dropdown-wrapper__input-field::placeholder{font-weight:400}.sg-dropdown--large .sg-dropdown__option,.sg-dropdown--large .sg-dropdown__option-group-header{padding:0 20px}.sg-dropdown--large .sg-dropdown__icon{width:40px;height:40px;padding:15px;top:calc(50% - 20px)}.sg-dropdown--large .sg-dropdown-wrapper__input-field::-webkit-input-placeholder{font-weight:600}.sg-dropdown--large .sg-dropdown-wrapper__input-field::-moz-placeholder{font-weight:600}.sg-dropdown--large .sg-dropdown-wrapper__input-field:-ms-input-placeholder{font-weight:600}.sg-dropdown--large .sg-dropdown-wrapper__input-field::placeholder{font-weight:600}.sg-dropdown--x-large .sg-dropdown__option-group-header,.sg-dropdown--x-large .sg-dropdown__option{padding:0 30px}.sg-dropdown--x-large .sg-dropdown__icon{width:60px;height:60px;padding:25px;top:calc(50% - 30px)}.sg-dropdown--x-large .sg-dropdown-wrapper__input-field::-webkit-input-placeholder{font-weight:600}.sg-dropdown--x-large .sg-dropdown-wrapper__input-field::-moz-placeholder{font-weight:600}.sg-dropdown--x-large .sg-dropdown-wrapper__input-field:-ms-input-placeholder{font-weight:600}.sg-dropdown--x-large .sg-dropdown-wrapper__input-field::placeholder{font-weight:600}.sg-dropdown__options-wrapper{overflow-y:auto}.sg-dropdown__option-group-header{background-color:var(--background-main);text-transform:uppercase;cursor:default;color:var(--typography-dark);font-size:14px}.sg-dropdown__option:hover,.sg-dropdown__option--hovered{color:var(--component-color-hover);background-color:var(--component-background-hover)}.sg-dropdown__option:focus{outline:none}.sg-dropdown__option--disabled{opacity:.5;pointer-events:none}.sg-dropdown__icon{position:absolute;top:0;right:0;color:var(--color-icon-button);background:transparent}.sg-dropdown--state-success .sg-dropdown__content{border-color:var(--color-success)}.sg-dropdown--state-error .sg-dropdown__content{border-color:var(--color-error)}.sg-dropdown--state-warning .sg-dropdown__content{border-color:var(--color-warning)}.sg-dropdown__option-group-header,.sg-dropdown__option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sg-dropdown--box-shadow{box-shadow:var(--first-level-box-shadow)}.sg-dropdown--theme-dark{background-color:var(--drawer-background);color:var(--background-main)}.sg-dropdown--theme-dark .sg-dropdown__options{background-color:var(--background-component-primary);color:var(--typography-dark)}.sg-dropdown--theme-dark .sg-dropdown__icon{color:var(--color-icon-button)}.sg-dropdown--transparent{background-color:transparent}@media(max-width: 1500px){.sg-dropdown--x-large .sg-dropdown__option{padding:0 20px}.sg-dropdown--x-large .sg-dropdown__icon{width:50px;height:50px;padding:20px;top:calc(50% - 25px)}}.sg-dropdown--border-none .sg-dropdown__content,.sg-dropdown--border-none .sg-input-dropdown__placeholder{border:none}
48
+ .sg-multiple-dropdown__placeholder{font-style:italic;font-weight:300;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:calc(100% - 30px)}.sg-multiple-dropdown__input{display:flex;flex:1 0 auto;width:70px}.sg-multiple-dropdown__input .sg-multiple-dropdown__input-wrapper{border:none;box-shadow:none}.sg-multiple-dropdown__input .sg-multiple-dropdown__input-wrapper .sg-multiple-dropdown__field{height:26px}.sg-multiple-dropdown__input:not(:first-child) .sg-field{padding:0}.sg-multiple-dropdown__closed-state.sg-multiple-dropdown__closed-state--success{border-color:var(--color-success)}.sg-multiple-dropdown__closed-state.sg-multiple-dropdown__closed-state--error{border-color:var(--color-error)}.sg-multiple-dropdown__closed-state.sg-multiple-dropdown__closed-state--warning{border-color:var(--color-warning)}.sg-multiple-dropdown__closed-state{display:flex;flex-wrap:wrap;padding:5px;min-height:40px;border:1px solid var(--border-color-default);border-radius:12px;cursor:text}.sg-multiple-dropdown__closed-state .sg-dropdown__icon{margin:auto;top:0;bottom:0}.sg-multiple-dropdown__opened-state--no-data{cursor:default}.sg-multiple-dropdown__opened-state--no-data .sg-dropdown__icon{visibility:hidden}.sg-multiple-dropdown__opened-state{display:flex;position:relative;flex-wrap:wrap;padding-top:5px;padding-right:40px;padding-left:5px;min-height:38px;border-top-left-radius:12px;border-top-right-radius:12px}.sg-multiple-dropdown__opened-state .sg-multiple-dropdown__chip{margin-bottom:5px}.sg-multiple-dropdown__opened-state .sg-multiple-dropdown__placeholder{padding-top:5px;padding-left:10px}.sg-multiple-dropdown__chip{margin-right:5px;cursor:default}.sg-multiple-dropdown__chip--invalid{border:1px solid var(--color-error)}.sg-multiple-dropdown__more-button{border:0;height:inherit;text-transform:lowercase;white-space:nowrap;margin-left:auto;margin-right:5px}
49
+ .sg-chip{display:inline-flex;flex-wrap:nowrap;align-items:center;padding:1px 5px;background-color:var(--background-component-secondary);border-radius:12px;max-width:100%;min-height:28px}.sg-chip:focus{box-shadow:var(--first-level-box-shadow);outline:none}.sg-chip--selected{border:1px solid #906090}.sg-chip_item:first-child{margin-right:5px;margin-left:5px}.sg-chip_item--icon{color:var(--color-primary);cursor:pointer}.sg-chip_item--icon:hover{color:var(--color-secondary-hovered)}.sg-chip_item--icon:active{color:var(--color-secondary-active)}.sg-chip_item--text{white-space:nowrap}.sg-chip--state-error{background-color:var(--color-error)}.sg-chip--state-error .sg-chip_item--icon,.sg-chip--state-error .sg-chip_item--text{color:var(--typography-white)}
50
+ .sg-table-wrapper{width:100%;max-width:100%;border-radius:12px;background-color:var(--background-component-primary)}.sg-theme-hcl .sg-table-wrapper,.sg-theme-hcb .sg-table-wrapper{border:1px solid var(--high-contrast-foreground)}.sg-table-wrapper--box-shadow{box-shadow:var(--first-level-box-shadow)}.sg-table{width:100%;border-radius:12px;text-align:start;table-layout:fixed}.sg-table .sg-table__head .sg-table__cell:first-of-type{border-top-left-radius:12px}.sg-table .sg-table__head .sg-table__cell:last-of-type{border-top-right-radius:12px}.sg-table .sg-table__row:last-of-type .sg-table__cell:first-of-type{border-bottom-left-radius:12px}.sg-table .sg-table__row:last-of-type .sg-table__cell:last-of-type{border-bottom-right-radius:12px}.sg-table__head .sg-table__cell{color:var(--typography-dark);font-family:var(--font-family-component);font-weight:500;font-size:var(--typography-table-label-size);line-height:20px;text-align:left;border-top:none}.sg-table__head-tile{text-align:center}.sg-table__head--background-white .sg-table__cell{background-color:var(--background-component-primary)}.sg-table__footer--background-default .sg-table__cell{border-radius:12px}.sg-table__footer--background-white .sg-table__cell{background-color:var(--background-component-primary);border-radius:12px}.sg-table__row--animation-enter{opacity:0;transition:opacity .5s linear}.sg-table__row--animation-enter-active{opacity:1}.sg-table__row--animation-exit{pointer-events:none;transition:opacity .5s linear}.sg-table__row--animation-exit-active{opacity:0}.sg-table__cell.sg-table__cell--is-in-row-selection,.sg-table__cell--is-in-row-selection{background-color:var(--component-background-hover)}.sg-theme-hcl .sg-table__cell.sg-table__cell--is-in-row-selection,.sg-theme-hcl .sg-table__cell--is-in-row-selection,.sg-theme-hcb .sg-table__cell.sg-table__cell--is-in-row-selection,.sg-theme-hcb .sg-table__cell--is-in-row-selection{background-color:var(--component-background-hover)}.sg-table__cell{position:relative;padding:0 20px;vertical-align:middle;background-color:var(--background-component-primary);border-top:1px solid var(--border-color-inner);font-size:16px;line-height:20px;text-align:left}.sg-table__cell:focus{outline:none}.sg-keyboard .sg-table__cell:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-table__cell--height-small{height:40px}.sg-table__cell--height-medium{height:60px}.sg-table__cell-dnd-wrapper{display:flex;align-items:center}.sg-table__cell-dnd-wrapper .sg-icon-move{display:none}.sg-table__cell-dnd-wrapper .sg-icon-dnd{margin-right:15px;color:var(--color-icon-button)}.sg-table__after-content{border-top:1px solid var(--border-color-inner)}.sg-table-load-more{display:flex;justify-content:center;padding:20px;border-bottom-right-radius:12px;border-bottom-left-radius:12px}.sg-theme-hcl .sg-table-load-more,.sg-theme-hcb .sg-table-load-more{border-top:1px solid var(--high-contrast-foreground)}.sg-table .sg-table__row .sg-table__cell.sg-table__expand-toggle{text-align:center;background-color:var(--background-component-secondary);padding:20px 15px}.sg-table__cell--skeleton{background-color:var(--background-component-secondary);height:14px}.sg-table-wrapper--density-none .sg-table__cell{padding:0}.sg-table-wrapper--density-none .sg-table__after-content{padding:0}.sg-table-wrapper--density-small .sg-table__cell:first-child{padding-left:20px}.sg-table-wrapper--density-small .sg-table__cell:last-child{padding-right:20px}.sg-table-wrapper--density-small .sg-table__after-content{padding:20px 20px}.sg-table-wrapper--density-small .sg-table-wrapper--density-small .sg-table__cell:first-child{padding-left:40px}.sg-table-wrapper--density-small .sg-table-wrapper--density-small .sg-table__cell:last-child{padding-right:40px}.sg-table-wrapper--density-medium .sg-table__cell:first-child{padding-left:30px}.sg-table-wrapper--density-medium .sg-table__cell:first-child::before{left:5px}.sg-table-wrapper--density-medium .sg-table__cell:last-child{padding-right:30px}.sg-table-wrapper--density-medium .sg-table__after-content{padding:20px 30px}.sg-table-wrapper--density-medium .sg-table-wrapper--density-medium .sg-table__cell:first-child{padding-left:60px}.sg-table-wrapper--density-medium .sg-table-wrapper--density-medium .sg-table__cell:first-child::before{left:10px}.sg-table-wrapper--density-medium .sg-table-wrapper--density-medium .sg-table__cell:last-child{padding-right:60px}.sg-table-wrapper--density-large .sg-table__cell:first-child{padding-left:60px}.sg-table-wrapper--density-large .sg-table__after-content{padding:20px 60px}.sg-table-wrapper--density-large .sg-table__cell:last-child{padding-right:60px}.sg-table-wrapper--density-large .sg-table-wrapper--density-large .sg-table__cell:first-child{padding-left:120px}.sg-table-wrapper--density-large .sg-table-wrapper--density-large .sg-table__cell:last-child{padding-right:120px}.sg-product-table{width:100%}.sg-product-table .sg-toolbar{margin:0}sg-product-table{border:2px solid transparent}.sg-product-table--selected{border:2px solid var(--color-primary);border-radius:12px}.sg-product-table__row{border-bottom:1px solid var(--border-color-inner)}@media(min-width: 801px){.sg-table.sg-table--no-footer .sg-table__row:last-child .sg-table__cell--is-selected::before{border-bottom:2px solid var(--background-button-primary)}.sg-table__cell--is-selected::before{content:" ";position:absolute;display:block;top:-1px;bottom:0;right:0;left:-2px;border-left:2px solid var(--background-button-primary);border-right:2px solid var(--background-button-primary);pointer-events:none}.sg-table__head .sg-table__cell--is-selected::before{border-top:2px solid var(--background-button-primary);border-radius:12px 12px 0 0}.sg-table__footer .sg-table__cell--is-selected::before{border-bottom:2px solid var(--background-button-primary);border-radius:0 0 12px 12px}}@media(min-width: 801px){.sg-table__row:hover .sg-table__cell{background-color:var(--component-background-hover)}}@media(max-width: 800px){.sg-table{table-layout:fixed}.sg-table-wrapper .sg-table__after-content{padding:0}.sg-table-wrapper--mobile-card .sg-table__cell,.sg-table-wrapper--mobile-card .sg-table__cell:first-child,.sg-table-wrapper--mobile-card .sg-table__cell:last-child,.sg-table-wrapper--mobile-card-flat .sg-table__cell,.sg-table-wrapper--mobile-card-flat .sg-table__cell:first-child,.sg-table-wrapper--mobile-card-flat .sg-table__cell:last-child{padding:24px 20px 15px 20px}.sg-table-wrapper--mobile-card .sg-table__cell:first-child,.sg-table-wrapper--mobile-card-flat .sg-table__cell:first-child{border-top-left-radius:12px;border-top-right-radius:12px}.sg-table-wrapper--mobile-card .sg-table__cell:last-child,.sg-table-wrapper--mobile-card-flat .sg-table__cell:last-child{border-bottom-left-radius:12px;border-bottom-right-radius:12px}.sg-table-wrapper--mobile-card .sg-table__footer,.sg-table-wrapper--mobile-card-flat .sg-table__footer{display:none}.sg-table-wrapper--mobile-card.sg-table-wrapper,.sg-table-wrapper--mobile-card-flat.sg-table-wrapper{background-color:transparent}.sg-table-wrapper--mobile-card:not(.sg-table-wrapper--no-data).sg-table-wrapper--box-shadow,.sg-table-wrapper--mobile-card-flat:not(.sg-table-wrapper--no-data).sg-table-wrapper--box-shadow{box-shadow:none}.sg-table-wrapper--mobile-card .sg-table__head,.sg-table-wrapper--mobile-card-flat .sg-table__head{display:none}.sg-table-wrapper--mobile-card .sg-table__row,.sg-table-wrapper--mobile-card-flat .sg-table__row{display:block;border-radius:12px}.sg-table-wrapper--mobile-card .sg-table__row{box-shadow:var(--first-level-box-shadow)}.sg-table-wrapper--mobile-card-flat .sg-table__row{box-shadow:none}.sg-table-wrapper--mobile-card-flat .sg-table__row{border:1px solid var(--border-color-outer)}.sg-table__cell-expandable-wrapper .sg-table__row{border-width:1px 0 0}.sg-table-wrapper--mobile-card:not(.sg-table-wrapper--reordable) .sg-table__row:not(:last-child),.sg-table-wrapper--mobile-card-flat:not(.sg-table-wrapper--reordable) .sg-table__row:not(:last-child){margin-bottom:20px}.sg-table-wrapper--mobile-card .sg-table__cell,.sg-table-wrapper--mobile-card-flat .sg-table__cell{height:auto;display:block;position:relative;border:none}.sg-table-wrapper--mobile-card .sg-table__cell:nth-child(n+2)::after,.sg-table-wrapper--mobile-card-flat .sg-table__cell:nth-child(n+2)::after{content:attr(data-label);display:block;position:absolute;top:4px;left:20px;font-family:var(--font-family-component);font-weight:500;font-size:var(--typography-table-label-size);line-height:16px;color:var(--typography-dark);text-align:initial;text-transform:capitalize}.sg-table-load-more{margin-top:20px;padding:0;background:none}}@media(max-width: 1500px){.sg-table-wrapper--density-medium .sg-table__cell:first-child{padding-left:20px}.sg-table-wrapper--density-medium .sg-table__cell:first-child::before{left:5px}.sg-table-wrapper--density-medium .sg-table__cell:last-child{padding-right:20px}.sg-table-wrapper--density-medium .sg-table__after-content{padding:20px 20px}.sg-table-wrapper--density-medium .sg-table-wrapper--density-medium .sg-table__cell:first-child{padding-left:40px}.sg-table-wrapper--density-medium .sg-table-wrapper--density-medium .sg-table__cell:last-child{padding-right:40px}.sg-table__cell--height-medium{height:50px}}
51
+ .sg-placeholder-wrapper{display:flex;flex-direction:column;align-items:center;justify-content:center;position:relative;overflow:hidden}.sg-placeholder-wrapper:focus{outline:none}.sg-keyboard .sg-placeholder-wrapper:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-theme-hcl .sg-placeholder-wrapper,.sg-theme-hcb .sg-placeholder-wrapper{border:1px solid var(--high-contrast-foreground)}.sg-placeholder-wrapper--border-radius-medium{border-radius:12px}.sg-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;z-index:2;width:100%}.sg-placeholder--background-white{background-color:var(--background-component-primary)}.sg-placeholder--background-lighter{background-color:var(--background-main)}.sg-placeholder--shadow{box-shadow:var(--first-level-box-shadow)}.sg-placeholder-icon-wrapper{display:flex;justify-content:center;align-items:center;border-radius:50%;background-color:var(--background-component-primary);margin-bottom:20px}.sg-placeholder-spacer{margin-top:40px}.sg-placeholder__images-container{margin:0 auto;width:800px;max-width:100%;position:absolute;height:240px;overflow:hidden;top:40px}.sg-placeholder__background-elements{width:800px;height:240px;max-width:100%;position:absolute}@media(max-width: 1500px){.sg-placeholder__background-elements{display:none}.sg-placeholder{padding:20px}}
52
+ .sg-table-dnd-placeholder{width:100%}.sg-table-dnd-placeholder tr{display:flex}.sg-table-dnd-placeholder td{display:flex;align-items:center;flex:1}.sg-icon-expandable{margin-right:15px}
53
+ .table-row--loading{pointer-events:none}.table-row--loading .table-row__cell--loading{padding:5px}.table-row__loader-wrapper{display:flex;align-items:center;justify-content:center;width:100%;max-width:100%;height:100%;position:relative}.hammerjs-wrapper{-webkit-user-select:auto !important;-moz-user-select:auto !important;-ms-user-select:auto !important;user-select:auto !important}@media(max-width: 800px){.table-row__loader-wrapper{min-height:50px}}
54
+ .sg-security-list{position:relative;grid-template-columns:1fr auto}@media(max-width: 800px){.sg-security-list{grid-template-columns:none}}
55
+ .sg-label{border:1px solid transparent;border-radius:2px;color:var(--typography-white);line-height:1;font-family:var(--font-family-component);font-weight:600;text-transform:uppercase;display:inline-flex;align-items:center;flex-shrink:0}.sg-label:focus{box-shadow:var(--first-level-box-shadow);outline:none}.sg-label--size-small{font-size:14px;padding:2px 5px}.sg-label--size-medium{font-size:13px;padding:2px 5px}.sg-label--size-large{font-size:16px;padding:4px 7px}.sg-label{background-color:currentColor}.sg-label .sg-label__text{color:var(--color-button-white)}.sg-label--type-outlined{border-color:currentColor;background-color:var(--background-component-primary)}.sg-label--type-outlined .sg-label__text{color:currentColor}.sg-label--type-link{background-color:transparent}.sg-label--type-link .sg-label__text{color:currentColor}
56
+ .sg-switch{display:inline-flex;align-items:center;color:var(--typography-dark);cursor:pointer;font-family:var(--font-family-component);font-weight:400;padding:1px}.sg-switch:focus{outline:none}.sg-switch:focus .sg-switch__slider{box-shadow:var(--first-level-box-shadow)}.sg-switch__input{display:none}.sg-switch__slider{display:block;flex-shrink:0;position:relative;background-color:var(--background-slider);cursor:pointer}.sg-switch__slider:focus{box-shadow:var(--first-level-box-shadow)}.sg-switch__slider::after{content:"";position:absolute;top:2px;left:2px;bottom:2px;width:calc(50% - 1px);background-color:var(--background-component-primary);border-radius:50%;transition:.4s}.sg-switch--disabled{opacity:.5;pointer-events:none}.sg-switch__input:checked+.sg-switch__slider{background-color:var(--background-button-primary)}.sg-switch__input:checked+.sg-switch__slider::after{-webkit-transform:translateX(calc(100% - 2px));transform:translateX(calc(100% - 2px))}.sg-switch--small .sg-switch__slider{height:20px;width:34px;border-radius:15px}.sg-switch--small .sg-switch__label{margin-left:6px;font-size:14px;line-height:18px}.sg-switch--medium .sg-switch__slider{height:30px;width:54px;border-radius:15px}.sg-switch--medium .sg-switch__label{margin-left:6px;font-size:16px;line-height:26px}.sg-switch--large .sg-switch__slider{height:40px;width:74px;border-radius:20px}.sg-switch--large .sg-switch__label{margin-left:8px;font-size:18px;line-height:28px}@media screen and (-ms-high-contrast: active),screen and (-ms-high-contrast: none){.sg-switch__input:checked+.sg-switch__slider::after{left:auto;right:2px}}
57
+ .sg-radio-button{display:inline-flex;align-items:flex-start;color:var(--typography-dark);cursor:pointer;font-family:var(--font-family-component);font-weight:400}.sg-radio-button:focus{outline:none}.sg-radio-button:focus .sg-radio-button__icon{box-shadow:var(--first-level-box-shadow)}.sg-radio-button__input{display:none}.sg-radio-button__icon{flex-shrink:0;border:1px solid var(--border-color-default);border-radius:50%;background:var(--background-component-primary);color:transparent}.sg-radio-button--disabled{opacity:.5;pointer-events:none}.sg-radio-button--small{padding:7px 0}.sg-radio-button--small .sg-radio-button__icon{width:12px;height:12px;margin-top:1px}.sg-radio-button--small .sg-radio-button__label{font-size:14px;line-height:18px}.sg-radio-button--small .sg-radio-button__icon+.sg-radio-button__label,.sg-radio-button--small .sg-radio-button__label+.sg-radio-button__icon{margin-left:6px}.sg-radio-button--medium{padding:9px 0}.sg-radio-button--medium .sg-radio-button__icon{width:18px;height:18px;margin-top:1px}.sg-radio-button--medium .sg-radio-button__label{font-size:16px;line-height:26px}.sg-radio-button--medium .sg-radio-button__icon+.sg-radio-button__label,.sg-radio-button--medium .sg-radio-button__label+.sg-radio-button__icon{margin-left:8px}.sg-radio-button--large{padding:11px 0}.sg-radio-button--large .sg-radio-button__icon{width:22px;height:22px;margin-top:2px}.sg-radio-button--large .sg-radio-button__label{font-size:18px;line-height:28px}.sg-radio-button--large .sg-radio-button__icon+.sg-radio-button__label,.sg-radio-button--large .sg-radio-button__label+.sg-radio-button__icon{margin-left:10px}.sg-radio-button--x-large{padding:15px 0}.sg-radio-button--x-large .sg-radio-button__icon{width:25px;height:25px;margin-top:2px}.sg-radio-button--x-large .sg-radio-button__label{font-size:22px;line-height:32px}.sg-radio-button--x-large .sg-radio-button__icon+.sg-radio-button__label,.sg-radio-button--x-large .sg-radio-button__label+.sg-radio-button__icon{margin-left:15px}.sg-radio-button__input:focus~.sg-radio-button__icon{box-shadow:var(--first-level-box-shadow)}.sg-radio-button__input:checked~.sg-radio-button__icon{border:1px solid var(--color-primary);color:var(--color-primary)}
58
+ .sg-notice{display:flex;position:relative;background-color:var(--background-component-primary);border-top-left-radius:12px;border-top-right-radius:12px;border-bottom-left-radius:12px;border-bottom-right-radius:12px;color:var(--typography-dark);text-align:start}.sg-notice:focus{outline:none}.sg-keyboard .sg-notice:focus{outline:none;box-shadow:var(--focus-shadow)}.sg-notice .sg-notice__close-icon{color:currentColor}.sg-notice__icon{margin-top:0}.sg-notice__icon--center-by-title{margin-top:4px}.sg-notice__content{flex:1 1 0;word-break:break-word}.sg-notice__content--size-limited{max-width:800px}.sg-notice__content--size-expanded{max-width:100%}.sg-notice__close-icon{position:absolute;top:15px;right:20px}.sg-notice--shadow{box-shadow:var(--first-level-box-shadow)}.sg-notice--shadow:focus{outline:none}.sg-keyboard .sg-notice--shadow:focus{outline:none;box-shadow:var(--first-level-box-shadow),var(--focus-shadow)}.sg-notice--type-success{border:3px solid var(--color-success)}.sg-notice--type-success .sg-list__icon{color:var(--color-success)}.sg-notice--type-error{border:3px solid var(--color-error)}.sg-notice--type-error .sg-list__icon{color:var(--color-error)}.sg-notice--type-warning{border:3px solid var(--color-warning)}.sg-notice--type-warning .sg-list__icon{color:var(--color-warning)}.sg-notice--type-instruction{border:3px solid var(--color-instruction)}.sg-notice--type-instruction .sg-list__icon{color:var(--color-instruction)}.sg-notice--type-info{border:3px solid var(--color-info)}.sg-notice--type-info .sg-list__icon{color:var(--color-info)}.sg-notice--type-hint{border:3px solid var(--color-hint)}.sg-notice--density-compact{padding:10px}.sg-notice--density-compact .sg-notice--border{border-width:2px}.sg-notice--density-compact .sg-notice__content{padding:0 10px 0 10px}.sg-notice--density-cozy{padding:15px 20px}.sg-notice--density-cozy .sg-notice__content{padding:0 10px 5px 20px}@media(max-width: 1500px){.sg-notice--density-compact,.sg-notice--density-cozy{padding:10px}.sg-notice--density-compact .sg-notice__content,.sg-notice--density-cozy .sg-notice__content{padding:0 10px 0 10px}.sg-notice--border{border-width:2px}}
59
+ .sg-time-picker.sg-dialog{padding:0}.sg-time-picker .sg-time-picker-header{margin-top:0}.sg-time-picker__input,.sg-time-picker__field{cursor:pointer;caret-color:transparent}.sg-time-picker__input.sg-time-picker__input--disabled,.sg-time-picker__input.sg-time-picker__field--disabled,.sg-time-picker__field.sg-time-picker__input--disabled,.sg-time-picker__field.sg-time-picker__field--disabled{cursor:not-allowed}.sg-time-picker__content{padding-top:30px;padding-bottom:30px;height:280px;width:100%;overflow-x:hidden;overflow-y:auto;overflow-y:overlay}.sg-time-picker__content--flex{display:flex;align-items:center;justify-content:center}.sg-time-picker__column{display:flex;flex-direction:column;justify-content:space-between;align-items:center;min-width:50px;min-height:160px}.sg-time-picker__column--justify-center{justify-content:center}.sg-time-picker__column--margin-start{margin-left:30px}.sg-time-picker-entity{cursor:pointer;line-height:36px}.sg-time-picker-entity:hover{color:var(--color-secondary)}.sg-time-picker-entity--selected{color:var(--color-secondary);font-size:26px}
60
+ .sg-time-picker-button{display:flex;justify-content:center;align-items:center;width:60px;background-color:transparent;color:var(--typography-dark);border:none;border-radius:12px;font-family:var(--font-family-component);font-weight:500;font-size:22px;text-transform:uppercase}.sg-time-picker-button:hover{cursor:pointer}.sg-time-picker-button:hover,.sg-time-picker-button:focus{color:var(--component-color-hover);background-color:var(--component-background-hover)}.sg-time-picker-button--size-large{height:40px}.sg-time-picker-button--size-xx-large{height:60px}.sg-time-picker-button--color-secondary{color:var(--color-secondary)}.sg-time-picker-button--background-secondary{color:var(--typography-white);background-color:var(--color-secondary)}.sg-time-picker-button--background-secondary:focus,.sg-time-picker-button--background-secondary:hover{background-color:var(--color-secondary-hovered)}
61
+ .sg-layout{display:flex;flex-direction:column;width:100%;overflow:hidden;background:var(--background-main)}.sg-layout--absolute{position:absolute;top:0;left:0;right:0;bottom:0}.sg-layout__page{position:relative;display:flex;flex:1 1 0;overflow:hidden;z-index:10}.sg-layout__wrapper{display:flex;height:100%;overflow-y:auto;position:relative}.sg-layout__drawer{width:0;height:100%;flex-shrink:0;position:relative;z-index:30;overflow-x:hidden;overflow-y:auto;background-color:var(--drawer-background);transition-property:width,-webkit-transform;transition-property:width,transform;transition-property:width,transform,-webkit-transform;transition-duration:150ms;transition-timing-function:linear;transition-delay:0ms}.sg-theme-hcl .sg-layout__drawer,.sg-theme-hcb .sg-layout__drawer{border-right:1px solid var(--high-contrast-foreground);box-shadow:var(--first-level-box-shadow)}.sg-layout__drawer--opened{width:280px}.sg-layout__drawer--compact{width:280px}.sg-drawer__overlay{position:absolute;top:0;right:0;bottom:0;left:0;display:none;cursor:pointer}@media(max-width: 1024px){.sg-layout__drawer{position:absolute;top:0;bottom:0;left:0;-webkit-transform:translateX(-260px);transform:translateX(-260px);box-shadow:var(--first-level-box-shadow)}.sg-layout__drawer--opened{-webkit-transform:translateX(0);transform:translateX(0)}.sg-drawer__overlay--opened{display:block}}@media(max-width: 1500px){.sg-layout__drawer--opened{width:250px}.sg-layout__drawer--compact{width:60px;position:relative;-webkit-transform:translateX(0);transform:translateX(0)}}
62
+ .sg-page{position:relative;flex:1 1 0;padding-left:0;background:var(--background-main);overflow-x:hidden;overflow-y:auto}.sg-page:focus{outline:none}.sg-keyboard .sg-page:focus{outline:none;box-shadow:var(--focus-shadow)}
63
+ .sg-notifications{position:fixed;top:100px;right:15px;z-index:150;overflow-x:hidden;padding:10px 15px 30px 15px}.sg-notifications strong{word-wrap:anywhere;word-break:break-all}.sg-notifications-is-empty{pointer-events:none}.sg-notification{display:flex;align-items:center;min-height:50px;max-width:390px;padding-right:10px;border-radius:12px;background-color:var(--background-component-primary);box-shadow:var(--second-level-box-shadow);overflow:hidden;-webkit-transform:translateX(0);transform:translateX(0);transition:-webkit-transform .3s ease;transition:transform .3s ease;transition:transform .3s ease, -webkit-transform .3s ease}.sg-notification:focus{outline:none}.sg-keyboard .sg-notification:focus{outline:none;box-shadow:var(--second-level-box-shadow),var(--focus-shadow)}.sg-notification:not(:first-child){margin-top:20px}.sg-notification--animation-enter,.sg-notification--animation-exit{-webkit-transform:translateX(calc(100% + 20px));transform:translateX(calc(100% + 20px))}.sg-theme-hcl .sg-notification,.sg-theme-hcb .sg-notification{border:1px solid var(--high-contrast-foreground)}.sg-notification__icon{display:flex;justify-content:center;align-items:center;align-self:stretch;flex-shrink:0;width:50px;color:var(--typography-white)}.sg-notification__close-icon{color:var(--color-icon-button);cursor:pointer}.sg-notification__content{flex:auto;padding:15px 20px;word-break:break-word}.sg-notification--success .sg-notification__icon{background-color:var(--color-success)}.sg-notification--error .sg-notification__icon{background-color:var(--color-error)}.sg-notification--warning .sg-notification__icon{background-color:var(--color-warning)}.sg-notification--instruction .sg-notification__icon{background-color:var(--color-instruction)}.sg-notification--info .sg-notification__icon{background-color:var(--color-info)}.sg-notification--hint .sg-notification__icon{background-color:var(--color-hint)}.sg-theme-hcl .sg-notification--success .sg-notification__icon,.sg-theme-hcl .sg-notification--error .sg-notification__icon,.sg-theme-hcl .sg-notification--warning .sg-notification__icon,.sg-theme-hcl .sg-notification--instruction .sg-notification__icon,.sg-theme-hcl .sg-notification--info .sg-notification__icon,.sg-theme-hcl .sg-notification--hint .sg-notification__icon,.sg-theme-hcb .sg-notification--success .sg-notification__icon,.sg-theme-hcb .sg-notification--error .sg-notification__icon,.sg-theme-hcb .sg-notification--warning .sg-notification__icon,.sg-theme-hcb .sg-notification--instruction .sg-notification__icon,.sg-theme-hcb .sg-notification--info .sg-notification__icon,.sg-theme-hcb .sg-notification--hint .sg-notification__icon{color:var(--high-contrast-background)}@media(max-width: 800px){.sg-notifications{top:60px;left:0;right:0;overflow-x:visible;padding:0}.sg-notification{-webkit-transform:translateY(0);transform:translateY(0);transition:-webkit-transform .7s ease;transition:transform .7s ease;transition:transform .7s ease, -webkit-transform .7s ease;max-width:100%}.sg-notification--animation-enter{-webkit-transform:translateY(-100vh);transform:translateY(-100vh)}.sg-notification--animation-exit{-webkit-transform:translateY(calc(-50vh - 100%));transform:translateY(calc(-50vh - 100%))}.sg-notification .sg-notification__icon{width:40px}.sg-notification .sg-notification__content{padding:10px 15px}.sg-notification__icon{width:40px}}
assets/images/icon.svg ADDED
@@ -0,0 +1 @@
 
1
+ <svg id="e4e50d01-0246-43a7-bdfe-0fa56d7fbf3e" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150.004 150"><path d="M136.64,82.639c.285-5.389.613-10.113-.438-15.408L149.7,58.875l-10.51-24.751-15.216,3.111c-2.961-3.815-7.257-7.534-10.884-11.3l2.9-15.649L91.076,0,82.641,13.36a119.665,119.665,0,0,0-15.456-.226L58.877.307,34.126,10.818l3.109,15.216c-4.481,3.008-7.532,7.254-11.3,10.883l-15.648-2.9L0,58.925l13.363,8.436c-.951,5.439-.566,10.781-.229,15.456L.307,91.125,10.82,115.876l15.216-3.109c3.006,4.481,7.255,7.532,10.883,11.3l-2.9,15.649L58.929,150l8.434-13.36c5.438.95,10.113.613,15.456.228L91.127,149.7l24.752-10.513-3.112-15.215c3.815-2.959,7.534-7.255,11.3-10.884l15.651,2.9L150,91.075Zm-34,25.38a3.13,3.13,0,0,1-3.13,3.131H50.489a3.131,3.131,0,0,1-3.131-3.131V68.293a3.13,3.13,0,0,1,3.131-3.13h3.574c.026-4.331-.006-8.664.13-12.991a17.553,17.553,0,0,1,1.791-6.8,20.264,20.264,0,0,1,6.723-8.111,18.75,18.75,0,0,1,6.708-3.033,19.512,19.512,0,0,1,5.4-.579,19.917,19.917,0,0,1,15.863,9.09,19.621,19.621,0,0,1,2.784,6.588,24.62,24.62,0,0,1,.594,5.455c-.011,3.461,0,6.922,0,10.383h5.46a3.13,3.13,0,0,1,3.13,3.13Z" fill="#fff"></path><path d="M79.7,89.183a2.437,2.437,0,0,1,.762-2.914,4.284,4.284,0,0,0,.972-1.082,7.613,7.613,0,0,0-.341-8.387c-2.315-3.195-5.822-4.257-8.924-2.478a7.711,7.711,0,0,0-4.278,7.321,5.877,5.877,0,0,0,2.013,4.53,2.444,2.444,0,0,1,.865,2.87c-.592,2.006-1.109,4.036-1.625,6.065-.61,2.4-1.464,4.744-1.3,7.3.046.724.207,1,.952.982,2.1-.045,6.313.032,6.313.056,2.231,0,4.462.015,6.693-.023.237,0,.667-.309.673-.487a13.151,13.151,0,0,0-.07-3.41C81.589,96.057,80.623,92.625,79.7,89.183Z" fill="#fff"></path><path d="M87.332,46.719a15.194,15.194,0,0,0-5.884-6.112,12.026,12.026,0,0,0-4.407-1.641,30.214,30.214,0,0,0-3.929-.279A12.552,12.552,0,0,0,67.7,40.075a14.974,14.974,0,0,0-6.984,6.763,14.111,14.111,0,0,0-1.729,6.381c-.03,2.038-.006,4.077-.006,6.116h-.013c0,1.942,0,3.885.007,5.828H89.138c.018-4.072.041-8.144-.027-12.215A13.773,13.773,0,0,0,87.332,46.719Z" fill="#fff"></path></svg>
assets/images/logo.gif ADDED
Binary file
assets/js/admin.js ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global ajaxurl*/
2
+ ;(function( $ ) {
3
+ $(document).ready(function() {
4
+ $('.dismiss-sg-security-notice').on('click', function(e) {
5
+ let $this = $(this);
6
+ $.ajax(
7
+ $this.data('link')
8
+ )
9
+ .success(function() {
10
+ $this.parents('.notice-error').remove()
11
+ })
12
+
13
+ })
14
+ })
15
+ })( jQuery )
assets/js/main.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! For license information please see main.min.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SGSecurity=t():e.SGSecurity=t()}(self,(function(){return function(){var e={718:function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},3381:function(e,t){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(this&&this[n]||n);else if(Array.isArray(n))e.push(o.apply(this,n));else if("object"===a)for(var i in n)r.call(n,i)&&n[i]&&e.push(this&&this[i]||i)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},2580:function(e,t,n){var r;t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)}},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(r=!1,function(){r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||function(){},e.exports=n(3211)(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},3211:function(e,t,n){var r=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},o=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(r(arguments[t]));return e};e.exports=function(e){function t(e){var n,o,a,i=null;function l(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(l.enabled){var o=l,a=Number(new Date),i=a-(n||a);o.diff=i,o.prev=n,o.curr=a,n=a,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");var u=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(function(n,r){if("%%"===n)return"%";u++;var a=t.formatters[r];if("function"==typeof a){var i=e[u];n=a.call(o,i),e.splice(u,1),u--}return n})),t.formatArgs.call(o,e);var s=o.log||t.log;s.apply(o,e)}}return l.namespace=e,l.useColors=t.useColors(),l.color=t.selectColor(e),l.extend=r,l.destroy=t.destroy,Object.defineProperty(l,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==i?i:(o!==t.namespaces&&(o=t.namespaces,a=t.enabled(e)),a)},set:function(e){i=e}}),"function"==typeof t.init&&t.init(l),l}function r(e,n){var r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){var e=o(t.names.map(a),t.skips.map(a).map((function(e){return"-"+e}))).join(",");return t.enable(""),e},t.enable=function(e){var n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n<o;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(9717),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((function(n){t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){for(var n=0,r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},6605:function(e,t,n){"use strict";var r=n(718);t.__esModule=!0,t.default=function(e,t){e.classList?e.classList.add(t):(0,o.default)(e,t)||("string"==typeof e.className?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))};var o=r(n(4120));e.exports=t.default},4120:function(e,t){"use strict";t.__esModule=!0,t.default=function(e,t){return e.classList?!!t&&e.classList.contains(t):-1!==(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")},e.exports=t.default},4213:function(e){"use strict";function t(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}e.exports=function(e,n){e.classList?e.classList.remove(n):"string"==typeof e.className?e.className=t(e.className,n):e.setAttribute("class",t(e.className&&e.className.baseVal||"",n))}},696:function(e){"use strict";var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}m(e,t,a,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var i=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function s(e,t,n,r){var o,a,i,s;if(l(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),i=a[t]),void 0===i)i=a[t]=n,++e._eventsCount;else if("function"==typeof i?i=a[t]=r?[n,i]:[i,n]:r?i.unshift(n):i.push(n),(o=u(e))>0&&i.length>o&&!i.warned){i.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=i.length,s=c,console&&console.warn&&console.warn(s)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=c.bind(r);return o.listener=n,r.wrapFn=o,o}function p(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):h(o,o.length)}function d(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function m(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(a){r.once&&e.removeEventListener(t,o),n(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return i},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");i=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,a=this._events;if(void 0!==a)o=o&&void 0===a.error;else if(!o)return!1;if(o){var i;if(t.length>0&&(i=t[0]),i instanceof Error)throw i;var l=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw l.context=i,l}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)r(u,this,t);else{var s=u.length,c=h(u,s);for(n=0;n<s;++n)r(c[n],this,t)}return!0},a.prototype.addListener=function(e,t){return s(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return s(this,e,t,!0)},a.prototype.once=function(e,t){return l(t),this.on(e,f(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,f(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,o,a,i;if(l(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){i=n[a].listener,o=a;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,i||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,a=Object.keys(n);for(r=0;r<a.length;++r)"removeListener"!==(o=a[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},1231:function(e){"use strict";function t(e){return function(){return e}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},2802:function(e){"use strict";e.exports=function(e,t,n,r,o,a,i,l){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,r,o,a,i,l],c=0;(u=new Error(t.replace(/%s/g,(function(){return s[c++]})))).name="Invariant Violation"}throw u.framesToPop=1,u}}},7012:function(e,t,n){"use strict";var r=n(1231);e.exports=r},5544:function(e,t,n){var r;!function(o,a,i,l){"use strict";var u,s=["","webkit","Moz","MS","ms","o"],c=a.createElement("div"),f=Math.round,p=Math.abs,d=Date.now;function h(e,t,n){return setTimeout(E(e,n),t)}function m(e,t,n){return!!Array.isArray(e)&&(y(e,n[t],n),!0)}function y(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==l)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function g(e,t,n){var r="DEPRECATED METHOD: "+t+"\n"+n+" AT \n";return function(){var t=new Error("get-stack-trace"),n=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",a=o.console&&(o.console.warn||o.console.log);return a&&a.call(o.console,r,n),e.apply(this,arguments)}}u="function"!=typeof Object.assign?function(e){if(e===l||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==l&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var v=g((function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===l)&&(e[r[o]]=t[r[o]]),o++;return e}),"extend","Use `assign`."),b=g((function(e,t){return v(e,t,!0)}),"merge","Use `assign`.");function w(e,t,n){var r,o=t.prototype;(r=e.prototype=Object.create(o)).constructor=e,r._super=o,n&&u(r,n)}function E(e,t){return function(){return e.apply(t,arguments)}}function _(e,t){return"function"==typeof e?e.apply(t&&t[0]||l,t):e}function O(e,t){return e===l?t:e}function S(e,t,n){y(T(t),(function(t){e.addEventListener(t,n,!1)}))}function x(e,t,n){y(T(t),(function(t){e.removeEventListener(t,n,!1)}))}function k(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function C(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function P(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;r<e.length;){if(n&&e[r][n]==t||!n&&e[r]===t)return r;r++}return-1}function N(e){return Array.prototype.slice.call(e,0)}function I(e,t,n){for(var r=[],o=[],a=0;a<e.length;){var i=t?e[a][t]:e[a];P(o,i)<0&&r.push(e[a]),o[a]=i,a++}return n&&(r=t?r.sort((function(e,n){return e[t]>n[t]})):r.sort()),r}function j(e,t){for(var n,r,o=t[0].toUpperCase()+t.slice(1),a=0;a<s.length;){if((r=(n=s[a])?n+o:t)in e)return r;a++}return l}var R=1;function A(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||o}var D="ontouchstart"in o,M=j(o,"PointerEvent")!==l,L=D&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),F="touch",z="mouse",U=["x","y"],V=["clientX","clientY"];function H(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){_(e.options.enable,[e])&&n.handler(t)},this.init()}function B(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=1&t&&r-o==0,i=12&t&&r-o==0;n.isFirst=!!a,n.isFinal=!!i,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=W(t)),o>1&&!n.firstMultiple?n.firstMultiple=W(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,i=n.firstMultiple,u=i?i.center:a.center,s=t.center=K(r);t.timeStamp=d(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=$(u,s),t.distance=G(u,s),function(e,t){var n=t.center,r=e.offsetDelta||{},o=e.prevDelta||{},a=e.prevInput||{};1!==t.eventType&&4!==a.eventType||(o=e.prevDelta={x:a.deltaX||0,y:a.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=o.x+(n.x-r.x),t.deltaY=o.y+(n.y-r.y)}(n,t),t.offsetDirection=Y(t.deltaX,t.deltaY);var c,f,h=q(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=p(h.x)>p(h.y)?h.x:h.y,t.scale=i?(c=i.pointers,G((f=r)[0],f[1],V)/G(c[0],c[1],V)):1,t.rotation=i?function(e,t){return $(t[1],t[0],V)+$(e[1],e[0],V)}(i.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,r,o,a,i=e.lastInterval||t,u=t.timeStamp-i.timeStamp;if(8!=t.eventType&&(u>25||i.velocity===l)){var s=t.deltaX-i.deltaX,c=t.deltaY-i.deltaY,f=q(u,s,c);r=f.x,o=f.y,n=p(f.x)>p(f.y)?f.x:f.y,a=Y(s,c),e.lastInterval=t}else n=i.velocity,r=i.velocityX,o=i.velocityY,a=i.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var m=e.element;k(t.srcEvent.target,m)&&(m=t.srcEvent.target),t.target=m}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function W(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:f(e.pointers[n].clientX),clientY:f(e.pointers[n].clientY)},n++;return{timeStamp:d(),pointers:t,center:K(t),deltaX:e.deltaX,deltaY:e.deltaY}}function K(e){var t=e.length;if(1===t)return{x:f(e[0].clientX),y:f(e[0].clientY)};for(var n=0,r=0,o=0;o<t;)n+=e[o].clientX,r+=e[o].clientY,o++;return{x:f(n/t),y:f(r/t)}}function q(e,t,n){return{x:t/e||0,y:n/e||0}}function Y(e,t){return e===t?1:p(e)>=p(t)?e<0?2:4:t<0?8:16}function G(e,t,n){n||(n=U);var r=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return Math.sqrt(r*r+o*o)}function $(e,t,n){n||(n=U);var r=t[n[0]]-e[n[0]],o=t[n[1]]-e[n[1]];return 180*Math.atan2(o,r)/Math.PI}H.prototype={handler:function(){},init:function(){this.evEl&&S(this.element,this.evEl,this.domHandler),this.evTarget&&S(this.target,this.evTarget,this.domHandler),this.evWin&&S(A(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(A(this.element),this.evWin,this.domHandler)}};var X={mousedown:1,mousemove:2,mouseup:4},Q="mousedown",J="mousemove mouseup";function Z(){this.evEl=Q,this.evWin=J,this.pressed=!1,H.apply(this,arguments)}w(Z,H,{handler:function(e){var t=X[e.type];1&t&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=4),this.pressed&&(4&t&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:z,srcEvent:e}))}});var ee={pointerdown:1,pointermove:2,pointerup:4,pointercancel:8,pointerout:8},te={2:F,3:"pen",4:z,5:"kinect"},ne="pointerdown",re="pointermove pointerup pointercancel";function oe(){this.evEl=ne,this.evWin=re,H.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(ne="MSPointerDown",re="MSPointerMove MSPointerUp MSPointerCancel"),w(oe,H,{handler:function(e){var t=this.store,n=!1,r=e.type.toLowerCase().replace("ms",""),o=ee[r],a=te[e.pointerType]||e.pointerType,i=a==F,l=P(t,e.pointerId,"pointerId");1&o&&(0===e.button||i)?l<0&&(t.push(e),l=t.length-1):12&o&&(n=!0),l<0||(t[l]=e,this.callback(this.manager,o,{pointers:t,changedPointers:[e],pointerType:a,srcEvent:e}),n&&t.splice(l,1))}});var ae={touchstart:1,touchmove:2,touchend:4,touchcancel:8},ie="touchstart",le="touchstart touchmove touchend touchcancel";function ue(){this.evTarget=ie,this.evWin=le,this.started=!1,H.apply(this,arguments)}function se(e,t){var n=N(e.touches),r=N(e.changedTouches);return 12&t&&(n=I(n.concat(r),"identifier",!0)),[n,r]}w(ue,H,{handler:function(e){var t=ae[e.type];if(1===t&&(this.started=!0),this.started){var n=se.call(this,e,t);12&t&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:F,srcEvent:e})}}});var ce={touchstart:1,touchmove:2,touchend:4,touchcancel:8},fe="touchstart touchmove touchend touchcancel";function pe(){this.evTarget=fe,this.targetIds={},H.apply(this,arguments)}function de(e,t){var n=N(e.touches),r=this.targetIds;if(3&t&&1===n.length)return r[n[0].identifier]=!0,[n,n];var o,a,i=N(e.changedTouches),l=[],u=this.target;if(a=n.filter((function(e){return k(e.target,u)})),1===t)for(o=0;o<a.length;)r[a[o].identifier]=!0,o++;for(o=0;o<i.length;)r[i[o].identifier]&&l.push(i[o]),12&t&&delete r[i[o].identifier],o++;return l.length?[I(a.concat(l),"identifier",!0),l]:void 0}function he(){H.apply(this,arguments);var e=E(this.handler,this);this.touch=new pe(this.manager,e),this.mouse=new Z(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function me(e,t){1&e?(this.primaryTouch=t.changedPointers[0].identifier,ye.call(this,t)):12&e&&ye.call(this,t)}function ye(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var r=this.lastTouches;setTimeout((function(){var e=r.indexOf(n);e>-1&&r.splice(e,1)}),2500)}}function ge(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,r=0;r<this.lastTouches.length;r++){var o=this.lastTouches[r],a=Math.abs(t-o.x),i=Math.abs(n-o.y);if(a<=25&&i<=25)return!0}return!1}w(pe,H,{handler:function(e){var t=ce[e.type],n=de.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:F,srcEvent:e})}}),w(he,H,{handler:function(e,t,n){var r=n.pointerType==F,o=n.pointerType==z;if(!(o&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(r)me.call(this,t,n);else if(o&&ge.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var ve=j(c.style,"touchAction"),be=ve!==l,we="compute",Ee="auto",_e="manipulation",Oe="none",Se="pan-x",xe="pan-y",ke=function(){if(!be)return!1;var e={},t=o.CSS&&o.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(n){e[n]=!t||o.CSS.supports("touch-action",n)})),e}();function Ce(e,t){this.manager=e,this.set(t)}Ce.prototype={set:function(e){e==we&&(e=this.compute()),be&&this.manager.element.style&&ke[e]&&(this.manager.element.style[ve]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return y(this.manager.recognizers,(function(t){_(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))})),function(e){if(C(e,Oe))return Oe;var t=C(e,Se),n=C(e,xe);return t&&n?Oe:t||n?t?Se:xe:C(e,_e)?_e:Ee}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var r=this.actions,o=C(r,Oe)&&!ke.none,a=C(r,xe)&&!ke["pan-y"],i=C(r,Se)&&!ke["pan-x"];if(o){var l=1===e.pointers.length,u=e.distance<2,s=e.deltaTime<250;if(l&&u&&s)return}if(!i||!a)return o||a&&6&n||i&&24&n?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Te=32;function Pe(e){this.options=u({},this.defaults,e||{}),this.id=R++,this.manager=null,this.options.enable=O(this.options.enable,!0),this.state=1,this.simultaneous={},this.requireFail=[]}function Ne(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function Ie(e){return 16==e?"down":8==e?"up":2==e?"left":4==e?"right":""}function je(e,t){var n=t.manager;return n?n.get(e):e}function Re(){Pe.apply(this,arguments)}function Ae(){Re.apply(this,arguments),this.pX=null,this.pY=null}function De(){Re.apply(this,arguments)}function Me(){Pe.apply(this,arguments),this._timer=null,this._input=null}function Le(){Re.apply(this,arguments)}function Fe(){Re.apply(this,arguments)}function ze(){Pe.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ue(e,t){return(t=t||{}).recognizers=O(t.recognizers,Ue.defaults.preset),new Ve(e,t)}function Ve(e,t){this.options=u({},Ue.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new(this.options.inputClass||(M?oe:L?pe:D?he:Z))(this,B),this.touchAction=new Ce(this,this.options.touchAction),He(this,!0),y(this.options.recognizers,(function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])}),this)}function He(e,t){var n,r=e.element;r.style&&(y(e.options.cssProps,(function(o,a){n=j(r.style,a),t?(e.oldCssProps[n]=r.style[n],r.style[n]=o):r.style[n]=e.oldCssProps[n]||""})),t||(e.oldCssProps={}))}Pe.prototype={defaults:{},set:function(e){return u(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(m(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=je(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return m(e,"dropRecognizeWith",this)||(e=je(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(m(e,"requireFailure",this))return this;var t=this.requireFail;return-1===P(t,e=je(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(m(e,"dropRequireFailure",this))return this;e=je(e,this);var t=P(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function r(n){t.manager.emit(n,e)}n<8&&r(t.options.event+Ne(n)),r(t.options.event),e.additionalEvent&&r(e.additionalEvent),n>=8&&r(t.options.event+Ne(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=Te},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(33&this.requireFail[e].state))return!1;e++}return!0},recognize:function(e){var t=u({},e);if(!_(this.options.enable,[this,t]))return this.reset(),void(this.state=Te);56&this.state&&(this.state=1),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},w(Re,Pe,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,r=6&t,o=this.attrTest(e);return r&&(8&n||!o)?16|t:r||o?4&n?8|t:2&t?4|t:2:Te}}),w(Ae,Re,{defaults:{event:"pan",threshold:10,pointers:1,direction:30},getTouchAction:function(){var e=this.options.direction,t=[];return 6&e&&t.push(xe),24&e&&t.push(Se),t},directionTest:function(e){var t=this.options,n=!0,r=e.distance,o=e.direction,a=e.deltaX,i=e.deltaY;return o&t.direction||(6&t.direction?(o=0===a?1:a<0?2:4,n=a!=this.pX,r=Math.abs(e.deltaX)):(o=0===i?1:i<0?8:16,n=i!=this.pY,r=Math.abs(e.deltaY))),e.direction=o,n&&r>t.threshold&&o&t.direction},attrTest:function(e){return Re.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Ie(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),w(De,Re,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Oe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),w(Me,Pe,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ee]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,o=e.deltaTime>t.time;if(this._input=e,!r||!n||12&e.eventType&&!o)this.reset();else if(1&e.eventType)this.reset(),this._timer=h((function(){this.state=8,this.tryEmit()}),t.time,this);else if(4&e.eventType)return 8;return Te},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&4&e.eventType?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=d(),this.manager.emit(this.options.event,this._input)))}}),w(Le,Re,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Oe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),w(Fe,Re,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:30,pointers:1},getTouchAction:function(){return Ae.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return 30&n?t=e.overallVelocity:6&n?t=e.overallVelocityX:24&n&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&p(t)>this.options.velocity&&4&e.eventType},emit:function(e){var t=Ie(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),w(ze,Pe,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[_e]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance<t.threshold,o=e.deltaTime<t.time;if(this.reset(),1&e.eventType&&0===this.count)return this.failTimeout();if(r&&o&&n){if(4!=e.eventType)return this.failTimeout();var a=!this.pTime||e.timeStamp-this.pTime<t.interval,i=!this.pCenter||G(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,i&&a?this.count+=1:this.count=1,this._input=e,0==this.count%t.taps)return this.hasRequireFailures()?(this._timer=h((function(){this.state=8,this.tryEmit()}),t.interval,this),2):8}return Te},failTimeout:function(){return this._timer=h((function(){this.state=Te}),this.options.interval,this),Te},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ue.VERSION="2.0.7",Ue.defaults={domEvents:!1,touchAction:we,enable:!0,inputTarget:null,inputClass:null,preset:[[Le,{enable:!1}],[De,{enable:!1},["rotate"]],[Fe,{direction:6}],[Ae,{direction:6},["swipe"]],[ze],[ze,{event:"doubletap",taps:2},["tap"]],[Me]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},Ve.prototype={set:function(e){return u(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var r=this.recognizers,o=t.curRecognizer;(!o||o&&8&o.state)&&(o=t.curRecognizer=null);for(var a=0;a<r.length;)n=r[a],2===t.stopped||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(e),!o&&14&n.state&&(o=t.curRecognizer=n),a++}},get:function(e){if(e instanceof Pe)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(m(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(m(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=P(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==l&&t!==l){var n=this.handlers;return y(T(e),(function(e){n[e]=n[e]||[],n[e].push(t)})),this}},off:function(e,t){if(e!==l){var n=this.handlers;return y(T(e),(function(e){t?n[e]&&n[e].splice(P(n[e],t),1):delete n[e]})),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var n=a.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t,t.target.dispatchEvent(n)}(e,t);var n=this.handlers[e]&&this.handlers[e].slice();if(n&&n.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](t),r++}},destroy:function(){this.element&&He(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},u(Ue,{INPUT_START:1,INPUT_MOVE:2,INPUT_END:4,INPUT_CANCEL:8,STATE_POSSIBLE:1,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:Te,DIRECTION_NONE:1,DIRECTION_LEFT:2,DIRECTION_RIGHT:4,DIRECTION_UP:8,DIRECTION_DOWN:16,DIRECTION_HORIZONTAL:6,DIRECTION_VERTICAL:24,DIRECTION_ALL:30,Manager:Ve,Input:H,TouchAction:Ce,TouchInput:pe,MouseInput:Z,PointerEventInput:oe,TouchMouseInput:he,SingleTouchInput:ue,Recognizer:Pe,AttrRecognizer:Re,Tap:ze,Pan:Ae,Swipe:Fe,Pinch:De,Rotate:Le,Press:Me,on:S,off:x,each:y,merge:b,extend:v,assign:u,inherit:w,bindFn:E,prefixed:j}),(void 0!==o?o:"undefined"!=typeof self?self:{}).Hammer=Ue,(r=function(){return Ue}.call(t,n,t,e))===l||(e.exports=r)}(window,document)},544:function(e,t,n){"use strict";var r=n(5538),o=n(5126);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=r.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=r.join32(e,0,e.length-n,this.endian);for(var o=0;o<e.length;o+=this._delta32)this._update(e,o,o+this._delta32)}return this},a.prototype.digest=function(e){return this.update(this._pad()),o(null===this.pending),this._digest(e)},a.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var o=1;o<n;o++)r[o]=0;if(e<<=3,"big"===this.endian){for(var a=8;a<this.padLength;a++)r[o++]=0;r[o++]=0,r[o++]=0,r[o++]=0,r[o++]=0,r[o++]=e>>>24&255,r[o++]=e>>>16&255,r[o++]=e>>>8&255,r[o++]=255&e}else for(r[o++]=255&e,r[o++]=e>>>8&255,r[o++]=e>>>16&255,r[o++]=e>>>24&255,r[o++]=0,r[o++]=0,r[o++]=0,r[o++]=0,a=8;a<this.padLength;a++)r[o++]=0;return r}},8519:function(e,t,n){"use strict";var r=n(5538),o=n(544),a=n(4313),i=r.rotl32,l=r.sum32,u=r.sum32_5,s=a.ft_1,c=o.BlockHash,f=[1518500249,1859775393,2400959708,3395469782];function p(){if(!(this instanceof p))return new p;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(p,c),e.exports=p,p.blockSize=512,p.outSize=160,p.hmacStrength=80,p.padLength=64,p.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=i(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var o=this.h[0],a=this.h[1],c=this.h[2],p=this.h[3],d=this.h[4];for(r=0;r<n.length;r++){var h=~~(r/20),m=u(i(o,5),s(h,a,c,p),d,n[r],f[h]);d=p,p=c,c=i(a,30),a=o,o=m}this.h[0]=l(this.h[0],o),this.h[1]=l(this.h[1],a),this.h[2]=l(this.h[2],c),this.h[3]=l(this.h[3],p),this.h[4]=l(this.h[4],d)},p.prototype._digest=function(e){return"hex"===e?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},4313:function(e,t,n){"use strict";var r=n(5538).rotr32;function o(e,t,n){return e&t^~e&n}function a(e,t,n){return e&t^e&n^t&n}function i(e,t,n){return e^t^n}t.ft_1=function(e,t,n,r){return 0===e?o(t,n,r):1===e||3===e?i(t,n,r):2===e?a(t,n,r):void 0},t.ch32=o,t.maj32=a,t.p32=i,t.s0_256=function(e){return r(e,2)^r(e,13)^r(e,22)},t.s1_256=function(e){return r(e,6)^r(e,11)^r(e,25)},t.g0_256=function(e){return r(e,7)^r(e,18)^e>>>3},t.g1_256=function(e){return r(e,17)^r(e,19)^e>>>10}},5538:function(e,t,n){"use strict";var r=n(5126),o=n(369);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function l(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=o,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),o=0;o<e.length;o+=2)n.push(parseInt(e[o]+e[o+1],16))}else for(var r=0,o=0;o<e.length;o++){var i=e.charCodeAt(o);i<128?n[r++]=i:i<2048?(n[r++]=i>>6|192,n[r++]=63&i|128):a(e,o)?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++o)),n[r++]=i>>18|240,n[r++]=i>>12&63|128,n[r++]=i>>6&63|128,n[r++]=63&i|128):(n[r++]=i>>12|224,n[r++]=i>>6&63|128,n[r++]=63&i|128)}else for(o=0;o<e.length;o++)n[o]=0|e[o];return n},t.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=l(e[n].toString(16));return t},t.htonl=i,t.toHex32=function(e,t){for(var n="",r=0;r<e.length;r++){var o=e[r];"little"===t&&(o=i(o)),n+=u(o.toString(16))}return n},t.zero2=l,t.zero8=u,t.join32=function(e,t,n,o){var a=n-t;r(a%4==0);for(var i=new Array(a/4),l=0,u=t;l<i.length;l++,u+=4){var s;s="big"===o?e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]:e[u+3]<<24|e[u+2]<<16|e[u+1]<<8|e[u],i[l]=s>>>0}return i},t.split32=function(e,t){for(var n=new Array(4*e.length),r=0,o=0;r<e.length;r++,o+=4){var a=e[r];"big"===t?(n[o]=a>>>24,n[o+1]=a>>>16&255,n[o+2]=a>>>8&255,n[o+3]=255&a):(n[o+3]=a>>>24,n[o+2]=a>>>16&255,n[o+1]=a>>>8&255,n[o]=255&a)}return n},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,n){return e+t+n>>>0},t.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},t.sum32_5=function(e,t,n,r,o){return e+t+n+r+o>>>0},t.sum64=function(e,t,n,r){var o=e[t],a=r+e[t+1]>>>0,i=(a<r?1:0)+n+o;e[t]=i>>>0,e[t+1]=a},t.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},t.sum64_lo=function(e,t,n,r){return t+r>>>0},t.sum64_4_hi=function(e,t,n,r,o,a,i,l){var u=0,s=t;return u+=(s=s+r>>>0)<t?1:0,u+=(s=s+a>>>0)<a?1:0,e+n+o+i+(u+=(s=s+l>>>0)<l?1:0)>>>0},t.sum64_4_lo=function(e,t,n,r,o,a,i,l){return t+r+a+l>>>0},t.sum64_5_hi=function(e,t,n,r,o,a,i,l,u,s){var c=0,f=t;return c+=(f=f+r>>>0)<t?1:0,c+=(f=f+a>>>0)<a?1:0,c+=(f=f+l>>>0)<l?1:0,e+n+o+i+u+(c+=(f=f+s>>>0)<s?1:0)>>>0},t.sum64_5_lo=function(e,t,n,r,o,a,i,l,u,s){return t+r+a+l+s>>>0},t.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},t.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},t.shr64_hi=function(e,t,n){return e>>>n},t.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0}},4996:function(e,t){"use strict";function n(e){return"number"==typeof e&&isNaN(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.startsWith=function(e,t,n){return e.substr(n||0,t.length)===t},t.endsWith=function(e,t,n){var r=(n||e.length)-t.length,o=e.lastIndexOf(t,r);return-1!==o&&o===r},t.stringIncludes=function(e,t,n){return-1!==e.indexOf(t,n||0)},t.isRealNaN=n,t.arrayIncludes=function(e,t,r){var o=e.length;if(0===o)return!1;for(var a=0|r,i=n(t),l=a>=0?a:o+a;l<o;){var u=e[l++];if(u===t)return!0;if(i&&n(u))return!0}return!1}},1346:function(e,t){"use strict";function n(e,t){var n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}function r(e){var t=e.charAt(0),n=e.length-1;return'"'!==t&&"'"!==t||t!==e.charAt(n)?e:e.slice(1,n)}function o(e){return e.map((function(e){var t=n(e.trim(),"=");return{key:t[0],value:"string"==typeof t[1]?r(t[1]):null}}))}Object.defineProperty(t,"__esModule",{value:!0}),t.splitHead=n,t.unquote=r,t.format=function e(t,n){return t.map((function(t){var r=t.type,a="element"===r?{type:r,tagName:t.tagName.toLowerCase(),attributes:o(t.attributes),children:e(t.children,n)}:{type:r,content:t.content};return n.includePositions&&(a.position=t.position),a}))},t.formatAttributes=o},9932:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseDefaults=void 0,t.parse=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=(0,r.default)(e,t),i=(0,o.default)(n,t);return(0,a.format)(i,t)},t.stringify=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;return(0,i.toHTML)(e,t)};var r=u(n(2255)),o=u(n(4495)),a=n(1346),i=n(249),l=n(5502);function u(e){return e&&e.__esModule?e:{default:e}}var s=t.parseDefaults={voidTags:l.voidTags,closingTags:l.closingTags,childlessTags:l.childlessTags,closingTagAncestorBreakers:l.closingTagAncestorBreakers,includePositions:!1}},2255:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.feedPosition=o,t.jumpPosition=a,t.makeInitialPosition=function(){return{index:0,column:0,line:0}},t.copyPosition=i,t.default=function(e,t){var n={str:e,options:t,position:{index:0,column:0,line:0},tokens:[]};return l(n),n.tokens},t.lex=l,t.findTextEnd=s,t.lexText=c,t.lexComment=f,t.lexTag=p,t.isWhitespaceChar=h,t.lexTagName=m,t.lexTagAttributes=y,t.lexSkipTag=v;var r=n(4996);function o(e,t,n){for(var r=e.index,o=e.index=r+n,a=r;a<o;a++)"\n"===t.charAt(a)?(e.line++,e.column=0):e.column++}function a(e,t,n){return o(e,t,n-e.index)}function i(e){return{index:e.index,line:e.line,column:e.column}}function l(e){for(var t=e.str,n=e.options.childlessTags,o=t.length;e.position.index<o;){var a=e.position.index;if(c(e),e.position.index===a)if((0,r.startsWith)(t,"!--",a+1))f(e);else{var i=p(e),l=i.toLowerCase();(0,r.arrayIncludes)(n,l)&&v(i,e)}}}var u=/[A-Za-z0-9]/;function s(e,t){for(;;){var n=e.indexOf("<",t);if(-1===n)return n;var r=e.charAt(n+1);if("/"===r||"!"===r||u.test(r))return n;t=n+1}}function c(e){var t=e.str,n=e.position,r=s(t,n.index);if(r!==n.index){-1===r&&(r=t.length);var o=i(n),l=t.slice(n.index,r);a(n,t,r);var u=i(n);e.tokens.push({type:"text",content:l,position:{start:o,end:u}})}}function f(e){var t=e.str,n=e.position,r=i(n);o(n,t,4);var l=t.indexOf("--\x3e",n.index),u=l+3;-1===l&&(l=u=t.length);var s=t.slice(n.index,l);a(n,t,u),e.tokens.push({type:"comment",content:s,position:{start:r,end:i(n)}})}function p(e){var t=e.str,n=e.position,r="/"===t.charAt(n.index+1),a=i(n);o(n,t,r?2:1),e.tokens.push({type:"tag-start",close:r,position:{start:a}});var l=m(e);y(e);var u="/"===t.charAt(n.index);o(n,t,u?2:1);var s=i(n);return e.tokens.push({type:"tag-end",close:u,position:{end:s}}),l}var d=/\s/;function h(e){return d.test(e)}function m(e){for(var t=e.str,n=e.position,r=t.length,o=n.index;o<r;){var i=t.charAt(o);if(!h(i)&&"/"!==i&&">"!==i)break;o++}for(var l=o+1;l<r;){var u=t.charAt(l);if(h(u)||"/"===u||">"===u)break;l++}a(n,t,l);var s=t.slice(o,l);return e.tokens.push({type:"tag",content:s}),s}function y(e){for(var t=e.str,n=e.position,o=e.tokens,i=n.index,l=null,u=i,s=[],c=t.length;i<c;){var f=t.charAt(i);if(l)f===l&&(l=null),i++;else{if("/"===f||">"===f){i!==u&&s.push(t.slice(u,i));break}h(f)?(i!==u&&s.push(t.slice(u,i)),u=i+1,i++):"'"===f||'"'===f?(l=f,i++):i++}}a(n,t,i);for(var p=s.length,d="attribute",m=0;m<p;m++){var y=s[m];if(-1===y.indexOf("=")){var g=s[m+1];if(g&&(0,r.startsWith)(g,"=")){if(g.length>1){var v=y+g;o.push({type:d,content:v}),m+=1;continue}var b=s[m+2];if(m+=1,b){var w=y+"="+b;o.push({type:d,content:w}),m+=1;continue}}}if((0,r.endsWith)(y,"=")){var E=s[m+1];if(E&&!(0,r.stringIncludes)(E,"=")){var _=y+E;o.push({type:d,content:_}),m+=1;continue}var O=y.slice(0,-1);o.push({type:d,content:O})}else o.push({type:d,content:y})}}var g=[].push;function v(e,t){for(var n=t.str,r=t.position,o=t.tokens,l=e.toLowerCase(),u=n.length,s=r.index;s<u;){var f=n.indexOf("</",s);if(-1===f){c(t);break}var d=i(r);a(d,n,f);var h={str:n,position:d,tokens:[]};if(l===p(h).toLowerCase()){if(f!==r.index){var m=i(r);a(r,n,f),o.push({type:"text",content:n.slice(m.index,f),position:{start:m,end:i(r)}})}g.apply(o,h.tokens),a(r,n,h.position.index);break}s=h.position.index}}},4495:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n={tagName:null,children:[]};return i({tokens:e,options:t,cursor:0,stack:[n]}),n.children},t.hasTerminalParent=o,t.rewindStack=a,t.parse=i;var r=n(4996);function o(e,t,n){var o=n[e];if(o)for(var a=t.length-1;a>=0;){var i=t[a].tagName;if(i===e)break;if((0,r.arrayIncludes)(o,i))return!0;a--}return!1}function a(e,t,n,r){e[t].position.end=r;for(var o=t+1,a=e.length;o<a;o++)e[o].position.end=n;e.splice(t)}function i(e){for(var t=e.tokens,n=e.options,l=e.stack,u=l[l.length-1].children,s=t.length,c=e.cursor;c<s;){var f=t[c];if("tag-start"===f.type){var p=t[++c];c++;var d=p.content.toLowerCase();if(f.close){for(var h=l.length,m=!1;--h>-1;)if(l[h].tagName===d){m=!0;break}for(;c<s&&"tag-end"===t[c].type;)c++;if(m){a(l,h,f.position.start,t[c-1].position.end);break}}else{var y=(0,r.arrayIncludes)(n.closingTags,d);if(y&&(y=!o(d,l,n.closingTagAncestorBreakers)),y)for(var g=l.length-1;g>0;){if(d===l[g].tagName){a(l,g,f.position.start,f.position.start),u=l[g-1].children;break}g-=1}for(var v=[],b=void 0;c<s&&"tag-end"!==(b=t[c]).type;)v.push(b.content),c++;c++;var w=[],E={start:f.position.start,end:b.position.end},_={type:"element",tagName:p.content,attributes:v,children:w,position:E};if(u.push(_),!b.close&&!(0,r.arrayIncludes)(n.voidTags,d)){var O=l.push({tagName:d,children:w,position:E}),S={tokens:t,options:n,cursor:c,stack:l};i(S),c=S.cursor,l.length===O&&(_.position.end=t[c-1].position.end)}}}else u.push(f),c++}e.cursor=c}},249:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatAttributes=o,t.toHTML=a;var r=n(4996);function o(e){return e.reduce((function(e,t){var n=t.key,r=t.value;if(null===r)return e+" "+n;var o=-1!==r.indexOf("'")?'"':"'";return e+" "+n+"="+o+r+o}),"")}function a(e,t){return e.map((function(e){if("text"===e.type)return e.content;if("comment"===e.type)return"\x3c!--"+e.content+"--\x3e";var n=e.tagName,i=e.attributes,l=e.children;return(0,r.arrayIncludes)(t.voidTags,n.toLowerCase())?"<"+n+o(i)+">":"<"+n+o(i)+">"+a(l,t)+"</"+n+">"})).join("")}t.default={toHTML:a}},5502:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.childlessTags=["style","script","template"],t.closingTags=["html","head","body","p","dt","dd","li","option","thead","th","tbody","tr","td","tfoot","colgroup"],t.closingTagAncestorBreakers={li:["ul","ol","menu"],dt:["dl"],dd:["dl"],tbody:["table"],thead:["table"],tfoot:["table"],tr:["table"],td:["table"]},t.voidTags=["!doctype","area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]},3578:function(e,t,n){"use strict";var r=n(8485),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function u(e){return r.isMemo(e)?i:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var s=Object.defineProperty,c=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,h=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(h){var o=d(n);o&&o!==h&&e(t,o,r)}var i=c(n);f&&(i=i.concat(f(n)));for(var l=u(t),m=u(n),y=0;y<i.length;++y){var g=i[y];if(!(a[g]||r&&r[g]||m&&m[g]||l&&l[g])){var v=p(n,g);try{s(t,g,v)}catch(e){}}}}return t}},369:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},998:function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=l(n(8965)),a=l(n(1646)),i=l(n(5040));function l(e){return e&&e.__esModule?e:{default:e}}var u=void 0;function s(e,t){var n,i,l,c,f,p,d,h,m=[],y={};for(p=0;p<e.length;p++)if("string"!==(f=e[p]).type){if(!t.hasOwnProperty(f.value)||void 0===t[f.value])throw new Error("Invalid interpolation, missing component node: `"+f.value+"`");if("object"!==r(t[f.value]))throw new Error("Invalid interpolation, component node must be a ReactElement or null: `"+f.value+"`","\n> "+u);if("componentClose"===f.type)throw new Error("Missing opening component token: `"+f.value+"`");if("componentOpen"===f.type){n=t[f.value],l=p;break}m.push(t[f.value])}else m.push(f.value);return n&&(c=function(e,t){var n,r,o=t[e],a=0;for(r=e+1;r<t.length;r++)if((n=t[r]).value===o.value){if("componentOpen"===n.type){a++;continue}if("componentClose"===n.type){if(0===a)return r;a--}}throw new Error("Missing closing component token `"+o.value+"`")}(l,e),d=s(e.slice(l+1,c),t),i=o.default.cloneElement(n,{},d),m.push(i),c<e.length-1&&(h=s(e.slice(c+1),t),m=m.concat(h))),1===m.length?m[0]:(m.forEach((function(e,t){e&&(y["interpolation-child-"+t]=e)})),(0,a.default)(y))}t.Z=function(e){var t=e.mixedString,n=e.components,o=e.throwErrors;if(u=t,!n)return t;if("object"!==(void 0===n?"undefined":r(n))){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because components is not an object");return t}var a=(0,i.default)(t);try{return s(a,n)}catch(e){if(o)throw new Error("Interpolation Error: unable to process `"+t+"` because of error `"+e.message+"`");return t}}},5040:function(e){"use strict";function t(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(t)}},9760:function(e,t,n){var r;e=n.nmd(e),function(){var o,a="Expected a function",i="__lodash_hash_undefined__",l="__lodash_placeholder__",u=32,s=128,c=1/0,f=9007199254740991,p=NaN,d=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",u],["partialRight",64],["rearg",256]],m="[object Arguments]",y="[object Array]",g="[object Boolean]",v="[object Date]",b="[object Error]",w="[object Function]",E="[object GeneratorFunction]",_="[object Map]",O="[object Number]",S="[object Object]",x="[object Promise]",k="[object RegExp]",C="[object Set]",T="[object String]",P="[object Symbol]",N="[object WeakMap]",I="[object ArrayBuffer]",j="[object DataView]",R="[object Float32Array]",A="[object Float64Array]",D="[object Int8Array]",M="[object Int16Array]",L="[object Int32Array]",F="[object Uint8Array]",z="[object Uint8ClampedArray]",U="[object Uint16Array]",V="[object Uint32Array]",H=/\b__p \+= '';/g,B=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,K=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,Y=RegExp(K.source),G=RegExp(q.source),$=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,oe=/\s/,ae=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ie=/\{\n\/\* \[wrapped with (.+)\] \*/,le=/,? & /,ue=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,se=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,me=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,be=/($^)/,we=/['\n\r\u2028\u2029\\]/g,Ee="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="a-z\\xdf-\\xf6\\xf8-\\xff",Oe="A-Z\\xc0-\\xd6\\xd8-\\xde",Se="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xe="["+Se+"]",ke="["+Ee+"]",Ce="\\d+",Te="["+_e+"]",Pe="[^\\ud800-\\udfff"+Se+Ce+"\\u2700-\\u27bf"+_e+Oe+"]",Ne="\\ud83c[\\udffb-\\udfff]",Ie="[^\\ud800-\\udfff]",je="(?:\\ud83c[\\udde6-\\uddff]){2}",Re="[\\ud800-\\udbff][\\udc00-\\udfff]",Ae="["+Oe+"]",De="(?:"+Te+"|"+Pe+")",Me="(?:"+Ae+"|"+Pe+")",Le="(?:['’](?:d|ll|m|re|s|t|ve))?",Fe="(?:['’](?:D|LL|M|RE|S|T|VE))?",ze="(?:"+ke+"|"+Ne+")?",Ue="[\\ufe0e\\ufe0f]?",Ve=Ue+ze+"(?:\\u200d(?:"+[Ie,je,Re].join("|")+")"+Ue+ze+")*",He="(?:"+["[\\u2700-\\u27bf]",je,Re].join("|")+")"+Ve,Be="(?:"+[Ie+ke+"?",ke,je,Re,"[\\ud800-\\udfff]"].join("|")+")",We=RegExp("['’]","g"),Ke=RegExp(ke,"g"),qe=RegExp(Ne+"(?="+Ne+")|"+Be+Ve,"g"),Ye=RegExp([Ae+"?"+Te+"+"+Le+"(?="+[xe,Ae,"$"].join("|")+")",Me+"+"+Fe+"(?="+[xe,Ae+De,"$"].join("|")+")",Ae+"?"+De+"+"+Le,Ae+"+"+Fe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ce,He].join("|"),"g"),Ge=RegExp("[\\u200d\\ud800-\\udfff"+Ee+"\\ufe0e\\ufe0f]"),$e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Xe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Qe=-1,Je={};Je[R]=Je[A]=Je[D]=Je[M]=Je[L]=Je[F]=Je[z]=Je[U]=Je[V]=!0,Je[m]=Je[y]=Je[I]=Je[g]=Je[j]=Je[v]=Je[b]=Je[w]=Je[_]=Je[O]=Je[S]=Je[k]=Je[C]=Je[T]=Je[N]=!1;var Ze={};Ze[m]=Ze[y]=Ze[I]=Ze[j]=Ze[g]=Ze[v]=Ze[R]=Ze[A]=Ze[D]=Ze[M]=Ze[L]=Ze[_]=Ze[O]=Ze[S]=Ze[k]=Ze[C]=Ze[T]=Ze[P]=Ze[F]=Ze[z]=Ze[U]=Ze[V]=!0,Ze[b]=Ze[w]=Ze[N]=!1;var et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=parseFloat,nt=parseInt,rt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ot="object"==typeof self&&self&&self.Object===Object&&self,at=rt||ot||Function("return this")(),it=t&&!t.nodeType&&t,lt=it&&e&&!e.nodeType&&e,ut=lt&&lt.exports===it,st=ut&&rt.process,ct=function(){try{return lt&&lt.require&&lt.require("util").types||st&&st.binding&&st.binding("util")}catch(e){}}(),ft=ct&&ct.isArrayBuffer,pt=ct&&ct.isDate,dt=ct&&ct.isMap,ht=ct&&ct.isRegExp,mt=ct&&ct.isSet,yt=ct&&ct.isTypedArray;function gt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var o=-1,a=null==e?0:e.length;++o<a;){var i=e[o];t(r,i,n(i),e)}return r}function bt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function wt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function _t(e,t){for(var n=-1,r=null==e?0:e.length,o=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[o++]=i)}return a}function Ot(e,t){return!(null==e||!e.length)&&Rt(e,t,0)>-1}function St(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function xt(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function kt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function Ct(e,t,n,r){var o=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++o]);++o<a;)n=t(n,e[o],o,e);return n}function Tt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function Pt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Nt=Lt("length");function It(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function jt(e,t,n,r){for(var o=e.length,a=n+(r?1:-1);r?a--:++a<o;)if(t(e[a],a,e))return a;return-1}function Rt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):jt(e,Dt,n)}function At(e,t,n,r){for(var o=n-1,a=e.length;++o<a;)if(r(e[o],t))return o;return-1}function Dt(e){return e!=e}function Mt(e,t){var n=null==e?0:e.length;return n?Ut(e,t)/n:p}function Lt(e){return function(t){return null==t?o:t[e]}}function Ft(e){return function(t){return null==e?o:e[t]}}function zt(e,t,n,r,o){return o(e,(function(e,o,a){n=r?(r=!1,e):t(n,e,o,a)})),n}function Ut(e,t){for(var n,r=-1,a=e.length;++r<a;){var i=t(e[r]);i!==o&&(n=n===o?i:n+i)}return n}function Vt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ht(e){return e?e.slice(0,ln(e)+1).replace(re,""):e}function Bt(e){return function(t){return e(t)}}function Wt(e,t){return xt(t,(function(t){return e[t]}))}function Kt(e,t){return e.has(t)}function qt(e,t){for(var n=-1,r=e.length;++n<r&&Rt(t,e[n],0)>-1;);return n}function Yt(e,t){for(var n=e.length;n--&&Rt(t,e[n],0)>-1;);return n}function Gt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var $t=Ft({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Xt=Ft({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Qt(e){return"\\"+et[e]}function Jt(e){return Ge.test(e)}function Zt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function en(e,t){return function(n){return e(t(n))}}function tn(e,t){for(var n=-1,r=e.length,o=0,a=[];++n<r;){var i=e[n];i!==t&&i!==l||(e[n]=l,a[o++]=n)}return a}function nn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function rn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function on(e){return Jt(e)?function(e){for(var t=qe.lastIndex=0;qe.test(e);)++t;return t}(e):Nt(e)}function an(e){return Jt(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.split("")}(e)}function ln(e){for(var t=e.length;t--&&oe.test(e.charAt(t)););return t}var un=Ft({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),sn=function e(t){var n,r=(t=null==t?at:sn.defaults(at.Object(),t,sn.pick(at,Xe))).Array,oe=t.Date,Ee=t.Error,_e=t.Function,Oe=t.Math,Se=t.Object,xe=t.RegExp,ke=t.String,Ce=t.TypeError,Te=r.prototype,Pe=_e.prototype,Ne=Se.prototype,Ie=t["__core-js_shared__"],je=Pe.toString,Re=Ne.hasOwnProperty,Ae=0,De=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Me=Ne.toString,Le=je.call(Se),Fe=at._,ze=xe("^"+je.call(Re).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=ut?t.Buffer:o,Ve=t.Symbol,He=t.Uint8Array,Be=Ue?Ue.allocUnsafe:o,qe=en(Se.getPrototypeOf,Se),Ge=Se.create,et=Ne.propertyIsEnumerable,rt=Te.splice,ot=Ve?Ve.isConcatSpreadable:o,it=Ve?Ve.iterator:o,lt=Ve?Ve.toStringTag:o,st=function(){try{var e=ca(Se,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==at.clearTimeout&&t.clearTimeout,Nt=oe&&oe.now!==at.Date.now&&oe.now,Ft=t.setTimeout!==at.setTimeout&&t.setTimeout,cn=Oe.ceil,fn=Oe.floor,pn=Se.getOwnPropertySymbols,dn=Ue?Ue.isBuffer:o,hn=t.isFinite,mn=Te.join,yn=en(Se.keys,Se),gn=Oe.max,vn=Oe.min,bn=oe.now,wn=t.parseInt,En=Oe.random,_n=Te.reverse,On=ca(t,"DataView"),Sn=ca(t,"Map"),xn=ca(t,"Promise"),kn=ca(t,"Set"),Cn=ca(t,"WeakMap"),Tn=ca(Se,"create"),Pn=Cn&&new Cn,Nn={},In=za(On),jn=za(Sn),Rn=za(xn),An=za(kn),Dn=za(Cn),Mn=Ve?Ve.prototype:o,Ln=Mn?Mn.valueOf:o,Fn=Mn?Mn.toString:o;function zn(e){if(nl(e)&&!Ki(e)&&!(e instanceof Bn)){if(e instanceof Hn)return e;if(Re.call(e,"__wrapped__"))return Ua(e)}return new Hn(e)}var Un=function(){function e(){}return function(t){if(!tl(t))return{};if(Ge)return Ge(t);e.prototype=t;var n=new e;return e.prototype=o,n}}();function Vn(){}function Hn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function Bn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Kn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Yn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new qn;++t<n;)this.add(e[t])}function Gn(e){var t=this.__data__=new Kn(e);this.size=t.size}function $n(e,t){var n=Ki(e),r=!n&&Wi(e),o=!n&&!r&&$i(e),a=!n&&!r&&!o&&cl(e),i=n||r||o||a,l=i?Vt(e.length,ke):[],u=l.length;for(var s in e)!t&&!Re.call(e,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||ga(s,u))||l.push(s);return l}function Xn(e){var t=e.length;return t?e[qr(0,t-1)]:o}function Qn(e,t){return Aa(To(e),ir(t,0,e.length))}function Jn(e){return Aa(To(e))}function Zn(e,t,n){(n!==o&&!Vi(e[t],n)||n===o&&!(t in e))&&or(e,t,n)}function er(e,t,n){var r=e[t];Re.call(e,t)&&Vi(r,n)&&(n!==o||t in e)||or(e,t,n)}function tr(e,t){for(var n=e.length;n--;)if(Vi(e[n][0],t))return n;return-1}function nr(e,t,n,r){return fr(e,(function(e,o,a){t(r,e,n(e),a)})),r}function rr(e,t){return e&&Po(t,jl(t),e)}function or(e,t,n){"__proto__"==t&&st?st(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ar(e,t){for(var n=-1,a=t.length,i=r(a),l=null==e;++n<a;)i[n]=l?o:Cl(e,t[n]);return i}function ir(e,t,n){return e==e&&(n!==o&&(e=e<=n?e:n),t!==o&&(e=e>=t?e:t)),e}function lr(e,t,n,r,a,i){var l,u=1&t,s=2&t,c=4&t;if(n&&(l=a?n(e,r,a,i):n(e)),l!==o)return l;if(!tl(e))return e;var f=Ki(e);if(f){if(l=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return To(e,l)}else{var p=da(e),d=p==w||p==E;if($i(e))return _o(e,u);if(p==S||p==m||d&&!a){if(l=s||d?{}:ma(e),!u)return s?function(e,t){return Po(e,pa(e),t)}(e,function(e,t){return e&&Po(t,Rl(t),e)}(l,e)):function(e,t){return Po(e,fa(e),t)}(e,rr(l,e))}else{if(!Ze[p])return a?e:{};l=function(e,t,n){var r,o=e.constructor;switch(t){case I:return Oo(e);case g:case v:return new o(+e);case j:return function(e,t){var n=t?Oo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case R:case A:case D:case M:case L:case F:case z:case U:case V:return So(e,n);case _:return new o;case O:case T:return new o(e);case k:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case C:return new o;case P:return r=e,Ln?Se(Ln.call(r)):{}}}(e,p,u)}}i||(i=new Gn);var h=i.get(e);if(h)return h;i.set(e,l),ll(e)?e.forEach((function(r){l.add(lr(r,t,n,r,e,i))})):rl(e)&&e.forEach((function(r,o){l.set(o,lr(r,t,n,o,e,i))}));var y=f?o:(c?s?ra:na:s?Rl:jl)(e);return bt(y||e,(function(r,o){y&&(r=e[o=r]),er(l,o,lr(r,t,n,o,e,i))})),l}function ur(e,t,n){var r=n.length;if(null==e)return!r;for(e=Se(e);r--;){var a=n[r],i=t[a],l=e[a];if(l===o&&!(a in e)||!i(l))return!1}return!0}function sr(e,t,n){if("function"!=typeof e)throw new Ce(a);return Na((function(){e.apply(o,n)}),t)}function cr(e,t,n,r){var o=-1,a=Ot,i=!0,l=e.length,u=[],s=t.length;if(!l)return u;n&&(t=xt(t,Bt(n))),r?(a=St,i=!1):t.length>=200&&(a=Kt,i=!1,t=new Yn(t));e:for(;++o<l;){var c=e[o],f=null==n?c:n(c);if(c=r||0!==c?c:0,i&&f==f){for(var p=s;p--;)if(t[p]===f)continue e;u.push(c)}else a(t,f,r)||u.push(c)}return u}zn.templateSettings={escape:$,evaluate:X,interpolate:Q,variable:"",imports:{_:zn}},zn.prototype=Vn.prototype,zn.prototype.constructor=zn,Hn.prototype=Un(Vn.prototype),Hn.prototype.constructor=Hn,Bn.prototype=Un(Vn.prototype),Bn.prototype.constructor=Bn,Wn.prototype.clear=function(){this.__data__=Tn?Tn(null):{},this.size=0},Wn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Wn.prototype.get=function(e){var t=this.__data__;if(Tn){var n=t[e];return n===i?o:n}return Re.call(t,e)?t[e]:o},Wn.prototype.has=function(e){var t=this.__data__;return Tn?t[e]!==o:Re.call(t,e)},Wn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Tn&&t===o?i:t,this},Kn.prototype.clear=function(){this.__data__=[],this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=tr(t,e);return!(n<0||(n==t.length-1?t.pop():rt.call(t,n,1),--this.size,0))},Kn.prototype.get=function(e){var t=this.__data__,n=tr(t,e);return n<0?o:t[n][1]},Kn.prototype.has=function(e){return tr(this.__data__,e)>-1},Kn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},qn.prototype.clear=function(){this.size=0,this.__data__={hash:new Wn,map:new(Sn||Kn),string:new Wn}},qn.prototype.delete=function(e){var t=ua(this,e).delete(e);return this.size-=t?1:0,t},qn.prototype.get=function(e){return ua(this,e).get(e)},qn.prototype.has=function(e){return ua(this,e).has(e)},qn.prototype.set=function(e,t){var n=ua(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Yn.prototype.add=Yn.prototype.push=function(e){return this.__data__.set(e,i),this},Yn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.clear=function(){this.__data__=new Kn,this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Gn.prototype.get=function(e){return this.__data__.get(e)},Gn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Kn){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new qn(r)}return n.set(e,t),this.size=n.size,this};var fr=jo(br),pr=jo(wr,!0);function dr(e,t){var n=!0;return fr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function hr(e,t,n){for(var r=-1,a=e.length;++r<a;){var i=e[r],l=t(i);if(null!=l&&(u===o?l==l&&!sl(l):n(l,u)))var u=l,s=i}return s}function mr(e,t){var n=[];return fr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function yr(e,t,n,r,o){var a=-1,i=e.length;for(n||(n=ya),o||(o=[]);++a<i;){var l=e[a];t>0&&n(l)?t>1?yr(l,t-1,n,r,o):kt(o,l):r||(o[o.length]=l)}return o}var gr=Ro(),vr=Ro(!0);function br(e,t){return e&&gr(e,t,jl)}function wr(e,t){return e&&vr(e,t,jl)}function Er(e,t){return _t(t,(function(t){return Ji(e[t])}))}function _r(e,t){for(var n=0,r=(t=vo(t,e)).length;null!=e&&n<r;)e=e[Fa(t[n++])];return n&&n==r?e:o}function Or(e,t,n){var r=t(e);return Ki(e)?r:kt(r,n(e))}function Sr(e){return null==e?e===o?"[object Undefined]":"[object Null]":lt&&lt in Se(e)?function(e){var t=Re.call(e,lt),n=e[lt];try{e[lt]=o;var r=!0}catch(e){}var a=Me.call(e);return r&&(t?e[lt]=n:delete e[lt]),a}(e):function(e){return Me.call(e)}(e)}function xr(e,t){return e>t}function kr(e,t){return null!=e&&Re.call(e,t)}function Cr(e,t){return null!=e&&t in Se(e)}function Tr(e,t,n){for(var a=n?St:Ot,i=e[0].length,l=e.length,u=l,s=r(l),c=1/0,f=[];u--;){var p=e[u];u&&t&&(p=xt(p,Bt(t))),c=vn(p.length,c),s[u]=!n&&(t||i>=120&&p.length>=120)?new Yn(u&&p):o}p=e[0];var d=-1,h=s[0];e:for(;++d<i&&f.length<c;){var m=p[d],y=t?t(m):m;if(m=n||0!==m?m:0,!(h?Kt(h,y):a(f,y,n))){for(u=l;--u;){var g=s[u];if(!(g?Kt(g,y):a(e[u],y,n)))continue e}h&&h.push(y),f.push(m)}}return f}function Pr(e,t,n){var r=null==(e=ka(e,t=vo(t,e)))?e:e[Fa(Qa(t))];return null==r?o:gt(r,e,n)}function Nr(e){return nl(e)&&Sr(e)==m}function Ir(e,t,n,r,a){return e===t||(null==e||null==t||!nl(e)&&!nl(t)?e!=e&&t!=t:function(e,t,n,r,a,i){var l=Ki(e),u=Ki(t),s=l?y:da(e),c=u?y:da(t),f=(s=s==m?S:s)==S,p=(c=c==m?S:c)==S,d=s==c;if(d&&$i(e)){if(!$i(t))return!1;l=!0,f=!1}if(d&&!f)return i||(i=new Gn),l||cl(e)?ea(e,t,n,r,a,i):function(e,t,n,r,o,a,i){switch(n){case j:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case I:return!(e.byteLength!=t.byteLength||!a(new He(e),new He(t)));case g:case v:case O:return Vi(+e,+t);case b:return e.name==t.name&&e.message==t.message;case k:case T:return e==t+"";case _:var l=Zt;case C:var u=1&r;if(l||(l=nn),e.size!=t.size&&!u)return!1;var s=i.get(e);if(s)return s==t;r|=2,i.set(e,t);var c=ea(l(e),l(t),r,o,a,i);return i.delete(e),c;case P:if(Ln)return Ln.call(e)==Ln.call(t)}return!1}(e,t,s,n,r,a,i);if(!(1&n)){var h=f&&Re.call(e,"__wrapped__"),w=p&&Re.call(t,"__wrapped__");if(h||w){var E=h?e.value():e,x=w?t.value():t;return i||(i=new Gn),a(E,x,n,r,i)}}return!!d&&(i||(i=new Gn),function(e,t,n,r,a,i){var l=1&n,u=na(e),s=u.length;if(s!=na(t).length&&!l)return!1;for(var c=s;c--;){var f=u[c];if(!(l?f in t:Re.call(t,f)))return!1}var p=i.get(e),d=i.get(t);if(p&&d)return p==t&&d==e;var h=!0;i.set(e,t),i.set(t,e);for(var m=l;++c<s;){var y=e[f=u[c]],g=t[f];if(r)var v=l?r(g,y,f,t,e,i):r(y,g,f,e,t,i);if(!(v===o?y===g||a(y,g,n,r,i):v)){h=!1;break}m||(m="constructor"==f)}if(h&&!m){var b=e.constructor,w=t.constructor;b==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(h=!1)}return i.delete(e),i.delete(t),h}(e,t,n,r,a,i))}(e,t,n,r,Ir,a))}function jr(e,t,n,r){var a=n.length,i=a,l=!r;if(null==e)return!i;for(e=Se(e);a--;){var u=n[a];if(l&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++a<i;){var s=(u=n[a])[0],c=e[s],f=u[1];if(l&&u[2]){if(c===o&&!(s in e))return!1}else{var p=new Gn;if(r)var d=r(c,f,s,e,t,p);if(!(d===o?Ir(f,c,3,r,p):d))return!1}}return!0}function Rr(e){return!(!tl(e)||(t=e,De&&De in t))&&(Ji(e)?ze:me).test(za(e));var t}function Ar(e){return"function"==typeof e?e:null==e?ou:"object"==typeof e?Ki(e)?zr(e[0],e[1]):Fr(e):du(e)}function Dr(e){if(!_a(e))return yn(e);var t=[];for(var n in Se(e))Re.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Mr(e,t){return e<t}function Lr(e,t){var n=-1,o=Yi(e)?r(e.length):[];return fr(e,(function(e,r,a){o[++n]=t(e,r,a)})),o}function Fr(e){var t=sa(e);return 1==t.length&&t[0][2]?Sa(t[0][0],t[0][1]):function(n){return n===e||jr(n,e,t)}}function zr(e,t){return ba(e)&&Oa(t)?Sa(Fa(e),t):function(n){var r=Cl(n,e);return r===o&&r===t?Tl(n,e):Ir(t,r,3)}}function Ur(e,t,n,r,a){e!==t&&gr(t,(function(i,l){if(a||(a=new Gn),tl(i))!function(e,t,n,r,a,i,l){var u=Ta(e,n),s=Ta(t,n),c=l.get(s);if(c)Zn(e,n,c);else{var f=i?i(u,s,n+"",e,t,l):o,p=f===o;if(p){var d=Ki(s),h=!d&&$i(s),m=!d&&!h&&cl(s);f=s,d||h||m?Ki(u)?f=u:Gi(u)?f=To(u):h?(p=!1,f=_o(s,!0)):m?(p=!1,f=So(s,!0)):f=[]:al(s)||Wi(s)?(f=u,Wi(u)?f=vl(u):tl(u)&&!Ji(u)||(f=ma(s))):p=!1}p&&(l.set(s,f),a(f,s,r,i,l),l.delete(s)),Zn(e,n,f)}}(e,t,l,n,Ur,r,a);else{var u=r?r(Ta(e,l),i,l+"",e,t,a):o;u===o&&(u=i),Zn(e,l,u)}}),Rl)}function Vr(e,t){var n=e.length;if(n)return ga(t+=t<0?n:0,n)?e[t]:o}function Hr(e,t,n){t=t.length?xt(t,(function(e){return Ki(e)?function(t){return _r(t,1===e.length?e[0]:e)}:e})):[ou];var r=-1;t=xt(t,Bt(la()));var o=Lr(e,(function(e,n,o){var a=xt(t,(function(t){return t(e)}));return{criteria:a,index:++r,value:e}}));return function(e,t){var r=e.length;for(e.sort((function(e,t){return function(e,t,n){for(var r=-1,o=e.criteria,a=t.criteria,i=o.length,l=n.length;++r<i;){var u=xo(o[r],a[r]);if(u)return r>=l?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(o)}function Br(e,t,n){for(var r=-1,o=t.length,a={};++r<o;){var i=t[r],l=_r(e,i);n(l,i)&&Qr(a,vo(i,e),l)}return a}function Wr(e,t,n,r){var o=r?At:Rt,a=-1,i=t.length,l=e;for(e===t&&(t=To(t)),n&&(l=xt(e,Bt(n)));++a<i;)for(var u=0,s=t[a],c=n?n(s):s;(u=o(l,c,u,r))>-1;)l!==e&&rt.call(l,u,1),rt.call(e,u,1);return e}function Kr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==a){var a=o;ga(o)?rt.call(e,o,1):so(e,o)}}return e}function qr(e,t){return e+fn(En()*(t-e+1))}function Yr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=fn(t/2))&&(e+=e)}while(t);return n}function Gr(e,t){return Ia(xa(e,t,ou),e+"")}function $r(e){return Xn(Vl(e))}function Xr(e,t){var n=Vl(e);return Aa(n,ir(t,0,n.length))}function Qr(e,t,n,r){if(!tl(e))return e;for(var a=-1,i=(t=vo(t,e)).length,l=i-1,u=e;null!=u&&++a<i;){var s=Fa(t[a]),c=n;if("__proto__"===s||"constructor"===s||"prototype"===s)return e;if(a!=l){var f=u[s];(c=r?r(f,s,u):o)===o&&(c=tl(f)?f:ga(t[a+1])?[]:{})}er(u,s,c),u=u[s]}return e}var Jr=Pn?function(e,t){return Pn.set(e,t),e}:ou,Zr=st?function(e,t){return st(e,"toString",{configurable:!0,enumerable:!1,value:tu(t),writable:!0})}:ou;function eo(e){return Aa(Vl(e))}function to(e,t,n){var o=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(n=n>a?a:n)<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var i=r(a);++o<a;)i[o]=e[o+t];return i}function no(e,t){var n;return fr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function ro(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var a=r+o>>>1,i=e[a];null!==i&&!sl(i)&&(n?i<=t:i<t)?r=a+1:o=a}return o}return oo(e,t,ou,n)}function oo(e,t,n,r){var a=0,i=null==e?0:e.length;if(0===i)return 0;for(var l=(t=n(t))!=t,u=null===t,s=sl(t),c=t===o;a<i;){var f=fn((a+i)/2),p=n(e[f]),d=p!==o,h=null===p,m=p==p,y=sl(p);if(l)var g=r||m;else g=c?m&&(r||d):u?m&&d&&(r||!h):s?m&&d&&!h&&(r||!y):!h&&!y&&(r?p<=t:p<t);g?a=f+1:i=f}return vn(i,4294967294)}function ao(e,t){for(var n=-1,r=e.length,o=0,a=[];++n<r;){var i=e[n],l=t?t(i):i;if(!n||!Vi(l,u)){var u=l;a[o++]=0===i?0:i}}return a}function io(e){return"number"==typeof e?e:sl(e)?p:+e}function lo(e){if("string"==typeof e)return e;if(Ki(e))return xt(e,lo)+"";if(sl(e))return Fn?Fn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function uo(e,t,n){var r=-1,o=Ot,a=e.length,i=!0,l=[],u=l;if(n)i=!1,o=St;else if(a>=200){var s=t?null:Go(e);if(s)return nn(s);i=!1,o=Kt,u=new Yn}else u=t?[]:l;e:for(;++r<a;){var c=e[r],f=t?t(c):c;if(c=n||0!==c?c:0,i&&f==f){for(var p=u.length;p--;)if(u[p]===f)continue e;t&&u.push(f),l.push(c)}else o(u,f,n)||(u!==l&&u.push(f),l.push(c))}return l}function so(e,t){return null==(e=ka(e,t=vo(t,e)))||delete e[Fa(Qa(t))]}function co(e,t,n,r){return Qr(e,t,n(_r(e,t)),r)}function fo(e,t,n,r){for(var o=e.length,a=r?o:-1;(r?a--:++a<o)&&t(e[a],a,e););return n?to(e,r?0:a,r?a+1:o):to(e,r?a+1:0,r?o:a)}function po(e,t){var n=e;return n instanceof Bn&&(n=n.value()),Ct(t,(function(e,t){return t.func.apply(t.thisArg,kt([e],t.args))}),n)}function ho(e,t,n){var o=e.length;if(o<2)return o?uo(e[0]):[];for(var a=-1,i=r(o);++a<o;)for(var l=e[a],u=-1;++u<o;)u!=a&&(i[a]=cr(i[a]||l,e[u],t,n));return uo(yr(i,1),t,n)}function mo(e,t,n){for(var r=-1,a=e.length,i=t.length,l={};++r<a;){var u=r<i?t[r]:o;n(l,e[r],u)}return l}function yo(e){return Gi(e)?e:[]}function go(e){return"function"==typeof e?e:ou}function vo(e,t){return Ki(e)?e:ba(e,t)?[e]:La(bl(e))}var bo=Gr;function wo(e,t,n){var r=e.length;return n=n===o?r:n,!t&&n>=r?e:to(e,t,n)}var Eo=ct||function(e){return at.clearTimeout(e)};function _o(e,t){if(t)return e.slice();var n=e.length,r=Be?Be(n):new e.constructor(n);return e.copy(r),r}function Oo(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function So(e,t){var n=t?Oo(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function xo(e,t){if(e!==t){var n=e!==o,r=null===e,a=e==e,i=sl(e),l=t!==o,u=null===t,s=t==t,c=sl(t);if(!u&&!c&&!i&&e>t||i&&l&&s&&!u&&!c||r&&l&&s||!n&&s||!a)return 1;if(!r&&!i&&!c&&e<t||c&&n&&a&&!r&&!i||u&&n&&a||!l&&a||!s)return-1}return 0}function ko(e,t,n,o){for(var a=-1,i=e.length,l=n.length,u=-1,s=t.length,c=gn(i-l,0),f=r(s+c),p=!o;++u<s;)f[u]=t[u];for(;++a<l;)(p||a<i)&&(f[n[a]]=e[a]);for(;c--;)f[u++]=e[a++];return f}function Co(e,t,n,o){for(var a=-1,i=e.length,l=-1,u=n.length,s=-1,c=t.length,f=gn(i-u,0),p=r(f+c),d=!o;++a<f;)p[a]=e[a];for(var h=a;++s<c;)p[h+s]=t[s];for(;++l<u;)(d||a<i)&&(p[h+n[l]]=e[a++]);return p}function To(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function Po(e,t,n,r){var a=!n;n||(n={});for(var i=-1,l=t.length;++i<l;){var u=t[i],s=r?r(n[u],e[u],u,n,e):o;s===o&&(s=e[u]),a?or(n,u,s):er(n,u,s)}return n}function No(e,t){return function(n,r){var o=Ki(n)?vt:nr,a=t?t():{};return o(n,e,la(r,2),a)}}function Io(e){return Gr((function(t,n){var r=-1,a=n.length,i=a>1?n[a-1]:o,l=a>2?n[2]:o;for(i=e.length>3&&"function"==typeof i?(a--,i):o,l&&va(n[0],n[1],l)&&(i=a<3?o:i,a=1),t=Se(t);++r<a;){var u=n[r];u&&e(t,u,r,i)}return t}))}function jo(e,t){return function(n,r){if(null==n)return n;if(!Yi(n))return e(n,r);for(var o=n.length,a=t?o:-1,i=Se(n);(t?a--:++a<o)&&!1!==r(i[a],a,i););return n}}function Ro(e){return function(t,n,r){for(var o=-1,a=Se(t),i=r(t),l=i.length;l--;){var u=i[e?l:++o];if(!1===n(a[u],u,a))break}return t}}function Ao(e){return function(t){var n=Jt(t=bl(t))?an(t):o,r=n?n[0]:t.charAt(0),a=n?wo(n,1).join(""):t.slice(1);return r[e]()+a}}function Do(e){return function(t){return Ct(Jl(Wl(t).replace(We,"")),e,"")}}function Mo(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Un(e.prototype),r=e.apply(n,t);return tl(r)?r:n}}function Lo(e){return function(t,n,r){var a=Se(t);if(!Yi(t)){var i=la(n,3);t=jl(t),n=function(e){return i(a[e],e,a)}}var l=e(t,n,r);return l>-1?a[i?t[l]:l]:o}}function Fo(e){return ta((function(t){var n=t.length,r=n,i=Hn.prototype.thru;for(e&&t.reverse();r--;){var l=t[r];if("function"!=typeof l)throw new Ce(a);if(i&&!u&&"wrapper"==aa(l))var u=new Hn([],!0)}for(r=u?r:n;++r<n;){var s=aa(l=t[r]),c="wrapper"==s?oa(l):o;u=c&&wa(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?u[aa(c[0])].apply(u,c[3]):1==l.length&&wa(l)?u[s]():u.thru(l)}return function(){var e=arguments,r=e[0];if(u&&1==e.length&&Ki(r))return u.plant(r).value();for(var o=0,a=n?t[o].apply(this,e):r;++o<n;)a=t[o].call(this,a);return a}}))}function zo(e,t,n,a,i,l,u,c,f,p){var d=t&s,h=1&t,m=2&t,y=24&t,g=512&t,v=m?o:Mo(e);return function o(){for(var s=arguments.length,b=r(s),w=s;w--;)b[w]=arguments[w];if(y)var E=ia(o),_=Gt(b,E);if(a&&(b=ko(b,a,i,y)),l&&(b=Co(b,l,u,y)),s-=_,y&&s<p){var O=tn(b,E);return qo(e,t,zo,o.placeholder,n,b,O,c,f,p-s)}var S=h?n:this,x=m?S[e]:e;return s=b.length,c?b=Ca(b,c):g&&s>1&&b.reverse(),d&&f<s&&(b.length=f),this&&this!==at&&this instanceof o&&(x=v||Mo(x)),x.apply(S,b)}}function Uo(e,t){return function(n,r){return function(e,t,n,r){return br(e,(function(e,o,a){t(r,n(e),o,a)})),r}(n,e,t(r),{})}}function Vo(e,t){return function(n,r){var a;if(n===o&&r===o)return t;if(n!==o&&(a=n),r!==o){if(a===o)return r;"string"==typeof n||"string"==typeof r?(n=lo(n),r=lo(r)):(n=io(n),r=io(r)),a=e(n,r)}return a}}function Ho(e){return ta((function(t){return t=xt(t,Bt(la())),Gr((function(n){var r=this;return e(t,(function(e){return gt(e,r,n)}))}))}))}function Bo(e,t){var n=(t=t===o?" ":lo(t)).length;if(n<2)return n?Yr(t,e):t;var r=Yr(t,cn(e/on(t)));return Jt(t)?wo(an(r),0,e).join(""):r.slice(0,e)}function Wo(e){return function(t,n,a){return a&&"number"!=typeof a&&va(t,n,a)&&(n=a=o),t=hl(t),n===o?(n=t,t=0):n=hl(n),function(e,t,n,o){for(var a=-1,i=gn(cn((t-e)/(n||1)),0),l=r(i);i--;)l[o?i:++a]=e,e+=n;return l}(t,n,a=a===o?t<n?1:-1:hl(a),e)}}function Ko(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=gl(t),n=gl(n)),e(t,n)}}function qo(e,t,n,r,a,i,l,s,c,f){var p=8&t;t|=p?u:64,4&(t&=~(p?64:u))||(t&=-4);var d=[e,t,a,p?i:o,p?l:o,p?o:i,p?o:l,s,c,f],h=n.apply(o,d);return wa(e)&&Pa(h,d),h.placeholder=r,ja(h,e,t)}function Yo(e){var t=Oe[e];return function(e,n){if(e=gl(e),(n=null==n?0:vn(ml(n),292))&&hn(e)){var r=(bl(e)+"e").split("e");return+((r=(bl(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Go=kn&&1/nn(new kn([,-0]))[1]==c?function(e){return new kn(e)}:su;function $o(e){return function(t){var n=da(t);return n==_?Zt(t):n==C?rn(t):function(e,t){return xt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Xo(e,t,n,i,c,f,p,d){var h=2&t;if(!h&&"function"!=typeof e)throw new Ce(a);var m=i?i.length:0;if(m||(t&=-97,i=c=o),p=p===o?p:gn(ml(p),0),d=d===o?d:ml(d),m-=c?c.length:0,64&t){var y=i,g=c;i=c=o}var v=h?o:oa(e),b=[e,t,n,i,c,y,g,f,p,d];if(v&&function(e,t){var n=e[1],r=t[1],o=n|r,a=o<131,i=r==s&&8==n||r==s&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!a&&!i)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var u=t[3];if(u){var c=e[3];e[3]=c?ko(c,u,t[4]):u,e[4]=c?tn(e[3],l):t[4]}(u=t[5])&&(c=e[5],e[5]=c?Co(c,u,t[6]):u,e[6]=c?tn(e[5],l):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=o}(b,v),e=b[0],t=b[1],n=b[2],i=b[3],c=b[4],!(d=b[9]=b[9]===o?h?0:e.length:gn(b[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)w=8==t||16==t?function(e,t,n){var a=Mo(e);return function i(){for(var l=arguments.length,u=r(l),s=l,c=ia(i);s--;)u[s]=arguments[s];var f=l<3&&u[0]!==c&&u[l-1]!==c?[]:tn(u,c);return(l-=f.length)<n?qo(e,t,zo,i.placeholder,o,u,f,o,o,n-l):gt(this&&this!==at&&this instanceof i?a:e,this,u)}}(e,t,d):t!=u&&33!=t||c.length?zo.apply(o,b):function(e,t,n,o){var a=1&t,i=Mo(e);return function t(){for(var l=-1,u=arguments.length,s=-1,c=o.length,f=r(c+u),p=this&&this!==at&&this instanceof t?i:e;++s<c;)f[s]=o[s];for(;u--;)f[s++]=arguments[++l];return gt(p,a?n:this,f)}}(e,t,n,i);else var w=function(e,t,n){var r=1&t,o=Mo(e);return function t(){return(this&&this!==at&&this instanceof t?o:e).apply(r?n:this,arguments)}}(e,t,n);return ja((v?Jr:Pa)(w,b),e,t)}function Qo(e,t,n,r){return e===o||Vi(e,Ne[n])&&!Re.call(r,n)?t:e}function Jo(e,t,n,r,a,i){return tl(e)&&tl(t)&&(i.set(t,e),Ur(e,t,o,Jo,i),i.delete(t)),e}function Zo(e){return al(e)?o:e}function ea(e,t,n,r,a,i){var l=1&n,u=e.length,s=t.length;if(u!=s&&!(l&&s>u))return!1;var c=i.get(e),f=i.get(t);if(c&&f)return c==t&&f==e;var p=-1,d=!0,h=2&n?new Yn:o;for(i.set(e,t),i.set(t,e);++p<u;){var m=e[p],y=t[p];if(r)var g=l?r(y,m,p,t,e,i):r(m,y,p,e,t,i);if(g!==o){if(g)continue;d=!1;break}if(h){if(!Pt(t,(function(e,t){if(!Kt(h,t)&&(m===e||a(m,e,n,r,i)))return h.push(t)}))){d=!1;break}}else if(m!==y&&!a(m,y,n,r,i)){d=!1;break}}return i.delete(e),i.delete(t),d}function ta(e){return Ia(xa(e,o,qa),e+"")}function na(e){return Or(e,jl,fa)}function ra(e){return Or(e,Rl,pa)}var oa=Pn?function(e){return Pn.get(e)}:su;function aa(e){for(var t=e.name+"",n=Nn[t],r=Re.call(Nn,t)?n.length:0;r--;){var o=n[r],a=o.func;if(null==a||a==e)return o.name}return t}function ia(e){return(Re.call(zn,"placeholder")?zn:e).placeholder}function la(){var e=zn.iteratee||au;return e=e===au?Ar:e,arguments.length?e(arguments[0],arguments[1]):e}function ua(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function sa(e){for(var t=jl(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,Oa(o)]}return t}function ca(e,t){var n=function(e,t){return null==e?o:e[t]}(e,t);return Rr(n)?n:o}var fa=pn?function(e){return null==e?[]:(e=Se(e),_t(pn(e),(function(t){return et.call(e,t)})))}:yu,pa=pn?function(e){for(var t=[];e;)kt(t,fa(e)),e=qe(e);return t}:yu,da=Sr;function ha(e,t,n){for(var r=-1,o=(t=vo(t,e)).length,a=!1;++r<o;){var i=Fa(t[r]);if(!(a=null!=e&&n(e,i)))break;e=e[i]}return a||++r!=o?a:!!(o=null==e?0:e.length)&&el(o)&&ga(i,o)&&(Ki(e)||Wi(e))}function ma(e){return"function"!=typeof e.constructor||_a(e)?{}:Un(qe(e))}function ya(e){return Ki(e)||Wi(e)||!!(ot&&e&&e[ot])}function ga(e,t){var n=typeof e;return!!(t=null==t?f:t)&&("number"==n||"symbol"!=n&&ge.test(e))&&e>-1&&e%1==0&&e<t}function va(e,t,n){if(!tl(n))return!1;var r=typeof t;return!!("number"==r?Yi(n)&&ga(t,n.length):"string"==r&&t in n)&&Vi(n[t],e)}function ba(e,t){if(Ki(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!sl(e))||Z.test(e)||!J.test(e)||null!=t&&e in Se(t)}function wa(e){var t=aa(e),n=zn[t];if("function"!=typeof n||!(t in Bn.prototype))return!1;if(e===n)return!0;var r=oa(n);return!!r&&e===r[0]}(On&&da(new On(new ArrayBuffer(1)))!=j||Sn&&da(new Sn)!=_||xn&&da(xn.resolve())!=x||kn&&da(new kn)!=C||Cn&&da(new Cn)!=N)&&(da=function(e){var t=Sr(e),n=t==S?e.constructor:o,r=n?za(n):"";if(r)switch(r){case In:return j;case jn:return _;case Rn:return x;case An:return C;case Dn:return N}return t});var Ea=Ie?Ji:gu;function _a(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function Oa(e){return e==e&&!tl(e)}function Sa(e,t){return function(n){return null!=n&&n[e]===t&&(t!==o||e in Se(n))}}function xa(e,t,n){return t=gn(t===o?e.length-1:t,0),function(){for(var o=arguments,a=-1,i=gn(o.length-t,0),l=r(i);++a<i;)l[a]=o[t+a];a=-1;for(var u=r(t+1);++a<t;)u[a]=o[a];return u[t]=n(l),gt(e,this,u)}}function ka(e,t){return t.length<2?e:_r(e,to(t,0,-1))}function Ca(e,t){for(var n=e.length,r=vn(t.length,n),a=To(e);r--;){var i=t[r];e[r]=ga(i,n)?a[i]:o}return e}function Ta(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Pa=Ra(Jr),Na=Ft||function(e,t){return at.setTimeout(e,t)},Ia=Ra(Zr);function ja(e,t,n){var r=t+"";return Ia(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ae,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return bt(h,(function(n){var r="_."+n[0];t&n[1]&&!Ot(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ie);return t?t[1].split(le):[]}(r),n)))}function Ra(e){var t=0,n=0;return function(){var r=bn(),a=16-(r-n);if(n=r,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Aa(e,t){var n=-1,r=e.length,a=r-1;for(t=t===o?r:t;++n<t;){var i=qr(n,a),l=e[i];e[i]=e[n],e[n]=l}return e.length=t,e}var Da,Ma,La=(Da=Di((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ee,(function(e,n,r,o){t.push(r?o.replace(ce,"$1"):n||e)})),t}),(function(e){return 500===Ma.size&&Ma.clear(),e})),Ma=Da.cache,Da);function Fa(e){if("string"==typeof e||sl(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function za(e){if(null!=e){try{return je.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ua(e){if(e instanceof Bn)return e.clone();var t=new Hn(e.__wrapped__,e.__chain__);return t.__actions__=To(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Va=Gr((function(e,t){return Gi(e)?cr(e,yr(t,1,Gi,!0)):[]})),Ha=Gr((function(e,t){var n=Qa(t);return Gi(n)&&(n=o),Gi(e)?cr(e,yr(t,1,Gi,!0),la(n,2)):[]})),Ba=Gr((function(e,t){var n=Qa(t);return Gi(n)&&(n=o),Gi(e)?cr(e,yr(t,1,Gi,!0),o,n):[]}));function Wa(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ml(n);return o<0&&(o=gn(r+o,0)),jt(e,la(t,3),o)}function Ka(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=r-1;return n!==o&&(a=ml(n),a=n<0?gn(r+a,0):vn(a,r-1)),jt(e,la(t,3),a,!0)}function qa(e){return null!=e&&e.length?yr(e,1):[]}function Ya(e){return e&&e.length?e[0]:o}var Ga=Gr((function(e){var t=xt(e,yo);return t.length&&t[0]===e[0]?Tr(t):[]})),$a=Gr((function(e){var t=Qa(e),n=xt(e,yo);return t===Qa(n)?t=o:n.pop(),n.length&&n[0]===e[0]?Tr(n,la(t,2)):[]})),Xa=Gr((function(e){var t=Qa(e),n=xt(e,yo);return(t="function"==typeof t?t:o)&&n.pop(),n.length&&n[0]===e[0]?Tr(n,o,t):[]}));function Qa(e){var t=null==e?0:e.length;return t?e[t-1]:o}var Ja=Gr(Za);function Za(e,t){return e&&e.length&&t&&t.length?Wr(e,t):e}var ei=ta((function(e,t){var n=null==e?0:e.length,r=ar(e,t);return Kr(e,xt(t,(function(e){return ga(e,n)?+e:e})).sort(xo)),r}));function ti(e){return null==e?e:_n.call(e)}var ni=Gr((function(e){return uo(yr(e,1,Gi,!0))})),ri=Gr((function(e){var t=Qa(e);return Gi(t)&&(t=o),uo(yr(e,1,Gi,!0),la(t,2))})),oi=Gr((function(e){var t=Qa(e);return t="function"==typeof t?t:o,uo(yr(e,1,Gi,!0),o,t)}));function ai(e){if(!e||!e.length)return[];var t=0;return e=_t(e,(function(e){if(Gi(e))return t=gn(e.length,t),!0})),Vt(t,(function(t){return xt(e,Lt(t))}))}function ii(e,t){if(!e||!e.length)return[];var n=ai(e);return null==t?n:xt(n,(function(e){return gt(t,o,e)}))}var li=Gr((function(e,t){return Gi(e)?cr(e,t):[]})),ui=Gr((function(e){return ho(_t(e,Gi))})),si=Gr((function(e){var t=Qa(e);return Gi(t)&&(t=o),ho(_t(e,Gi),la(t,2))})),ci=Gr((function(e){var t=Qa(e);return t="function"==typeof t?t:o,ho(_t(e,Gi),o,t)})),fi=Gr(ai),pi=Gr((function(e){var t=e.length,n=t>1?e[t-1]:o;return n="function"==typeof n?(e.pop(),n):o,ii(e,n)}));function di(e){var t=zn(e);return t.__chain__=!0,t}function hi(e,t){return t(e)}var mi=ta((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,a=function(t){return ar(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Bn&&ga(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:hi,args:[a],thisArg:o}),new Hn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(a)})),yi=No((function(e,t,n){Re.call(e,n)?++e[n]:or(e,n,1)})),gi=Lo(Wa),vi=Lo(Ka);function bi(e,t){return(Ki(e)?bt:fr)(e,la(t,3))}function wi(e,t){return(Ki(e)?wt:pr)(e,la(t,3))}var Ei=No((function(e,t,n){Re.call(e,n)?e[n].push(t):or(e,n,[t])})),_i=Gr((function(e,t,n){var o=-1,a="function"==typeof t,i=Yi(e)?r(e.length):[];return fr(e,(function(e){i[++o]=a?gt(t,e,n):Pr(e,t,n)})),i})),Oi=No((function(e,t,n){or(e,n,t)}));function Si(e,t){return(Ki(e)?xt:Lr)(e,la(t,3))}var xi=No((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ki=Gr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&va(e,t[0],t[1])?t=[]:n>2&&va(t[0],t[1],t[2])&&(t=[t[0]]),Hr(e,yr(t,1),[])})),Ci=Nt||function(){return at.Date.now()};function Ti(e,t,n){return t=n?o:t,t=e&&null==t?e.length:t,Xo(e,s,o,o,o,o,t)}function Pi(e,t){var n;if("function"!=typeof t)throw new Ce(a);return e=ml(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=o),n}}var Ni=Gr((function(e,t,n){var r=1;if(n.length){var o=tn(n,ia(Ni));r|=u}return Xo(e,r,t,n,o)})),Ii=Gr((function(e,t,n){var r=3;if(n.length){var o=tn(n,ia(Ii));r|=u}return Xo(t,r,e,n,o)}));function ji(e,t,n){var r,i,l,u,s,c,f=0,p=!1,d=!1,h=!0;if("function"!=typeof e)throw new Ce(a);function m(t){var n=r,a=i;return r=i=o,f=t,u=e.apply(a,n)}function y(e){return f=e,s=Na(v,t),p?m(e):u}function g(e){var n=e-c;return c===o||n>=t||n<0||d&&e-f>=l}function v(){var e=Ci();if(g(e))return b(e);s=Na(v,function(e){var n=t-(e-c);return d?vn(n,l-(e-f)):n}(e))}function b(e){return s=o,h&&r?m(e):(r=i=o,u)}function w(){var e=Ci(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===o)return y(c);if(d)return Eo(s),s=Na(v,t),m(c)}return s===o&&(s=Na(v,t)),u}return t=gl(t)||0,tl(n)&&(p=!!n.leading,l=(d="maxWait"in n)?gn(gl(n.maxWait)||0,t):l,h="trailing"in n?!!n.trailing:h),w.cancel=function(){s!==o&&Eo(s),f=0,r=c=i=s=o},w.flush=function(){return s===o?u:b(Ci())},w}var Ri=Gr((function(e,t){return sr(e,1,t)})),Ai=Gr((function(e,t,n){return sr(e,gl(t)||0,n)}));function Di(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ce(a);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var i=e.apply(this,r);return n.cache=a.set(o,i)||a,i};return n.cache=new(Di.Cache||qn),n}function Mi(e){if("function"!=typeof e)throw new Ce(a);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Di.Cache=qn;var Li=bo((function(e,t){var n=(t=1==t.length&&Ki(t[0])?xt(t[0],Bt(la())):xt(yr(t,1),Bt(la()))).length;return Gr((function(r){for(var o=-1,a=vn(r.length,n);++o<a;)r[o]=t[o].call(this,r[o]);return gt(e,this,r)}))})),Fi=Gr((function(e,t){var n=tn(t,ia(Fi));return Xo(e,u,o,t,n)})),zi=Gr((function(e,t){var n=tn(t,ia(zi));return Xo(e,64,o,t,n)})),Ui=ta((function(e,t){return Xo(e,256,o,o,o,t)}));function Vi(e,t){return e===t||e!=e&&t!=t}var Hi=Ko(xr),Bi=Ko((function(e,t){return e>=t})),Wi=Nr(function(){return arguments}())?Nr:function(e){return nl(e)&&Re.call(e,"callee")&&!et.call(e,"callee")},Ki=r.isArray,qi=ft?Bt(ft):function(e){return nl(e)&&Sr(e)==I};function Yi(e){return null!=e&&el(e.length)&&!Ji(e)}function Gi(e){return nl(e)&&Yi(e)}var $i=dn||gu,Xi=pt?Bt(pt):function(e){return nl(e)&&Sr(e)==v};function Qi(e){if(!nl(e))return!1;var t=Sr(e);return t==b||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!al(e)}function Ji(e){if(!tl(e))return!1;var t=Sr(e);return t==w||t==E||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zi(e){return"number"==typeof e&&e==ml(e)}function el(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function tl(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function nl(e){return null!=e&&"object"==typeof e}var rl=dt?Bt(dt):function(e){return nl(e)&&da(e)==_};function ol(e){return"number"==typeof e||nl(e)&&Sr(e)==O}function al(e){if(!nl(e)||Sr(e)!=S)return!1;var t=qe(e);if(null===t)return!0;var n=Re.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&je.call(n)==Le}var il=ht?Bt(ht):function(e){return nl(e)&&Sr(e)==k},ll=mt?Bt(mt):function(e){return nl(e)&&da(e)==C};function ul(e){return"string"==typeof e||!Ki(e)&&nl(e)&&Sr(e)==T}function sl(e){return"symbol"==typeof e||nl(e)&&Sr(e)==P}var cl=yt?Bt(yt):function(e){return nl(e)&&el(e.length)&&!!Je[Sr(e)]},fl=Ko(Mr),pl=Ko((function(e,t){return e<=t}));function dl(e){if(!e)return[];if(Yi(e))return ul(e)?an(e):To(e);if(it&&e[it])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[it]());var t=da(e);return(t==_?Zt:t==C?nn:Vl)(e)}function hl(e){return e?(e=gl(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ml(e){var t=hl(e),n=t%1;return t==t?n?t-n:t:0}function yl(e){return e?ir(ml(e),0,d):0}function gl(e){if("number"==typeof e)return e;if(sl(e))return p;if(tl(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=tl(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ht(e);var n=he.test(e);return n||ye.test(e)?nt(e.slice(2),n?2:8):de.test(e)?p:+e}function vl(e){return Po(e,Rl(e))}function bl(e){return null==e?"":lo(e)}var wl=Io((function(e,t){if(_a(t)||Yi(t))Po(t,jl(t),e);else for(var n in t)Re.call(t,n)&&er(e,n,t[n])})),El=Io((function(e,t){Po(t,Rl(t),e)})),_l=Io((function(e,t,n,r){Po(t,Rl(t),e,r)})),Ol=Io((function(e,t,n,r){Po(t,jl(t),e,r)})),Sl=ta(ar),xl=Gr((function(e,t){e=Se(e);var n=-1,r=t.length,a=r>2?t[2]:o;for(a&&va(t[0],t[1],a)&&(r=1);++n<r;)for(var i=t[n],l=Rl(i),u=-1,s=l.length;++u<s;){var c=l[u],f=e[c];(f===o||Vi(f,Ne[c])&&!Re.call(e,c))&&(e[c]=i[c])}return e})),kl=Gr((function(e){return e.push(o,Jo),gt(Dl,o,e)}));function Cl(e,t,n){var r=null==e?o:_r(e,t);return r===o?n:r}function Tl(e,t){return null!=e&&ha(e,t,Cr)}var Pl=Uo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),e[t]=n}),tu(ou)),Nl=Uo((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),Re.call(e,t)?e[t].push(n):e[t]=[n]}),la),Il=Gr(Pr);function jl(e){return Yi(e)?$n(e):Dr(e)}function Rl(e){return Yi(e)?$n(e,!0):function(e){if(!tl(e))return function(e){var t=[];if(null!=e)for(var n in Se(e))t.push(n);return t}(e);var t=_a(e),n=[];for(var r in e)("constructor"!=r||!t&&Re.call(e,r))&&n.push(r);return n}(e)}var Al=Io((function(e,t,n){Ur(e,t,n)})),Dl=Io((function(e,t,n,r){Ur(e,t,n,r)})),Ml=ta((function(e,t){var n={};if(null==e)return n;var r=!1;t=xt(t,(function(t){return t=vo(t,e),r||(r=t.length>1),t})),Po(e,ra(e),n),r&&(n=lr(n,7,Zo));for(var o=t.length;o--;)so(n,t[o]);return n})),Ll=ta((function(e,t){return null==e?{}:function(e,t){return Br(e,t,(function(t,n){return Tl(e,n)}))}(e,t)}));function Fl(e,t){if(null==e)return{};var n=xt(ra(e),(function(e){return[e]}));return t=la(t),Br(e,n,(function(e,n){return t(e,n[0])}))}var zl=$o(jl),Ul=$o(Rl);function Vl(e){return null==e?[]:Wt(e,jl(e))}var Hl=Do((function(e,t,n){return t=t.toLowerCase(),e+(n?Bl(t):t)}));function Bl(e){return Ql(bl(e).toLowerCase())}function Wl(e){return(e=bl(e))&&e.replace(ve,$t).replace(Ke,"")}var Kl=Do((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),ql=Do((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Yl=Ao("toLowerCase"),Gl=Do((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),$l=Do((function(e,t,n){return e+(n?" ":"")+Ql(t)})),Xl=Do((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ql=Ao("toUpperCase");function Jl(e,t,n){return e=bl(e),(t=n?o:t)===o?function(e){return $e.test(e)}(e)?function(e){return e.match(Ye)||[]}(e):function(e){return e.match(ue)||[]}(e):e.match(t)||[]}var Zl=Gr((function(e,t){try{return gt(e,o,t)}catch(e){return Qi(e)?e:new Ee(e)}})),eu=ta((function(e,t){return bt(t,(function(t){t=Fa(t),or(e,t,Ni(e[t],e))})),e}));function tu(e){return function(){return e}}var nu=Fo(),ru=Fo(!0);function ou(e){return e}function au(e){return Ar("function"==typeof e?e:lr(e,1))}var iu=Gr((function(e,t){return function(n){return Pr(n,e,t)}})),lu=Gr((function(e,t){return function(n){return Pr(e,n,t)}}));function uu(e,t,n){var r=jl(t),o=Er(t,r);null!=n||tl(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=Er(t,jl(t)));var a=!(tl(n)&&"chain"in n&&!n.chain),i=Ji(e);return bt(o,(function(n){var r=t[n];e[n]=r,i&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__),o=n.__actions__=To(this.__actions__);return o.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,kt([this.value()],arguments))})})),e}function su(){}var cu=Ho(xt),fu=Ho(Et),pu=Ho(Pt);function du(e){return ba(e)?Lt(Fa(e)):function(e){return function(t){return _r(t,e)}}(e)}var hu=Wo(),mu=Wo(!0);function yu(){return[]}function gu(){return!1}var vu,bu=Vo((function(e,t){return e+t}),0),wu=Yo("ceil"),Eu=Vo((function(e,t){return e/t}),1),_u=Yo("floor"),Ou=Vo((function(e,t){return e*t}),1),Su=Yo("round"),xu=Vo((function(e,t){return e-t}),0);return zn.after=function(e,t){if("function"!=typeof t)throw new Ce(a);return e=ml(e),function(){if(--e<1)return t.apply(this,arguments)}},zn.ary=Ti,zn.assign=wl,zn.assignIn=El,zn.assignInWith=_l,zn.assignWith=Ol,zn.at=Sl,zn.before=Pi,zn.bind=Ni,zn.bindAll=eu,zn.bindKey=Ii,zn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ki(e)?e:[e]},zn.chain=di,zn.chunk=function(e,t,n){t=(n?va(e,t,n):t===o)?1:gn(ml(t),0);var a=null==e?0:e.length;if(!a||t<1)return[];for(var i=0,l=0,u=r(cn(a/t));i<a;)u[l++]=to(e,i,i+=t);return u},zn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var a=e[t];a&&(o[r++]=a)}return o},zn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return kt(Ki(n)?To(n):[n],yr(t,1))},zn.cond=function(e){var t=null==e?0:e.length,n=la();return e=t?xt(e,(function(e){if("function"!=typeof e[1])throw new Ce(a);return[n(e[0]),e[1]]})):[],Gr((function(n){for(var r=-1;++r<t;){var o=e[r];if(gt(o[0],this,n))return gt(o[1],this,n)}}))},zn.conforms=function(e){return function(e){var t=jl(e);return function(n){return ur(n,e,t)}}(lr(e,1))},zn.constant=tu,zn.countBy=yi,zn.create=function(e,t){var n=Un(e);return null==t?n:rr(n,t)},zn.curry=function e(t,n,r){var a=Xo(t,8,o,o,o,o,o,n=r?o:n);return a.placeholder=e.placeholder,a},zn.curryRight=function e(t,n,r){var a=Xo(t,16,o,o,o,o,o,n=r?o:n);return a.placeholder=e.placeholder,a},zn.debounce=ji,zn.defaults=xl,zn.defaultsDeep=kl,zn.defer=Ri,zn.delay=Ai,zn.difference=Va,zn.differenceBy=Ha,zn.differenceWith=Ba,zn.drop=function(e,t,n){var r=null==e?0:e.length;return r?to(e,(t=n||t===o?1:ml(t))<0?0:t,r):[]},zn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?to(e,0,(t=r-(t=n||t===o?1:ml(t)))<0?0:t):[]},zn.dropRightWhile=function(e,t){return e&&e.length?fo(e,la(t,3),!0,!0):[]},zn.dropWhile=function(e,t){return e&&e.length?fo(e,la(t,3),!0):[]},zn.fill=function(e,t,n,r){var a=null==e?0:e.length;return a?(n&&"number"!=typeof n&&va(e,t,n)&&(n=0,r=a),function(e,t,n,r){var a=e.length;for((n=ml(n))<0&&(n=-n>a?0:a+n),(r=r===o||r>a?a:ml(r))<0&&(r+=a),r=n>r?0:yl(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},zn.filter=function(e,t){return(Ki(e)?_t:mr)(e,la(t,3))},zn.flatMap=function(e,t){return yr(Si(e,t),1)},zn.flatMapDeep=function(e,t){return yr(Si(e,t),c)},zn.flatMapDepth=function(e,t,n){return n=n===o?1:ml(n),yr(Si(e,t),n)},zn.flatten=qa,zn.flattenDeep=function(e){return null!=e&&e.length?yr(e,c):[]},zn.flattenDepth=function(e,t){return null!=e&&e.length?yr(e,t=t===o?1:ml(t)):[]},zn.flip=function(e){return Xo(e,512)},zn.flow=nu,zn.flowRight=ru,zn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},zn.functions=function(e){return null==e?[]:Er(e,jl(e))},zn.functionsIn=function(e){return null==e?[]:Er(e,Rl(e))},zn.groupBy=Ei,zn.initial=function(e){return null!=e&&e.length?to(e,0,-1):[]},zn.intersection=Ga,zn.intersectionBy=$a,zn.intersectionWith=Xa,zn.invert=Pl,zn.invertBy=Nl,zn.invokeMap=_i,zn.iteratee=au,zn.keyBy=Oi,zn.keys=jl,zn.keysIn=Rl,zn.map=Si,zn.mapKeys=function(e,t){var n={};return t=la(t,3),br(e,(function(e,r,o){or(n,t(e,r,o),e)})),n},zn.mapValues=function(e,t){var n={};return t=la(t,3),br(e,(function(e,r,o){or(n,r,t(e,r,o))})),n},zn.matches=function(e){return Fr(lr(e,1))},zn.matchesProperty=function(e,t){return zr(e,lr(t,1))},zn.memoize=Di,zn.merge=Al,zn.mergeWith=Dl,zn.method=iu,zn.methodOf=lu,zn.mixin=uu,zn.negate=Mi,zn.nthArg=function(e){return e=ml(e),Gr((function(t){return Vr(t,e)}))},zn.omit=Ml,zn.omitBy=function(e,t){return Fl(e,Mi(la(t)))},zn.once=function(e){return Pi(2,e)},zn.orderBy=function(e,t,n,r){return null==e?[]:(Ki(t)||(t=null==t?[]:[t]),Ki(n=r?o:n)||(n=null==n?[]:[n]),Hr(e,t,n))},zn.over=cu,zn.overArgs=Li,zn.overEvery=fu,zn.overSome=pu,zn.partial=Fi,zn.partialRight=zi,zn.partition=xi,zn.pick=Ll,zn.pickBy=Fl,zn.property=du,zn.propertyOf=function(e){return function(t){return null==e?o:_r(e,t)}},zn.pull=Ja,zn.pullAll=Za,zn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Wr(e,t,la(n,2)):e},zn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Wr(e,t,o,n):e},zn.pullAt=ei,zn.range=hu,zn.rangeRight=mu,zn.rearg=Ui,zn.reject=function(e,t){return(Ki(e)?_t:mr)(e,Mi(la(t,3)))},zn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],a=e.length;for(t=la(t,3);++r<a;){var i=e[r];t(i,r,e)&&(n.push(i),o.push(r))}return Kr(e,o),n},zn.rest=function(e,t){if("function"!=typeof e)throw new Ce(a);return Gr(e,t=t===o?t:ml(t))},zn.reverse=ti,zn.sampleSize=function(e,t,n){return t=(n?va(e,t,n):t===o)?1:ml(t),(Ki(e)?Qn:Xr)(e,t)},zn.set=function(e,t,n){return null==e?e:Qr(e,t,n)},zn.setWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:Qr(e,t,n,r)},zn.shuffle=function(e){return(Ki(e)?Jn:eo)(e)},zn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&va(e,t,n)?(t=0,n=r):(t=null==t?0:ml(t),n=n===o?r:ml(n)),to(e,t,n)):[]},zn.sortBy=ki,zn.sortedUniq=function(e){return e&&e.length?ao(e):[]},zn.sortedUniqBy=function(e,t){return e&&e.length?ao(e,la(t,2)):[]},zn.split=function(e,t,n){return n&&"number"!=typeof n&&va(e,t,n)&&(t=n=o),(n=n===o?d:n>>>0)?(e=bl(e))&&("string"==typeof t||null!=t&&!il(t))&&!(t=lo(t))&&Jt(e)?wo(an(e),0,n):e.split(t,n):[]},zn.spread=function(e,t){if("function"!=typeof e)throw new Ce(a);return t=null==t?0:gn(ml(t),0),Gr((function(n){var r=n[t],o=wo(n,0,t);return r&&kt(o,r),gt(e,this,o)}))},zn.tail=function(e){var t=null==e?0:e.length;return t?to(e,1,t):[]},zn.take=function(e,t,n){return e&&e.length?to(e,0,(t=n||t===o?1:ml(t))<0?0:t):[]},zn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?to(e,(t=r-(t=n||t===o?1:ml(t)))<0?0:t,r):[]},zn.takeRightWhile=function(e,t){return e&&e.length?fo(e,la(t,3),!1,!0):[]},zn.takeWhile=function(e,t){return e&&e.length?fo(e,la(t,3)):[]},zn.tap=function(e,t){return t(e),e},zn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Ce(a);return tl(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ji(e,t,{leading:r,maxWait:t,trailing:o})},zn.thru=hi,zn.toArray=dl,zn.toPairs=zl,zn.toPairsIn=Ul,zn.toPath=function(e){return Ki(e)?xt(e,Fa):sl(e)?[e]:To(La(bl(e)))},zn.toPlainObject=vl,zn.transform=function(e,t,n){var r=Ki(e),o=r||$i(e)||cl(e);if(t=la(t,4),null==n){var a=e&&e.constructor;n=o?r?new a:[]:tl(e)&&Ji(a)?Un(qe(e)):{}}return(o?bt:br)(e,(function(e,r,o){return t(n,e,r,o)})),n},zn.unary=function(e){return Ti(e,1)},zn.union=ni,zn.unionBy=ri,zn.unionWith=oi,zn.uniq=function(e){return e&&e.length?uo(e):[]},zn.uniqBy=function(e,t){return e&&e.length?uo(e,la(t,2)):[]},zn.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?uo(e,o,t):[]},zn.unset=function(e,t){return null==e||so(e,t)},zn.unzip=ai,zn.unzipWith=ii,zn.update=function(e,t,n){return null==e?e:co(e,t,go(n))},zn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:o,null==e?e:co(e,t,go(n),r)},zn.values=Vl,zn.valuesIn=function(e){return null==e?[]:Wt(e,Rl(e))},zn.without=li,zn.words=Jl,zn.wrap=function(e,t){return Fi(go(t),e)},zn.xor=ui,zn.xorBy=si,zn.xorWith=ci,zn.zip=fi,zn.zipObject=function(e,t){return mo(e||[],t||[],er)},zn.zipObjectDeep=function(e,t){return mo(e||[],t||[],Qr)},zn.zipWith=pi,zn.entries=zl,zn.entriesIn=Ul,zn.extend=El,zn.extendWith=_l,uu(zn,zn),zn.add=bu,zn.attempt=Zl,zn.camelCase=Hl,zn.capitalize=Bl,zn.ceil=wu,zn.clamp=function(e,t,n){return n===o&&(n=t,t=o),n!==o&&(n=(n=gl(n))==n?n:0),t!==o&&(t=(t=gl(t))==t?t:0),ir(gl(e),t,n)},zn.clone=function(e){return lr(e,4)},zn.cloneDeep=function(e){return lr(e,5)},zn.cloneDeepWith=function(e,t){return lr(e,5,t="function"==typeof t?t:o)},zn.cloneWith=function(e,t){return lr(e,4,t="function"==typeof t?t:o)},zn.conformsTo=function(e,t){return null==t||ur(e,t,jl(t))},zn.deburr=Wl,zn.defaultTo=function(e,t){return null==e||e!=e?t:e},zn.divide=Eu,zn.endsWith=function(e,t,n){e=bl(e),t=lo(t);var r=e.length,a=n=n===o?r:ir(ml(n),0,r);return(n-=t.length)>=0&&e.slice(n,a)==t},zn.eq=Vi,zn.escape=function(e){return(e=bl(e))&&G.test(e)?e.replace(q,Xt):e},zn.escapeRegExp=function(e){return(e=bl(e))&&ne.test(e)?e.replace(te,"\\$&"):e},zn.every=function(e,t,n){var r=Ki(e)?Et:dr;return n&&va(e,t,n)&&(t=o),r(e,la(t,3))},zn.find=gi,zn.findIndex=Wa,zn.findKey=function(e,t){return It(e,la(t,3),br)},zn.findLast=vi,zn.findLastIndex=Ka,zn.findLastKey=function(e,t){return It(e,la(t,3),wr)},zn.floor=_u,zn.forEach=bi,zn.forEachRight=wi,zn.forIn=function(e,t){return null==e?e:gr(e,la(t,3),Rl)},zn.forInRight=function(e,t){return null==e?e:vr(e,la(t,3),Rl)},zn.forOwn=function(e,t){return e&&br(e,la(t,3))},zn.forOwnRight=function(e,t){return e&&wr(e,la(t,3))},zn.get=Cl,zn.gt=Hi,zn.gte=Bi,zn.has=function(e,t){return null!=e&&ha(e,t,kr)},zn.hasIn=Tl,zn.head=Ya,zn.identity=ou,zn.includes=function(e,t,n,r){e=Yi(e)?e:Vl(e),n=n&&!r?ml(n):0;var o=e.length;return n<0&&(n=gn(o+n,0)),ul(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&Rt(e,t,n)>-1},zn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ml(n);return o<0&&(o=gn(r+o,0)),Rt(e,t,o)},zn.inRange=function(e,t,n){return t=hl(t),n===o?(n=t,t=0):n=hl(n),function(e,t,n){return e>=vn(t,n)&&e<gn(t,n)}(e=gl(e),t,n)},zn.invoke=Il,zn.isArguments=Wi,zn.isArray=Ki,zn.isArrayBuffer=qi,zn.isArrayLike=Yi,zn.isArrayLikeObject=Gi,zn.isBoolean=function(e){return!0===e||!1===e||nl(e)&&Sr(e)==g},zn.isBuffer=$i,zn.isDate=Xi,zn.isElement=function(e){return nl(e)&&1===e.nodeType&&!al(e)},zn.isEmpty=function(e){if(null==e)return!0;if(Yi(e)&&(Ki(e)||"string"==typeof e||"function"==typeof e.splice||$i(e)||cl(e)||Wi(e)))return!e.length;var t=da(e);if(t==_||t==C)return!e.size;if(_a(e))return!Dr(e).length;for(var n in e)if(Re.call(e,n))return!1;return!0},zn.isEqual=function(e,t){return Ir(e,t)},zn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:o)?n(e,t):o;return r===o?Ir(e,t,o,n):!!r},zn.isError=Qi,zn.isFinite=function(e){return"number"==typeof e&&hn(e)},zn.isFunction=Ji,zn.isInteger=Zi,zn.isLength=el,zn.isMap=rl,zn.isMatch=function(e,t){return e===t||jr(e,t,sa(t))},zn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:o,jr(e,t,sa(t),n)},zn.isNaN=function(e){return ol(e)&&e!=+e},zn.isNative=function(e){if(Ea(e))throw new Ee("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Rr(e)},zn.isNil=function(e){return null==e},zn.isNull=function(e){return null===e},zn.isNumber=ol,zn.isObject=tl,zn.isObjectLike=nl,zn.isPlainObject=al,zn.isRegExp=il,zn.isSafeInteger=function(e){return Zi(e)&&e>=-9007199254740991&&e<=f},zn.isSet=ll,zn.isString=ul,zn.isSymbol=sl,zn.isTypedArray=cl,zn.isUndefined=function(e){return e===o},zn.isWeakMap=function(e){return nl(e)&&da(e)==N},zn.isWeakSet=function(e){return nl(e)&&"[object WeakSet]"==Sr(e)},zn.join=function(e,t){return null==e?"":mn.call(e,t)},zn.kebabCase=Kl,zn.last=Qa,zn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var a=r;return n!==o&&(a=(a=ml(n))<0?gn(r+a,0):vn(a,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):jt(e,Dt,a,!0)},zn.lowerCase=ql,zn.lowerFirst=Yl,zn.lt=fl,zn.lte=pl,zn.max=function(e){return e&&e.length?hr(e,ou,xr):o},zn.maxBy=function(e,t){return e&&e.length?hr(e,la(t,2),xr):o},zn.mean=function(e){return Mt(e,ou)},zn.meanBy=function(e,t){return Mt(e,la(t,2))},zn.min=function(e){return e&&e.length?hr(e,ou,Mr):o},zn.minBy=function(e,t){return e&&e.length?hr(e,la(t,2),Mr):o},zn.stubArray=yu,zn.stubFalse=gu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Ou,zn.nth=function(e,t){return e&&e.length?Vr(e,ml(t)):o},zn.noConflict=function(){return at._===this&&(at._=Fe),this},zn.noop=su,zn.now=Ci,zn.pad=function(e,t,n){e=bl(e);var r=(t=ml(t))?on(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return Bo(fn(o),n)+e+Bo(cn(o),n)},zn.padEnd=function(e,t,n){e=bl(e);var r=(t=ml(t))?on(e):0;return t&&r<t?e+Bo(t-r,n):e},zn.padStart=function(e,t,n){e=bl(e);var r=(t=ml(t))?on(e):0;return t&&r<t?Bo(t-r,n)+e:e},zn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),wn(bl(e).replace(re,""),t||0)},zn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&va(e,t,n)&&(t=n=o),n===o&&("boolean"==typeof t?(n=t,t=o):"boolean"==typeof e&&(n=e,e=o)),e===o&&t===o?(e=0,t=1):(e=hl(e),t===o?(t=e,e=0):t=hl(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var a=En();return vn(e+a*(t-e+tt("1e-"+((a+"").length-1))),t)}return qr(e,t)},zn.reduce=function(e,t,n){var r=Ki(e)?Ct:zt,o=arguments.length<3;return r(e,la(t,4),n,o,fr)},zn.reduceRight=function(e,t,n){var r=Ki(e)?Tt:zt,o=arguments.length<3;return r(e,la(t,4),n,o,pr)},zn.repeat=function(e,t,n){return t=(n?va(e,t,n):t===o)?1:ml(t),Yr(bl(e),t)},zn.replace=function(){var e=arguments,t=bl(e[0]);return e.length<3?t:t.replace(e[1],e[2])},zn.result=function(e,t,n){var r=-1,a=(t=vo(t,e)).length;for(a||(a=1,e=o);++r<a;){var i=null==e?o:e[Fa(t[r])];i===o&&(r=a,i=n),e=Ji(i)?i.call(e):i}return e},zn.round=Su,zn.runInContext=e,zn.sample=function(e){return(Ki(e)?Xn:$r)(e)},zn.size=function(e){if(null==e)return 0;if(Yi(e))return ul(e)?on(e):e.length;var t=da(e);return t==_||t==C?e.size:Dr(e).length},zn.snakeCase=Gl,zn.some=function(e,t,n){var r=Ki(e)?Pt:no;return n&&va(e,t,n)&&(t=o),r(e,la(t,3))},zn.sortedIndex=function(e,t){return ro(e,t)},zn.sortedIndexBy=function(e,t,n){return oo(e,t,la(n,2))},zn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ro(e,t);if(r<n&&Vi(e[r],t))return r}return-1},zn.sortedLastIndex=function(e,t){return ro(e,t,!0)},zn.sortedLastIndexBy=function(e,t,n){return oo(e,t,la(n,2),!0)},zn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ro(e,t,!0)-1;if(Vi(e[n],t))return n}return-1},zn.startCase=$l,zn.startsWith=function(e,t,n){return e=bl(e),n=null==n?0:ir(ml(n),0,e.length),t=lo(t),e.slice(n,n+t.length)==t},zn.subtract=xu,zn.sum=function(e){return e&&e.length?Ut(e,ou):0},zn.sumBy=function(e,t){return e&&e.length?Ut(e,la(t,2)):0},zn.template=function(e,t,n){var r=zn.templateSettings;n&&va(e,t,n)&&(t=o),e=bl(e),t=_l({},t,r,Qo);var a,i,l=_l({},t.imports,r.imports,Qo),u=jl(l),s=Wt(l,u),c=0,f=t.interpolate||be,p="__p += '",d=xe((t.escape||be).source+"|"+f.source+"|"+(f===Q?fe:be).source+"|"+(t.evaluate||be).source+"|$","g"),h="//# sourceURL="+(Re.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Qe+"]")+"\n";e.replace(d,(function(t,n,r,o,l,u){return r||(r=o),p+=e.slice(c,u).replace(we,Qt),n&&(a=!0,p+="' +\n__e("+n+") +\n'"),l&&(i=!0,p+="';\n"+l+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=u+t.length,t})),p+="';\n";var m=Re.call(t,"variable")&&t.variable;if(m){if(se.test(m))throw new Ee("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(i?p.replace(H,""):p).replace(B,"$1").replace(W,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Zl((function(){return _e(u,h+"return "+p).apply(o,s)}));if(y.source=p,Qi(y))throw y;return y},zn.times=function(e,t){if((e=ml(e))<1||e>f)return[];var n=d,r=vn(e,d);t=la(t),e-=d;for(var o=Vt(r,t);++n<e;)t(n);return o},zn.toFinite=hl,zn.toInteger=ml,zn.toLength=yl,zn.toLower=function(e){return bl(e).toLowerCase()},zn.toNumber=gl,zn.toSafeInteger=function(e){return e?ir(ml(e),-9007199254740991,f):0===e?e:0},zn.toString=bl,zn.toUpper=function(e){return bl(e).toUpperCase()},zn.trim=function(e,t,n){if((e=bl(e))&&(n||t===o))return Ht(e);if(!e||!(t=lo(t)))return e;var r=an(e),a=an(t);return wo(r,qt(r,a),Yt(r,a)+1).join("")},zn.trimEnd=function(e,t,n){if((e=bl(e))&&(n||t===o))return e.slice(0,ln(e)+1);if(!e||!(t=lo(t)))return e;var r=an(e);return wo(r,0,Yt(r,an(t))+1).join("")},zn.trimStart=function(e,t,n){if((e=bl(e))&&(n||t===o))return e.replace(re,"");if(!e||!(t=lo(t)))return e;var r=an(e);return wo(r,qt(r,an(t))).join("")},zn.truncate=function(e,t){var n=30,r="...";if(tl(t)){var a="separator"in t?t.separator:a;n="length"in t?ml(t.length):n,r="omission"in t?lo(t.omission):r}var i=(e=bl(e)).length;if(Jt(e)){var l=an(e);i=l.length}if(n>=i)return e;var u=n-on(r);if(u<1)return r;var s=l?wo(l,0,u).join(""):e.slice(0,u);if(a===o)return s+r;if(l&&(u+=s.length-u),il(a)){if(e.slice(u).search(a)){var c,f=s;for(a.global||(a=xe(a.source,bl(pe.exec(a))+"g")),a.lastIndex=0;c=a.exec(f);)var p=c.index;s=s.slice(0,p===o?u:p)}}else if(e.indexOf(lo(a),u)!=u){var d=s.lastIndexOf(a);d>-1&&(s=s.slice(0,d))}return s+r},zn.unescape=function(e){return(e=bl(e))&&Y.test(e)?e.replace(K,un):e},zn.uniqueId=function(e){var t=++Ae;return bl(e)+t},zn.upperCase=Xl,zn.upperFirst=Ql,zn.each=bi,zn.eachRight=wi,zn.first=Ya,uu(zn,(vu={},br(zn,(function(e,t){Re.call(zn.prototype,t)||(vu[t]=e)})),vu),{chain:!1}),zn.VERSION="4.17.21",bt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){zn[e].placeholder=zn})),bt(["drop","take"],(function(e,t){Bn.prototype[e]=function(n){n=n===o?1:gn(ml(n),0);var r=this.__filtered__&&!t?new Bn(this):this.clone();return r.__filtered__?r.__takeCount__=vn(n,r.__takeCount__):r.__views__.push({size:vn(n,d),type:e+(r.__dir__<0?"Right":"")}),r},Bn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),bt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Bn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:la(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),bt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Bn.prototype[e]=function(){return this[n](1).value()[0]}})),bt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Bn.prototype[e]=function(){return this.__filtered__?new Bn(this):this[n](1)}})),Bn.prototype.compact=function(){return this.filter(ou)},Bn.prototype.find=function(e){return this.filter(e).head()},Bn.prototype.findLast=function(e){return this.reverse().find(e)},Bn.prototype.invokeMap=Gr((function(e,t){return"function"==typeof e?new Bn(this):this.map((function(n){return Pr(n,e,t)}))})),Bn.prototype.reject=function(e){return this.filter(Mi(la(e)))},Bn.prototype.slice=function(e,t){e=ml(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Bn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==o&&(n=(t=ml(t))<0?n.dropRight(-t):n.take(t-e)),n)},Bn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Bn.prototype.toArray=function(){return this.take(d)},br(Bn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),a=zn[r?"take"+("last"==t?"Right":""):t],i=r||/^find/.test(t);a&&(zn.prototype[t]=function(){var t=this.__wrapped__,l=r?[1]:arguments,u=t instanceof Bn,s=l[0],c=u||Ki(t),f=function(e){var t=a.apply(zn,kt([e],l));return r&&p?t[0]:t};c&&n&&"function"==typeof s&&1!=s.length&&(u=c=!1);var p=this.__chain__,d=!!this.__actions__.length,h=i&&!p,m=u&&!d;if(!i&&c){t=m?t:new Bn(this);var y=e.apply(t,l);return y.__actions__.push({func:hi,args:[f],thisArg:o}),new Hn(y,p)}return h&&m?e.apply(this,l):(y=this.thru(f),h?r?y.value()[0]:y.value():y)})})),bt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Te[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);zn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(Ki(o)?o:[],e)}return this[n]((function(n){return t.apply(Ki(n)?n:[],e)}))}})),br(Bn.prototype,(function(e,t){var n=zn[t];if(n){var r=n.name+"";Re.call(Nn,r)||(Nn[r]=[]),Nn[r].push({name:t,func:n})}})),Nn[zo(o,2).name]=[{name:"wrapper",func:o}],Bn.prototype.clone=function(){var e=new Bn(this.__wrapped__);return e.__actions__=To(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=To(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=To(this.__views__),e},Bn.prototype.reverse=function(){if(this.__filtered__){var e=new Bn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Bn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ki(e),r=t<0,o=n?e.length:0,a=function(e,t,n){for(var r=-1,o=n.length;++r<o;){var a=n[r],i=a.size;switch(a.type){case"drop":e+=i;break;case"dropRight":t-=i;break;case"take":t=vn(t,e+i);break;case"takeRight":e=gn(e,t-i)}}return{start:e,end:t}}(0,o,this.__views__),i=a.start,l=a.end,u=l-i,s=r?l:i-1,c=this.__iteratees__,f=c.length,p=0,d=vn(u,this.__takeCount__);if(!n||!r&&o==u&&d==u)return po(e,this.__actions__);var h=[];e:for(;u--&&p<d;){for(var m=-1,y=e[s+=t];++m<f;){var g=c[m],v=g.iteratee,b=g.type,w=v(y);if(2==b)y=w;else if(!w){if(1==b)continue e;break e}}h[p++]=y}return h},zn.prototype.at=mi,zn.prototype.chain=function(){return di(this)},zn.prototype.commit=function(){return new Hn(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===o&&(this.__values__=dl(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var t,n=this;n instanceof Vn;){var r=Ua(n);r.__index__=0,r.__values__=o,t?a.__wrapped__=r:t=r;var a=r;n=n.__wrapped__}return a.__wrapped__=e,t},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Bn){var t=e;return this.__actions__.length&&(t=new Bn(this)),(t=t.reverse()).__actions__.push({func:hi,args:[ti],thisArg:o}),new Hn(t,this.__chain__)}return this.thru(ti)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return po(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,it&&(zn.prototype[it]=function(){return this}),zn}();at._=sn,(r=function(){return sn}.call(t,n,t,e))===o||(e.exports=r)}.call(this)},8865:function(e,t,n){var r=n(696),o=n(369);function a(e){if(!(this instanceof a))return new a(e);"number"==typeof e&&(e={max:e}),e||(e={}),r.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=e.max||1e3,this.maxAge=e.maxAge||0}e.exports=a,o(a,r.EventEmitter),Object.defineProperty(a.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),a.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},a.prototype.remove=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];return delete this.cache[e],this._unlink(e,t.prev,t.next),t.value}},a.prototype._unlink=function(e,t,n){this.length--,0===this.length?this.head=this.tail=null:this.head===e?(this.head=t,this.cache[this.head].next=null):this.tail===e?(this.tail=n,this.cache[this.tail].prev=null):(this.cache[t].next=n,this.cache[n].prev=t)},a.prototype.peek=function(e){if(this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return t.value}},a.prototype.set=function(e,t){var n;if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){if((n=this.cache[e]).value=t,this.maxAge&&(n.modified=Date.now()),e===this.head)return t;this._unlink(e,n.prev,n.next)}else n={value:t,modified:0,next:null,prev:null},this.maxAge&&(n.modified=Date.now()),this.cache[e]=n,this.length===this.max&&this.evict();return this.length++,n.next=null,n.prev=this.head,this.head&&(this.cache[this.head].next=e),this.head=e,this.tail||(this.tail=e),t},a.prototype._checkAge=function(e,t){return!(this.maxAge&&Date.now()-t.modified>this.maxAge&&(this.remove(e),this.emit("evict",{key:e,value:t.value}),1))},a.prototype.get=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return this.head!==e&&(e===this.tail?(this.tail=t.next,this.cache[this.tail].prev=null):this.cache[t.prev].next=t.next,this.cache[t.next].prev=t.prev,this.cache[this.head].next=e,t.prev=this.head,t.next=null,this.head=e),t.value}},a.prototype.evict=function(){if(this.tail){var e=this.tail,t=this.remove(this.tail);this.emit("evict",{key:e,value:t})}}},5126:function(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},9717:function(e){var t=1e3,n=60*t,r=60*n,o=24*r;function a(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,i){i=i||{};var l,u,s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(a){var i=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*i;case"weeks":case"week":case"w":return 6048e5*i;case"days":case"day":case"d":return i*o;case"hours":case"hour":case"hrs":case"hr":case"h":return i*r;case"minutes":case"minute":case"mins":case"min":case"m":return i*n;case"seconds":case"second":case"secs":case"sec":case"s":return i*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}(e);if("number"===s&&isFinite(e))return i.long?(l=e,(u=Math.abs(l))>=o?a(l,u,o,"day"):u>=r?a(l,u,r,"hour"):u>=n?a(l,u,n,"minute"):u>=t?a(l,u,t,"second"):l+" ms"):function(e){var a=Math.abs(e);return a>=o?Math.round(e/o)+"d":a>=r?Math.round(e/r)+"h":a>=n?Math.round(e/n)+"m":a>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},1464:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,a){for(var i,l,u=o(e),s=1;s<arguments.length;s++){for(var c in i=Object(arguments[s]))n.call(i,c)&&(u[c]=i[c]);if(t){l=t(i);for(var f=0;f<l.length;f++)r.call(i,l[f])&&(u[l[f]]=i[l[f]])}}return u}},6977:function(e,t,n){"use strict";var r=n(669);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,i){if(i!==r){var l=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 l.name="Invariant Violation",l}}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,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},2598:function(e,t,n){e.exports=n(6977)()},669:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},1646:function(e,t,n){"use strict";var r=n(8965),o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,a=n(1231),i=n(2802),l=n(7012),u="function"==typeof Symbol&&Symbol.iterator;function s(e,t){return e&&"object"==typeof e&&null!=e.key?(n=e.key,r={"=":"=0",":":"=2"},"$"+(""+n).replace(/[=:]/g,(function(e){return r[e]}))):t.toString(36);var n,r}function c(e,t,n,r){var a,l=typeof e;if("undefined"!==l&&"boolean"!==l||(e=null),null===e||"string"===l||"number"===l||"object"===l&&e.$$typeof===o)return n(r,e,""===t?"."+s(e,0):t),1;var f=0,p=""===t?".":t+":";if(Array.isArray(e))for(var d=0;d<e.length;d++)f+=c(a=e[d],p+s(a,d),n,r);else{var h=function(e){var t=e&&(u&&e[u]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(h)for(var m,y=h.call(e),g=0;!(m=y.next()).done;)f+=c(a=m.value,p+s(a,g++),n,r);else if("object"===l){var v=""+e;i(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===v?"object with keys {"+Object.keys(e).join(", ")+"}":v,"")}}return f}var f=/\/+/g;function p(e){return(""+e).replace(f,"$&/")}var d,h,m=y,y=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)};function g(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function v(e,t,n){var o,i,l=e.result,u=e.keyPrefix,s=e.func,c=e.context,f=s.call(c,t,e.count++);Array.isArray(f)?b(f,l,n,a.thatReturnsArgument):null!=f&&(r.isValidElement(f)&&(o=f,i=u+(!f.key||t&&t.key===f.key?"":p(f.key)+"/")+n,f=r.cloneElement(o,{key:i},void 0!==o.props?o.props.children:void 0)),l.push(f))}function b(e,t,n,r,o){var a="";null!=n&&(a=p(n)+"/");var i=g.getPooled(t,a,r,o);!function(e,t,n){null==e||c(e,"",t,n)}(e,v,i),g.release(i)}g.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},d=function(e,t,n,r){var o=this;if(o.instancePool.length){var a=o.instancePool.pop();return o.call(a,e,t,n,r),a}return new o(e,t,n,r)},(h=g).instancePool=[],h.getPooled=d||m,h.poolSize||(h.poolSize=10),h.release=function(e){var t=this;i(e instanceof t,"Trying to release an instance into a pool of a different type."),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return l(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(r.isValidElement(e))return l(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;i(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var n in e)b(e[n],t,n,a.thatReturnsArgument);return t}},6539:function(e,t,n){"use strict";var r=n(8965),o=n(1464),a=n(9076);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(i(227));var l=new Set,u={};function s(e,t){c(e,t),c(e+"Capture",t)}function c(e,t){for(u[e]=t,e=0;e<t.length;e++)l.add(t[e])}var f=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d=Object.prototype.hasOwnProperty,h={},m={};function y(e,t,n,r,o,a,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){g[e]=new y(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];g[t]=new y(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){g[e]=new y(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){g[e]=new y(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){g[e]=new y(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){g[e]=new y(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){g[e]=new y(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){g[e]=new y(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){g[e]=new y(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function w(e,t,n,r){var o=g.hasOwnProperty(t)?g[t]:null;(null!==o?0===o.type:!r&&2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1]))||(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!d.call(m,e)||!d.call(h,e)&&(p.test(e)?m[e]=!0:(h[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(v,b);g[t]=new y(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(v,b);g[t]=new y(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(v,b);g[t]=new y(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){g[e]=new y(e,1,!1,e.toLowerCase(),null,!1,!1)})),g.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){g[e]=new y(e,1,!1,e.toLowerCase(),null,!0,!0)}));var E=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,_=60103,O=60106,S=60107,x=60108,k=60114,C=60109,T=60110,P=60112,N=60113,I=60120,j=60115,R=60116,A=60121,D=60128,M=60129,L=60130,F=60131;if("function"==typeof Symbol&&Symbol.for){var z=Symbol.for;_=z("react.element"),O=z("react.portal"),S=z("react.fragment"),x=z("react.strict_mode"),k=z("react.profiler"),C=z("react.provider"),T=z("react.context"),P=z("react.forward_ref"),N=z("react.suspense"),I=z("react.suspense_list"),j=z("react.memo"),R=z("react.lazy"),A=z("react.block"),z("react.scope"),D=z("react.opaque.id"),M=z("react.debug_trace_mode"),L=z("react.offscreen"),F=z("react.legacy_hidden")}var U,V="function"==typeof Symbol&&Symbol.iterator;function H(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=V&&e[V]||e["@@iterator"])?e:null}function B(e){if(void 0===U)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);U=t&&t[1]||""}return"\n"+U+e}var W=!1;function K(e,t){if(!e||W)return"";W=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(e){if(e&&r&&"string"==typeof e.stack){for(var o=e.stack.split("\n"),a=r.stack.split("\n"),i=o.length-1,l=a.length-1;1<=i&&0<=l&&o[i]!==a[l];)l--;for(;1<=i&&0<=l;i--,l--)if(o[i]!==a[l]){if(1!==i||1!==l)do{if(i--,0>--l||o[i]!==a[l])return"\n"+o[i].replace(" at new "," at ")}while(1<=i&&0<=l);break}}}finally{W=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?B(e):""}function q(e){switch(e.tag){case 5:return B(e.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return K(e.type,!1);case 11:return K(e.type.render,!1);case 22:return K(e.type._render,!1);case 1:return K(e.type,!0);default:return""}}function Y(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case S:return"Fragment";case O:return"Portal";case k:return"Profiler";case x:return"StrictMode";case N:return"Suspense";case I:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case C:return(e._context.displayName||"Context")+".Provider";case P:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case j:return Y(e.type);case A:return Y(e._render);case R:t=e._payload,e=e._init;try{return Y(e(t))}catch(e){}}return null}function G(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function X(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Q(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function J(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Z(e,t){var n=t.checked;return o({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function ee(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=G(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&w(e,"checked",t,!1)}function ne(e,t){te(e,t);var n=G(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?oe(e,t.type,n):t.hasOwnProperty("defaultValue")&&oe(e,t.type,G(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function re(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function oe(e,t,n){"number"===t&&J(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}function ae(e,t){return e=o({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function ie(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+G(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function le(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(i(91));return o({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ue(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(i(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(i(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:G(n)}}function se(e,t){var n=G(t.value),r=G(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ce(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var fe="http://www.w3.org/1999/xhtml";function pe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function de(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?pe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var he,me,ye=(me=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((he=he||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=he.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return me(e,t)}))}:me);function ge(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var ve={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},be=["Webkit","ms","Moz","O"];function we(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ve.hasOwnProperty(e)&&ve[e]?(""+t).trim():t+"px"}function Ee(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=we(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(ve).forEach((function(e){be.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ve[t]=ve[e]}))}));var _e=o({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Oe(e,t){if(t){if(_e[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(i(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(i(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(i(62))}}function Se(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function xe(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ke=null,Ce=null,Te=null;function Pe(e){if(e=no(e)){if("function"!=typeof ke)throw Error(i(280));var t=e.stateNode;t&&(t=oo(t),ke(e.stateNode,e.type,t))}}function Ne(e){Ce?Te?Te.push(e):Te=[e]:Ce=e}function Ie(){if(Ce){var e=Ce,t=Te;if(Te=Ce=null,Pe(e),t)for(e=0;e<t.length;e++)Pe(t[e])}}function je(e,t){return e(t)}function Re(e,t,n,r,o){return e(t,n,r,o)}function Ae(){}var De=je,Me=!1,Le=!1;function Fe(){null===Ce&&null===Te||(Ae(),Ie())}function ze(e,t){var n=e.stateNode;if(null===n)return null;var r=oo(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(i(231,t,typeof n));return n}var Ue=!1;if(f)try{var Ve={};Object.defineProperty(Ve,"passive",{get:function(){Ue=!0}}),window.addEventListener("test",Ve,Ve),window.removeEventListener("test",Ve,Ve)}catch(me){Ue=!1}function He(e,t,n,r,o,a,i,l,u){var s=Array.prototype.slice.call(arguments,3);try{t.apply(n,s)}catch(e){this.onError(e)}}var Be=!1,We=null,Ke=!1,qe=null,Ye={onError:function(e){Be=!0,We=e}};function Ge(e,t,n,r,o,a,i,l,u){Be=!1,We=null,He.apply(Ye,arguments)}function $e(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function Xe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function Qe(e){if($e(e)!==e)throw Error(i(188))}function Je(e){if(e=function(e){var t=e.alternate;if(!t){if(null===(t=$e(e)))throw Error(i(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var a=o.alternate;if(null===a){if(null!==(r=o.return)){n=r;continue}break}if(o.child===a.child){for(a=o.child;a;){if(a===n)return Qe(o),e;if(a===r)return Qe(o),t;a=a.sibling}throw Error(i(188))}if(n.return!==r.return)n=o,r=a;else{for(var l=!1,u=o.child;u;){if(u===n){l=!0,n=o,r=a;break}if(u===r){l=!0,r=o,n=a;break}u=u.sibling}if(!l){for(u=a.child;u;){if(u===n){l=!0,n=a,r=o;break}if(u===r){l=!0,r=a,n=o;break}u=u.sibling}if(!l)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(3!==n.tag)throw Error(i(188));return n.stateNode.current===n?e:t}(e),!e)return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function Ze(e,t){for(var n=e.alternate;null!==t;){if(t===e||t===n)return!0;t=t.return}return!1}var et,tt,nt,rt,ot=!1,at=[],it=null,lt=null,ut=null,st=new Map,ct=new Map,ft=[],pt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function dt(e,t,n,r,o){return{blockedOn:e,domEventName:t,eventSystemFlags:16|n,nativeEvent:o,targetContainers:[r]}}function ht(e,t){switch(e){case"focusin":case"focusout":it=null;break;case"dragenter":case"dragleave":lt=null;break;case"mouseover":case"mouseout":ut=null;break;case"pointerover":case"pointerout":st.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ct.delete(t.pointerId)}}function mt(e,t,n,r,o,a){return null===e||e.nativeEvent!==a?(e=dt(t,n,r,o,a),null!==t&&null!==(t=no(t))&&tt(t),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==o&&-1===t.indexOf(o)&&t.push(o),e)}function yt(e){var t=to(e.target);if(null!==t){var n=$e(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=Xe(n)))return e.blockedOn=t,void rt(e.lanePriority,(function(){a.unstable_runWithPriority(e.priority,(function(){nt(n)}))}))}else if(3===t&&n.stateNode.hydrate)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function gt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=no(n))&&tt(t),e.blockedOn=n,!1;t.shift()}return!0}function vt(e,t,n){gt(e)&&n.delete(t)}function bt(){for(ot=!1;0<at.length;){var e=at[0];if(null!==e.blockedOn){null!==(e=no(e.blockedOn))&&et(e);break}for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n){e.blockedOn=n;break}t.shift()}null===e.blockedOn&&at.shift()}null!==it&&gt(it)&&(it=null),null!==lt&&gt(lt)&&(lt=null),null!==ut&&gt(ut)&&(ut=null),st.forEach(vt),ct.forEach(vt)}function wt(e,t){e.blockedOn===t&&(e.blockedOn=null,ot||(ot=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,bt)))}function Et(e){function t(t){return wt(t,e)}if(0<at.length){wt(at[0],e);for(var n=1;n<at.length;n++){var r=at[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==it&&wt(it,e),null!==lt&&wt(lt,e),null!==ut&&wt(ut,e),st.forEach(t),ct.forEach(t),n=0;n<ft.length;n++)(r=ft[n]).blockedOn===e&&(r.blockedOn=null);for(;0<ft.length&&null===(n=ft[0]).blockedOn;)yt(n),null===n.blockedOn&&ft.shift()}function _t(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ot={animationend:_t("Animation","AnimationEnd"),animationiteration:_t("Animation","AnimationIteration"),animationstart:_t("Animation","AnimationStart"),transitionend:_t("Transition","TransitionEnd")},St={},xt={};function kt(e){if(St[e])return St[e];if(!Ot[e])return e;var t,n=Ot[e];for(t in n)if(n.hasOwnProperty(t)&&t in xt)return St[e]=n[t];return e}f&&(xt=document.createElement("div").style,"AnimationEvent"in window||(delete Ot.animationend.animation,delete Ot.animationiteration.animation,delete Ot.animationstart.animation),"TransitionEvent"in window||delete Ot.transitionend.transition);var Ct=kt("animationend"),Tt=kt("animationiteration"),Pt=kt("animationstart"),Nt=kt("transitionend"),It=new Map,jt=new Map,Rt=["abort","abort",Ct,"animationEnd",Tt,"animationIteration",Pt,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Nt,"transitionEnd","waiting","waiting"];function At(e,t){for(var n=0;n<e.length;n+=2){var r=e[n],o=e[n+1];o="on"+(o[0].toUpperCase()+o.slice(1)),jt.set(r,t),It.set(r,o),s(o,[r])}}(0,a.unstable_now)();var Dt=8;function Mt(e){if(0!=(1&e))return Dt=15,1;if(0!=(2&e))return Dt=14,2;if(0!=(4&e))return Dt=13,4;var t=24&e;return 0!==t?(Dt=12,t):0!=(32&e)?(Dt=11,32):0!=(t=192&e)?(Dt=10,t):0!=(256&e)?(Dt=9,256):0!=(t=3584&e)?(Dt=8,t):0!=(4096&e)?(Dt=7,4096):0!=(t=4186112&e)?(Dt=6,t):0!=(t=62914560&e)?(Dt=5,t):67108864&e?(Dt=4,67108864):0!=(134217728&e)?(Dt=3,134217728):0!=(t=805306368&e)?(Dt=2,t):0!=(1073741824&e)?(Dt=1,1073741824):(Dt=8,e)}function Lt(e,t){var n=e.pendingLanes;if(0===n)return Dt=0;var r=0,o=0,a=e.expiredLanes,i=e.suspendedLanes,l=e.pingedLanes;if(0!==a)r=a,o=Dt=15;else if(0!=(a=134217727&n)){var u=a&~i;0!==u?(r=Mt(u),o=Dt):0!=(l&=a)&&(r=Mt(l),o=Dt)}else 0!=(a=n&~i)?(r=Mt(a),o=Dt):0!==l&&(r=Mt(l),o=Dt);if(0===r)return 0;if(r=n&((0>(r=31-Bt(r))?0:1<<r)<<1)-1,0!==t&&t!==r&&0==(t&i)){if(Mt(t),o<=Dt)return t;Dt=o}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)o=1<<(n=31-Bt(t)),r|=e[n],t&=~o;return r}function Ft(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function zt(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=Ut(24&~t))?zt(10,t):e;case 10:return 0===(e=Ut(192&~t))?zt(8,t):e;case 8:return 0===(e=Ut(3584&~t))&&0===(e=Ut(4186112&~t))&&(e=512),e;case 2:return 0===(t=Ut(805306368&~t))&&(t=268435456),t}throw Error(i(358,e))}function Ut(e){return e&-e}function Vt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ht(e,t,n){e.pendingLanes|=t;var r=t-1;e.suspendedLanes&=r,e.pingedLanes&=r,(e=e.eventTimes)[t=31-Bt(t)]=n}var Bt=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Wt(e)/Kt|0)|0},Wt=Math.log,Kt=Math.LN2,qt=a.unstable_UserBlockingPriority,Yt=a.unstable_runWithPriority,Gt=!0;function $t(e,t,n,r){Me||Ae();var o=Qt,a=Me;Me=!0;try{Re(o,e,t,n,r)}finally{(Me=a)||Fe()}}function Xt(e,t,n,r){Yt(qt,Qt.bind(null,e,t,n,r))}function Qt(e,t,n,r){var o;if(Gt)if((o=0==(4&t))&&0<at.length&&-1<pt.indexOf(e))e=dt(null,e,t,n,r),at.push(e);else{var a=Jt(e,t,n,r);if(null===a)o&&ht(e,r);else{if(o){if(-1<pt.indexOf(e))return e=dt(a,e,t,n,r),void at.push(e);if(function(e,t,n,r,o){switch(t){case"focusin":return it=mt(it,e,t,n,r,o),!0;case"dragenter":return lt=mt(lt,e,t,n,r,o),!0;case"mouseover":return ut=mt(ut,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return st.set(a,mt(st.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,ct.set(a,mt(ct.get(a)||null,e,t,n,r,o)),!0}return!1}(a,e,t,n,r))return;ht(e,r)}Ar(e,t,r,null,n)}}}function Jt(e,t,n,r){var o=xe(r);if(null!==(o=to(o))){var a=$e(o);if(null===a)o=null;else{var i=a.tag;if(13===i){if(null!==(o=Xe(a)))return o;o=null}else if(3===i){if(a.stateNode.hydrate)return 3===a.tag?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null)}}return Ar(e,t,r,o,n),null}var Zt=null,en=null,tn=null;function nn(){if(tn)return tn;var e,t,n=en,r=n.length,o="value"in Zt?Zt.value:Zt.textContent,a=o.length;for(e=0;e<r&&n[e]===o[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===o[a-t];t++);return tn=o.slice(e,1<t?1-t:void 0)}function rn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function on(){return!0}function an(){return!1}function ln(e){function t(t,n,r,o,a){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(o):o[i]);return this.isDefaultPrevented=(null!=o.defaultPrevented?o.defaultPrevented:!1===o.returnValue)?on:an,this.isPropagationStopped=an,this}return o(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=on)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=on)},persist:function(){},isPersistent:on}),t}var un,sn,cn,fn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pn=ln(fn),dn=o({},fn,{view:0,detail:0}),hn=ln(dn),mn=o({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cn&&(cn&&"mousemove"===e.type?(un=e.screenX-cn.screenX,sn=e.screenY-cn.screenY):sn=un=0,cn=e),un)},movementY:function(e){return"movementY"in e?e.movementY:sn}}),yn=ln(mn),gn=ln(o({},mn,{dataTransfer:0})),vn=ln(o({},dn,{relatedTarget:0})),bn=ln(o({},fn,{animationName:0,elapsedTime:0,pseudoElement:0})),wn=o({},fn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),En=ln(wn),_n=ln(o({},fn,{data:0})),On={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},xn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=xn[e])&&!!t[e]}function Cn(){return kn}var Tn=o({},dn,{key:function(e){if(e.key){var t=On[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=rn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Sn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cn,charCode:function(e){return"keypress"===e.type?rn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?rn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Pn=ln(Tn),Nn=ln(o({},mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=ln(o({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cn})),jn=ln(o({},fn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=o({},mn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),An=ln(Rn),Dn=[9,13,27,32],Mn=f&&"CompositionEvent"in window,Ln=null;f&&"documentMode"in document&&(Ln=document.documentMode);var Fn=f&&"TextEvent"in window&&!Ln,zn=f&&(!Mn||Ln&&8<Ln&&11>=Ln),Un=String.fromCharCode(32),Vn=!1;function Hn(e,t){switch(e){case"keyup":return-1!==Dn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Wn=!1,Kn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function qn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Kn[e.type]:"textarea"===t}function Yn(e,t,n,r){Ne(r),0<(t=Mr(t,"onChange")).length&&(n=new pn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Gn=null,$n=null;function Xn(e){Tr(e,0)}function Qn(e){if(Q(ro(e)))return e}function Jn(e,t){if("change"===e)return t}var Zn=!1;if(f){var er;if(f){var tr="oninput"in document;if(!tr){var nr=document.createElement("div");nr.setAttribute("oninput","return;"),tr="function"==typeof nr.oninput}er=tr}else er=!1;Zn=er&&(!document.documentMode||9<document.documentMode)}function rr(){Gn&&(Gn.detachEvent("onpropertychange",or),$n=Gn=null)}function or(e){if("value"===e.propertyName&&Qn($n)){var t=[];if(Yn(t,$n,e,xe(e)),e=Xn,Me)e(t);else{Me=!0;try{je(e,t)}finally{Me=!1,Fe()}}}}function ar(e,t,n){"focusin"===e?(rr(),$n=n,(Gn=t).attachEvent("onpropertychange",or)):"focusout"===e&&rr()}function ir(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn($n)}function lr(e,t){if("click"===e)return Qn(t)}function ur(e,t){if("input"===e||"change"===e)return Qn(t)}var sr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},cr=Object.prototype.hasOwnProperty;function fr(e,t){if(sr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!cr.call(t,n[r])||!sr(e[n[r]],t[n[r]]))return!1;return!0}function pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dr(e,t){var n,r=pr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=pr(r)}}function hr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function mr(){for(var e=window,t=J();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=J((e=t.contentWindow).document)}return t}function yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var gr=f&&"documentMode"in document&&11>=document.documentMode,vr=null,br=null,wr=null,Er=!1;function _r(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;Er||null==vr||vr!==J(r)||(r="selectionStart"in(r=vr)&&yr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},wr&&fr(wr,r)||(wr=r,0<(r=Mr(br,"onSelect")).length&&(t=new pn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=vr)))}At("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),At("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),At(Rt,2);for(var Or="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Sr=0;Sr<Or.length;Sr++)jt.set(Or[Sr],0);c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),s("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),s("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),s("onBeforeInput",["compositionend","keypress","textInput","paste"]),s("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),s("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),kr=new Set("cancel close invalid load scroll toggle".split(" ").concat(xr));function Cr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,o,a,l,u,s){if(Ge.apply(this,arguments),Be){if(!Be)throw Error(i(198));var c=We;Be=!1,We=null,Ke||(Ke=!0,qe=c)}}(r,t,void 0,e),e.currentTarget=null}function Tr(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],u=l.instance,s=l.currentTarget;if(l=l.listener,u!==a&&o.isPropagationStopped())break e;Cr(o,l,s),a=u}else for(i=0;i<r.length;i++){if(u=(l=r[i]).instance,s=l.currentTarget,l=l.listener,u!==a&&o.isPropagationStopped())break e;Cr(o,l,s),a=u}}}if(Ke)throw e=qe,Ke=!1,qe=null,e}function Pr(e,t){var n=ao(t),r=e+"__bubble";n.has(r)||(Rr(t,e,2,!1),n.add(r))}var Nr="_reactListening"+Math.random().toString(36).slice(2);function Ir(e){e[Nr]||(e[Nr]=!0,l.forEach((function(t){kr.has(t)||jr(t,!1,e,null),jr(t,!0,e,null)})))}function jr(e,t,n,r){var o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=n;if("selectionchange"===e&&9!==n.nodeType&&(a=n.ownerDocument),null!==r&&!t&&kr.has(e)){if("scroll"!==e)return;o|=2,a=r}var i=ao(a),l=e+"__"+(t?"capture":"bubble");i.has(l)||(t&&(o|=4),Rr(a,e,o,t),i.add(l))}function Rr(e,t,n,r){var o=jt.get(t);switch(void 0===o?2:o){case 0:o=$t;break;case 1:o=Xt;break;default:o=Qt}n=o.bind(null,t,n,e),o=void 0,!Ue||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(o=!0),r?void 0!==o?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):void 0!==o?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Ar(e,t,n,r,o){var a=r;if(0==(1&t)&&0==(2&t)&&null!==r)e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var l=r.stateNode.containerInfo;if(l===o||8===l.nodeType&&l.parentNode===o)break;if(4===i)for(i=r.return;null!==i;){var u=i.tag;if((3===u||4===u)&&((u=i.stateNode.containerInfo)===o||8===u.nodeType&&u.parentNode===o))return;i=i.return}for(;null!==l;){if(null===(i=to(l)))return;if(5===(u=i.tag)||6===u){r=a=i;continue e}l=l.parentNode}}r=r.return}!function(e,t,n){if(Le)return e();Le=!0;try{De(e,t,n)}finally{Le=!1,Fe()}}((function(){var r=a,o=xe(n),i=[];e:{var l=It.get(e);if(void 0!==l){var u=pn,s=e;switch(e){case"keypress":if(0===rn(n))break e;case"keydown":case"keyup":u=Pn;break;case"focusin":s="focus",u=vn;break;case"focusout":s="blur",u=vn;break;case"beforeblur":case"afterblur":u=vn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":u=yn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":u=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":u=In;break;case Ct:case Tt:case Pt:u=bn;break;case Nt:u=jn;break;case"scroll":u=hn;break;case"wheel":u=An;break;case"copy":case"cut":case"paste":u=En;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":u=Nn}var c=0!=(4&t),f=!c&&"scroll"===e,p=c?null!==l?l+"Capture":null:l;c=[];for(var d,h=r;null!==h;){var m=(d=h).stateNode;if(5===d.tag&&null!==m&&(d=m,null!==p&&null!=(m=ze(h,p))&&c.push(Dr(h,m,d))),f)break;h=h.return}0<c.length&&(l=new u(l,s,null,n,o),i.push({event:l,listeners:c}))}}if(0==(7&t)){if(u="mouseout"===e||"pointerout"===e,(!(l="mouseover"===e||"pointerover"===e)||0!=(16&t)||!(s=n.relatedTarget||n.fromElement)||!to(s)&&!s[Zr])&&(u||l)&&(l=o.window===o?o:(l=o.ownerDocument)?l.defaultView||l.parentWindow:window,u?(u=r,null!==(s=(s=n.relatedTarget||n.toElement)?to(s):null)&&(s!==(f=$e(s))||5!==s.tag&&6!==s.tag)&&(s=null)):(u=null,s=r),u!==s)){if(c=yn,m="onMouseLeave",p="onMouseEnter",h="mouse","pointerout"!==e&&"pointerover"!==e||(c=Nn,m="onPointerLeave",p="onPointerEnter",h="pointer"),f=null==u?l:ro(u),d=null==s?l:ro(s),(l=new c(m,h+"leave",u,n,o)).target=f,l.relatedTarget=d,m=null,to(o)===r&&((c=new c(p,h+"enter",s,n,o)).target=d,c.relatedTarget=f,m=c),f=m,u&&s)e:{for(p=s,h=0,d=c=u;d;d=Lr(d))h++;for(d=0,m=p;m;m=Lr(m))d++;for(;0<h-d;)c=Lr(c),h--;for(;0<d-h;)p=Lr(p),d--;for(;h--;){if(c===p||null!==p&&c===p.alternate)break e;c=Lr(c),p=Lr(p)}c=null}else c=null;null!==u&&Fr(i,l,u,c,!1),null!==s&&null!==f&&Fr(i,f,s,c,!0)}if("select"===(u=(l=r?ro(r):window).nodeName&&l.nodeName.toLowerCase())||"input"===u&&"file"===l.type)var y=Jn;else if(qn(l))if(Zn)y=ur;else{y=ir;var g=ar}else(u=l.nodeName)&&"input"===u.toLowerCase()&&("checkbox"===l.type||"radio"===l.type)&&(y=lr);switch(y&&(y=y(e,r))?Yn(i,y,n,o):(g&&g(e,l,r),"focusout"===e&&(g=l._wrapperState)&&g.controlled&&"number"===l.type&&oe(l,"number",l.value)),g=r?ro(r):window,e){case"focusin":(qn(g)||"true"===g.contentEditable)&&(vr=g,br=r,wr=null);break;case"focusout":wr=br=vr=null;break;case"mousedown":Er=!0;break;case"contextmenu":case"mouseup":case"dragend":Er=!1,_r(i,n,o);break;case"selectionchange":if(gr)break;case"keydown":case"keyup":_r(i,n,o)}var v;if(Mn)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Wn?Hn(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(zn&&"ko"!==n.locale&&(Wn||"onCompositionStart"!==b?"onCompositionEnd"===b&&Wn&&(v=nn()):(en="value"in(Zt=o)?Zt.value:Zt.textContent,Wn=!0)),0<(g=Mr(r,b)).length&&(b=new _n(b,e,null,n,o),i.push({event:b,listeners:g}),(v||null!==(v=Bn(n)))&&(b.data=v))),(v=Fn?function(e,t){switch(e){case"compositionend":return Bn(t);case"keypress":return 32!==t.which?null:(Vn=!0,Un);case"textInput":return(e=t.data)===Un&&Vn?null:e;default:return null}}(e,n):function(e,t){if(Wn)return"compositionend"===e||!Mn&&Hn(e,t)?(e=nn(),tn=en=Zt=null,Wn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return zn&&"ko"!==t.locale?null:t.data}}(e,n))&&0<(r=Mr(r,"onBeforeInput")).length&&(o=new _n("onBeforeInput","beforeinput",null,n,o),i.push({event:o,listeners:r}),o.data=v)}Tr(i,t)}))}function Dr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Mr(e,t){for(var n=t+"Capture",r=[];null!==e;){var o=e,a=o.stateNode;5===o.tag&&null!==a&&(o=a,null!=(a=ze(e,n))&&r.unshift(Dr(e,a,o)),null!=(a=ze(e,t))&&r.push(Dr(e,a,o))),e=e.return}return r}function Lr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Fr(e,t,n,r,o){for(var a=t._reactName,i=[];null!==n&&n!==r;){var l=n,u=l.alternate,s=l.stateNode;if(null!==u&&u===r)break;5===l.tag&&null!==s&&(l=s,o?null!=(u=ze(n,a))&&i.unshift(Dr(n,u,l)):o||null!=(u=ze(n,a))&&i.push(Dr(n,u,l))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}function zr(){}var Ur=null,Vr=null;function Hr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Br(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Wr="function"==typeof setTimeout?setTimeout:void 0,Kr="function"==typeof clearTimeout?clearTimeout:void 0;function qr(e){(1===e.nodeType||9===e.nodeType&&null!=(e=e.body))&&(e.textContent="")}function Yr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Gr(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var $r=0,Xr=Math.random().toString(36).slice(2),Qr="__reactFiber$"+Xr,Jr="__reactProps$"+Xr,Zr="__reactContainer$"+Xr,eo="__reactEvents$"+Xr;function to(e){var t=e[Qr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Zr]||n[Qr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=Gr(e);null!==e;){if(n=e[Qr])return n;e=Gr(e)}return t}n=(e=n).parentNode}return null}function no(e){return!(e=e[Qr]||e[Zr])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function ro(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(i(33))}function oo(e){return e[Jr]||null}function ao(e){var t=e[eo];return void 0===t&&(t=e[eo]=new Set),t}var io=[],lo=-1;function uo(e){return{current:e}}function so(e){0>lo||(e.current=io[lo],io[lo]=null,lo--)}function co(e,t){lo++,io[lo]=e.current,e.current=t}var fo={},po=uo(fo),ho=uo(!1),mo=fo;function yo(e,t){var n=e.type.contextTypes;if(!n)return fo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in n)a[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function go(e){return null!=e.childContextTypes}function vo(){so(ho),so(po)}function bo(e,t,n){if(po.current!==fo)throw Error(i(168));co(po,t),co(ho,n)}function wo(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var a in r=r.getChildContext())if(!(a in e))throw Error(i(108,Y(t)||"Unknown",a));return o({},n,r)}function Eo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||fo,mo=po.current,co(po,e),co(ho,ho.current),!0}function _o(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=wo(e,t,mo),r.__reactInternalMemoizedMergedChildContext=e,so(ho),so(po),co(po,e)):so(ho),co(ho,n)}var Oo=null,So=null,xo=a.unstable_runWithPriority,ko=a.unstable_scheduleCallback,Co=a.unstable_cancelCallback,To=a.unstable_shouldYield,Po=a.unstable_requestPaint,No=a.unstable_now,Io=a.unstable_getCurrentPriorityLevel,jo=a.unstable_ImmediatePriority,Ro=a.unstable_UserBlockingPriority,Ao=a.unstable_NormalPriority,Do=a.unstable_LowPriority,Mo=a.unstable_IdlePriority,Lo={},Fo=void 0!==Po?Po:function(){},zo=null,Uo=null,Vo=!1,Ho=No(),Bo=1e4>Ho?No:function(){return No()-Ho};function Wo(){switch(Io()){case jo:return 99;case Ro:return 98;case Ao:return 97;case Do:return 96;case Mo:return 95;default:throw Error(i(332))}}function Ko(e){switch(e){case 99:return jo;case 98:return Ro;case 97:return Ao;case 96:return Do;case 95:return Mo;default:throw Error(i(332))}}function qo(e,t){return e=Ko(e),xo(e,t)}function Yo(e,t,n){return e=Ko(e),ko(e,t,n)}function Go(){if(null!==Uo){var e=Uo;Uo=null,Co(e)}$o()}function $o(){if(!Vo&&null!==zo){Vo=!0;var e=0;try{var t=zo;qo(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),zo=null}catch(t){throw null!==zo&&(zo=zo.slice(e+1)),ko(jo,Go),t}finally{Vo=!1}}}var Xo=E.ReactCurrentBatchConfig;function Qo(e,t){if(e&&e.defaultProps){for(var n in t=o({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var Jo=uo(null),Zo=null,ea=null,ta=null;function na(){ta=ea=Zo=null}function ra(e){var t=Jo.current;so(Jo),e.type._context._currentValue=t}function oa(e,t){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)===t){if(null===n||(n.childLanes&t)===t)break;n.childLanes|=t}else e.childLanes|=t,null!==n&&(n.childLanes|=t);e=e.return}}function aa(e,t){Zo=e,ta=ea=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Mi=!0),e.firstContext=null)}function ia(e,t){if(ta!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(ta=e,t=1073741823),t={context:e,observedBits:t,next:null},null===ea){if(null===Zo)throw Error(i(308));ea=t,Zo.dependencies={lanes:0,firstContext:t,responders:null}}else ea=ea.next=t;return e._currentValue}var la=!1;function ua(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function sa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ca(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function fa(e,t){if(null!==(e=e.updateQueue)){var n=(e=e.shared).pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}}function pa(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var o=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?o=a=i:a=a.next=i,n=n.next}while(null!==n);null===a?o=a=t:a=a.next=t}else o=a=t;return n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function da(e,t,n,r){var a=e.updateQueue;la=!1;var i=a.firstBaseUpdate,l=a.lastBaseUpdate,u=a.shared.pending;if(null!==u){a.shared.pending=null;var s=u,c=s.next;s.next=null,null===l?i=c:l.next=c,l=s;var f=e.alternate;if(null!==f){var p=(f=f.updateQueue).lastBaseUpdate;p!==l&&(null===p?f.firstBaseUpdate=c:p.next=c,f.lastBaseUpdate=s)}}if(null!==i){for(p=a.baseState,l=0,f=c=s=null;;){u=i.lane;var d=i.eventTime;if((r&u)===u){null!==f&&(f=f.next={eventTime:d,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var h=e,m=i;switch(u=t,d=n,m.tag){case 1:if("function"==typeof(h=m.payload)){p=h.call(d,p,u);break e}p=h;break e;case 3:h.flags=-4097&h.flags|64;case 0:if(null==(u="function"==typeof(h=m.payload)?h.call(d,p,u):h))break e;p=o({},p,u);break e;case 2:la=!0}}null!==i.callback&&(e.flags|=32,null===(u=a.effects)?a.effects=[i]:u.push(i))}else d={eventTime:d,lane:u,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===f?(c=f=d,s=p):f=f.next=d,l|=u;if(null===(i=i.next)){if(null===(u=a.shared.pending))break;i=u.next,u.next=null,a.lastBaseUpdate=u,a.shared.pending=null}}null===f&&(s=p),a.baseState=s,a.firstBaseUpdate=c,a.lastBaseUpdate=f,Fl|=l,e.lanes=l,e.memoizedState=p}}function ha(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(null!==o){if(r.callback=null,r=n,"function"!=typeof o)throw Error(i(191,o));o.call(r)}}}var ma=(new r.Component).refs;function ya(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:o({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var ga={isMounted:function(e){return!!(e=e._reactInternals)&&$e(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=su(),o=cu(e),a=ca(r,o);a.payload=t,null!=n&&(a.callback=n),fa(e,a),fu(e,o,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=su(),o=cu(e),a=ca(r,o);a.tag=1,a.payload=t,null!=n&&(a.callback=n),fa(e,a),fu(e,o,r)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=su(),r=cu(e),o=ca(n,r);o.tag=2,null!=t&&(o.callback=t),fa(e,o),fu(e,r,n)}};function va(e,t,n,r,o,a,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,i):!(t.prototype&&t.prototype.isPureReactComponent&&fr(n,r)&&fr(o,a))}function ba(e,t,n){var r=!1,o=fo,a=t.contextType;return"object"==typeof a&&null!==a?a=ia(a):(o=go(t)?mo:po.current,a=(r=null!=(r=t.contextTypes))?yo(e,o):fo),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ga,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=a),t}function wa(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ga.enqueueReplaceState(t,t.state,null)}function Ea(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=ma,ua(e);var a=t.contextType;"object"==typeof a&&null!==a?o.context=ia(a):(a=go(t)?mo:po.current,o.context=yo(e,a)),da(e,n,o,r),o.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(ya(e,t,a,n),o.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(t=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&ga.enqueueReplaceState(o,o.state,null),da(e,n,o,r),o.state=e.memoizedState),"function"==typeof o.componentDidMount&&(e.flags|=4)}var _a=Array.isArray;function Oa(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(i(309));var r=n.stateNode}if(!r)throw Error(i(147,e));var o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=r.refs;t===ma&&(t=r.refs={}),null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!=typeof e)throw Error(i(284));if(!n._owner)throw Error(i(290,e))}return e}function Sa(e,t){if("textarea"!==e.type)throw Error(i(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function xa(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.flags=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Bu(e,t)).index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags=2,n):r:(t.flags=2,n):n}function l(t){return e&&null===t.alternate&&(t.flags=2),t}function u(e,t,n,r){return null===t||6!==t.tag?((t=Yu(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function s(e,t,n,r){return null!==t&&t.elementType===n.type?((r=o(t,n.props)).ref=Oa(e,t,n),r.return=e,r):((r=Wu(n.type,n.key,n.props,null,e.mode,r)).ref=Oa(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Gu(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function f(e,t,n,r,a){return null===t||7!==t.tag?((t=Ku(n,e.mode,r,a)).return=e,t):((t=o(t,n)).return=e,t)}function p(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=Yu(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case _:return(n=Wu(t.type,t.key,t.props,null,e.mode,n)).ref=Oa(e,null,t),n.return=e,n;case O:return(t=Gu(t,e.mode,n)).return=e,t}if(_a(t)||H(t))return(t=Ku(t,e.mode,n,null)).return=e,t;Sa(e,t)}return null}function d(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==o?null:u(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case _:return n.key===o?n.type===S?f(e,t,n.props.children,r,o):s(e,t,n,r):null;case O:return n.key===o?c(e,t,n,r):null}if(_a(n)||H(n))return null!==o?null:f(e,t,n,r,null);Sa(e,n)}return null}function h(e,t,n,r,o){if("string"==typeof r||"number"==typeof r)return u(t,e=e.get(n)||null,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case _:return e=e.get(null===r.key?n:r.key)||null,r.type===S?f(t,e,r.props.children,o,r.key):s(t,e,r,o);case O:return c(t,e=e.get(null===r.key?n:r.key)||null,r,o)}if(_a(r)||H(r))return f(t,e=e.get(n)||null,r,o,null);Sa(t,r)}return null}function m(o,i,l,u){for(var s=null,c=null,f=i,m=i=0,y=null;null!==f&&m<l.length;m++){f.index>m?(y=f,f=null):y=f.sibling;var g=d(o,f,l[m],u);if(null===g){null===f&&(f=y);break}e&&f&&null===g.alternate&&t(o,f),i=a(g,i,m),null===c?s=g:c.sibling=g,c=g,f=y}if(m===l.length)return n(o,f),s;if(null===f){for(;m<l.length;m++)null!==(f=p(o,l[m],u))&&(i=a(f,i,m),null===c?s=f:c.sibling=f,c=f);return s}for(f=r(o,f);m<l.length;m++)null!==(y=h(f,o,m,l[m],u))&&(e&&null!==y.alternate&&f.delete(null===y.key?m:y.key),i=a(y,i,m),null===c?s=y:c.sibling=y,c=y);return e&&f.forEach((function(e){return t(o,e)})),s}function y(o,l,u,s){var c=H(u);if("function"!=typeof c)throw Error(i(150));if(null==(u=c.call(u)))throw Error(i(151));for(var f=c=null,m=l,y=l=0,g=null,v=u.next();null!==m&&!v.done;y++,v=u.next()){m.index>y?(g=m,m=null):g=m.sibling;var b=d(o,m,v.value,s);if(null===b){null===m&&(m=g);break}e&&m&&null===b.alternate&&t(o,m),l=a(b,l,y),null===f?c=b:f.sibling=b,f=b,m=g}if(v.done)return n(o,m),c;if(null===m){for(;!v.done;y++,v=u.next())null!==(v=p(o,v.value,s))&&(l=a(v,l,y),null===f?c=v:f.sibling=v,f=v);return c}for(m=r(o,m);!v.done;y++,v=u.next())null!==(v=h(m,o,y,v.value,s))&&(e&&null!==v.alternate&&m.delete(null===v.key?y:v.key),l=a(v,l,y),null===f?c=v:f.sibling=v,f=v);return e&&m.forEach((function(e){return t(o,e)})),c}return function(e,r,a,u){var s="object"==typeof a&&null!==a&&a.type===S&&null===a.key;s&&(a=a.props.children);var c="object"==typeof a&&null!==a;if(c)switch(a.$$typeof){case _:e:{for(c=a.key,s=r;null!==s;){if(s.key===c){if(7===s.tag){if(a.type===S){n(e,s.sibling),(r=o(s,a.props.children)).return=e,e=r;break e}}else if(s.elementType===a.type){n(e,s.sibling),(r=o(s,a.props)).ref=Oa(e,s,a),r.return=e,e=r;break e}n(e,s);break}t(e,s),s=s.sibling}a.type===S?((r=Ku(a.props.children,e.mode,u,a.key)).return=e,e=r):((u=Wu(a.type,a.key,a.props,null,e.mode,u)).ref=Oa(e,r,a),u.return=e,e=u)}return l(e);case O:e:{for(s=a.key;null!==r;){if(r.key===s){if(4===r.tag&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),(r=o(r,a.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Gu(a,e.mode,u)).return=e,e=r}return l(e)}if("string"==typeof a||"number"==typeof a)return a=""+a,null!==r&&6===r.tag?(n(e,r.sibling),(r=o(r,a)).return=e,e=r):(n(e,r),(r=Yu(a,e.mode,u)).return=e,e=r),l(e);if(_a(a))return m(e,r,a,u);if(H(a))return y(e,r,a,u);if(c&&Sa(e,a),void 0===a&&!s)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(i(152,Y(e.type)||"Component"))}return n(e,r)}}var ka=xa(!0),Ca=xa(!1),Ta={},Pa=uo(Ta),Na=uo(Ta),Ia=uo(Ta);function ja(e){if(e===Ta)throw Error(i(174));return e}function Ra(e,t){switch(co(Ia,t),co(Na,e),co(Pa,Ta),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:de(null,"");break;default:t=de(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}so(Pa),co(Pa,t)}function Aa(){so(Pa),so(Na),so(Ia)}function Da(e){ja(Ia.current);var t=ja(Pa.current),n=de(t,e.type);t!==n&&(co(Na,e),co(Pa,n))}function Ma(e){Na.current===e&&(so(Pa),so(Na))}var La=uo(0);function Fa(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var za=null,Ua=null,Va=!1;function Ha(e,t){var n=Vu(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Ba(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Wa(e){if(Va){var t=Ua;if(t){var n=t;if(!Ba(e,t)){if(!(t=Yr(n.nextSibling))||!Ba(e,t))return e.flags=-1025&e.flags|2,Va=!1,void(za=e);Ha(za,n)}za=e,Ua=Yr(t.firstChild)}else e.flags=-1025&e.flags|2,Va=!1,za=e}}function Ka(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;za=e}function qa(e){if(e!==za)return!1;if(!Va)return Ka(e),Va=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Br(t,e.memoizedProps))for(t=Ua;t;)Ha(e,t),t=Yr(t.nextSibling);if(Ka(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){Ua=Yr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}Ua=null}}else Ua=za?Yr(e.stateNode.nextSibling):null;return!0}function Ya(){Ua=za=null,Va=!1}var Ga=[];function $a(){for(var e=0;e<Ga.length;e++)Ga[e]._workInProgressVersionPrimary=null;Ga.length=0}var Xa=E.ReactCurrentDispatcher,Qa=E.ReactCurrentBatchConfig,Ja=0,Za=null,ei=null,ti=null,ni=!1,ri=!1;function oi(){throw Error(i(321))}function ai(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sr(e[n],t[n]))return!1;return!0}function ii(e,t,n,r,o,a){if(Ja=a,Za=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Xa.current=null===e||null===e.memoizedState?ji:Ri,e=n(r,o),ri){a=0;do{if(ri=!1,!(25>a))throw Error(i(301));a+=1,ti=ei=null,t.updateQueue=null,Xa.current=Ai,e=n(r,o)}while(ri)}if(Xa.current=Ii,t=null!==ei&&null!==ei.next,Ja=0,ti=ei=Za=null,ni=!1,t)throw Error(i(300));return e}function li(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ti?Za.memoizedState=ti=e:ti=ti.next=e,ti}function ui(){if(null===ei){var e=Za.alternate;e=null!==e?e.memoizedState:null}else e=ei.next;var t=null===ti?Za.memoizedState:ti.next;if(null!==t)ti=t,ei=e;else{if(null===e)throw Error(i(310));e={memoizedState:(ei=e).memoizedState,baseState:ei.baseState,baseQueue:ei.baseQueue,queue:ei.queue,next:null},null===ti?Za.memoizedState=ti=e:ti=ti.next=e}return ti}function si(e,t){return"function"==typeof t?t(e):t}function ci(e){var t=ui(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=ei,o=r.baseQueue,a=n.pending;if(null!==a){if(null!==o){var l=o.next;o.next=a.next,a.next=l}r.baseQueue=o=a,n.pending=null}if(null!==o){o=o.next,r=r.baseState;var u=l=a=null,s=o;do{var c=s.lane;if((Ja&c)===c)null!==u&&(u=u.next={lane:0,action:s.action,eagerReducer:s.eagerReducer,eagerState:s.eagerState,next:null}),r=s.eagerReducer===e?s.eagerState:e(r,s.action);else{var f={lane:c,action:s.action,eagerReducer:s.eagerReducer,eagerState:s.eagerState,next:null};null===u?(l=u=f,a=r):u=u.next=f,Za.lanes|=c,Fl|=c}s=s.next}while(null!==s&&s!==o);null===u?a=r:u.next=l,sr(r,t.memoizedState)||(Mi=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=u,n.lastRenderedState=r}return[t.memoizedState,n.dispatch]}function fi(e){var t=ui(),n=t.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,a=t.memoizedState;if(null!==o){n.pending=null;var l=o=o.next;do{a=e(a,l.action),l=l.next}while(l!==o);sr(a,t.memoizedState)||(Mi=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function pi(e,t,n){var r=t._getVersion;r=r(t._source);var o=t._workInProgressVersionPrimary;if(null!==o?e=o===r:(e=e.mutableReadLanes,(e=(Ja&e)===e)&&(t._workInProgressVersionPrimary=r,Ga.push(t))),e)return n(t._source);throw Ga.push(t),Error(i(350))}function di(e,t,n,r){var o=Nl;if(null===o)throw Error(i(349));var a=t._getVersion,l=a(t._source),u=Xa.current,s=u.useState((function(){return pi(o,t,n)})),c=s[1],f=s[0];s=ti;var p=e.memoizedState,d=p.refs,h=d.getSnapshot,m=p.source;p=p.subscribe;var y=Za;return e.memoizedState={refs:d,source:t,subscribe:r},u.useEffect((function(){d.getSnapshot=n,d.setSnapshot=c;var e=a(t._source);if(!sr(l,e)){e=n(t._source),sr(f,e)||(c(e),e=cu(y),o.mutableReadLanes|=e&o.pendingLanes),e=o.mutableReadLanes,o.entangledLanes|=e;for(var r=o.entanglements,i=e;0<i;){var u=31-Bt(i),s=1<<u;r[u]|=e,i&=~s}}}),[n,t,r]),u.useEffect((function(){return r(t._source,(function(){var e=d.getSnapshot,n=d.setSnapshot;try{n(e(t._source));var r=cu(y);o.mutableReadLanes|=r&o.pendingLanes}catch(e){n((function(){throw e}))}}))}),[t,r]),sr(h,n)&&sr(m,t)&&sr(p,r)||((e={pending:null,dispatch:null,lastRenderedReducer:si,lastRenderedState:f}).dispatch=c=Ni.bind(null,Za,e),s.queue=e,s.baseQueue=null,f=pi(o,t,n),s.memoizedState=s.baseState=f),f}function hi(e,t,n){return di(ui(),e,t,n)}function mi(e){var t=li();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:si,lastRenderedState:e}).dispatch=Ni.bind(null,Za,e),[t.memoizedState,e]}function yi(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=Za.updateQueue)?(t={lastEffect:null},Za.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function gi(e){return e={current:e},li().memoizedState=e}function vi(){return ui().memoizedState}function bi(e,t,n,r){var o=li();Za.flags|=e,o.memoizedState=yi(1|t,n,void 0,void 0===r?null:r)}function wi(e,t,n,r){var o=ui();r=void 0===r?null:r;var a=void 0;if(null!==ei){var i=ei.memoizedState;if(a=i.destroy,null!==r&&ai(r,i.deps))return void yi(t,n,a,r)}Za.flags|=e,o.memoizedState=yi(1|t,n,a,r)}function Ei(e,t){return bi(516,4,e,t)}function _i(e,t){return wi(516,4,e,t)}function Oi(e,t){return wi(4,2,e,t)}function Si(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function xi(e,t,n){return n=null!=n?n.concat([e]):null,wi(4,2,Si.bind(null,t,e),n)}function ki(){}function Ci(e,t){var n=ui();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ai(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ti(e,t){var n=ui();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&ai(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Pi(e,t){var n=Wo();qo(98>n?98:n,(function(){e(!0)})),qo(97<n?97:n,(function(){var n=Qa.transition;Qa.transition=1;try{e(!1),t()}finally{Qa.transition=n}}))}function Ni(e,t,n){var r=su(),o=cu(e),a={lane:o,action:n,eagerReducer:null,eagerState:null,next:null},i=t.pending;if(null===i?a.next=a:(a.next=i.next,i.next=a),t.pending=a,i=e.alternate,e===Za||null!==i&&i===Za)ri=ni=!0;else{if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var l=t.lastRenderedState,u=i(l,n);if(a.eagerReducer=i,a.eagerState=u,sr(u,l))return}catch(e){}fu(e,o,r)}}var Ii={readContext:ia,useCallback:oi,useContext:oi,useEffect:oi,useImperativeHandle:oi,useLayoutEffect:oi,useMemo:oi,useReducer:oi,useRef:oi,useState:oi,useDebugValue:oi,useDeferredValue:oi,useTransition:oi,useMutableSource:oi,useOpaqueIdentifier:oi,unstable_isNewReconciler:!1},ji={readContext:ia,useCallback:function(e,t){return li().memoizedState=[e,void 0===t?null:t],e},useContext:ia,useEffect:Ei,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,bi(4,2,Si.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bi(4,2,e,t)},useMemo:function(e,t){var n=li();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=li();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Ni.bind(null,Za,e),[r.memoizedState,e]},useRef:gi,useState:mi,useDebugValue:ki,useDeferredValue:function(e){var t=mi(e),n=t[0],r=t[1];return Ei((function(){var t=Qa.transition;Qa.transition=1;try{r(e)}finally{Qa.transition=t}}),[e]),n},useTransition:function(){var e=mi(!1),t=e[0];return gi(e=Pi.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,n){var r=li();return r.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:n},di(r,e,t,n)},useOpaqueIdentifier:function(){if(Va){var e=!1,t=function(e){return{$$typeof:D,toString:e,valueOf:e}}((function(){throw e||(e=!0,n("r:"+($r++).toString(36))),Error(i(355))})),n=mi(t)[1];return 0==(2&Za.mode)&&(Za.flags|=516,yi(5,(function(){n("r:"+($r++).toString(36))}),void 0,null)),t}return mi(t="r:"+($r++).toString(36)),t},unstable_isNewReconciler:!1},Ri={readContext:ia,useCallback:Ci,useContext:ia,useEffect:_i,useImperativeHandle:xi,useLayoutEffect:Oi,useMemo:Ti,useReducer:ci,useRef:vi,useState:function(){return ci(si)},useDebugValue:ki,useDeferredValue:function(e){var t=ci(si),n=t[0],r=t[1];return _i((function(){var t=Qa.transition;Qa.transition=1;try{r(e)}finally{Qa.transition=t}}),[e]),n},useTransition:function(){var e=ci(si)[0];return[vi().current,e]},useMutableSource:hi,useOpaqueIdentifier:function(){return ci(si)[0]},unstable_isNewReconciler:!1},Ai={readContext:ia,useCallback:Ci,useContext:ia,useEffect:_i,useImperativeHandle:xi,useLayoutEffect:Oi,useMemo:Ti,useReducer:fi,useRef:vi,useState:function(){return fi(si)},useDebugValue:ki,useDeferredValue:function(e){var t=fi(si),n=t[0],r=t[1];return _i((function(){var t=Qa.transition;Qa.transition=1;try{r(e)}finally{Qa.transition=t}}),[e]),n},useTransition:function(){var e=fi(si)[0];return[vi().current,e]},useMutableSource:hi,useOpaqueIdentifier:function(){return fi(si)[0]},unstable_isNewReconciler:!1},Di=E.ReactCurrentOwner,Mi=!1;function Li(e,t,n,r){t.child=null===e?Ca(t,null,n,r):ka(t,e.child,n,r)}function Fi(e,t,n,r,o){n=n.render;var a=t.ref;return aa(t,o),r=ii(e,t,n,r,a,o),null===e||Mi?(t.flags|=1,Li(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~o,nl(e,t,o))}function zi(e,t,n,r,o,a){if(null===e){var i=n.type;return"function"!=typeof i||Hu(i)||void 0!==i.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Wu(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,Ui(e,t,i,r,o,a))}return i=e.child,0==(o&a)&&(o=i.memoizedProps,(n=null!==(n=n.compare)?n:fr)(o,r)&&e.ref===t.ref)?nl(e,t,a):(t.flags|=1,(e=Bu(i,r)).ref=t.ref,e.return=t,t.child=e)}function Ui(e,t,n,r,o,a){if(null!==e&&fr(e.memoizedProps,r)&&e.ref===t.ref){if(Mi=!1,0==(a&o))return t.lanes=e.lanes,nl(e,t,a);0!=(16384&e.flags)&&(Mi=!0)}return Bi(e,t,n,r,a)}function Vi(e,t,n){var r=t.pendingProps,o=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode||"unstable-defer-without-hiding"===r.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},bu(0,n);else{if(0==(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},bu(0,e),null;t.memoizedState={baseLanes:0},bu(0,null!==a?a.baseLanes:n)}else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,bu(0,r);return Li(e,t,o,n),t.child}function Hi(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=128)}function Bi(e,t,n,r,o){var a=go(n)?mo:po.current;return a=yo(t,a),aa(t,o),n=ii(e,t,n,r,a,o),null===e||Mi?(t.flags|=1,Li(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~o,nl(e,t,o))}function Wi(e,t,n,r,o){if(go(n)){var a=!0;Eo(t)}else a=!1;if(aa(t,o),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),ba(t,n,r),Ea(t,n,r,o),r=!0;else if(null===e){var i=t.stateNode,l=t.memoizedProps;i.props=l;var u=i.context,s=n.contextType;s="object"==typeof s&&null!==s?ia(s):yo(t,s=go(n)?mo:po.current);var c=n.getDerivedStateFromProps,f="function"==typeof c||"function"==typeof i.getSnapshotBeforeUpdate;f||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==r||u!==s)&&wa(t,i,r,s),la=!1;var p=t.memoizedState;i.state=p,da(t,r,i,o),u=t.memoizedState,l!==r||p!==u||ho.current||la?("function"==typeof c&&(ya(t,n,c,r),u=t.memoizedState),(l=la||va(t,n,l,r,p,u,s))?(f||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4)):("function"==typeof i.componentDidMount&&(t.flags|=4),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=s,r=l):("function"==typeof i.componentDidMount&&(t.flags|=4),r=!1)}else{i=t.stateNode,sa(e,t),l=t.memoizedProps,s=t.type===t.elementType?l:Qo(t.type,l),i.props=s,f=t.pendingProps,p=i.context,u="object"==typeof(u=n.contextType)&&null!==u?ia(u):yo(t,u=go(n)?mo:po.current);var d=n.getDerivedStateFromProps;(c="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l!==f||p!==u)&&wa(t,i,r,u),la=!1,p=t.memoizedState,i.state=p,da(t,r,i,o);var h=t.memoizedState;l!==f||p!==h||ho.current||la?("function"==typeof d&&(ya(t,n,d,r),h=t.memoizedState),(s=la||va(t,n,s,r,p,h,u))?(c||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,h,u),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,h,u)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=256),t.memoizedProps=r,t.memoizedState=h),i.props=r,i.state=h,i.context=u,r=s):("function"!=typeof i.componentDidUpdate||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=256),r=!1)}return Ki(e,t,n,r,a,o)}function Ki(e,t,n,r,o,a){Hi(e,t);var i=0!=(64&t.flags);if(!r&&!i)return o&&_o(t,n,!1),nl(e,t,a);r=t.stateNode,Di.current=t;var l=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=ka(t,e.child,null,a),t.child=ka(t,null,l,a)):Li(e,t,l,a),t.memoizedState=r.state,o&&_o(t,n,!0),t.child}function qi(e){var t=e.stateNode;t.pendingContext?bo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&bo(0,t.context,!1),Ra(e,t.containerInfo)}var Yi,Gi,$i,Xi={dehydrated:null,retryLane:0};function Qi(e,t,n){var r,o=t.pendingProps,a=La.current,i=!1;return(r=0!=(64&t.flags))||(r=(null===e||null!==e.memoizedState)&&0!=(2&a)),r?(i=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===o.fallback||!0===o.unstable_avoidThisFallback||(a|=1),co(La,1&a),null===e?(void 0!==o.fallback&&Wa(t),e=o.children,a=o.fallback,i?(e=Ji(t,e,a,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xi,e):"number"==typeof o.unstable_expectedLoadTime?(e=Ji(t,e,a,n),t.child.memoizedState={baseLanes:n},t.memoizedState=Xi,t.lanes=33554432,e):((n=qu({mode:"visible",children:e},t.mode,n,null)).return=t,t.child=n)):(e.memoizedState,i?(o=function(e,t,n,r,o){var a=t.mode,i=e.child;e=i.sibling;var l={mode:"hidden",children:n};return 0==(2&a)&&t.child!==i?((n=t.child).childLanes=0,n.pendingProps=l,null!==(i=n.lastEffect)?(t.firstEffect=n.firstEffect,t.lastEffect=i,i.nextEffect=null):t.firstEffect=t.lastEffect=null):n=Bu(i,l),null!==e?r=Bu(e,r):(r=Ku(r,a,o,null)).flags|=2,r.return=t,n.return=t,n.sibling=r,t.child=n,r}(e,t,o.children,o.fallback,n),i=t.child,a=e.child.memoizedState,i.memoizedState=null===a?{baseLanes:n}:{baseLanes:a.baseLanes|n},i.childLanes=e.childLanes&~n,t.memoizedState=Xi,o):(n=function(e,t,n,r){var o=e.child;return e=o.sibling,n=Bu(o,{mode:"visible",children:n}),0==(2&t.mode)&&(n.lanes=r),n.return=t,n.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=n}(e,t,o.children,n),t.memoizedState=null,n))}function Ji(e,t,n,r){var o=e.mode,a=e.child;return t={mode:"hidden",children:t},0==(2&o)&&null!==a?(a.childLanes=0,a.pendingProps=t):a=qu(t,o,0,null),n=Ku(n,o,r,null),a.return=e,n.return=e,a.sibling=n,e.child=a,n}function Zi(e,t){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),oa(e.return,t)}function el(e,t,n,r,o,a){var i=e.memoizedState;null===i?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o,lastEffect:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o,i.lastEffect=a)}function tl(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if(Li(e,t,r.children,n),0!=(2&(r=La.current)))r=1&r|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Zi(e,n);else if(19===e.tag)Zi(e,n);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(co(La,r),0==(2&t.mode))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===Fa(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),el(t,!1,o,n,a,t.lastEffect);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===Fa(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}el(t,!0,n,null,a,t.lastEffect);break;case"together":el(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function nl(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Fl|=t.lanes,0!=(n&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(n=Bu(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Bu(e,e.pendingProps)).return=t;n.sibling=null}return t.child}return null}function rl(e,t){if(!Va)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ol(e,t,n){var r=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:case 17:return go(t.type)&&vo(),null;case 3:return Aa(),so(ho),so(po),$a(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(qa(t)?t.flags|=4:r.hydrate||(t.flags|=256)),null;case 5:Ma(t);var a=ja(Ia.current);if(n=t.type,null!==e&&null!=t.stateNode)Gi(e,t,n,r),e.ref!==t.ref&&(t.flags|=128);else{if(!r){if(null===t.stateNode)throw Error(i(166));return null}if(e=ja(Pa.current),qa(t)){r=t.stateNode,n=t.type;var l=t.memoizedProps;switch(r[Qr]=t,r[Jr]=l,n){case"dialog":Pr("cancel",r),Pr("close",r);break;case"iframe":case"object":case"embed":Pr("load",r);break;case"video":case"audio":for(e=0;e<xr.length;e++)Pr(xr[e],r);break;case"source":Pr("error",r);break;case"img":case"image":case"link":Pr("error",r),Pr("load",r);break;case"details":Pr("toggle",r);break;case"input":ee(r,l),Pr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!l.multiple},Pr("invalid",r);break;case"textarea":ue(r,l),Pr("invalid",r)}for(var s in Oe(n,l),e=null,l)l.hasOwnProperty(s)&&(a=l[s],"children"===s?"string"==typeof a?r.textContent!==a&&(e=["children",a]):"number"==typeof a&&r.textContent!==""+a&&(e=["children",""+a]):u.hasOwnProperty(s)&&null!=a&&"onScroll"===s&&Pr("scroll",r));switch(n){case"input":X(r),re(r,l,!0);break;case"textarea":X(r),ce(r);break;case"select":case"option":break;default:"function"==typeof l.onClick&&(r.onclick=zr)}r=e,t.updateQueue=r,null!==r&&(t.flags|=4)}else{switch(s=9===a.nodeType?a:a.ownerDocument,e===fe&&(e=pe(n)),e===fe?"script"===n?((e=s.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),"select"===n&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Qr]=t,e[Jr]=r,Yi(e,t),t.stateNode=e,s=Se(n,r),n){case"dialog":Pr("cancel",e),Pr("close",e),a=r;break;case"iframe":case"object":case"embed":Pr("load",e),a=r;break;case"video":case"audio":for(a=0;a<xr.length;a++)Pr(xr[a],e);a=r;break;case"source":Pr("error",e),a=r;break;case"img":case"image":case"link":Pr("error",e),Pr("load",e),a=r;break;case"details":Pr("toggle",e),a=r;break;case"input":ee(e,r),a=Z(e,r),Pr("invalid",e);break;case"option":a=ae(e,r);break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=o({},r,{value:void 0}),Pr("invalid",e);break;case"textarea":ue(e,r),a=le(e,r),Pr("invalid",e);break;default:a=r}Oe(n,a);var c=a;for(l in c)if(c.hasOwnProperty(l)){var f=c[l];"style"===l?Ee(e,f):"dangerouslySetInnerHTML"===l?null!=(f=f?f.__html:void 0)&&ye(e,f):"children"===l?"string"==typeof f?("textarea"!==n||""!==f)&&ge(e,f):"number"==typeof f&&ge(e,""+f):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(u.hasOwnProperty(l)?null!=f&&"onScroll"===l&&Pr("scroll",e):null!=f&&w(e,l,f,s))}switch(n){case"input":X(e),re(e,r,!1);break;case"textarea":X(e),ce(e);break;case"option":null!=r.value&&e.setAttribute("value",""+G(r.value));break;case"select":e.multiple=!!r.multiple,null!=(l=r.value)?ie(e,!!r.multiple,l,!1):null!=r.defaultValue&&ie(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=zr)}Hr(n,r)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)$i(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));n=ja(Ia.current),ja(Pa.current),qa(t)?(r=t.stateNode,n=t.memoizedProps,r[Qr]=t,r.nodeValue!==n&&(t.flags|=4)):((r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[Qr]=t,t.stateNode=r)}return null;case 13:return so(La),r=t.memoizedState,0!=(64&t.flags)?(t.lanes=n,t):(r=null!==r,n=!1,null===e?void 0!==t.memoizedProps.fallback&&qa(t):n=null!==e.memoizedState,r&&!n&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&La.current)?0===Dl&&(Dl=3):(0!==Dl&&3!==Dl||(Dl=4),null===Nl||0==(134217727&Fl)&&0==(134217727&zl)||mu(Nl,jl))),(r||n)&&(t.flags|=4),null);case 4:return Aa(),null===e&&Ir(t.stateNode.containerInfo),null;case 10:return ra(t),null;case 19:if(so(La),null===(r=t.memoizedState))return null;if(l=0!=(64&t.flags),null===(s=r.rendering))if(l)rl(r,!1);else{if(0!==Dl||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(s=Fa(e))){for(t.flags|=64,rl(r,!1),null!==(l=s.updateQueue)&&(t.updateQueue=l,t.flags|=4),null===r.lastEffect&&(t.firstEffect=null),t.lastEffect=r.lastEffect,r=n,n=t.child;null!==n;)e=r,(l=n).flags&=2,l.nextEffect=null,l.firstEffect=null,l.lastEffect=null,null===(s=l.alternate)?(l.childLanes=0,l.lanes=e,l.child=null,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,l.type=s.type,e=s.dependencies,l.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return co(La,1&La.current|2),t.child}e=e.sibling}null!==r.tail&&Bo()>Bl&&(t.flags|=64,l=!0,rl(r,!1),t.lanes=33554432)}else{if(!l)if(null!==(e=Fa(s))){if(t.flags|=64,l=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),rl(r,!0),null===r.tail&&"hidden"===r.tailMode&&!s.alternate&&!Va)return null!==(t=t.lastEffect=r.lastEffect)&&(t.nextEffect=null),null}else 2*Bo()-r.renderingStartTime>Bl&&1073741824!==n&&(t.flags|=64,l=!0,rl(r,!1),t.lanes=33554432);r.isBackwards?(s.sibling=t.child,t.child=s):(null!==(n=r.last)?n.sibling=s:t.child=s,r.last=s)}return null!==r.tail?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=t.lastEffect,r.renderingStartTime=Bo(),n.sibling=null,t=La.current,co(La,l?1&t|2:1&t),n):null;case 23:case 24:return wu(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==r.mode&&(t.flags|=4),null}throw Error(i(156,t.tag))}function al(e){switch(e.tag){case 1:go(e.type)&&vo();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Aa(),so(ho),so(po),$a(),0!=(64&(t=e.flags)))throw Error(i(285));return e.flags=-4097&t|64,e;case 5:return Ma(e),null;case 13:return so(La),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return so(La),null;case 4:return Aa(),null;case 10:return ra(e),null;case 23:case 24:return wu(),null;default:return null}}function il(e,t){try{var n="",r=t;do{n+=q(r),r=r.return}while(r);var o=n}catch(e){o="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:o}}function ll(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}Yi=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Gi=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,ja(Pa.current);var i,l=null;switch(n){case"input":a=Z(e,a),r=Z(e,r),l=[];break;case"option":a=ae(e,a),r=ae(e,r),l=[];break;case"select":a=o({},a,{value:void 0}),r=o({},r,{value:void 0}),l=[];break;case"textarea":a=le(e,a),r=le(e,r),l=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(e.onclick=zr)}for(f in Oe(n,r),n=null,a)if(!r.hasOwnProperty(f)&&a.hasOwnProperty(f)&&null!=a[f])if("style"===f){var s=a[f];for(i in s)s.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else"dangerouslySetInnerHTML"!==f&&"children"!==f&&"suppressContentEditableWarning"!==f&&"suppressHydrationWarning"!==f&&"autoFocus"!==f&&(u.hasOwnProperty(f)?l||(l=[]):(l=l||[]).push(f,null));for(f in r){var c=r[f];if(s=null!=a?a[f]:void 0,r.hasOwnProperty(f)&&c!==s&&(null!=c||null!=s))if("style"===f)if(s){for(i in s)!s.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in c)c.hasOwnProperty(i)&&s[i]!==c[i]&&(n||(n={}),n[i]=c[i])}else n||(l||(l=[]),l.push(f,n)),n=c;else"dangerouslySetInnerHTML"===f?(c=c?c.__html:void 0,s=s?s.__html:void 0,null!=c&&s!==c&&(l=l||[]).push(f,c)):"children"===f?"string"!=typeof c&&"number"!=typeof c||(l=l||[]).push(f,""+c):"suppressContentEditableWarning"!==f&&"suppressHydrationWarning"!==f&&(u.hasOwnProperty(f)?(null!=c&&"onScroll"===f&&Pr("scroll",e),l||s===c||(l=[])):"object"==typeof c&&null!==c&&c.$$typeof===D?c.toString():(l=l||[]).push(f,c))}n&&(l=l||[]).push("style",n);var f=l;(t.updateQueue=f)&&(t.flags|=4)}},$i=function(e,t,n,r){n!==r&&(t.flags|=4)};var ul="function"==typeof WeakMap?WeakMap:Map;function sl(e,t,n){(n=ca(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Yl||(Yl=!0,Gl=r),ll(0,t)},n}function cl(e,t,n){(n=ca(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return ll(0,t),r(o)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){"function"!=typeof r&&(null===$l?$l=new Set([this]):$l.add(this),ll(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}var fl="function"==typeof WeakSet?WeakSet:Set;function pl(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){Lu(e,t)}else t.current=null}function dl(e,t){switch(t.tag){case 0:case 11:case 15:case 22:case 5:case 6:case 4:case 17:return;case 1:if(256&t.flags&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:Qo(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&qr(t.stateNode.containerInfo))}throw Error(i(163))}function hl(e,t,n){switch(n.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var r=e.create;e.destroy=r()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=n.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var o=e;r=o.next,0!=(4&(o=o.tag))&&0!=(1&o)&&(Au(n,e),Ru(n,e)),e=r}while(e!==t)}return;case 1:return e=n.stateNode,4&n.flags&&(null===t?e.componentDidMount():(r=n.elementType===n.type?t.memoizedProps:Qo(n.type,t.memoizedProps),e.componentDidUpdate(r,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=n.updateQueue)&&ha(n,t,e));case 3:if(null!==(t=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 5:case 1:e=n.child.stateNode}ha(n,t,e)}return;case 5:return e=n.stateNode,void(null===t&&4&n.flags&&Hr(n.type,n.memoizedProps)&&e.focus());case 6:case 4:case 12:case 19:case 17:case 20:case 21:case 23:case 24:return;case 13:return void(null===n.memoizedState&&(n=n.alternate,null!==n&&(n=n.memoizedState,null!==n&&(n=n.dehydrated,null!==n&&Et(n)))))}throw Error(i(163))}function ml(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)"function"==typeof(r=r.style).setProperty?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var o=n.memoizedProps.style;o=null!=o&&o.hasOwnProperty("display")?o.display:null,r.style.display=we("display",o)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else if((23!==n.tag&&24!==n.tag||null===n.memoizedState||n===e)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function yl(e,t){if(So&&"function"==typeof So.onCommitFiberUnmount)try{So.onCommitFiberUnmount(Oo,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n,o=r.destroy;if(r=r.tag,void 0!==o)if(0!=(4&r))Au(t,n);else{r=t;try{o()}catch(e){Lu(r,e)}}n=n.next}while(n!==e)}break;case 1:if(pl(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){Lu(t,e)}break;case 5:pl(t);break;case 4:_l(e,t)}}function gl(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function vl(e){return 5===e.tag||3===e.tag||4===e.tag}function bl(e){e:{for(var t=e.return;null!==t;){if(vl(t))break e;t=t.return}throw Error(i(160))}var n=t;switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw Error(i(161))}16&n.flags&&(ge(t,""),n.flags&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||vl(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.flags)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.flags)){n=n.stateNode;break e}}r?wl(e,n,t):El(e,n,t)}function wl(e,t,n){var r=e.tag,o=5===r||6===r;if(o)e=o?e.stateNode:e.stateNode.instance,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=zr));else if(4!==r&&null!==(e=e.child))for(wl(e,t,n),e=e.sibling;null!==e;)wl(e,t,n),e=e.sibling}function El(e,t,n){var r=e.tag,o=5===r||6===r;if(o)e=o?e.stateNode:e.stateNode.instance,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(El(e,t,n),e=e.sibling;null!==e;)El(e,t,n),e=e.sibling}function _l(e,t){for(var n,r,o=t,a=!1;;){if(!a){a=o.return;e:for(;;){if(null===a)throw Error(i(160));switch(n=a.stateNode,a.tag){case 5:r=!1;break e;case 3:case 4:n=n.containerInfo,r=!0;break e}a=a.return}a=!0}if(5===o.tag||6===o.tag){e:for(var l=e,u=o,s=u;;)if(yl(l,s),null!==s.child&&4!==s.tag)s.child.return=s,s=s.child;else{if(s===u)break e;for(;null===s.sibling;){if(null===s.return||s.return===u)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}r?(l=n,u=o.stateNode,8===l.nodeType?l.parentNode.removeChild(u):l.removeChild(u)):n.removeChild(o.stateNode)}else if(4===o.tag){if(null!==o.child){n=o.stateNode.containerInfo,r=!0,o.child.return=o,o=o.child;continue}}else if(yl(e,o),null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;4===(o=o.return).tag&&(a=!1)}o.sibling.return=o.return,o=o.sibling}}function Ol(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var r=n=n.next;do{3==(3&r.tag)&&(e=r.destroy,r.destroy=void 0,void 0!==e&&e()),r=r.next}while(r!==n)}return;case 1:case 12:case 17:return;case 5:if(null!=(n=t.stateNode)){r=t.memoizedProps;var o=null!==e?e.memoizedProps:r;e=t.type;var a=t.updateQueue;if(t.updateQueue=null,null!==a){for(n[Jr]=r,"input"===e&&"radio"===r.type&&null!=r.name&&te(n,r),Se(e,o),t=Se(e,r),o=0;o<a.length;o+=2){var l=a[o],u=a[o+1];"style"===l?Ee(n,u):"dangerouslySetInnerHTML"===l?ye(n,u):"children"===l?ge(n,u):w(n,l,u,t)}switch(e){case"input":ne(n,r);break;case"textarea":se(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(a=r.value)?ie(n,!!r.multiple,a,!1):e!==!!r.multiple&&(null!=r.defaultValue?ie(n,!!r.multiple,r.defaultValue,!0):ie(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(i(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((n=t.stateNode).hydrate&&(n.hydrate=!1,Et(n.containerInfo)));case 13:return null!==t.memoizedState&&(Hl=Bo(),ml(t.child,!0)),void Sl(t);case 19:return void Sl(t);case 23:case 24:return void ml(t,null!==t.memoizedState)}throw Error(i(163))}function Sl(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new fl),t.forEach((function(t){var r=zu.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function xl(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&null!==(t=t.memoizedState)&&null===t.dehydrated}var kl=Math.ceil,Cl=E.ReactCurrentDispatcher,Tl=E.ReactCurrentOwner,Pl=0,Nl=null,Il=null,jl=0,Rl=0,Al=uo(0),Dl=0,Ml=null,Ll=0,Fl=0,zl=0,Ul=0,Vl=null,Hl=0,Bl=1/0;function Wl(){Bl=Bo()+500}var Kl,ql=null,Yl=!1,Gl=null,$l=null,Xl=!1,Ql=null,Jl=90,Zl=[],eu=[],tu=null,nu=0,ru=null,ou=-1,au=0,iu=0,lu=null,uu=!1;function su(){return 0!=(48&Pl)?Bo():-1!==ou?ou:ou=Bo()}function cu(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Wo()?1:2;if(0===au&&(au=Ll),0!==Xo.transition){0!==iu&&(iu=null!==Vl?Vl.pendingLanes:0),e=au;var t=4186112&~iu;return 0==(t&=-t)&&0==(t=(e=4186112&~e)&-e)&&(t=8192),t}return e=Wo(),e=zt(0!=(4&Pl)&&98===e?12:e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),au)}function fu(e,t,n){if(50<nu)throw nu=0,ru=null,Error(i(185));if(null===(e=pu(e,t)))return null;Ht(e,t,n),e===Nl&&(zl|=t,4===Dl&&mu(e,jl));var r=Wo();1===t?0!=(8&Pl)&&0==(48&Pl)?yu(e):(du(e,n),0===Pl&&(Wl(),Go())):(0==(4&Pl)||98!==r&&99!==r||(null===tu?tu=new Set([e]):tu.add(e)),du(e,n)),Vl=e}function pu(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}function du(e,t){for(var n=e.callbackNode,r=e.suspendedLanes,o=e.pingedLanes,a=e.expirationTimes,l=e.pendingLanes;0<l;){var u=31-Bt(l),s=1<<u,c=a[u];if(-1===c){if(0==(s&r)||0!=(s&o)){c=t,Mt(s);var f=Dt;a[u]=10<=f?c+250:6<=f?c+5e3:-1}}else c<=t&&(e.expiredLanes|=s);l&=~s}if(r=Lt(e,e===Nl?jl:0),t=Dt,0===r)null!==n&&(n!==Lo&&Co(n),e.callbackNode=null,e.callbackPriority=0);else{if(null!==n){if(e.callbackPriority===t)return;n!==Lo&&Co(n)}15===t?(n=yu.bind(null,e),null===zo?(zo=[n],Uo=ko(jo,$o)):zo.push(n),n=Lo):14===t?n=Yo(99,yu.bind(null,e)):(n=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(i(358,e))}}(t),n=Yo(n,hu.bind(null,e))),e.callbackPriority=t,e.callbackNode=n}}function hu(e){if(ou=-1,iu=au=0,0!=(48&Pl))throw Error(i(327));var t=e.callbackNode;if(ju()&&e.callbackNode!==t)return null;var n=Lt(e,e===Nl?jl:0);if(0===n)return null;var r=n,o=Pl;Pl|=16;var a=Ou();for(Nl===e&&jl===r||(Wl(),Eu(e,r));;)try{ku();break}catch(t){_u(e,t)}if(na(),Cl.current=a,Pl=o,null!==Il?r=0:(Nl=null,jl=0,r=Dl),0!=(Ll&zl))Eu(e,0);else if(0!==r){if(2===r&&(Pl|=64,e.hydrate&&(e.hydrate=!1,qr(e.containerInfo)),0!==(n=Ft(e))&&(r=Su(e,n))),1===r)throw t=Ml,Eu(e,0),mu(e,n),du(e,Bo()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=n,r){case 0:case 1:throw Error(i(345));case 2:case 5:Pu(e);break;case 3:if(mu(e,n),(62914560&n)===n&&10<(r=Hl+500-Bo())){if(0!==Lt(e,0))break;if(((o=e.suspendedLanes)&n)!==n){su(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Wr(Pu.bind(null,e),r);break}Pu(e);break;case 4:if(mu(e,n),(4186112&n)===n)break;for(r=e.eventTimes,o=-1;0<n;){var l=31-Bt(n);a=1<<l,(l=r[l])>o&&(o=l),n&=~a}if(n=o,10<(n=(120>(n=Bo()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*kl(n/1960))-n)){e.timeoutHandle=Wr(Pu.bind(null,e),n);break}Pu(e);break;default:throw Error(i(329))}}return du(e,Bo()),e.callbackNode===t?hu.bind(null,e):null}function mu(e,t){for(t&=~Ul,t&=~zl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bt(t),r=1<<n;e[n]=-1,t&=~r}}function yu(e){if(0!=(48&Pl))throw Error(i(327));if(ju(),e===Nl&&0!=(e.expiredLanes&jl)){var t=jl,n=Su(e,t);0!=(Ll&zl)&&(n=Su(e,t=Lt(e,t)))}else n=Su(e,t=Lt(e,0));if(0!==e.tag&&2===n&&(Pl|=64,e.hydrate&&(e.hydrate=!1,qr(e.containerInfo)),0!==(t=Ft(e))&&(n=Su(e,t))),1===n)throw n=Ml,Eu(e,0),mu(e,t),du(e,Bo()),n;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Pu(e),du(e,Bo()),null}function gu(e,t){var n=Pl;Pl|=1;try{return e(t)}finally{0===(Pl=n)&&(Wl(),Go())}}function vu(e,t){var n=Pl;Pl&=-2,Pl|=8;try{return e(t)}finally{0===(Pl=n)&&(Wl(),Go())}}function bu(e,t){co(Al,Rl),Rl|=t,Ll|=t}function wu(){Rl=Al.current,so(Al)}function Eu(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Kr(n)),null!==Il)for(n=Il.return;null!==n;){var r=n;switch(r.tag){case 1:null!=(r=r.type.childContextTypes)&&vo();break;case 3:Aa(),so(ho),so(po),$a();break;case 5:Ma(r);break;case 4:Aa();break;case 13:case 19:so(La);break;case 10:ra(r);break;case 23:case 24:wu()}n=n.return}Nl=e,Il=Bu(e.current,null),jl=Rl=Ll=t,Dl=0,Ml=null,Ul=zl=Fl=0}function _u(e,t){for(;;){var n=Il;try{if(na(),Xa.current=Ii,ni){for(var r=Za.memoizedState;null!==r;){var o=r.queue;null!==o&&(o.pending=null),r=r.next}ni=!1}if(Ja=0,ti=ei=Za=null,ri=!1,Tl.current=null,null===n||null===n.return){Dl=1,Ml=t,Il=null;break}e:{var a=e,i=n.return,l=n,u=t;if(t=jl,l.flags|=2048,l.firstEffect=l.lastEffect=null,null!==u&&"object"==typeof u&&"function"==typeof u.then){var s=u;if(0==(2&l.mode)){var c=l.alternate;c?(l.updateQueue=c.updateQueue,l.memoizedState=c.memoizedState,l.lanes=c.lanes):(l.updateQueue=null,l.memoizedState=null)}var f=0!=(1&La.current),p=i;do{var d;if(d=13===p.tag){var h=p.memoizedState;if(null!==h)d=null!==h.dehydrated;else{var m=p.memoizedProps;d=void 0!==m.fallback&&(!0!==m.unstable_avoidThisFallback||!f)}}if(d){var y=p.updateQueue;if(null===y){var g=new Set;g.add(s),p.updateQueue=g}else y.add(s);if(0==(2&p.mode)){if(p.flags|=64,l.flags|=16384,l.flags&=-2981,1===l.tag)if(null===l.alternate)l.tag=17;else{var v=ca(-1,1);v.tag=2,fa(l,v)}l.lanes|=1;break e}u=void 0,l=t;var b=a.pingCache;if(null===b?(b=a.pingCache=new ul,u=new Set,b.set(s,u)):void 0===(u=b.get(s))&&(u=new Set,b.set(s,u)),!u.has(l)){u.add(l);var w=Fu.bind(null,a,s,l);s.then(w,w)}p.flags|=4096,p.lanes=t;break e}p=p.return}while(null!==p);u=Error((Y(l.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Dl&&(Dl=2),u=il(u,l),p=i;do{switch(p.tag){case 3:a=u,p.flags|=4096,t&=-t,p.lanes|=t,pa(p,sl(0,a,t));break e;case 1:a=u;var E=p.type,_=p.stateNode;if(0==(64&p.flags)&&("function"==typeof E.getDerivedStateFromError||null!==_&&"function"==typeof _.componentDidCatch&&(null===$l||!$l.has(_)))){p.flags|=4096,t&=-t,p.lanes|=t,pa(p,cl(p,a,t));break e}}p=p.return}while(null!==p)}Tu(n)}catch(e){t=e,Il===n&&null!==n&&(Il=n=n.return);continue}break}}function Ou(){var e=Cl.current;return Cl.current=Ii,null===e?Ii:e}function Su(e,t){var n=Pl;Pl|=16;var r=Ou();for(Nl===e&&jl===t||Eu(e,t);;)try{xu();break}catch(t){_u(e,t)}if(na(),Pl=n,Cl.current=r,null!==Il)throw Error(i(261));return Nl=null,jl=0,Dl}function xu(){for(;null!==Il;)Cu(Il)}function ku(){for(;null!==Il&&!To();)Cu(Il)}function Cu(e){var t=Kl(e.alternate,e,Rl);e.memoizedProps=e.pendingProps,null===t?Tu(e):Il=t,Tl.current=null}function Tu(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(n=ol(n,t,Rl)))return void(Il=n);if(24!==(n=t).tag&&23!==n.tag||null===n.memoizedState||0!=(1073741824&Rl)||0==(4&n.mode)){for(var r=0,o=n.child;null!==o;)r|=o.lanes|o.childLanes,o=o.sibling;n.childLanes=r}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(n=al(t)))return n.flags&=2047,void(Il=n);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Il=t);Il=t=e}while(null!==t);0===Dl&&(Dl=5)}function Pu(e){var t=Wo();return qo(99,Nu.bind(null,e,t)),null}function Nu(e,t){do{ju()}while(null!==Ql);if(0!=(48&Pl))throw Error(i(327));var n=e.finishedWork;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(i(177));e.callbackNode=null;var r=n.lanes|n.childLanes,o=r,a=e.pendingLanes&~o;e.pendingLanes=o,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=o,e.mutableReadLanes&=o,e.entangledLanes&=o,o=e.entanglements;for(var l=e.eventTimes,u=e.expirationTimes;0<a;){var s=31-Bt(a),c=1<<s;o[s]=0,l[s]=-1,u[s]=-1,a&=~c}if(null!==tu&&0==(24&r)&&tu.has(e)&&tu.delete(e),e===Nl&&(Il=Nl=null,jl=0),1<n.flags?null!==n.lastEffect?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,null!==r){if(o=Pl,Pl|=32,Tl.current=null,Ur=Gt,yr(l=mr())){if("selectionStart"in l)u={start:l.selectionStart,end:l.selectionEnd};else e:if(u=(u=l.ownerDocument)&&u.defaultView||window,(c=u.getSelection&&u.getSelection())&&0!==c.rangeCount){u=c.anchorNode,a=c.anchorOffset,s=c.focusNode,c=c.focusOffset;try{u.nodeType,s.nodeType}catch(e){u=null;break e}var f=0,p=-1,d=-1,h=0,m=0,y=l,g=null;t:for(;;){for(var v;y!==u||0!==a&&3!==y.nodeType||(p=f+a),y!==s||0!==c&&3!==y.nodeType||(d=f+c),3===y.nodeType&&(f+=y.nodeValue.length),null!==(v=y.firstChild);)g=y,y=v;for(;;){if(y===l)break t;if(g===u&&++h===a&&(p=f),g===s&&++m===c&&(d=f),null!==(v=y.nextSibling))break;g=(y=g).parentNode}y=v}u=-1===p||-1===d?null:{start:p,end:d}}else u=null;u=u||{start:0,end:0}}else u=null;Vr={focusedElem:l,selectionRange:u},Gt=!1,lu=null,uu=!1,ql=r;do{try{Iu()}catch(e){if(null===ql)throw Error(i(330));Lu(ql,e),ql=ql.nextEffect}}while(null!==ql);lu=null,ql=r;do{try{for(l=e;null!==ql;){var b=ql.flags;if(16&b&&ge(ql.stateNode,""),128&b){var w=ql.alternate;if(null!==w){var E=w.ref;null!==E&&("function"==typeof E?E(null):E.current=null)}}switch(1038&b){case 2:bl(ql),ql.flags&=-3;break;case 6:bl(ql),ql.flags&=-3,Ol(ql.alternate,ql);break;case 1024:ql.flags&=-1025;break;case 1028:ql.flags&=-1025,Ol(ql.alternate,ql);break;case 4:Ol(ql.alternate,ql);break;case 8:_l(l,u=ql);var _=u.alternate;gl(u),null!==_&&gl(_)}ql=ql.nextEffect}}catch(e){if(null===ql)throw Error(i(330));Lu(ql,e),ql=ql.nextEffect}}while(null!==ql);if(E=Vr,w=mr(),b=E.focusedElem,l=E.selectionRange,w!==b&&b&&b.ownerDocument&&hr(b.ownerDocument.documentElement,b)){null!==l&&yr(b)&&(w=l.start,void 0===(E=l.end)&&(E=w),"selectionStart"in b?(b.selectionStart=w,b.selectionEnd=Math.min(E,b.value.length)):(E=(w=b.ownerDocument||document)&&w.defaultView||window).getSelection&&(E=E.getSelection(),u=b.textContent.length,_=Math.min(l.start,u),l=void 0===l.end?_:Math.min(l.end,u),!E.extend&&_>l&&(u=l,l=_,_=u),u=dr(b,_),a=dr(b,l),u&&a&&(1!==E.rangeCount||E.anchorNode!==u.node||E.anchorOffset!==u.offset||E.focusNode!==a.node||E.focusOffset!==a.offset)&&((w=w.createRange()).setStart(u.node,u.offset),E.removeAllRanges(),_>l?(E.addRange(w),E.extend(a.node,a.offset)):(w.setEnd(a.node,a.offset),E.addRange(w))))),w=[];for(E=b;E=E.parentNode;)1===E.nodeType&&w.push({element:E,left:E.scrollLeft,top:E.scrollTop});for("function"==typeof b.focus&&b.focus(),b=0;b<w.length;b++)(E=w[b]).element.scrollLeft=E.left,E.element.scrollTop=E.top}Gt=!!Ur,Vr=Ur=null,e.current=n,ql=r;do{try{for(b=e;null!==ql;){var O=ql.flags;if(36&O&&hl(b,ql.alternate,ql),128&O){w=void 0;var S=ql.ref;if(null!==S){var x=ql.stateNode;ql.tag,w=x,"function"==typeof S?S(w):S.current=w}}ql=ql.nextEffect}}catch(e){if(null===ql)throw Error(i(330));Lu(ql,e),ql=ql.nextEffect}}while(null!==ql);ql=null,Fo(),Pl=o}else e.current=n;if(Xl)Xl=!1,Ql=e,Jl=t;else for(ql=r;null!==ql;)t=ql.nextEffect,ql.nextEffect=null,8&ql.flags&&((O=ql).sibling=null,O.stateNode=null),ql=t;if(0===(r=e.pendingLanes)&&($l=null),1===r?e===ru?nu++:(nu=0,ru=e):nu=0,n=n.stateNode,So&&"function"==typeof So.onCommitFiberRoot)try{So.onCommitFiberRoot(Oo,n,void 0,64==(64&n.current.flags))}catch(e){}if(du(e,Bo()),Yl)throw Yl=!1,e=Gl,Gl=null,e;return 0!=(8&Pl)||Go(),null}function Iu(){for(;null!==ql;){var e=ql.alternate;uu||null===lu||(0!=(8&ql.flags)?Ze(ql,lu)&&(uu=!0):13===ql.tag&&xl(e,ql)&&Ze(ql,lu)&&(uu=!0));var t=ql.flags;0!=(256&t)&&dl(e,ql),0==(512&t)||Xl||(Xl=!0,Yo(97,(function(){return ju(),null}))),ql=ql.nextEffect}}function ju(){if(90!==Jl){var e=97<Jl?97:Jl;return Jl=90,qo(e,Du)}return!1}function Ru(e,t){Zl.push(t,e),Xl||(Xl=!0,Yo(97,(function(){return ju(),null})))}function Au(e,t){eu.push(t,e),Xl||(Xl=!0,Yo(97,(function(){return ju(),null})))}function Du(){if(null===Ql)return!1;var e=Ql;if(Ql=null,0!=(48&Pl))throw Error(i(331));var t=Pl;Pl|=32;var n=eu;eu=[];for(var r=0;r<n.length;r+=2){var o=n[r],a=n[r+1],l=o.destroy;if(o.destroy=void 0,"function"==typeof l)try{l()}catch(e){if(null===a)throw Error(i(330));Lu(a,e)}}for(n=Zl,Zl=[],r=0;r<n.length;r+=2){o=n[r],a=n[r+1];try{var u=o.create;o.destroy=u()}catch(e){if(null===a)throw Error(i(330));Lu(a,e)}}for(u=e.current.firstEffect;null!==u;)e=u.nextEffect,u.nextEffect=null,8&u.flags&&(u.sibling=null,u.stateNode=null),u=e;return Pl=t,Go(),!0}function Mu(e,t,n){fa(e,t=sl(0,t=il(n,t),1)),t=su(),null!==(e=pu(e,1))&&(Ht(e,1,t),du(e,t))}function Lu(e,t){if(3===e.tag)Mu(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){Mu(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===$l||!$l.has(r))){var o=cl(n,e=il(t,e),1);if(fa(n,o),o=su(),null!==(n=pu(n,1)))Ht(n,1,o),du(n,o);else if("function"==typeof r.componentDidCatch&&(null===$l||!$l.has(r)))try{r.componentDidCatch(t,e)}catch(e){}break}}n=n.return}}function Fu(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=su(),e.pingedLanes|=e.suspendedLanes&n,Nl===e&&(jl&n)===n&&(4===Dl||3===Dl&&(62914560&jl)===jl&&500>Bo()-Hl?Eu(e,0):Ul|=n),du(e,t)}function zu(e,t){var n=e.stateNode;null!==n&&n.delete(t),0==(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Wo()?1:2:(0===au&&(au=Ll),0===(t=Ut(62914560&~au))&&(t=4194304))),n=su(),null!==(e=pu(e,t))&&(Ht(e,t,n),du(e,n))}function Uu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Vu(e,t,n,r){return new Uu(e,t,n,r)}function Hu(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Bu(e,t){var n=e.alternate;return null===n?((n=Vu(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Wu(e,t,n,r,o,a){var l=2;if(r=e,"function"==typeof e)Hu(e)&&(l=1);else if("string"==typeof e)l=5;else e:switch(e){case S:return Ku(n.children,o,a,t);case M:l=8,o|=16;break;case x:l=8,o|=1;break;case k:return(e=Vu(12,n,t,8|o)).elementType=k,e.type=k,e.lanes=a,e;case N:return(e=Vu(13,n,t,o)).type=N,e.elementType=N,e.lanes=a,e;case I:return(e=Vu(19,n,t,o)).elementType=I,e.lanes=a,e;case L:return qu(n,o,a,t);case F:return(e=Vu(24,n,t,o)).elementType=F,e.lanes=a,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case C:l=10;break e;case T:l=9;break e;case P:l=11;break e;case j:l=14;break e;case R:l=16,r=null;break e;case A:l=22;break e}throw Error(i(130,null==e?e:typeof e,""))}return(t=Vu(l,n,t,o)).elementType=e,t.type=r,t.lanes=a,t}function Ku(e,t,n,r){return(e=Vu(7,e,r,t)).lanes=n,e}function qu(e,t,n,r){return(e=Vu(23,e,r,t)).elementType=L,e.lanes=n,e}function Yu(e,t,n){return(e=Vu(6,e,null,t)).lanes=n,e}function Gu(e,t,n){return(t=Vu(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $u(e,t,n){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Vt(0),this.expirationTimes=Vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.mutableSourceEagerHydrationData=null}function Xu(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:O,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}function Qu(e,t,n,r){var o=t.current,a=su(),l=cu(o);e:if(n){t:{if($e(n=n._reactInternals)!==n||1!==n.tag)throw Error(i(170));var u=n;do{switch(u.tag){case 3:u=u.stateNode.context;break t;case 1:if(go(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break t}}u=u.return}while(null!==u);throw Error(i(171))}if(1===n.tag){var s=n.type;if(go(s)){n=wo(n,s,u);break e}}n=u}else n=fo;return null===t.context?t.context=n:t.pendingContext=n,(t=ca(a,l)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),fa(o,t),fu(o,l,a),l}function Ju(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Zu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function es(e,t){Zu(e,t),(e=e.alternate)&&Zu(e,t)}function ts(e,t,n){var r=null!=n&&null!=n.hydrationOptions&&n.hydrationOptions.mutableSources||null;if(n=new $u(e,t,null!=n&&!0===n.hydrate),t=Vu(3,null,null,2===t?7:1===t?3:0),n.current=t,t.stateNode=n,ua(t),e[Zr]=n.current,Ir(8===e.nodeType?e.parentNode:e),r)for(e=0;e<r.length;e++){var o=(t=r[e])._getVersion;o=o(t._source),null==n.mutableSourceEagerHydrationData?n.mutableSourceEagerHydrationData=[t,o]:n.mutableSourceEagerHydrationData.push(t,o)}this._internalRoot=n}function ns(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function rs(e,t,n,r,o){var a=n._reactRootContainer;if(a){var i=a._internalRoot;if("function"==typeof o){var l=o;o=function(){var e=Ju(i);l.call(e)}}Qu(t,i,e,o)}else{if(a=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new ts(e,0,t?{hydrate:!0}:void 0)}(n,r),i=a._internalRoot,"function"==typeof o){var u=o;o=function(){var e=Ju(i);u.call(e)}}vu((function(){Qu(t,i,e,o)}))}return Ju(i)}function os(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!ns(t))throw Error(i(200));return Xu(e,t,null,n)}Kl=function(e,t,n){var r=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||ho.current)Mi=!0;else{if(0==(n&r)){switch(Mi=!1,t.tag){case 3:qi(t),Ya();break;case 5:Da(t);break;case 1:go(t.type)&&Eo(t);break;case 4:Ra(t,t.stateNode.containerInfo);break;case 10:r=t.memoizedProps.value;var o=t.type._context;co(Jo,o._currentValue),o._currentValue=r;break;case 13:if(null!==t.memoizedState)return 0!=(n&t.child.childLanes)?Qi(e,t,n):(co(La,1&La.current),null!==(t=nl(e,t,n))?t.sibling:null);co(La,1&La.current);break;case 19:if(r=0!=(n&t.childLanes),0!=(64&e.flags)){if(r)return tl(e,t,n);t.flags|=64}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null,o.lastEffect=null),co(La,La.current),r)break;return null;case 23:case 24:return t.lanes=0,Vi(e,t,n)}return nl(e,t,n)}Mi=0!=(16384&e.flags)}else Mi=!1;switch(t.lanes=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,o=yo(t,po.current),aa(t,n),o=ii(null,t,r,e,o,n),t.flags|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,go(r)){var a=!0;Eo(t)}else a=!1;t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,ua(t);var l=r.getDerivedStateFromProps;"function"==typeof l&&ya(t,r,l,e),o.updater=ga,t.stateNode=o,o._reactInternals=t,Ea(t,r,e,n),t=Ki(null,t,r,!0,a,n)}else t.tag=0,Li(null,t,o,n),t=t.child;return t;case 16:o=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,o=(a=o._init)(o._payload),t.type=o,a=t.tag=function(e){if("function"==typeof e)return Hu(e)?1:0;if(null!=e){if((e=e.$$typeof)===P)return 11;if(e===j)return 14}return 2}(o),e=Qo(o,e),a){case 0:t=Bi(null,t,o,e,n);break e;case 1:t=Wi(null,t,o,e,n);break e;case 11:t=Fi(null,t,o,e,n);break e;case 14:t=zi(null,t,o,Qo(o.type,e),r,n);break e}throw Error(i(306,o,""))}return t;case 0:return r=t.type,o=t.pendingProps,Bi(e,t,r,o=t.elementType===r?o:Qo(r,o),n);case 1:return r=t.type,o=t.pendingProps,Wi(e,t,r,o=t.elementType===r?o:Qo(r,o),n);case 3:if(qi(t),r=t.updateQueue,null===e||null===r)throw Error(i(282));if(r=t.pendingProps,o=null!==(o=t.memoizedState)?o.element:null,sa(e,t),da(t,r,null,n),(r=t.memoizedState.element)===o)Ya(),t=nl(e,t,n);else{if((a=(o=t.stateNode).hydrate)&&(Ua=Yr(t.stateNode.containerInfo.firstChild),za=t,a=Va=!0),a){if(null!=(e=o.mutableSourceEagerHydrationData))for(o=0;o<e.length;o+=2)(a=e[o])._workInProgressVersionPrimary=e[o+1],Ga.push(a);for(n=Ca(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|1024,n=n.sibling}else Li(e,t,r,n),Ya();t=t.child}return t;case 5:return Da(t),null===e&&Wa(t),r=t.type,o=t.pendingProps,a=null!==e?e.memoizedProps:null,l=o.children,Br(r,o)?l=null:null!==a&&Br(r,a)&&(t.flags|=16),Hi(e,t),Li(e,t,l,n),t.child;case 6:return null===e&&Wa(t),null;case 13:return Qi(e,t,n);case 4:return Ra(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=ka(t,null,r,n):Li(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,Fi(e,t,r,o=t.elementType===r?o:Qo(r,o),n);case 7:return Li(e,t,t.pendingProps,n),t.child;case 8:case 12:return Li(e,t,t.pendingProps.children,n),t.child;case 10:e:{r=t.type._context,o=t.pendingProps,l=t.memoizedProps,a=o.value;var u=t.type._context;if(co(Jo,u._currentValue),u._currentValue=a,null!==l)if(u=l.value,0==(a=sr(u,a)?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(u,a):1073741823))){if(l.children===o.children&&!ho.current){t=nl(e,t,n);break e}}else for(null!==(u=t.child)&&(u.return=t);null!==u;){var s=u.dependencies;if(null!==s){l=u.child;for(var c=s.firstContext;null!==c;){if(c.context===r&&0!=(c.observedBits&a)){1===u.tag&&((c=ca(-1,n&-n)).tag=2,fa(u,c)),u.lanes|=n,null!==(c=u.alternate)&&(c.lanes|=n),oa(u.return,n),s.lanes|=n;break}c=c.next}}else l=10===u.tag&&u.type===t.type?null:u.child;if(null!==l)l.return=u;else for(l=u;null!==l;){if(l===t){l=null;break}if(null!==(u=l.sibling)){u.return=l.return,l=u;break}l=l.return}u=l}Li(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=(a=t.pendingProps).children,aa(t,n),r=r(o=ia(o,a.unstable_observedBits)),t.flags|=1,Li(e,t,r,n),t.child;case 14:return a=Qo(o=t.type,t.pendingProps),zi(e,t,o,a=Qo(o.type,a),r,n);case 15:return Ui(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Qo(r,o),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,go(r)?(e=!0,Eo(t)):e=!1,aa(t,n),ba(t,r,o),Ea(t,r,o,n),Ki(null,t,r,!0,e,n);case 19:return tl(e,t,n);case 23:case 24:return Vi(e,t,n)}throw Error(i(156,t.tag))},ts.prototype.render=function(e){Qu(e,this._internalRoot,null,null)},ts.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Qu(null,e,null,(function(){t[Zr]=null}))},et=function(e){13===e.tag&&(fu(e,4,su()),es(e,4))},tt=function(e){13===e.tag&&(fu(e,67108864,su()),es(e,67108864))},nt=function(e){if(13===e.tag){var t=su(),n=cu(e);fu(e,n,t),es(e,n)}},rt=function(e,t){return t()},ke=function(e,t,n){switch(t){case"input":if(ne(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=oo(r);if(!o)throw Error(i(90));Q(r),ne(r,o)}}}break;case"textarea":se(e,n);break;case"select":null!=(t=n.value)&&ie(e,!!n.multiple,t,!1)}},je=gu,Re=function(e,t,n,r,o){var a=Pl;Pl|=4;try{return qo(98,e.bind(null,t,n,r,o))}finally{0===(Pl=a)&&(Wl(),Go())}},Ae=function(){0==(49&Pl)&&(function(){if(null!==tu){var e=tu;tu=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,du(e,Bo())}))}Go()}(),ju())},De=function(e,t){var n=Pl;Pl|=2;try{return e(t)}finally{0===(Pl=n)&&(Wl(),Go())}};var as={Events:[no,ro,oo,Ne,Ie,ju,{current:!1}]},is={findFiberByHostInstance:to,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},ls={bundleType:is.bundleType,version:is.version,rendererPackageName:is.rendererPackageName,rendererConfig:is.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Je(e))?null:e.stateNode},findFiberByHostInstance:is.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var us=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!us.isDisabled&&us.supportsFiber)try{Oo=us.inject(ls),So=us}catch(me){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=as,t.createPortal=os,t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(i(188));throw Error(i(268,Object.keys(e)))}return null===(e=Je(t))?null:e.stateNode},t.flushSync=function(e,t){var n=Pl;if(0!=(48&n))return e(t);Pl|=1;try{if(e)return qo(99,e.bind(null,t))}finally{Pl=n,Go()}},t.hydrate=function(e,t,n){if(!ns(t))throw Error(i(200));return rs(null,e,t,!0,n)},t.render=function(e,t,n){if(!ns(t))throw Error(i(200));return rs(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!ns(e))throw Error(i(40));return!!e._reactRootContainer&&(vu((function(){rs(null,null,e,!1,(function(){e._reactRootContainer=null,e[Zr]=null}))})),!0)},t.unstable_batchedUpdates=gu,t.unstable_createPortal=function(e,t){return os(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)},t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ns(n))throw Error(i(200));if(null==e||void 0===e._reactInternals)throw Error(i(38));return rs(e,t,n,!1,r)},t.version="17.0.2"},3102:function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(6539)},3298:function(e,t){"use strict";var n,r,o,a;if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var s=null,c=null,f=function(){if(null!==s)try{var e=t.unstable_now();s(!0,e),s=null}catch(e){throw setTimeout(f,0),e}};n=function(e){null!==s?setTimeout(n,0,e):(s=e,setTimeout(f,0))},r=function(e,t){c=setTimeout(e,t)},o=function(){clearTimeout(c)},t.unstable_shouldYield=function(){return!1},a=t.unstable_forceFrameRate=function(){}}else{var p=window.setTimeout,d=window.clearTimeout;if("undefined"!=typeof console){var h=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof h&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var m=!1,y=null,g=-1,v=5,b=0;t.unstable_shouldYield=function(){return t.unstable_now()>=b},a=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):v=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,E=w.port2;w.port1.onmessage=function(){if(null!==y){var e=t.unstable_now();b=e+v;try{y(!0,e)?E.postMessage(null):(m=!1,y=null)}catch(e){throw E.postMessage(null),e}}else m=!1},n=function(e){y=e,m||(m=!0,E.postMessage(null))},r=function(e,n){g=p((function(){e(t.unstable_now())}),n)},o=function(){d(g),g=-1}}function _(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,o=e[r];if(!(void 0!==o&&0<x(o,t)))break e;e[r]=t,e[n]=o,n=r}}function O(e){return void 0===(e=e[0])?null:e}function S(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length;r<o;){var a=2*(r+1)-1,i=e[a],l=a+1,u=e[l];if(void 0!==i&&0>x(i,n))void 0!==u&&0>x(u,i)?(e[r]=u,e[l]=n,r=l):(e[r]=i,e[a]=n,r=a);else{if(!(void 0!==u&&0>x(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}return null}function x(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var k=[],C=[],T=1,P=null,N=3,I=!1,j=!1,R=!1;function A(e){for(var t=O(C);null!==t;){if(null===t.callback)S(C);else{if(!(t.startTime<=e))break;S(C),t.sortIndex=t.expirationTime,_(k,t)}t=O(C)}}function D(e){if(R=!1,A(e),!j)if(null!==O(k))j=!0,n(M);else{var t=O(C);null!==t&&r(D,t.startTime-e)}}function M(e,n){j=!1,R&&(R=!1,o()),I=!0;var a=N;try{for(A(n),P=O(k);null!==P&&(!(P.expirationTime>n)||e&&!t.unstable_shouldYield());){var i=P.callback;if("function"==typeof i){P.callback=null,N=P.priorityLevel;var l=i(P.expirationTime<=n);n=t.unstable_now(),"function"==typeof l?P.callback=l:P===O(k)&&S(k),A(n)}else S(k);P=O(k)}if(null!==P)var u=!0;else{var s=O(C);null!==s&&r(D,s.startTime-n),u=!1}return u}finally{P=null,N=a,I=!1}}var L=a;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){j||I||(j=!0,n(M))},t.unstable_getCurrentPriorityLevel=function(){return N},t.unstable_getFirstCallbackNode=function(){return O(k)},t.unstable_next=function(e){switch(N){case 1:case 2:case 3:var t=3;break;default:t=N}var n=N;N=t;try{return e()}finally{N=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=L,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=N;N=e;try{return t()}finally{N=n}},t.unstable_scheduleCallback=function(e,a,i){var l=t.unstable_now();switch(i="object"==typeof i&&null!==i&&"number"==typeof(i=i.delay)&&0<i?l+i:l,e){case 1:var u=-1;break;case 2:u=250;break;case 5:u=1073741823;break;case 4:u=1e4;break;default:u=5e3}return e={id:T++,callback:a,priorityLevel:e,startTime:i,expirationTime:u=i+u,sortIndex:-1},i>l?(e.sortIndex=i,_(C,e),null===O(k)&&e===O(C)&&(R?o():R=!0,r(D,i-l))):(e.sortIndex=u,_(k,e),j||I||(j=!0,n(M))),e},t.unstable_wrapCallback=function(e){var t=N;return function(){var n=N;N=t;try{return e.apply(this,arguments)}finally{N=n}}}},9076:function(e,t,n){"use strict";e.exports=n(3298)},4330:function(e,t){t.w=function(e){return e}},394:function(e,t){"use strict";var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,u=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,c=n?Symbol.for("react.async_mode"):60111,f=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,y=n?Symbol.for("react.lazy"):60116,g=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,b=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case c:case f:case a:case l:case i:case d:return e;default:switch(e=e&&e.$$typeof){case s:case p:case y:case m:case u:return e;default:return t}}case o:return t}}}function _(e){return E(e)===f}t.AsyncMode=c,t.ConcurrentMode=f,t.ContextConsumer=s,t.ContextProvider=u,t.Element=r,t.ForwardRef=p,t.Fragment=a,t.Lazy=y,t.Memo=m,t.Portal=o,t.Profiler=l,t.StrictMode=i,t.Suspense=d,t.isAsyncMode=function(e){return _(e)||E(e)===c},t.isConcurrentMode=_,t.isContextConsumer=function(e){return E(e)===s},t.isContextProvider=function(e){return E(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return E(e)===p},t.isFragment=function(e){return E(e)===a},t.isLazy=function(e){return E(e)===y},t.isMemo=function(e){return E(e)===m},t.isPortal=function(e){return E(e)===o},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===i},t.isSuspense=function(e){return E(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===f||e===l||e===i||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===m||e.$$typeof===u||e.$$typeof===s||e.$$typeof===p||e.$$typeof===v||e.$$typeof===b||e.$$typeof===w||e.$$typeof===g)},t.typeOf=E},8485:function(e,t,n){"use strict";e.exports=n(394)},9879:function(e,t,n){"use strict";t.__esModule=!0;var r=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},o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2598)),a=c(n(6605)),i=c(n(4213)),l=c(n(8965)),u=c(n(5743)),s=n(6994);function c(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(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 d=function(e,t){return t&&t.split(" ").forEach((function(t){return(0,a.default)(e,t)}))},h=function(e,t){return t&&t.split(" ").forEach((function(t){return(0,i.default)(e,t)}))},m=(r({},u.default.propTypes,{classNames:s.classNamesShape,onEnter:o.func,onEntering:o.func,onEntered:o.func,onExit:o.func,onExiting:o.func,onExited:o.func}),function(e){function t(){var n,r;f(this,t);for(var o=arguments.length,a=Array(o),i=0;i<o;i++)a[i]=arguments[i];return n=r=p(this,e.call.apply(e,[this].concat(a))),r.onEnter=function(e,t){var n=r.getClassNames(t?"appear":"enter").className;r.removeClasses(e,"exit"),d(e,n),r.props.onEnter&&r.props.onEnter(e)},r.onEntering=function(e,t){var n=r.getClassNames(t?"appear":"enter").activeClassName;r.reflowAndAddClass(e,n),r.props.onEntering&&r.props.onEntering(e)},r.onEntered=function(e,t){r.removeClasses(e,t?"appear":"enter"),r.props.onEntered&&r.props.onEntered(e)},r.onExit=function(e){var t=r.getClassNames("exit").className;r.removeClasses(e,"appear"),r.removeClasses(e,"enter"),d(e,t),r.props.onExit&&r.props.onExit(e)},r.onExiting=function(e){var t=r.getClassNames("exit").activeClassName;r.reflowAndAddClass(e,t),r.props.onExiting&&r.props.onExiting(e)},r.onExited=function(e){r.removeClasses(e,"exit"),r.props.onExited&&r.props.onExited(e)},r.getClassNames=function(e){var t=r.props.classNames,n="string"!=typeof t?t[e]:t+"-"+e;return{className:n,activeClassName:"string"!=typeof t?t[e+"Active"]:n+"-active"}},p(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,e),t.prototype.removeClasses=function(e,t){var n=this.getClassNames(t),r=n.className,o=n.activeClassName;r&&h(e,r),o&&h(e,o)},t.prototype.reflowAndAddClass=function(e,t){e.scrollTop,d(e,t)},t.prototype.render=function(){var e=r({},this.props);return delete e.classNames,l.default.createElement(u.default,r({},e,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},t}(l.default.Component));m.propTypes={},t.default=m,e.exports=t.default},5743:function(e,t,n){"use strict";t.__esModule=!0,t.EXITING=t.ENTERED=t.ENTERING=t.EXITED=t.UNMOUNTED=void 0;var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2598)),o=i(n(8965)),a=i(n(3102));function i(e){return e&&e.__esModule?e:{default:e}}n(6994);var l=t.UNMOUNTED="unmounted",u=t.EXITED="exited",s=t.ENTERING="entering",c=t.ENTERED="entered",f=t.EXITING="exiting",p=function(e){function t(n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(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}(this,e.call(this,n,r)),a=r.transitionGroup,i=a&&!a.isMounting?n.enter:n.appear,f=void 0;return o.nextStatus=null,n.in?i?(f=u,o.nextStatus=s):f=c:f=n.unmountOnExit||n.mountOnEnter?l:u,o.state={status:f},o.nextCallback=null,o}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,e),t.prototype.getChildContext=function(){return{transitionGroup:null}},t.prototype.componentDidMount=function(){this.updateStatus(!0)},t.prototype.componentWillReceiveProps=function(e){var t=(this.pendingState||this.state).status;e.in?(t===l&&this.setState({status:u}),t!==s&&t!==c&&(this.nextStatus=s)):t!==s&&t!==c||(this.nextStatus=f)},t.prototype.componentDidUpdate=function(){this.updateStatus()},t.prototype.componentWillUnmount=function(){this.cancelNextCallback()},t.prototype.getTimeouts=function(){var e=this.props.timeout,t=void 0,n=void 0,r=void 0;return t=n=r=e,null!=e&&"number"!=typeof e&&(t=e.exit,n=e.enter,r=e.appear),{exit:t,enter:n,appear:r}},t.prototype.updateStatus=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nextStatus;if(null!==t){this.nextStatus=null,this.cancelNextCallback();var n=a.default.findDOMNode(this);t===s?this.performEnter(n,e):this.performExit(n)}else this.props.unmountOnExit&&this.state.status===u&&this.setState({status:l})},t.prototype.performEnter=function(e,t){var n=this,r=this.props.enter,o=this.context.transitionGroup?this.context.transitionGroup.isMounting:t,a=this.getTimeouts();t||r?(this.props.onEnter(e,o),this.safeSetState({status:s},(function(){n.props.onEntering(e,o),n.onTransitionEnd(e,a.enter,(function(){n.safeSetState({status:c},(function(){n.props.onEntered(e,o)}))}))}))):this.safeSetState({status:c},(function(){n.props.onEntered(e)}))},t.prototype.performExit=function(e){var t=this,n=this.props.exit,r=this.getTimeouts();n?(this.props.onExit(e),this.safeSetState({status:f},(function(){t.props.onExiting(e),t.onTransitionEnd(e,r.exit,(function(){t.safeSetState({status:u},(function(){t.props.onExited(e)}))}))}))):this.safeSetState({status:u},(function(){t.props.onExited(e)}))},t.prototype.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},t.prototype.safeSetState=function(e,t){var n=this;this.pendingState=e,t=this.setNextCallback(t),this.setState(e,(function(){n.pendingState=null,t()}))},t.prototype.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},t.prototype.onTransitionEnd=function(e,t,n){this.setNextCallback(n),e?(this.props.addEndListener&&this.props.addEndListener(e,this.nextCallback),null!=t&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},t.prototype.render=function(){var e=this.state.status;if(e===l)return null;var t=this.props,n=t.children,r=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(t,["children"]);if(delete r.in,delete r.mountOnEnter,delete r.unmountOnExit,delete r.appear,delete r.enter,delete r.exit,delete r.timeout,delete r.addEndListener,delete r.onEnter,delete r.onEntering,delete r.onEntered,delete r.onExit,delete r.onExiting,delete r.onExited,"function"==typeof n)return n(e,r);var a=o.default.Children.only(n);return o.default.cloneElement(a,r)},t}(o.default.Component);function d(){}p.contextTypes={transitionGroup:r.object},p.childContextTypes={transitionGroup:function(){}},p.propTypes={},p.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:d,onEntering:d,onEntered:d,onExit:d,onExiting:d,onExited:d},p.UNMOUNTED=0,p.EXITED=1,p.ENTERING=2,p.ENTERED=3,p.EXITING=4,t.default=p},4730:function(e,t,n){"use strict";t.__esModule=!0;var r=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},o=u(n(2598)),a=n(8965),i=u(a),l=n(7034);function u(e){return e&&e.__esModule?e:{default:e}}var s=Object.values||function(e){return Object.keys(e).map((function(t){return e[t]}))},c=(o.default.any,o.default.node,o.default.bool,o.default.bool,o.default.bool,o.default.func,function(e){function t(n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(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}(this,e.call(this,n,o));return i.handleExited=function(e,t,n){var o=(0,l.getChildMapping)(i.props.children);e in o||(n&&n(t),i.setState((function(t){var n=r({},t.children);return delete n[e],{children:n}})))},i.state={children:(0,l.getChildMapping)(n.children,(function(e){return(0,a.cloneElement)(e,{onExited:function(t){i.handleExited(e.key,t,e.props.onExited)},in:!0,appear:i.getProp(e,"appear"),enter:i.getProp(e,"enter"),exit:i.getProp(e,"exit")})}))},i}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,e),t.prototype.getChildContext=function(){return{transitionGroup:{isMounting:!this.appeared}}},t.prototype.getProp=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props;return null!=n[t]?n[t]:e.props[t]},t.prototype.componentDidMount=function(){this.appeared=!0},t.prototype.componentWillReceiveProps=function(e){var t=this,n=this.state.children,r=(0,l.getChildMapping)(e.children),o=(0,l.mergeChildMappings)(n,r);Object.keys(o).forEach((function(i){var l=o[i];if((0,a.isValidElement)(l)){var u=function(e){t.handleExited(l.key,e,l.props.onExited)},s=i in n,c=i in r,f=n[i],p=(0,a.isValidElement)(f)&&!f.props.in;!c||s&&!p?c||!s||p?c&&s&&(0,a.isValidElement)(f)&&(o[i]=(0,a.cloneElement)(l,{onExited:u,in:f.props.in,exit:t.getProp(l,"exit",e),enter:t.getProp(l,"enter",e)})):o[i]=(0,a.cloneElement)(l,{in:!1}):o[i]=(0,a.cloneElement)(l,{onExited:u,in:!0,exit:t.getProp(l,"exit",e),enter:t.getProp(l,"enter",e)})}})),this.setState({children:o})},t.prototype.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(e,["component","childFactory"]),o=this.state.children;return delete r.appear,delete r.enter,delete r.exit,i.default.createElement(t,r,s(o).map(n))},t}(i.default.Component));c.childContextTypes={transitionGroup:o.default.object.isRequired},c.propTypes={},c.defaultProps={component:"div",childFactory:function(e){return e}},t.default=c,e.exports=t.default},6285:function(e,t,n){"use strict";var r=i(n(9879)),o=i(n(4730)),a=i(n(5743));function i(e){return e&&e.__esModule?e:{default:e}}e.exports={Transition:a.default,TransitionGroup:o.default,CSSTransition:r.default}},7034:function(e,t,n){"use strict";t.__esModule=!0,t.getChildMapping=function(e,t){var n=Object.create(null);return e&&r.Children.map(e,(function(e){return e})).forEach((function(e){n[e.key]=function(e){return t&&(0,r.isValidElement)(e)?t(e):e}(e)})),n},t.mergeChildMappings=function(e,t){function n(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var r=Object.create(null),o=[];for(var a in e)a in t?o.length&&(r[a]=o,o=[]):o.push(a);var i=void 0,l={};for(var u in t){if(r[u])for(i=0;i<r[u].length;i++){var s=r[u][i];l[r[u][i]]=n(s)}l[u]=n(u)}for(i=0;i<o.length;i++)l[o[i]]=n(o[i]);return l};var r=n(8965)},6994:function(e,t,n){"use strict";t.__esModule=!0,t.classNamesShape=t.timeoutsShape=void 0,t.transitionTimeout=function(e){var t="transition"+e+"Timeout",n="transition"+e;return function(e){if(e[n]){if(null==e[t])return new Error(t+" wasn't supplied to CSSTransitionGroup: this can cause unreliable animations and won't be supported in a future version of React. See https://fb.me/react-animation-transition-group-timeout for more information.");if("number"!=typeof e[t])return new Error(t+" must be a number (in milliseconds)")}return null}};var r,o=(r=n(2598))&&r.__esModule?r:{default:r};t.timeoutsShape=o.default.oneOfType([o.default.number,o.default.shape({enter:o.default.number,exit:o.default.number}).isRequired]),t.classNamesShape=o.default.oneOfType([o.default.string,o.default.shape({enter:o.default.string,exit:o.default.string,active:o.default.string}),o.default.shape({enter:o.default.string,enterActive:o.default.string,exit:o.default.string,exitActive:o.default.string})])},4850:function(e,t,n){"use strict";var r=n(1464),o=60103,a=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var i=60109,l=60110,u=60112;t.Suspense=60113;var s=60115,c=60116;if("function"==typeof Symbol&&Symbol.for){var f=Symbol.for;o=f("react.element"),a=f("react.portal"),t.Fragment=f("react.fragment"),t.StrictMode=f("react.strict_mode"),t.Profiler=f("react.profiler"),i=f("react.provider"),l=f("react.context"),u=f("react.forward_ref"),t.Suspense=f("react.suspense"),s=f("react.memo"),c=f("react.lazy")}var p="function"==typeof Symbol&&Symbol.iterator;function d(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m={};function y(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||h}function g(){}function v(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||h}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(d(85));this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},g.prototype=y.prototype;var b=v.prototype=new g;b.constructor=v,r(b,y.prototype),b.isPureReactComponent=!0;var w={current:null},E=Object.prototype.hasOwnProperty,_={key:!0,ref:!0,__self:!0,__source:!0};function O(e,t,n){var r,a={},i=null,l=null;if(null!=t)for(r in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(i=""+t.key),t)E.call(t,r)&&!_.hasOwnProperty(r)&&(a[r]=t[r]);var u=arguments.length-2;if(1===u)a.children=n;else if(1<u){for(var s=Array(u),c=0;c<u;c++)s[c]=arguments[c+2];a.children=s}if(e&&e.defaultProps)for(r in u=e.defaultProps)void 0===a[r]&&(a[r]=u[r]);return{$$typeof:o,type:e,key:i,ref:l,props:a,_owner:w.current}}function S(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var x=/\/+/g;function k(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function C(e,t,n,r,i){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var u=!1;if(null===e)u=!0;else switch(l){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case o:case a:u=!0}}if(u)return i=i(u=e),e=""===r?"."+k(u,0):r,Array.isArray(i)?(n="",null!=e&&(n=e.replace(x,"$&/")+"/"),C(i,t,n,"",(function(e){return e}))):null!=i&&(S(i)&&(i=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,n+(!i.key||u&&u.key===i.key?"":(""+i.key).replace(x,"$&/")+"/")+e)),t.push(i)),1;if(u=0,r=""===r?".":r+":",Array.isArray(e))for(var s=0;s<e.length;s++){var c=r+k(l=e[s],s);u+=C(l,t,n,c,i)}else if(c=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof c)for(e=c.call(e),s=0;!(l=e.next()).done;)u+=C(l=l.value,t,n,c=r+k(l,s++),i);else if("object"===l)throw t=""+e,Error(d(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return u}function T(e,t,n){if(null==e)return e;var r=[],o=0;return C(e,r,"","",(function(e){return t.call(n,e,o++)})),r}function P(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var N={current:null};function I(){var e=N.current;if(null===e)throw Error(d(321));return e}var j={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:w,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:T,forEach:function(e,t,n){T(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return T(e,(function(){t++})),t},toArray:function(e){return T(e,(function(e){return e}))||[]},only:function(e){if(!S(e))throw Error(d(143));return e}},t.Component=y,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j,t.cloneElement=function(e,t,n){if(null==e)throw Error(d(267,e));var a=r({},e.props),i=e.key,l=e.ref,u=e._owner;if(null!=t){if(void 0!==t.ref&&(l=t.ref,u=w.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(c in t)E.call(t,c)&&!_.hasOwnProperty(c)&&(a[c]=void 0===t[c]&&void 0!==s?s[c]:t[c])}var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){s=Array(c);for(var f=0;f<c;f++)s[f]=arguments[f+2];a.children=s}return{$$typeof:o,type:e.type,key:i,ref:l,props:a,_owner:u}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:l,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:i,_context:e},e.Consumer=e},t.createElement=O,t.createFactory=function(e){var t=O.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=S,t.lazy=function(e){return{$$typeof:c,_payload:{_status:-1,_result:e},_init:P}},t.memo=function(e,t){return{$$typeof:s,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return I().useCallback(e,t)},t.useContext=function(e,t){return I().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return I().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return I().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return I().useLayoutEffect(e,t)},t.useMemo=function(e,t){return I().useMemo(e,t)},t.useReducer=function(e,t,n){return I().useReducer(e,t,n)},t.useRef=function(e){return I().useRef(e)},t.useState=function(e){return I().useState(e)},t.version="17.0.2"},8965:function(e,t,n){"use strict";e.exports=n(4850)},5043:function(e,t,n){var r;"undefined"!=typeof self&&self,r=function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=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},o=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}}(),a=u(n(1)),i=n(2),l=u(n(3));function u(e){return e&&e.__esModule?e:{default:e}}var s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.config=r({},e.defaultConfig,t),this.tagId=0,this.cache=[],this.generateDom=this.generateDom.bind(this),this.transform=this.transform.bind(this),this.getCache=this.getCache.bind(this),this.formatAttributes=this.formatAttributes.bind(this)}return o(e,[{key:"formatAttributes",value:function(e){var t=this,n={};return e.filter((function(e){var n=e.key;return t.config.ALLOWED_ATTRIBUTES.includes(n)})).forEach((function(e){var t=e.key,r=e.value;(0,l.default)(t),n[t]=r})),n}},{key:"generateDom",value:function(e){var t=e.type,n=void 0===t?"":t,o=e.children,i=void 0===o?[]:o,u=e.content,s=void 0===u?"":u,c=e.tagName,f=void 0===c?"":c,p=e.attributes,d=void 0===p?[]:p,h=this.config,m=h.ALLOWED_TAGS,y=h.KEY_NAME,g=i.length?i.map(this.generateDom):s;if("element"===n&&m.includes(f)){(0,l.default)(f);var v=r({},this.formatAttributes(d),{key:""+y+this.tagId++});return g?a.default.createElement(f,v,g):a.default.createElement(f,v)}return g}},{key:"getCache",value:function(e){return this.cache.find((function(t){return t.str===e}))}},{key:"transform",value:function(e){var t=this.getCache(e);if(t)return t.dom;var n=(0,i.parse)(e).map(this.generateDom);return this.cache.push({str:e,dom:n}),n}}]),e}();s.defaultConfig={ALLOWED_TAGS:["strong","a"],ALLOWED_ATTRIBUTES:["href"],KEY_NAME:"ssih-tag-"},t.default=s},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e in o.attributes&&console.warn(o.attributes[e].replace("%s","attribute "+e)),e in o.tags&&console.warn(o.tags[e].replace("%s","tag <"+e+" />"))};var r="Be careful with the use of %s, it presents a potential XSS risk",o=t.messages={attributes:{ontransitionend:r,ontransitioncancel:r,onblur:r,ondrag:r,ondrop:r},tags:{script:r,style:r}}}])},e.exports=r(n(8965),n(9932))},3680:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}}),e=n.hmd(e);var r=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:e)},819:function(e,t,n){"use strict";var r=n(1464),o=n(8965);t.useSubscription=function(e){var t=e.getCurrentValue,n=e.subscribe,a=o.useState((function(){return{getCurrentValue:t,subscribe:n,value:t()}}));e=a[0];var i=a[1];return a=e.value,e.getCurrentValue===t&&e.subscribe===n||(a=t(),i({getCurrentValue:t,subscribe:n,value:a})),o.useDebugValue(a),o.useEffect((function(){function e(){if(!o){var e=t();i((function(o){return o.getCurrentValue!==t||o.subscribe!==n||o.value===e?o:r({},o,{value:e})}))}}var o=!1,a=n(e);return e(),function(){o=!0,a()}}),[t,n]),a}},6442:function(e,t,n){"use strict";e.exports=n(819)},2965:function(e,t,n){"use strict";n.d(t,{default:function(){return Im},h:function(){return Tm}});var r={};n.r(r);var o={};n.r(o);var a={};n.r(a);var i={};n.r(i);var l={};n.r(l);var u={};n.r(u);var s={};n.r(s);var c={};n.r(c);var f={};n.r(f);var p={};n.r(p);var d={};n.r(d);var h={};n.r(h);var m={};n.r(m);var y=n(8965),g=n(3102),v=n(2598),b=n.n(v),w=y.createContext(null),E=function(e){e()},_=function(){return E},O={notify:function(){}},S=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=O,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=function(){var e=_(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())},t.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=O)},e}(),x="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?y.useLayoutEffect:y.useEffect,k=function(e){var t=e.store,n=e.context,r=e.children,o=(0,y.useMemo)((function(){var e=new S(t);return e.onStateChange=e.notifyNestedSubs,{store:t,subscription:e}}),[t]),a=(0,y.useMemo)((function(){return t.getState()}),[t]);x((function(){var e=o.subscription;return e.trySubscribe(),a!==t.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[o,a]);var i=n||w;return y.createElement(i.Provider,{value:o},r)};n(3578),n(8485);var C=n(3680),T=function(){return Math.random().toString(36).substring(7).split("").join(".")},P={INIT:"@@redux/INIT"+T(),REPLACE:"@@redux/REPLACE"+T(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+T()}};function N(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function I(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(I)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,a=t,i=[],l=i,u=!1;function s(){l===i&&(l=i.slice())}function c(){if(u)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function f(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(u)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var t=!0;return s(),l.push(e),function(){if(t){if(u)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");t=!1,s();var n=l.indexOf(e);l.splice(n,1),i=null}}}function p(e){if(!N(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,a=o(a,e)}finally{u=!1}for(var t=i=l,n=0;n<t.length;n++)(0,t[n])();return e}function d(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,p({type:P.REPLACE})}function h(){var e,t=f;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(c())}return n(),{unsubscribe:t(n)}}})[C.Z]=function(){return this},e}return p({type:P.INIT}),(r={dispatch:p,subscribe:f,getState:c,replaceReducer:d})[C.Z]=h,r}function j(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+String(n)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(n,!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function L(){return L=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},L.apply(this,arguments)}function F(){return(0,y.useContext)(w)}function z(e){void 0===e&&(e=w);var t=e===w?F:function(){return(0,y.useContext)(e)};return function(){return t().store}}var U=z();function V(e){void 0===e&&(e=w);var t=e===w?U:z(e);return function(){return t().dispatch}}var H=V(),B=function(e,t){return e===t};function W(e){void 0===e&&(e=w);var t=e===w?F:function(){return(0,y.useContext)(e)};return function(e,n){void 0===n&&(n=B);var r=t(),o=function(e,t,n,r){var o,a=(0,y.useReducer)((function(e){return e+1}),0)[1],i=(0,y.useMemo)((function(){return new S(n,r)}),[n,r]),l=(0,y.useRef)(),u=(0,y.useRef)(),s=(0,y.useRef)(),c=(0,y.useRef)(),f=n.getState();try{if(e!==u.current||f!==s.current||l.current){var p=e(f);o=void 0!==c.current&&t(p,c.current)?c.current:p}else o=c.current}catch(e){throw l.current&&(e.message+="\nThe error may be correlated with this previous error:\n"+l.current.stack+"\n\n"),e}return x((function(){u.current=e,s.current=f,c.current=o,l.current=void 0})),x((function(){function e(){try{var e=u.current(n.getState());if(t(e,c.current))return;c.current=e}catch(e){l.current=e}a()}return i.onStateChange=e,i.trySubscribe(),e(),function(){return i.tryUnsubscribe()}}),[n,i]),o}(e,n,r.store,r.subscription);return(0,y.useDebugValue)(o),o}}var K,q=W();function Y(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 G(e,t){if(e){if("string"==typeof e)return Y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Y(e,t):void 0}}function $(e){return function(e){if(Array.isArray(e))return Y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||G(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}K=g.unstable_batchedUpdates,E=K;var X,Q,J,Z,ee=n(2580),te=n.n(ee),ne=n(998);X={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},Q=["(","?"],J={")":["("],":":["?","?:"]},Z=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;var re={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,n){if(e)throw t;return n}};var oe={contextDelimiter:"",onMissingKey:null};function ae(e,t){var n;for(n in this.data=e,this.pluralForms={},this.options={},oe)this.options[n]=void 0!==t&&n in t?t[n]:oe[n]}ae.prototype.getPluralForm=function(e,t){var n,r,o,a,i=this.pluralForms[e];return i||("function"!=typeof(o=(n=this.data[e][""])["Plural-Forms"]||n["plural-forms"]||n.plural_forms)&&(r=function(e){var t,n,r;for(t=e.split(";"),n=0;n<t.length;n++)if(0===(r=t[n].trim()).indexOf("plural="))return r.substr(7)}(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),a=function(e){var t=function(e){for(var t,n,r,o,a=[],i=[];t=e.match(Z);){for(n=t[0],(r=e.substr(0,t.index).trim())&&a.push(r);o=i.pop();){if(J[n]){if(J[n][0]===o){n=J[n][1]||n;break}}else if(Q.indexOf(o)>=0||X[o]<X[n]){i.push(o);break}a.push(o)}J[n]||i.push(n),e=e.substr(t.index+n.length)}return(e=e.trim())&&a.push(e),a.concat(i.reverse())}(e);return function(e){return function(e,t){var n,r,o,a,i,l,u=[];for(n=0;n<e.length;n++){if(i=e[n],a=re[i]){for(r=a.length,o=Array(r);r--;)o[r]=u.pop();try{l=a.apply(null,o)}catch(e){return e}}else l=t.hasOwnProperty(i)?t[i]:+i;u.push(l)}return u[0]}(t,e)}}(r),o=function(e){return+a({n:e})}),i=this.pluralForms[e]=o),i(t)},ae.prototype.dcnpgettext=function(e,t,n,r,o){var a,i,l;return a=void 0===o?0:this.getPluralForm(e,o),i=n,t&&(i=t+this.options.contextDelimiter+n),(l=this.data[e][i])&&l[a]?l[a]:(this.options.onMissingKey&&this.options.onMissingKey(n,e),0===a?n:r)};var ie=n(8865),le=n.n(ie),ue=n(8519),se=n.n(ue),ce=n(696),fe=/%(((\d+)\$)|(\(([$_a-zA-Z][$_a-zA-Z0-9]*)\)))?[ +0#-]*\d*(\.(\d+|\*))?(ll|[lhqL])?([cduxXefgsp%])/g;function pe(e,t){var n;if(!Array.isArray(t))for(t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return n=1,e.replace(fe,(function(){var e,r,o,a,i;return e=arguments[3],r=arguments[5],"%"===(a=arguments[9])?"%":("*"===(o=arguments[7])&&(o=t[n-1],n++),void 0!==r?t[0]&&"object"==typeof t[0]&&t[0].hasOwnProperty(r)&&(i=t[0][r]):(void 0===e&&(e=n),n++,i=t[e-1]),"f"===a?i=parseFloat(i)||0:"d"===a&&(i=parseInt(i)||0),void 0!==o&&("f"===a?i=i.toFixed(o):"s"===a&&(i=i.substr(0,o))),null!=i?i:"")}))}function de(e,t,n,r){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var o=isFinite(+e)?+e:0,a=isFinite(+t)?Math.abs(t):0,i=void 0===r?",":r,l=void 0===n?".":n,u="";return u=(a?function(e,t){var n=Math.pow(10,t);return""+(Math.round(e*n)/n).toFixed(t)}(o,a):""+Math.round(o)).split("."),u[0].length>3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(u[1]||"").length<a&&(u[1]=u[1]||"",u[1]+=new Array(a-u[1].length+1).join("0")),u.join(l)}var he=te()("i18n-calypso"),me="number_format_decimals",ye="number_format_thousands_sep",ge="messages",ve=[function(e){return e}],be={};function we(){xe.throwErrors&&"undefined"!=typeof window&&window.console&&window.console.warn&&window.console.warn.apply(window.console,arguments)}function Ee(e){return Array.prototype.slice.call(e)}function _e(e){var t=e[0];("string"!=typeof t||e.length>3||e.length>2&&"object"==typeof e[1]&&"object"==typeof e[2])&&we("Deprecated Invocation: `translate()` accepts ( string, [string], [object] ). These arguments passed:",Ee(e),". See https://github.com/Automattic/i18n-calypso#translate-method"),2===e.length&&"string"==typeof t&&"string"==typeof e[1]&&we("Invalid Invocation: `translate()` requires an options object for plural translations, but passed:",Ee(e));for(var n={},r=0;r<e.length;r++)"object"==typeof e[r]&&(n=e[r]);if("string"==typeof t?n.original=t:"object"==typeof n.original&&(n.plural=n.original.plural,n.count=n.original.count,n.original=n.original.single),"string"==typeof e[1]&&(n.plural=e[1]),void 0===n.original)throw new Error("Translate called without a `string` value as first argument.");return n}function Oe(e,t){return e.dcnpgettext(ge,t.context,t.original,t.plural,t.count)}function Se(e,t){for(var n=ve.length-1;n>=0;n--){var r=ve[n](Object.assign({},t)),o=r.context?r.context+""+r.original:r.original;if(e.state.locale[o])return Oe(e.state.tannin,r)}return null}function xe(){if(!(this instanceof xe))return new xe;this.defaultLocaleSlug="en",this.defaultPluralForms=function(e){return 1===e?0:1},this.state={numberFormatSettings:{},tannin:void 0,locale:void 0,localeSlug:void 0,textDirection:void 0,translations:le()({max:100})},this.componentUpdateHooks=[],this.translateHooks=[],this.stateObserver=new ce.EventEmitter,this.stateObserver.setMaxListeners(0),this.configure()}xe.throwErrors=!1,xe.prototype.on=function(){var e;(e=this.stateObserver).on.apply(e,arguments)},xe.prototype.off=function(){var e;(e=this.stateObserver).off.apply(e,arguments)},xe.prototype.emit=function(){var e;(e=this.stateObserver).emit.apply(e,arguments)},xe.prototype.numberFormat=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="number"==typeof t?t:t.decimals||0,r=t.decPoint||this.state.numberFormatSettings.decimal_point||".",o=t.thousandsSep||this.state.numberFormatSettings.thousands_sep||",";return de(e,n,r,o)},xe.prototype.configure=function(e){Object.assign(this,e||{}),this.setLocale()},xe.prototype.setLocale=function(e){var t,n,r,o,a,i;if(e&&e[""]&&e[""]["key-hash"]){var l=e[""]["key-hash"],u=function(e,t){var n=!1===t?"":String(t);if(void 0!==be[n+e])return be[n+e];var r=se()().update(e).digest("hex");return be[n+e]=t?r.substr(0,t):r},s=function(e){return function(t){return t.context?(t.original=u(t.context+String.fromCharCode(4)+t.original,e),delete t.context):t.original=u(t.original,e),t}};if("sha1"===l.substr(0,4))if(4===l.length)ve.push(s(!1));else{var c=l.substr(5).indexOf("-");if(c<0){var f=Number(l.substr(5));ve.push(s(f))}else for(var p=Number(l.substr(5,c)),d=Number(l.substr(6+c)),h=p;h<=d;h++)ve.push(s(h))}}if(e&&e[""].localeSlug)if(e[""].localeSlug===this.state.localeSlug){if(e===this.state.locale)return;Object.assign(this.state.locale,e)}else this.state.locale=Object.assign({},e);else this.state.locale={"":{localeSlug:this.defaultLocaleSlug,plural_forms:this.defaultPluralForms}};this.state.localeSlug=this.state.locale[""].localeSlug,this.state.textDirection=(null===(t=this.state.locale["text directionltr"])||void 0===t?void 0:t[0])||(null===(n=this.state.locale[""])||void 0===n||null===(r=n.momentjs_locale)||void 0===r?void 0:r.textDirection),this.state.tannin=new ae((o={},a=ge,i=this.state.locale,a in o?Object.defineProperty(o,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[a]=i,o)),this.state.numberFormatSettings.decimal_point=Oe(this.state.tannin,_e([me])),this.state.numberFormatSettings.thousands_sep=Oe(this.state.tannin,_e([ye])),this.state.numberFormatSettings.decimal_point===me&&(this.state.numberFormatSettings.decimal_point="."),this.state.numberFormatSettings.thousands_sep===ye&&(this.state.numberFormatSettings.thousands_sep=","),this.stateObserver.emit("change")},xe.prototype.getLocale=function(){return this.state.locale},xe.prototype.getLocaleSlug=function(){return this.state.localeSlug},xe.prototype.isRtl=function(){return"rtl"===this.state.textDirection},xe.prototype.addTranslations=function(e){for(var t in e)""!==t&&(this.state.tannin.data.messages[t]=e[t]);this.stateObserver.emit("change")},xe.prototype.hasTranslation=function(){return!!Se(this,_e(arguments))},xe.prototype.translate=function(){var e=_e(arguments),t=Se(this,e);if(t||(t=Oe(this.state.tannin,e)),e.args){var n=Array.isArray(e.args)?e.args.slice(0):[e.args];n.unshift(t);try{t=pe.apply(void 0,$(n))}catch(e){if(!window||!window.console)return;var r=this.throwErrors?"error":"warn";"string"!=typeof e?window.console[r](e):window.console[r]("i18n sprintf error:",n)}}return e.components&&(t=(0,ne.Z)({mixedString:t,components:e.components,throwErrors:this.throwErrors})),this.translateHooks.forEach((function(n){t=n(t,e)})),t},xe.prototype.reRenderTranslations=function(){he("Re-rendering all translations due to external request"),this.stateObserver.emit("change")},xe.prototype.registerComponentUpdateHook=function(e){this.componentUpdateHooks.push(e)},xe.prototype.registerTranslateHook=function(e){this.translateHooks.push(e)};var ke=xe;var Ce=n(6442),Te=n(9760),Pe=new ke,Ne=Pe,Ie=(Pe.numberFormat.bind(Pe),Pe.translate.bind(Pe)),je=(Pe.configure.bind(Pe),Pe.setLocale.bind(Pe),Pe.getLocale.bind(Pe),Pe.getLocaleSlug.bind(Pe),Pe.addTranslations.bind(Pe),Pe.reRenderTranslations.bind(Pe),Pe.registerComponentUpdateHook.bind(Pe),Pe.registerTranslateHook.bind(Pe),Pe.state,Pe.stateObserver,Pe.on.bind(Pe),Pe.off.bind(Pe),Pe.emit.bind(Pe),function(e){e.numberFormat.bind(e),e.translate.bind(e)}(Pe),function(e){var t={getCurrentValue:function(){return e.isRtl()},subscribe:function(t){return e.on("change",t),function(){return e.off("change",t)}}};function n(){return(0,Ce.useSubscription)(t)}var r,o,a=(r=function(e){return(0,y.forwardRef)((function(t,r){var o=n();return y.createElement(e,L({},t,{isRtl:o,ref:r}))}))},o="WithRTL",function(e){var t=r(e),n=e.displayName,a=void 0===n?e.name||"Component":n;return t.displayName="".concat((0,Te.upperFirst)((0,Te.camelCase)(o)),"(").concat(a,")"),t});return{useRtl:n,withRtl:a}}(Pe)),Re=(je.useRtl,je.withRtl,{SECURITY_DASHBOARD:"SECURITY_DASHBOARD",LOGIN_SETTINGS:"LOGIN_SETTINGS",SITE_SECURITY:"SITE_SECURITY",ACTIVITY_LOG:"ACTIVITY_LOG",POST_HACK_ACTIONS:"POST_HACK_ACTIONS"}),Ae=window.navigator.userAgent.toLowerCase(),De=function(e){return-1!==Ae.indexOf(e)},Me=De("opera"),Le=De("fxios"),Fe=De("firefox"),ze=De("safari"),Ue=!document.documentMode&&!!window.StyleMedia,Ve=De("crios"),He=De("chrome")||Ve,Be=De("chromium"),We=(He||Me)&&!!window.CSS,Ke=function(){return Ue?"edge":Ve?"crios":He?"chrome":Be?"chromium":Me?"opera":We?"blink":Le?"fxios":Fe?"firefox":ze?"safari":""},qe=function(){var e=new RegExp(Ke()+"/([0-9.]+)"),t=Ae.match(e);if(ze&&!He&&!Fe&&!Le){var n=new RegExp("version/([0-9.]+)"),r=Ae.match(n);return parseInt(r[1].split(".").join("").padEnd(4,"0"))}return t.length>0?parseInt(t[1]):0},Ye=function(){return De("windows")},Ge=function(){return!Ye()&&De("iphone")},$e=function(){return De("ipod")},Xe=function(){return De("ipad")},Qe=function(){return Ge()||$e()||Xe()},Je=function(){return!Ye()&&De("android")},Ze=function(){return De("blackberry")||De("bb10")||De("rim")},et=function(){return Ye()&&De("phone")},tt=function(){return(De("(mobile;")||De("(tablet;"))&&De("; rv:")},nt=function(){return Je()&&De("mobile")||Ge()||$e()||et()||Ze()&&!De("tablet")||tt()&&De("mobile")||De("meego")},rt=function(){return window.innerWidth<=800||nt()},ot=function(){return Xe()||Je()&&!De("mobile")||Ze()&&De("tablet")||Ye()&&De("touch")&&!et()||tt()&&De("tablet")},at=function(){return window.innerWidth>800&&window.innerWidth<=1500||ot()};function it(){return{isDesktop:window.innerWidth>=1500||!at()&&!rt(),isDevicePhone:nt(),isDeviceTablet:ot(),isPhone:rt(),isTablet:at(),isPortrait:window.innerHeight/window.innerWidth>1,isLandscape:window.innerHeight/window.innerWidth<1,isTelevision:!!["googletv","viera","smarttv","internet.tv","netcast","nettv","appletv","boxee","kylo","roku","dlnadoc","roku","pov_tv","hbbtv","ce-html"].find((function(e){return De(e)})),browser:{name:Ke(),version:qe(),isSupported:(e=qe(),!!e&&(Ue?e>=15:He||Me||We?e>=58:Fe?e>=54:Le?e>=16:ze?e>=1012:Fe||ze||Ue||He||We))},height:window.innerHeight,width:window.innerWidth};var e}var lt,ut={config:{assetsPath:function(){var e="";try{e=process&&process.env&&process.env.ASSETS_PATH}catch(e){}return e||"https://d2vwyrahnvh3s3.cloudfront.net/styleguide/v2.3.2/assets"}()},device:it()},st=y.createContext(ut),ct=(lt=function(e,t){return lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},lt(e,t)},function(e,t){function n(){this.constructor=e}lt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),ft=function(){return ft=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ft.apply(this,arguments)},pt=function(e){var t;return t=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.state={device:it()},e.timeout=null,e.onResize=function(){e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout((function(){var t=it();e.setState({device:t},(function(){return e.props.onResize(t)}))}),300)},e}return ct(n,t),n.prototype.componentDidMount=function(){window.addEventListener("resize",this.onResize),this.props.onInit(this.state.device)},n.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.onResize)},n.prototype.render=function(){var t=this.props,n=(t.onInit,t.onResize,t.children),r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["onInit","onResize","children"]);return y.createElement(e,ft({device:this.state.device},r),n)},n}(y.Component),t.defaultProps={onInit:function(){return null},onResize:function(){return null}},t},dt=function(){return dt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},dt.apply(this,arguments)},ht=pt((function(e){var t=e.context,n=void 0===t?{}:t,r=e.device,o=e.children,a=dt(dt(dt({},ut),{device:r}),n);return y.createElement(st.Provider,{value:a},o)})),mt=n(3381),yt=n.n(mt),gt=function(){return gt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},gt.apply(this,arguments)};function vt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(Boolean).join(" ")}function bt(e){var t=e.styles,n=e.classes,r=e.className,o=yt().bind(t),a={};return r&&(a[""+r]=!0),o(gt(gt({},n),a))}var wt=function(e){var t={};return e.map((function(e){e.props.map((function(n){return t[""+e.class+n]=n===e.selected}))})),t},Et="navigation",_t=function(){window.dispatchEvent(new Event(Et))},Ot=function(){return Ot=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ot.apply(this,arguments)},St=Array.from(new Set(["accept","accept-charset","accesskey","action","alt","async","autocomplete","autofocus","autoplay","charset","checked","cite","class","cols","colspan","content","contenteditable","controls","coords","data","datetime","default","defer","dir","dirname","disabled","download","draggable","dropzone","enctype","for","form","formaction","headers","height","hidden","high","href","hreflang","http-equiv","id","ismap","kind","label","lang","list","loop","low","max","maxlength","media","method","min","multiple","muted","name","novalidate","onabort","onafterprint","onbeforeprint","onbeforeunload","onblur","oncanplay","oncanplaythrough","onchange","onclick","oncontextmenu","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onoffline","ononline","onpageshow","onpaste","onpause","onplay","onplaying","onprogress","onratechange","onreset","onresize","onscroll","onsearch","onseeked","onseeking","onselect","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","onunload","onvolumechange","onwaiting","onwheel","open","optimum","pattern","placeholder","poster","preload","readonly","rel","required","reversed","role","rows","rowspan","sandbox","scope","selected","shape","size","sizes","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","type","usemap","value","width","wrap"].concat(["children","dangerouslysetinnerhtml","oncopy","oncopycapture","oncut","oncutcapture","onpaste","onpastecapture","oncompositionend","oncompositionendcapture","oncompositionstart","oncompositionstartcapture","oncompositionupdate","oncompositionupdatecapture","onfocus","onfocuscapture","onblur","onblurcapture","onchange","onchangecapture","onbeforeinput","onbeforeinputcapture","oninput","oninputcapture","onreset","onresetcapture","onsubmit","onsubmitcapture","oninvalid","oninvalidcapture","onload","onloadcapture","onerror","onerrorcapture","onkeydown","onkeydowncapture","onkeypress","onkeypresscapture","onkeyup","onkeyupcapture","onabort","onabortcapture","oncanplay","oncanplaycapture","oncanplaythrough","oncanplaythroughcapture","ondurationchange","ondurationchangecapture","onemptied","onemptiedcapture","onencrypted","onencryptedcapture","onended","onendedcapture","onloadeddata","onloadeddatacapture","onloadedmetadata","onloadedmetadatacapture","onloadstart","onloadstartcapture","onpause","onpausecapture","onplay","onplaycapture","onplaying","onplayingcapture","onprogress","onprogresscapture","onratechange","onratechangecapture","onseeked","onseekedcapture","onseeking","onseekingcapture","onstalled","onstalledcapture","onsuspend","onsuspendcapture","ontimeupdate","ontimeupdatecapture","onvolumechange","onvolumechangecapture","onwaiting","onwaitingcapture","onclick","onclickcapture","oncontextmenu","oncontextmenucapture","ondoubleclick","ondoubleclickcapture","ondrag","ondragcapture","ondragend","ondragendcapture","ondragenter","ondragentercapture","ondragexit","ondragexitcapture","ondragleave","ondragleavecapture","ondragover","ondragovercapture","ondragstart","ondragstartcapture","ondrop","ondropcapture","onmousedown","onmousedowncapture","onmouseenter","onmouseleave","onmousemove","onmousemovecapture","onmouseout","onmouseoutcapture","onmouseover","onmouseovercapture","onmouseup","onmouseupcapture","onselect","onselectcapture","ontouchcancel","ontouchcancelcapture","ontouchend","ontouchendcapture","ontouchmove","ontouchmovecapture","ontouchstart","ontouchstartcapture","onpointerdown","onpointerdowncapture","onpointermove","onpointermovecapture","onpointerup","onpointerupcapture","onpointercancel","onpointercancelcapture","onpointerenter","onpointerentercapture","onpointerleave","onpointerleavecapture","onpointerover","onpointerovercapture","onpointerout","onpointeroutcapture","ongotpointercapture","ongotpointercapturecapture","onlostpointercapture","onlostpointercapturecapture","onscroll","onscrollcapture","onwheel","onwheelcapture","onanimationstart","onanimationstartcapture","onanimationend","onanimationendcapture","onanimationiteration","onanimationiterationcapture","ontransitionend","ontransitionendcapture"]))).reduce((function(e,t){var n;return Ot(Ot({},e),((n={})[t]=!0,n))}),{});function xt(e){var t,n,r=Object.keys(e),o={};try{for(var a=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(r),i=a.next();!i.done;i=a.next()){var l=i.value,u=l.toLocaleLowerCase();(St[u]||u.startsWith("data-")||u.startsWith("aria-"))&&(o[l]=e[l])}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o}var kt={UP:"ArrowUp",DOWN:"ArrowDown",LEFT:"ArrowLeft",RIGHT:"ArrowRight",HOME:"Home",END:"End",ENTER:"Enter",BACKSPACE:"Backspace",ESCAPE:"Escape",COMMA:",",TAB:"Tab",META:"Meta",CONTROL:"Control",A:"a",C:"c",V:"v",SPACE:" "},Ct=kt,Tt=function(e){return e.key===kt.TAB&&!e.shiftKey},Pt=function(e){return e.key===kt.TAB&&e.shiftKey},Nt=function(){return Nt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Nt.apply(this,arguments)},It="sg-keyboard",jt=function(e){switch(e.key){case Ct.TAB:case Ct.UP:case Ct.RIGHT:case Ct.DOWN:case Ct.LEFT:document.body.classList.add(It)}},Rt=function(){return document.body.classList.add(It)},At=function(){return document.body.classList.remove(It)},Dt=function(e){var t=e.children,n=e.context,r=e.device,o=e.headerContent,a=e.pageContent,i=e.drawerContent,l=e.isDrawerOpened,u=e.layout,s=e.onDrawerOverlayClick,c=e.position,f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","context","device","headerContent","pageContent","drawerContent","isDrawerOpened","layout","onDrawerOverlayClick","position"]),p=vt("sg-layout","sg-layout--"+c),d=vt("sg-layout__drawer",u&&"sg-layout__drawer--"+u,l&&"sg-layout__drawer--opened"),h=vt("sg-drawer__overlay",l&&"sg-drawer__overlay--opened");return y.useEffect((function(){return window.addEventListener(Et,Rt),window.addEventListener("keydown",jt),window.addEventListener("click",At),function(){window.removeEventListener(Et,Rt),window.removeEventListener("keydown",jt),window.removeEventListener("click",At)}}),[]),y.createElement(st.Provider,{value:Nt(Nt(Nt({},ut),{device:r}),n)},y.createElement("div",Nt({className:p},xt(f),{"data-e2e":e["data-e2e"]}),o,y.createElement("div",{className:"sg-layout__wrapper"},i&&y.createElement("aside",{className:d},i),y.createElement("main",{className:"sg-layout__page"},a,t),y.createElement("div",{className:h,onClick:s}))))};Dt.defaultProps={"data-e2e":"layout",position:"absolute"};var Mt=pt(Dt);function Lt(e,t){if("string"==typeof t)return{top:t,right:t,bottom:t,left:t};var n=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(t,4),r=n[0],o=n[1],a=n[2],i=n[3];switch(t.length){case 2:return{top:r,right:o,bottom:r,left:o};case 3:return{top:r,right:o,bottom:a,left:o};case 4:return{top:r,right:o,bottom:a,left:i};default:throw new Error("The array with "+e+" must contain max 4 settings [top, right, bottom, left]")}}var Ft=["small","medium","large","x-large"],zt=function(){return Ft},Ut=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Vt=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ut(arguments[t]));return e}(["inherit","none"],["xx-small","x-small","small","medium","large","x-large","xx-large"],["responsive"]),Ht=function(){return Vt},Bt=function(){return Bt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Bt.apply(this,arguments)},Wt=function(e){if(!e)return null;var t=Lt("padding",e),n=[{class:"sg-with-padding--padding-top-",props:Ht(),selected:t.top},{class:"sg-with-padding--padding-right-",props:Ht(),selected:t.right},{class:"sg-with-padding--padding-bottom-",props:Ht(),selected:t.bottom},{class:"sg-with-padding--padding-left-",props:Ht(),selected:t.left}];return bt({styles:r.default,classes:Bt({"sg-with-padding":!0},wt(n))})},Kt=function(){return Kt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kt.apply(this,arguments)},qt=y.forwardRef((function(e,t){var n=e.children,r=e.padding,o=e.className,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","padding","className"]),i=vt("sg-page",Wt(r),o);return y.createElement("div",Kt({className:i},xt(a),{ref:t,"data-component":"page"}),n)}));qt.defaultProps={"data-e2e":"page"};var Yt=qt,Gt=n(6285),$t=function(){return $t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},$t.apply(this,arguments)},Xt=function(e){var t=e.className,n=e.children,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","children"]),o=vt("sg-notifications",0===n.length&&"sg-notifications-is-empty",t);return y.createElement(Gt.TransitionGroup,$t({className:o},xt(r),{role:"alert"}),n)},Qt=new(function(){function e(){this.subscribers=[]}return e.prototype.subscribe=function(e){this.subscribers.push(e)},e.prototype.emit=function(e){this.subscribers.forEach((function(t){return t(e)}))},e.prototype.unsubscribe=function(e){this.subscribers.filter((function(t){return t!==e}))},e.prototype.success=function(e,t){void 0===t&&(t=null),this.emit({id:+new Date,type:"success",message:e,title:t})},e.prototype.error=function(e,t){void 0===t&&(t=null),this.emit({id:+new Date,type:"error",message:e,title:t})},e}()),Jt=["A","BUTTON","INPUT","TEXTAREA"],Zt=function(e){var t=Jt.includes(e.nodeName),n=null!==e.getAttribute("tabindex");return(t||n)&&!function(e){var t=e.getAttribute("disabled"),n=e.getAttribute("data-disabled");return""===t||"true"===t||""===n||"true"===n}(e)},en=function(){return en=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},en.apply(this,arguments)},tn={event:null,includeChildren:!1,isDirectionForward:!0,onComponentFiltering:function(){return!0},onSuccessCallback:function(){return!0}},nn=function(e){var t=en(en({},tn),e),n=t.event,r=t.includeChildren,o=t.startingElement,a=void 0===o?document.activeElement:o,i=t.isDirectionForward,l=t.onComponentFiltering,u=t.onSuccessCallback,s=i?1:-1,c=Array.from(document.body.querySelectorAll("*")).filter((function(e){return e===a||e.getAttribute("data-component")&&Zt(e)&&l(e)})).filter((function(e){return a===e||!!r||!1===a.contains(e)})),f=c.findIndex((function(e){return e===a})),p=c[f+s];p&&(p.focus(),function(e){e.preventDefault(),e.stopPropagation(),_t()}(n),u(p))},rn=["primary","success","warning","error","info","instruction","white","light","dark"],on=function(){return on=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},on.apply(this,arguments)},an=function(e){return void 0===e&&(e=null),bt({styles:o.default,classes:on({"sg-with-color":!0},wt([{class:"sg-with-color--color-",props:rn,selected:e}]))})},ln=0,un=function(e){return void 0===e&&(e="sg"),""+e+ ++ln},sn=function(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left||t.x,right:t.top||t.y,top:t.top,width:t.width}},cn=function(e){var t=e.target,n=e.property,r=e.value;try{t.style[n]=r}catch(e){t.setAttribute(n,r),t.setAttribute("style",t.getAttribute("style")+";"+n+":"+r)}},fn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),pn=function(){return pn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},pn.apply(this,arguments)},dn=function(e){function t(t){var n=e.call(this,t)||this;return n.node=null,n.node=y.createRef(),n}return fn(t,e),t.prototype.componentDidMount=function(){this.setPosition()},t.prototype.setPosition=function(){var e=this.props.target,t=sn(e),n=t.left+t.width/2,r=t.top+t.height/2,o=window.innerWidth/2,a=this.node.current.offsetWidth/2,i=window.innerHeight-r>t.height/2+this.node.current.offsetHeight+5;if(n<o){var l=t.left+t.width/2-a,u=l>0?l:0;cn({target:this.node.current,property:"left",value:u+"px"})}else{var s=t.left+t.width/2+a,c=window.innerWidth-s>0?window.innerWidth-s:0;cn({target:this.node.current,property:"right",value:c+"px"})}if(i){var f=t.height+t.top+window.pageYOffset+10;cn({target:this.node.current,property:"top",value:f+"px"})}else{var p=window.innerHeight-r+t.height/2+10;cn({target:this.node.current,property:"bottom",value:p+"px"})}},t.prototype.render=function(){var e=this.props,t=e.className,n=e.children,r=e.tooltipSize,o=(e.target,e.background),a=e.density,i=e.tooltipId,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","children","tooltipSize","target","background","density","tooltipId"]),u=vt("sg-tooltip",r&&"sg-tooltip--size-"+r,o&&"sg-tooltip--background-"+o,a&&"sg-tooltip--density-"+a,t);return g.createPortal(y.createElement("div",pn({ref:this.node,className:u,role:"tooltip","aria-hidden":"false",id:i},l),n),document.body)},t.defaultProps={"data-e2e":"tooltip",background:"black",density:"cozy"},t}(y.PureComponent),hn=dn,mn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yn=function(){return yn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},yn.apply(this,arguments)},gn=function(e,t){void 0===t&&(t={});var n=function(n){function r(){var e=null!==n&&n.apply(this,arguments)||this;return e.state={target:null,isTooltipVisible:!1},e.timeoutId=null,e.handleEnter=function(n){clearTimeout(e.timeoutId);var r="svg"===n.currentTarget.nodeName?n.currentTarget.parentElement:n.currentTarget;t.delay?e.timeoutId=setTimeout((function(){return e.showTooltip(r)}),t.delay):e.showTooltip(r)},e.showTooltip=function(t){e.setState({target:t,isTooltipVisible:!0},(function(){e.isMobileSafari&&(document.removeEventListener("touchend",e.handleTouchEndOnMobileSafari),document.addEventListener("touchend",e.handleTouchEndOnMobileSafari))}))},e.hideTooltip=function(){clearTimeout(e.timeoutId),e.setState({isTooltipVisible:!1}),e.isMobileSafari&&document.removeEventListener("touchend",e.handleTouchEndOnMobileSafari)},e.handleTouchEndOnMobileSafari=function(t){var n=e.state,r=n.isTooltipVisible,o=n.target;o===t.target||o.contains(t.target)||t.target.className&&t.target.className.indexOf("sg-tooltip")>=0||r&&(o!==document.activeElement&&o.focus(),o.blur())},e}return mn(r,n),Object.defineProperty(r.prototype,"isMobileSafari",{get:function(){var e=this.props.device;return e.isDevicePhone&&"safari"===e.browser.name},enumerable:!0,configurable:!0}),r.prototype.componentWillUnmount=function(){this.isMobileSafari&&document.removeEventListener("touchend",this.handleTouchEndOnMobileSafari)},r.prototype.render=function(){var n=this.props,r=n.device,o=n.tooltip,a=void 0===o?t.tooltip:o,i=n.tooltipSize,l=n.forwardRef,u=n.background,s=n.density,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(n,["device","tooltip","tooltipSize","forwardRef","background","density"]),f=this.state,p=f.target,d=f.isTooltipVisible,h=t.preventTooltipOnMobile,m=Boolean(d&&a);h&&(m=!r.isDevicePhone&&!r.isDeviceTablet&&m);var g=un();return y.createElement(y.Fragment,null,y.createElement(e,yn({},c,{ref:l,device:r,onMouseEnter:this.handleEnter,onMouseLeave:this.hideTooltip,onFocus:this.handleEnter,onBlur:this.hideTooltip,"aria-describedby":g})),m&&y.createElement(hn,{target:p,tooltipId:g,tooltipSize:i,background:u,density:s},a))},r.defaultProps={},r}(y.Component);return y.forwardRef((function(e,t){return y.createElement(st.Consumer,null,(function(r){var o=r.device;return y.createElement(n,yn({},e,{device:o,forwardRef:t}))}))}))},vn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),bn=function(){return bn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},bn.apply(this,arguments)},wn=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},En={exceptionIcons:{empty:" ",e2e:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle class="st0" cx="16" cy="16" r="5.75"></circle></svg>'},getIcon:function(e,t){return void 0!==En.exceptionIcons[e]?new Promise((function(t){return t(En.exceptionIcons[e])})):(En[e]||(En[e]=fetch(t).then((function(e){return e.text()})).then((function(e){return e.toLowerCase().includes("!doctype")?null:e})).catch((function(e){console.warn(e)}))),En[e])}},_n=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={svg:""},t.mounted=!1,t.getSVG=function(){var e=t.props,n=e.width,r=e.height,o=e.size,a=t.state.svg||"";return n||r||o?((r||o)&&(a=a.replace('xmlns="http://www.w3.org/2000/svg"','xmlns="http://www.w3.org/2000/svg" height="'+(r||o)+'" ')),(n||o)&&(a=a.replace('xmlns="http://www.w3.org/2000/svg"','xmlns="http://www.w3.org/2000/svg" width="'+(n||o)+'" ')),a):t.state.svg},t.getIconPath=function(e){return t.props.path+"/"+e+".svg"},t}return vn(t,e),t.prototype.componentDidMount=function(){var e=this;this.mounted=!0,this.fetch(this.props.name),this.props.prefetch&&this.props.prefetch.forEach((function(t){return e.prefetch(t)}))},t.prototype.componentDidUpdate=function(e){this.props.name!==e.name&&this.fetch(this.props.name)},t.prototype.componentWillUnmount=function(){this.mounted=!1},t.prototype.prefetch=function(e){En.getIcon(e,this.getIconPath(e))},t.prototype.fetch=function(e){var t=this;En.getIcon(e,this.getIconPath(e)).then((function(e){t.mounted&&t.setState({svg:e})}))},t.prototype.render=function(){var e=this.props,t=e.name,n=void 0===t?"":t,r=e.multicolor,o=e.fill,a=e.className,i=e.tabIndex,l=e.forwardRef,u=e.color,s=e.role,c=e["data-tooltip"],f=e["data-e2e"],p=e["data-component"],d=e["aria-label"],h=wn(e,["name","multicolor","fill","className","tabIndex","forwardRef","color","role","data-tooltip","data-e2e","data-component","aria-label"]),m=this.props,g=m.width,v=m.height,b=m.size,w=m.style,E=m.onClick,_=m.onKeyDown,O=(wn(m,["width","height","size","style","onClick","onKeyDown"]),bn(bn({},{width:(g||b)+"px",height:(v||b)+"px"}),w)),S=!r,x=c&&0,k=vt("sg-icon",E&&"sg-icon--interactive",o&&"sg-icon--fill-"+o,S&&"sg-icon--use-css-colors",S&&an(u),new RegExp("(presentational|product)").test(n)&&S&&"sg-icon--color-"+u,a);return y.createElement("span",bn({className:k},xt(h),{ref:l,"data-tooltip":c,style:O,onClick:E,tabIndex:void 0!==i?i:x,dangerouslySetInnerHTML:{__html:this.getSVG()},"data-e2e":f,"data-component":p,"data-icon":n,role:s,"aria-label":d,onKeyDown:function(e){switch(e.key){case Ct.SPACE:case Ct.ENTER:e.preventDefault(),e.stopPropagation(),e.target.click()}_&&_(e)}}))},t.defaultProps={fill:"lighter","data-e2e":"icon","data-component":"icon",role:"img"},t}(y.Component),On=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return e.reduceRight((function(e,t){return t(e)}),t)}}(gn,y.forwardRef)((function(e,t){return y.createElement(_n,bn({},e,{forwardRef:t}))}));On.displayName="Icon";var Sn=y.forwardRef((function(e,t){return y.createElement(st.Consumer,null,(function(n){var r=n.config;return y.createElement(On,bn({ref:t,path:r.assetsPath+"/svg"},e))}))})),xn=function(){return xn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},xn.apply(this,arguments)},kn=y.forwardRef((function(e,t){var n=t||y.createRef(),r=y.createRef(),o=e.children,a=e.disabled,i=e.className,l=e.tag,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","disabled","className","tag"]);return y.createElement(l,xn({},u,{ref:n,onMouseDown:function(e){if(!n.current||!r.current||a)return null;r.current.classList.remove("sg-ripple"),r.current.style.left="0px",r.current.style.top="0px",r.current.style.width="0px",r.current.style.height="0px";var t,o,i,l=(o=(t=n.current).offsetWidth)>=(i=t.offsetHeight)?o:i,u=function(e,t,n){var r=sn(t);return{x:e.clientX-r.left-n/2,y:e.clientY-r.top-n/2}}(e,n.current,l);r.current.style.left=u.x+"px",r.current.style.top=u.y+"px",r.current.style.width=l+"px",r.current.style.height=l+"px",r.current.classList.add("sg-ripple")},className:vt("sg-ripple-container",i)}),o,y.createElement("span",{ref:r}))}));kn.displayName="Ripple";var Cn=kn,Tn=function(){return Tn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Tn.apply(this,arguments)},Pn={small:"12",medium:"16",large:"18","x-large":"18","xx-large":"22"},Nn=y.forwardRef((function(e,t){var n=e.children,r=e.color,o=e.disabled,a=(e.device,e.size),i=e.className,l=e.icon,u=e.onClick,s=e.iconColor,c=e.tabIndex,f=e.isActive,p=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","color","disabled","device","size","className","icon","onClick","iconColor","tabIndex","isActive"]),d=vt("sg-icon-button","sg-icon-button--circle",f&&"sg-icon-button--active",r&&"sg-icon-button--"+r,o&&"sg-icon-button--disabled",a&&"sg-icon-button--"+a,i);return y.createElement(Cn,Tn({ref:t,tag:"span",className:d,tabIndex:c,role:"button"},xt(p),{onKeyDown:function(e){return function(e){var t=e.event,n=e.disabled;switch(Tt(t)&&nn({event:t}),Pt(t)&&nn({event:t,isDirectionForward:!1}),t.key){case Ct.SPACE:case Ct.ENTER:if(n)return;return t.preventDefault(),t.stopPropagation(),t.target.click();default:return}}({event:e,disabled:o,onClick:u})},disabled:o,onClick:function(e){o?e.preventDefault():"function"==typeof u&&u(e)}}),l&&y.createElement(Sn,{name:l,size:Pn[a],className:"sg-icon-button__icon",tabIndex:null,color:s,"aria-hidden":!0}),n)}));Nn.defaultProps={color:"neutral",size:"medium","data-e2e":"icon-button","data-component":"icon-button",tabIndex:0};var In=gn(Nn,{preventTooltipOnMobile:!0});In.displayName="IconButton";var jn=In,Rn=["left","center","right"],An=["capitalize","lowercase","uppercase"],Dn=["light","regular","medium","bold","extra-bold"],Mn=function(){return Mn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Mn.apply(this,arguments)},Ln=function(e){if(!e)return null;var t=e.align,n=e.italic,r=e.transform,o=e.truncate,i=e.weight,l=e.wordBreak;return bt({styles:a.default,classes:Mn({"sg-typography":!0,"sg-typography--truncate":o,"sg-typography--italic":n},wt([{class:"sg-typography--align-",props:Rn,selected:t},{class:"sg-typography--transform-",props:An,selected:r},{class:"sg-typography--weight-",props:Dn,selected:i},{class:"sg-typography--break-",props:["all","word"],selected:l}]))})},Fn=function(){return Fn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fn.apply(this,arguments)},zn=function(e){var t=e.children,n=e.className,r=e.size,o=e.tag,a=e.color,l=e.padding,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","size","tag","color","padding"]),s=[{class:"sg-text--size-",props:["small","medium","large","x-large","inherit"],selected:r}],c=vt(n,an(a),Wt(l),Ln(u)),f=bt({styles:i.default,classes:Fn({"sg-text":!0},wt(s)),className:c});return y.createElement(o,Fn({className:f},xt(u)),t)};zn.defaultProps={weight:"regular",color:"dark",size:"medium",tag:"p","data-e2e":"text"};var Un=zn,Vn=n(5043),Hn=n.n(Vn),Bn=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Wn=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Bn(arguments[t]));return e},Kn=["1","2","3","4","5","6"],qn=["airy","comfortable","cozy","compact","none"],Yn=function(){return Yn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Yn.apply(this,arguments)},Gn=function(e){var t,n,r,o=e.children,a=e.className,i=e.density,u=e.level,s=e.color,c=e.tag,f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","density","level","color","tag"]),p=vt(an(s),Ln(f),a),d=bt({styles:l.default,classes:Yn({"sg-title":!0},wt([{class:"sg-title--density-",props:qn,selected:i},{class:"sg-title--level-",props:Kn,selected:u}])),className:p});return y.createElement(c||"h"+u,Yn({className:d,"data-component":"title",role:"heading"},xt(f)),"string"==typeof o?(void 0===n&&(n=[]),void 0===r&&(r=[]),(t=o)?new(Hn())({ALLOWED_TAGS:Wn(["em","strong","b","br","span"],n),ALLOWED_ATTRIBUTES:Wn(["class","className"],r)}).transform(t):""):o)};Gn.defaultProps={weight:"bold",color:"dark",density:"cozy",level:"1","data-e2e":"title"},Gn.displayName="Title";var $n=Gn,Xn=function(){return Xn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Xn.apply(this,arguments)},Qn={success:"success",error:"error",warning:"warning",info:"information",instruction:"information",hint:"information"},Jn=function(e){var t=e.className,n=e.device,r=e.message,o=e.title,a=e.type,i=e.onClose,l=e.children,u=e.style,s=e.enter,c=e.onEnter,f=e.onEntered,p=e.onEntering,d=e.exit,h=e.onExit,m=e.onExited,g=e.onExiting,v=e["data-e2e"],b=e["data-component"],w=e.tabIndex,E=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","device","message","title","type","onClose","children","style","enter","onEnter","onEntered","onEntering","exit","onExit","onExited","onExiting","data-e2e","data-component","tabIndex"]),_=vt("sg-notification",a&&"sg-notification--"+a,t);return y.createElement(Gt.CSSTransition,Xn({classNames:"sg-notification--animation"},xt(E),{in:e.in,enter:s,onEnter:c,onEntered:f,onEntering:p,exit:d,onExit:h,onExited:m,onExiting:g,mountOnEnter:!0,unmountOnExit:!0,timeout:{enter:1,exit:500}}),y.createElement("div",{style:u,className:_,"data-e2e":v,"data-e2e-status":a,"data-component":b,tabIndex:w},y.createElement("div",{className:"sg-notification__icon"},y.createElement(Sn,{name:Qn[a],color:"white",size:n.isPhone?"15":"20"})),y.createElement("div",{className:"sg-notification__content","data-e2e":"notification-content"},y.createElement($n,{level:"6",density:"none",className:"sg-notification__title"},o),r&&y.createElement(Un,{size:"small",color:"dark"},r),l),y.createElement("div",{className:"sg-notification__close-icon","data-e2e":"notification-close-icon"},i&&y.createElement(jn,{icon:"cross",size:"small",onClick:i,tabIndex:-1}))))};Jn.defaultProps={"data-e2e":"notification","data-component":"notification",tabIndex:-1};var Zn=function(e){return y.createElement(st.Consumer,null,(function(t){var n=t.device;return y.createElement(Jn,Xn({},e,{device:n}))}))};Zn.displayName="Notification";var er=Zn,tr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nr=function(){return nr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},nr.apply(this,arguments)},rr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultTitles={success:t.props.defaultSuccessTitle,error:t.props.defaultErrorTitle},t.handleClose=function(){var e=t.props,n=e.removeNotification,r=e.notification;void 0!==t.timeout&&(clearTimeout(t.timeout),t.timeout=void 0,n(r.id))},t}return tr(t,e),t.prototype.componentDidMount=function(){var e=this;this.timeout=setTimeout((function(){e.handleClose()}),7e3)},t.prototype.componentWillUnmount=function(){this.handleClose()},t.prototype.render=function(){var e=this.props,t=e.notification,n=(e.defaultErrorTitle,e.defaultSuccessTitle,e.removeNotification,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["notification","defaultErrorTitle","defaultSuccessTitle","removeNotification"])),r=t.title||this.defaultTitles[t.type];return y.createElement(er,nr({type:t.type,title:r,message:t.message,onClose:this.handleClose},n))},t}(y.Component),or=rr,ar=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ir=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={notifications:[]},t.addNotification=function(e){t.setState((function(t){return{notifications:t.notifications.concat(e)}}))},t.removeNotification=function(e){t.setState((function(t){return{notifications:t.notifications.filter((function(t){return t.id!==e}))}}))},t}return ar(t,e),t.prototype.componentDidMount=function(){Qt.subscribe(this.addNotification)},t.prototype.componentWillUnmount=function(){Qt.unsubscribe(this.addNotification)},t.prototype.render=function(){var e=this;return y.createElement(Xt,null,this.state.notifications.map((function(t){return y.createElement(or,{key:t.id,notification:t,defaultSuccessTitle:e.props.defaultSuccessTitle,defaultErrorTitle:e.props.defaultErrorTitle,removeNotification:e.removeNotification})})))},t}(y.Component),lr=ir,ur=n(4330),sr=["none","small","medium","inherit"],cr=["none","default","inherit"],fr=function(){return sr},pr=function(){return pr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},pr.apply(this,arguments)},dr=function(e,t){if(!e)return null;var n=Lt("border",e),r=[{class:"sg-with-border--radius-",props:cr,selected:t},{class:"sg-with-border--border-top-",props:fr(),selected:n.top},{class:"sg-with-border--border-right-",props:fr(),selected:n.right},{class:"sg-with-border--border-bottom-",props:fr(),selected:n.bottom},{class:"sg-with-border--border-left-",props:fr(),selected:n.left}];return bt({styles:u.default,classes:pr({"sg-with-border":!0},wt(r))})},hr=function(){return hr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},hr.apply(this,arguments)},mr=function(e){var t=e.background,n=e.children,r=e.className,o=e.delay,a=e.density,i=e.hideSpinner,l=e.iconSize,u=e.position,s=e.spinnerPosition,c=e.border,f=e.borderRadius,p=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["background","children","className","delay","density","hideSpinner","iconSize","position","spinnerPosition","border","borderRadius"]),d=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(y.useState(null),2),h=d[0],m=d[1];y.useEffect((function(){if(0!==o){var e=setTimeout((function(){return m(!0)}),o);return function(){return clearTimeout(e)}}m(!0)}),[o]);var g=vt("sg-loader","sg-loader--density-"+a,"sg-loader--position-"+u,"sg-loader--background-"+t,dr(c,f),r),v=vt("sg-loader__content","sg-loader__content--position-"+s,!h&&"sg-loader__content--transparent"),b=vt("sg-loader__message","sg-loader__message--color-"+t);return y.createElement("div",hr({className:g,"data-e2e":"loader"},xt(p)),h&&y.createElement("div",{className:v},!i&&y.createElement("div",{className:"sg-loader__spinner","data-e2e":"loader-spinner"},y.createElement(Sn,{name:"loader",color:"success",size:l,multicolor:!0})),n&&y.createElement("div",{className:b,"data-e2e":"loader-message"},n)))};mr.defaultProps={background:"default",delay:1e3,density:"medium",hideSpinner:!1,iconSize:"50",position:"fixed",spinnerPosition:"sticky",border:"none",borderRadius:"inherit","data-e2e":"loader"};var yr=mr,gr=function(e){return e.httpRequests},vr=y.createContext({parentLoaderVisible:!1}),br=function(e){var t=e.children,n=e.resources,r=q(gr),o=r.specified,a=r.unspecified,i=o.find((function(e){return Array.isArray(n)&&n.includes(e)}))||a>0;return y.createElement(vr.Consumer,null,(function(e){var n=e.parentLoaderVisible;return y.createElement(vr.Provider,{value:{parentLoaderVisible:i}},y.createElement(y.Fragment,null,!n&&i&&y.createElement(yr,{spinnerPosition:"absolute",position:"absolute"}),t))}))},wr=function(e){return e.config.home_url},Er=function(e){var t=e.config.locale?JSON.parse(e.config.locale):{"":{}};return t[""].localeSlug=e.config.localeSlug||"en",t},_r=function(e){return e.config.log_page_url},Or=function(e){return e.config.data_consent_popup},Sr=function(e,t){var n=!t||void 0===t.triggerNavigationEvent||t.triggerNavigationEvent;e&&(n&&_t(),e.focus())},xr=function(e){var t=getComputedStyle(e);return"none"!==t.display&&"hidden"!==t.visibility},kr={isDirectionForward:!0},Cr=function(e,t){var n=(void 0===t?kr:t).isDirectionForward,r=null;if(!e)return r;for(var o=n?e.firstChild:e.lastChild;o;){if(1===o.nodeType&&xr(o)){if(Zt(o))return o;if(r=Cr(o,{isDirectionForward:n}))return r}o=n?o.nextSibling:o.previousSibling}return r},Tr=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Pr=function(){return Pr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Pr.apply(this,arguments)},Nr=function(e){function t(t){var n=e.call(this,t)||this;return n.onKeyDown=function(e){var t=Cr(n.tabsRef,{isDirectionForward:!0}),r=Cr(n.tabsRef,{isDirectionForward:!1});switch(e.key){case Ct.RIGHT:case Ct.DOWN:if(r===e.target)return;return e.target===n.tabsRootRef&&Sr(t),void nn({event:e});case Ct.LEFT:case Ct.UP:if(t===e.target)return;return e.target===n.tabsRootRef&&Sr(r),void nn({event:e,isDirectionForward:!1});default:return}},n.state={hasArrows:!1},n.tabsWrapperWith=null,n.tabsWidth=null,n.initialClientXLocation=0,n.deltaXFromLastTranslateRequest=0,n.deltaXfromLastMoveEvent=0,n.tabsRootRef=y.createRef(),n.tabsWrapperRef=y.createRef(),n.tabsRef=y.createRef(),n.applyTransformXStyle=n.applyTransformXStyle.bind(n),n.saveComponentDimensions=n.saveComponentDimensions.bind(n),n.resizeHandler=n.resizeHandler.bind(n),n.onMouseDown=n.onMouseDown.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n}return Tr(t,e),t.prototype.componentDidMount=function(){this.saveComponentDimensions(),this.setState({hasArrows:this.tabsWrapperWith<this.tabsWidth}),window.addEventListener("resize",this.resizeHandler,!1)},t.prototype.componentDidUpdate=function(e){e.children.length!==this.props.children.length&&this.setState({hasArrows:this.tabsWrapperWith<this.tabsWidth}),this.saveComponentDimensions()},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.resizeHandler,!1)},t.prototype.onMouseDown=function(e){this.tabsWrapperWith>=this.tabsWidth||(this.initialClientXLocation=e.clientX||e.touches[0].clientX)},t.prototype.onMouseMove=function(e){if(this.initialClientXLocation){var t=e.clientX||e.touches[0].clientX;this.translateTabs(t)}},t.prototype.onMouseUp=function(){this.initialClientXLocation=0,this.deltaXFromLastTranslateRequest=this.deltaXfromLastMoveEvent},t.prototype.saveComponentDimensions=function(){this.tabsWrapperRef&&(this.tabsWrapperWith=this.tabsWrapperRef.getClientRects()[0].width,this.tabsWidth=this.tabsRef.getClientRects()[0].width)},t.prototype.translateTabs=function(e){var t=this.tabsWidth-this.tabsWrapperWith,n=e-this.initialClientXLocation+this.deltaXFromLastTranslateRequest,r=Math.min(Math.max(parseInt(n,10),-t),0);this.deltaXfromLastMoveEvent=r,this.applyTransformXStyle(r)},t.prototype.applyTransformXStyle=function(e){this.tabsRef.style.webkitTransform="translateX("+e+"px)",this.tabsRef.style.transform="translateX("+e+"px)"},t.prototype.resizeHandler=function(){var e=this.tabsWrapperWith<this.tabsWidth;this.state.hasArrows!==e&&this.setState({hasArrows:e}),this.applyTransformXStyle(0),this.saveComponentDimensions()},t.prototype.render=function(){var e=this,t=this.props,n=t.className,r=t.children,o=t.border,a=t.size,i=t.tabIndex,l=t["data-e2e"],u=t["data-component"],s=t["aria-label"],c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["className","children","border","size","tabIndex","data-e2e","data-component","aria-label"]),f=vt("sg-tabs-wrapper",o&&"sg-tabs-wrapper--border-"+o,n),p=vt("sg-tabs","sg-tabs--active-color","sg-tabs--background-transparent","sg-tabs--"+a),d=this.state.hasArrows;return y.createElement("div",Pr({ref:function(t){e.tabsRootRef=t},className:f,"data-e2e":l,"data-component":u,tabIndex:i},xt(c),{onMouseDown:this.onMouseDown,onMouseMove:this.onMouseMove,onMouseUp:this.onMouseUp,onMouseLeave:this.onMouseUp,onTouchStart:this.onMouseDown,onTouchMove:this.onMouseMove,onTouchEnd:this.onMouseUp,onKeyDown:this.onKeyDown}),d&&y.createElement("div",{className:"sg-tabs__arrow sg-tabs__arrow--start",onClick:function(){return e.translateTabs(40)}},y.createElement(Sn,{name:"arrow-left-thin",size:"10"})),y.createElement("div",{className:"sg-tabs_container",ref:function(t){e.tabsWrapperRef=t}},y.createElement("ul",Pr({className:p,ref:function(t){e.tabsRef=t},role:"tablist","aria-label":s},c),r)),d&&y.createElement("div",{className:"sg-tabs__arrow sg-tabs__arrow--end",onClick:function(){return e.translateTabs(-40)}},y.createElement(Sn,{name:"arrow-right-thin",size:"10"})))},t.defaultProps={size:"medium",tabIndex:0,"data-e2e":"tabs","data-component":"tabs"},t}(y.Component),Ir=Nr,jr=function(){return jr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},jr.apply(this,arguments)},Rr=function(e){switch(e.key){case Ct.SPACE:case Ct.ENTER:e.preventDefault(),e.stopPropagation(),e.target.click()}},Ar=y.forwardRef((function(e,t){var n=e.active,r=e.disabled,o=e.className,a=e.children,i=e.padding,l=e.tabIndex,u=e["data-e2e"],s=e["data-component"],c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["active","disabled","className","children","padding","tabIndex","data-e2e","data-component"]),f=vt("sg-tabs__tab",n&&"sg-tabs__tab--active",r&&"sg-tabs__tab--disabled",Wt(i),o);return y.createElement(Cn,jr({tag:"li",ref:t,className:f,tabIndex:l,"data-e2e":u,"data-component":s,role:"tab","aria-selected":n,"aria-controls":"panel-"+l},xt(c),{onKeyDown:Rr}),a)}));Ar.displayName="Tab",Ar.defaultProps={tabIndex:-1,"data-e2e":"tab","data-component":"tab"};var Dr=Ar,Mr=function(){return Mr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Mr.apply(this,arguments)},Lr=y.forwardRef((function(e,t){var n=e.border,r=e.borderRadius,o=e.children,a=e.className,i=e.align,l=e.alignSelf,u=e.justify,s=e.justifyItems,c=e.autoflow,f=e.xs,p=e.sm,d=e.m,h=e.lg,m=e.gap,g=e.autoFit,v=e.padding,b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["border","borderRadius","children","className","align","alignSelf","justify","justifyItems","autoflow","xs","sm","m","lg","gap","autoFit","padding"]),w=vt("sg-grid","sg-grid--gap-"+m,l&&"sg-grid--align-self-"+l,c&&"sg-grid--autoflow-"+c,f&&"sg-grid--xs-"+f,p&&"sg-grid--sm-"+p,d&&"sg-grid--m-"+d,h&&"sg-grid--lg-"+h,g&&"sg-grid--auto-fit",i&&"sg-grid--align-"+i,u&&"sg-grid--justify-"+u,Wt(v),s&&"sg-grid--justify-items-"+s,dr(n,r),!!window.MSInputMethodContext&&!!document.documentMode&&"sg-grid--ie11",a);return y.createElement("div",Mr({ref:t,className:w},xt(b)),o)}));Lr.defaultProps={gap:"medium",autoflow:"row",alignSelf:"stretch"};var Fr=Lr,zr=function(){return zr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},zr.apply(this,arguments)},Ur=function(e){var t=e.className,n=e.density,r=e.padding,o=e.theme,a=e.children,i=e.expanded,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","density","padding","theme","children","expanded"]),u=vt("sg-section",n&&"sg-section--density-"+n,o&&"sg-section--theme-"+o,i&&"sg-section--expanded",t);return r&&console.warn("Property padding is deprecated. Use density for vertical spacing"),o&&console.warn("Property theme is deprecated."),y.createElement("div",zr({className:u},xt(l)),y.createElement("div",{className:"sg-section__content"},a))};Ur.defaultProps={density:"cozy","data-e2e":"section"};var Vr=Ur,Hr=function(){return Hr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Hr.apply(this,arguments)},Br="vertical",Wr={"x-small":"36",small:"48",medium:"64",large:"96","x-large":"144"},Kr={"x-small":"6",small:"5",medium:"4",large:"3","x-large":"2"},qr=function(e){var t=e.device,n=e.divided,r=e.layout,o=e.selected,a=e.text,i=e.title,l=e.padding,u=e.iconName,s=e.iconColor,c=e.iconMulticolor,f=e.size,p=e.children,d=e.className,h=e.outline,m=e.tabIndex,g=e["data-e2e"],v=e["data-component"],b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["device","divided","layout","selected","text","title","padding","iconName","iconColor","iconMulticolor","size","children","className","outline","tabIndex","data-e2e","data-component"]),w=t.isPhone||r===Br,E=n&&!w,_=vt("sg-card",Wt(l),h&&"sg-card--outline-"+h,o&&"sg-card--selected",d),O=vt("sg-card__content-wrapper",E&&"sg-card__content-wrapper--divided",w?"sg-card__content-wrapper--row":"sg-card__content-wrapper--column"),S=vt("sg-card__icon-wrapper");return y.createElement("div",Hr({className:_,role:"figure",tabIndex:m},xt(b),{"data-e2e":g,"data-component":v}),y.createElement(Fr,{className:O,gap:w?"medium":"large"},y.createElement("div",{className:S},y.createElement(Sn,{name:u,color:s,size:Wr[f],multicolor:c})),E&&y.createElement("div",{className:"sg-card__divider"}),y.createElement(Fr,{className:vt("sg-card__content",r===Br&&"sg-card__content--vertical")},y.createElement(Fr,null,i&&y.createElement($n,{level:Kr[f],weight:"bold",density:"none"},i),a&&y.createElement(Un,{color:"dark"},a)),p&&y.createElement("div",{className:"sg-card__actions-wrapper"},p))))};qr.defaultProps={padding:"responsive",divided:!1,layout:"horizontal",outline:"shadow","data-e2e":"card","data-component":"card",size:"medium",tabIndex:0},qr.displayName="Card";var Yr=function(e){return y.createElement(st.Consumer,null,(function(t){var n=t.device;return y.createElement(qr,Hr({},e,{device:n}))}))},Gr=function(){return Gr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gr.apply(this,arguments)},$r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},Xr=function(e){var t=e.children,n=$r(e,["children"]);return y.createElement($n,Gr({density:"comfortable"},n),t)},Qr=function(e){var t=e.children,n=$r(e,["children"]);return y.createElement($n,Gr({level:"4"},n),t)},Jr=function(e){var t=function(e){var t;return((t={})[Re.SECURITY_DASHBOARD]={title:Ie("SiteGround Security"),text:Ie("SiteGround Security is the all-in-one security solution for your WordPress website. With the carefully selected and easy to configure functions the plugin provides everything you need to secure your website and prevent a number of threats such as brute-force attacks, compromised login, data leaks and more."),iconName:"logo-sg-security",iconMulticolor:!0},t[Re.LOGIN_SETTINGS]={title:Ie("SiteGround Security - Login Security"),text:Ie("Login security is paramount for keeping your site and data secure. Use the tools we have compiled to protect your WordPress wp-admin from unauthorised visitors, bots and other human or automated attacks."),iconName:"product-ssl-encryption",iconColor:"primary"},t[Re.SITE_SECURITY]={title:Ie("SiteGround Security - Site Security"),text:Ie("We have created a list of tools to help you harden your WordPress site's security and keep it safe from malware, exploits and other malicious actions. The options tagged as recommended are essential for your site security."),iconName:"product-ssl-wildcard",iconColor:"primary"},t[Re.ACTIVITY_LOG]={title:Ie("SiteGround Security - Activity Log"),text:Ie("The activity log can help you monitor your site and login page for unauthorised visitors or brute force attempts. You can easily block and unblock IPs or visitors that look suspicious and prevent them from malicious actions."),iconName:"product-access-logs",iconColor:"primary"},t[Re.POST_HACK_ACTIONS]={title:Ie("SiteGround Security - Post-hack Actions"),text:Ie("If you believe that your website was hacked, you have installed a compromised plugin or one of your users login has been compromised, you can use the tools in our post-hack actions for a quick remedy."),iconName:"product-hacked-site-repair",iconColor:"primary"},t)[e]}(e.pageId);if(!t)return null;var n=t.title,r=t.text,o=t.iconName,a=t.iconColor,i=t.iconMulticolor;return y.createElement("div",null,y.createElement(Xr,null,n),y.createElement(Yr,{iconName:o,iconColor:a,iconMulticolor:i,text:r}))},Zr=function(e){var t=e.children,n=e.pageId;return y.createElement(Vr,null,y.createElement(Fr,null,y.createElement(Jr,{pageId:n}),y.createElement(Fr,null,t)))},eo=function(){return eo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},eo.apply(this,arguments)},to=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},no=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(to(arguments[t]));return e},ro=y.forwardRef((function(e,t){var n=e.action,r=e.color,o=e.size,a=e.children,i=e.className,l=e.disabled,u=e.expand,s=e.tabIndex,c=e.tag,f=e["data-e2e"],p=e["data-component"],d=e.onClick,h=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["action","color","size","children","className","disabled","expand","tabIndex","tag","data-e2e","data-component","onClick"]),m=vt("sg-button","sg-button--"+r,"sg-button--"+o,l&&"sg-button--disabled",u&&"sg-button--expanded",i);return y.createElement(Cn,eo({tag:c,className:m,ref:t,tabIndex:s,"data-e2e":f,"data-component":p},xt(h),{type:n,onClick:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];l||"function"!=typeof d||d.apply(void 0,no(e))}}),y.createElement("span",{className:"sg-button__content"},a))}));ro.displayName="Button",ro.defaultProps={action:"submit",color:"neutral","data-e2e":"button","data-component":"button",tag:"button",size:"medium",tabIndex:0};var oo=ro,ao="FETCH_ITEM",io="FETCH_ITEM_SUCCEEDED",lo="UPDATE_ITEM",uo="UPDATE_ITEM_SUCCEEDED",so="UPDATE_ITEM_SETTINGS",co="UPDATE_ITEM_SETTINGS_SUCCEEDED",fo="FETCH_ITEM",po="UPDATE_ITEM",ho="CONSENT_DIALOG",mo="RATE",yo="BLOCK_USER",go="NOTIFICATIONS_EMAILS",vo="TWO_FA",bo="DISABLE_ADMIN_USERNAME",wo="CUSTOM_LOGIN_URL",Eo="LOGIN_ACCESS",_o="LOGIN_ATTEMPTS",Oo="UPDATE_FREE_PLUGINS",So="FORCE_PASSWORD_RESET",xo="LOGOUT_ALL_USERS",ko="DELETE_DEFAULT_README",Co="DISABLE_RSS_AND_ATOM",To="DISABLE_XML_RPC",Po="XSS_PROTECTION",No="DISABLE_EDITORS",Io="HIDE_WORDPRESS_VERSION",jo="LOCK_AND_PROTECT_SYSTEM_FOLDER",Ro=function(){return Ro=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ro.apply(this,arguments)},Ao=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},Do=function(e){return{type:co,payload:e}},Mo=function(e,t){var n=e.requestTypeName,r=Ao(e,["requestTypeName"]);return Ro({type:ao,requestTypeName:n,payload:Ro({},r)},t)},Lo=function(e){return{type:io,payload:e}},Fo=function(e,t){var n=e.requestTypeName,r=Ao(e,["requestTypeName"]);return Ro({type:lo,requestTypeName:n||po,payload:Ro({},r)},t)},zo=function(e){return{type:uo,payload:e}},Uo={FETCH_OPTIONS:{endpoint:"/fetch-options",resourceName:"options"},UPDATE_CONSENT_SETTINGS:{endpoint:"/update-settings",resourceName:"data_consent_popup"},NOTIFICATIONS:{endpoint:"/notifications",resourceName:"notifications"},HARDENING:{endpoint:"/hardening",resourceName:"hardening"},EBOOK:{endpoint:"/e-book",resourceName:"ebook"},RATE:{endpoint:"/rate",resourceName:"rate"},ACTIVITY_UNKNOWN:{endpoint:"/activity-unknown",resourceName:"activityUnknown"},ACTIVITY_REGISTERED:{endpoint:"/activity-registered",resourceName:"registeredActivity"},ACTIVITY_BLOCKED_USERS:{endpoint:"/blocked-users",resourceName:"blockedUsers"},WEEKLY_REPORTS:{endpoint:"/weekly-report",resourceName:"weeklyReports"},NOTIFICATIONS_EMAILS:{endpoint:"/notification-emails",resourceName:"options"},BLOCK_USER:{endpoint:"/block-user"},BLOCK_IP:{endpoint:"/block-ip"},LOGIN_UNBLOCK:{endpoint:"/login-unblock"},GET_VISITOR_STATUS:{endpoint:"/get-visitor-status",resourceName:"visitorStatus"},TWO_FA:{endpoint:"/2fa",resourceName:"options"},DISABLE_ADMIN_USERNAME:{endpoint:"/disable-admin-username",resourceName:"options"},RESET_TWO_FACTOR:{endpoint:"/reset-user-2fa",resourceName:"options"},LOGIN_ATTEMPTS:{endpoint:"/limit-login-attempts",resourceName:"options"},CUSTOM_LOGIN_URL:{endpoint:"/custom-login-url",resourceName:"options"},LOGIN_ACCESS:{endpoint:"/login-access",resourceName:"options"},AWAY_MODE:{endpoint:"/away-mode",resourceName:"away_mode"},REINSTALL_PLUGINS:{endpoint:"/reinstall-plugins"},FORCE_PASSWORD_RESET:{endpoint:"/force-password-reset"},LOGOUT_USERS:{endpoint:"/logout-users"},LOCK_SYSTEM_FOLDERS:{endpoint:"/lock-system-folders",resourceName:"options"},HIDE_WP_VERSION:{endpoint:"/hide-wp-version",resourceName:"options"},DISABLE_EDITORS:{endpoint:"/disable-editors",resourceName:"options"},DISABLE_XML_RPC:{endpoint:"/disable-xml-rpc",resourceName:"options"},FORCE_HTTP_Strict_Transport_Security:{endpoint:"/hsts-protection",resourceName:"options"},DISABLE_FEEDS:{endpoint:"/disable-feeds",resourceName:"options"},XSS_PROTECTION:{endpoint:"/xss-protection",resourceName:"options"},DELETE_README:{endpoint:"/delete-readme",resourceName:"options"}},Vo=function(){return Vo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vo.apply(this,arguments)},Ho=function(e){var t=e.elevation,n=e.padding,r=e.className,o=e.children,a=e.tabIndex,i=e["data-e2e"],l=e["data-component"],u=e.ref,s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["elevation","padding","className","children","tabIndex","data-e2e","data-component","ref"]),c=vt("sg-container","sg-container--elevation-"+t,Wt(n),r);return y.createElement("div",Vo({ref:u,className:c,"data-e2e":i,"data-component":l,tabIndex:a},xt(s)),o)};Ho.defaultProps={elevation:"1",padding:"medium","data-e2e":"container","data-component":"container"};var Bo=Ho;function Wo(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor!==t.constructor)return!1;var n,r=void 0,o=void 0;if(Array.isArray(e)){if((r=e.length)!=t.length)return!1;for(o=r;0!=o--;)if(!Wo(e[o],t[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"==typeof e.valueOf&&"function"==typeof t.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&"function"==typeof e.toString&&"function"==typeof t.toString)return e.toString()===t.toString();if((r=(n=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,n[o]))return!1;for(o=r;0!=o--;){var a=n[o];if(!Wo(e[a],t[a]))return!1}return!0}return e!=e&&t!=t}var Ko=function(){return Ko=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ko.apply(this,arguments)},qo=y.useEffect,Yo=y.useRef,Go=function(e){var t=e.event,n=e.domRef,r=e.isDirectionForward,o=Cr(n,{isDirectionForward:!0}),a=Cr(n,{isDirectionForward:!1}),i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(r?[o,a]:[a,o],2),l=i[0];i[1]===document.activeElement&&(t.preventDefault(),t.stopPropagation(),Sr(l))},$o=function(e){var t=e.autoFocus,n=e.children,r=e.className,o=e.handleOnKeyDown,a=e.tabIndex,i=e.hasTabHandling,l=void 0===i||i,u=e.hasArrowHandling,s=void 0!==u&&u,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["autoFocus","children","className","handleOnKeyDown","tabIndex","hasTabHandling","hasArrowHandling"]),f=Yo(null);return qo((function(){if(t){var e=Cr(f.current);Sr(e,{triggerNavigationEvent:!1})}}),[t]),y.createElement("div",Ko({ref:f,className:r,tabIndex:a,onKeyDown:function(e){return function(e){var t=e.event,n=e.domRef,r=e.handleOnKeyDown,o=e.hasTabHandling,a=e.hasArrowHandling;return Tt(t)&&o?Go({event:t,domRef:n,isDirectionForward:!0}):Pt(t)&&o?Go({event:t,domRef:n,isDirectionForward:!1}):a?function(e){var t=e.event,n=e.domRef,r=Cr(n,{isDirectionForward:!0}),o=Cr(n,{isDirectionForward:!1});switch(t.key){case Ct.RIGHT:case Ct.DOWN:return t.target===o?Sr(r):nn({event:t});case Ct.LEFT:case Ct.UP:return t.target===r?Sr(o):nn({event:t,isDirectionForward:!1})}}({event:t,domRef:n}):void(r&&r(t))}({event:e,domRef:f.current,handleOnKeyDown:o,hasTabHandling:l,hasArrowHandling:s})}},xt(c)),n)};$o.displayName="FocusScope",$o.defaultProps={autoFocus:!0};var Xo=[],Qo={addElementToFocusQ:function(e){Xo.push(e)},focusLastElementInQ:function(){var e=Xo.pop();e&&e.focus()}},Jo=y.createContext(Qo),Zo=y.useEffect,ea=function(){var e=y.useContext(Jo),t=e.focusLastElementInQ,n=e.addElementToFocusQ;return Zo((function(){return n(document.activeElement),function(){t()}}),[n,t]),null};ea.displayName="HandleModalFocus";var ta="20px",na="absolute",ra=function(e,t,n,r,o){var a=void 0===o?{}:o,i=a.setMaxHeight,l=void 0!==i&&i,u=a.priority,s=void 0===u?null:u,c=r.current.clientHeight,f=r.current.clientWidth;if(function(e){try{e.current.style=null}catch(t){e.current.setAttribute("style",null)}}(r),!n.isPhone){!function(e){var t=e.menuHeight,n=e.rect,r=e.listRef;if(e.setMaxHeight){var o=t+(window.innerHeight-(t+parseInt(n.top,10)))-40,a=o<220?220:o;cn({target:r.current,property:"max-height",value:a+"px"})}}({menuHeight:c,rect:t,listRef:r,setMaxHeight:l});var p,d,h=function(e,t,n,r){var o=n&&"right"===n;return{hasEnoughSpaceForPositionLeftByElement:!(n&&"left"===n)&&window.innerWidth-(e+parseInt(r.left,10))>0,hasEnoughSpaceForPositionRightByElement:!o&&window.innerWidth-(e+parseInt(r.right,10))>0,hasEnoughSpaceForPositionUnderElement:window.innerHeight-(t+parseInt(r.top,10))>0,hasEnoughSpaceForPositionAboveElement:window.innerHeight-(t+parseInt(r.bottom,10))>0}}(f,c,s,t),m=h.hasEnoughSpaceForPositionLeftByElement,y=h.hasEnoughSpaceForPositionRightByElement,g=h.hasEnoughSpaceForPositionUnderElement,v=h.hasEnoughSpaceForPositionAboveElement,b=e===na?"0":t.left,w=e===na?"0":t.right,E=e===na?"100%":t.top,_=e===na?"100%":t.bottom;switch(!0){case m:cn({target:r.current,property:"left",value:b}),p="0";break;case y:cn({target:r.current,property:"right",value:w}),p="100%";break;default:cn({target:r.current,property:"left",value:ta}),cn({target:r.current,property:"right",value:ta})}switch(!0){case g:cn({target:r.current,property:"top",value:E}),d="0";break;case v:cn({target:r.current,property:"bottom",value:_}),d="100%";break;default:cn({target:r.current,property:"top",value:ta}),cn({target:r.current,property:"bottom",value:ta})}p&&d&&cn({target:r.current,property:"transformOrigin",value:p+" "+d+" 0"})}},oa=function(){return oa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},oa.apply(this,arguments)},aa=function(e){var t=e.className,n=e.gutter,r=e.gap,o=e.grow,a=e.align,i=e.alignSelf,l=e.background,u=e.direction,s=e.expand,c=e.justify,f=e.wrap,p=e.margin,d=e.shrink,h=e.children,m=e.padding,g=e.border,v=e.borderRadius,b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","gutter","gap","grow","align","alignSelf","background","direction","expand","justify","wrap","margin","shrink","children","padding","border","borderRadius"]),w=vt("sg-flex",a&&"sg-flex--align-"+a,i&&"sg-flex--align-self-"+i,n&&"sg-flex--gutter-"+n,r&&"sg-flex--gap-"+r,u&&"sg-flex--direction-"+u,s&&"sg-flex--expanded",c&&"sg-flex--justify-"+c,f&&"sg-flex--flex-wrap-"+f,p&&"sg-flex--margin-"+p,d&&"sg-flex--shrink-"+d,o&&"sg-flex--grow-"+o,l&&"sg-flex--background-"+l,Wt(m),dr(g,v),t);return y.createElement("div",oa({className:w},xt(b)),h)},ia=function(){return ia=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ia.apply(this,arguments)},la=y.forwardRef((function(e,t){var n=e.classes,r=e.children,o=(e.onKeyDown,e.wrapperClasses),a=e.tabIndex,i=e.footer,l=e.wrapperRef,u=e["data-e2e"],s=e["data-component"],c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["classes","children","onKeyDown","wrapperClasses","tabIndex","footer","wrapperRef","data-e2e","data-component"]),f=y.useContext(st).device,p=vt("sg-menu-wrapper",f.isPhone&&"sg-menu-wrapper--mobile",o),d=vt("sg-menu",f.isPhone&&"sg-menu--mobile",n);return y.createElement("div",ia({ref:l,className:p},xt(c)),y.createElement("ul",{ref:t,className:d,"data-e2e":u,"data-component":s,onKeyDown:e.onKeyDown,tabIndex:a,role:"menu"},r),i)}));la.displayName="Menu",la.defaultProps={"data-e2e":"menu","data-component":"menu"};var ua=la,sa=function(){return sa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},sa.apply(this,arguments)},ca=y.forwardRef((function(e,t){var n=e.align,r=e.background,o=e.density,a=e.justify,i=e.className,l=e.direction,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["align","background","density","justify","className","direction"]),s=vt("sg-toolbar","sg-toolbar--background-"+r,"sg-toolbar--density-"+o,n&&"sg-toolbar--align-"+n,a&&"sg-toolbar--justify-"+a,l&&"sg-toolbar--direction-"+l,i);return y.createElement("div",sa({ref:t,className:s,"data-e2e":e["data-e2e"]},xt(u)),e.children)}));ca.defaultProps={align:"baseline",background:"transparent",density:"cozy",direction:"row","data-e2e":"toolbar"};var fa=ca,pa=function(){function e(){this.level=null,this.messages=null,this.level="warn",this.messages=[]}return e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.messages.find((function(t){return JSON.stringify(t)===JSON.stringify(e[0])}));n||(window.console&&console.warn.apply(console,e.map((function(e){return"%c"+e})).concat("color: red; font-size: small")),this.messages=this.messages.concat(e))},e}(),da=pa,ha=function(){return ha=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ha.apply(this,arguments)},ma=new da,ya=function(e){e.key!==Ct.SPACE&&e.key!==Ct.ENTER||(e.preventDefault(),e.stopPropagation(),e.target.querySelector('[data-html="input"]').click())},ga=function(e){var t=e.children,n=e.className,r=e.disabled,o=e.reverse,a=e.size,i=e.align,l=e.style,u=e.checkIcon,s=e.indeterminate,c=e.expand,f=e.tabIndex,p=e.checked,d=e["data-e2e"],h=e["data-component"],m=e["aria-label"],g=e["aria-describedby"],v=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","disabled","reverse","size","align","style","checkIcon","indeterminate","expand","tabIndex","checked","data-e2e","data-component","aria-label","aria-describedby"]),b=vt("sg-checkbox",n,r&&"sg-checkbox--disabled",i&&"sg-checkbox--align-"+i,c&&"sg-checkbox--expand",p&&"sg-checkbox--checked","sg-checkbox--"+a),w=s?"check-square":u;return ma.log('"checkIcon" will be deprecated, please use "icon" instead'),y.createElement("label",{className:b,style:l,"data-e2e":d,"data-component":h,onKeyDown:ya,role:"checkbox","aria-checked":e.checked,tabIndex:f,"aria-label":m,"aria-describedby":g},y.createElement("input",ha({className:"sg-checkbox__input",checked:p},xt(v),{"data-e2e":"checkbox-input","data-html":"input",ref:function(e){e&&(e.indeterminate=s)},type:"checkbox",disabled:r})),o&&t&&y.createElement("span",{className:"sg-checkbox__label"},t),y.createElement(Sn,{name:w,className:"sg-checkbox__icon"}),!o&&t&&y.createElement("span",{className:"sg-checkbox__label"},t))};ga.displayName="Checkbox",ga.defaultProps={tabIndex:0,size:"medium",checkIcon:"check",indeterminate:!1,expand:!1,"data-e2e":"checkbox","data-component":"checkbox"};var va=ga,ba=["M","T","W","T","F","S","S"],wa=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ea=["January","February","March","April","May","June","July","August","September","October","November","December"],_a=["en","en-US","en-US-POSIX","dz","dz-BT","en-CA","zh","zh-Hans","zh-Hans-CN","zh-Hans-HK","zh-Hans-MO","zh-Hans-SG","zh-Hant","zh-Hant-HK","zh-Hant-MO","zh-Hant-TW","ko","ko-KR","ta","ta-IN","ta-LK","hu","hu-HU","fa_IR","ja","ja-JP","lt_LT","mn","mn-MN"],Oa=["en","en-US","en-US-POSIX"],Sa=["dz","dz-BT","en-CA","zh","zh-Hans","zh-Hans-CN","zh-Hans-HK","zh-Hans-MO","zh-Hans-SG","zh-Hant","zh-Hant-HK","zh-Hant-MO","zh-Hant-TW","ko","ko-KR","ta","ta-IN","ta-LK","hu","hu-HU","fa_IR","ja","ja-JP","lt_LT","mn","mn-MN"],xa=["ko","ko-KR","ja","ja-JP","zh","zh-cn","zh-hk","zh-mo","zh-sg","zh-tw"],ka=function(e){if("number"==typeof e){var t=e.toString().length;if(t<=10)return new Date(1e3*e);if(t<=13)return new Date(e);console.warn("Unsupported utc date format")}return e instanceof Date?e:null},Ca=function(e,t){return Intl.DateTimeFormat(e,{hour:"numeric"}).format(t).replace(/\u200E/g,"")},Ta=function(e,t){for(var n=new Date(t,e,1),r=[];n.getMonth()===e;)r.push(new Date(n)),n.setDate(n.getDate()+1);return r},Pa=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Na=function(){return Na=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Na.apply(this,arguments)},Ia=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={animation:""},t.mouseDownHandler=function(e){t.mouseDownTarget=e.target},t.clickHandler=function(e){e.stopPropagation(),e.currentTarget===e.target&&t.mouseDownTarget===e.currentTarget&&t.closeHandler()},t}return Pa(t,e),t.prototype.componentDidMount=function(){this.setState({animation:"open"}),this.disablePageScroll()},t.prototype.componentDidUpdate=function(e){e.triggerClose!==this.props.triggerClose&&this.closeHandler()},t.prototype.componentWillUnmount=function(){this.enablePageScroll()},t.prototype.disablePageScroll=function(){var e=document.querySelector(".sg-page");e&&(e.setAttribute("aria-hidden","true"),Qe()&&e.classList.add("from-dialog--prevent-scroll"))},t.prototype.enablePageScroll=function(){var e=document.querySelector(".sg-page");e&&(e.removeAttribute("aria-hidden"),Qe()&&e.classList.remove("from-dialog--prevent-scroll"))},t.prototype.keypressHandler=function(e){27===e.keyCode&&(e.stopPropagation(),this.closeHandler())},t.prototype.closeHandler=function(){var e=this.props,t=e.disableClose,n=e.onCloseHandler;t||(n?this.setState({animation:"close"},(function(){setTimeout((function(){return n()}),300)})):console.warn("Dialog component must have onCloseHandler property to work correctly"))},t.prototype.render=function(){var e=this.props,t=e.autoFocus,n=e.children,r=e.wrapperClassName,o=e.className,a=e.renderCustomHeader,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["autoFocus","children","wrapperClassName","className","renderCustomHeader"]),l=this.state.animation,u=vt("sg-dialog-wrapper",r,l&&"sg-dialog-wrapper--animation-"+l);return g.createPortal(y.createElement("div",{className:u,onKeyDown:this.keypressHandler.bind(this),onMouseDown:this.mouseDownHandler,onClick:this.clickHandler,ref:this.props.forwardedRef,"data-component":"dialog-wrapper","data-e2e":"dialog-wrapper"},y.createElement(ea,null),y.createElement($o,Na({className:o,autoFocus:t},xt(i),{"data-e2e":this.props["data-e2e"]}),a&&a(),n)),document.body)},t.defaultProps={"data-e2e":"dialog-wrapper"},t}(y.Component),ja=y.forwardRef((function(e,t){return y.createElement(Ia,Na({},e,{forwardedRef:t}))})),Ra=function(){return Ra=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ra.apply(this,arguments)},Aa=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Da=function(e){var t=e.icon,n=e.iconColor,r=e.iconSize,o=e.state,a="presentational"===o?"72":"30",i="presentational"===o?"48":"20";return y.createElement(st.Consumer,null,(function(e){var o=e.device;return y.createElement(Sn,{name:t,color:n,size:r||(o.isDesktop?a:i),multicolor:!n})}))},Ma=y.forwardRef((function(e,t){var n=Aa(y.useState(null),2),r=n[0],o=n[1],a=Aa(y.useState(null),2),i=a[0],l=a[1];y.useEffect((function(){var e=un("sg-dialog-");o(e+"-title"),l(e+"-subtitle")}),[]);var u=e.autoFocus,s=e.align,c=e.children,f=e.className,p=e.density,d=e.icon,h=e.iconColor,m=e.iconSize,g=e.footer,v=e.renderCustomHeader,b=e.onCloseHandler,w=e.triggerClose,E=e.size,_=e.state,O=e.title,S=e.subTitle,x=e.wrapperClassName,k=e.autoFocusTitle,C=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["autoFocus","align","children","className","density","icon","iconColor","iconSize","footer","renderCustomHeader","onCloseHandler","triggerClose","size","state","title","subTitle","wrapperClassName","autoFocusTitle"]),T=vt("sg-dialog","sg-dialog--align-"+s,"sg-dialog--size-"+E,p&&"sg-dialog--density-"+p,_?"sg-dialog--state-"+_:"sg-dialog--no-state",f),P=O||S;return y.createElement(ja,Ra({className:T,wrapperClassName:x,autoFocus:u},xt(C),{ref:t,renderCustomHeader:v,onCloseHandler:b,triggerClose:w,role:"dialog","aria-modal":"true","aria-labelledby":r,"aria-describedby":i}),y.createElement("div",{className:"sg-dialog__content-wrapper"},d&&y.createElement("div",{className:"sg-dialog__icon-wrapper"},y.createElement("div",{className:"sg-dialog__icon"},y.createElement(Da,{icon:d,iconColor:h,iconSize:m,state:_}))),P&&y.createElement("div",{className:"sg-dialog__title-wrapper"},O&&y.createElement($n,{id:r,level:"3",weight:"medium",density:"compact",className:"sg-dialog__title",align:s,tabIndex:k?0:null},O),S&&y.createElement(Un,{id:i,weight:"bold",color:"dark",align:s},S)),y.createElement("div",{className:"sg-dialog__content"},c)),g&&y.createElement(fa,{density:"comfortable",justify:"flex-end"},g))}));Ma.displayName="Dialog",Ma.defaultProps={align:"center",density:"medium",size:"medium",autoFocusTitle:!1,renderCustomHeader:function(){return null},"data-e2e":"dialog"};var La=Ma,Fa=function(){return Fa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fa.apply(this,arguments)},za=function(e){var t=e.className,n=e.size,r=e.tag,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","size","tag"]),a=vt("sg-spacer","sg-spacer--size-"+n,t);return y.createElement(r,Fa({className:a,"aria-hidden":"true"},xt(o)))};za.defaultProps={"data-e2e":"spacer",size:"expanded",tag:"div"};var Ua=za,Va=function(){return Va=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Va.apply(this,arguments)},Ha=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Ba=function(){return Ba=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ba.apply(this,arguments)},Wa=bt({styles:s.default,classes:{"sg-form-label":!0}}),Ka=function(e){var t=e.children,n=e.tooltip,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","tooltip"]);return y.createElement(Un,Ba({color:"dark",size:"small",align:"left",weight:"medium",padding:t?["inherit","inherit","xx-small","inherit"]:"none",tag:"span",className:Wa},r),t,n&&y.createElement(Sn,{className:"sg-form-label-tooltip",name:"information",size:"12",color:"dark",tooltip:n,tabIndex:null}))},qa=["success","error","warning","hint"],Ya=function(){return qa},Ga=function(){return Ga=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ga.apply(this,arguments)},$a=function(e){var t=e.validationMessageTemplate,n=e.validationMessage,r=e.state,o=e.className,a=e.focused,i=e.showValidation,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["validationMessageTemplate","validationMessage","state","className","focused","showValidation"]),u=[{class:"sg-validation--",props:Ya(),selected:r}],s=o+" "+o+"-"+r,f=a&&"error"===r,p=bt({styles:c.default,classes:Ga({"sg-validation":!0,"sg-validation--focused":a,"sg-validation--error-focused":f,"sg-validation--error-visible":i},wt(u)),className:s});if(!n&&!t)return null;if(t)return y.createElement("div",Ga({className:p},l,{"data-e2e":l["data-e2e"]}),t());var d="error"===r,h=bt({styles:c.default,classes:{"sg-validation-icon":!0}});return y.createElement("div",Ga({className:p},l,{"data-e2e":l["data-e2e"]}),d&&y.createElement(Sn,{name:"error-attention",height:"13",width:"13",className:h,color:f?"white":"error"}),y.createElement("span",null,n))};$a.defaultProps={state:"hint","data-e2e":"validation"};var Xa=$a,Qa=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ja=function(){return Ja=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ja.apply(this,arguments)},Za=function(){return Za=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Za.apply(this,arguments)},ei=function(e){var t=e.addonType,n=e.addonClasses,r=e.device,o=e.numberOfCharactersToTrim,a=e.onMouseEnter,i=e.onMouseLeave,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["addonType","addonClasses","device","numberOfCharactersToTrim","onMouseEnter","onMouseLeave"]),u=r&&r.isPhone?12:18,s=o||u,c=t.length>=s,f=bt({styles:p.default,classes:{"sg-input-text-truncate":c}});return y.createElement("div",{key:""+t,className:n,onMouseEnter:function(e){a&&c&&a(e)},onMouseLeave:function(e){i&&c&&i(e)},"data-e2e":e["data-e2e"]},c&&y.createElement("span",Za({},l)),y.createElement("span",{className:f},t))};ei.defaultProps={"data-e2e":"addon"};var ti=gn(ei),ni=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ri=function(){return ri=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ri.apply(this,arguments)},oi="prefix",ai="suffix",ii="password",li=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isPasswordVisible:!1},t.getAddonTemplate=function(e){var n=t.props,r=n.type,o=n.forceAddonClass,a=t.getAddonProps(e,o),i=a.addon,l=a.addonTypeIsString,u=a.addonClasses,s=t.props.disableTogglePassword,c=r===ii&&e===ai&&!s;if(!i&&!c)return null;if(i&&l)return y.createElement(ti,{key:e,addonType:i,addonClasses:u,tooltip:i});var f=bt({styles:p.default,classes:{"sg-input-addon__array":!0}});return i&&i.map?y.createElement("div",{className:f},i.map((function(t,n){return y.createElement("span",{key:e+"-"+n,className:u},t)}))):y.createElement("span",{key:e,className:u},c&&y.createElement(jn,{icon:t.state.isPasswordVisible?"eye":"eye-cross",size:"small",onClick:t.togglePasswordVisibility,"data-e2e":t.state.isPasswordVisible?"password-hide":"password-show",role:"switch","aria-label":"show password","aria-checked":t.state.isPasswordVisible}),i&&y.createElement(Ua,{size:"xx-small"}),i)},t.togglePasswordVisibility=function(e){e.preventDefault(),t.setState({isPasswordVisible:!t.state.isPasswordVisible})},t.handleKeyUp=function(e){var n=t.props,r=n.onPressEnter,o=n.onKeyUp;e.key===Ct.ENTER&&r&&r(),o&&o(e)},t}return ni(t,e),t.prototype.componentDidUpdate=function(e,t,n){e.visiblePassword!==this.props.visiblePassword&&this.setState({isPasswordVisible:this.props.visiblePassword})},t.prototype.getAddonProps=function(e,t){var n=this.props[e],r="string"==typeof n,o=[{class:"sg-input-addon__size--",props:zt(),selected:this.props.size}],a=ri({"sg-input-addon":!0,"sg-input-addon--prefix":oi===e,"sg-input-addon--suffix":ai===e,"sg-input-addon--component":t&&"string"!=typeof n,"sg-input-addon--component-suffix":ai===e&&t&&"string"!=typeof n,"sg-input-addon--component-prefix":oi===e&&t&&"string"!=typeof n},wt(o));return{addon:n,addonTypeIsString:r,addonClasses:bt({styles:p.default,classes:a})}},t.prototype.render=function(){var e=this.props,t=e.onRefsReady,n=e.type,r=e.className,o=e.tabIndex,a=e["data-e2e"],i=e["data-component"],l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["onRefsReady","type","className","tabIndex","data-e2e","data-component"]),u=this.state.isPasswordVisible?"text":ii;return y.createElement(y.Fragment,null,this.getAddonTemplate(oi),y.createElement("input",ri({className:r,"data-e2e":a,"data-component":i,tabIndex:o},xt(l),{onKeyUp:this.handleKeyUp.bind(this),ref:function(e){t&&t(e)},type:n===ii?u:n})),this.getAddonTemplate(ai))},t.defaultProps={disableTogglePassword:!1,forceAddonClass:!0,"data-e2e":"input","data-component":"input",tabIndex:0},t}(y.Component),ui=function(e){var t;return t=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.state={isFocused:!1,debounce:null,props:{validationMessage:null,validationMessageTemplate:null}},e.debouncedTimerId=null,e.setDebouncedState=function(){var t=e.props,n=t.state,r=t._enableDebounce;e.debouncedTimerId&&clearTimeout(e.debouncedTimerId);var o={props:{validationMessage:e.props.validationMessage,validationMessageTemplate:e.props.validationMessageTemplate}};r&&e.state.debounce&&"error"===n?e.debouncedTimerId=setTimeout((function(){return e.setState(o)}),500):e.setState(o)},e.onBlurHandler=function(t){e.setState({isFocused:!1}),e.props.onBlur&&e.props.onBlur(t)},e.onFocusHandler=function(t){e.setState({isFocused:!0}),e.props.onFocus&&e.props.onFocus(t)},e.onKeyDownHandler=function(t){e.setState({debounce:!0}),e.props.onKeyDown&&e.props.onKeyDown(t)},e}return Qa(n,t),n.prototype.componentDidMount=function(){this.setDebouncedState()},n.prototype.componentDidUpdate=function(e){this.props.value===e.value&&this.props.state===e.state&&this.props.validationMessage===e.validationMessage||this.setDebouncedState()},n.prototype.render=function(){var t=this.props,n=t.state,r=t.size,o=t.style,a=t.className,i=t.label,l=t.fieldClassName,u=t.tag,s=t.wrapperClassName,c=t.validationClassName,p=t.labelTooltip,d=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["state","size","style","className","label","fieldClassName","tag","wrapperClassName","validationClassName","labelTooltip"]),h=this.state.props,m=h.validationMessage,g=h.validationMessageTemplate,v=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Object.entries(e).filter((function(e){var n=Ha(e,1)[0];return!t.includes(n)})).reduce((function(e,t){var n,r=Ha(t,2),o=r[0],a=r[1];return Va(Va({},e),((n={})[o]=a,n))}),{})}(d,"validationMessage","validationMessageTemplate"),b=bt({styles:f.default,classes:{"sg-field-label":!0},className:a}),w=[{class:"sg-field-wrapper--",props:zt(),selected:r},{class:"sg-field-wrapper--",props:Ya(),selected:n}],E=function(e){return e&&["error","warning"].includes(e)}(n),_=(this.state.isFocused||E)&&(m||g),O=Ja({"sg-field-wrapper":!0,"sg-field-wrapper--readonly":d.readOnly,"sg-field-wrapper--disabled":d.disabled,"sg-field-wrapper--focused":this.state.isFocused,"sg-field-wrapper--has-validation":_,"sg-field-wrapper--error-focused":this.state.isFocused&&"error"===n},wt(w)),S=bt({styles:f.default,classes:O,className:s}),x=bt({styles:f.default,classes:{"sg-field":!0},className:l});return y.createElement(u,{className:b,style:o,"data-disabled":d.disabled,"data-e2e":d["data-e2e"]+"-label"},y.createElement(Ka,{tooltip:p},i),y.createElement("span",{className:S},y.createElement(e,Ja({},v,{size:r,className:x,onFocus:this.onFocusHandler,onBlur:this.onBlurHandler,onKeyDown:this.onKeyDownHandler}))),y.createElement(Xa,{"aria-live":"polite",validationMessageTemplate:g,validationMessage:m,state:n,className:c,focused:this.state.isFocused,showValidation:E}))},n}(y.Component),t.defaultProps={size:"medium",_enableDebounce:!0,tag:"label","data-e2e":"form-field"},t}(li),si="---daySplitter",ci="---WeekSplitter",fi="DAYS_CALENDAR",pi="MONTHS_CALENDAR",di="YEARS_CALENDAR",hi=["es-AR","en-BZ","en-BO","pt-BR","en-CA","es-CL","zh-CN","es-CO","es-CR","es-DO","es-EC","es-SV","es-GT","es-HN","zh-HK","he_IL","en-JM","ja","ja-JP","","","es-MX","es-NI","es-PA","es-PE","en-PH","es-PR","en-za","ko_KR","zh-TW","en-US","es-VE","en"],mi=["ps_AF","ar_DZ","ar-BH","ar-EG","fa_IR","ar-IQ","ar-JO","ar-KW","ar-LY","ar-OM","ar-QA","ar-SA","ar-SY","ar-AE","ar-YE"],yi=function(e){var t=e.children,n=e.isActive,r=e.isDisabled,o=e.isCurrent,a=e.onClick,i=e["data-e2e"],l=e["data-index"],u=vt("sg-date-picker-entity",r&&"sg-date-picker-entity--disabled",o&&"sg-date-picker-entity--current",n&&"sg-date-picker-entity--selected");return y.createElement("div",{className:u,tabIndex:n?0:-1,"data-active":n,"data-datepicker-entity":"true","data-e2e":i,"data-index":l,onClick:a},t)};yi.displayName="DatePickerEntity";var gi=function(){return gi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},gi.apply(this,arguments)},vi=y.useEffect,bi=y.useRef,wi=function(e){var t=e.children,n=e.handleKeyDown,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","handleKeyDown"]),o=bi(null);return vi((function(){var e=o.current.querySelector("[data-active=true]");e?e.focus():Sr(Cr(o.current))}),[t]),y.createElement(Fr,gi({ref:o,gap:"none",justifyItems:"center"},r,{onKeyDown:n}),t)};wi.displayName="DatePickerEntityWrapper";var Ei=function(){return Ei=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ei.apply(this,arguments)},_i={behavior:"smooth",block:"end",inline:"nearest"},Oi=function(e,t){void 0===t&&(t={}),e&&e.scrollIntoView(Ei(Ei({},_i),t))},Si=y.useEffect,xi=y.useRef,ki=function(e){var t=e.children,n=e.isActive,r=e.onClick,o=xi(null);Si((function(){n&&(o.current.focus(),Oi(o.current,{block:"center"}))}),[n]);var a=vt("sg-date-picker-year-entity",n&&"sg-date-picker-year-entity--selected");return y.createElement("span",{className:"sg-date-picker-year-entity-wrapper",tabIndex:n?0:-1,ref:o},y.createElement(Un,{className:a,color:"dark",weight:"bold",onClick:r},t))};ki.displayName="DatePickerYearEntity";var Ci=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ti=function(){return Ti=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ti.apply(this,arguments)},Pi=function(e){function t(t){var n=e.call(this,t)||this;n.handleDayNavigation=function(e){var t=e.dayAccumulator,r=void 0===t?0:t,o=e.monthAccumulator,a=void 0===o?0:o,i=e.yearAccumulator,l=void 0===i?0:i,u=n.state.selectedDate,s=new Date(u),c=s.getDate(),f=s.getMonth(),p=s.getFullYear(),d=c+r<1,h=f+a<0,m=new Date(p,f+1,0).getDate(),y=c+r>m,g=f+a>11,v=y?c+r-m:c+r,b=y?f+a+1:f+a;n.handleDateSelection({day:v,month:b,year:p+l}),d||h?n.handleStartNavigation():(y||g)&&n.handleEndNavigation()},n.handleDayViewKeyboardNavigation=function(e){if(!Tt(e)&&!Pt(e)){var t=n.state,r=t.calendarMonth,o=t.calendarYear,a=n.getSelectedMonth()===r&&n.getSelectedYear()===o,i=document.activeElement&&document.activeElement.getAttribute("data-index");if(a||!i)switch(e.key){case Ct.SPACE:case Ct.ENTER:return void n.handleDateChange();case Ct.UP:return void n.handleDayNavigation({dayAccumulator:-7});case Ct.RIGHT:return void n.handleDayNavigation({dayAccumulator:1});case Ct.DOWN:return void n.handleDayNavigation({dayAccumulator:7});case Ct.LEFT:return void n.handleDayNavigation({dayAccumulator:-1});default:return}else n.handleDateSelection({day:Number(i),month:r,year:o})}},n.handleMonthViewKeyboardNavigation=function(e){if(!Tt(e)&&!Pt(e)){var t=n.state.calendarYear,r=n.getSelectedYear()===t,o=document.activeElement&&document.activeElement.getAttribute("data-index");if(r||!o)switch(e.key){case Ct.SPACE:case Ct.ENTER:return void n.setState({calendarType:n.state.defaultType,calendarMonth:n.getSelectedMonth(),calendarYear:n.getSelectedYear()});case Ct.UP:return void n.handleDayNavigation({monthAccumulator:-3});case Ct.RIGHT:return void n.handleDayNavigation({monthAccumulator:1});case Ct.DOWN:return void n.handleDayNavigation({monthAccumulator:3});case Ct.LEFT:return void n.handleDayNavigation({monthAccumulator:-1});default:return}else n.handleDateSelection({month:o,year:t})}},n.handleYearViewKeyboardNavigation=function(e){if(!Tt(e)&&!Pt(e))switch(e.preventDefault(),e.stopPropagation(),e.key){case Ct.SPACE:case Ct.ENTER:return void n.setState({calendarType:n.state.defaultType,calendarYear:n.getSelectedYear()});case Ct.DOWN:case Ct.RIGHT:return void n.handleDayNavigation({yearAccumulator:1});case Ct.UP:case Ct.LEFT:return void n.handleDayNavigation({yearAccumulator:-1});default:return}};var r=new Date;return r.setHours(0),r.setMinutes(0),r.setSeconds(0),n.state={defaultType:fi,calendarType:fi,currentDay:r.getDate(),currentMonth:r.getMonth(),currentYear:r.getFullYear(),calendarMonth:r.getMonth(),calendarYear:r.getFullYear(),selectedDate:r.getTime(),inputValue:"",isDatePickerVisible:!1,triggerDialogClose:!1},n.handleStartNavigation=n.handleStartNavigation.bind(n),n.handleEndNavigation=n.handleEndNavigation.bind(n),n.handleDateChange=n.handleDateChange.bind(n),n.handleDateSelection=n.handleDateSelection.bind(n),n.openDatePicker=n.openDatePicker.bind(n),n.closeDatePicker=n.closeDatePicker.bind(n),n.resetSelectedDate=n.resetSelectedDate.bind(n),n.renderDayEntity=n.renderDayEntity.bind(n),n.renderMonthEntity=n.renderMonthEntity.bind(n),n.renderDatePickerHeader=n.renderDatePickerHeader.bind(n),n}return Ci(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.value,n=e.disableDayPicker,r=this.state.selectedDate;t&&r!==t&&this.setStateFromValue(t),n&&this.setState({defaultType:pi,calendarType:pi})},t.prototype.componentDidUpdate=function(e){if(e.disableDayPicker!==this.props.disableDayPicker&&(this.props.disableDayPicker?this.setState({defaultType:pi,calendarType:pi}):this.setState({defaultType:fi,calendarType:fi})),""===this.props.value&&""!==this.state.inputValue)return this.setState({inputValue:""});e.value!==this.props.value&&this.setStateFromValue(this.props.value)},t.prototype.getTranslation=function(){return Object.assign({},t.defaultProps.translation,this.props.translation)},t.prototype.getUTCFormatterDate=function(e){return Math.floor(e/1e3)},t.prototype.setStateFromValue=function(e){var t=new Date(1e3*parseInt(e,10));if("string"==typeof e)return this.setState({inputValue:""}),void this.resetSelectedDate();this.setState({selectedDate:t.getTime(),calendarMonth:t.getMonth(),calendarYear:t.getFullYear(),inputValue:t.getTime()})},t.prototype.getStartingWeekDayIndex=function(){var e=this.props.locales;return mi.includes(e)?5:hi.includes(e)?6:0},t.prototype.getWeeksInMonth=function(){var e=this,t=this.state,n=t.calendarMonth,r=t.calendarYear;return Ta(n,r).map((function(t){return t.getDay()===e.getStartingWeekDayIndex()?""+t+si+ci:""+t+si})).join("").split(ci).filter(Boolean).map((function(e,t){var n=e.split(si).filter(Boolean),r=Array(7-n.length);return 0===t?r.fill(null).concat(n):n.concat(r.fill(null))}))},t.prototype.getInputDateFromLocales=function(){var e=this.props.locales;return function(e,t){void 0===t&&(t=navigator.language);var n=ka(e);if(!n)return null;var r=n.getDate().toString().padStart(2,"0"),o=(n.getMonth()+1).toString().padStart(2,"0"),a=n.getFullYear();return Oa.includes(t)?o+"/"+r+"/"+a:Sa.includes(t)?a+"/"+o+"/"+r:r+"/"+o+"/"+a}(this.state.inputValue,e)},t.prototype.getHeaderDateFromLocales=function(){var e=this.props,t=e.locales,n=e.hideDayInHeader,r=e.translation;return function(e){var t=e.date,n=e.locales,r=void 0===n?navigator.language:n,o=e.translation,a=void 0===o?{abbreviatedMonthsNames:wa}:o,i=e.hideDay,l=void 0!==i&&i,u=e.hideYear,s=void 0!==u&&u,c=ka(t),f=l?"":c.getDate(),p=c.getMonth(),d=s?"":c.getFullYear();if(_a.includes(r)){var h=s?"":", "+d;return(a.abbreviatedMonthsNames[p]+" "+f).trim()+h}return(f+" "+a.abbreviatedMonthsNames[p]+" "+d).trim()}({date:new Date(this.state.selectedDate),locales:t,translation:{abbreviatedMonthsNames:r.abbreviatedMonthsNames},hideDay:n})},t.prototype.getSelectedMonth=function(){var e=this.state.selectedDate;return new Date(e).getMonth()},t.prototype.getSelectedYear=function(){var e=this.state.selectedDate;return new Date(e).getFullYear()},t.prototype.closeDatePicker=function(){this.setState({isDatePickerVisible:!1,triggerDialogClose:!1,calendarType:this.state.defaultType})},t.prototype.openDatePicker=function(){this.props.disabled||this.setState({isDatePickerVisible:!0})},t.prototype.handleStartNavigation=function(){var e=this.state,t=e.calendarType,n=e.calendarMonth,r=e.calendarYear;t===fi&&this.setState({calendarMonth:0===n?11:n-1,calendarYear:0===n?r-1:r}),t===pi&&this.setState({calendarYear:this.state.calendarYear-1})},t.prototype.handleEndNavigation=function(){var e=this.state,t=e.calendarType,n=e.calendarMonth,r=e.calendarYear;t===fi&&this.setState({calendarMonth:11===n?0:n+1,calendarYear:11===n?r+1:r}),t===pi&&this.setState({calendarYear:r+1})},t.prototype.handleDateSelection=function(e){var t=e.year,n=e.month,r=e.day,o=e.hour,a=e.minute,i=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["year","month","day","hour","minute"]),l=new Date(this.state.selectedDate),u=void 0!==t?t:l.getFullYear(),s=void 0!==n?n:l.getMonth(),c=void 0!==r?r:l.getDate(),f=void 0!==o?o:l.getHours(),p=void 0!==a?a:l.getMinutes(),d=new Date(u,s+1,0).getDate();c>d&&(c=d),this.setState(Ti({selectedDate:new Date(u,s,c,f,p).getTime()},i))},t.prototype.handleDateChange=function(){var e=this.props.onChange,t=this.state.selectedDate,n=this.getUTCFormatterDate(t);this.setState({inputValue:t,triggerDialogClose:!0},(function(){return e(n)}))},t.prototype.shouldDisableSubmitButton=function(){var e=this.state,t=e.calendarMonth,n=e.calendarYear,r=this.props,o=r.disableDayPicker,a=r.shouldDisableDate,i=r.shouldDisableMonth,l=this.state.selectedDate;if(o){var u=i(Ta(t,n));return[0,1,2,3,4,5,6,7,8,9,10,11].map((function(e){return i(Ta(e,n))})).every((function(e){return!0===e}))&&u}return a(this.getUTCFormatterDate(l))},t.prototype.resetSelectedDate=function(){var e=new Date;e.setHours(0),e.setMinutes(0),e.setSeconds(0),this.setState({calendarMonth:e.getMonth(),calendarYear:e.getFullYear(),selectedMinute:e.getMinutes(),selectedHour:e.getHours(),selectedDay:e.getDate(),selectedMonth:e.getMonth(),selectedYear:e.getFullYear(),selectedDate:e})},t.prototype.renderCalendarNavigation=function(){var e=this,t=this.state,n=t.calendarType,r=t.calendarMonth,o=t.calendarYear,a=this.props.disableDayPicker,i=this.getTranslation();return y.createElement("nav",{className:"sg-date-picker__nav","data-e2e":"datepicker-navigation"},y.createElement(jn,{"data-e2e":"datepicker-start-navigation",icon:"arrow-left-thin",tabIndex:null,onClick:this.handleStartNavigation}),n!==pi&&y.createElement(oo,{disabled:a,"data-e2e":"datepicker-navigation-months",style:{textTransform:"camelcase"},onClick:function(){return e.setState({calendarType:pi})}},i.monthsName[r]),y.createElement(oo,{"data-e2e":"datepicker-navigation-years",onClick:function(){return e.setState({calendarType:di})}},o),y.createElement(jn,{"data-e2e":"datepicker-end-navigation",icon:"arrow-right-thin",tabIndex:null,onClick:this.handleEndNavigation}))},t.prototype.renderDayEntity=function(e,t,n){var r=this,o=this.state.selectedDate,a=this.props,i=a.shouldDisableDate,l=a.locales;if(!e)return y.createElement("div",{key:t,className:"sg-date-picker-entity sg-date-picker-entity--disabled"});var u=new Date(e),s=new Intl.DateTimeFormat(l).format(new Date),c=new Intl.DateTimeFormat(l).format(o),f=new Intl.DateTimeFormat(l).format(u),p=f===s,d=f===c,h=i(this.getUTCFormatterDate(u));return y.createElement(yi,{key:t,isActive:d,isCurrent:p,isDisabled:s&&h,"data-index":u.getDate(),"data-e2e":"datepicker-day",onClick:function(){return r.handleDateSelection({day:u.getDate(),month:u.getMonth(),year:u.getFullYear()})}},u.getDate())},t.prototype.renderDaysCalendar=function(){var e=this.getTranslation().abbreviatedDaysNames,t=this.getStartingWeekDayIndex(),n=[].concat(e.slice(t,7)).concat(e.slice(0,t)),r=this.getWeeksInMonth().reduce((function(e,t){return e.concat(t)}),[]);return y.createElement("div",{className:"sg-date-picker__content sg-date-picker__content--grid-view sg-date-picker__content--fixed-height","data-e2e":"datepicker-days-calendar"},this.renderCalendarNavigation(),y.createElement("div",{className:"sg-date-picker-calendar__row"},n.map((function(e,t){return y.createElement("div",{key:t,className:"sg-date-picker-entity sg-date-picker-entity--non-selectable","data-e2e":"datepicker-day-name"},e)}))),y.createElement(wi,{xs:"7",handleKeyDown:this.handleDayViewKeyboardNavigation},r.map(this.renderDayEntity)))},t.prototype.renderMonthEntity=function(e,t){var n=this,r=this.state,o=r.currentMonth,a=r.currentYear,i=r.calendarYear,l=this.props.shouldDisableMonth,u=t===o&&a===i,s=this.getSelectedMonth()===t&&this.getSelectedYear()===i,c=Ta(t,i);return y.createElement(yi,{key:t,isActive:s,isCurrent:u,isDisabled:l(c),"data-index":t,"data-e2e":"datepicker-month-entity",onClick:function(){n.handleDateSelection({month:t,year:i,calendarType:n.state.defaultType,calendarMonth:t})}},e)},t.prototype.renderMonthsCalendar=function(){var e=this.getTranslation().abbreviatedMonthsNames;return y.createElement("div",{className:"sg-date-picker__content sg-date-picker__content--grid-view sg-date-picker__content--fixed-height","data-e2e":"datepicker-months-calendar"},this.renderCalendarNavigation(),y.createElement(wi,{xs:"3",handleKeyDown:this.handleMonthViewKeyboardNavigation},e.map(this.renderMonthEntity)))},t.prototype.renderYearsCalendar=function(){var e=this,t=this.getSelectedYear(),n=t-50,r=Array(t+51-n).fill(null).map((function(e,t){return n+t}));return y.createElement("div",{className:"sg-date-picker__content sg-date-picker__content--scrollable sg-date-picker__content--fixed-height","data-e2e":"datepicker-years-calendar",onKeyDown:this.handleYearViewKeyboardNavigation},r.map((function(n){return y.createElement(ki,{key:n,isActive:t===n,onClick:function(){e.handleDateSelection({year:n,calendarType:e.state.defaultType,calendarYear:n})}},n)})))},t.prototype.renderFooter=function(){var e=this.getTranslation(),t=this.shouldDisableSubmitButton();return y.createElement(y.Fragment,null,y.createElement(oo,{"data-e2e":"datepicker-cancel-button",style:{marginLeft:"auto"},onClick:this.closeDatePicker},e.cancelButton),y.createElement(oo,{"data-e2e":"datepicker-confirm-button",color:"primary",disabled:t,onClick:this.handleDateChange},e.okButton))},t.prototype.renderInput=function(){var e=this,t=this.state.inputValue,n=this.props,r=n.disabled,o=n.renderInputDateValue,a={label:this.props.label,placeholder:this.props.placeholder,size:this.props.size,validationMessage:this.props.validationMessage,validationMessageTemplate:this.props.validationMessageTemplate,state:this.props.state,"data-e2e":this.props["data-e2e-input"],disabled:this.props.disabled,readOnly:this.props.readOnly},i="";t&&(i=o?o(t):this.getInputDateFromLocales());var l=vt("sg-date-picker__input",r&&"sg-date-picker__input--disabled"),u=vt("sg-date-picker__field",r&&"sg-date-picker__field--disabled");return y.createElement(ui,Ti({className:l,fieldClassName:u,value:i,prefix:y.createElement(Sn,{name:"generic-calendar",color:"primary",size:"18","aria-hidden":!0}),onClick:this.openDatePicker,onKeyDown:function(t){t.key!==Ct.SPACE&&t.key!==Ct.ENTER||e.openDatePicker()},role:"button","aria-label":i},a))},t.prototype.renderDatePickerHeader=function(){var e=this.state.calendarType,t=this.props.disableTodayButton,n=this.getTranslation(),r=!t&&e===fi;return y.createElement(fa,{className:"sg-date-picker__header",align:"center",justify:"space-between",density:"comfortable","data-e2e":"datepicker-header"},y.createElement($n,{level:"3",color:"light",density:"cozy",weight:"medium"},this.getHeaderDateFromLocales()),r&&y.createElement(oo,{"data-e2e":"datepicker-today-button",color:"neutral",onClick:this.resetSelectedDate},n.todayButton))},t.prototype.renderDatePickerDialog=function(){var e=this.state,t=e.calendarType,n=e.isDatePickerVisible,r=e.triggerDialogClose,o=this.props.className;if(!n&&!r)return null;var a=vt("sg-date-picker",o);return y.createElement(La,{className:a,density:"small",size:"small",autoFocus:!1,triggerClose:r,footer:this.renderFooter(),onCloseHandler:this.closeDatePicker,renderCustomHeader:this.renderDatePickerHeader,"data-e2e":this.props["data-e2e"]},t===fi&&this.renderDaysCalendar(),t===pi&&this.renderMonthsCalendar(),t===di&&this.renderYearsCalendar())},t.prototype.render=function(){return y.createElement(y.Fragment,null,this.renderInput(),this.renderDatePickerDialog())},t.defaultProps={disableDayPicker:!1,disableTodayButton:!1,hideDayInHeader:!1,placeholder:"Select a date",locales:navigator.language||"en-US",shouldDisableDate:function(){return!1},shouldDisableMonth:function(){return!1},onChange:function(e){return e},translation:{backButton:"Back",cancelButton:"Cancel",okButton:"Ok",todayButton:"Today",abbreviatedDaysNames:ba,abbreviatedMonthsNames:wa,monthsName:Ea},"data-e2e":"date-picker","data-e2e-input":"datepicker-input"},t}(y.Component),Ni=Pi,Ii=function(e){Object.keys(e).forEach((function(t){document.addEventListener(t,e[t],!1)}))},ji=function(e){Object.keys(e).forEach((function(t){document.removeEventListener(t,e[t],!1)}))},Ri=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Ai={closeMenu:function(){return{isOpen:!1,searchInputValue:""}},getFilteredOptions:function(e,t){return function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ri(arguments[t]));return e}(e.options)},getPlaceholder:function(e,t){if(0===t.selectedOptions.length)return e.placeholder;var n=t.selectedOptions.map((function(t){return t[e.optionLabel]}));return e.template?e.template(t.selectedOptions[0],{isPlaceHolder:!0}):n.join(", ")},getSelectionClass:function(e,t){return e?t:null},handleClick:function(e,t,n,r){if(n){var o=[n];return e.onChange(n[e.optionValue],n,o),{selectedOptions:o,preselectedOptionIndex:Number.isInteger(r)?r:t.preselectedOptionIndex}}},handleCreateChip:function(){return{}},handleKeyDownEnter:function(e){e.preventDefault(),e.stopPropagation()},handleKeyDownLeftRight:function(){return null},handleKeyDownAll:function(e){return e},renderHint:function(e,t){return e?null:t},setSelectedValue:function(e,t){var n=e.options,r=e.optionValue,o=e.selectedValue;if(""===o||null==o)return{selectedOptions:[],preselectedOptionIndex:0};var a=n.findIndex((function(e){return e[r]===o}));return{selectedOptions:[].concat(n[a]).filter(Boolean),preselectedOptionIndex:a}},shouldCreateChip:function(e,t){return!1},shouldCreateChipOnInputBlur:function(e,t){return!1},shouldRemoveLastSelectedValue:function(e){return!1}},Di=Ai,Mi=function(){return Mi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Mi.apply(this,arguments)},Li=Mi(Mi({},Di),{closeMenu:function(){return{isOpen:!1}},getPlaceholder:function(e,t){return e.placeholder},getSelectionClass:function(e,t){return null},handleClick:function(e,t,n,r){var o=[n];return n?e.onChange(n[e.optionValue],n,o):e.onChange(t.searchInputValue,null,null),{selectedOptions:n?o:t.selectedOptions,searchInputValue:n?n[e.optionLabel]:t.searchInputValue,preselectedOptionIndex:Number.isInteger(r)?r:t.preselectedOptionIndex}},handleKeyDownEnter:function(e,t){return t.onEnter(e,e.target.value)},handleKeyDownAll:function(e){return{isOpen:!0}},renderHint:function(e,t){return null},setSelectedValue:function(e,t){var n=e.options,r=e.optionValue,o=e.selectedValue;if(""===o||null==o)return{searchInputValue:o,selectedOptions:[],preselectedOptionIndex:0};var a=n.findIndex((function(e){return e[r]===o}));return{searchInputValue:o,selectedOptions:[].concat(n[a]).filter(Boolean),preselectedOptionIndex:a}}}),Fi=function(){return Fi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fi.apply(this,arguments)},zi=Fi({},Di),Ui=function(){return Ui=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ui.apply(this,arguments)},Vi=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Hi=Ui(Ui({},Di),{closeMenu:function(){return{isOpen:!1,searchInputValue:"",preselectedOptionIndex:0,areAllChipsSelected:!1}},getFilteredOptions:function(e,t){var n=e.options,r=e.optionValue,o=t.selectedOptions.map((function(e){return e[r]}));return n.filter((function(e){return!o.includes(e[r])}))},getPlaceholder:function(e,t){return 0===t.selectedOptions.length?e.placeholder:t.selectedOptions.map((function(t){return t[e.optionLabel]})).join(", ")},handleClick:function(e,t,n,r){if(n){var o=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Vi(arguments[t]));return e}(t.selectedOptions,[n]);return e.onChange(n[e.optionValue],n,o),{selectedOptions:o,preselectedOptionIndex:Number.isInteger(r)?r:t.preselectedOptionIndex}}},handleKeyDownEnter:function(e,t){return t.onEnter(e,e.target.value)},setSelectedValue:function(e,t){var n=e.options,r=e.optionValue,o=e.selectedValue;return""===o||null==o?{selectedOptions:[],preselectedOptionIndex:0}:{selectedOptions:(Array.isArray(o)?o:[o]).map((function(e){return n.find((function(t){return t[r]===e}))})),preselectedOptionIndex:0}},shouldRemoveLastSelectedValue:function(e){return!0}}),Bi=Hi,Wi=function(){return Wi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Wi.apply(this,arguments)},Ki=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},qi=Wi(Wi(Wi({},Di),Bi),{handleKeyDownEnter:function(e){e.preventDefault(),e.stopPropagation()},handleKeyDownLeftRight:function(e,t,n){if(e.preventDefault(),e.stopPropagation(),!t.isOpen){if(e.target===n){var r=Cr(n,{isDirectionForward:!0});Sr(r)}nn({event:e,isDirectionForward:e.key===Ct.RIGHT,onComponentFiltering:function(e){if(!n.contains(e))return!1;var t=e.getAttribute("data-component");return"chip"===t||"button"===t}})}},handleCreateChip:function(e,t,n){var r=n.split(",").map((function(t){var n;return(n={})[e.optionLabel]=function(e){var t=e.match(/<([^<>]+)>/g);return t&&t.length?t.map((function(e){return e.replace(/^</,"").replace(/>$/,"")})).join(","):e}(t.toLocaleLowerCase().trim()),n[e.optionValue]=t.toLocaleLowerCase().trim(),n})).filter((function(n){return!t.selectedOptions.find((function(t){return t[e.optionValue]===n[e.optionValue]}))})),o=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Ki(arguments[t]));return e}(t.selectedOptions,r);return e.onChange(n,r,o),{selectedOptions:o}},renderHint:function(e,t){return null},setSelectedValue:function(e,t){var n=e.options,r=e.optionValue,o=e.optionLabel,a=e.selectedValue;if(""===a||null==a)return{selectedOptions:[],preselectedOptionIndex:0};var i=(Array.isArray(a)?a:[a]).map((function(e){var t;return n.find((function(t){return t[r]===e}))||((t={})[r]=e,t[o]=e,t)}));return{selectedOptions:i,preselectedOptionIndex:0}},shouldCreateChip:function(e,t){return!!e.searchable&&""!==t&&null!=t&&(!e.chipRegExp||e.chipRegExp.test(t))},shouldCreateChipOnInputBlur:function(e,t){return!!e.searchable&&""!==t&&null!=t},shouldRemoveLastSelectedValue:function(e){return!e.searchInputValue&&e.selectedOptions.length>0}}),Yi=qi,Gi=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i="30px",Xi="40px",Qi=function(e,t){var n=function(n){function r(e){var t=n.call(this,e)||this;return t.strategy=null,t.dropdownWrapper=null,t.dropdown=null,t.shadow=null,t.componentRef=null,t.componentNode=null,t.optionsWrapper=null,t.state={isOpen:!1,searchInputValue:"",selectedOptions:[],preselectedOptionIndex:0,areAllChipsSelected:!1},t.preventBlur=!1,t.onInputChange=function(e){var n=t.props.normalizeInput(e.target.value);t.props.onType&&t.props.onType(n),t.setState({searchInputValue:n})},t.onInputBlur=function(e){t.props.onBlur&&t.props.onBlur(e,t.state.searchInputValue),t.handleChipCreation(e.target.value,"shouldCreateChipOnInputBlur")},t.getPlaceholder=function(){return t.strategy.getPlaceholder(t.props,t.state)},t.removeSelectedValue=function(e){var n=t.state.selectedOptions,r=t.findOptionIndexByValue(e,n);if(r>=0){t.preventBlur=!0;var o=n[r],a=n.filter((function(e,t){return t!==r})),i=t.props,l=i.onChange,u=(i.onBlur,i.optionValue);t.setState({selectedOptions:a,preselectedOptionIndex:0}),l(o[u],o,a)}},t.openMenu=function(e){e.stopPropagation(),t.setState({isOpen:!0},(function(){return t.handleOptionMarking(!t.props.searchable)}))},t.closeMenu=function(e){e&&(e.stopPropagation(),e.preventDefault()),t.setState(t.strategy.closeMenu());var n=e&&t.dropdownWrapper&&t.dropdownWrapper.current&&t.dropdownWrapper.current.contains(e.relatedTarget),r=t.dropdown&&t.dropdown.current;n&&r&&r.focus()},t.toggleMenu=function(e){return e.stopPropagation(),t.state.isOpen?t.closeMenu(e):t.openMenu(e)},t.handleChipCreation=function(e,n){if(void 0===n&&(n="shouldCreateChip"),t.strategy[n](t.props,e)){var r=t.strategy.handleCreateChip(t.props,t.state,e).selectedOptions;t.setState({selectedOptions:r,searchInputValue:"",preselectedOptionIndex:0,areAllChipsSelected:!1})}},t.handleBlur=function(e){if(e.stopPropagation(),t.preventBlur)t.preventBlur=!1;else if(t.dropdownWrapper.current){var n=t.dropdownWrapper.current.contains(e.relatedTarget),r=t.dropdownWrapper.current.contains(document.activeElement);n||r||(t.props.onBlur(e,t.state.searchInputValue),t.closeMenu(e))}},t.handleOptionMarking=function(e){void 0===e&&(e=!0);var n=t.state.preselectedOptionIndex,r=t.optionsWrapper&&t.optionsWrapper.current;if(r){r.scrollTop=parseInt(Xi,10)*n;var o=r.querySelector('[data-navigation="'+n+'"]');o&&e&&o.focus()}},t.onBackSpacePress=function(e,n,r){var o=function(e,t){return e.map((function(e){return e[t]})).findIndex((function(e){return e===document.activeElement.innerText}))}(e,n);if(o>-1){var a=e[o]&&e[o][r];return t.removeSelectedValue(a),void t.dropdown.current.focus()}var i=e[e.length-1]&&e[e.length-1][r];t.removeSelectedValue(i)},t.onVKeyPress=function(e){(e.metaKey||e.ctrlKey)&&setTimeout((function(){t.handleChipCreation(t.state.searchInputValue,"shouldCreateChipOnInputBlur")}),100)},t.handleKeyDown=function(e){var n=t.getOptionsForRender(),r=t.props,o=r.optionLabel,a=r.optionValue,i=t.state,l=i.areAllChipsSelected,u=i.selectedOptions;switch(e.key){case Ct.TAB:t.state.isOpen&&t.closeMenu(e);break;case Ct.ESCAPE:t.setState(t.strategy.closeMenu());break;case Ct.UP:case Ct.DOWN:e.preventDefault(),e.stopPropagation();break;case Ct.LEFT:case Ct.RIGHT:t.strategy.handleKeyDownLeftRight(e,t.state,t.dropdown.current);break;case Ct.ENTER:n.length||t.strategy.handleKeyDownEnter(e,t.props);break;case Ct.BACKSPACE:t.strategy.shouldRemoveLastSelectedValue(t.state)&&t.onBackSpacePress(u,o,a);break;case Ct.A:(e.metaKey||e.ctrlKey)&&t.setState({areAllChipsSelected:!0});break;case Ct.C:if((e.metaKey||e.ctrlKey)&&l)(function(e,t){void 0===t&&(t=function(e){return null});var n=document.createElement("textarea");if(n.style.cssText="position: absolute; z-index: -9999; font-size: 16px",n.contentEditable="true",n.readOnly=!1,n.value=e,document.body.appendChild(n),navigator.userAgent.match(/ipad|ipod|iphone/i)){var r=document.createRange();r.selectNodeContents(n);var o=window.getSelection();o.removeAllRanges(),o.addRange(r),n.setSelectionRange(0,999999)}else n.select();var a=document.execCommand("copy");document.body.removeChild(n),t(a)})(u.map((function(e){return e[o]})).join(", ")),t.setState({areAllChipsSelected:!1});break;case Ct.V:t.onVKeyPress(e);break;default:t.setState(t.strategy.handleKeyDownAll(t.state))}},t.handleKeyUp=function(e){var n=t.getOptionsForRender(),r=t.state.preselectedOptionIndex;if(t.state.isOpen)switch(e.key){case Ct.UP:t.setState({preselectedOptionIndex:r-1<0?n.length-1:r-1},t.handleOptionMarking);break;case Ct.DOWN:t.setState({preselectedOptionIndex:r+1>=n.length?0:r+1},t.handleOptionMarking);break;case Ct.ENTER:if(e.preventDefault(),e.stopPropagation(),t.getOptionsForRender().length)return t.handleOptionSelection(n[r]);t.handleChipCreation(e.target.value);break;case Ct.COMMA:var o=e.target.value.replace(",","");t.handleChipCreation(o);break;case Ct.SPACE:var a=e.target.value&&e.target.value.trim();t.handleChipCreation(a);break;case Ct.HOME:t.setState({preselectedOptionIndex:0},t.handleOptionMarking);break;case Ct.END:t.setState({preselectedOptionIndex:Math.max(n.length-1,0)},t.handleOptionMarking)}},t.renderArrowIcon=function(e){var n=t.props,r=n.readOnly,o=n.suffix,a=t.state.isOpen;return"function"==typeof o?o(t.closeMenu):o||y.createElement(Sn,{ref:e,"aria-hidden":"true",name:a?"arrow-up":"arrow-down",className:"sg-dropdown__icon",onClick:r?null:t.toggleMenu})},t.handleOnKeyDown=function(e){if(e.key===Ct.SPACE){var n=t.state.isOpen;t.props.searchable||(e.preventDefault(),e.stopPropagation()),n||t.openMenu(e)}},t.strategy=function(e){switch(e){case"autocomplete":return Li;case"multiple":return Bi;case"email-select":return Yi;default:return zi}}(t.props.strategy),t.dropdownWrapper=y.createRef(),t.dropdown=y.createRef(),t.optionsWrapper=y.createRef(),t.shadow=y.createRef(),t.componentRef=function(e){t.componentNode=e},t}return Gi(r,n),r.prototype.componentDidMount=function(){this.setState(this.strategy.setSelectedValue(this.props,this.state))},r.prototype.componentDidUpdate=function(e,n){if(Boolean(JSON.stringify({selectedValue:e.selectedValue,options:e.options})!==JSON.stringify({selectedValue:this.props.selectedValue,options:this.props.options}))&&this.setState(this.strategy.setSelectedValue(this.props,this.state)),!n.isOpen&&this.state.isOpen&&Ii(this.getMouseEventMap()),n.isOpen&&!this.state.isOpen)ji(this.getMouseEventMap());else if(this.state.isOpen&&!t){var r=sn(this.componentNode);this.shadow.current.style.top="-"+r.height+"px"}},r.prototype.componentWillUnmount=function(){ji(this.getMouseEventMap())},r.prototype.getMouseEventMap=function(){return{click:this.handleBlur,touchstart:this.handleBlur}},r.prototype.getOptionsForRender=function(){var e=this.props,t=e.optionLabel,n=e.groupBy,r=e.disableGroupReorder,o=e.searchable,a=this.state.searchInputValue,i=this.strategy.getFilteredOptions(this.props,this.state);return n&&!r&&(i=i.sort((function(e,r){return function(e,t,n,r){return e[n]<t[n]?-1:e[n]>t[n]?1:e[r]<t[r]?-1:e[r]>t[r]?1:0}(e,r,n,t)}))),o&&(i=i.filter((function(e){if(!a)return!0;var n=a.trim().toLocaleLowerCase();return e[t].toLowerCase().indexOf(n)>-1}))),i},r.prototype.findOptionIndexByValue=function(e,t){var n=this.props.optionValue;return t.findIndex((function(t){return t[n]===e}))},r.prototype.handleOptionSelection=function(e,t){e&&e[this.props.optionDisabled]||(this.setState(this.strategy.handleClick(this.props,this.state,e,t)),this.closeMenu())},r.prototype.renderItem=function(e,t){var n=this.props,r=n.optionValue,o=n.optionLabel,a=void 0===o?r:o,i=n.optionDisabled,l=n.template,u=(n.size,this.state.preselectedOptionIndex),s=vt("sg-dropdown__option",e[i]&&"sg-dropdown__option--disabled",t===u&&"sg-dropdown__option--hovered");return y.createElement("div",{key:e[a]+"-"+e[r],className:s,style:{lineHeight:Xi},onClick:this.handleOptionSelection.bind(this,e,t),"data-e2e":"dropdown-option-"+e[r],"data-navigation":t,tabIndex:-1,role:"option","aria-disabled":e[i],"aria-selected":t===u},l&&l(e,{isOption:!0})||e[a])},r.prototype.renderGroupAndItem=function(e,t){var n=this.props,r=n.optionValue,o=n.optionLabel,a=void 0===o?r:o,i=n.groupBy;return n.size,y.createElement(y.Fragment,{key:e[a]+"-"+e[r]+"-fragment"},y.createElement("div",{key:e[a]+"-"+e[r]+"-group-header",className:"sg-dropdown__option-group-header",style:{lineHeight:$i}},e[i]),this.renderItem(e,t))},r.prototype.renderItems=function(e){var n=this,r=this.props,o=r.groupBy,a=r.state,i=r.validationMessage,l=(r.size,r.translation),u=sn(this.dropdownWrapper.current).bottom,s=this.getOptionsForRender(),c=parseInt(Xi,10),f=c,p=vt("sg-dropdown__content",t?"sg-dropdown__content--with-top-border":"sg-dropdown__content--without-top-border",t&&"sg-dropdown__content--with-box-shadow"),d=s.length?parseInt($i,10):0;s.length>0&&(d=s.length<3?c*s.length:3*c);var h=vt("sg-dropdown__options",i&&"sg-dropdown__options--with-bottom-padding");return y.createElement("div",{className:p,style:{top:t?"0":"100%"}},t&&t(e),!t&&y.createElement("div",{className:"sg-dropdown__content__shadow",ref:this.shadow}),y.createElement("div",{ref:this.optionsWrapper,className:"sg-dropdown__options-wrapper",style:{minHeight:d,maxHeight:"calc(100vh - "+(u+f)+"px)"}},y.createElement("div",{className:h,role:"listbox","data-e2e":"dropdown-options"},s.map((function(e,t,r){return(r[t-1]&&r[t-1][o])===(r[t]&&r[t][o])?n.renderItem(e,t):n.renderGroupAndItem(e,t)})),this.strategy.renderHint(s.length,y.createElement(Xa,{state:"hint",focused:!0,showValidation:!0,className:"sg-dropdown__nothing-found",validationMessage:l.nothingFound})))),a&&y.createElement(Xa,{state:a,focused:!0,showValidation:!0,className:"sg-dropdown__validation",validationMessage:i}))},r.prototype.render=function(){var t=this.state,n=t.isOpen,r=t.selectedOptions,o=t.searchInputValue,a=t.areAllChipsSelected,i=this.props,l=i.className,u=i.label,s=i.disabled,c=i.readOnly,f=i.searchable,p=i.size,d=i.state,h=i.enableShadow,m=i.theme,g=i.inline,v=i.expand,b=i.style,w=i.optionValue,E=i.optionLabel,_=i.onFocus,O=i.chipRegExp,S=i.name,x=i.transparent,k=i["data-e2e"],C=i["data-component"],T=i.options,P=i.suffix,N=i.border,I=vt("sg-dropdown-wrapper",n&&"sg-dropdown-wrapper--opened",g&&"sg-dropdown-wrapper--inline",v&&"sg-dropdown-wrapper--expand"),j=vt("sg-dropdown","sg-dropdown--"+p,s&&"sg-dropdown--disabled",N&&"sg-dropdown--border-"+N,d&&"sg-dropdown--state sg-dropdown--state-"+d,m&&"sg-dropdown--theme-"+m,h&&!n&&"sg-dropdown--box-shadow",this.strategy.getSelectionClass(r.length,"sg-dropdown--has-selection"),x&&"sg-dropdown--transparent",l),R={areAllChipsSelected:a,size:p,state:d,searchable:f,searchInputValue:o,getPlaceholder:this.getPlaceholder,renderArrowIcon:this.renderArrowIcon,openMenu:this.openMenu,onChange:this.onInputChange,selectedOptions:r,removeSelectedValue:this.removeSelectedValue,readOnly:c,componentRef:this.componentRef,isOpen:n,closeMenu:this.closeMenu,optionValue:w,optionLabel:E,handleBlur:this.onInputBlur,onFocus:_,chipRegExp:O,name:S,transparent:x,optionsLength:T.length,suffix:P};return y.createElement("div",{ref:this.dropdownWrapper,className:I,onKeyDown:c?null:this.handleKeyDown,onKeyUp:c?null:this.handleKeyUp,style:b,"data-e2e":k+"-wrapper","data-component":this.props["data-component"]},y.createElement(Ka,null,u),y.createElement("div",{ref:this.dropdown,className:j,"data-e2e":k,"data-component":C,tabIndex:this.props.searchable?-1:0,onBlur:this.handleBlur,onKeyDown:this.handleOnKeyDown,role:this.props.searchable?"combobox":"button","aria-autocomplete":this.props.searchable?"list":null,"aria-haspopup":"listbox","aria-expanded":n},e(R),n&&this.renderItems(R)))},r.defaultProps={options:[],inline:!1,expand:!1,multiple:!1,enableShadow:!1,onChange:function(){return!1},onBlur:function(){return!1},onEnter:function(){return!1},normalizeInput:function(e){return e},style:{},placeholder:"",size:"medium",strategy:"dropdown","data-e2e":"dropdown","data-component":"dropdown",translation:{nothingFound:"Nothing was found"}},r}(y.Component);return n},Ji=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi=function(){return Zi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Zi.apply(this,arguments)},el=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},tl={small:{lineHeight:"28px",minHeight:"30px"},medium:{lineHeight:"38px",minHeight:"40px"},large:{lineHeight:"38px",minHeight:"40px"},"x-large":{lineHeight:"58px",minHeight:"60px"}},nl={small:{lineHeight:"28px",minHeight:"30px"},medium:{lineHeight:"38px",minHeight:"40px"},large:{lineHeight:"38px",minHeight:"40px"},"x-large":{lineHeight:"48px",minHeight:"50px"}},rl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ji(t,e),t.prototype.renderPlaceholder=function(e){var t=this.props,n=t.size,r=t.className,o=t.getPlaceholder,a=t.renderArrowIcon,i=t.selectedOptions,l=t.openMenu,u=el(t,["size","className","getPlaceholder","renderArrowIcon","selectedOptions","openMenu"]),s={"sg-input-dropdown__placeholder":!0,"sg-input-dropdown__placeholder--selected":0===i.length},c=bt({styles:d.default,classes:s,className:r}),f=e?tl:nl;return y.createElement("div",Zi({className:c},xt(u),{onClick:l,style:f[n],"data-e2e":"dropdown-placeholder"}),o(),a())},t.prototype.renderInput=function(){var e=this.props,t=e.size,n=e.state,r=e.searchInputValue,o=e.getPlaceholder,a=e.renderArrowIcon,i=e.readOnly,l=e.openMenu,u=e.suffix,s=el(e,["size","state","searchInputValue","getPlaceholder","renderArrowIcon","readOnly","openMenu","suffix"]);return y.createElement(y.Fragment,null,y.createElement(ui,Zi({},xt(s),{wrapperClassName:"sg-dropdown-wrapper__input-wrapper",fieldClassName:"sg-dropdown-wrapper__input-field",onClick:l,readOnly:i,placeholder:o(),size:t,state:n,value:r,suffix:u&&a(),tabIndex:0})),!u&&a())},t.prototype.render=function(){var e=this,t=this.props,n=t.searchable,r=t.componentRef;return y.createElement(st.Consumer,null,(function(t){var o=t.device;return y.createElement("div",{ref:r,className:"sg-input-dropdown","data-e2e":e.props["data-e2e"]},n&&e.renderInput(),!n&&e.renderPlaceholder(o.isDesktop))}))},t.defaultProps={"data-e2e":"dropdown"},t}(y.Component),ol=Qi((function(e){var t=e,n=t.size,r=t.state,o=t.searchable,a=t.searchInputValue,i=t.getPlaceholder,l=t.renderArrowIcon,u=t.openMenu,s=t.onChange,c=t.onEnter,f=t.readOnly,p=t.selectedOptions,d=t.componentRef,h=t.onBlur,m=t.onFocus,g=t.suffix;return y.createElement(rl,{size:n,state:r,searchable:o,searchInputValue:a,getPlaceholder:i,renderArrowIcon:l,openMenu:u,onChange:s,onEnter:c,onFocus:m,onBlur:h,readOnly:f,selectedOptions:p,componentRef:d,"data-e2e":e["data-e2e"],suffix:g})})),al=ol,il=function(){return il=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},il.apply(this,arguments)},ll=y.forwardRef((function(e,t){var n=e.className,r=e.children,o=e.onClose,a=e.selected,i=e.state,l=e["data-e2e"],u=e["data-component"],s=e.tabIndex,c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","children","onClose","selected","state","data-e2e","data-component","tabIndex"]),f=vt("sg-chip",a&&"sg-chip--selected",i&&"sg-chip--state-"+i,n);return y.createElement("div",il({ref:t,className:f,"data-e2e":l,"data-component":u,tabIndex:s},xt(c)),y.createElement(Sn,{className:"sg-chip_item sg-chip_item--icon",name:"cross",size:"8","data-e2e":"chip-icon",onClick:o}),y.createElement(Un,{className:"sg-chip_item sg-chip_item--text",truncate:!0},r))}));ll.defaultProps={"data-e2e":"chip","data-component":"chip",tabIndex:0},ll.displayName="Chip";var ul=ll,sl=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cl=function(){return cl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},cl.apply(this,arguments)},fl=function(e){function t(t){var n=e.call(this,t)||this;return n.moreButtonNode=y.createRef(),n.state={rectsCalculated:!1,chipsRects:null,rootRect:null,moreButtonRect:null},n.rootNodeRef=function(e){var t=n.props.componentRef;n.rootNode=e,t(e)},n}return sl(t,e),t.prototype.componentDidMount=function(){this.calculateRects()},t.prototype.UNSAFE_componentWillReceiveProps=function(){this.setState({rectsCalculated:!1})},t.prototype.componentDidUpdate=function(){this.state.rectsCalculated||this.calculateRects()},t.prototype.isChipValid=function(e){return!this.props.chipRegExp||this.props.chipRegExp.test(e)},t.prototype.calculateRects=function(){if(0!==this.props.selectedOptions.length){var e=sn(this.rootNode),t=this.chipNodes.map((function(e){return sn(e)})),n=sn(this.moreButtonNode.current);this.setState({rectsCalculated:!0,rootRect:e,chipsRects:t,moreButtonRect:n})}},t.prototype.createChipRef=function(e){var t=this;return function(n){t.chipNodes[e]=n}},t.prototype.countChipsThatFitInSpace=function(e,t){for(var n=this.state.chipsRects,r=0,o=0,a=0;a<n.length&&!((o+=n[a].width+(a===n.length-1?0:t))>e);a++)r++;return r},t.prototype.renderChip=function(e,t){var n=this.props,r=n.optionValue,o=n.optionLabel,a=n.removeSelectedValue;return y.createElement(ul,cl({key:e[r],className:"sg-multiple-dropdown__chip",state:this.isChipValid(e[r])?void 0:"error",onClose:function(t){t.stopPropagation(),a(e[r])},onClick:function(e){e.preventDefault(),e.stopPropagation()},tabIndex:-1},t),e[o])},t.prototype.renderChipsForMeasure=function(){var e=this,t=this.props,n=t.selectedOptions,r=t.optionLabel;return this.chipNodes=[],n.map((function(t,n){return y.createElement(ul,{key:n,className:"sg-multiple-dropdown__chip",ref:e.createChipRef(n)},t[r])}))},t.prototype.renderMoreButton=function(e){var t=this.props.openMenu;return y.createElement(oo,{ref:this.moreButtonNode,className:"sg-multiple-dropdown__more-button",onClick:t,color:"neutral",size:"small",action:"button"},e+" more")},t.prototype.renderElementsToMeasure=function(){return y.createElement(y.Fragment,null,this.renderChipsForMeasure(),this.renderMoreButton(10))},t.prototype.renderSingleChip=function(e){var t=this.props.selectedOptions,n=this.state.rootRect.width-e-e-20;return this.renderChip(t[0],{style:{maxWidth:n+"px"}})},t.prototype.renderAllChipsIfPossible=function(e){var t=this,n=this.props.selectedOptions,r=this.state.rootRect.width-e-e;return this.countChipsThatFitInSpace(r,e)===n.length?n.map((function(e){return t.renderChip(e)})):null},t.prototype.renderChipsThatFitAndMoreButton=function(e){var t=this,n=this.props.selectedOptions,r=this.state,o=r.rootRect,a=r.moreButtonRect,i=o.width-e-e-a.width-e,l=this.countChipsThatFitInSpace(i,e);return 0===l?y.createElement(y.Fragment,null,this.renderChip(n[0],{style:{width:i+"px"}}),this.renderMoreButton(n.length-1)):y.createElement(y.Fragment,null,n.slice(0,l).map((function(e){return t.renderChip(e)})),this.renderMoreButton(n.length-l))},t.prototype.renderFinalChips=function(){var e=this.props.selectedOptions,t=getComputedStyle(this.rootNode),n=parseInt(t.paddingLeft,10);return 1===e.length?this.renderSingleChip(n):this.renderAllChipsIfPossible(n)||this.renderChipsThatFitAndMoreButton(n)},t.prototype.renderFinal=function(){return y.createElement(y.Fragment,null,this.renderFinalChips())},t.prototype.renderEmpty=function(){var e=this.props.getPlaceholder;return y.createElement(aa,{gutter:"medium",align:"center",direction:"row",style:{width:"100%"}},y.createElement("div",{className:"sg-multiple-dropdown__placeholder"},e()))},t.prototype.render=function(){var e=this.state.rectsCalculated,t=this.props,n=t.isOpen,r=t.selectedOptions,o=t.state,a=t.openMenu,i=t.name,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["isOpen","selectedOptions","state","openMenu","name"]),u=vt("sg-multiple-dropdown__closed-state",o&&"sg-multiple-dropdown__closed-state--"+o);return y.createElement("div",cl({className:u,style:n?{visibility:"hidden"}:void 0,ref:this.rootNodeRef,onClick:a},xt(l)),0===r.length&&this.renderEmpty(),r.length>0&&(e?this.renderFinal():this.renderElementsToMeasure()),y.createElement("div",{"data-name":i,tabIndex:-1,onFocus:a}))},t}(y.Component),pl=fl,dl=function(){return dl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},dl.apply(this,arguments)},hl=function(e){var t=e.areAllChipsSelected,n=e.componentRef,r=e.selectedOptions,o=e.closeMenu,a=e.removeSelectedValue,i=e.renderArrowIcon,l=e.optionValue,u=e.getPlaceholder,s=e.optionLabel,c=e.searchable,f=e.handleBlur,p=e.searchInputValue,d=e.chipRegExp,h=e.optionsLength,m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["areAllChipsSelected","componentRef","selectedOptions","closeMenu","removeSelectedValue","renderArrowIcon","optionValue","getPlaceholder","optionLabel","searchable","handleBlur","searchInputValue","chipRegExp","optionsLength"]),g=vt("sg-multiple-dropdown__opened-state",0===h&&"sg-multiple-dropdown__opened-state--no-data"),v=function(e){return function(t){t.preventDefault(),t.stopPropagation(),a(e[l])}};return y.createElement("div",{className:g,ref:n,onClick:o},0===r.length&&!c&&y.createElement("div",{className:"sg-multiple-dropdown__placeholder"},u()),r.length>0&&r.map((function(e,n){return y.createElement(ul,{className:"sg-multiple-dropdown__chip",state:(r=e[l],!d||d.test(r)?void 0:"error"),selected:t,onClose:v(e),key:n},e[s]);var r})),c&&y.createElement(ui,dl({className:"sg-multiple-dropdown__input",wrapperClassName:"sg-multiple-dropdown__input-wrapper",fieldClassName:"sg-multiple-dropdown__field"},xt(m),{inline:!0,autoFocus:!0,value:p,onClick:function(e){e.preventDefault(),e.stopPropagation()},onBlur:f})),i())},ml=function(){return ml=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ml.apply(this,arguments)},yl=Qi((function(e){var t=e.openMenu,n=e.componentRef,r=e.isOpen,o=e.renderArrowIcon,a=e.selectedOptions,i=e.removeSelectedValue,l=e.optionValue,u=e.getPlaceholder,s=e.optionLabel,c=e.state,f=e.chipRegExp,p=e.name;return y.createElement(pl,{name:p,openMenu:t,componentRef:n,isOpen:r,renderArrowIcon:o,selectedOptions:a,removeSelectedValue:i,optionValue:l,getPlaceholder:u,optionLabel:s,state:c,chipRegExp:f})}),(function(e){var t=e.componentRef,n=e.areAllChipsSelected,r=e.selectedOptions,o=e.closeMenu,a=e.removeSelectedValue,i=e.renderArrowIcon,l=e.optionValue,u=e.getPlaceholder,s=e.optionLabel,c=e.searchable,f=e.onChange,p=e.handleBlur,d=e.onFocus,h=e.searchInputValue,m=e.chipRegExp,g=e.optionsLength;return y.createElement(hl,{componentRef:t,areAllChipsSelected:n,selectedOptions:r,closeMenu:o,searchable:c,removeSelectedValue:a,renderArrowIcon:i,optionValue:l,getPlaceholder:u,optionLabel:s,onChange:f,onFocus:d,handleBlur:p,searchInputValue:h,chipRegExp:m,optionsLength:g})})),gl=function(e){return y.createElement(st.Consumer,null,(function(){return y.createElement(yl,ml({strategy:"multiple"},e))}))},vl=function(){return vl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},vl.apply(this,arguments)},bl=function(e){return y.createElement(gl,vl({searchable:!0},e,{strategy:"email-select"}))},wl=function(){return wl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},wl.apply(this,arguments)},El=function(e){var t=e.icon,n=e.iconSize,r=e.children,o=e.className,a=e.shortcut,i=e.disabled,l=e.onClick,u=e.tabIndex,s=e["data-e2e"],c=e["data-component"],f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["icon","iconSize","children","className","shortcut","disabled","onClick","tabIndex","data-e2e","data-component"]),p=vt("sg-menu-item",i&&"sg-menu-item--disabled",o);return y.createElement("li",wl({className:p,onClick:function(e){i?e.stopPropagation():l(e)},"data-e2e":s,"data-component":c},xt(f),{onKeyDown:function(e){return function(e){var t=e.event,n=e.onClick;Ct.ENTER!==t.key&&Ct.SPACE!==t.key||n(t)}({event:e,onClick:l})},tabIndex:u,role:"menuitem"}),t&&y.createElement(Sn,{name:t,size:n,className:"sg-menu-item__icon"}),y.createElement("span",{className:"sg-menu-item__text"},r),a&&y.createElement("span",{className:"sg-menu-item__shortcut"},a))};El.displayName="MenuItem",El.defaultProps={iconSize:"14",onClick:function(){return null},"data-e2e":"menu-item","data-component":"menu-item"};var _l=El,Ol=function(e){return y.createElement("li",null,y.createElement("ul",{"data-e2e":e["data-e2e"],role:"group"},e.groupTitle&&y.createElement(_l,{disabled:!0,className:"sg-menu-group--title"},e.groupTitle),e.children))};Ol.defaultProps={"data-e2e":"menu-group"};var Sl,xl,kl=Ol;!function(e){e.Open="open",e.Close="close"}(Sl||(Sl={})),function(e){e.Datepicker="datepicker",e.Input="input",e.Checkbox="checkbox",e.Dropdown="dropdown",e.EmailDropdown="emailDropdown",e.MultipleDropdown="multipleDropdown"}(xl||(xl={}));var Cl,Tl,Pl=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Nl=function(){return Nl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Nl.apply(this,arguments)},Il=function(e){var t=e.option,n=e.index,r=e.field,o=(r.children[n-1]&&r.children[n-1][r.groupBy])===(r.children[n]&&r.children[n][r.groupBy]);return!r.groupBy||o?null:t[r.groupBy]},jl=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Pl(t,e),t.prototype.handleFilterCheckboxSelection=function(e){var t=e.option,n=e.field,r=e.key,o=n.children.map((function(e){var n=Object.assign({},e);return n.id===t.id&&(n.checked=!t.checked),n}));this.fireOnChange({field:Nl(Nl({},n),{children:o}),key:r})},t.prototype.fireOnChange=function(e){var t,n=e.field,r=e.key,o=n.onChange||this.props.onChange;o&&o(Nl(Nl({},this.props.config),((t={})[r]=n,t)))},t.prototype.renderTitle=function(){var e=this.props.title;return e?y.createElement(_l,{disabled:!0,tabIndex:0,className:"sg-filter__title"},e):null},t.prototype.renderDatepicker=function(e){var t=this,n=e.field,r=e.key;return y.createElement(kl,{key:n.type+"-group",groupTitle:n.groupTitle},n.children.map((function(e,o){return y.createElement(_l,{key:"datepicker-"+o},y.createElement(Ni,Nl({size:"small",onChange:function(o){return t.changeSelectedValue({option:e,value:o,field:n,key:r})}},e)))})))},t.prototype.renderDropdown=function(e){var t=this,n=e.field,r=e.key,o=e.tag;return y.createElement(kl,{key:n.type+"-group",groupTitle:n.groupTitle},n.children.map((function(e,a){return y.createElement(_l,{key:n.type+"-"+a,className:"sg-filter-list__dropdown-field"},y.createElement(o,Nl({},e,{size:"small",onChange:function(o){return t.changeSelectedValue({option:e,value:o,field:n,key:r})}})))})))},t.prototype.changeSelectedValue=function(e){var t=e.option,n=e.value,r=e.field,o=e.key,a=r.children.map((function(e){var r=Object.assign({},e);return r.id===t.id&&(r.selectedValue=n,r.value=n),r}));this.fireOnChange({field:Nl(Nl({},r),{children:a}),key:o})},t.prototype.renderInput=function(e){var t=this,n=e.field,r=e.key;return y.createElement(kl,{key:n.type+"-group",groupTitle:n.groupTitle},n.children.map((function(e,o){return y.createElement(_l,{key:n.type+"-"+o},y.createElement(ui,Nl({},e,{size:"small",onChange:function(o){return t.changeSelectedValue({option:e,value:o.target.value,field:n,key:r})}})))})))},t.prototype.renderCheckboxOptions=function(e){var t=this,n=e.field,r=e.key,o=function(e){var o=e.index,a=e.option;return y.createElement(_l,{key:n.type+"-item-"+o,onClick:function(e){e.stopPropagation(),t.handleFilterCheckboxSelection({option:a,field:n,key:r})}},y.createElement(va,{key:a.label,checked:a.checked,readOnly:!0,"aria-label":a.ariaLabel,className:"sg-filter__checkbox"},a.label))};return n.groupTitle?y.createElement(kl,{key:n.type+"-group-"+n.groupTitle,groupTitle:n.groupTitle},n.children.map((function(e,t){return o({index:t,option:e})}))):n.children.map((function(e,t){return y.createElement(kl,{key:n.type+"-group-"+t,groupTitle:Il({option:e,index:t,field:n})},o({index:t,option:e}))}))},t.prototype.renderFieldsConfiguration=function(){var e=this,t=this.props.config;return Object.keys(t).map((function(n){var r=t[n];switch(r.type){case xl.Checkbox:return e.renderCheckboxOptions({field:r,key:n});case xl.Datepicker:return e.renderDatepicker({field:r,key:n});case xl.Input:return e.renderInput({field:r,key:n});case xl.Dropdown:return e.renderDropdown({field:r,key:n,tag:al});case xl.EmailDropdown:return e.renderDropdown({field:r,key:n,tag:bl});case xl.MultipleDropdown:return e.renderDropdown({field:r,key:n,tag:gl})}}))},t.prototype.render=function(){return y.createElement(y.Fragment,null,this.renderTitle(),this.renderFieldsConfiguration())},t}(y.Component),Rl=jl,Al=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dl=function(){return Dl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Dl.apply(this,arguments)},Ml=function(e){function t(t){var n=e.call(this,t)||this;return n.state={animation:null},n.triggerClose=function(e){e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation();var t=n.props.onClose;n.state.animation!==Sl.Close&&n.setState({animation:Sl.Close},(function(){setTimeout((function(){t()}),400)}))},n.keypressHandler=function(e){27===e.keyCode&&(e.stopPropagation(),n.triggerClose(e))},n.triggerReset=function(e){e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),n.props.onResetFilter()},n.listRef=y.createRef(),n.wrapperFilterRef=y.createRef(),n}return Al(t,e),t.prototype.componentDidMount=function(){this.setPosition(),this.listRef&&this.listRef.current.focus(),this.setState({animation:Sl.Open})},t.prototype.componentDidUpdate=function(e){Wo(this.props.config,e.config)&&this.setPosition()},t.prototype.setPosition=function(){var e=this.props,t=e.position,n=e.rect,r=e.device,o=e.priority;ra(t,n,r,this.wrapperFilterRef,{setMaxHeight:!0,priority:o})},t.prototype.render=function(){var e=this.props,t=e.className,n=(e.children,e.device),r=e.position,o=(e.onClose,e.translations),a=e.title,i=e.config,l=e.onChange,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["className","children","device","position","onClose","translations","title","config","onChange"]),s=this.state.animation,c=n.isPhone,f=vt("sg-filter-menu",c?"sg-filter-menu--mobile":"sg-filter-menu--position-"+r,s&&(c?"sg-filter-menu--"+s:"sg-filter-menu-list--"+s)),p=vt(!c&&"sg-filter-menu-list--position-"+r,c&&s&&"sg-filter-menu-list--"+s,"sg-filter--menu",t),d=y.createElement(fa,{density:"none",align:"center",justify:"flex-end",background:"transparent",className:"sg-filter-list__buttons"},y.createElement(aa,{padding:["x-small","medium"]},y.createElement(oo,{size:"small",onClick:this.triggerReset,color:"secondary"},o.resetBtnLabel),y.createElement(oo,{size:"small",color:"neutral",onClick:this.triggerClose},o.closeBtnLabel)));return y.createElement(y.Fragment,null,y.createElement("div",{className:"sg-filter--trigger-close-background",onClick:this.triggerClose}),y.createElement(ua,Dl({onKeyDown:this.keypressHandler,wrapperClasses:f,classes:p,ref:this.listRef,wrapperRef:this.wrapperFilterRef},u,{"data-e2e":this.props["data-e2e"],footer:c?null:d}),y.createElement("div",null,y.createElement(Rl,{title:a,config:i,onChange:l}),c&&d)))},t.defaultProps={position:na,onClose:function(){return null},"data-e2e":"filter-list"},t}(y.Component),Ll=function(e){return y.createElement(st.Consumer,null,(function(t){var n=t.device;return y.createElement(Ml,Dl({},e,{device:n}))}))},Fl=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),zl=function(){return zl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},zl.apply(this,arguments)},Ul=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={opened:!1,rect:{top:null,right:null,bottom:null,left:null},initialConfig:t.props.config,hasSelection:!1},t.closeMenu=function(){var e=t.props,n=e.onClose,r=e.config;t.setState({opened:!1,hasSelection:!Wo(r,t.state.initialConfig)}),n&&n()},t.openMenu=function(e){e.stopPropagation();var n=sn(e.currentTarget),r=n.height+n.top+window.pageYOffset,o=window.innerWidth-(n.left+n.width),a=window.innerHeight-n.top,i=n.left;t.setState({rect:{top:r+"px",right:o+"px",bottom:a+"px",left:i+"px"},opened:!0})},t}return Fl(t,e),t.prototype.componentDidUpdate=function(e){Wo(this.props.config,e.config)||this.setState({hasSelection:!Wo(this.props.config,this.state.initialConfig)})},t.prototype.renderFilterMenuListComponent=function(){var e=this,t=this.props,n=t.children,r=t.className,o=t.position,a=t.config,i=t.title,l=t.translations,u=t.onChange,s=this.state,c=s.rect,f=s.initialConfig;return y.createElement(Ll,{config:a,title:i,className:r,onClose:this.closeMenu,position:o,rect:c,translations:l,onResetFilter:function(){return e.props.onResetFilter(f)},priority:this.props.priority,onChange:u},n)},t.prototype.renderFilterMenuList=function(){return"fixed"===this.props.position||this.props.device.isPhone?g.createPortal(this.renderFilterMenuListComponent(),document.body):y.createElement(y.Fragment,null,y.createElement(ea,null),y.createElement($o,null,this.renderFilterMenuListComponent()))},t.prototype.render=function(){var e=this.state,t=e.opened,n=e.hasSelection,r=this.props,o=r["data-e2e"],a=r["data-component"],i=(r.title,r["aria-label"]),l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(r,["data-e2e","data-component","title","aria-label"]);return y.createElement("div",zl({className:"sg-filter","data-e2e":o,"data-component":a,"aria-label":i},xt(l),{onKeyDown:function(e){return e.stopPropagation()}}),y.createElement(jn,{icon:"filter",onClick:this.openMenu,className:n?"sg-filter__icon-selected-state":"",isActive:t,"aria-haspopup":!0,"aria-expanded":t}),t&&this.renderFilterMenuList())},t.defaultProps={position:"absolute",onClose:function(){return null},"data-e2e":"filter","data-component":"filter",translations:{closeBtnLabel:"Close",resetBtnLabel:"Reset"}},t}(y.Component),Vl=gn((function(e){return y.createElement(st.Consumer,null,(function(t){var n=t.device;return y.createElement(Ul,zl({},e,{device:n}))}))})),Hl="UPDATE_ACTIVITY_LOG_DATA",Bl=function(){return Bl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Bl.apply(this,arguments)};!function(e){e.None="none",e.Ascending="ascending",e.Descending="descending"}(Tl||(Tl={})),(Cl={})[Tl.None]="sort",Cl[Tl.Ascending]="sort-ascending",Cl[Tl.Descending]="sort-descending";var Wl=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Kl=y.createContext({sortedData:[],sortElement:null,setSortConfig:function(e){return null}}),ql=function(e){var t=e.children,n=e.data,r=Wl(y.useState(null),2),o=r[0],a=r[1],i=Wl(y.useState(Tl.None),2),l=i[0],u=i[1],s=Wl(y.useState(null),2),c=s[0],f=s[1],p=y.useMemo((function(){return{sortedData:o?o([].concat(n)):[].concat(n),sortElement:c,setSortConfig:function(e){var t=e.sortFunctionToUse,n=e.sortType,r=e.sortElement;a((function(){return t})),u(n),f(r)}}}),[n,o,l,c]);return y.createElement(Kl.Provider,{value:p},t)};ql.displayName="SortProvider";function Yl(e){var t,n;if(null==e||"object"!=typeof e)return e;if(e instanceof Date){var r=new Date;return r.setTime(e.getTime()),r}if(e instanceof Array){for(var o=[],a=0;a<e.length;a+=1)o[a]=Yl(e[a]);return o}if(e instanceof Object){var i={};try{for(var l=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(e)),u=l.next();!u.done;u=l.next()){var s=u.value;Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=Yl(e[s]))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return i}}var Gl=function(){return Gl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gl.apply(this,arguments)},$l=function(e){var t=e.background,n=e.children,r=e.className,o=e.icon,a=e.iconColor,i=e.message,l=e.title,u=e.shadow,s=e.borderRadius,c=e.showFragments,f=e.handleKeyDown,p=e.tabIndex,d=e.iconSize,h=e.iconClassName,m=e.titleProps,g=e["data-e2e"],v=e["data-component"],b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["background","children","className","icon","iconColor","message","title","shadow","borderRadius","showFragments","handleKeyDown","tabIndex","iconSize","iconClassName","titleProps","data-e2e","data-component"]),w=vt("sg-placeholder",r),E=vt("sg-placeholder-wrapper",u&&"sg-placeholder--shadow","sg-placeholder--background-"+t,s&&"sg-placeholder-wrapper--border-radius-"+s),_=rt()?"200":"300",O=rt()?"120":"240";return y.createElement("div",Gl({className:E,"data-e2e":g,"data-component":v,tabIndex:p,onKeyDown:f,role:"figure"},xt(b)),c&&y.createElement("div",{className:"sg-placeholder__images-container"},y.createElement("div",{className:"sg-placeholder__background-elements"},y.createElement(Sn,{multicolor:!0,name:"background-dots",width:"800",height:"240"}))),y.createElement("div",{className:w,"data-e2e":e["data-e2e"]},y.createElement(Sn,{name:o,color:a,width:d||_,height:d||O,className:h,multicolor:!0}),l&&y.createElement($n,Gl({},m,{density:"cozy",align:"center"}),l),i&&y.createElement(Un,{align:"center"},i),n&&y.createElement("div",{className:"sg-placeholder-spacer"}),n))};$l.defaultProps={icon:"presentational-paper-rocket-dotted",iconColor:"primary",background:"white",showFragments:!0,"data-e2e":"empty-data-placeholder","data-component":"empty-data-placeholder",tabIndex:0,titleProps:{weight:"light",level:"3"}};var Xl=$l,Ql=function(){return Ql=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ql.apply(this,arguments)},Jl=gn(Un,{preventTooltipOnMobile:!0,delay:1e3}),Zl=function(e){var t=e.children,n=e.colSpan,r=e.dataAttributes,o=e.cellHeight,a=e.isInColumnSelection,i=e.isInRowSelection,l=e.isFirst,u=e.style,s=e.className,c=e.tabIndex,f=e["data-e2e"],p=e["data-component"],d=e["aria-describedby"],h=vt("sg-table__cell",s,"sg-table__cell--height-"+o,a&&"sg-table__cell--is-selected",i&&"sg-table__cell--is-in-row-selection"),m=Ql(Ql({className:h,colSpan:n,tabIndex:c},r),{style:u,"data-e2e":f,"data-component":p,"aria-describedby":d});return"string"==typeof t?y.createElement(st.Consumer,null,(function(e){var n=e.device;return y.createElement("td",Ql({},m),l&&n.isPhone?y.createElement($n,{truncate:!0,level:"4",density:"none"},t):y.createElement(Jl,{truncate:!0,tooltip:t},t))})):y.createElement("td",Ql({},m),t)};Zl.defaultProps={"data-e2e":"table-cell","data-component":"table-cell",cellHeight:"medium",tabIndex:-1};var eu=Zl,tu=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}}();function nu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ru(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 ou="undefined"!=typeof window?n(5544):void 0,au={children:!0,direction:!0,options:!0,recognizeWith:!0,vertical:!0},iu={action:"tap press",onDoubleTap:"doubletap",onPan:"pan",onPanCancel:"pancancel",onPanEnd:"panend",onPanStart:"panstart",onPinch:"pinch",onPinchCancel:"pinchcancel",onPinchEnd:"pinchend",onPinchIn:"pinchin",onPinchOut:"pinchout",onPinchStart:"pinchstart",onPress:"press",onPressUp:"pressup",onRotate:"rotate",onRotateCancel:"rotatecancel",onRotateEnd:"rotateend",onRotateMove:"rotatemove",onRotateStart:"rotatestart",onSwipe:"swipe",onSwipeRight:"swiperight",onSwipeLeft:"swipeleft",onSwipeUp:"swipeup",onSwipeDown:"swipedown",onTap:"tap"};function lu(e,t){t.hasOwnProperty("vertical")&&console.warn("vertical is deprecated, please use `direction` instead");var n=t.direction;if(n||t.hasOwnProperty("vertical")){var r=n||(t.vertical?"DIRECTION_ALL":"DIRECTION_HORIZONTAL");e.get("pan").set({direction:ou[r]}),e.get("swipe").set({direction:ou[r]})}t.options&&Object.keys(t.options).forEach((function(n){if("recognizers"===n)Object.keys(t.options.recognizers).forEach((function(n){var r=e.get(n);r.set(t.options.recognizers[n]),t.options.recognizers[n].requireFailure&&r.requireFailure(t.options.recognizers[n].requireFailure)}),this);else{var r={};r[n]=t.options[n],e.set(r)}}),this),t.recognizeWith&&Object.keys(t.recognizeWith).forEach((function(n){e.get(n).recognizeWith(t.recognizeWith[n])}),this),Object.keys(t).forEach((function(n){var r=iu[n];r&&(e.off(r),e.on(r,t[n]))}))}Object.keys(iu).forEach((function(e){au[e]=!0}));var uu=function(e){function t(){return nu(this,t),ru(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}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,e),tu(t,[{key:"componentDidMount",value:function(){this.hammer=new ou(this.domElement),lu(this.hammer,this.props)}},{key:"componentDidUpdate",value:function(){this.hammer&&lu(this.hammer,this.props)}},{key:"componentWillUnmount",value:function(){this.hammer&&(this.hammer.stop(),this.hammer.destroy()),this.hammer=null}},{key:"render",value:function(){var e={};Object.keys(this.props).forEach((function(t){au[t]||(e[t]=this.props[t])}),this);var t=this;return e.ref=function(e){t.props.ref&&t.props.ref(e),t.domElement=e},y.cloneElement(y.Children.only(this.props.children),e)}}]),t}(y.Component);uu.displayName="Hammer",uu.propTypes={className:b().string};var su=uu,cu=function(){return cu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},cu.apply(this,arguments)},fu={recognizers:{tap:{threshold:9},press:{threshold:9}}},pu=function(e){var t=e.className,n=e.children,r=e.loading,o=e.dragAndDrop,a=e.onContextMenu,i=e.onRefsReady,l=e.onRowPress,u=e.onRowTap,s=1;return Array.isArray(n)&&(s=n.reduce((function(e,t){return e.concat(t)}),[]).filter(Boolean).length),y.createElement(su,{ref:function(e){return e&&i&&i(e.domElement)},className:vt(t,"hammerjs-wrapper","sg-table__row",r&&"table-row--loading"),onTap:u,onPress:l,options:fu},y.createElement("tr",cu({onContextMenu:a},o,{"data-e2e":e["data-e2e"]}),r?y.createElement(eu,{className:"table-row__cell--loading",colSpan:s},y.createElement("div",{className:"table-row__loader-wrapper"},y.createElement(yr,{density:"none",position:"absolute",iconSize:"40"}))):n))};pu.defaultProps={onClick:function(){return null},onContextMenu:function(){return null},onRefsReady:function(){return null},onRowPress:function(){return null},onRowTap:function(){return null},"data-e2e":"table-row"};var du=pu,hu=function(){return hu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},hu.apply(this,arguments)},mu=function(e){return 0!==e.length&&e.find((function(e){return Boolean(e.footer)}))},yu=function(e){return e.tableId+"-th-"+e.index},gu=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),vu=function(){return vu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},vu.apply(this,arguments)},bu=function(e){function t(t){var n=e.call(this,t)||this;return n.id=un(),n}return gu(t,e),t.prototype.getRowKey=function(e){return e[this.props.rowKey]||JSON.stringify(e)},t.prototype.getTransitionGroupProps=function(e,t){var n={className:"sg-table__body",component:"tbody","data-e2e":"table-body"};return this.props.reordable&&e&&t?vu(vu({},n),{id:this.id,ref:function(t){return t&&e.innerRef(document.querySelector("#"+t.props.id))},style:{background:"#25b8d2",width:"100%"}}):n},t.prototype.getCSSTransitionProps=function(){return this.props.disableRowAnimation?null:{classNames:"sg-table__row--animation",timeout:500}},t.prototype.getTableRowProps=function(e,t,n){var r=this.props,o=r.onContextMenuHandler,a=r.onRowPress,i=r.onRowTap,l=r.reordable,u=r.rowSelectionHandler,s={onContextMenu:function(t){return o({selectedRow:e,event:t})},onRowTap:function(t){u(e,t),i(e,t)},onRowPress:function(t){return a(e,t)},loading:(0,r.shouldRowLoading)(e),"data-e2e":"table-row"};return l&&t&&n?vu(vu({},s),{dragAndDrop:vu(vu({},t.draggableProps),t.dragHandleProps),onRefsReady:t.innerRef,style:vu({userSelect:"none"},t.draggableProps.style)}):s},t.prototype.isRowExpanded=function(e){var t=this.props,n=t.isExpandedRowInComponentProps,r=t.expandableTemplate,o=Boolean(r);return n(e)&&o},t.prototype.renderTableCell=function(e){var t=e.column,n=e.index,r=e.rowIndex,o=this.props,a=o.data,i=o.cellHeight,l=o.isSelectedRowInComponentState,u=o.selectedColumns,s=o.tableId,c=a[r];if(!c)return null;var f=c[t.accessor],p=t.render?t.render(f,c):f,d=u.includes(n),h=l(c);return y.createElement(eu,{key:r+"-"+n,cellHeight:i,isInColumnSelection:d,isInRowSelection:h,isFirst:0===n,style:t.style,className:t.className,"aria-describedby":yu({tableId:s,index:n}),dataAttributes:{"data-label":"string"==typeof t.header?t.header:null,"data-cell-index":n,"data-row-index":r}},p)},t.prototype.renderTableRow=function(e){var t=this,n=e.row,r=e.rowIndex,o=e.draggableProvided,a=e.draggableSnapshot,i=this.props.columns;return y.createElement(du,vu({},this.getTableRowProps(n,o,a)),i.map((function(e,n){return t.renderTableCell({column:e,index:n,rowIndex:r})})))},t.prototype.render=function(){var e=this,t=this.props,n=t.columns,r=t.data,o=t.expandableTemplate,a=t.disableRowAnimation,i=a?"tbody":Gt.TransitionGroup,l=a?y.Fragment:Gt.CSSTransition;return y.createElement(st.Consumer,null,(function(t){var a=t.device;return y.createElement(i,vu({},e.getTransitionGroupProps()),r.map((function(t,r){return y.createElement(l,vu({key:e.getRowKey(t)},e.getCSSTransitionProps()),y.createElement(y.Fragment,null,y.createElement(du,vu({},e.getTableRowProps(t),{className:e.isRowExpanded(t)?"sg-table__row-expanded":null}),n.slice(0,-1).map((function(t,n){return e.renderTableCell({column:t,index:n,rowIndex:r})})),a.isPhone&&e.isRowExpanded(t)&&y.createElement(eu,{className:"sg-table__cell-expandable-wrapper",dataAttributes:{colSpan:n.length}},o(t,r)),n.slice(-1).map((function(t){return e.renderTableCell({column:t,index:n.length-1,rowIndex:r})}))),!a.isPhone&&e.isRowExpanded(t)&&y.createElement(du,null,y.createElement(eu,{className:"sg-table__cell-expandable-wrapper",dataAttributes:{colSpan:n.length},style:{padding:0}},o(t,r)))))})))}))},t.defaultProps={"data-e2e":"table-body"},t}(y.Component),wu=bu,Eu=function(e){var t=e.columnLength,n=e.rowLength,r=e.tableHead,o=Array(n).fill(null);return y.createElement("table",{className:"sg-table"},r,y.createElement("tbody",null,o.map((function(e,n){return y.createElement("tr",{key:n,className:"sg-table__row"},Array(t).fill(null).map((function(e,t,n){return y.createElement("td",{key:t,className:"sg-table__cell sg-table__cell--height-medium"},y.createElement("div",{className:"sg-table__cell--skeleton"}))})))}))))};Eu.defaultProps={"data-e2e":"table-cell","data-component":"table-cell",rowLength:5,tabIndex:-1};var _u,Ou,Su=Eu,xu=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ku=function(){return ku=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ku.apply(this,arguments)},Cu=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},Tu=new da,Pu="data-row-index",Nu="data-cell-index",Iu=function(e){function t(t){var n=e.call(this,t)||this;return n.state={selectedRows:[]},n.tableId=null,n.onTableClick=function(e){var t=e.target;if("td"!==t.tagName&&(t=t.closest("td")),null!==t){var r=Number(t.getAttribute(Pu)),o=Number(t.getAttribute(Nu));n.props.onCellSelection({rowIndex:r,colIndex:o})}},n.getColumnRender=function(e,t,n){return e[0].render?e[0].render(t,n):t},n.handleCellNavigation=function(e){var t=e.event,r=e.cellAccumulator,o=void 0===r?0:r,a=e.rowAccumulator,i=void 0===a?0:a;nn({event:t,isDirectionForward:!(o<0||i<0),onComponentFiltering:function(e){var n=t.target,r=n.getAttribute(Nu),a=n.getAttribute(Pu);if(null!==r&&null!==a){var l=String(Number(a)+i),u=String(Number(r)+o);return e.getAttribute(Pu)===l&&e.getAttribute(Nu)===u}},onSuccessCallback:function(e){var t=n.tableRef.querySelectorAll('td[tabindex="0"]');t.length&&Array.from(t).forEach((function(e){e.setAttribute("tabindex","-1")})),e.setAttribute("tabindex",0)}})},n.handleOnKeyDown=function(e){var t=e.target.getAttribute("data-component"),r=t&&t.indexOf("table")>-1;Tt(e)&&r&&nn({event:e,startingElement:n.tableRef}),Pt(e)&&r&&nn({event:e,startingElement:n.tableRef,isDirectionForward:!1});var o=Cr(e.target);switch(e.key){case Ct.DOWN:return e.target===n.tableWrapperRef&&Sr(o),void n.handleCellNavigation({event:e,rowAccumulator:1});case Ct.UP:return void n.handleCellNavigation({event:e,rowAccumulator:-1});case Ct.RIGHT:return void n.handleCellNavigation({event:e,cellAccumulator:1});case Ct.LEFT:return void n.handleCellNavigation({event:e,cellAccumulator:-1});case Ct.ENTER:case Ct.SPACE:return r&&(e.preventDefault(),e.stopPropagation()),void Sr(o);default:return}},n.renderNoData=function(){var e=n.props,t=e.noDataProps,r=e.customNoDataComponent,o=e.translation;return r||y.createElement(Xl,ku({background:"white",icon:"presentational-no-data-dotted",title:o.placeholderTitle,borderRadius:"medium",handleKeyDown:function(e){e.key!==Ct.ESCAPE&&e.stopPropagation()}},t))},n.renderDataTable=function(e){var t=e.classesTable,r=e.disableTableHead,o=e.propsToPropagate,a=e.showHeaderWithNoData,i=e.data;return n.props.showSkeleton?y.createElement(Su,{tableHead:n.renderHead(),columnLength:Number(n.props.columns&&n.props.columns.length),rowLength:n.props.skeletonRowCount}):0!==i.length||a?y.createElement(y.Fragment,null,y.createElement("table",ku({ref:function(e){n.tableRef=e},className:t},xt(o)),(!r||a)&&n.renderHead(),n.renderBody(),n.renderFooter()),0===i.length&&n.renderNoData()):n.renderNoData()},n.tableId=un("sg-table-"),n}return xu(t,e),t.prototype.componentDidMount=function(){var e=this.props.selectedRows;this.props.onCellSelection&&this.tableRef&&this.tableRef.addEventListener("click",this.onTableClick,!1),e&&this.setState({selectedRows:Array.from(new Set(e))})},t.prototype.componentDidUpdate=function(e){e.data.length!==this.props.data.length&&this.setState({selectedRows:[]}),Wo(e.selectedRows,this.props.selectedRows)||this.setState({selectedRows:Array.from(new Set(this.props.selectedRows))}),this.tableRef&&e.onCellSelection&&!this.props.onCellSelection&&this.tableRef.removeEventListener("click",this.onTableClick,!1),this.tableRef&&!e.onCellSelection&&this.props.onCellSelection&&this.tableRef.addEventListener("click",this.onTableClick,!1)},t.prototype.componentWillUnmount=function(){this.tableRef&&this.tableRef.removeEventListener("click",this.onTableClick,!1)},t.prototype.onRowSelection=function(e){this.props.onRowSelection(e)},t.prototype.onContextMenuHandler=function(e){var t=e.event,n=e.selectedRow;if(this.props.selectable){var r=this.state.selectedRows.find((function(e){return Wo(e,n)}));this.state.selectedRows.length<=1||!r?this.setState({selectedRows:[n]},this.props.onRowContextMenu({event:t,selectedRows:[n]})):this.props.onRowContextMenu({event:t,selectedRows:this.state.selectedRows})}},t.prototype.getColumnsToRender=function(e){var t=this;void 0===e&&(e=!1);var n,r=this.props,o=r.reordable,a=r.columns,i=r.expandableTemplate,l=r.onExpandToggle,u=r.translation,s=Boolean(i);return s&&e?(n=Yl(a)).concat({className:"sg-table__expand-toggle",render:function(e,n){return y.createElement(oo,{color:"neutral",onClick:function(){return l(n)}},t.isExpandedRowInComponentProps(n)?u.collapse:u.expand)}}):s?((n=Yl(a))[0].render=function(e,n){return y.createElement("div",null,y.createElement(Sn,{size:"10",tabIndex:-1,color:"primary",className:"sg-icon-expandable",onClick:function(){return l(n)},name:t.isExpandedRowInComponentProps(n)?"minus":"plus"}),t.getColumnRender(a,e,n))},n):o?((n=Yl(a))[0].render=function(e,n){return y.createElement("div",{className:"sg-table__cell-dnd-wrapper"},t.getColumnRender(a,e,n))},n):a},t.prototype.getEventKeys=function(e){return e.srcEvent,{ctrlKey:e.srcEvent.ctrlKey,metaKey:e.srcEvent.metaKey,shiftKey:e.srcEvent.shiftKey}},t.prototype.isSelectedRowInComponentState=function(e){var t=this,n=this.props.rowKey;return n?Boolean(this.state.selectedRows.find((function(t){return t[n]===e[n]}))):Boolean(this.state.selectedRows.find((function(n){return t.areObjectsEqual(n,e)})))},t.prototype.isExpandedRowInComponentProps=function(e){var t=this,n=this.props.expandedRows;return Boolean(n)&&Boolean(n.find((function(n){return t.areObjectsEqual(n,e)})))},t.prototype.areObjectsEqual=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},t.prototype.toggleRowSelection=function(e){var t=this.isSelectedRowInComponentState(e)?[]:[e];this.setState({selectedRows:t},this.onRowSelection(t))},t.prototype.toggleRowsSelection=function(e,t){var n=this,r=this.props.data,o=this.getEventKeys(t),a=o.ctrlKey,i=o.metaKey,l=o.shiftKey,u=r.findIndex((function(t){return n.areObjectsEqual(t,e)})),s=[];if(l)for(var c=r.findIndex((function(e){return n.areObjectsEqual(e,n.state.selectedRows[0])})),f=this.state.selectedRows.length>0?c:u,p=Math.min(u,f),d=Math.max(u,f),h=p;h<=d;h++)s.push(r[h]);(a||i)&&(s=s.concat(this.state.selectedRows),this.isSelectedRowInComponentState(e)?s=this.state.selectedRows.filter((function(t){return n.areObjectsEqual(t,e)})):s.push(r[u])),this.setState({selectedRows:s},this.onRowSelection(s))},t.prototype.rowSelectionHandler=function(e,t){var n=this.getEventKeys(t),r=n.ctrlKey,o=n.metaKey,a=n.shiftKey;this.props.selectable&&(a||r||o?this.toggleRowsSelection(e,t):this.toggleRowSelection(e))},t.prototype.isColumnSelected=function(e){return this.props.selectedColumns.includes(e)},t.prototype.renderHead=function(){var e=this,t=this.props,n=t.headerBackground,r=t.cellHeight,o=vt("sg-table__head","sg-table__head--background-"+n),a=this.getColumnsToRender();return a.length&&a.find((function(e){return e.header}))?y.createElement("thead",{className:o,"data-e2e":"table-head"},y.createElement("tr",null,a.map((function(t,n){var o=t.renderHead?t.renderHead:t.header,a=void 0!==t.header?t.header:t.accessor;Tu.log('"column.renderHead" will be deprecated in favor of "column.render" '),Tu.log('Using "cell.accessor" as default column header will be deprecated.');var i=e.isColumnSelected(n),l=vt("sg-table__cell","sg-table__cell--height-"+r,i&&"sg-table__cell--is-selected"),u=function(e){var t=e.cell,n=e.device;return n.isPhone?hu({width:t.smSize,maxWidth:t.smSize},t.style):n.isTablet?hu({width:t.mSize||t.smSize,maxWidth:t.mSize||t.smSize},t.style):n.isDesktop?hu({width:t.lgSize||t.mSize||t.smSize,maxWidth:t.lgSize||t.mSize||t.smSize},t.style):hu({},t.style)}({cell:t,device:e.context.device});return y.createElement("th",{id:yu({tableId:e.tableId,index:n}),className:l,key:n,style:u,"data-cell-index":n,"data-row-index":-1,"data-component":"table-head",tabIndex:0===n?0:-1},"function"==typeof o?o(a):a)})))):null},t.prototype.renderFooter=function(){var e=this,t=this.props,n=t.footerBackground,r=t.cellHeight,o=this.props.columns,a=vt("sg-table__footer","sg-table__footer--background-"+n);return mu(o)?y.createElement("tfoot",{className:a,"data-e2e":"table-footer"},y.createElement("tr",null,o.map((function(t,n){var o=e.isColumnSelected(n),a=vt("sg-table__cell","sg-table__cell--height-"+r,o&&"sg-table__cell--is-selected");return Tu.log('Using "cell.renderFooterCell" as function will be deprecated.'),y.createElement("td",{className:a,key:"table-footer-"+n,style:ku({},t.style),"data-cell-index":n},t.footer?e.renderFooterCell(t):"")})))):null},t.prototype.renderFooterCell=function(e){return"function"==typeof e.footer?e.footer():e.footer},t.prototype.renderBody=function(){var e=this,t=this.props,n=t.data,r=t.onReorder,o=t.onRowPress,a=t.onRowTap,i=t.reordable,l=t.rowKey,u=t.selectedColumns,s=t.shouldRowLoading,c=t.expandableTemplate,f=t.disableRowAnimation,p=t.cellHeight;return y.createElement(wu,{columns:this.getColumnsToRender(this.context.device.isPhone),data:n,cellHeight:p,disableRowAnimation:f,expandableTemplate:c,isSelectedRowInComponentState:function(t){return e.isSelectedRowInComponentState(t)},isExpandedRowInComponentProps:function(t){return e.isExpandedRowInComponentProps(t)},onContextMenuHandler:function(t){var n=t.event,r=t.selectedRow;return e.onContextMenuHandler({event:n,selectedRow:r})},onReorder:r,onRowPress:o,onRowTap:a,reordable:i,rowKey:l,rowSelectionHandler:function(t,n){return e.rowSelectionHandler(t,n)},shouldRowLoading:s,selectedColumns:u,tableRef:this.tableRef,tableId:this.tableId})},t.prototype.render=function(){var e=this,t=this.props,n=t.className,r=t.columns,o=t.data,a=t.density,i=t.disableTableHead,l=t.mobileLayout,u=t.expandableTemplate,s=t.onLoadMore,c=t.reordable,f=t.shadow,p=t.showLoadMore,d=t.translation,h=t["data-e2e"],m=t["data-component"],g=Cu(t,["className","columns","data","density","disableTableHead","mobileLayout","expandableTemplate","onLoadMore","reordable","shadow","showLoadMore","translation","data-e2e","data-component"]),v=(g.expandedRows,g.selectable,g.selectedRows,g.rowKey,g.onExpandToggle,g.onRowSelection,g.onRowContextMenu,g.onCellSelection,g.selectedColumns,g.onReorder,g.renderBeforeTableContent),b=g.renderAfterTableContent,w=(g.headerBackground,g.footerBackground,g.onRowTap,g.onRowPress,g.shouldRowLoading,g.disableRowAnimation,g.border),E=g.borderRadius,_=g.showHeaderWithNoData,O=void 0!==_&&_,S=Cu(g,["expandedRows","selectable","selectedRows","rowKey","onExpandToggle","onRowSelection","onRowContextMenu","onCellSelection","selectedColumns","onReorder","renderBeforeTableContent","renderAfterTableContent","headerBackground","footerBackground","onRowTap","onRowPress","shouldRowLoading","disableRowAnimation","border","borderRadius","showHeaderWithNoData"]),x=vt("sg-table-wrapper",f&&"sg-table-wrapper--box-shadow",a&&"sg-table-wrapper--density-"+a,l&&"sg-table-wrapper--mobile-"+l,Boolean(u)&&"sg-table-wrapper--expandable",c&&"sg-table-wrapper--reordable",0===o.length&&"sg-table-wrapper--no-data",this.context.device&&!this.context.device.isPhone&&dr(w,E),n),k=vt("sg-table",!mu(r)&&"sg-table--no-footer");return y.createElement("div",{ref:function(t){e.tableWrapperRef=t},className:x,"data-e2e":h,"data-component":m,onKeyDown:this.handleOnKeyDown},v(),this.renderDataTable({classesTable:k,data:o,disableTableHead:i,propsToPropagate:S,showHeaderWithNoData:O}),p&&y.createElement("div",{className:"sg-table-load-more","data-e2e":"table-load-more"},y.createElement(oo,{onClick:function(t){var n=Cr(e.tableRef,{isDirectionForward:!1});Sr(n),s(t)},onKeyDown:function(e){e.stopPropagation(),Tt(e)&&nn({event:e}),Pt(e)&&nn({event:e,isDirectionForward:!1})}},d.loadMoreText)),b&&y.createElement("div",{className:"sg-table__after-content"},b()))},t.contextType=st,t.displayName="Table",t.defaultProps={columns:[],data:[],density:"medium",disableTableHead:!1,disableRowAnimation:!1,mobileLayout:"card",selectable:!1,headerBackground:"default",footerBackground:"default",selectedColumns:[],onExpandToggle:function(){return null},onRowSelection:function(){return null},onRowTap:function(){return null},onRowPress:function(){return null},onRowContextMenu:function(){return null},renderBeforeTableContent:function(){return null},shouldRowLoading:function(){return!1},reordable:!1,shadow:!1,translation:{loadMoreText:"Load More",expand:"Expand",collapse:"Collapse",placeholderTitle:"Nothing here yet"},cellHeight:"medium","data-e2e":"table","data-component":"table"},t}(y.Component),ju=Iu,Ru=function(){return Ru=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ru.apply(this,arguments)},Au=function(e){var t=e.resources,n=e.data,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["resources","data"]);return y.createElement("div",{style:{position:"relative"}},y.createElement(br,{resources:t},y.createElement(ql,{data:n},y.createElement(Kl.Consumer,null,(function(e){var t=e.sortedData,o=void 0===t?[]:t;return y.createElement(ju,Ru({data:o,showSkeleton:!n},r))})))))},Du=function(e){return e.items.options},Mu=function(e){return e.items[Uo.NOTIFICATIONS.resourceName]||[]},Lu=function(e){return e.items[Uo.HARDENING.resourceName]||[]},Fu=function(e){return e.items[Uo.EBOOK.resourceName]},zu=function(e){return e.items[Uo.ACTIVITY_UNKNOWN.resourceName]||{}},Uu=function(e){return e.items[Uo.ACTIVITY_REGISTERED.resourceName]||{}},Vu=function(e){return e.items[Uo.WEEKLY_REPORTS.resourceName]||{}},Hu=function(e){return e.items[Uo.GET_VISITOR_STATUS.resourceName]||{}},Bu=function(e){return e.items[Uo.RATE.resourceName]||{}},Wu=function(){return Wu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Wu.apply(this,arguments)},Ku=((_u={})[Uo.ACTIVITY_REGISTERED.resourceName]=Uu,_u[Uo.ACTIVITY_UNKNOWN.resourceName]=zu,_u[Uo.ACTIVITY_BLOCKED_USERS.resourceName]=function(e){return e.items[Uo.ACTIVITY_BLOCKED_USERS.resourceName]||{}},_u[Uo.WEEKLY_REPORTS.resourceName]=Vu,_u),qu=function(e){var t,n,r=e.title,o=e.columns,a=e.api,i=e.limitedView,l=e.shadow,u=H(),s=q(Ku[a.resourceName]),c=s.entries,f=s.filters,p=s.page,d=s.pages;return y.useEffect((function(){u(Mo(Wu(Wu({},a),{requestTypeName:fo,body:{limitedView:Number(i)}})))}),[u,a,i]),y.createElement("div",null,y.createElement(aa,{justify:"space-between",align:"center"},r&&y.createElement(Qr,null,r),!i&&y.createElement("div",null,y.createElement(jn,{icon:"refresh-thin",onClick:function(){return u(Mo(Wu(Wu({},a),{requestTypeName:fo})))}}),f&&y.createElement(Vl,{title:Ie("Filter Activity"),config:(t=f,n=function(e){return u(Mo(Wu(Wu({},a),{body:{filters:e}})))},void 0===t&&(t=[]),t.reduce((function(e,t,r){var o;return Wu(Wu({},e),((o={})[r]=Wu(Wu({},t),{onChange:n}),o))}),{})),translations:{closeBtnLabel:Ie("close"),resetBtnLabel:Ie("reset")},onResetFilter:function(){return u(Mo(a))}}))),y.createElement(Bo,{padding:"none",elevation:l?"1":"none"},y.createElement(Au,{data:c,columns:o,cellHeight:"small",resources:[fo,Hl],showLoadMore:p<d,onLoadMore:function(){var e;u((e=Wu(Wu({},a),{body:{filters:f,page:p+1},requestTypeName:fo}),Bl({type:Hl,requestTypeName:"UPDATE_ACTIVITY_LOG_DATA",payload:e},undefined)))}})))},Yu=function(){return Yu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Yu.apply(this,arguments)},Gu=function(e){var t=H();return y.createElement(qu,Yu({api:Uo.ACTIVITY_BLOCKED_USERS,shadow:!0,columns:[{header:Ie("Blocked On"),accessor:"ts",smSize:"170px"},{header:Ie("User/Ip"),accessor:"user"},{header:Ie("Actions"),accessor:"ts",style:{textAlign:"right"},smSize:"140px",render:function(e,n){var r=n.type,o=n.visitor_id,a=n.user;return y.createElement(oo,{color:"secondary",size:"small",onClick:function(){var e=function(e,t,n){var r="ip"===e&&0===t?{ip:n}:{block:0};return"ip"!==e?{body:r,endpoint:Uo.BLOCK_USER.endpoint}:0===t?{body:r,endpoint:Uo.LOGIN_UNBLOCK.endpoint}:{body:r,endpoint:Uo.BLOCK_IP.endpoint}}(r,o,a),n=e.endpoint,i=e.body;t(Fo({endpoint:n,itemId:o,body:i},{onComplete:function(){return t(Mo(Uo.ACTIVITY_BLOCKED_USERS))}}))}},Ie("unblock"))}}]},e))},$u="unknown",Xu="registered",Qu="blocked",Ju="weekly-reports",Zu=[{type:$u,label:"Unknown"},{type:Xu,label:"Registered"},{type:Qu,label:"Blocked"},{type:Ju,label:"Weekly Reports"}],es=Ie("Email");!function(e){e.Open="open",e.Close="close"}(Ou||(Ou={}));var ts=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ns=function(){return ns=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ns.apply(this,arguments)},rs=function(e){function t(t){var n=e.call(this,t)||this;return n.state={animation:null},n.triggerClose=function(e){e.preventDefault(),e.stopPropagation(),e.nativeEvent.stopImmediatePropagation();var t=n.props.onClose;n.state.animation!==Ou.Close&&n.setState({animation:Ou.Close},(function(){setTimeout((function(){t()}),400)}))},n.handleBlur=function(e){e.persist(),n.timeOutId=setTimeout((function(){n.triggerClose(e)}))},n.timeOutId=null,n.listRef=y.createRef(),n}return ts(t,e),t.prototype.componentDidMount=function(){this.setPosition(),this.listRef&&this.listRef.current.focus(),this.setState({animation:Ou.Open})},t.prototype.componentDidUpdate=function(){this.setPosition()},t.prototype.setPosition=function(){var e=this.props,t=e.position,n=e.priority,r=e.rect;ra(t,r,this.context.device,this.listRef,{priority:n})},t.prototype.render=function(){var e=this,t=this.props,n=t.className,r=t.children,o=t.position,a=t.tabIndex,i=t["data-e2e"],l=t["data-component"],u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["className","children","position","tabIndex","data-e2e","data-component"]),s=this.state.animation,c=this.context.device.isPhone,f=vt(c&&"sg-context-menu-list-wrapper--mobile",s&&"sg-context-menu-list-wrapper--"+s),p=vt(!c&&"sg-context-menu-list--position-"+o,s&&"sg-context-menu-list--"+s,n);return y.createElement(ua,ns({wrapperClasses:f,classes:p,ref:this.listRef},xt(u),{onBlur:this.handleBlur,onClick:this.triggerClose,onFocus:function(){return clearTimeout(e.timeOutId)},"data-e2e":i,"data-component":l,tabIndex:a,"aria-labelledby":"menu-button"}),r)},t.contextType=st,t.displayName="ContextMenuList",t.defaultProps={position:"absolute",onClose:function(){return null},"data-e2e":"context-menu-list","data-component":"context-menu-list"},t}(y.Component),os=rs,as=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),is=function(){return is=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},is.apply(this,arguments)},ls=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={opened:!1,rect:{top:null,right:null,bottom:null,left:null}},t.menuRef=y.createRef(),t.closeMenu=function(){var e=t.props.onClose;t.setState({opened:!1}),e&&e()},t.openMenu=function(e){var n=sn(e.currentTarget),r=n.height+n.top+window.pageYOffset,o=window.innerWidth-(n.left+n.width),a=window.innerHeight-n.top,i=n.left;t.setState({rect:{top:r+"px",right:o+"px",bottom:a+"px",left:i+"px"},opened:!0})},t.toggleMenu=function(e){return t.state.opened?t.closeMenu():t.openMenu(e)},t}return as(t,e),t.prototype.handleKeyDown=function(e){return e.key!==Ct.ENTER&&e.key!==Ct.SPACE||(e.preventDefault(),this.openMenu(e)),e.key===Ct.ESCAPE&&(e.preventDefault(),this.closeMenu()),Tt(e)?nn({event:e,startingElement:this.menuRef.current}):Pt(e)?nn({event:e,startingElement:this.menuRef.current,isDirectionForward:!1}):void 0},t.prototype.renderContextMenuListComponent=function(){var e=this.props,t=e.children,n=e.className,r=e.position,o=e.priority,a=this.state.rect;return y.createElement(os,{className:n,onClose:this.closeMenu,position:r,rect:a,priority:o},y.createElement(ea,null),y.createElement($o,{hasTabHandling:!1,hasArrowHandling:!0},t))},t.prototype.renderContextMenuList=function(){return"fixed"===this.props.position||this.context.device.isPhone?g.createPortal(this.renderContextMenuListComponent(),document.body):this.renderContextMenuListComponent()},t.prototype.render=function(){var e=this,t=this.props,n=t.className,r=t.opener,o=t["data-e2e"],a=t["data-component"],i=t["aria-label"],l=this.state.opened,u=vt("sg-context-menu",n),s=y.cloneElement(r,{isActive:l,"aria-haspopup":!0,"aria-expanded":l});return y.createElement("div",is({ref:this.menuRef,className:u},xt(this.props),{onClick:this.toggleMenu,onKeyDown:function(t){return e.handleKeyDown(t)},"data-e2e":o,"data-component":a,"aria-label":i}),s,l&&y.createElement("div",{className:"sg-context-menu--click-prevent"}),l&&this.renderContextMenuList())},t.contextType=st,t.displayName="ContextMenu",t.defaultProps={position:"absolute",onClose:function(){return null},"data-e2e":"context-menu","data-component":"context-menu"},t}(y.Component),us=ls,ss=function(){return ss=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ss.apply(this,arguments)},cs=function(e){return y.createElement(_l,ss({},e))};cs.displayName="ContextMenuItem",cs.defaultProps={onClick:function(){return null},iconSize:"14",tabIndex:0,"data-e2e":"context-menu-item","data-component":"context-menu-item"};var fs=cs,ps=function(){function e(){this.subscribersOnOpen={},this.subscribersOnClose={},this.subscribersOnData={}}return e.prototype.subscribe=function(e,t,n){switch(void 0===n&&(n="visibility"),n){case"open":this.subscribersOnOpen[e]=this.subscribersOnOpen[e]?this.subscribersOnOpen[e].concat(t):[t];break;case"close":this.subscribersOnClose[e]=this.subscribersOnClose[e]?this.subscribersOnClose[e].concat(t):[t];break;case"visibility":this.subscribersOnOpen[e]=this.subscribersOnOpen[e]?this.subscribersOnOpen[e].concat(t):[t],this.subscribersOnClose[e]=this.subscribersOnClose[e]?this.subscribersOnClose[e].concat(t):[t];break;case"data":this.subscribersOnData[e]=this.subscribersOnData[e]?this.subscribersOnData[e].concat(t):[t]}},e.prototype.emit=function(e,t,n){var r,o,a;switch(void 0===n&&(n=null),t){case"open":null===(r=this.subscribersOnOpen[e])||void 0===r||r.forEach((function(e){return e("open")}));break;case"close":null===(o=this.subscribersOnClose[e])||void 0===o||o.forEach((function(e){return e("close")}));break;case"data":null===(a=this.subscribersOnData[e])||void 0===a||a.forEach((function(e){return e(n)}));break;case"visibility":throw"Cannot open and close dialog at the same time"}},e.prototype.unsubscribe=function(e,t,n){var r,o,a,i,l;switch(void 0===n&&(n="visibility"),n){case"open":this.subscribersOnOpen[e]=null===(r=this.subscribersOnOpen[e])||void 0===r?void 0:r.filter((function(e){return e!==t}));break;case"close":this.subscribersOnClose[e]=null===(o=this.subscribersOnClose[e])||void 0===o?void 0:o.filter((function(e){return e!==t}));break;case"visibility":this.subscribersOnOpen[e]=null===(a=this.subscribersOnOpen[e])||void 0===a?void 0:a.filter((function(e){return e!==t})),this.subscribersOnClose[e]=null===(i=this.subscribersOnClose[e])||void 0===i?void 0:i.filter((function(e){return e!==t}));break;case"data":this.subscribersOnData[e]=null===(l=this.subscribersOnData[e])||void 0===l?void 0:l.filter((function(e){return e!==t}))}},e.prototype.open=function(e){this.emit(e,"open")},e.prototype.close=function(e){this.emit(e,"close")},e.prototype.hidrate=function(e,t){void 0===t&&(t=null),this.emit(e,"data",t)},e}(),ds=new ps,hs="CUSTOM_LOGIN_URL",ms="LOGIN_ACCESS",ys="CHANGE_ADMIN_USERNAME",gs="RESET_TWO_FACTOR",vs="MANAGE_IP_TRAFFIC",bs="MANAGE_USER_TRAFFIC",ws="EDIT_EMAIL_RECORDS",Es="DELETE_EMAIL_RECORDS",_s="CONSENT_DIALOG",Os=function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function l(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}u((r=r.apply(e,t||[])).next())}))},Ss=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},xs=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},ks=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(xs(arguments[t]));return e},Cs=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ts=function(e){return"checkbox"===e.type},Ps=function(e){return null==e},Ns=function(e){return"object"==typeof e},Is=function(e){return!Ps(e)&&!Array.isArray(e)&&Ns(e)&&!(e instanceof Date)},js=function(e){return e.substring(0,e.search(/.\d/))||e},Rs=function(e){return e.filter(Boolean)},As=function(e){return void 0===e},Ds=function(e,t,n){void 0===e&&(e={});var r=Rs(t.split(/[,[\].]+?/)).reduce((function(e,t){return Ps(e)?e:e[t]}),e);return As(r)||r===e?As(e[t])?n:e[t]:r},Ms="blur",Ls="onChange",Fs="onSubmit",zs="all",Us="undefined",Vs="pattern",Hs="required",Bs=function(e,t){var n=Object.assign({},e);return delete n[t],n},Ws=y.createContext(null);Ws.displayName="RHFContext";var Ks=function(){return y.useContext(Ws)},qs=function(e,t,n,r,o){return void 0===o&&(o=!0),e?new Proxy(t,{get:function(e,t){if(t in e)return n.current[t]!==zs&&(n.current[t]=!o||zs),r&&(r.current[t]=!0),e[t]}}):t},Ys=function(e){return Is(e)&&!Object.keys(e).length},Gs=function(e,t,n){return Ys(e)||Object.keys(e).length>=Object.keys(t).length||Object.keys(e).find((function(e){return t[e]===(!n||zs)}))},$s=typeof window!==Us&&typeof window.HTMLElement!==Us&&typeof document!==Us,Xs=$s?"Proxy"in window:typeof Proxy!==Us;var Qs=function(e){return e.render((n=(t=e).name,r=t.rules,o=t.defaultValue,a=t.control,i=t.shouldUnregister,l=Ks(),u=a||l.control,s=u.defaultValuesRef,c=u.register,f=u.fieldsRef,p=u.unregister,d=u.fieldArrayNamesRef,h=u.controllerSubjectRef,m=u.shouldUnmountUnregister,g=c(n,r),v=g.onChange,b=g.onBlur,w=g.ref,E=xs(y.useState(As(Ds(f.current,n)._f.value)||function(e,t){return ks(e).some((function(e){return js(t)===e}))}(d.current,n)?As(o)?Ds(s.current,n):o:Ds(f.current,n)._f.value),2),_=E[0],O=E[1],S=function(e){var t=Ks(),n=e&&e.control||t.control,r=n.formStateRef,o=n.formStateSubjectRef,a=n.readFormStateRef,i=xs(y.useState(r.current),2),l=i[0],u=i[1],s=y.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1});return y.useEffect((function(){var e=o.current.subscribe({next:function(e){Gs(e,s.current)&&u(Object.assign(Object.assign({},r.current),e))}});return function(){return e.unsubscribe()}}),[]),qs(Xs,l,a,s,!1)}({control:a||l.control}),Ds(f.current,n)._f.value=_,y.useEffect((function(){var e=h.current.subscribe({next:function(e){return(!e.name||n===e.name)&&O(Ds(e.values,n))}});return w({target:_}),function(){e.unsubscribe(),(m||i)&&p(n)}}),[n]),{field:{onChange:function(e){var t=function(e){return Is(e)&&e.target?Ts(e.target)?e.target.checked:e.target.value:e}(e);O(t),v({target:{value:t,name:n},type:"change"})},onBlur:function(){b({target:{name:n},type:Ms})},name:n,value:_,ref:w},formState:S,fieldState:Object.defineProperties({},{invalid:{get:function(){return!!Ds(S.errors,n)}},isDirty:{get:function(){return!!Ds(S.dirtyFields,n)}},isTouched:{get:function(){return!!Ds(S.touchedFields,n)}},error:{get:function(){return Ds(S.errors,n)}}})}));var t,n,r,o,a,i,l,u,s,c,f,p,d,h,m,g,v,b,w,E,_,O,S},Js=function(e,t,n,r,o){var a;return t?Object.assign(Object.assign({},n[e]),{types:Object.assign(Object.assign({},n[e]&&n[e].types?n[e].types:{}),(a={},a[r]=o||!0,a))}):{}},Zs=function(e){return/^\w*$/.test(e)},ec=function(e){return Rs(e.replace(/["|']|\]/g,"").split(/\.|\[/))};function tc(e,t,n){for(var r=-1,o=Zs(t)?[t]:ec(t),a=o.length,i=a-1;++r<a;){var l=o[r],u=n;if(r!==i){var s=e[l];u=Is(s)||Array.isArray(s)?s:isNaN(+o[r+1])?{}:[]}e[l]=u,e=e[l]}return e}var nc=function(e,t,n){var r,o;try{for(var a=Cs(n||Object.keys(e)),i=a.next();!i.done;i=a.next()){var l=i.value,u=Ds(e,l);if(u){var s=u._f,c=Bs(u,"_f");if(s&&t(s.name)){if(s.ref.focus&&As(s.ref.focus()))break;if(s.refs){s.refs[0].focus();break}}else Is(c)&&nc(c,t)}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}},rc=function(e,t,n){for(var r in void 0===t&&(t={current:{}}),void 0===n&&(n={}),e.current){var o=e.current[r];if(o){var a=o._f,i=Bs(o,"_f");tc(n,r,a?a.ref.disabled||a.refs&&a.refs.every((function(e){return e.disabled}))?void 0:a.value:Array.isArray(o)?[]:{}),i&&rc({current:i},t,n[r])}}return Object.assign(Object.assign({},t.current),n)},oc=function(e,t){return void 0===e&&(e=[]),e.map((function(e){var n,r;return Object.assign(((n={})[t]=e&&e[t]||(r=typeof performance===Us?Date.now():1e3*performance.now(),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(16*Math.random()+r)%16|0;return("x"==e?t:3&t|8).toString(16)}))),n),e)}))},ac=function(e){return Ps(e)||!Ns(e)};function ic(e,t,n){var r,o;if(ac(e)||ac(t)||e instanceof Date||t instanceof Date)return e===t;if(!y.isValidElement(e)){var a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;try{for(var l=Cs(a),u=l.next();!u.done;u=l.next()){var s=u.value,c=e[s];if(!n||"ref"!==s){var f=t[s];if((Is(c)||Array.isArray(c))&&(Is(f)||Array.isArray(f))?!ic(c,f,n):c!==f)return!1}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}return!0}function lc(e,t){if(ac(e)||ac(t))return t;for(var n in t){var r=e[n],o=t[n];try{e[n]=Is(r)&&Is(o)||Array.isArray(r)&&Array.isArray(o)?lc(r,o):o}catch(e){}}return e}function uc(e,t,n,r,o){for(var a,i=-1;++i<e.length;){for(var l in e[i])Array.isArray(e[i][l])?(!n[i]&&(n[i]={}),n[i][l]=[],uc(e[i][l],Ds(t[i]||{},l,[]),n[i][l],n[i],l)):ic(Ds(t[i]||{},l),e[i][l])?tc(n[i]||{},l):n[i]=Object.assign(Object.assign({},n[i]),((a={})[l]=!0,a));r&&!n.length&&delete r[o]}return n}var sc=function(e,t,n){return lc(uc(e,t,n.slice(0,e.length)),uc(t,e,n.slice(0,e.length)))};function cc(e,t){return ks(e,Array.isArray(t)?t:[t])}var fc=function(e){return Array.isArray(e)?Array(e.length).fill(void 0):void 0};function pc(e,t,n){return ks(e.slice(0,t),Array.isArray(n)?n:[n],e.slice(t))}var dc=function(e,t,n){return Array.isArray(e)?(As(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[]};function hc(e,t){return ks(Array.isArray(t)?t:[t],e)}var mc=function(e,t){return As(t)?[]:function(e,t){var n,r,o=0,a=ks(e);try{for(var i=Cs(t),l=i.next();!l.done;l=i.next()){var u=l.value;a.splice(u-o,1),o++}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return Rs(a).length?a:[]}(e,(Array.isArray(t)?t:[t]).sort((function(e,t){return e-t})))},yc=function(e,t,n){e[t]=[e[n],e[n]=e[t]][0]},gc=function(e){return"boolean"==typeof e};function vc(e,t){var n,r=Zs(t)?[t]:ec(t),o=1==r.length?e:function(e,t){for(var n=t.slice(0,-1).length,r=0;r<n;)e=As(e)?r++:e[t[r++]];return e}(e,r),a=r[r.length-1];o&&delete o[a];for(var i=0;i<r.slice(0,-1).length;i++){var l=-1,u=void 0,s=r.slice(0,-(i+1)),c=s.length-1;for(i>0&&(n=e);++l<s.length;){var f=s[l];u=u?u[f]:e[f],c===l&&(Is(u)&&Ys(u)||Array.isArray(u)&&!u.filter((function(e){return Is(e)&&!Ys(e)||gc(e)})).length)&&(n?delete n[f]:delete e[f]),n=u}}return e}var bc=function(e){var t=e.control,n=e.name,r=e.keyName,o=void 0===r?"id":r,a=e.shouldUnregister,i=Ks(),l=y.useRef(""),u=t||i.control,s=u.isWatchAllRef,c=u.watchFieldsRef,f=u.getIsDirty,p=u.watchSubjectRef,d=u.fieldArraySubjectRef,h=u.fieldArrayNamesRef,m=u.fieldsRef,g=u.defaultValuesRef,v=u.formStateRef,b=u.formStateSubjectRef,w=u.readFormStateRef,E=u.validFieldsRef,_=u.fieldsWithValidationRef,O=u.fieldArrayDefaultValuesRef,S=u.unregister,x=u.shouldUnmountUnregister,k=xs(y.useState(oc(Ds(O.current,js(n))?Ds(O.current,n,[]):Ds(g.current,n,[]),o)),2),C=k[0],T=k[1];tc(O.current,n,ks(C)),h.current.add(n);var P=function(e){return e.map((function(e){return Bs(e||{},o)}))},N=function(){var e=Ds(rc(m,g),n,[]);return oc(Ds(O.current,n,[]).map((function(t,n){return Object.assign(Object.assign({},t),e[n])})),o)},I=function(e,t){return t?As(t.focusIndex)?t.focusName?t.focusName:t.shouldFocus?n+"."+e:"":n+"."+t.focusIndex:n+"."+e},j=function(e){return void 0===e&&(e=[]),T(oc(e,o))},R=function(e){return!Rs(Ds(e,n,[])).length&&vc(e,n)},A=function(e,t,r,o){if(void 0===r&&(r=[]),void 0===o&&(o=!0),Ds(m.current,n)){var a=e(Ds(m.current,n),t.argA,t.argB);o&&tc(m.current,n,a)}Array.isArray(Ds(v.current.errors,n))&&(a=e(Ds(v.current.errors,n),t.argA,t.argB),o&&tc(v.current.errors,n,a),R(v.current.errors)),w.current.touchedFields&&Ds(v.current.touchedFields,n)&&(a=e(Ds(v.current.touchedFields,n),t.argA,t.argB),o&&tc(v.current.touchedFields,n,a),R(v.current.touchedFields)),(w.current.dirtyFields||w.current.isDirty)&&(tc(v.current.dirtyFields,n,sc(P(r),Ds(g.current,n,[]),Ds(v.current.dirtyFields,n,[]))),function(e){e&&tc(v.current.dirtyFields,n,sc(P(e),Ds(g.current,n,[]),Ds(v.current.dirtyFields,n,[])))}(r),R(v.current.dirtyFields)),w.current.isValid&&(tc(E.current,n,e(Ds(E.current,n,[]),t.argA)),R(E.current),tc(_.current,n,e(Ds(_.current,n,[]),t.argA)),R(_.current)),b.current.next({isDirty:f(n,P(r)),errors:v.current.errors,isValid:v.current.isValid})},D=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=""),e.forEach((function(e,o){return!ac(e)&&Object.entries(e).forEach((function(e){var a=xs(e,2),i=a[0],l=a[1],u=(r||n)+"."+(r?o:t+o)+"."+i;Array.isArray(l)?D(l,o,u):tc(m.current,u,{_f:{ref:{name:u},name:u,value:l}})}))}))};return y.useEffect((function(){var e,t;if(s.current)b.current.next({});else try{for(var r=Cs(c.current),o=r.next();!o.done;o=r.next()){var a=o.value;if(n.startsWith(a)){b.current.next({});break}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}p.current.next({name:n,value:Ds(rc(m,g),n,[])}),l.current&&nc(m.current,(function(e){return e.startsWith(l.current)})),l.current="",d.current.next({name:n,fields:P(ks(C))})}),[C,n]),y.useEffect((function(){var e=d.current.subscribe({next:function(e){var t=e.name,r=e.fields;e.isReset&&(vc(m.current,t||n),t?tc(O.current,t,r):O.current=r,j(Ds(O.current,n)))}});return!Ds(m.current,n)&&tc(m.current,n,[]),function(){e.unsubscribe(),(x||a)&&S(n)}}),[]),{swap:y.useCallback((function(e,t){var n=N();yc(n,e,t),A(yc,{argA:e,argB:t},n,!1),j(n)}),[n]),move:y.useCallback((function(e,t){var n=N();dc(n,e,t),j(n),A(dc,{argA:e,argB:t},n,!1)}),[n]),prepend:y.useCallback((function(e,t){var n=Array.isArray(e)?e:[e],r=hc(N(),n);j(r),A(hc,{argA:fc(e)},r),D(n),l.current=I(0,t)}),[n]),append:y.useCallback((function(e,t){var n=Array.isArray(e)?e:[e],r=cc(N(),n),o=r.length-n.length;j(r),A(cc,{argA:fc(e)},r,!1),D(n,o),l.current=I(o,t)}),[n]),remove:y.useCallback((function(e){var t=mc(N(),e);!function(e){(Array.isArray(e)?e:[e]).forEach((function(e){return tc(m.current,n+(As(e)?"":"."+e),As(e)?[]:void 0)}))}(e),j(t),A(mc,{argA:e},t)}),[n]),insert:y.useCallback((function(e,t,n){var r=Array.isArray(t)?t:[t],o=pc(N(),e,r);j(o),A(pc,{argA:e,argB:fc(t)},o),D(r,e),l.current=I(e,n)}),[n]),fields:C}};function wc(e,t){var n,r,o={};try{for(var a=Cs(e),i=a.next();!i.done;i=a.next()){var l=i.value,u=Ds(t,l);u&&(Zs(l)?o[l]=u._f:tc(o,l,u._f))}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return o}var Ec=function(e){return"file"===e.type},_c=function(e){return"select-multiple"===e.type},Oc=function(e){return"radio"===e.type},Sc={value:!1,isValid:!1},xc={value:!0,isValid:!0},kc=function(e){if(Array.isArray(e)){if(e.length>1){var t=e.filter((function(e){return e&&e.checked&&!e.disabled})).map((function(e){return e.value}));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!As(e[0].attributes.value)?As(e[0].value)||""===e[0].value?xc:{value:e[0].value,isValid:!0}:xc:Sc}return Sc},Cc={isValid:!1,value:null},Tc=function(e){return Array.isArray(e)?e.reduce((function(e,t){return t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e}),Cc):Cc};function Pc(e){if(e&&e._f){var t=e._f.ref;if(t.disabled)return;return Ec(t)?t.files:Oc(t)?Tc(e._f.refs).value:_c(t)?(l=t.options,ks(l).filter((function(e){return e.selected})).map((function(e){return e.value}))):Ts(t)?kc(e._f.refs).value:(n=As(t.value)?e._f.ref.value:t.value,o=(r=e._f).valueAsNumber,a=r.valueAsDate,i=r.setValueAs,o?""===n?NaN:+n:a?new Date(n):i?i(n):n)}var n,r,o,a,i,l}var Nc=function(e){return e&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate)},Ic=function(e){return"function"==typeof e},jc=function(e){return"string"==typeof e},Rc=function(e){return jc(e)||y.isValidElement(e)},Ac=function(e){return e instanceof RegExp};function Dc(e,t,n){if(void 0===n&&(n="validate"),Rc(e)||gc(e)&&!e)return{type:n,message:Rc(e)?e:"",ref:t}}var Mc=function(e){return Is(e)&&!Ac(e)?e:{value:e,message:""}},Lc=function(e,t){var n=e._f,r=n.ref,o=n.refs,a=n.required,i=n.maxLength,l=n.minLength,u=n.min,s=n.max,c=n.pattern,f=n.validate,p=n.name,d=n.value,h=n.valueAsNumber;return Os(void 0,void 0,void 0,(function(){var e,n,m,y,g,v,b,w,E,_,O,S,x,k,C,T,P,N,I,j,R,A,D,M,L,F,z,U,V,H,B,W,K;return Ss(this,(function(q){switch(q.label){case 0:return e={},n=Oc(r),m=Ts(r),y=n||m,g=(h||Ec(r))&&!r.value||""===d||Array.isArray(d)&&!d.length,v=Js.bind(null,p,t,e),b=function(t,n,o,a,i){void 0===a&&(a="maxLength"),void 0===i&&(i="minLength");var l=t?n:o;e[p]=Object.assign({type:t?a:i,message:l,ref:r},v(t?a:i,l))},a&&(!n&&!m&&(g||Ps(d))||gc(d)&&!d||m&&!kc(o).isValid||n&&!Tc(o).isValid)&&(w=Rc(a)?{value:!!a,message:a}:Mc(a),E=w.value,j=w.message,E&&(e[p]=Object.assign({type:Hs,message:j,ref:y?(o||[])[0]||{}:r},v(Hs,j)),!t))?[2,e]:(Ps(u)&&Ps(s)||""===d||(T=void 0,P=void 0,_=Mc(s),O=Mc(u),isNaN(d)?(x=r.valueAsDate||new Date(d),jc(_.value)&&(T=x>new Date(_.value)),jc(O.value)&&(P=x<new Date(O.value))):(S=r.valueAsNumber||parseFloat(d),Ps(_.value)||(T=S>_.value),Ps(O.value)||(P=S<O.value)),!T&&!P||(b(!!T,_.message,O.message,"max","min"),t)))&&(!jc(d)||g||!i&&!l||(k=Mc(i),C=Mc(l),T=!Ps(k.value)&&d.length>k.value,P=!Ps(C.value)&&d.length<C.value,!T&&!P||(b(T,k.message,C.message),t)))?jc(d)&&c&&!g&&(N=Mc(c),I=N.value,j=N.message,Ac(I)&&!d.match(I)&&(e[p]=Object.assign({type:Vs,message:j,ref:r},v(Vs,j)),!t))?[2,e]:f?(R=y&&o?o[0]:r,Ic(f)?[4,f(d)]:[3,2]):[3,11]:[2,e];case 1:return A=q.sent(),(H=Dc(A,R))&&(e[p]=Object.assign(Object.assign({},H),v("validate",H.message)),!t)?[2,e]:[3,11];case 2:if(!Is(f))return[3,11];D={},q.label=3;case 3:q.trys.push([3,8,9,10]),M=Cs(Object.entries(f)),L=M.next(),q.label=4;case 4:return L.done?[3,7]:(F=xs(L.value,2),z=F[0],U=F[1],Ys(D)||t?[4,U(d)]:[3,7]);case 5:V=q.sent(),(H=Dc(V,R,z))&&(D=Object.assign(Object.assign({},H),v(z,H.message)),t&&(e[p]=D)),q.label=6;case 6:return L=M.next(),[3,4];case 7:return[3,10];case 8:return B=q.sent(),W={error:B},[3,10];case 9:try{L&&!L.done&&(K=M.return)&&K.call(M)}finally{if(W)throw W.error}return[7];case 10:if(!Ys(D)&&(e[p]=Object.assign({ref:R},D),!t))return[2,e];q.label=11;case 11:return[2,e]}}))}))},Fc=function(e){return{isOnSubmit:!e||e===Fs,isOnBlur:"onBlur"===e,isOnChange:e===Ls,isOnAll:e===zs,isOnTouch:"onTouched"===e}},zc=function(e){return e instanceof HTMLElement},Uc=function(){function e(){this.tearDowns=[]}return e.prototype.add=function(e){this.tearDowns.push(e)},e.prototype.unsubscribe=function(){var e,t;try{for(var n=Cs(this.tearDowns),r=n.next();!r.done;r=n.next())(0,r.value)()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.tearDowns=[]},e}(),Vc=function(){function e(e,t){var n=this;this.observer=e,this.closed=!1,t.add((function(){return n.closed=!0}))}return e.prototype.next=function(e){this.closed||this.observer.next(e)},e}(),Hc=function(){function e(){this.observers=[]}return e.prototype.next=function(e){var t,n;try{for(var r=Cs(this.observers),o=r.next();!o.done;o=r.next())o.value.next(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},e.prototype.subscribe=function(e){var t=new Uc,n=new Vc(e,t);return this.observers.push(n),t},e.prototype.unsubscribe=function(){this.observers=[]},e}(),Bc=typeof window===Us;function Wc(e){var t=this,n=void 0===e?{}:e,r=n.mode,o=void 0===r?Fs:r,a=n.reValidateMode,i=void 0===a?Ls:a,l=n.resolver,u=n.context,s=n.defaultValues,c=void 0===s?{}:s,f=n.shouldFocusError,p=void 0===f||f,d=n.shouldUnregister,h=void 0!==d&&d,m=n.criteriaMode,g=y.useRef({}),v=y.useRef(new Set),b=y.useRef(new Hc),w=y.useRef(new Hc),E=y.useRef(new Hc),_=y.useRef(new Hc),O=y.useRef({}),S=y.useRef(new Set),x=y.useRef(!1),k=y.useRef({}),C=y.useRef({}),T=y.useRef(c),P=y.useRef(!1),N=y.useRef(u),I=y.useRef(l),j=y.useRef(new Set),R=Fc(o),A=m===zs,D=xs(y.useState({isDirty:!1,isValidating:!1,dirtyFields:{},isSubmitted:!1,submitCount:0,touchedFields:{},isSubmitting:!1,isSubmitSuccessful:!1,isValid:!R.isOnSubmit,errors:{}}),2),M=D[0],L=D[1],F=y.useRef({isDirty:!Xs,dirtyFields:!Xs,touchedFields:!Xs,isValidating:!Xs,isValid:!Xs,errors:!Xs}),z=y.useRef(M);N.current=u,I.current=l;var U=function(){return z.current.isValid=ic(C.current,k.current)&&Ys(z.current.errors)},V=y.useCallback((function(e,t,n,r,o,a){void 0===n&&(n=!1),void 0===r&&(r={});var i=Ds(z.current.errors,e),l=n||!ic(i,t,!0)||F.current.isValid&&As(t)&&Ds(k.current,e)&&!Ds(C.current,e);if(t?(vc(C.current,e),l=l||!i||!ic(i,t,!0),tc(z.current.errors,e,t)):((Ds(k.current,e)||I.current)&&(tc(C.current,e,!0),l=l||i),vc(z.current.errors,e)),l&&!Ps(n)||!Ys(r)||a){var u=Object.assign(Object.assign({},r),{isValid:I.current?!!o:U(),errors:z.current.errors});z.current=Object.assign(Object.assign({},z.current),u),b.current.next(a?{}:u)}b.current.next({isValidating:!1})}),[]),H=y.useCallback((function(e,t,n,r,o){void 0===n&&(n={}),o&&re(e);var a=Ds(g.current,e,{})._f;if(a){var i=$s&&zc(a.ref)&&Ps(t)?"":t;if(a.value=t,Oc(a.ref)?(a.refs||[]).forEach((function(e){return e.checked=e.value===i})):Ec(a.ref)&&!jc(i)?a.ref.files=i:_c(a.ref)?ks(a.ref.options).forEach((function(e){return e.selected=i.includes(e.value)})):Ts(a.ref)&&a.refs?a.refs.length>1?a.refs.forEach((function(e){return e.checked=Array.isArray(i)?!!i.find((function(t){return t===e.value})):i===e.value})):a.refs[0].checked=!!i:a.ref.value=i,r){var l=rc(g);tc(l,e,t),E.current.next({values:Object.assign(Object.assign({},T.current),l),name:e})}n.shouldDirty&&W(e,i),n.shouldValidate&&G(e)}}),[]),B=y.useCallback((function(e,t){var n=rc(g);return e&&t&&tc(n,e,t),!ic(n,T.current)}),[]),W=y.useCallback((function(e,t,n){if(void 0===n&&(n=!0),F.current.isDirty||F.current.dirtyFields){var r=!ic(Ds(T.current,e),t),o=Ds(z.current.dirtyFields,e),a=z.current.isDirty;r?tc(z.current.dirtyFields,e,!0):vc(z.current.dirtyFields,e),z.current.isDirty=B();var i={isDirty:z.current.isDirty,dirtyFields:z.current.dirtyFields},l=F.current.isDirty&&a!==i.isDirty||F.current.dirtyFields&&o!==Ds(z.current.dirtyFields,e);return l&&n&&b.current.next(i),l?i:{}}return{}}),[]),K=y.useCallback((function(e,n){return Os(t,void 0,void 0,(function(){var t;return Ss(this,(function(r){switch(r.label){case 0:return[4,Lc(Ds(g.current,e),A)];case 1:return t=r.sent()[e],V(e,t,n),[2,As(t)]}}))}))}),[A]),q=y.useCallback((function(e,n){return void 0===n&&(n=[]),Os(t,void 0,void 0,(function(){var t,r,o,a,i,l,u;return Ss(this,(function(s){switch(s.label){case 0:return[4,I.current(rc(g,T),N.current,{criteriaMode:m,names:n,fields:wc(v.current,g.current)})];case 1:t=s.sent().errors;try{for(r=Cs(e),o=r.next();!o.done;o=r.next())a=o.value,(i=Ds(t,a))?tc(z.current.errors,a,i):vc(z.current.errors,a)}catch(e){l={error:e}}finally{try{o&&!o.done&&(u=r.return)&&u.call(r)}finally{if(l)throw l.error}}return[2,t]}}))}))}),[m]),Y=function(e){return Os(t,void 0,void 0,(function(){var t,n,r,o,a,i,l,u;return Ss(this,(function(s){switch(s.label){case 0:for(n in t=[],e)t.push(n);r=0,s.label=1;case 1:return r<t.length?(o=t[r],(a=e[o])?(i=a._f,l=Bs(a,"_f"),i?[4,Lc(a,A)]:[3,3]):[3,6]):[3,7];case 2:(u=s.sent())[i.name]?(tc(z.current.errors,i.name,u[i.name]),vc(C.current,i.name)):Ds(k.current,i.name)&&(tc(C.current,i.name,!0),vc(z.current.errors,i.name)),s.label=3;case 3:return l?[4,Y(l)]:[3,5];case 4:s.sent(),s.label=5;case 5:s.label=6;case 6:return r++,[3,1];case 7:return[2]}}))}))},G=y.useCallback((function(e){return Os(t,void 0,void 0,(function(){var t,n,r,o=this;return Ss(this,(function(a){switch(a.label){case 0:return t=As(e)?Object.keys(g.current):Array.isArray(e)?e:[e],b.current.next({isValidating:!0}),I.current?(r=Ys,[4,q(t,As(e)?void 0:t)]):[3,2];case 1:return n=r.apply(void 0,[a.sent()]),[3,7];case 2:return As(e)?[4,Y(g.current)]:[3,4];case 3:return a.sent(),[3,6];case 4:return[4,Promise.all(t.map((function(e){return Os(o,void 0,void 0,(function(){return Ss(this,(function(t){switch(t.label){case 0:return[4,K(e,null)];case 1:return[2,t.sent()]}}))}))})))];case 5:a.sent(),a.label=6;case 6:a.label=7;case 7:return b.current.next({errors:z.current.errors,isValidating:!1,isValid:I.current?n:U()}),[2]}}))}))}),[q,K]),$=y.useCallback((function(e,t,n){return Object.entries(t).forEach((function(t){var r=xs(t,2),o=r[0],a=r[1],i=e+"."+o,l=Ds(g.current,i);l&&!l._f?$(i,a,n):H(i,a,n,!0,!l)}))}),[G]),X=function(e){return P.current||S.current.has(e)||S.current.has((e.match(/\w+/)||[])[0])},Q=function(e,t,n,r){var o=Ds(g.current,e),a=As(o._f.value)?Ds(T.current,e):o._f.value;return o&&!As(a)&&(n&&n.defaultChecked?o._f.value=Pc(o):H(e,a)),(!As(a)||r)&&Nc(t)&&!R.isOnSubmit&&o&&F.current.isValid&&Lc(o,A).then((function(t){Ys(t)?tc(C.current,e,!0):vc(C.current,e),z.current.isValid!==U()&&L(Object.assign(Object.assign({},z.current),{isValid:U()}))})),a},J=y.useCallback((function(e){var n=e.type,r=e.target,o=e.target,a=o.value,l=o.type;return Os(t,void 0,void 0,(function(){var e,t,o,u,s,c,f,p,d,h,y,v,E,_,O,S,x;return Ss(this,(function(k){switch(k.label){case 0:return e=r.name,(u=Ds(g.current,e))?(s=l?Pc(u):void 0,s=As(s)?a:s,c=n===Ms,f=Fc(i),p=f.isOnBlur,d=f.isOnChange,h=!Nc(u._f)&&!I.current||function(e){var t=e.isOnBlur,n=e.isOnChange,r=e.isOnTouch,o=e.isTouched,a=e.isReValidateOnBlur,i=e.isReValidateOnChange,l=e.isBlurEvent,u=e.isSubmitted;return!e.isOnAll&&(!u&&r?!(o||l):(u?a:t)?!l:!(u?i:n)||l)}(Object.assign({isBlurEvent:c,isTouched:!!Ds(z.current.touchedFields,e),isSubmitted:z.current.isSubmitted,isReValidateOnBlur:p,isReValidateOnChange:d},R)),y=!c&&X(e),As(s)||(u._f.value=s),v=W(e,u._f.value,!1),c&&!Ds(z.current.touchedFields,e)&&(tc(z.current.touchedFields,e,!0),F.current.touchedFields&&(v.touchedFields=z.current.touchedFields)),E=!Ys(v)||y,h?(!c&&w.current.next({name:e,type:n,value:s}),[2,E&&b.current.next(y?{}:v)]):(b.current.next({isValidating:!0}),I.current?[4,I.current(rc(g,T),N.current,{criteriaMode:m,fields:wc([e],g.current),names:[e]})]:[3,2])):[3,5];case 1:return _=k.sent().errors,O=z.current.isValid,t=Ds(_,e),Ts(r)&&!t&&(S=js(e),(x=Ds(_,S,{})).type&&x.message&&(t=x),(x||Ds(z.current.errors,S))&&(e=S)),o=Ys(_),O!==o&&(E=!0),[3,4];case 2:return[4,Lc(u,A)];case 3:t=k.sent()[e],k.label=4;case 4:!c&&w.current.next({name:e,type:n,value:s}),V(e,t,E,v,o,y),k.label=5;case 5:return[2]}}))}))}),[]),Z=function(e){var t=x.current?rc(g,T):T.current;return As(e)?t:jc(e)?Ds(t,e):e.map((function(e){return Ds(t,e)}))},ee=y.useCallback((function(e){return void 0===e&&(e={}),Os(t,void 0,void 0,(function(){var t,n;return Ss(this,(function(r){switch(r.label){case 0:return t=z.current.isValid,l?[4,I.current(Object.assign(Object.assign({},rc(g,T)),e),N.current,{criteriaMode:m,fields:wc(v.current,g.current)})]:[3,2];case 1:return n=r.sent().errors,z.current.isValid=Ys(n),[3,3];case 2:U(),r.label=3;case 3:return t!==z.current.isValid&&b.current.next({isValid:z.current.isValid}),[2]}}))}))}),[m]),te=y.useCallback((function(e,t,n){var r,o,a,i=Array.isArray(e),l=x.current?Z():As(t)?T.current:i?t||{}:((r={})[e]=t,r);if(As(e))return n&&(P.current=!0),l;var u=[];try{for(var s=Cs(i?e:[e]),c=s.next();!c.done;c=s.next()){var f=c.value;n&&S.current.add(f),u.push(Ds(l,f))}}catch(e){o={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(o)throw o.error}}return i?u:u[0]}),[]),ne=function(e,t){var n,r;void 0===t&&(t={});try{for(var o=Cs(e?Array.isArray(e)?e:[e]:Object.keys(v.current)),a=o.next();!a.done;a=o.next()){var i=a.value;v.current.delete(i),j.current.delete(i),Ds(g.current,i)&&(t.keepIsValid||(vc(k.current,i),vc(C.current,i)),!t.keepError&&vc(z.current.errors,i),!t.keepValue&&vc(g.current,i),!t.keepDirty&&vc(z.current.dirtyFields,i),!t.keepTouched&&vc(z.current.touchedFields,i),!t.keepDefaultValue&&vc(T.current,i),w.current.next({name:i}))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}b.current.next(Object.assign(Object.assign(Object.assign({},z.current),t.keepDirty?{isDirty:B()}:{}),I.current?{}:{isValid:U()})),t.keepIsValid||ee()},re=y.useCallback((function(e,t){var n=!Ds(g.current,e);return tc(g.current,e,{_f:Object.assign(Object.assign(Object.assign({},n?{ref:{name:e}}:Object.assign({ref:(Ds(g.current,e)._f||{}).ref},Ds(g.current,e)._f)),{name:e}),t)}),Nc(t)&&tc(k.current,e,!0),v.current.add(e),n&&Q(e,t),Bc?{name:e}:{name:e,onChange:J,onBlur:J,ref:function(n){return n?function(e,t,n){var r=Ds(g.current,e);if(r){var o=function(e){return Oc(e)||Ts(e)}(t);if(t===r._f.ref||$s&&zc(r._f.ref)&&!zc(t)||o&&Array.isArray(r._f.refs)&&Rs(r._f.refs).find((function(e){return e===t})))return;r={_f:o?Object.assign(Object.assign({},r._f),{refs:ks(Rs(r._f.refs||[]).filter((function(e){return zc(e)&&document.contains(e)})),[t]),ref:{type:t.type,name:e}}):Object.assign(Object.assign({},r._f),{ref:t})},tc(g.current,e,r);var a=Q(e,n,t,!0);(o&&Array.isArray(a)?!ic(Ds(g.current,e)._f.value,a):As(Ds(g.current,e)._f.value))&&(Ds(g.current,e)._f.value=Pc(Ds(g.current,e)))}}(e,n,t):(h||t&&t.shouldUnregister)&&ne(e)}}}),[T.current]),oe=y.useCallback((function(e,n){return function(r){return Os(t,void 0,void 0,(function(){var t,o,a,i;return Ss(this,(function(l){switch(l.label){case 0:r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist()),t=Object.assign(Object.assign({},T.current),rc(g,T)),b.current.next({isSubmitting:!0}),l.label=1;case 1:return l.trys.push([1,,11,12]),I.current?[4,I.current(t,N.current,{criteriaMode:m,fields:wc(v.current,g.current)})]:[3,3];case 2:return o=l.sent(),a=o.errors,i=o.values,z.current.errors=a,t=i,[3,5];case 3:return[4,Y(g.current)];case 4:l.sent(),l.label=5;case 5:return Ys(z.current.errors)&&Object.keys(z.current.errors).every((function(e){return Ds(t,e)}))?(b.current.next({errors:{},isSubmitting:!0}),[4,e(t,r)]):[3,7];case 6:return l.sent(),[3,10];case 7:return n?[4,n(z.current.errors,r)]:[3,9];case 8:l.sent(),l.label=9;case 9:p&&nc(g.current,(function(e){return Ds(z.current.errors,e)}),v.current),l.label=10;case 10:return[3,12];case 11:return z.current.isSubmitted=!0,b.current.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ys(z.current.errors),submitCount:z.current.submitCount+1,errors:z.current.errors}),[7];case 12:return[2]}}))}))}}),[p,A,m]),ae=y.useCallback((function(e,t){var n=e.keepErrors,r=e.keepDirty,o=e.keepIsSubmitted,a=e.keepTouched,i=e.keepIsValid,l=e.keepSubmitCount;i||(C.current={},k.current={}),S.current=new Set,P.current=!1,b.current.next({submitCount:l?z.current.submitCount:0,isDirty:r?z.current.isDirty:!(!t||!B()),isSubmitted:!!o&&z.current.isSubmitted,isValid:i?z.current.isValid:!!ee(t),dirtyFields:r?z.current.dirtyFields:{},touchedFields:a?z.current.touchedFields:{},errors:n?z.current.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})}),[]);return y.useEffect((function(){x.current=!0;var e=b.current.subscribe({next:function(e){void 0===e&&(e={}),Gs(e,F.current,!0)&&(z.current=Object.assign(Object.assign({},z.current),e),L(z.current))}}),t=_.current.subscribe({next:function(e){if(e.fields&&e.name&&F.current.isValid){var t=rc(g);tc(t,e.name,e.fields),ee(t)}}});return I.current&&F.current.isValid&&ee(),function(){w.current.unsubscribe(),e.unsubscribe(),t.unsubscribe()}}),[]),{control:y.useMemo((function(){return{register:re,isWatchAllRef:P,watchFieldsRef:S,getIsDirty:B,formStateSubjectRef:b,fieldArraySubjectRef:_,controllerSubjectRef:E,watchSubjectRef:w,watchInternal:te,fieldsRef:g,validFieldsRef:C,fieldsWithValidationRef:k,fieldArrayNamesRef:j,readFormStateRef:F,formStateRef:z,defaultValuesRef:T,fieldArrayDefaultValuesRef:O,unregister:ne,shouldUnmountUnregister:h}}),[]),formState:qs(Xs,M,F),trigger:G,register:re,handleSubmit:oe,watch:y.useCallback((function(e,t){return Ic(e)?w.current.subscribe({next:function(n){return e(te(void 0,t),n)}}):te(e,t,!0)}),[]),setValue:y.useCallback((function(e,t,n){void 0===n&&(n={}),x.current=!0;var r=Ds(g.current,e),o=j.current.has(e);o&&(_.current.next({fields:t,name:e,isReset:!0}),(F.current.isDirty||F.current.dirtyFields)&&n.shouldDirty&&(tc(z.current.dirtyFields,e,sc(t,Ds(T.current,e,[]),Ds(z.current.dirtyFields,e,[]))),b.current.next({dirtyFields:z.current.dirtyFields,isDirty:B(e,t)})),!t.length&&tc(g.current,e,[])&&tc(O.current,e,[])),r&&!r._f||o?$(e,t,o?{}:n):H(e,t,n,!0,!r),X(e)&&b.current.next({}),w.current.next({name:e,value:t})}),[$]),getValues:y.useCallback(Z,[]),reset:y.useCallback((function(e,t){var n,r;void 0===t&&(t={});var o=e||T.current;if($s&&!t.keepValues)try{for(var a=Cs(v.current),i=a.next();!i.done;i=a.next()){var l=i.value,u=Ds(g.current,l);if(u&&u._f){var s=Array.isArray(u._f.refs)?u._f.refs[0]:u._f.ref;if(zc(s))try{s.closest("form").reset();break}catch(e){}}}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}!t.keepDefaultValues&&(T.current=Object.assign({},o)),t.keepValues||(g.current={},E.current.next({values:Object.assign({},o)}),w.current.next({value:Object.assign({},o)}),_.current.next({fields:Object.assign({},o),isReset:!0})),ae(t,e)}),[]),clearErrors:y.useCallback((function(e){e&&(Array.isArray(e)?e:[e]).forEach((function(e){return vc(z.current.errors,e)})),b.current.next({errors:e?z.current.errors:{}})}),[]),unregister:y.useCallback(ne,[]),setError:y.useCallback((function(e,t,n){var r=((Ds(g.current,e)||{_f:{}})._f||{}).ref;tc(z.current.errors,e,Object.assign(Object.assign({},t),{ref:r})),b.current.next({errors:z.current.errors,isValid:!1}),n&&n.shouldFocus&&r&&r.focus&&r.focus()}),[]),setFocus:y.useCallback((function(e){return Ds(g.current,e)._f.ref.focus()}),[])}}var Kc=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qc=function(){return qc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qc.apply(this,arguments)},Yc=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={open:!1,closing:!1},t.handleChange=function(e){"open"===e?t.setState({open:!0,closing:!1}):t.setState((function(e){return{open:!1,closing:e.open}}))},t}return Kc(t,e),t.prototype.componentDidMount=function(){ds.subscribe(this.props.id,this.handleChange)},t.prototype.componentWillUnmount=function(){ds.unsubscribe(this.props.id,this.handleChange)},t.prototype.render=function(){var e=this.props,t=e.id,n=e.onCloseHandler,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["id","onCloseHandler"]),o=this.state,a=o.open,i=o.closing;return a||i?y.createElement(La,qc({},r,{"data-e2e":"sg-dialog-"+t,triggerClose:i,onCloseHandler:function(){n&&n(),ds.close(t)}})):null},t}(y.Component),Gc=Yc,$c=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xc=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return $c(t,e),t.prototype.render=function(){var e=this.props,t=e.align,n=e.children,r=e.density,o=e.disableClose,a=e.footer,i=e.icon,l=e.iconColor,u=e.iconSize,s=e.id,c=e.onCloseHandler,f=e.requested,p=e.size,d=e.state,h=e.title,m=e.subTitle,g=e.resources,v=f>0;return y.createElement(Gc,{id:s,"data-e2e":"sg-dialog-"+s,align:t,density:r,disableClose:o||v,footer:a,icon:i,iconColor:l,iconSize:u,size:p,state:d,title:h,subTitle:m,onCloseHandler:c},y.createElement(br,{resources:g},n))},t}(y.Component),Qc=Xc,Jc=function(e){var t=e.e2eAttr,n=void 0===t?"dialog-close":t,r=e.id,o=e.label;return y.createElement(oo,{action:"button","data-e2e":n,onClick:function(){return ds.close(r)}},o||Ie("Cancel"))},Zc=function(e){var t=e.e2eAttr,n=void 0===t?"dialog-submit":t,r=e.label,o=e.onSubmit;return y.createElement(oo,{color:"primary",action:"button","data-e2e":n,onClick:o},r||Ie("Confirm"))},ef=function(e){var t=e.children,n=e.name;return y.createElement("form",{"data-e2e":"sg-form-"+n,onSubmit:function(e){return e.preventDefault()}},t)},tf=function(e){var t=e.children,n=e.name,r=e.size,o=e.title,a=e.subTitle,i=e.state,l=void 0===i?"warning":i,u=e.icon,s=void 0===u?"edit":u,c=e.iconColor,f=e.iconSize,p=e.align,d=e.density,h=e.footer,m=e.resources,g=void 0===m?[]:m,v=e.submitLabel,b=e.onSubmit,w=e.onCloseHandler;return y.createElement(Qc,{id:n,size:r,title:o,subTitle:a,state:l,icon:s,iconColor:c,iconSize:f,align:p,density:d,resources:g,footer:h||y.createElement(y.Fragment,null,y.createElement(Jc,{id:n}),y.createElement(Zc,{label:v,onSubmit:b})),onCloseHandler:function(){w&&w()}},y.createElement(ef,{name:n},t))},nf=function(e){var t=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(y.useState({}),2),n=t[0],r=t[1],o=y.useCallback((function(e){r(e)}),[]);return y.useEffect((function(){return ds.subscribe(e,o,"data")})),n},rf=function(){return rf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},rf.apply(this,arguments)},of=function(){var e=H(),t=Wc().handleSubmit,n=q(Hu).block,r=nf(bs),o=r.visitor_id,a=r.user;y.useEffect((function(){o&&e(Mo({endpoint:Uo.GET_VISITOR_STATUS.endpoint+"/"+o,resourceName:Uo.GET_VISITOR_STATUS.resourceName,requestTypeName:fo}))}),[e,o]);var i=Ie(n?"Unblock {{em}}{{strong}}%(user)s{{/strong}}{{/em}}":"Block {{em}}{{strong}}%(user)s{{/strong}}{{/em}}",{args:{user:a},components:{strong:y.createElement("strong",null),em:y.createElement("em",null)}}),l=Ie(n?"{{strong}}%(user)s{{/strong}} is currently blocked.":"Blocking {{strong}}%(user)s{{/strong}} will prevent them from accessing your site until you manually unblock them from the Blocked tab.",{args:{user:a},components:{strong:y.createElement("strong",null)}});return y.createElement(tf,{name:bs,size:"large",title:i,subTitle:l,resources:[fo,yo],onSubmit:t((function(){return e(Fo(rf(rf({},Uo.BLOCK_USER),{resourceName:yo,itemId:o,body:{block:Number(!n)}}),{onComplete:function(){return ds.close(bs)}}))}))},y.createElement(Un,null,Ie("Are you sure you wish to proceed?")))},af=function(){return af=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},af.apply(this,arguments)},lf=function(e){var t=H(),n=q(Uu).filters,r=null==n?void 0:n.find((function(e){return"user"===e.wp_name})),o=[{header:Ie("Timestamp"),accessor:"ts",smSize:"180px"},{header:Ie("User"),accessor:"user"},{header:Ie("IP Address"),accessor:"ip",smSize:"170px",render:function(e,t){return y.createElement(Un,null,e,y.createElement(Ua,{size:"xx-small"}),y.createElement(Sn,{color:"dark",name:"information",size:"12",tooltip:Ie("Hostname:")+" "+t.hostname}))}},{header:Ie("Activity"),accessor:"activity"},{header:Ie("Actions"),accessor:"actions",style:{textAlign:"right"},smSize:"140px",render:function(e,n){return y.createElement(us,{opener:y.createElement(jn,{icon:"dots"})},!n.do_not_block&&y.createElement(fs,{onClick:function(){ds.open(bs),ds.hidrate(bs,n)}},Ie("Manage User Traffic")),y.createElement(fs,{onClick:function(){return t(Mo(af(af({},Uo.ACTIVITY_REGISTERED),{body:{filters:[af(af({},r),{children:r.children.map((function(e){return af(af({},e),{value:n.visitor_id})}))})]}})))}},Ie("View Activity")))}}].filter((function(t){return!e.limitedView||"actions"!==t.accessor}));return e.limitedView&&o.push(),y.createElement(y.Fragment,null,y.createElement(qu,af({api:Uo.ACTIVITY_REGISTERED,columns:o,shadow:!e.limitedView},e)),y.createElement(of,null))},uf=function(){return uf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},uf.apply(this,arguments)},sf=function(){var e=H(),t=Wc().handleSubmit,n=q(Hu).block,r=nf(vs),o=r.visitor_id,a=r.ip;y.useEffect((function(){o&&e(Mo({endpoint:Uo.GET_VISITOR_STATUS.endpoint+"/"+o,resourceName:Uo.GET_VISITOR_STATUS.resourceName,requestTypeName:fo}))}),[e,o]);var i=Ie(n?"Unblock {{em}}{{strong}}%(ip)s{{/strong}}{{/em}}":"Block {{em}}{{strong}}%(ip)s{{/strong}}{{/em}}",{args:{ip:a},components:{strong:y.createElement("strong",null),em:y.createElement("em",null)}}),l=Ie(n?"{{strong}}%(ip)s{{/strong}} is currently blocked.":"Blocking {{strong}}%(ip)s{{/strong}} will prevent them from accessing your site until you manually unblock them from the Blocked tab.",{args:{ip:a},components:{strong:y.createElement("strong",null)}});return y.createElement(tf,{name:vs,size:"large",title:i,subTitle:l,resources:[fo,"BLOCK_IP"],onSubmit:t((function(){return e(Fo(uf(uf({},Uo.BLOCK_IP),{itemId:o,body:{block:Number(!n)}}),{onComplete:function(){return ds.close(vs)}}))}))},y.createElement(Un,null,Ie("Are you sure you wish to proceed?")))},cf=function(){return cf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},cf.apply(this,arguments)},ff=function(e){var t=H(),n=q(zu).filters,r=null==n?void 0:n.find((function(e){return"ip"===e.wp_name})),o=[{header:Ie("Timestamp"),accessor:"ts",smSize:"180px"},{header:Ie("Visitor Type"),accessor:"type",smSize:"140px"},{header:Ie("IP Address"),accessor:"ip",smSize:"170px",render:function(e,t){return y.createElement(Un,null,e,y.createElement(Ua,{size:"xx-small"}),y.createElement(Sn,{color:"dark",name:"information",size:"12",tooltip:Ie("Hostname:")+" "+t.hostname}))}},{header:Ie("Page Visited"),accessor:"page_visited"},{header:Ie("Response"),accessor:"response",smSize:"120px"},{header:Ie("Actions"),accessor:"actions",style:{textAlign:"right"},smSize:"140px",render:function(e,n){return y.createElement(us,{opener:y.createElement(jn,{icon:"dots"})},!n.do_not_block&&y.createElement(fs,{onClick:function(){ds.open(vs),ds.hidrate(vs,n)}},Ie("Manage IP Traffic")),y.createElement(fs,{onClick:function(){return t(Mo(cf(cf({},Uo.ACTIVITY_UNKNOWN),{body:{filters:[cf(cf({},r),{children:r.children.map((function(e){return cf(cf({},e),{value:n.ip})}))})]}})))}},Ie("View Activity")))}}].filter((function(t){return!e.limitedView||"actions"!==t.accessor}));return y.createElement(y.Fragment,null,y.createElement(qu,cf({api:Uo.ACTIVITY_UNKNOWN,columns:o,shadow:!e.limitedView},e)),y.createElement(sf,null))},pf=["compact","cozy"],df=["success","error","warning","instruction","info","hint"],hf=function(){return hf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},hf.apply(this,arguments)},mf={success:"success",error:"error-attention",warning:"warning",info:"information",instruction:"information",hint:"information"},yf={success:"success",error:"error",warning:"warning",info:"info",instruction:"instruction",hint:"light"},gf=y.forwardRef((function(e,t){var n=y.useContext(st).device,r=e.density,o=e.children,a=(e.className,e.contentSize,e.title),i=e.type,l=(e.shadow,e.onClose),u=e.tabIndex,s=e["data-e2e"],c=e["data-component"],f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["density","children","className","contentSize","title","type","shadow","onClose","tabIndex","data-e2e","data-component"]),p=function(e){var t=e.density,n=e.className,r=e.contentSize,o=e.title,a=e.type,i=e.shadow,l=hf({"sg-notice":!0,"sg-notice--shadow":i},wt([{class:"sg-notice--density-",props:pf,selected:t},{class:"sg-notice--type-",props:df,selected:a}]));return{classes:bt({styles:h.default,classes:l,className:n}),contentClasses:bt({styles:h.default,classes:hf({"sg-notice__content":!0},wt([{class:"sg-notice__content--size-",props:zt(),selected:r}]))}),iconClasses:bt({styles:h.default,classes:{"sg-notice__icon":!0,"sg-notice__icon--center-by-title":Boolean(o)}})}}(e),d=p.classes,m=p.contentClasses,g=p.iconClasses,v=un("sg-notice-content-"),b={compact:"20",cozy:n.isDesktop?"30":"20"};return y.createElement("div",hf({ref:t,className:d,tabIndex:u,"data-e2e":s,"data-component":c,role:"group","aria-labelledby":v},xt(f)),mf[i]&&y.createElement(Sn,{className:g,name:mf[i],size:b[r],color:yf[i]}),y.createElement("div",{id:v,className:m},a&&y.createElement($n,{level:"6",density:"none",color:yf[i]},a),o),l&&!n.isPhone&&y.createElement(jn,{icon:"cross",size:"small",className:"sg-notice__close-icon",onClick:l}))}));gf.defaultProps={density:"cozy",contentSize:"expanded",shadow:!0,type:"hint",tabIndex:0,"data-e2e":"notice","data-component":"notice"};var vf=gf,bf=["administrator","Administrator","user1","admin","Admin","user","User"],wf=function(e){return void 0===e&&(e=""),!(e&&!/^[A-Fa-f0-9.\-\%\/:*]+$/.test(e))||Ie("Invalid format.")},Ef=function(e){return e.length<7||Ie("You can't enable Away Mode for every day of the week.")},_f=function(e){if(!e)return null;var t=e.message;return"required"===e.type?Ie("This field is required."):t},Of=function(e){var t,n=e.email,r=e.emails;return n?(void 0===(t=n)&&(t=""),/^\S+@\S+\.\S+$/.test(t)?!r.find((function(e){return e.email===n}))||Ie("Email %(name)s already exists.",{args:{email:n}}):Ie("Invalid email address.")):Ie("This field is required.")},Sf=function(){return Sf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Sf.apply(this,arguments)},xf=function(e){var t=e.children,n=e.className,r=e.flex,o=e.xsStart,a=e.smStart,i=e.mStart,l=e.lgStart,u=e.xsSpan,s=e.smSpan,c=e.mSpan,f=e.lgSpan,p=e.align,d=e.justify,h=e.justifySelf,m=e.border,g=e.borderRadius,v=e.padding,b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","flex","xsStart","smStart","mStart","lgStart","xsSpan","smSpan","mSpan","lgSpan","align","justify","justifySelf","border","borderRadius","padding"]),w=vt(u&&"sg-grid-column--xs-span-"+u,s&&"sg-grid-column--sm-span-"+s,c&&"sg-grid-column--m-span-"+c,f&&"sg-grid-column--lg-span-"+f,o&&"sg-grid-column--xs-start-"+o,a&&"sg-grid-column--sm-start-"+a,i&&"sg-grid-column--m-start-"+i,l&&"sg-grid-column--lg-start-"+l,r&&"sg-grid-column--flex",!!window.MSInputMethodContext&&!!document.documentMode&&"sg-grid-column--ie11",p&&"sg-grid-column--align-"+p,d&&"sg-grid-column--justify-"+d,h&&"sg-grid-column--justify-self-"+h,dr(m,g),Wt(v),n);return y.createElement("div",Sf({className:w},xt(b)),t)},kf=function(){return kf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},kf.apply(this,arguments)},Cf=function(){var e=H(),t=Wc().handleSubmit,n=q(Vu),r=nf(Es).email;return y.createElement(tf,{state:"inactive",icon:"trash",name:Es,size:"large",title:Ie("Delete Notification Email"),subTitle:r,resources:[fo,go],onSubmit:t((function(){var t=n.entries.map((function(e){return e.email})).indexOf(r);n.entries.splice(t,1),e(Fo(kf(kf({},Uo.NOTIFICATIONS_EMAILS),{requestTypeName:go,body:kf({},n)}),{onComplete:function(){e(Mo(kf(kf({},Uo.WEEKLY_REPORTS),{requestTypeName:fo}))),ds.close(Es)}}))}))},y.createElement(Un,null,Ie("This action cannot be undone. Are you sure you wish to proceed?")))},Tf=function(){return Tf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Tf.apply(this,arguments)},Pf=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Nf=function(){var e=H(),t=Wc(),n=t.control,r=t.handleSubmit,o=q(Vu),a=nf(ws).email;return y.createElement(tf,{state:"warning",icon:"edit",name:ws,size:"large",title:Ie("Edit Notification Email"),subTitle:a,resources:[fo,go],onSubmit:r((function(t){var n=t.editedEmail,r=o.entries.map((function(e){return e.email})).indexOf(a),i=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Pf(arguments[t]));return e}(o.entries);i[r].email=n,e(Fo(Tf(Tf({},Uo.NOTIFICATIONS_EMAILS),{requestTypeName:go,body:Tf(Tf({},o),{entries:i})}),{onComplete:function(){e(Mo(Tf(Tf({},Uo.WEEKLY_REPORTS),{requestTypeName:fo}))),ds.close(ws)}}))}))},y.createElement(Qs,{name:"editedEmail",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(ui,Tf({onRefsReady:t.ref,placeholder:es,label:Ie("Email"),validationMessage:_f(o),state:r?"error":void 0},t))},shouldUnregister:!0,control:n,rules:{validate:function(e){return Of({email:e,emails:o.entries})}},defaultValue:a}))},If=function(){return If=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},If.apply(this,arguments)},jf=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i},Rf=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(jf(arguments[t]));return e},Af=function(e){var t,n,r=H(),o=q(Vu),a=Wc(),i=a.control,l=a.handleSubmit,u=o.max_emails;return y.createElement(y.Fragment,null,y.createElement("div",null,y.createElement(Qr,null,Ie("Add New Notification Email")),y.createElement(Bo,null,(null===(t=o.entries)||void 0===t?void 0:t.length)>=u?y.createElement(vf,{type:"info",shadow:!1},y.createElement(Un,null,Ie("The maximum number of email accounts that can receive the weekly reports email has been reached."))):y.createElement(Fr,{autoflow:"row"},y.createElement(xf,null,y.createElement(ef,{name:"emailForm"},y.createElement(Qs,{name:"email",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(ui,If({onRefsReady:t.ref,placeholder:es,label:Ie("Email"),validationMessage:_f(o),state:r?"error":void 0},t))},shouldUnregister:!0,control:i,rules:{validate:function(e){return Of({email:e,emails:o.entries})}}}))),y.createElement(xf,null,y.createElement(oo,{disabled:(null===(n=o.entries)||void 0===n?void 0:n.length)>=u,color:"primary",onClick:l((function(e){var t=e.email;r(Fo(If(If({},Uo.NOTIFICATIONS_EMAILS),{requestTypeName:go,body:{entries:Rf(o.entries,[{email:t}])}}),{onComplete:function(){return r(Mo(If(If({},Uo.WEEKLY_REPORTS),{requestTypeName:fo})))}}))}))},Ie("Create")))))),y.createElement(qu,If({title:Ie("Manage Notification Emails"),api:Uo.WEEKLY_REPORTS,shadow:!0,columns:[{header:Ie("Email"),accessor:"email",smSize:"170px"},{header:Ie("Actions"),accessor:"id",style:{textAlign:"right"},smSize:"140px",render:function(e,t){return y.createElement(y.Fragment,null,y.createElement(jn,{icon:"edit",onClick:function(){ds.open(ws),ds.hidrate(ws,t)}}),y.createElement(jn,{icon:"trash",onClick:function(){ds.open(Es),ds.hidrate(Es,t)}}))}}]},e)),y.createElement(Cf,null),y.createElement(Nf,null))},Df=function(){var e=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(y.useState($u),2),t=e[0],n=e[1];return y.createElement(Zr,{pageId:Re.ACTIVITY_LOG},y.createElement(Ir,{border:"light"},Zu.map((function(e){var r=e.label,o=e.type;return y.createElement(Dr,{key:o,active:t===o,onClick:function(){return n(o)}},Ie(r))}))),t===$u&&y.createElement(ff,{title:Ie("Unknown Visitors Activity")}),t===Xu&&y.createElement(lf,{title:Ie("Registered Users Activity")}),t===Qu&&y.createElement(Gu,{title:Ie("Blocked")}),t===Ju&&y.createElement(Af,{title:Ie("Weekly Reports")}))},Mf=function(){var e=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(y.useState($u),2),t=e[0],n=e[1],r=q(_r);return y.createElement("div",null,y.createElement(Qr,null,Ie("Recent Activity")),y.createElement(Fr,null,y.createElement(Bo,{padding:"none"},y.createElement(Ir,null,Zu.map((function(e){var r=e.label,o=e.type;return o===Qu||o===Ju?null:y.createElement(Dr,{key:o,active:t===o,onClick:function(){return n(o)}},Ie(r))}))),t===$u&&y.createElement(ff,{limitedView:!0}),t===Xu&&y.createElement(lf,{limitedView:!0})),y.createElement("a",{href:r,style:{textAlign:"center"}},y.createElement(oo,{color:"secondary"},Ie("View all logs")))))},Lf=function(){var e=H(),t=q(Lu),n=q(Fu);return y.useEffect((function(){e(Mo(Uo.HARDENING)),e(Mo(Uo.EBOOK))}),[e]),y.createElement(Fr,{sm:"3",gap:"responsive"},y.createElement(xf,{smSpan:"2"},y.createElement(Qr,null,Ie("Security Hardening")),y.createElement(Fr,{sm:"2",gap:"responsive"},t.map((function(e){var t=e.button_link,n=e.button_text,r=e.icon,o=e.text,a=e.title;return y.createElement(Yr,{key:a+o,layout:"vertical",iconName:r,iconColor:"primary",text:o,title:a},y.createElement("a",{href:t,className:"sg-security-ebook-button"},y.createElement(oo,{color:"secondary"},n)))})))),y.createElement(xf,{className:"sg-security-hardening-column"},y.createElement(Qr,null,null==n?void 0:n.title),y.createElement("a",{className:"sg-security-ebook",href:null==n?void 0:n.link,"aria-label":null==n?void 0:n.text,target:"_blank",rel:"noreferrer",style:{backgroundImage:'url("'+(null==n?void 0:n.image)+'")'}})))},Ff=function(e){var t=e.children;return y.createElement(Bo,{className:"sg-card-notifications",padding:"none"},y.createElement(Fr,{gap:"none",padding:["none","responsive"]},t))};Ff.displayName="CardNotifications";var zf=Ff,Uf=function(){return Uf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Uf.apply(this,arguments)},Vf=function(e){var t=e.title,n=e.description,r=e.device,o=e.buttonLabel,a=e.disabled,i=e.handleClick,l=un("sg-card-notification-title-"),u=un("sg-card-notification-description-"),s=l+" "+u;return y.createElement(Fr,{className:"sg-card-notification",align:"flex-start",autoflow:r.isPhone?"row":"column",gap:"responsive",border:["none","none","small","none"],padding:["responsive","none"],justify:"space-between"},!r.isPhone&&y.createElement(Sn,{size:"48",color:"primary",name:"product-notification-bell"}),y.createElement(Fr,{autoflow:"row",gap:"none"},y.createElement($n,{id:l,density:"none",level:"6",weight:"extra-bold",transform:"uppercase"},t),y.createElement(Un,{id:u,className:"sg-card-notification--description"},n)),o&&y.createElement(xf,{style:{alignSelf:"center"}},y.createElement(oo,{onClick:i,disabled:a,color:"primary",size:"small","aria-describedby":s},o)))};Vf.displayName="CardNotification";var Hf=function(e){return y.createElement(st.Consumer,null,(function(t){var n=t.device;return y.createElement(Vf,Uf({},e,{device:n}))}))},Bf=function(){var e=H(),t=q(Mu);return y.useEffect((function(){e(Mo(Uo.NOTIFICATIONS))}),[e]),t&&0!==t.length?y.createElement("div",null,y.createElement(Qr,null,Ie("Important Notifications")),y.createElement(zf,null,t.map((function(e){var t=e.title,n=e.text,r=e.button_link,o=e.button_text;return y.createElement(Hf,{key:t+n,title:t,description:n,buttonLabel:o,handleClick:function(){return location.href=r}})})))):null},Wf=function(){return Wf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Wf.apply(this,arguments)},Kf=function(e){var t=y.useRef(null),n=e.decoration,r=e.disabled,o=e.className,a=e.onClick,i=e.onKeyDown,l=e.children,u=e.target,s=e.color,c=e.title,f=e.breadcrumb,p=e.tabIndex,d=e["data-e2e"],h=e["data-component"],m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["decoration","disabled","className","onClick","onKeyDown","children","target","color","title","breadcrumb","tabIndex","data-e2e","data-component"]),g=vt("sg-link",n&&"sg-link--decoration-"+n,r&&"sg-link--disabled",f&&"sg-link--breadcrumb",an(s),Ln(m),o);return y.createElement("a",Wf({ref:t,className:g,"data-e2e":d,"data-component":h,tabIndex:p},xt(m),{target:u,onClick:r?null:a,onKeyDown:function(e){r||(e.key===Ct.ENTER&&(e.preventDefault(),e.stopPropagation(),t.current&&t.current.click()),i&&i(e))},title:c}),l)};Kf.defaultProps={"data-e2e":"link","data-component":"link",tabIndex:0,role:"link",wordBreak:"all"};var qf=Kf,Yf=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Gf=function(){return Gf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gf.apply(this,arguments)},$f={small:"16",medium:"26",large:"36"},Xf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.starRatingRef=y.createRef(),t.state={rating:t.props.rating},t.keyboardHandling=function(e){if(Tt(e))nn({event:e,startingElement:t.starRatingRef.current});else if(Pt(e))nn({event:e,startingElement:t.starRatingRef.current,isDirectionForward:!1});else switch(e.key){case Ct.LEFT:case Ct.UP:if(e.preventDefault(),e.stopPropagation(),e.target===Cr(t.starRatingRef.current))return;nn({event:e,includeChildren:!0,isDirectionForward:!1});break;case Ct.RIGHT:case Ct.DOWN:if(e.preventDefault(),e.stopPropagation(),e.target===Cr(t.starRatingRef.current,{isDirectionForward:!1}))return;nn({event:e,includeChildren:!0});break;case Ct.ENTER:case Ct.SPACE:e.target.click()}},t.classes=function(){return vt("sg-star-rating","sg-star-rating--size-"+t.props.size,t.props.className)},t.handleOnClick=function(e){var n=t.props.onClick;n&&n(e)},t.handleOnMouseOver=function(e){var n=t.props,r=n.onClick,o=n.onMouseOver;if(r)return t.setState({rating:e}),o&&o(e)},t.handleOnMouseOut=function(){var e=t.props,n=e.rating,r=e.onClick,o=e.onMouseOut;if(r)return t.setState({rating:n}),o&&o()},t.renderStarts=function(){return new Array(t.props.stars).fill(null).map((function(e,n){var r=n+1,o=t.state.rating>=r?"star-filled":"star";return y.createElement(Sn,{tabIndex:-1,key:"starRating-"+r+o,"aria-hidden":"true",name:o,size:$f[t.props.size],onClick:function(){return t.handleOnClick(r)},onMouseOver:function(){return t.handleOnMouseOver(r)},onMouseOut:t.handleOnMouseOut,color:"primary",prefetch:["star-filled","star"]})}))},t}return Yf(t,e),t.prototype.componentDidUpdate=function(){this.props.onClick||this.state.rating===this.props.rating||this.setState({rating:this.props.rating})},t.prototype.render=function(){var e=this.props,t=(e.onClick,e.onMouseEnter,e.onMouseLeave,e.onMouseOver,e.onMouseOut,e.tabIndex),n=e["data-e2e"],r=e["data-component"],o=e["aria-label"],a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["onClick","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","tabIndex","data-e2e","data-component","aria-label"]);return y.createElement("div",Gf({role:"img","aria-label":o,ref:this.starRatingRef,className:this.classes(),"data-e2e":n,"data-component":r,tabIndex:t},xt(a),{onKeyDown:this.keyboardHandling}),this.renderStarts())},t.defaultProps={rating:0,size:"medium",stars:5,tabIndex:0,"data-e2e":"star-rating","data-component":"star-rating","aria-label":"Star Rating: 0 out of 5 stars"},t}(y.Component),Qf=Xf,Jf=function(){return Jf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jf.apply(this,arguments)},Zf=function(){var e=y.useContext(st).device,t=H(),n=q(Bu).show;return y.useEffect((function(){t(Mo(Uo.RATE))}),[t]),n?y.createElement("div",null,y.createElement(Qr,null,Ie("Rate Us")),y.createElement(Bo,{className:"rate"},y.createElement(br,{resources:[fo,mo]},y.createElement("div",null,y.createElement("div",{className:vt("rate__wrapper",e.isPhone&&"rate_wrapper--mobile")},y.createElement("a",{className:"rate__starts",href:"https://wordpress.org/support/plugin/sg-security/reviews/?rate=5#new-post",target:"_blank",rel:"noreferrer"},y.createElement(Qf,{rating:5})),y.createElement("div",{className:"rate__separator"}),y.createElement(aa,{direction:"column"},y.createElement($n,{level:"4",density:"compact"},Ie("Thank you for using SiteGround Security!")),y.createElement(qf,{href:"https://wordpress.org/support/plugin/sg-security/reviews/?rate=5#new-post",target:"_blank"},Ie("Help other people secure their WordPress website by rating our plugin."))),y.createElement(jn,{className:vt("rate__close-icon-button","rate__close-icon-button--mobile"),icon:"cross",onClick:function(){return t(Fo(Jf(Jf({},Uo.RATE),{requestTypeName:mo,body:{show:0}})))}})))))):null},ep=function(){return y.createElement(Zr,{pageId:Re.SECURITY_DASHBOARD},y.createElement(Bf,null),y.createElement(Lf,null),y.createElement(Zf,null),y.createElement(Mf,null))},tp=function(){return tp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},tp.apply(this,arguments)},np=function(e){var t=e.checked,n=e.className,r=e.id,o=e.disabled,a=e.label,i=e.name,l=e.size,u=e.style,s=e.tabIndex,c=e["data-e2e"],f=e["data-component"],p=e["aria-label"],d=e["aria-labelledby"],h=e["aria-describedby"],m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["checked","className","id","disabled","label","name","size","style","tabIndex","data-e2e","data-component","aria-label","aria-labelledby","aria-describedby"]),g=vt("sg-switch",n,o&&"sg-switch--disabled","sg-switch--"+l);return y.createElement("label",{className:g,style:u,tabIndex:s,"data-e2e":c,"data-component":f,onKeyDown:function(e){return function(e){e.key!==Ct.SPACE&&e.key!==Ct.ENTER||(e.preventDefault(),e.stopPropagation(),e.target.querySelector('[data-html="input"]').click())}(e)},role:"switch","aria-checked":t,"aria-label":p,"aria-labelledby":d,"aria-describedby":h},y.createElement("input",tp({className:"sg-switch__input"},xt(m),{id:r,type:"checkbox","data-html":"input",name:i,disabled:o,checked:t})),y.createElement("span",{className:"sg-switch__slider"}),a&&y.createElement("span",{className:"sg-switch__label"},a))};np.displayName="Switch",np.defaultProps={size:"medium",style:{},tabIndex:0,"data-e2e":"switch","data-component":"switch"};var rp=np,op=["default","outlined","link"],ap=function(){return ap=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ap.apply(this,arguments)},ip=function(e){var t=e.children,n=e.className,r=e.color,o=e.size,a=e.type,i=e.padding,l=e.tabIndex,u=e["data-e2e"],s=e["data-component"],c=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","color","size","type","padding","tabIndex","data-e2e","data-component"]),f=[{class:"sg-label--type-",props:op,selected:a},{class:"sg-label--size-",props:zt(),selected:o}],p=vt(n,an(r),Wt(i)),d=bt({styles:m.default,classes:ap({"sg-label":!0},wt(f)),className:p}),h=bt({styles:m.default,classes:{"sg-label__text":!0}});return y.createElement("span",ap({className:d,"data-e2e":u,"data-component":s,tabIndex:l},xt(c)),y.createElement("span",{className:h},t))};ip.defaultProps={"data-e2e":"label","data-component":"label",size:"small",type:"default",color:"light"};var lp,up=ip,sp=function(e){var t=e.label,n=e.title,r=e.text,o=e.action,a=e.resources;return y.createElement(Fr,{className:"sg-security-list",border:["none","none","small","none"],padding:"responsive"},y.createElement(br,{resources:a},y.createElement("div",null,y.createElement(aa,{align:"center"},y.createElement(Qr,{weight:"bold",density:"compact"},n),y.createElement(Ua,{size:"x-small"}),t&&y.createElement(up,{color:"primary"},t)),y.createElement(Un,null,r)),y.createElement(aa,{align:"center"},o)))},cp=((lp={})[Re.LOGIN_SETTINGS]="login",lp[Re.SITE_SECURITY]="security",lp),fp=function(){return fp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},fp.apply(this,arguments)},pp=function(e){var t=e.color,n=e.children,r=e.className,o=e.background,a=e.size,i=e.tabIndex,l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["color","children","className","background","size","tabIndex"]),u=vt("sg-time-picker-button",t&&"sg-time-picker-button--color-"+t,o&&"sg-time-picker-button--background-"+o,"sg-time-picker-button--size-"+a,r);return y.createElement("button",fp({className:u,type:"button",tabIndex:i},l),n)};pp.defaultProps={size:"large",tabIndex:-1};var dp=pp,hp=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mp=function(){return mp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mp.apply(this,arguments)},yp="TIME",gp="HOUR",vp="MINUTE",bp=function(e){function t(t){var n=e.call(this,t)||this;return n.handleHourKeyDown=function(e){switch(e.key){case Ct.SPACE:case Ct.ENTER:return e.preventDefault(),void e.stopPropagation();case Ct.UP:case Ct.RIGHT:return void n.handleHourIncrease();case Ct.DOWN:case Ct.LEFT:return void n.handleHourDecrease();default:return}},n.handleMinuteKeyDown=function(e){switch(e.key){case Ct.SPACE:case Ct.ENTER:return e.preventDefault(),void e.stopPropagation();case Ct.UP:case Ct.RIGHT:return void n.handleMinuteIncrease();case Ct.DOWN:case Ct.LEFT:return void n.handleMinuteDecrease();default:return}},n.state={viewType:yp,selectedTime:+(new Date).setMinutes(0),inputValue:null,isTimePickerVisible:!1},n.openTimePicker=n.openTimePicker.bind(n),n.closeTimePicker=n.closeTimePicker.bind(n),n.handleTimePick=n.handleTimePick.bind(n),n.handleTimeChange=n.handleTimeChange.bind(n),n.handleHourIncrease=n.handleHourIncrease.bind(n),n.handleHourSelection=n.handleHourSelection.bind(n),n.handleHourDecrease=n.handleHourDecrease.bind(n),n.handleMinuteIncrease=n.handleMinuteIncrease.bind(n),n.handleMinuteSelection=n.handleMinuteSelection.bind(n),n.handleMinuteDecrease=n.handleMinuteDecrease.bind(n),n.handleDayPeriodChange=n.handleDayPeriodChange.bind(n),n}return hp(t,e),t.prototype.componentDidMount=function(){var e=this.props.value,t=this.state.selectedTime;e&&t!==e&&this.setStateFromValue(e)},t.prototype.componentDidUpdate=function(e){""===this.props.value&&null!==this.state.inputValue&&this.setState({inputValue:null}),e.value!==this.props.value&&this.setStateFromValue(this.props.value)},t.prototype.setStateFromValue=function(e){var t=+new Date(1e3*parseInt(e,10));"string"!=typeof e?this.setState({selectedTime:t,inputValue:t}):this.setState({selectedTime:+new Date,inputValue:""})},t.prototype.getTimeFromLocales=function(){return function(e,t){void 0===t&&(t=navigator.language);var n=ka(e);if(!n)return null;var r=xa.find((function(e){return e.toLowerCase()===t.toLowerCase()})),o=Ca(r?"en":t,n),a=/AM|PM|a\.m|p\.m/.test(o),i=n.getHours()>=12?"PM":"AM",l=parseInt(o,10).toString().padStart(2,"0"),u=n.getMinutes().toString().padStart(2,"0");return a?l+":"+u+" "+i:l+":"+u}(this.state.inputValue,this.props.locales)},t.prototype.getHours=function(){var e=this.state.selectedTime;return new Date(e).getHours()},t.prototype.getMinutes=function(){var e=this.state.selectedTime;return new Date(e).getMinutes()},t.prototype.getFormattedTime=function(e){return Math.floor(e/1e3)},t.prototype.getHumanReadableSelectedHour=function(){var e=this.props.locales,t=this.state.selectedTime,n=Ca(e,new Date(t));return parseInt(n,10).toString().padStart(2,"0")},t.prototype.getHumanReadableSelectedMinute=function(){var e=this.getMinutes().toString();return parseInt(e,10).toString().padStart(2,"0")},t.prototype.getHumanReadableSelectedDayPeriod=function(){return this.getHours()>=12?"PM":"AM"},t.prototype.closeTimePicker=function(){this.setState({isTimePickerVisible:!1,viewType:yp})},t.prototype.openTimePicker=function(){this.props.disabled||this.setState({isTimePickerVisible:!0})},t.prototype.handleTimePick=function(){var e=this.props.onChange,t=this.state.selectedTime,n=this.getFormattedTime(t);this.setState({inputValue:t},(function(){return e(n)}))},t.prototype.handleTimeChange=function(e){var t=e.hour,n=e.minute,r=this.state.selectedTime,o=new Date(r),a=void 0!==t?t:o.getHours(),i=void 0!==n?n:o.getMinutes(),l=+new Date(o.getFullYear(),o.getMonth(),o.getDate(),a,i,0);this.setState({selectedTime:l})},t.prototype.handleHourIncrease=function(){var e=this.getHours(),t=23===e?0:e+1;this.handleTimeChange({hour:t})},t.prototype.handleHourDecrease=function(){var e=this.getHours(),t=0===e?23:e-1;this.handleTimeChange({hour:t})},t.prototype.handleHourSelection=function(e){var t=this;this.setState({viewType:yp},(function(){return t.handleTimeChange({hour:e})}))},t.prototype.handleMinuteIncrease=function(){var e=this.getMinutes(),t=59===e?0:e+1;this.handleTimeChange({minute:t})},t.prototype.handleMinuteDecrease=function(){var e=this.getMinutes(),t=0===e?59:e-1;this.handleTimeChange({minute:t})},t.prototype.handleMinuteSelection=function(e){var t=this;this.setState({viewType:yp},(function(){return t.handleTimeChange({minute:e})}))},t.prototype.handleDayPeriodChange=function(){var e=this.getHours(),t=e>=12?e-12:e+12;this.handleTimeChange({hour:t})},t.prototype.shouldUse12hFormat=function(){var e=this.state.selectedTime,t=this.props.locales,n=Ca(t,new Date(e));return Boolean(["A","M","P","a","m","p"].find((function(e){return n.includes(e)})))},t.prototype.renderInput=function(){var e=this,t=this.props.disabled,n=this.state.inputValue,r={label:this.props.label,placeholder:this.props.placeholder,size:this.props.size,validationMessage:this.props.validationMessage,validationMessageTemplate:this.props.validationMessageTemplate,state:this.props.state,disabled:this.props.disabled,readOnly:this.props.readOnly,ariaLabel:this.props["aria-label"],"data-e2e":this.props["data-e2e-input"]},o=n?this.getTimeFromLocales():"",a=vt("sg-time-picker__input",t&&"sg-time-picker__input--disabled"),i=vt("sg-time-picker__field",t&&"sg-time-picker__field--disabled");return y.createElement(ui,mp({className:a,fieldClassName:i,value:o,prefix:y.createElement(Sn,{name:"generic-clock",color:"primary",size:"18",className:"date-picker-calendar-icon","aria-hidden":!0}),onClick:this.openTimePicker,role:"button","aria-label":r.ariaLabel,onKeyDown:function(t){t.key!==Ct.SPACE&&t.key!==Ct.ENTER||(t.preventDefault(),t.stopPropagation(),e.openTimePicker())}},r))},t.prototype.renderTimePickerDialog=function(){var e=this.state,t=e.isTimePickerVisible,n=e.viewType,r=vt("sg-time-picker",this.props.className);return t?y.createElement(La,{className:r,density:"small",size:"small",footer:this.renderFooter(),onCloseHandler:this.closeTimePicker,"data-e2e":this.props["data-e2e"],"aria-hidden":t,role:"region","aria-live":"polite"},n===yp&&this.renderClock(),n===gp&&this.renderHourPicker(),n===vp&&this.renderMinutePicker()):null},t.prototype.renderFooter=function(){var e=this,t=this.props.translation;return y.createElement(y.Fragment,null,y.createElement(oo,{onClick:this.closeTimePicker,"data-e2e":"timepicker-cancel-button"},t.cancelButton),y.createElement(oo,{"data-e2e":"timepicker-confirm-button",color:"primary",disabled:this.props.shouldDisableTime(this.getFormattedTime(this.state.selectedTime)),onClick:function(){e.handleTimePick(),e.closeTimePicker()}},t.okButton))},t.prototype.renderClock=function(){var e=this,t=this.shouldUse12hFormat(),n=this.getHumanReadableSelectedHour(),r=this.getHumanReadableSelectedMinute(),o=this.getHumanReadableSelectedDayPeriod(),a=this.props.ariaProps;return y.createElement("div",{className:"sg-time-picker__content sg-time-picker__content--flex","data-e2e":"timepicker-clock",role:"group"},y.createElement("div",{className:"sg-time-picker__column"},y.createElement(dp,{size:"xx-large",tabIndex:0,style:{order:1},onClick:function(){return e.setState({viewType:gp})},onKeyDown:this.handleHourKeyDown,"data-e2e":"timepicker-hour",role:"spinbutton","aria-valuenow":parseInt(n),"aria-valuetext":n,"aria-valuemin":1,"aria-valuemax":t?12:24,"aria-label":a.ariaLabelHours,"aria-live":"polite"},n),y.createElement(dp,{color:"secondary",style:{order:0},onClick:this.handleHourIncrease,"data-e2e":"timepicker-hour-increase",role:"presentation","aria-hidden":"true"},y.createElement(Sn,{name:"arrow-up",size:"16"})),y.createElement(dp,{color:"secondary",style:{order:2},onClick:this.handleHourDecrease,"data-e2e":"timepicker-hour-decrease",role:"presentation","aria-hidden":"true"},y.createElement(Sn,{name:"arrow-down",size:"16"}))),y.createElement("div",{className:"sg-time-picker__column sg-time-picker__column--justify-center"},":"),y.createElement("div",{className:"sg-time-picker__column"},y.createElement(dp,{color:"secondary",onClick:this.handleMinuteIncrease,"data-e2e":"timepicker-hour-increase",role:"presentation","aria-hidden":"true"},y.createElement(Sn,{name:"arrow-up",size:"16"})),y.createElement(dp,{size:"xx-large",tabIndex:0,onClick:function(){return e.setState({viewType:vp})},onKeyDown:this.handleMinuteKeyDown,"data-e2e":"timepicker-minute",role:"spinbutton","aria-valuenow":parseInt(r),"aria-valuetext":r,"aria-valuemin":0,"aria-valuemax":59,"aria-label":a.ariaLabelMinutes,"aria-live":"assertive"},r),y.createElement(dp,{color:"secondary",onClick:this.handleMinuteDecrease,"data-e2e":"timepicker-minute-decrease",role:"presentation","aria-hidden":"true"},y.createElement(Sn,{name:"arrow-down",size:"16"}))),t&&y.createElement("div",{className:vt("sg-time-picker__column","sg-time-picker__column--justify-center","sg-time-picker__column--margin-start")},y.createElement(dp,{background:"secondary",onClick:this.handleDayPeriodChange,tabIndex:0,"data-e2e":"timepicker-period-change","aria-label":"am/pm",role:"button","aria-valuetext":o},o)))},t.prototype.renderHourPicker=function(){var e=this,t=this.getHours(),n=this.shouldUse12hFormat(),r=Array(n?12:24).fill(null).map((function(e,t){return n?t+1:t}));return y.createElement("div",{className:"sg-time-picker__content","data-e2e":"timepicker-hour"},r.map((function(n){var r=t===n,o=vt("sg-time-picker-entity",r&&"sg-time-picker-entity--selected");return y.createElement("span",{key:n,ref:function(e){return r&&Oi(e,{block:"center"})},"data-e2e":"timepicker-hours"},y.createElement(Un,{className:o,color:"dark",weight:"bold",onClick:function(){return e.handleHourSelection(n)}},n.toString().padStart(2,"0")))})))},t.prototype.renderMinutePicker=function(){var e=this,t=this.getMinutes(),n=Array(60).fill(null).map((function(e,t){return t}));return y.createElement("div",{className:"sg-time-picker__content","data-e2e":"timepicker-minutes"},n.map((function(n){var r=t===n,o=vt("sg-time-picker-entity",r&&"sg-time-picker-entity--selected");return y.createElement("span",{key:n,ref:function(e){return r&&Oi(e,{block:"center"})},"data-e2e":"timepicker-minute"},y.createElement(Un,{className:o,weight:"bold",onClick:function(){return e.handleMinuteSelection(n)}},n.toString().padStart(2,"0")))})))},t.prototype.render=function(){return y.createElement(y.Fragment,null,this.renderInput(),this.renderTimePickerDialog())},t.defaultProps={locales:navigator.language||"en-US",placeholder:"Select a time",onChange:function(){return!1},shouldDisableTime:function(){return!1},translation:{cancelButton:"Cancel",okButton:"Ok"},"data-e2e":"timepicker","data-e2e-input":"timepicker-input",ariaProps:{ariaLabelMinutes:"Minutes",ariaLabelHours:"Hour"}},t}(y.Component),wp=bp,Ep=function(){return Ep=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ep.apply(this,arguments)},_p="period",Op="weekly",Sp="daily",xp=[{label:Ie("Specific Period"),value:_p},{label:Ie("Weekly"),value:Op},{label:Ie("Daily"),value:Sp}],kp=[{label:Ie("Monday"),value:"monday"},{label:Ie("Tuesday"),value:"tuesday"},{label:Ie("Wednesday"),value:"wednesday"},{label:Ie("Thursday"),value:"thursday"},{label:Ie("Friday"),value:"friday"},{label:Ie("Saturday"),value:"saturday"},{label:Ie("Sunday"),value:"sunday"}],Cp=function(e){switch(e.type){case _p:return{type:e.type,from:e.from_date,to:e.to_date};case Op:return{type:e.type,value:e.weekly.map((function(e){return e.value}))};case Sp:return{type:e.type,from:e.from_hour,to:e.to_hour}}},Tp=+(new Date).setHours(0,0,0),Pp=(new Date).setMonth((new Date).getMonth()+6),Np=function(){var e=H(),t=Wc({defaultValues:{type:_p}}),n=t.control,r=t.handleSubmit,o=t.watch,a=t.setValue,i=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}(o(["type","from_date","to_date","from_hour","to_hour"]),5),l=i[0],u=i[1],s=i[2],c=i[3],f=i[4];return y.createElement(tf,{name:"AWAY_MODE",size:"large",title:Ie("Configure Away Mode"),onSubmit:r((function(t){return e(Fo(Ep(Ep({},Uo.AWAY_MODE),{requestTypeName:"AWAY_MODE",body:Cp(t)}),{onComplete:function(){return ds.close(hs)}}))}))},y.createElement(Fr,null,y.createElement(Un,null,y.createElement(Un,{tag:"span",weight:"bold"},Ie("Use Away Mode with caution.")),y.createElement(Ua,{size:"xx-small"}),Ie("When Away Mode is enabled, you won't be able to access your website and make changes, including disabling the away mode.")),y.createElement(Qs,{name:"type",render:function(e){var t=e.field;return y.createElement(al,Ep({label:Ie("Mode"),options:xp,optionValue:"value",optionLabel:"label",selectedValue:t.value},t))},shouldUnregister:!0,control:n,rules:{required:!0}}),l===_p&&y.createElement(Fr,{sm:"2"},y.createElement(Qs,{name:"from_date",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(Ni,Ep({label:Ie("From"),state:r?"error":void 0,validationMessage:_f(o),shouldDisableDate:function(e){return Tp>=1e3*e}},t,{onChange:function(e){e>s&&a("to_date",""),t.onChange(e)}}))},shouldUnregister:!0,control:n,rules:{required:!0}}),y.createElement(Qs,{name:"to_date",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(Ni,Ep({label:Ie("To"),state:r?"error":void 0,validationMessage:_f(o),shouldDisableDate:function(e){return 1e3*e<Tp||e<u||1e3*e>Pp||void 0}},t))},shouldUnregister:!0,control:n,rules:{required:!0}})),l===Op&&y.createElement(Qs,{name:"weekly",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(gl,Ep({label:"Select one or more",options:kp,optionValue:"value",optionLabel:"label",groupBy:"group",state:r?"error":void 0,validationMessage:_f(o)},t,{onChange:function(e,n,r){return t.onChange(r)}}))},shouldUnregister:!0,control:n,rules:{required:!0,validate:Ef}}),l===Sp&&y.createElement(Fr,{sm:"2"},y.createElement(Qs,{name:"from_hour",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(wp,Ep({locales:"bg",label:Ie("From"),state:r?"error":void 0,validationMessage:_f(o)},t,{onChange:function(e){e>f&&a("to_hour",""),t.onChange(e)}}))},shouldUnregister:!0,control:n,rules:{required:!0}}),y.createElement(Qs,{name:"to_hour",render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(wp,Ep({locales:"bg",label:Ie("To"),state:r?"error":void 0,validationMessage:_f(o)},t))},shouldUnregister:!0,control:n,rules:{required:!0,validate:function(e){return e-c<=82800||Ie("You can enable Away Mode for maximum of 23 hours daily.")}}}))))},Ip=function(){return Ip=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ip.apply(this,arguments)},jp="data-component",Rp=function(e){var t=y.useRef(null),n=e.children,r=e.className,o=e.disabled,a=e.reverse,i=e.size,l=e.style,u=e.tabIndex,s=e["data-e2e"],c=e["data-component"],f=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children","className","disabled","reverse","size","style","tabIndex","data-e2e","data-component"]),p=vt("sg-radio-button",o&&"sg-radio-button--disabled","sg-radio-button--"+i,r);return y.createElement("label",{role:"radio",ref:t,className:p,style:l,tabIndex:u,"data-e2e":s,"data-component":c,onKeyDown:function(e){return function(e){var t=e.event,n=e.dataComponent,r=e.domRef;if(Tt(t))nn({event:t,onComponentFiltering:function(e){return e.getAttribute(jp)!==n}});else if(Pt(t))nn({event:t,onComponentFiltering:function(e){return e.getAttribute(jp)!==n}});else switch(t.key){case Ct.SPACE:return void r.current.click();case Ct.RIGHT:case Ct.DOWN:return void nn({event:t,onComponentFiltering:function(e){return e.getAttribute(jp)===n}});case Ct.LEFT:case Ct.UP:return void nn({event:t,isDirectionForward:!1,onComponentFiltering:function(e){return e.getAttribute(jp)===n}});default:return}}({event:e,dataComponent:c,domRef:t})},"aria-checked":f.checked},y.createElement("input",Ip({className:"sg-radio-button__input"},xt(f),{type:"radio",disabled:o})),a&&y.createElement("span",{className:"sg-radio-button__label"},n),y.createElement(Sn,{name:"dot",className:"sg-radio-button__icon"}),!a&&y.createElement("span",{className:"sg-radio-button__label"},n))};Rp.defaultProps={size:"medium",tabIndex:0,"data-e2e":"radio-button","data-component":"radio-button"};var Ap=Rp,Dp=function(){return Dp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Dp.apply(this,arguments)},Mp="custom",Lp="default",Fp="type",zp=function(e){var t=e.signup,n=e.type,r=e.homeURL,o=e.control;return null==t?null:y.createElement(Qs,{name:"signup",render:function(e){var t=e.field,o=e.fieldState,a=o.invalid,i=o.error;return y.createElement(ui,Dp({onRefsReady:t.ref,prefix:n===Mp&&r,readOnly:n===Lp,state:a?"error":void 0,validationMessage:_f(i),label:Ie(n===Mp?"Custom Signup URL":"Default Signup URL")},t))},shouldUnregister:!0,control:o,rules:{required:!0},defaultValue:n===Mp?t.replace(r,""):t})},Up=function(){var e=H(),t=q(Du).login_url,n=void 0===t?[]:t,r=q(wr),o=Wc(),a=o.control,i=o.watch,l=o.handleSubmit,u=o.setValue,s=o.getValues,c=i(Fp),f=n.find((function(e){var t=e.type;return c===t})),p=s();return y.useEffect((function(){var e=n.find((function(e){return e.selected}));e&&u(Fp,e.type)}),[n,u]),y.createElement(tf,{size:"large",name:hs,title:Ie("Configure Login URL"),subTitle:(null==f?void 0:f.signup)&&Ie("If you have your registration form open for new users, you will be asked to change the signup URL, too."),resources:[wo],onSubmit:l((function(t){var n=t.type,r=t.login,o=t.signup;e(Fo(Dp(Dp({},Uo.CUSTOM_LOGIN_URL),{requestTypeName:wo,body:{type:n,login:r,signup:o}}),{onComplete:function(){return ds.close(hs)}}))}))},y.createElement(Fr,{sm:"1"},y.createElement(Fr,{sm:"2"},y.createElement(Qs,{render:function(e){var t=e.field;return y.createElement(y.Fragment,null,n.map((function(e){var r=e.type,o=e.label;return y.createElement(Ap,{key:r,name:"radiobutton",value:r,checked:t.value===r,onChange:function(){var e=n.find((function(e){return e.type===r}));u(Fp,r),u("login",e.login),u("signup",e.signup)}},o)})))},control:a,name:Fp})),"custom"===p.type&&y.createElement(vf,{type:"info",shadow:!1},Ie("Your site signup URL (wp-signup.php) has a link to your login URL, which can be easily exploited. Please change the signup URL, too and make sure that {{strong}}you update the URL with the new one{{/strong}} if you have it linked in your website, emails or other places.",{components:{strong:y.createElement("strong",null)}})),y.createElement(Fr,{sm:"1"},f&&y.createElement(Qs,{name:"login",render:function(e){var t=e.field,n=e.fieldState,o=n.invalid,a=n.error;return y.createElement(ui,Dp({onRefsReady:t.ref,prefix:f.type===Mp&&r,readOnly:f.type===Lp,label:f.type===Mp?Ie("Custom Login URL"):Ie("Default Login URL"),validationMessage:_f(a),state:o?"error":void 0},t))},shouldUnregister:!0,control:a,rules:{required:!0},defaultValue:f.type===Mp?f.login.replace(r,""):f.login}),y.createElement(zp,Dp({},f,{homeURL:r,control:a})))))},Vp=function(){return Vp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vp.apply(this,arguments)},Hp=function(){var e=H(),t=Wc(),n=t.control,r=t.handleSubmit,o=t.reset,a=t.getValues,i=q(Du).usernames_data,l=void 0===i?{}:i,u=l.admin_matches,s=void 0===u?[]:u,c=l.all_users,f=void 0===c?[]:c,p=s.reduce((function(e,t){return e.push(t.ID),e}),[]);return y.createElement(tf,{name:ys,title:Ie("Change Common Usernames"),subTitle:Ie("There are one or more users with common usernames. Please provide new username(s) for them."),resources:[wo],onCloseHandler:function(){return o()},onSubmit:r((function(t){var n=function(e){return Object.keys(e).reduce((function(t,n){var r={ID:n,user_login:e[n]};return t.push(r),t}),[])}(t);e(Fo(Vp(Vp({},Uo.DISABLE_ADMIN_USERNAME),{requestTypeName:bo,body:{admin_names:Vp({},n),disable_usernames:1}}),{onComplete:function(){e(Mo(Vp(Vp({},Uo.FETCH_OPTIONS),{method:"POST",body:{page:cp[Re.LOGIN_SETTINGS]}}))),ds.close(ys)}}))}))},y.createElement(Fr,null,s.map((function(e){return y.createElement(Qs,{key:e.ID,render:function(t){var n=t.field,r=t.fieldState.error;return y.createElement(ui,Vp({onRefsReady:n.ref},n,{label:Ie("New username: %(admin)s",{args:{admin:e.user_login}}),state:r?"error":"success",validationMessage:_f(r)}))},control:n,name:e.ID,rules:{validate:function(e){var t=a(p);return function(e){var t,n=e.name,r=e.users,o=e.fieldsValues;if(!n)return Ie("This field is required.");if(void 0===(t=n)&&(t=""),/[^a-z0-9 _.\-@]/i.test(t))return Ie("Invalid format.");var a,i=function(e){return e.reduce((function(e,t){return e.push(t.user_login),e}),[])}(r);return a=n,o.filter((function(e){return e===a})).length>1?Ie("Username %(name)s already typed.",{args:{name:n}}):i.includes(n)?Ie("Username %(name)s already exists.",{args:{name:n}}):!bf.includes(n)||Ie("Username %(name)s is not allowed.",{args:{name:n}})}({name:e,users:f,fieldsValues:t})}}})})),y.createElement(Un,null,Ie("Bear in mind that the user will NOT be notified of the change."))))},Bp=function(){return Bp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Bp.apply(this,arguments)},Wp=function(){var e=H(),t=Wc(),n=t.handleSubmit,r=t.reset,o=t.control,a=q(Du).reset_2fa;return y.createElement(tf,{size:"large",name:gs,title:Ie("Reset 2-factor Authentication"),subTitle:Ie("Resetting the 2FA authentication will enable them to set up their Authentication app anew on their next login. Use this functionality when a user no longer has access to their Authenticator app or backup codes and cannot log in."),resources:["FETCH_OPTIONS"],onCloseHandler:function(){return r()},onSubmit:n((function(t){e(Fo(Bp(Bp({},Uo.RESET_TWO_FACTOR),{requestTypeName:"RESET_TWO_FACTOR",itemId:t.user_login}),{onComplete:function(){ds.close(gs)}}))}))},y.createElement(Fr,null,y.createElement(Qs,{name:"user_login",render:function(e){var t=e.field;return y.createElement(al,Bp({label:Ie("Select User"),options:a,optionValue:"ID",optionLabel:"user_login",selectedValue:t.value},t))},control:o})))},Kp=function(){return Kp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kp.apply(this,arguments)},qp=Ie("IP"),Yp=function(){var e=H(),t=q(Du).login_access,n=Wc(),r=n.control,o=n.handleSubmit,a=n.setValue,i=bc({control:r,name:"ips"}),l=i.fields,u=i.remove,s=i.insert;return y.useEffect((function(){var e;a("ips",(e=t)&&0!==e.length?e.map((function(e){return{ip:e}})):[{ip:""}])}),[t,a]),y.createElement(tf,{name:ms,title:Ie("Manage Login Access"),resources:[Eo],onSubmit:o((function(t){return e(Fo(Kp(Kp({},Uo.LOGIN_ACCESS),{requestTypeName:Eo,body:t.ips.map((function(e){return e.ip})).filter(Boolean)}),{onComplete:function(){return ds.close(ms)}}))}))},y.createElement(Fr,null,l.map((function(e,t,n){var o=e.id,i=e.ip,l="ips."+t+".ip";return y.createElement(aa,{key:o,align:"center",wrap:"nowrap"},y.createElement(Qs,{render:function(e){var t=e.field,n=e.fieldState,r=n.invalid,o=n.error;return y.createElement(ui,Kp({placeholder:qp,onRefsReady:t.ref},t,{state:r?"error":void 0,validationMessage:null==o?void 0:o.message}))},rules:{validate:wf},control:r,defaultValue:i,name:l}),y.createElement(jn,{icon:"circle-minus",onClick:function(){return 1!==n.length?u(t):a(l,"")}}),y.createElement(jn,{icon:"circle-plus",onClick:function(){return s(t+1,"")}}))}))))},Gp=function(){return Gp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gp.apply(this,arguments)},$p=function(){var e,t=H(),n=q(Du),r=n.usernames_data,o=n.sg2fa,a=n.disable_usernames,i=n.login_url,l=n.login_attempts;y.useEffect((function(){t(Mo(Gp(Gp({},Uo.FETCH_OPTIONS),{method:"POST",body:{page:cp[Re.LOGIN_SETTINGS]}})))}),[t]);var u=Boolean(null==i?void 0:i.find((function(e){return e.selected&&"default"===e.type}))),s=null===(e=null==l?void 0:l.find((function(e){return e.selected})))||void 0===e?void 0:e.value,c=0===o?Ie("Two-factor authentication forces admin users to login only after providing a token, generated from the Google Authenticator application. When you enable this option, {{strong}}all admin & editor users will be asked to configure their two-factor authentication in the Authenticator app on their next login.{{/strong}}",{components:{strong:y.createElement("strong",null)}}):Ie("Two-factor authentication forces admin users to login only after providing a token, generated from the Google Authenticator application. You can find the backup codes for your 2-factor authentication in the WordPress Profile page. If one of your users no longer have access to their Authenticator app and cannot log in to get their backup codes, {{link}}click here{{/link}} to reset their 2-factor authentication.",{components:{link:y.createElement(qf,{onClick:function(){return ds.open(gs)}})}});return y.createElement(Zr,{pageId:Re.LOGIN_SETTINGS},y.createElement("div",null,y.createElement(Qr,null,Ie("Login Settings")),y.createElement(Bo,{padding:"none"},y.createElement(sp,{label:u&&Ie("recommended"),title:Ie("Custom Login URL"),text:Ie("Attackers often try exploits on /wp-admin as a default login URL for WordPress. Change it to avoid these attacks and have an easily memorisable login URL."),action:y.createElement(oo,{color:"secondary",onClick:function(){return ds.open(hs)}},Ie("configure"))}),y.createElement(sp,{title:Ie("Login Access"),text:Ie("By default your WordPress login can be accessed by any IP. You can use this feature to allow login only for specific IPs or range of IPs in order to prevent brute-force attacks or malicious login attempts."),action:y.createElement(oo,{color:"secondary",onClick:function(){return ds.open(ms)}},Ie("configure"))}),y.createElement(sp,{label:!o&&Ie("recommended"),title:Ie("Two-factor Authentication for Admin & Editors Users"),text:c,resources:[vo],action:y.createElement(rp,{checked:Boolean(o),onChange:function(){return t(Fo(Gp(Gp({},Uo.TWO_FA),{requestTypeName:vo,body:{sg2fa:Number(!o)}})))}})}),y.createElement(sp,{label:!a&&Ie("recommended"),title:Ie("Disable Common Usernames"),text:Ie("Using common usernames like 'admin' is a security threat that often results in unauthorised access. By enabling this option we will disable the creation of common usernames and if you already have one or more users with a weak username, we'll ask you to provide new one(s)."),resources:[bo],action:y.createElement(rp,{checked:Boolean(a),onChange:function(){var e=r.admin_matches;a||!e.length?t(Fo(Gp(Gp({},Uo.DISABLE_ADMIN_USERNAME),{requestTypeName:bo,body:{disable_usernames:Number(!a)}}))):ds.open(ys)}})}),y.createElement(sp,{label:0===s&&Ie("recommended"),title:Ie("Limit Login Attempts"),text:Ie("Limit the number of times a given user can attempt to log in to your wp-admin with incorrect credentials. Once the login attempt limit is reached, the IP from which the attempts have originated will be blocked first for 1 hour. If the attempts continue after the first hour, the limit will then be triggered for 24 hours and then for 7 days."),resources:[_o],action:y.createElement(al,{options:l,optionValue:"value",optionLabel:"label",selectedValue:s,onChange:function(e){return t(Fo(Gp(Gp({},Uo.LOGIN_ATTEMPTS),{requestTypeName:_o,body:{login_attempts:e}})))}})})),y.createElement(Up,null),y.createElement(Hp,null),y.createElement(Yp,null),y.createElement(Wp,null),y.createElement(Np,null)))},Xp=function(){return Xp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Xp.apply(this,arguments)},Qp=function(){var e=H();return y.createElement(Zr,{pageId:Re.POST_HACK_ACTIONS},y.createElement("div",null,y.createElement(Qr,null,Ie("Post-hack Actions")),y.createElement(Bo,{padding:"none"},y.createElement(sp,{title:Ie("Reinstall All Free Plugins"),text:Ie("Doing this will reinstall the same version of all free plugins you have installed in order to make sure that their codebase is not compromised by an attacker."),resources:[Oo],action:y.createElement(oo,{color:"secondary",onClick:function(){return e(Fo(Xp(Xp({},Uo.REINSTALL_PLUGINS),{requestTypeName:Oo})))}},Ie("reinstall all"))}),y.createElement(sp,{title:Ie("Force Password Reset"),text:Ie("All users will be required to change their passwords upon their next login. {{strong}}All currently logged in users will be instantly logged out.{{/strong}}",{components:{strong:y.createElement("strong",null)}}),resources:[So],action:y.createElement(oo,{color:"secondary",onClick:function(){return e(Fo(Xp(Xp({},Uo.FORCE_PASSWORD_RESET),{requestTypeName:So})))}},Ie("force password reset"))}),y.createElement(sp,{title:Ie("Log out All Users"),text:Ie("This will log out all currently logged in users without asking them to change their passwords."),resources:[xo],action:y.createElement(oo,{color:"secondary",onClick:function(){return e(Fo(Xp(Xp({},Uo.LOGOUT_USERS),{requestTypeName:xo})))}},Ie("Log out All Users"))}))))},Jp=function(){return Jp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jp.apply(this,arguments)},Zp=function(){var e=H(),t=q(Du),n=t.disable_file_edit,r=t.wp_remove_version,o=t.disable_xml_rpc,a=t.disable_feed,i=t.xss_protection,l=t.lock_system_folders,u=(t.hsts_protection,t.delete_readme);return y.useEffect((function(){e(Mo(Jp(Jp({},Uo.FETCH_OPTIONS),{body:{page:cp[Re.SITE_SECURITY]}})))}),[e]),y.createElement(Zr,{pageId:Re.SITE_SECURITY},y.createElement("div",null,y.createElement(Qr,null,Ie("Site Security")),y.createElement(Bo,{padding:"none"},y.createElement(sp,{label:l?null:Ie("recommended"),title:Ie("Lock and Protect System Folders"),text:Ie("By enabling this option you are ensuring that no unauthorised or malicious scripts can be executed in your system folders. This is an often exploited back door you can close with a simple toggle."),resources:[jo],action:y.createElement(rp,{checked:Boolean(l),onChange:function(){return e(Fo(Jp(Jp({},Uo.LOCK_SYSTEM_FOLDERS),{requestTypeName:jo,body:{lock_system_folders:Number(!l)}})))}})}),y.createElement(sp,{label:r?null:Ie("recommended"),title:Ie("Hide WordPress Version"),text:Ie("Many attackers scan sites for vulnerable WordPress versions. By hiding the version from your site HTML, you avoid being marked by hackers for mass attacks."),resources:[Io],action:y.createElement(rp,{checked:Boolean(r),onChange:function(){return e(Fo(Jp(Jp({},Uo.HIDE_WP_VERSION),{requestTypeName:Io,body:{wp_remove_version:Number(!r)}})))}})}),y.createElement(sp,{label:n?null:Ie("recommended"),title:Ie("Disable Themes & Plugins Editor"),text:Ie("Disable the option to edit themes and plugins code directly from the WordPress admin to prevent potential coding errors or unauthorised access via the WordPress editor."),resources:[No],action:y.createElement(rp,{checked:Boolean(n),onChange:function(){return e(Fo(Jp(Jp({},Uo.DISABLE_EDITORS),{requestTypeName:No,body:{disable_file_edit:Number(!n)}})))}})}),y.createElement(sp,{label:o?null:Ie("recommended"),title:Ie("Disable XML-RPC"),text:Ie("XML-RPC was designed as a protocol enabling WordPress to communicate with third-party systems but recently it has been used in a number of exploits. Unless you specifically need to use it, we recommend that XML-RPC is always disabled."),resources:[To],action:y.createElement(rp,{checked:Boolean(o),onChange:function(){return e(Fo(Jp(Jp({},Uo.DISABLE_XML_RPC),{requestTypeName:To,body:{disable_xml_rpc:Number(!o)}})))}})}),!1,y.createElement(sp,{label:a?null:Ie("recommended"),title:Ie("Disable RSS and ATOM Feeds"),text:Ie("RSS and ATOM feeds are often used to scrape your content and to perform a number of attacks against your site. Only use feeds if you have readers using your site via RSS readers."),resources:[Co],action:y.createElement(rp,{checked:Boolean(a),onChange:function(){return e(Fo(Jp(Jp({},Uo.DISABLE_FEEDS),{requestTypeName:Co,body:{disable_feed:Number(!a)}})))}})}),y.createElement(sp,{label:i?null:Ie("recommended"),title:Ie("Advanced XSS Protection"),text:Ie("Enabling this option will add extra headers to your site for protection against XSS attacks."),resources:[Po],action:y.createElement(rp,{checked:Boolean(i),onChange:function(){return e(Fo(Jp(Jp({},Uo.XSS_PROTECTION),{requestTypeName:Po,body:{xss_protection:Number(!i)}})))}})}),y.createElement(sp,{title:Ie("Delete the Default Readme.html"),text:Ie("WordPress comes with a readme.html file containing information about your website. The readme.html is often used by hackers to compile lists of potentially vulnerable sites which can be hacked or attacked."),resources:[ko],action:y.createElement(rp,{checked:Boolean(u),onChange:function(){return e(Fo(Jp(Jp({},Uo.DELETE_README),{requestTypeName:ko,body:{delete_readme:Number(!u)}})))}})}))))},ed=function(e){var t=e.condition,n=e.children;return t?y.createElement(y.Fragment,null,n):null},td=function(){return td=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},td.apply(this,arguments)},nd=function(e){var t=e.showDataField,n=e.showEmailField,r=H(),o=Wc(),a=o.control,i=o.handleSubmit;return y.createElement(tf,{name:_s,title:Ie("Get the Most of This Plugin"),icon:"information",size:"medium",state:"info",resources:[ho],footer:y.createElement(Zc,{onSubmit:i((function(e){var t=e.siteground_data_consent,n=e.siteground_email_consent,o={siteground_settings_security:1};void 0!==t&&(o.siteground_data_consent=+t),void 0!==n&&(o.siteground_email_consent=+n),r(function(e,t){var n=e.requestTypeName,r=Ao(e,["requestTypeName"]);return Ro({type:so,requestTypeName:n||po,payload:Ro({},r)},t)}(td(td({},Uo.UPDATE_CONSENT_SETTINGS),{requestTypeName:ho,body:o}),{onComplete:function(){return ds.close(_s)}}))}))})},y.createElement(ed,{condition:t},y.createElement(Qs,{control:a,name:"siteground_data_consent",defaultValue:!1,render:function(e){var t=e.field;return y.createElement(va,td({},t,{checked:t.value}),Ie("Collect technical data about my installation. The data will be used to make sure that the plugin(s) works seamlessly on the widest possible range of WordPress sites. (A full list of the data to be collected can be found {{link}}here{{/link}}).",{components:{link:y.createElement(qf,{href:"https://www.siteground.com/kb/what-information-wp-plugins-collect",target:"_blank"})}}))}})),y.createElement(ed,{condition:n},y.createElement(Qs,{control:a,name:"siteground_email_consent",defaultValue:!1,render:function(e){var t=e.field;return y.createElement(va,td({},t,{checked:t.value}),Ie("Send me occasional emails about updates, special offers and new features from SiteGround."))}})))},rd=function(e){switch(e){case Re.SECURITY_DASHBOARD:return y.createElement(ep,null);case Re.LOGIN_SETTINGS:return y.createElement($p,null);case Re.SITE_SECURITY:return y.createElement(Zp,null);case Re.ACTIVITY_LOG:return y.createElement(Df,null);case Re.POST_HACK_ACTIONS:return y.createElement(Qp,null)}},od=(0,ur.w)((function(e){var t=e.page,n=q(Er),r=q(Or),o=r.show_data_field,a=r.show_email_field,i=!a&&!o;return y.useEffect((function(){n&&Ne.setLocale(n)}),[n]),i||ds.open(_s),y.createElement(ht,null,y.createElement(Mt,{position:"relative",pageContent:y.createElement(Yt,{className:"sg-security"},y.createElement(br,null,y.createElement(lr,{defaultErrorTitle:Ne.translate("Error").toString(),defaultSuccessTitle:Ne.translate("Success").toString()}),rd(t)))}),y.createElement(nd,{showDataField:o,showEmailField:a}))})),ad=function(e){return"@@redux-saga/"+e},id=ad("CANCEL_PROMISE"),ld=ad("CHANNEL_END"),ud=ad("IO"),sd=ad("MATCH"),cd=ad("MULTICAST"),fd=ad("SAGA_ACTION"),pd=ad("SELF_CANCELLATION"),dd=ad("TASK"),hd=ad("TASK_CANCEL"),md=ad("TERMINATE"),yd=ad("LOCATION"),gd=function(e){return null==e},vd=function(e){return null!=e},bd=function(e){return"function"==typeof e},wd=function(e){return"string"==typeof e},Ed=Array.isArray,_d=function(e){return e&&bd(e.then)},Od=function(e){return e&&bd(e.next)&&bd(e.throw)},Sd=function e(t){return t&&(wd(t)||Cd(t)||bd(t)||Ed(t)&&t.every(e))},xd=function(e){return e&&bd(e.take)&&bd(e.close)},kd=function(e){return bd(e)&&e.hasOwnProperty("toString")},Cd=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Td=function(e){return function(){return true}}(),Pd=function(){},Nd=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Id=function(e,t){L(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function jd(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Rd=function(e){throw e},Ad=function(e){return{value:e,done:!0}};function Dd(e,t,n){void 0===t&&(t=Rd),void 0===n&&(n="iterator");var r={meta:{name:n},next:e,throw:t,return:Ad,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(r[Symbol.iterator]=function(){return r}),r}function Md(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ld=function(e){return Array.apply(null,new Array(e))},Fd=function(e){return function(t){return e(Object.defineProperty(t,fd,{value:!0}))}},zd=function(e){return e===md},Ud=function(e){return e===hd},Vd=function(e){return zd(e)||Ud(e)};function Hd(e,t){var n,r=Object.keys(e),o=r.length,a=0,i=Ed(e)?Ld(o):{},l={};return r.forEach((function(e){var r=function(r,l){n||(l||Vd(r)?(t.cancel(),t(r,l)):(i[e]=r,++a===o&&(n=!0,t(i))))};r.cancel=Pd,l[e]=r})),t.cancel=function(){n||(n=!0,r.forEach((function(e){return l[e].cancel()})))},l}function Bd(e){return{name:e.name||"anonymous",location:Wd(e)}}function Wd(e){return e[yd]}var Kd=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),r=0,o=0,a=0,i=function(t){n[o]=t,o=(o+1)%e,r++},l=function(){if(0!=r){var t=n[a];return n[a]=null,r--,a=(a+1)%e,t}},u=function(){for(var e=[];r;)e.push(l());return e};return{isEmpty:function(){return 0==r},put:function(l){var s;if(r<e)i(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:s=2*e,n=u(),r=n.length,o=n.length,a=0,n.length=s,e=s,i(l)}},take:l,flush:u}}(e,4)},qd="TAKE",Yd="CALL",Gd="FORK",$d="SELECT",Xd=function(e,t){var n;return(n={})[ud]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Qd(e,t){return void 0===e&&(e="*"),Sd(e)?Xd(qd,{pattern:e}):xd(n=e)&&n[cd]&&vd(t)&&Sd(t)?Xd(qd,{channel:e,pattern:t}):xd(e)?Xd(qd,{channel:e}):void 0;var n}function Jd(e,t){return gd(t)&&(t=e,e=void 0),Xd("PUT",{channel:e,action:t})}function Zd(e,t){var n,r=null;return bd(e)?n=e:(Ed(e)?(r=e[0],n=e[1]):(r=e.context,n=e.fn),r&&wd(n)&&bd(r[n])&&(n=r[n])),{context:r,fn:n,args:t}}function eh(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Xd(Yd,Zd(e,n))}function th(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Xd(Gd,Zd(e,n))}function nh(e){void 0===e&&(e=Nd);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Xd($d,{selector:e,args:n})}var rh=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},oh=[],ah=0;function ih(e){try{sh(),e()}finally{ch()}}function lh(e){oh.push(e),ah||(sh(),fh())}function uh(e){try{return sh(),e()}finally{fh()}}function sh(){ah++}function ch(){ah--}function fh(){var e;for(ch();!ah&&void 0!==(e=oh.shift());)ih(e)}var ph=function(e){return function(t){return e.some((function(e){return gh(e)(t)}))}},dh=function(e){return function(t){return e(t)}},hh=function(e){return function(t){return t.type===String(e)}},mh=function(e){return function(t){return t.type===e}},yh=function(){return Td};function gh(e){var t="*"===e?yh:wd(e)?hh:Ed(e)?ph:kd(e)?hh:bd(e)?dh:Cd(e)?mh:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var vh={type:ld},bh=function(e){return e&&e.type===ld};function wh(){var e,t,n,r,o,a,i=(t=!1,r=n=[],o=function(){r===n&&(r=n.slice())},a=function(){t=!0;var e=n=r;r=[],e.forEach((function(e){e(vh)}))},(e={})[cd]=!0,e.put=function(e){if(!t)if(bh(e))a();else for(var o=n=r,i=0,l=o.length;i<l;i++){var u=o[i];u[sd](e)&&(u.cancel(),u(e))}},e.take=function(e,n){var a,i;void 0===n&&(n=yh),t?e(vh):(e[sd]=n,o(),r.push(e),e.cancel=(a=function(){o(),jd(r,e)},i=!1,function(){i||(i=!0,a())}))},e.close=a,e),l=i.put;return i.put=function(e){e[fd]?l(e):lh((function(){l(e)}))},i}function Eh(e,t){var n=e[id];bd(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var _h,Oh=0,Sh=function(){return++Oh};function xh(e){e.isRunning()&&e.cancel()}var kh=((_h={}).TAKE=function(e,t,n){var r=t.channel,o=void 0===r?e.channel:r,a=t.pattern,i=t.maybe,l=function(e){e instanceof Error?n(e,!0):!bh(e)||i?n(e):n(md)};try{o.take(l,vd(a)?gh(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},_h.PUT=function(e,t,n){var r=t.channel,o=t.action,a=t.resolve;lh((function(){var t;try{t=(r?r.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&_d(t)?Eh(t,n):n(t)}))},_h.ALL=function(e,t,n,r){var o=r.digestEffect,a=Oh,i=Object.keys(t);if(0!==i.length){var l=Hd(t,n);i.forEach((function(e){o(t[e],a,l[e],e)}))}else n(Ed(t)?[]:{})},_h.RACE=function(e,t,n,r){var o=r.digestEffect,a=Oh,i=Object.keys(t),l=Ed(t)?Ld(i.length):{},u={},s=!1;i.forEach((function(e){var t=function(t,r){s||(r||Vd(t)?(n.cancel(),n(t,r)):(n.cancel(),s=!0,l[e]=t,n(l)))};t.cancel=Pd,u[e]=t})),n.cancel=function(){s||(s=!0,i.forEach((function(e){return u[e].cancel()})))},i.forEach((function(e){s||o(t[e],a,u[e],e)}))},_h.CALL=function(e,t,n,r){var o=t.context,a=t.fn,i=t.args,l=r.task;try{var u=a.apply(o,i);if(_d(u))return void Eh(u,n);if(Od(u))return void Mh(e,u,l.context,Oh,Bd(a),!1,n);n(u)}catch(e){n(e,!0)}},_h.CPS=function(e,t,n){var r=t.context,o=t.fn,a=t.args;try{var i=function(e,t){gd(e)?n(t):n(e,!0)};o.apply(r,a.concat(i)),i.cancel&&(n.cancel=i.cancel)}catch(e){n(e,!0)}},_h.FORK=function(e,t,n,r){var o=t.context,a=t.fn,i=t.args,l=t.detached,u=r.task,s=function(e){var t=e.context,n=e.fn,r=e.args;try{var o=n.apply(t,r);if(Od(o))return o;var a=!1;return Dd((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!_d(o)})}))}catch(e){return Dd((function(){throw e}))}}({context:o,fn:a,args:i}),c=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Bd(t)}(s,a);uh((function(){var t=Mh(e,s,u.context,Oh,c,l,void 0);l?n(t):t.isRunning()?(u.queue.addTask(t),n(t)):t.isAborted()?u.queue.abort(t.error()):n(t)}))},_h.JOIN=function(e,t,n,r){var o=r.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&jd(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ed(t)){if(0===t.length)return void n([]);var i=Hd(t,n);t.forEach((function(e,t){a(e,i[t])}))}else a(t,n)},_h.CANCEL=function(e,t,n,r){var o=r.task;t===pd?xh(o):Ed(t)?t.forEach(xh):xh(t),n()},_h.SELECT=function(e,t,n){var r=t.selector,o=t.args;try{n(r.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},_h.ACTION_CHANNEL=function(e,t,n){var r=t.pattern,o=function(e){void 0===e&&(e=Kd());var t=!1,n=[];return{take:function(r){t&&e.isEmpty()?r(vh):e.isEmpty()?(n.push(r),r.cancel=function(){jd(n,r)}):r(e.take())},put:function(r){if(!t){if(0===n.length)return e.put(r);n.shift()(r)}},flush:function(n){t&&e.isEmpty()?n(vh):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var r=0,o=e.length;r<o;r++)(0,e[r])(vh)}}}}(t.buffer),a=gh(r),i=function t(n){bh(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){i.cancel(),l()},e.channel.take(i,a),n(o)},_h.CANCELLED=function(e,t,n,r){n(r.task.isCancelled())},_h.FLUSH=function(e,t,n){t.flush(n)},_h.GET_CONTEXT=function(e,t,n,r){n(r.task.context[t])},_h.SET_CONTEXT=function(e,t,n,r){var o=r.task;Id(o.context,t),n()},_h);function Ch(e,t){return e+"?"+t}function Th(e){var t=e.name,n=e.location;return n?t+" "+Ch(n.fileName,n.lineNumber):t}function Ph(e){var t,n,r=(t=e,(n=[]).concat.apply(n,t.map((function(e){return e.cancelledTasks}))));return r.length?["Tasks cancelled due to error:"].concat(r).join("\n"):""}var Nh=null,Ih=[],jh=function(e){e.crashedEffect=Nh,Ih.push(e)},Rh=function(){Nh=null,Ih.length=0},Ah=function(){var e=Ih[0],t=Ih.slice(1),n=e.crashedEffect?function(e){var t=Wd(e);return t?t.code+" "+Ch(t.fileName,t.lineNumber):""}(e.crashedEffect):null;return["The above error occurred in task "+Th(e.meta)+(n?" \n when executing effect "+n:"")].concat(t.map((function(e){return" created by "+Th(e.meta)})),[Ph(Ih)]).join("\n")};function Dh(e,t,n,r,o,a,i){var l;void 0===i&&(i=Pd);var u,s,c=0,f=null,p=[],d=Object.create(n),h=function(e,t,n){var r,o=[],a=!1;function i(e){p.push.apply(p,h.getTasks().map((function(e){return e.meta.name}))),u(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,u){a||(jd(o,t),t.cont=Pd,u?i(l):(t===e&&(r=l),o.length||(a=!0,n(r))))}}function u(){a||(a=!0,o.forEach((function(e){e.cont=Pd,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:u,abort:i,getTasks:function(){return o}}}(t,0,m);function m(t,n){if(n){if(c=2,jh({meta:o,cancelledTasks:p}),y.isRoot){var r=Ah();Rh(),e.onError(t,{sagaStack:r})}s=t,f&&f.reject(t)}else t===hd?c=1:1!==c&&(c=3),u=t,f&&f.resolve(t);y.cont(t,n),y.joiners.forEach((function(e){e.cb(t,n)})),y.joiners=null}var y=((l={})[dd]=!0,l.id=r,l.meta=o,l.isRoot=a,l.context=d,l.joiners=[],l.queue=h,l.cancel=function(){0===c&&(c=1,h.cancelAll(),m(hd,!1))},l.cont=i,l.end=m,l.setContext=function(e){Id(d,e)},l.toPromise=function(){return f||(f=rh(),2===c?f.reject(s):0!==c&&f.resolve(u)),f.promise},l.isRunning=function(){return 0===c},l.isCancelled=function(){return 1===c||0===c&&1===t.status},l.isAborted=function(){return 2===c},l.result=function(){return u},l.error=function(){return s},l);return y}function Mh(e,t,n,r,o,a,i){var l=e.finalizeRunEffect((function(t,n,r){_d(t)?Eh(t,r):Od(t)?Mh(e,t,s.context,n,o,!1,r):t&&t[ud]?(0,kh[t.type])(e,t.payload,r,c):r(t)}));f.cancel=Pd;var u={meta:o,cancel:function(){0===u.status&&(u.status=1,f(hd))},status:0},s=Dh(e,u,n,r,o,a,i),c={task:s,digestEffect:p};return i&&(i.cancel=s.cancel),f(),s;function f(e,n){try{var o;n?(o=t.throw(e),Rh()):Ud(e)?(u.status=1,f.cancel(),o=bd(t.return)?t.return(hd):{done:!0,value:hd}):o=zd(e)?bd(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==u.status&&(u.status=3),u.cont(o.value)):p(o.value,r,f)}catch(e){if(1===u.status)throw e;u.status=2,u.cont(e,!0)}}function p(t,n,r,o){void 0===o&&(o="");var a,i=Sh();function u(n,o){a||(a=!0,r.cancel=Pd,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(i,n):e.sagaMonitor.effectResolved(i,n)),o&&function(e){Nh=e}(t),r(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:i,parentEffectId:n,label:o,effect:t}),u.cancel=Pd,r.cancel=function(){a||(a=!0,u.cancel(),u.cancel=Pd,e.sagaMonitor&&e.sagaMonitor.effectCancelled(i))},l(t,i,u)}}function Lh(e,t){for(var n=e.channel,r=void 0===n?wh():n,o=e.dispatch,a=e.getState,i=e.context,l=void 0===i?{}:i,u=e.sagaMonitor,s=e.effectMiddlewares,c=e.onError,f=void 0===c?Md:c,p=arguments.length,d=new Array(p>2?p-2:0),h=2;h<p;h++)d[h-2]=arguments[h];var m,y=t.apply(void 0,d),g=Sh();if(u&&(u.rootSagaStarted=u.rootSagaStarted||Pd,u.effectTriggered=u.effectTriggered||Pd,u.effectResolved=u.effectResolved||Pd,u.effectRejected=u.effectRejected||Pd,u.effectCancelled=u.effectCancelled||Pd,u.actionDispatched=u.actionDispatched||Pd,u.rootSagaStarted({effectId:g,saga:t,args:d})),s){var v=M.apply(void 0,s);m=function(e){return function(t,n,r){return v((function(t){return e(t,n,r)}))(t)}}}else m=Nd;var b={channel:r,dispatch:Fd(o),getState:a,sagaMonitor:u,onError:f,finalizeRunEffect:m};return uh((function(){var e=Mh(b,y,l,g,Bd(t),!0,void 0);return u&&u.effectResolved(g,e),e}))}var Fh=function(e){var t,n=void 0===e?{}:e,r=n.context,o=void 0===r?{}:r,a=n.channel,i=void 0===a?wh():a,l=n.sagaMonitor,u=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(n,["context","channel","sagaMonitor"]);function s(e){var n=e.getState,r=e.dispatch;return t=Lh.bind(null,L({},u,{context:o,channel:i,dispatch:r,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return i.put(t),n}}}return s.run=function(){return t.apply(void 0,arguments)},s.setContext=function(e){Id(o,e)},s},zh=function(){return zh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},zh.apply(this,arguments)},Uh={rest_base:"",home_url:"",log_page_url:"",locale:null,localeSlug:null,data_consent_popup:{show_data_field:null,show_email_field:null}},Vh=function(){return Vh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vh.apply(this,arguments)},Hh={options:{}},Bh="HTTP_REQUEST_STARTED",Wh="HTTP_REQUEST_SUCCEED",Kh="HTTP_REQUEST_FAILED",qh=function(){return qh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qh.apply(this,arguments)},Yh={specified:[],unspecified:0},Gh=function(e){return e.requestedAction&&e.requestedAction.requestTypeName},$h=function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var o=t[r];"function"==typeof e[o]&&(n[o]=e[o])}var a,i=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:P.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:P.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+P.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var r=!1,o={},l=0;l<i.length;l++){var u=i[l],s=n[u],c=e[u],f=s(c,t);if(void 0===f){var p=j(u,t);throw new Error(p)}o[u]=f,r=r||f!==c}return(r=r||i.length!==Object.keys(e).length)?o:e}}({config:function(e,t){var n;void 0===e&&(e=Uh);var r=t.payload;return t.type===co?zh(zh({},e),((n={})[r.resourceName]=zh(zh({},e[r.resourceName]),r.item),n)):e},items:function(e,t){var n,r;void 0===e&&(e=Hh);var o=t.payload;switch(t.type){case io:return Vh(Vh({},e),((n={})[o.resourceName]=o.item,n));case uo:return Vh(Vh({},e),((r={})[o.resourceName]=Vh(Vh({},e[o.resourceName]),o.item),r));default:return e}},httpRequests:function(e,t){void 0===e&&(e=Yh);var n=t.payload;switch(t.type){case Bh:var r=Gh(n);return qh(qh({},e),r?{specified:e.specified.filter((function(e){return e!==r})).concat(r)}:{unspecified:e.unspecified+1});case Wh:case Kh:var o=Gh(n);return qh(qh({},e),o?{specified:e.specified.filter((function(e){return e!==o}))}:{unspecified:e.unspecified-1});default:return e}}}),Xh=$h,Qh=function(e){return{done:!0,value:e}},Jh={};function Zh(e){return xd(e)?"channel":kd(e)?String(e):bd(e)?e.name:String(e)}function em(e,t,n){var r,o,a,i=t;function l(t,n){if(i===Jh)return Qh(t);if(n&&!o)throw i=Jh,n;r&&r(t);var l=n?e[o](n):e[i]();return i=l.nextState,a=l.effect,r=l.stateUpdater,o=l.errorState,i===Jh?Qh(t):a}return Dd(l,(function(e){return l(null,e)}),n)}function tm(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];var a,i={done:!1,value:Qd(e)},l=function(e){return{done:!1,value:th.apply(void 0,[t].concat(r,[e]))}},u=function(e){return a=e};return em({q1:function(){return{nextState:"q2",effect:i,stateUpdater:u}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Zh(e)+", "+t.name+")")}function nm(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return th.apply(void 0,[tm,e,t].concat(r))}var rm=function(e){var t=e.status,n=e.message;this.message=n,this.status=t};function om(e){return t=this,n=void 0,o=function(){var t,n;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(r){switch(r.label){case 0:t=null,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.json()];case 2:return t=r.sent(),[3,4];case 3:throw n=r.sent(),console.error(n),new rm({status:555,message:"No JSON from WP api!"});case 4:return[2,t]}}))},new((r=void 0)||(r=Promise))((function(e,a){function i(e){try{u(o.next(e))}catch(e){a(e)}}function l(e){try{u(o.throw(e))}catch(e){a(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(i,l)}u((o=o.apply(t,n||[])).next())}));var t,n,r,o}function am(e){var t=e.endpoint,n=e.method,r=void 0===n?"GET":n,o=e.body,a=Tm.getState().config,i={method:r,headers:{Accept:"application/json","X-WP-Nonce":a.wp_nonce},body:JSON.stringify(o)};return"GET"!==r&&"DELETE"!==r||delete i.body,function(){return fetch(a.rest_base+"/sg-security/v1"+t,i).catch((function(e){throw console.error(e),Error("An error occurred. Please try again later")})).then(om).then((function(e){if(200===e.status)return e;throw new rm(e)}))}}function im(e){var t=e.endpoint,n=e.method,r=void 0===n?"GET":n,o=e.body,a=Tm.getState().config,i={method:r,headers:{Accept:"application/json","X-WP-Nonce":a.wp_nonce},body:JSON.stringify(o)};return"GET"!==r&&"DELETE"!==r||delete i.body,function(){return fetch(a.rest_base+"/siteground-settings/v1"+t,i).catch((function(e){throw console.error(e),Error("An error occurred. Please try again later")})).then(om).then((function(e){if(200===e.status)return e;throw new rm(e)}))}}var lm=function(e,t){return{type:Bh,payload:{requestedAction:e,response:t}}},um=function(e,t){return{type:Wh,payload:{requestedAction:e,response:t}}},sm=function(){return sm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},sm.apply(this,arguments)};function cm(e){return function(t){var n,r,o;return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(a){switch(a.label){case 0:return n=sm(sm({},t),{payload:sm(sm({},t.payload),{_meta:void 0})}),[4,Jd(lm(t))];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,5,,7]),[4,eh(e,n)];case 3:return r=a.sent(),[4,Jd(um(t,r))];case 4:return a.sent(),[3,7];case 5:return o=a.sent(),console.error("Failed request...",o),[4,Jd((i=t,l=o,{type:Kh,payload:{requestedAction:i,exception:l}}))];case 6:return a.sent(),[3,7];case 7:return[2]}var i,l}))}}var fm=function(){return fm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},fm.apply(this,arguments)},pm=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function dm(e){var t,n,r,o,a,i,l,u=e.payload;return pm(this,(function(e){switch(e.label){case 0:return t=u.body,n=u.endpoint,r=u.method,o=void 0===r?"POST":r,a=u.resourceName,[4,eh(am({endpoint:n,method:o,body:t}))];case 1:return i=e.sent(),[4,nh((function(e){return e.items[a]}))];case 2:return l=e.sent(),[4,Jd(Lo({resourceName:a,item:fm(fm({},i.data),{entries:l.entries.concat(i.data.entries)})}))];case 3:return e.sent(),[2,i]}}))}var hm=function(){return pm(this,(function(e){switch(e.label){case 0:return[4,nm(Hl,cm(dm))];case 1:return e.sent(),[2]}}))},mm=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function ym(e){var t,n,r,o,a,i,l=e.payload;return mm(this,(function(e){switch(e.label){case 0:return t=l.body,n=l.endpoint,r=l.method,o=void 0===r?"POST":r,a=l.resourceName,[4,eh(am({endpoint:n,method:o,body:t}))];case 1:return i=e.sent(),[4,Jd(Lo({resourceName:a,item:i.data}))];case 2:return e.sent(),[2,i]}}))}function gm(e){var t,n,r,o,a,i,l,u=e.payload;return mm(this,(function(e){switch(e.label){case 0:return t=u.body,n=u.endpoint,r=u.itemId,o=u.method,a=void 0===o?"POST":o,i=u.resourceName,[4,eh(am({endpoint:r?n+"/"+r:n,method:a,body:t}))];case 1:return l=e.sent(),[4,Jd(zo({resourceName:i,item:l.data}))];case 2:return e.sent(),[2,l]}}))}function vm(e){var t,n,r,o,a,i,l,u=e.payload;return mm(this,(function(e){switch(e.label){case 0:return t=u.body,n=u.endpoint,r=u.itemId,o=u.method,a=void 0===o?"PUT":o,i=u.resourceName,[4,eh(im({endpoint:r?n+"/"+r:n,method:a,body:t}))];case 1:return l=e.sent(),[4,Jd(Do({resourceName:i,item:{show_data_field:0,show_email_field:0}}))];case 2:return e.sent(),[2,l]}}))}var bm=function(){return mm(this,(function(e){switch(e.label){case 0:return[4,nm(ao,cm(ym))];case 1:return e.sent(),[4,nm(lo,cm(gm))];case 2:return e.sent(),[4,nm(so,cm(vm))];case 3:return e.sent(),[2]}}))},wm=function(e){var t={success:null,error:null};if(!e||!e._meta||!e._meta.notification)return t;var n=e._meta.notification;return n.success&&(t.success=n.success),n.error&&(t.error=n.error),t},Em=function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}};function _m(e){var t=e.exception,n=e.requestedAction,r=wm(n.payload).error,o=null==t?void 0:t.message,a=null==t?void 0:t.status;return r&&r.intlKey?Qt.error(r.intlKey):555===a?Qt.error(Ie("Either a security plugin, custom function, or rules in your .htaccess file is preventing the WordPress REST API from working properly. SiteGround Optimizer is using it to store its options and other functionalities so please make sure it works properly."),Ie("Could not connect to the WordPress REST API")):o?Qt.error(o):Qt.error(Ie("Either a security plugin, custom function or rules in your .htaccess file is preventing the WordPress REST API from working properly. SiteGround Security is using it to store its options and other functionalities so please make sure it works properly."),Ie("Could not connect to the WordPress REST API"))}function Om(e){var t,n,r=e.payload;return Em(this,(function(e){switch(e.label){case 0:return t=r.requestedAction,[4,eh(_m,{exception:n=r.exception,requestedAction:t})];case 1:return e.sent(),function(e,t){var n;null===(n=null==e?void 0:e.onFailure)||void 0===n||n.call(e,t)}(t,n),[2]}}))}function Sm(e){var t=e.payload,n=t.requestedAction,r=t.response,o=null==r?void 0:r.message,a=wm(n.payload).success;(null==a?void 0:a.intlKey)&&Qt.success(a.intlKey),o&&Qt.success(o),function(e,t){var n;t&&(null===(n=null==e?void 0:e.onComplete)||void 0===n||n.call(e,t.data))}(n,r)}function xm(){return Em(this,(function(e){switch(e.label){case 0:return[4,nm(Wh,Sm)];case 1:return e.sent(),[4,nm(Kh,Om)];case 2:return e.sent(),[2]}}))}var km;function Cm(){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!((o=(o=i.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}(this,(function(e){switch(e.label){case 0:return[4,(t=[hm(),bm(),xm()],n=Xd("ALL",t),n.combinator=!0,n)];case 1:return e.sent(),[2]}var t,n}))}var Tm,Pm=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||M;var Nm={init:function(e){var t,n,r=e.domElementId,o=e.page,a=e.config,i=r||function(){var e="sg-security-container";if(document.getElementById(e))return e;var t=document.createElement("div");return t.id=e,document.body.append(t),e}();t={config:a},n=Fh(),km=I(Xh,t,Pm(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return D({},n,{dispatch:r=M.apply(void 0,a)(n.dispatch)})}}}(n))),n.run(Cm),Tm=km,g.render(y.createElement(k,{store:Tm},y.createElement(od,{page:o})),document.getElementById(i))},PAGE:Re},Im=Nm}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.hmd=function(e){return(e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e};var r=n(2965);return r.default}()}));
core/Activator/Activator.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activator;
3
+
4
+ use SG_Security\Activity_Log\Activity_Log_Helper;
5
+ use SG_Security\Htaccess_Service\Directory_Service;
6
+ use SG_Security\Htaccess_Service\Xmlrpc_Service;
7
+ use SG_Security\Install_Service\Install_Service;
8
+
9
+ /**
10
+ * Class managing plugin activation.
11
+ */
12
+ class Activator {
13
+
14
+ /**
15
+ * Run on plugin activation.
16
+ *
17
+ * @since 1.0.0
18
+ */
19
+ public function activate( $network_active ) {
20
+ Activity_Log_Helper::create_log_tables();
21
+
22
+ // Create the necesary tables in subsites upon activation for multisite.
23
+ if (
24
+ \is_multisite() &&
25
+ true === $network_active
26
+ ) {
27
+ // Get all sites.
28
+ $sites = get_sites();
29
+
30
+ // Loop trough subsites and create the necesary db tables.
31
+ foreach ( $sites as $site ) {
32
+ switch_to_blog( $site->blog_id );
33
+
34
+ // Run the db creation.
35
+ Activity_Log_Helper::create_log_tables();
36
+ }
37
+
38
+ // Restore to current blog.
39
+ restore_current_blog();
40
+ }
41
+
42
+ // Check if system folder protection is enabled.
43
+ if ( 1 === intval( get_option( 'sg_security_lock_system_folders', 0 ) ) ) {
44
+ // Enable the existing rules on activation.
45
+ $directory_service = new Directory_Service();
46
+ $directory_service->toggle_rules( 1 );
47
+ }
48
+
49
+ // Check if we need to enable the xml-rpc.
50
+ if ( 1 === intval( get_option( 'sg_security_disable_xml_rpc', 0 ) ) ) {
51
+ $xml_rpc_service = new Xmlrpc_Service();
52
+
53
+ // Enable the rule.
54
+ $xml_rpc_service->toggle_rules( 1 );
55
+ }
56
+
57
+ $install_service = new Install_Service();
58
+ $install_service->install();
59
+ }
60
+ }
core/Activity_Log/Activity_Log.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ use SG_Security\Activity_Log\Activity_Log_Posts;
5
+ use SG_Security\Activity_Log\Activity_Log_Options;
6
+ use SG_Security\Activity_Log\Activity_Log_Attachments;
7
+ use SG_Security\Activity_Log\Activity_Log_Comments;
8
+ use SG_Security\Activity_Log\Activity_Log_Core;
9
+ use SG_Security\Activity_Log\Activity_Log_Menu;
10
+ use SG_Security\Activity_Log\Activity_Log_Export;
11
+ use SG_Security\Activity_Log\Activity_Log_Plugins;
12
+ use SG_Security\Activity_Log\Activity_Log_Themes;
13
+ use SG_Security\Activity_Log\Activity_Log_Users;
14
+ use SG_Security\Activity_Log\Activity_Log_Widgets;
15
+ use SG_Security\Activity_Log\Activity_Log_Unknown;
16
+ use SG_Security\Activity_Log\Activity_Log_Taxonomies;
17
+ use SG_Security\Activity_Log\Activity_Log_Weekly_Emails;
18
+ use SG_Security\Helper\Helper;
19
+ use SG_Security\Activity_Log\Activity_Log_Helper;
20
+ use SiteGround_Helper\Helper_Service;
21
+
22
+ /**
23
+ * Activity log main class
24
+ */
25
+ class Activity_Log {
26
+
27
+ /**
28
+ * The singleton instance.
29
+ *
30
+ * @since 1.0.0
31
+ *
32
+ * @var \Activity_Log The singleton instance.
33
+ */
34
+ private static $instance;
35
+
36
+ /**
37
+ * Our custom log table name
38
+ *
39
+ * @var string
40
+ */
41
+ public $log_table = 'sgs_log_events';
42
+
43
+ /**
44
+ * Our custom log visitors tabl
45
+ *
46
+ * @var string
47
+ */
48
+ public $visitors_table = 'sgs_log_visitors';
49
+
50
+ /**
51
+ * Set logs to exspire after specific time. Default 12 days.
52
+ *
53
+ * @since 1.0.0
54
+ *
55
+ * @var int The expire time.
56
+ */
57
+ const LOG_LIFETIME = 12;
58
+
59
+
60
+ /**
61
+ * Child classes that have to be initialized.
62
+ *
63
+ * @var array
64
+ *
65
+ * @since 1.0.0
66
+ */
67
+ public static $children = array(
68
+ 'posts',
69
+ 'options',
70
+ 'attachments',
71
+ 'comments',
72
+ 'core',
73
+ 'export',
74
+ 'plugins',
75
+ 'themes',
76
+ 'users',
77
+ 'widgets',
78
+ 'unknown',
79
+ 'taxonomies',
80
+ 'weekly_emails',
81
+ );
82
+
83
+ /**
84
+ * The constructor.
85
+ */
86
+ public function __construct() {
87
+ self::$instance = $this;
88
+ $this->run();
89
+
90
+ global $wpdb;
91
+
92
+ $wpdb->sgs_log = $wpdb->prefix . $this->log_table;
93
+ $wpdb->sgs_visitors = $wpdb->prefix . $this->visitors_table;
94
+ }
95
+
96
+ /**
97
+ * Get the singleton instance.
98
+ *
99
+ * @since 1.0.0
100
+ *
101
+ * @return \Minifier The singleton instance.
102
+ */
103
+ public static function get_instance() {
104
+ if ( null == self::$instance ) {
105
+ static::$instance = new self();
106
+ }
107
+ return self::$instance;
108
+ }
109
+
110
+ /**
111
+ * Init the sub loggers
112
+ *
113
+ * @since 1.0.0
114
+ */
115
+ public function run() {
116
+ foreach ( self::$children as $child ) {
117
+ $this->factory( $child );
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Create a new log of type $type
123
+ *
124
+ * @since 1.0.0
125
+ *
126
+ * @param string $type The type of the log class.
127
+ *
128
+ * @throws \Exception if the type is not supported.
129
+ */
130
+ private function factory( $type ) {
131
+
132
+ $class = __NAMESPACE__ . '\\Activity_Log_' . str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $type ) ) );
133
+
134
+ if ( ! class_exists( $class ) ) {
135
+ throw new \Exception( 'Unknown activity log type "' . $type . '".' );
136
+ }
137
+
138
+ $this->$type = new $class();
139
+ }
140
+
141
+
142
+ /**
143
+ * Set the cron job for deleting old logs.
144
+ *
145
+ * @since 1.0.0
146
+ */
147
+ public function set_sgs_logs_cron() {
148
+ // Bail if cron is disabled.
149
+ if ( 1 === Helper_Service::is_cron_disabled() ) {
150
+ return;
151
+ }
152
+
153
+ if ( ! wp_next_scheduled( 'siteground_security_clear_logs_cron' ) ) {
154
+ wp_schedule_event( time(), 'daily', 'siteground_security_clear_logs_cron' );
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Delete logs on plugin page if cron is disabled.
160
+ *
161
+ * @since 1.0.0
162
+ */
163
+ public function delete_logs_on_admin_page() {
164
+ // Delete if we are on plugin page and cron is disabled.
165
+ if (
166
+ isset( $_GET['page'] ) &&
167
+ 'sg-security' === $_GET['page'] &&
168
+ 1 === Helper_Service::is_cron_disabled()
169
+ ) {
170
+ $this->delete_old_activity_logs();
171
+ }
172
+ }
173
+
174
+ /**
175
+ * Delete the old log records from the database.
176
+ *
177
+ * @since 1.0.0
178
+ */
179
+ public function delete_old_activity_logs() {
180
+ global $wpdb;
181
+
182
+ // Bail if table doesn't exist.
183
+ if ( ! Helper::table_exists( $wpdb->sgs_log ) ) {
184
+ return false;
185
+ }
186
+
187
+ // Set custom log lifetime interval in days. The intval covers the cases for string, array and sql injections.
188
+ $log_lifetime = intval( apply_filters( 'sgs_set_activity_log_lifetime', self::LOG_LIFETIME ) );
189
+
190
+ // If the custom value is less than 1 day or more than 12, fallback to the default lifetime.
191
+ if ( ( 1 > $log_lifetime ) || ( $log_lifetime > 12 ) ) {
192
+ $log_lifetime = self::LOG_LIFETIME;
193
+ }
194
+
195
+ $wpdb->query(
196
+ $wpdb->prepare(
197
+ 'DELETE FROM `' . $wpdb->sgs_log . '`
198
+ WHERE `ts` < %s
199
+ ;',
200
+ time() - $log_lifetime * DAY_IN_SECONDS
201
+ )
202
+ );
203
+ }
204
+
205
+ /**
206
+ * Create log tables upon new site creation.
207
+ *
208
+ * @since 1.2.0
209
+ *
210
+ * @param WP_Site $new_site New site object.
211
+ */
212
+ public function create_subsite_log_tables( $new_site ) {
213
+ // Check if the method exists.
214
+ if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
215
+ require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
216
+ }
217
+
218
+ if ( ! \is_plugin_active_for_network( 'sg-security/sg-security.php' ) ) {
219
+ return;
220
+ }
221
+
222
+ // Switch to the newly created blog.
223
+ switch_to_blog( $new_site->blog_id );
224
+
225
+ // Add the new tables.
226
+ Activity_Log_Helper::create_log_tables();
227
+
228
+ // Restore to the current blog.
229
+ restore_current_blog();
230
+ }
231
+ }
core/Activity_Log/Activity_Log_Attachments.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Attachments main class
6
+ */
7
+ class Activity_Log_Attachments extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Log add attachment event.
11
+ *
12
+ * @param int $id The attachment ID.
13
+ *
14
+ * @since 1.0.0
15
+ */
16
+ public function log_add_attachment( $id ) {
17
+ $activity = __( 'Added attachment', 'sg-security' );
18
+ $this->log_event( array(
19
+ 'activity' => $activity,
20
+ 'description' => $this->get_attachment_activity_description( $id, $activity ),
21
+ 'object_id' => $id,
22
+ 'type' => 'attachment',
23
+ 'action' => 'add',
24
+ ) );
25
+ }
26
+
27
+ /**
28
+ * Log edit attachment event.
29
+ *
30
+ * @param int $id The attachment ID.
31
+ *
32
+ * @since 1.0.0
33
+ */
34
+ public function log_edit_attachment( $id ) {
35
+ $activity = __( 'Edited attachment', 'sg-security' );
36
+ $this->log_event( array(
37
+ 'activity' => $activity,
38
+ 'description' => $this->get_attachment_activity_description( $id, $activity ),
39
+ 'object_id' => $id,
40
+ 'type' => 'attachment',
41
+ 'action' => 'edit',
42
+ ) );
43
+ }
44
+
45
+ /**
46
+ * Log delete attachment event.
47
+ *
48
+ * @param int $id The attachment ID.
49
+ *
50
+ * @since 1.0.0
51
+ */
52
+ public function log_delete_attachment( $id ) {
53
+ $activity = __( 'Deleted attachment', 'sg-security' );
54
+ $this->log_event( array(
55
+ 'activity' => $activity,
56
+ 'description' => $this->get_attachment_activity_description( $id, $activity ),
57
+ 'object_id' => $id,
58
+ 'type' => 'attachment',
59
+ 'action' => 'delete',
60
+ ) );
61
+ }
62
+
63
+
64
+ /**
65
+ * Get the activity description for posts.
66
+ *
67
+ * @since 1.0.0
68
+ *
69
+ * @param int $id Post ID.
70
+ * @param string $activity The activity.
71
+ *
72
+ * @return string The description.
73
+ */
74
+ public function get_attachment_activity_description( $id, $activity ) {
75
+ if ( empty( $id ) ) {
76
+ return __( 'Unknown', 'sg-security' );
77
+ }
78
+
79
+ $post = get_post( $id );
80
+
81
+ if ( empty( $post ) ) {
82
+ return __( 'Unknown', 'sg-security' );
83
+ }
84
+
85
+ return $activity . ' - ' . $post->post_title;
86
+ }
87
+ }
core/Activity_Log/Activity_Log_Comments.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Comments main class
6
+ */
7
+ class Activity_Log_Comments extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Log comment insert.
11
+ *
12
+ * @since 1.0.0
13
+ *
14
+ * @param int $id The comment ID.
15
+ */
16
+ public function log_comment_insert( $id ) {
17
+ $visitor_type = ( true === is_user_logged_in() ) ? 'user' : 'Human';
18
+
19
+ $activity = __( 'New comment', 'sg-security' );
20
+ $this->log_event( array(
21
+ 'activity' => $activity,
22
+ 'description' => $this->get_comment_description( $id, $activity ),
23
+ 'object_id' => $id,
24
+ 'type' => 'comment',
25
+ 'action' => 'insert',
26
+ 'visitor_type' => $visitor_type,
27
+ ) );
28
+ }
29
+
30
+ /**
31
+ * Log comment edit.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param int $id The comment ID.
36
+ */
37
+ public function log_comment_edit( $id ) {
38
+ $activity = __( 'Edited comment', 'sg-security' );
39
+ $this->log_event( array(
40
+ 'activity' => $activity,
41
+ 'description' => $this->get_comment_description( $id, $activity ),
42
+ 'object_id' => $id,
43
+ 'type' => 'comment',
44
+ 'action' => 'edit',
45
+ ) );
46
+ }
47
+
48
+ /**
49
+ * Log comment trash.
50
+ *
51
+ * @since 1.0.0
52
+ *
53
+ * @param int $id The comment ID.
54
+ */
55
+ public function log_comment_trash( $id ) {
56
+ $activity = __( 'Trashed comment', 'sg-security' );
57
+ $this->log_event( array(
58
+ 'activity' => $activity,
59
+ 'description' => $this->get_comment_description( $id, $activity ),
60
+ 'object_id' => $id,
61
+ 'type' => 'comment',
62
+ 'action' => 'trash',
63
+ ) );
64
+ }
65
+
66
+ /**
67
+ * Log comment untrash.
68
+ *
69
+ * @since 1.0.0
70
+ *
71
+ * @param int $id The comment ID.
72
+ */
73
+ public function log_comment_untrash( $id ) {
74
+ $activity = __( 'Untrashed comment', 'sg-security' );
75
+ $this->log_event( array(
76
+ 'activity' => $activity,
77
+ 'description' => $this->get_comment_description( $id, $activity ),
78
+ 'object_id' => $id,
79
+ 'type' => 'comment',
80
+ 'action' => 'untrash',
81
+ ) );
82
+ }
83
+
84
+ /**
85
+ * Log comment spam.
86
+ *
87
+ * @since 1.0.0
88
+ *
89
+ * @param int $id The comment ID.
90
+ */
91
+ public function log_comment_spam( $id ) {
92
+ $activity = __( 'Spammed comment', 'sg-security' );
93
+ $this->log_event( array(
94
+ 'activity' => $activity,
95
+ 'description' => $this->get_comment_description( $id, $activity ),
96
+ 'object_id' => $id,
97
+ 'type' => 'comment',
98
+ 'action' => 'spam',
99
+ ) );
100
+ }
101
+
102
+ /**
103
+ * Log comment unspam.
104
+ *
105
+ * @since 1.0.0
106
+ *
107
+ * @param int $id The comment ID.
108
+ */
109
+ public function log_comment_unspam( $id ) {
110
+ $activity = __( 'Unspamed comment', 'sg-security' );
111
+ $this->log_event( array(
112
+ 'activity' => $activity,
113
+ 'description' => $this->get_comment_description( $id, $activity ),
114
+ 'object_id' => $id,
115
+ 'type' => 'comment',
116
+ 'action' => 'unspam',
117
+ ) );
118
+ }
119
+
120
+ /**
121
+ * Log comment delete.
122
+ *
123
+ * @since 1.0.0
124
+ *
125
+ * @param int $id The comment ID.
126
+ */
127
+ public function log_comment_delete( $id ) {
128
+ $activity = __( 'Deleted comment', 'sg-security' );
129
+ $this->log_event( array(
130
+ 'activity' => $activity,
131
+ 'description' => $this->get_comment_description( $id, $activity ),
132
+ 'object_id' => $id,
133
+ 'type' => 'comment',
134
+ 'action' => 'delete',
135
+ ) );
136
+ }
137
+
138
+ /**
139
+ * Log comment status transition.
140
+ *
141
+ * @since 1.0.0
142
+ *
143
+ * @param string $new_status The new comment status.
144
+ * @param string $old_status The old comment status.
145
+ * @param object $comment Comment object.
146
+ */
147
+ public function log_comment_status_transition( $new_status, $old_status, $comment ) {
148
+ if ( ! in_array( $new_status, array( 'unapproved', 'approved' ) ) ) {
149
+ return;
150
+ }
151
+
152
+ $activity = ucwords( $new_status ) . __( ' comment', 'sg-security' );
153
+ $this->log_event( array(
154
+ 'activity' => $activity,
155
+ 'description' => $this->get_comment_description( $comment->comment_ID, $activity ),
156
+ 'object_id' => $comment->comment_ID,
157
+ 'type' => 'comment',
158
+ 'action' => 'transition',
159
+ ) );
160
+ }
161
+
162
+ /**
163
+ * Get comment description
164
+ *
165
+ * @since 1.0.0
166
+ *
167
+ * @param int $id Comment ID.
168
+ * @param string $activity The activity type.
169
+ *
170
+ * @return string Comment log description.
171
+ */
172
+ public function get_comment_description( $id, $activity ) {
173
+ $comment = get_comment( $id, ARRAY_A );
174
+
175
+ return $activity . ' ' . 'posted by ' . $comment['comment_author'] . ' on ' . get_the_title( $comment['comment_post_ID'] );
176
+ }
177
+ }
core/Activity_Log/Activity_Log_Core.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Core main class
6
+ */
7
+ class Activity_Log_Core extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Log update core.
11
+ *
12
+ * @since 1.0.0
13
+ */
14
+ public function log_core_update() {
15
+ $this->log_event( array(
16
+ 'activity' => __( 'Updated Core', 'sg-security' ),
17
+ 'description' => __( 'Updated Core', 'sg-security' ),
18
+ 'object_id' => 0,
19
+ 'type' => 'core',
20
+ 'action' => 'update',
21
+ ) );
22
+ }
23
+ }
core/Activity_Log/Activity_Log_Export.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Export main class
6
+ */
7
+ class Activity_Log_Export extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Log update core.
11
+ *
12
+ * @since 1.0.0
13
+ */
14
+ public function log_export() {
15
+ $this->log_event( array(
16
+ 'activity' => __( 'Exported WordPress', 'sg-security' ),
17
+ 'description' => __( 'Exported WordPress', 'sg-security' ),
18
+ 'object_id' => 0,
19
+ 'type' => 'wp',
20
+ 'action' => 'export',
21
+ ) );
22
+ }
23
+ }
core/Activity_Log/Activity_Log_Helper.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ use SG_Security\Helper\Helper;
5
+
6
+ /**
7
+ * Activity log main class
8
+ */
9
+ class Activity_Log_Helper {
10
+
11
+ /**
12
+ * Log an event from registered user.
13
+ *
14
+ * @since 1.0.0
15
+ *
16
+ * @param array $args Array of the event details.
17
+ */
18
+ public function log_event( $args ) {
19
+ // Include the template.php if the function doesn't exists.
20
+ if ( ! function_exists( 'wp_get_current_user' ) ) {
21
+ require_once ABSPATH . '/wp-includes/pluggable.php';
22
+ }
23
+
24
+ // Get the current user.
25
+ $user = \wp_get_current_user();
26
+
27
+ // Prepare the user id.
28
+ $user_id = ! empty( $user->ID ) ? $user->ID : 0;
29
+
30
+ if ( ! empty( $args['user_id'] ) ) {
31
+ $user_id = $args['user_id'];
32
+ }
33
+
34
+ $ip = Helper::get_current_user_ip();
35
+
36
+ // Merge the event args with the args for each event.
37
+ $args = array_merge(
38
+ array(
39
+ 'ts' => time(), // Current timestamp.
40
+ 'ip' => $ip, // The user IP address.
41
+ 'code' => 200, // The user ID.
42
+ 'visitor_id' => $this->get_visitor_by_user_id( $user_id ), // The user ID.
43
+ 'visitor_type' => 'user', // The visitor type.
44
+ 'hostname' => filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ? $ip : gethostbyaddr( $ip ),
45
+ ),
46
+ $args
47
+ );
48
+
49
+ // Check if it's a wpcli.
50
+ if ( defined( 'WP_CLI' ) ) {
51
+ $args['object_id'] = 'wpcli';
52
+ }
53
+
54
+ // Check for system actions.
55
+ if ( $ip === get_option( 'sg_security_server_address', '' ) ) {
56
+ $args['object_id'] = 'system';
57
+ }
58
+
59
+ $this->insert( $args );
60
+ }
61
+
62
+ /**
63
+ * Create the log table.
64
+ *
65
+ * @since 1.0.0
66
+ */
67
+ public static function create_log_tables() {
68
+ global $wpdb;
69
+ $events_sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sgs_log_events` (
70
+ `id` int(11) NOT NULL AUTO_INCREMENT,
71
+ `visitor_id` int(11) NOT NULL,
72
+ `ts` int(11) NOT NULL DEFAULT '0',
73
+ `activity` varchar(255) NOT NULL,
74
+ `description` varchar(255) NOT NULL,
75
+ `ip` varchar(55) NOT NULL DEFAULT '127.0.0.1',
76
+ `hostname` varchar(255) DEFAULT '0',
77
+ `code` varchar(255) NOT NULL DEFAULT '',
78
+ `object_id` varchar(255) NOT NULL,
79
+ `type` varchar(255) NOT NULL,
80
+ `action` varchar(255) NOT NULL,
81
+ `visitor_type` varchar(255) NOT NULL,
82
+ PRIMARY KEY (`id`)
83
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
84
+
85
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
86
+ dbDelta( $events_sql );
87
+
88
+ $visitors_sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sgs_log_visitors` (
89
+ `id` int(11) NOT NULL AUTO_INCREMENT,
90
+ `ip` varchar(55) NOT NULL DEFAULT '127.0.0.1',
91
+ `user_id` int(11) NOT NULL DEFAULT 0,
92
+ `block` int(11) NOT NULL DEFAULT 0,
93
+ `blocked_on` int(11) NOT NULL DEFAULT 0,
94
+ PRIMARY KEY (`id`)
95
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
96
+ dbDelta( $visitors_sql );
97
+ }
98
+
99
+ /**
100
+ * Check if the activity already exists in the database to avoid duplicates.
101
+ *
102
+ * @since 1.0.0
103
+ *
104
+ * @param array $args Array of event args.
105
+ *
106
+ * @return bool True if the entry alredy exists, false otherwise.
107
+ */
108
+ public function check_for_duplicates( $args ) {
109
+ global $wpdb;
110
+
111
+ // Bail if table doesn't exist.
112
+ if ( ! Helper::table_exists( $wpdb->sgs_visitors ) ) {
113
+ return false;
114
+ }
115
+
116
+ $has_duplicate = $wpdb->get_row( // phpcs:ignore
117
+ $wpdb->prepare(
118
+ 'SELECT `id` FROM `' . $wpdb->sgs_log . '`
119
+ WHERE `visitor_id` = %s
120
+ AND `ts` = %s
121
+ AND `activity` = %s
122
+ AND `description` = %s
123
+ AND `ip` = %s
124
+ AND `hostname` = %s
125
+ AND `code` = %s
126
+ AND `object_id` = %s
127
+ AND `type` = %s
128
+ AND `action` = %s
129
+ AND `visitor_type` = %s
130
+ ;',
131
+ $args['visitor_id'],
132
+ $args['ts'],
133
+ $args['activity'],
134
+ $args['description'],
135
+ $args['ip'],
136
+ $args['hostname'],
137
+ $args['code'],
138
+ $args['object_id'],
139
+ $args['type'],
140
+ $args['action'],
141
+ $args['visitor_type']
142
+ )
143
+ );
144
+
145
+ if ( $has_duplicate ) {
146
+ return true;
147
+ }
148
+
149
+ return false;
150
+ }
151
+
152
+ /**
153
+ * Insert a log in the database.
154
+ *
155
+ * @since 1.0.0
156
+ *
157
+ * @param array $args The data to insert.
158
+ */
159
+ public function insert( $args ) {
160
+ global $wpdb;
161
+
162
+ if ( $this->check_for_duplicates( $args ) ) {
163
+ return;
164
+ }
165
+
166
+ $wpdb->insert(
167
+ $wpdb->sgs_log,
168
+ array(
169
+ 'visitor_id' => $args['visitor_id'],
170
+ 'ts' => $args['ts'],
171
+ 'activity' => $args['activity'],
172
+ 'description' => $args['description'],
173
+ 'ip' => $args['ip'],
174
+ 'hostname' => $args['hostname'],
175
+ 'code' => $args['code'],
176
+ 'object_id' => $args['object_id'],
177
+ 'type' => $args['type'],
178
+ 'action' => $args['action'],
179
+ 'visitor_type' => $args['visitor_type'],
180
+ ),
181
+ array( '%d', '%d', '%s', '%s', '%s', '%s', '%d', '%s', '%s', '%s', '%s' )
182
+ );
183
+ }
184
+
185
+ /**
186
+ * Get the user id from the visitors table.
187
+ *
188
+ * @since 1.0.0
189
+ *
190
+ * @param int $user_id The user ID.
191
+ *
192
+ * @return int The ID from the visitors table.
193
+ */
194
+ public function get_visitor_by_user_id( $user_id ) {
195
+ global $wpdb;
196
+
197
+ // Check if there is already a record as a visitor for this user.
198
+ $maybe_id = $wpdb->get_row( // phpcs:ignore.
199
+ $wpdb->prepare(
200
+ 'SELECT `ID` FROM `' . $wpdb->sgs_visitors . '`
201
+ WHERE `user_id` = %s
202
+ ;',
203
+ $user_id
204
+ )
205
+ );
206
+
207
+ // If there is such record, return the visitor ID.
208
+ if ( ! is_null( $maybe_id ) ) {
209
+ return $maybe_id->ID;
210
+ }
211
+
212
+ // Create a new record for the user as a visitor.
213
+ $wpdb->insert(
214
+ $wpdb->sgs_visitors,
215
+ array(
216
+ 'user_id' => $user_id,
217
+ 'ip' => Helper::get_current_user_ip(),
218
+ ),
219
+ array( '%s', '%s' )
220
+ );
221
+
222
+ // Get the user visitor ID.
223
+ $id = $wpdb->get_row( // phpcs:ignore.
224
+ $wpdb->prepare(
225
+ 'SELECT `ID` FROM `' . $wpdb->sgs_visitors . '`
226
+ WHERE `user_id` = %s
227
+ ;',
228
+ $user_id
229
+ )
230
+ );
231
+
232
+ // Return the ID.
233
+ return $id->ID;
234
+ }
235
+
236
+ /**
237
+ * Get the visitor unique ID by Ip address.
238
+ *
239
+ * @since 1.0.0
240
+ *
241
+ * @param string $ip The visitor IP.
242
+ *
243
+ * @return int The ID from the visitors table.
244
+ */
245
+ public function get_visitor_by_ip( $ip ) {
246
+ global $wpdb;
247
+ $maybe_id = $wpdb->get_row( // phpcs:ignore
248
+ $wpdb->prepare(
249
+ 'SELECT `ID` FROM `' . $wpdb->sgs_visitors . '`
250
+ WHERE `ip` = %s
251
+ AND `user_id` = 0
252
+ ;',
253
+ $ip
254
+ )
255
+ );
256
+
257
+ if ( ! is_null( $maybe_id ) ) {
258
+ return $maybe_id->ID;
259
+ }
260
+
261
+ // Insert the visitors ip in the db.
262
+ $wpdb->insert(
263
+ $wpdb->sgs_visitors,
264
+ array(
265
+ 'ip' => $ip,
266
+ ),
267
+ array( '%s' )
268
+ );
269
+
270
+ // Get the visitor id from visitors table.
271
+ $id = $wpdb->get_row( // phpcs:ignore.
272
+ $wpdb->prepare(
273
+ 'SELECT `ID` FROM `' . $wpdb->sgs_visitors . '`
274
+ WHERE `ip` = %s
275
+ ;',
276
+ $ip
277
+ )
278
+ );
279
+
280
+ return $id->ID;
281
+ }
282
+
283
+ }
core/Activity_Log/Activity_Log_Options.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Options main class
6
+ */
7
+ class Activity_Log_Options extends Activity_Log_Helper {
8
+ /**
9
+ * Log option update
10
+ *
11
+ * @param string $option The option name.
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ public function log_option_update( $option ) {
16
+
17
+ // We don't want to log all option updates, but only the main WordPress optins.
18
+ // Please refer to https://codex.wordpress.org/Option_Reference.
19
+ $log_options = array(
20
+ 'comment_max_links',
21
+ 'comment_moderation',
22
+ 'comments_notify',
23
+ 'default_comment_status',
24
+ 'default_ping_status',
25
+ 'default_pingback_flag',
26
+ 'moderation_keys',
27
+ 'moderation_notify',
28
+ 'require_name_email',
29
+ 'thread_comments',
30
+ 'thread_comments_depth',
31
+ 'show_avatars',
32
+ 'avatar_rating',
33
+ 'avatar_default',
34
+ 'close_comments_for_old_posts',
35
+ 'close_comments_days_old',
36
+ 'page_comments',
37
+ 'comments_per_page',
38
+ 'default_comments_page',
39
+ 'comment_order',
40
+ 'comment_whitelist',
41
+ 'admin_email',
42
+ 'blogdescription',
43
+ 'blogname',
44
+ 'comment_registration',
45
+ 'date_format',
46
+ 'default_role',
47
+ 'gmt_offset',
48
+ 'home',
49
+ 'siteurl',
50
+ 'start_of_week',
51
+ 'time_format',
52
+ 'timezone_string',
53
+ 'users_can_register',
54
+ 'links_updated_date_format',
55
+ 'links_recently_updated_prepend',
56
+ 'links_recently_updated_append',
57
+ 'links_recently_updated_time',
58
+ 'thumbnail_size_w',
59
+ 'thumbnail_size_h',
60
+ 'thumbnail_crop',
61
+ 'medium_size_w',
62
+ 'medium_size_h',
63
+ 'large_size_w',
64
+ 'large_size_h',
65
+ 'embed_autourls',
66
+ 'embed_size_w',
67
+ 'embed_size_h',
68
+ 'hack_file',
69
+ 'html_type',
70
+ 'secret',
71
+ 'upload_path',
72
+ 'upload_url_path',
73
+ 'uploads_use_yearmonth_folders',
74
+ 'use_linksupdate',
75
+ 'permalink_structure',
76
+ 'category_base',
77
+ 'tag_base',
78
+ 'blog_public',
79
+ 'blog_charset',
80
+ 'gzipcompression',
81
+ 'page_on_front',
82
+ 'page_for_posts',
83
+ 'posts_per_page',
84
+ 'posts_per_rss',
85
+ 'rss_language',
86
+ 'rss_use_excerpt',
87
+ 'show_on_front',
88
+ 'template',
89
+ 'stylesheet',
90
+ 'default_category',
91
+ 'default_email_category',
92
+ 'default_link_category',
93
+ 'default_post_edit_rows',
94
+ 'mailserver_login',
95
+ 'mailserver_pass',
96
+ 'mailserver_port',
97
+ 'mailserver_url',
98
+ 'ping_sites',
99
+ 'use_balanceTags',
100
+ 'use_smilies',
101
+ 'use_trackback',
102
+ 'enable_app',
103
+ 'enable_xmlrpc',
104
+ // 'active_plugins',
105
+ 'advanced_edit',
106
+ 'recently_edited',
107
+ 'image_default_link_type',
108
+ 'image_default_size',
109
+ 'image_default_align',
110
+ 'sidebars_widgets',
111
+ 'sticky_posts',
112
+ 'widget_categories',
113
+ 'widget_text',
114
+ 'widget_rss',
115
+ );
116
+
117
+ // Add a hook, so the users can modify the options list.
118
+ $log_options = apply_filters( 'sg_security_log_options', $log_options );
119
+
120
+ // Bail if the option is not in the list.
121
+ if ( ! in_array( $option, $log_options ) ) {
122
+ return;
123
+ }
124
+
125
+ $this->log_event( array(
126
+ 'activity' => __( 'Updated Option', 'sg-security' ),
127
+ 'description' => __( 'Updated Option', 'sg-security' ) . ' - ' . $option,
128
+ 'object_id' => $option,
129
+ 'type' => 'option',
130
+ 'action' => 'update',
131
+ ) );
132
+ }
133
+ }
core/Activity_Log/Activity_Log_Plugins.php ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Plugins main class
6
+ */
7
+ class Activity_Log_Plugins extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Log plugin activate.
11
+ *
12
+ * @since 1.0.0
13
+ *
14
+ * @param string $plugin Path to the plugin file relative to the plugins directory.
15
+ */
16
+ public function log_plugin_activate( $plugin ) {
17
+ $activity = __( 'Activated Plugin', 'sg-security' );
18
+ $this->log_event( array(
19
+ 'activity' => $activity,
20
+ 'description' => $this->get_plugin_log_description( $this->get_plugin_name( $plugin ), $activity ),
21
+ 'object_id' => 0,
22
+ 'type' => 'plugin',
23
+ 'action' => 'activate',
24
+ ) );
25
+ }
26
+
27
+ /**
28
+ * Log plugin deactivate.
29
+ *
30
+ * @since 1.0.0
31
+ *
32
+ * @param string $plugin Path to the plugin file relative to the plugins directory.
33
+ */
34
+ public function log_plugin_deactivate( $plugin ) {
35
+ $activity = __( 'Deactivated Plugin', 'sg-security' );
36
+ $this->log_event( array(
37
+ 'activity' => $activity,
38
+ 'description' => $this->get_plugin_log_description( $this->get_plugin_name( $plugin ), $activity ),
39
+ 'object_id' => 0,
40
+ 'type' => 'plugin',
41
+ 'action' => 'deactivate',
42
+ ) );
43
+ }
44
+
45
+ /**
46
+ * Log plugin file edit.
47
+ *
48
+ * @since 1.0.0
49
+ *
50
+ * @param array $old_value Array of last edited files.
51
+ * @param array $new_value Array of last edited files including the last file.
52
+ */
53
+ public function log_plugin_edit( $old_value, $new_value ) {
54
+ // Bail if the updated file is not a plugin file.
55
+ if ( false === strpos( $new_value[0], WP_PLUGIN_DIR ) ) {
56
+ return;
57
+ }
58
+
59
+ $activity = __( 'Edited Plugin', 'sg-security' );
60
+ $this->log_event( array(
61
+ 'activity' => $activity,
62
+ 'description' => $this->get_plugin_log_description( $this->get_plugin_name( $new_value[0] ), $activity ),
63
+ 'object_id' => 0,
64
+ 'type' => 'plugin',
65
+ 'action' => 'edit',
66
+ ) );
67
+ }
68
+
69
+ /**
70
+ * Log plugin install
71
+ *
72
+ * @since 1.0.0
73
+ *
74
+ * @param obejct $upgrader WP_Upgrader object.
75
+ * @param array $options Array of extra options.
76
+ */
77
+ public function log_plugin_install( $upgrader, $options ) {
78
+ // Bail if the type of the installtion is not a plugin.
79
+ if (
80
+ ! isset( $options['type'] ) ||
81
+ 'plugin' !== $options['type']
82
+ ) {
83
+ return;
84
+ }
85
+
86
+ // Bail if the action is not an install.
87
+ if ( 'install' !== $options['action'] ) {
88
+ return;
89
+ }
90
+
91
+ $activity = __( 'Installed Plugin', 'sg-security' );
92
+ $this->log_event( array(
93
+ 'activity' => $activity,
94
+ 'description' => $this->get_plugin_log_description( $upgrader->new_plugin_data['Name'], $activity ),
95
+ 'object_id' => 0,
96
+ 'type' => 'plugin',
97
+ 'action' => 'install',
98
+ ) );
99
+ }
100
+
101
+ /**
102
+ * Log plugin update
103
+ *
104
+ * @since 1.0.0
105
+ *
106
+ * @param obejct $upgrader WP_Upgrader object.
107
+ * @param array $options Array of extra options.
108
+ */
109
+ public function log_plugin_update( $upgrader, $options ) {
110
+ // Bail if the type of the update is not a plugin.
111
+ if (
112
+ ! isset( $options['type'] ) ||
113
+ 'plugin' !== $options['type']
114
+ ) {
115
+ return;
116
+ }
117
+
118
+ // Bail if the action is not an update.
119
+ if ( 'update' !== $options['action'] ) {
120
+ return;
121
+ }
122
+
123
+ $activity = __( 'Updated Plugin', 'sg-security' );
124
+
125
+ if ( ! empty( $options['plugin'] ) ) {
126
+ $this->log_event( array(
127
+ 'activity' => $activity,
128
+ 'description' => $this->get_plugin_log_description( $this->get_plugin_name( $options['plugin'] ), $activity ),
129
+ 'object_id' => 0,
130
+ 'type' => 'plugin',
131
+ 'action' => 'update',
132
+ ) );
133
+
134
+ return;
135
+ }
136
+
137
+ foreach ( $options['plugins'] as $path ) {
138
+ $this->log_event( array(
139
+ 'activity' => $activity,
140
+ 'description' => $this->get_plugin_log_description( $this->get_plugin_name( $path ), $activity ),
141
+ 'object_id' => 0,
142
+ 'type' => 'plugin',
143
+ 'action' => 'update',
144
+ ) );
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Get the plugin name from the plugin path.
150
+ *
151
+ * @since 1.0.0
152
+ *
153
+ * @param string $plugin The plugin path.
154
+ *
155
+ * @return string The plugin name.
156
+ */
157
+ public function get_plugin_name( $plugin ) {
158
+ // Add the plugin path.
159
+ if ( false === strpos( $plugin, WP_PLUGIN_DIR ) ) {
160
+ $plugin = WP_PLUGIN_DIR . '/' . $plugin;
161
+ }
162
+
163
+ $plugin_data = \get_plugin_data( $plugin );
164
+
165
+ return $plugin_data['Name'];
166
+ }
167
+
168
+ /**
169
+ * Get plugin log description
170
+ *
171
+ * @since 1.0.0
172
+ *
173
+ * @param string $plugin The plugin name.
174
+ * @param string $activity The activity.
175
+ *
176
+ * @return string The description.
177
+ */
178
+ public function get_plugin_log_description( $plugin, $activity ) {
179
+ return $activity . ' - ' . $plugin;
180
+ }
181
+ }
core/Activity_Log/Activity_Log_Posts.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Posts main class
6
+ */
7
+ class Activity_Log_Posts extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Log post status transition.
11
+ *
12
+ * @param string $new New post status.
13
+ * @param string $old Old post status.
14
+ * @param WP_Post $post Post object.
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ public function log_post_status_transition( $new, $old, $post ) {
19
+ // Bail if it's a revision.
20
+ if ( wp_is_post_revision( $post->ID ) ) {
21
+ return;
22
+ }
23
+
24
+ // Bail for menu items.
25
+ if ( 'nav_menu_item' === $post->post_type ) {
26
+ return;
27
+ }
28
+
29
+ $post_type = ucwords( $post->post_type );
30
+
31
+ if (
32
+ 'auto-draft' === $old &&
33
+ ( 'auto-draft' !== $new && 'inherit' !== $new )
34
+ ) {
35
+ $activity = __( 'Created', 'sg-security' ) . ' ' . $post_type;
36
+ $this->log_event( array(
37
+ 'activity' => $activity,
38
+ 'description' => $this->get_post_description( $post, $activity ),
39
+ 'object_id' => $post->ID,
40
+ 'type' => 'post',
41
+ 'action' => 'create',
42
+ ) );
43
+ } elseif (
44
+ 'auto-draft' === $new ||
45
+ ( 'new' === $old && 'inherit' === $new )
46
+ ) {
47
+ return;
48
+ } elseif ( 'trash' === $new ) {
49
+ // page was deleted.
50
+ $activity = __( 'Trashed', 'sg-security' ) . ' ' . $post_type;
51
+ $this->log_event( array(
52
+ 'activity' => $activity,
53
+ 'description' => $this->get_post_description( $post, $activity ),
54
+ 'object_id' => $post->ID,
55
+ 'type' => 'post',
56
+ 'action' => 'trash',
57
+ ) );
58
+ } elseif ( 'trash' === $old ) {
59
+ $activity = __( 'Restored', 'sg-security' ) . ' ' . $post_type;
60
+ $this->log_event( array(
61
+ 'activity' => $activity,
62
+ 'description' => $this->get_post_description( $post, $activity ),
63
+ 'object_id' => $post->ID,
64
+ 'type' => 'post',
65
+ 'action' => 'restore',
66
+ ) );
67
+ } else {
68
+ $activity = __( 'Updated', 'sg-security' ) . ' ' . $post_type;
69
+ $this->log_event( array(
70
+ 'activity' => $activity,
71
+ 'description' => $this->get_post_description( $post, $activity ),
72
+ 'object_id' => $post->ID,
73
+ 'type' => 'post',
74
+ 'action' => 'update',
75
+ ) );
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Log post deleted from database.
81
+ *
82
+ * @since 1.0.0
83
+ *
84
+ * @param int $id The post ID.
85
+ * @param object $post WP_Post object.
86
+ */
87
+ public function log_post_delete( $id, $post ) {
88
+
89
+ if (
90
+ 'autodraft' === $post->post_status ||
91
+ 'inherit' === $post->post_status ||
92
+ 'nav_menu_item' === $post->post_type
93
+ ) {
94
+ return;
95
+ }
96
+
97
+ $activity = __( 'Deleted', 'sg-security' ) . ' ' . ucwords( $post->post_type );
98
+ $this->log_event( array(
99
+ 'activity' => $activity,
100
+ 'description' => $this->get_post_description( $post, $activity ),
101
+ 'object_id' => $id,
102
+ 'type' => 'post',
103
+ 'action' => 'delete',
104
+ ) );
105
+ }
106
+
107
+ /**
108
+ * Get post log description.
109
+ *
110
+ * @since 1.0.0
111
+ *
112
+ * @param int $post_obj The post object.
113
+ * @param string $activity The activity type.
114
+ *
115
+ * @return string The description.
116
+ */
117
+ public function get_post_description( $post_obj, $activity ) {
118
+ return $activity . ' - ' . $post_obj->post_title;
119
+ }
120
+ }
core/Activity_Log/Activity_Log_Taxonomies.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Taxonomies main class
6
+ */
7
+ class Activity_Log_Taxonomies extends Activity_Log_Helper {
8
+ /**
9
+ * Log term create.
10
+ *
11
+ * @since 1.0.0
12
+ *
13
+ * @param int $term_id Term ID.
14
+ * @param int $tt_id Term Taxonomy ID.
15
+ * @param int $taxonomy Taxonomy.
16
+ */
17
+ public function log_term_create( $term_id, $tt_id, $taxonomy ) {
18
+ $tax = get_taxonomy( $taxonomy );
19
+ $activity = __( 'Created', 'sg-security' ) . ' ' . $tax->labels->singular_name;
20
+ $this->log_event( array(
21
+ 'activity' => $activity,
22
+ 'description' => $this->get_term_description( $term_id, $taxonomy, $activity ),
23
+ 'object_id' => $term_id,
24
+ 'type' => 'term',
25
+ 'action' => 'create',
26
+ ) );
27
+ }
28
+
29
+ /**
30
+ * Log term edit.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @param int $term_id Term ID.
35
+ * @param int $tt_id Term Taxonomy ID.
36
+ * @param int $taxonomy Taxonomy.
37
+ */
38
+ public function log_term_edit( $term_id, $tt_id, $taxonomy ) {
39
+ $tax = get_taxonomy( $taxonomy );
40
+ $activity = __( 'Edited', 'sg-security' ) . ' ' . $tax->labels->singular_name;
41
+ $this->log_event( array(
42
+ 'activity' => $activity,
43
+ 'description' => $this->get_term_description( $term_id, $taxonomy, $activity ),
44
+ 'object_id' => $term_id,
45
+ 'type' => 'term',
46
+ 'action' => 'edit',
47
+ ) );
48
+ }
49
+
50
+ /**
51
+ * Log term delete.
52
+ *
53
+ * @since 1.0.0
54
+ *
55
+ * @param int $term_id Term ID.
56
+ * @param int $tt_id Term Taxonomy ID.
57
+ * @param int $taxonomy Taxonomy.
58
+ * @param object $deleted_term Deleted Term.
59
+ */
60
+ public function log_term_delete( $term_id, $tt_id, $taxonomy, $deleted_term ) {
61
+ $tax = get_taxonomy( $taxonomy );
62
+ $activity = __( 'Deleted', 'sg-security' ) . ' ' . $tax->labels->singular_name;
63
+ $this->log_event( array(
64
+ 'activity' => $activity,
65
+ 'description' => $activity . ' - ' . $deleted_term->name,
66
+ 'object_id' => $term_id,
67
+ 'type' => 'term',
68
+ 'action' => 'delete',
69
+ ) );
70
+ }
71
+
72
+ /**
73
+ * Get post log description.
74
+ *
75
+ * @since 1.0.0
76
+ *
77
+ * @param int $term_id Term ID.
78
+ * @param int $taxonomy Term Taxonomy.
79
+ * @param string $activity The activity type.
80
+ *
81
+ * @return string The description.
82
+ */
83
+ public function get_term_description( $term_id, $taxonomy, $activity ) {
84
+ $term = get_term( $term_id, $taxonomy );
85
+ return $activity . ' - ' . $term->name;
86
+ }
87
+ }
core/Activity_Log/Activity_Log_Themes.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Themes main class
6
+ */
7
+ class Activity_Log_Themes extends Activity_Log_Helper {
8
+
9
+ /**
10
+ * Path to the wp-content/themes.
11
+ *
12
+ * @var string
13
+ */
14
+ private $themes_dir = WP_CONTENT_DIR . '/themes/';
15
+
16
+ /**
17
+ * Log theme file edit.
18
+ *
19
+ * @since 1.0.0
20
+ *
21
+ * @param array $old_value Array of last edited files.
22
+ * @param array $new_value Array of last edited files including the last file.
23
+ */
24
+ public function log_theme_edit( $old_value, $new_value ) {
25
+ // Bail if the updated file is not a theme file.
26
+ if ( false === strpos( $new_value[0], $this->themes_dir ) ) {
27
+ return;
28
+ }
29
+
30
+ $activity = __( 'Edited Theme', 'sg-security' );
31
+ $theme_name = $this->get_theme_name( dirname( $new_value[0] ) );
32
+ $this->log_event( array(
33
+ 'activity' => $activity,
34
+ 'description' => $this->get_theme_description( $theme_name, $activity ),
35
+ 'object_id' => $theme_name,
36
+ 'type' => 'theme',
37
+ 'action' => 'edit',
38
+ ) );
39
+ }
40
+
41
+ /**
42
+ * Log theme install
43
+ *
44
+ * @since 1.0.0
45
+ *
46
+ * @param obejct $upgrader WP_Upgrader object.
47
+ * @param array $options Array of extra options.
48
+ */
49
+ public function log_theme_install( $upgrader, $options ) {
50
+ // Bail if the type of the installtion is not a theme.
51
+ if (
52
+ ! isset( $options['type'] ) ||
53
+ 'theme' !== $options['type']
54
+ ) {
55
+ return;
56
+ }
57
+
58
+ // Bail if the action is not an install.
59
+ if ( 'install' !== $options['action'] ) {
60
+ return;
61
+ }
62
+
63
+ $activity = __( 'Installed Theme', 'sg-security' );
64
+ $this->log_event( array(
65
+ 'activity' => $activity,
66
+ 'description' => $this->get_theme_description( $upgrader->new_theme_data['Name'], $activity ),
67
+ 'object_id' => $upgrader->new_theme_data['Name'],
68
+ 'type' => 'theme',
69
+ 'action' => 'install',
70
+ ) );
71
+ }
72
+
73
+ /**
74
+ * Log theme update
75
+ *
76
+ * @since 1.0.0
77
+ *
78
+ * @param obejct $upgrader WP_Upgrader object.
79
+ * @param array $options Array of extra options.
80
+ */
81
+ public function log_theme_update( $upgrader, $options ) {
82
+ // Bail if the type of the update is not a theme.
83
+ if (
84
+ ! isset( $options['type'] ) ||
85
+ 'theme' !== $options['type']
86
+ ) {
87
+ return;
88
+ }
89
+
90
+ // Bail if the action is not an update.
91
+ if ( 'update' !== $options['action'] ) {
92
+ return;
93
+ }
94
+
95
+ $activity = __( 'Updated Theme', 'sg-security' );
96
+
97
+ if ( ! empty( $options['theme'] ) ) {
98
+ $this->log_event( array(
99
+ 'activity' => $activity,
100
+ 'description' => $this->get_theme_description( $this->get_theme_name( $options['theme'] ), $activity ),
101
+ 'object_id' => 0,
102
+ 'type' => 'theme',
103
+ 'action' => 'update',
104
+ ) );
105
+
106
+ return;
107
+ }
108
+
109
+ foreach ( $options['themes'] as $path ) {
110
+ $theme_name = $this->get_theme_name( $path );
111
+ $this->log_event( array(
112
+ 'activity' => $activity,
113
+ 'description' => $this->get_theme_description( $theme_name, $activity ),
114
+ 'object_id' => 0,
115
+ 'type' => 'theme',
116
+ 'action' => 'update',
117
+ ) );
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Log switch theme.
123
+ *
124
+ * @since 1.0.0
125
+ *
126
+ * @param string $new_theme New theme name.
127
+ */
128
+ public function log_theme_switch( $new_theme ) {
129
+ $activity = __( 'Switched Theme', 'sg-security' );
130
+ $this->log_event( array(
131
+ 'activity' => $activity,
132
+ 'description' => $this->get_theme_description( $new_theme, $activity ),
133
+ 'object_id' => $new_theme,
134
+ 'type' => 'theme',
135
+ 'action' => 'switch',
136
+ ) );
137
+ }
138
+
139
+
140
+ /**
141
+ * Log theme edit via Customizer
142
+ *
143
+ * @since 1.0.0
144
+ *
145
+ * @param obejct $customizer WP_Customize_Manager obejct.
146
+ */
147
+ public function log_theme_customizer_edit( $customizer ) {
148
+ $activity = __( 'Edited Customizer Theme', 'sg-security' );
149
+ $this->log_event( array(
150
+ 'activity' => $activity,
151
+ 'description' => $this->get_theme_description( $customizer->theme()->display( 'Name' ), $activity ),
152
+ 'object_id' => $customizer->theme()->display( 'Name' ),
153
+ 'type' => 'theme',
154
+ 'action' => 'edit_customizer',
155
+ ) );
156
+ }
157
+
158
+ /**
159
+ * Log theme delete
160
+ *
161
+ * @since 1.0.0
162
+ */
163
+ public function log_theme_delete() {
164
+ // Try to get the deleted theme.
165
+ $deleted_theme = $this->get_delete_theme();
166
+
167
+ // Bail if we cannot find the deleted theme.
168
+ if ( empty( $deleted_theme ) ) {
169
+ return;
170
+ }
171
+
172
+ $activity = __( 'Deleted Theme', 'sg-security' );
173
+ $theme_name = $this->get_theme_name( $deleted_theme['args'][0] );
174
+ $this->log_event( array(
175
+ 'activity' => $activity,
176
+ 'description' => $this->get_theme_description( $theme_name, $activity ),
177
+ 'object_id' => $theme_name,
178
+ 'type' => 'theme',
179
+ 'action' => 'delete',
180
+ ) );
181
+ }
182
+
183
+ /**
184
+ * Get the theme name from the theme path.
185
+ *
186
+ * @since 1.0.0
187
+ *
188
+ * @param string $theme The theme path.
189
+ *
190
+ * @return string The theme name.
191
+ */
192
+ public function get_theme_name( $theme ) {
193
+ $theme = str_replace( $this->themes_dir, '', $theme );
194
+
195
+ $theme_data = \wp_get_theme( $theme );
196
+
197
+ return $theme_data['Name'];
198
+ }
199
+
200
+ /**
201
+ * Get deleted theme.
202
+ *
203
+ * @since 1.0.0
204
+ *
205
+ * @return array Deleted theme data.
206
+ */
207
+ private function get_delete_theme() {
208
+ $backtrace = debug_backtrace();
209
+ $delete_theme = null;
210
+ foreach ( $backtrace as $call ) {
211
+ if (
212
+ isset( $call['function'] ) &&
213
+ 'delete_theme' === $call['function']
214
+ ) {
215
+ $delete_theme = $call;
216
+ break;
217
+ }
218
+ }
219
+ return $delete_theme;
220
+ }
221
+
222
+ /**
223
+ * Get theme log description
224
+ *
225
+ * @since 1.0.0
226
+ *
227
+ * @param string $name Theme name.
228
+ * @param string $activity Activity type.
229
+ *
230
+ * @return string The description.
231
+ */
232
+ public function get_theme_description( $name, $activity ) {
233
+ return $activity . ' - ' . $name;
234
+ }
235
+ }
core/Activity_Log/Activity_Log_Unknown.php ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ use SG_Security\Helper\Helper;
5
+ /**
6
+ * Class that manages the Activity log for unknown visits.
7
+ */
8
+ class Activity_Log_Unknown extends Activity_Log_Helper {
9
+
10
+ /**
11
+ * Known crawlers arraay.
12
+ *
13
+ * @var array
14
+ */
15
+ public $crawlers = array(
16
+ 'googlebot',
17
+ 'adsbot',
18
+ 'bingbot',
19
+ 'slurp',
20
+ 'duckduckbot',
21
+ 'baiduspider',
22
+ 'yandexbot',
23
+ 'facebot',
24
+ 'ia_archiver',
25
+ 'petalbot',
26
+ );
27
+
28
+ /**
29
+ * Known services array.
30
+ *
31
+ * @var array
32
+ */
33
+ public $ping_services = array(
34
+ 'UptimeRobot' => array(
35
+ '216.144.250.150',
36
+ '69.162.124.226',
37
+ '69.162.124.227',
38
+ '69.162.124.228',
39
+ '69.162.124.229',
40
+ '69.162.124.230',
41
+ '69.162.124.231',
42
+ '69.162.124.232',
43
+ '69.162.124.233',
44
+ '69.162.124.234',
45
+ '69.162.124.235',
46
+ '69.162.124.236',
47
+ '69.162.124.237',
48
+ '63.143.42.242',
49
+ '63.143.42.243',
50
+ '63.143.42.244',
51
+ '63.143.42.245',
52
+ '63.143.42.246',
53
+ '63.143.42.247',
54
+ '63.143.42.248',
55
+ '63.143.42.249',
56
+ '63.143.42.250',
57
+ '63.143.42.251',
58
+ '63.143.42.252',
59
+ '63.143.42.253',
60
+ '216.245.221.82',
61
+ '216.245.221.83',
62
+ '216.245.221.84',
63
+ '216.245.221.85',
64
+ '216.245.221.86',
65
+ '216.245.221.87',
66
+ '216.245.221.88',
67
+ '216.245.221.89',
68
+ '216.245.221.90',
69
+ '216.245.221.91',
70
+ '216.245.221.92',
71
+ '216.245.221.93',
72
+ '208.115.199.18',
73
+ '208.115.199.19',
74
+ '208.115.199.20',
75
+ '208.115.199.21',
76
+ '208.115.199.22',
77
+ '208.115.199.23',
78
+ '208.115.199.24',
79
+ '208.115.199.25',
80
+ '208.115.199.26',
81
+ '208.115.199.27',
82
+ '208.115.199.28',
83
+ '208.115.199.29',
84
+ '208.115.199.30',
85
+ '46.137.190.132',
86
+ '122.248.234.23',
87
+ '167.99.209.234',
88
+ '178.62.52.237',
89
+ '54.79.28.129',
90
+ '54.94.142.218',
91
+ '104.131.107.63',
92
+ '54.67.10.127',
93
+ '54.64.67.106',
94
+ '159.203.30.41',
95
+ '46.101.250.135',
96
+ '18.221.56.27',
97
+ '52.60.129.180',
98
+ '159.89.8.111',
99
+ '146.185.143.14',
100
+ '139.59.173.249',
101
+ '165.227.83.148',
102
+ '128.199.195.156',
103
+ '138.197.150.151',
104
+ '34.233.66.117',
105
+ '2607:ff68:107::3',
106
+ '2607:ff68:107::4',
107
+ '2607:ff68:107::5',
108
+ '2607:ff68:107::6',
109
+ '2607:ff68:107::7',
110
+ '2607:ff68:107::8',
111
+ '2607:ff68:107::9',
112
+ '2607:ff68:107::10',
113
+ '2607:ff68:107::11',
114
+ '2607:ff68:107::12',
115
+ '2607:ff68:107::13',
116
+ '2607:ff68:107::14',
117
+ '2607:ff68:107::15',
118
+ '2607:ff68:107::16',
119
+ '2607:ff68:107::17',
120
+ '2607:ff68:107::18',
121
+ '2607:ff68:107::19',
122
+ '2607:ff68:107::20',
123
+ '2607:ff68:107::21',
124
+ '2607:ff68:107::22',
125
+ '2607:ff68:107::23',
126
+ '2607:ff68:107::24',
127
+ '2607:ff68:107::25',
128
+ '2607:ff68:107::26',
129
+ '2607:ff68:107::27',
130
+ '2607:ff68:107::28',
131
+ '2607:ff68:107::29',
132
+ '2607:ff68:107::30',
133
+ '2607:ff68:107::31',
134
+ '2607:ff68:107::32',
135
+ '2607:ff68:107::33',
136
+ '2607:ff68:107::34',
137
+ '2607:ff68:107::35',
138
+ '2607:ff68:107::36',
139
+ '2607:ff68:107::37',
140
+ '2607:ff68:107::38',
141
+ '2607:ff68:107::39',
142
+ '2607:ff68:107::40',
143
+ '2607:ff68:107::41',
144
+ '2607:ff68:107::42',
145
+ '2607:ff68:107::43',
146
+ '2607:ff68:107::44',
147
+ '2607:ff68:107::45',
148
+ '2607:ff68:107::46',
149
+ '2607:ff68:107::47',
150
+ '2607:ff68:107::48',
151
+ '2607:ff68:107::49',
152
+ '2607:ff68:107::50',
153
+ '2607:ff68:107::51',
154
+ '2607:ff68:107::52',
155
+ '2607:ff68:107::53',
156
+ '2607:ff68:107::54',
157
+ '2607:ff68:107::55',
158
+ '2a03:b0c0:2:d0::fa3:e001',
159
+ '2a03:b0c0:1:d0::e54:a001',
160
+ '2604:a880:800:10::4e6:f001',
161
+ '2604:a880:cad:d0::122:7001',
162
+ '2a03:b0c0:3:d0::33e:4001',
163
+ '2600:1f16:775:3a01:70d6:601a:1eb5:dbb9',
164
+ '2600:1f11:56a:9000:23:651b:dac0:9be4',
165
+ '2a03:b0c0:3:d0::44:f001',
166
+ '2a03:b0c0:0:1010::2b:b001',
167
+ '2a03:b0c0:1:d0::22:5001',
168
+ '2604:a880:400:d0::4f:3001',
169
+ '2400:6180:0:d0::16:d001',
170
+ '2604:a880:cad:d0::18:f001',
171
+ '2600:1f18:179:f900:88b2:b3d:e487:e2f4',
172
+ ),
173
+ );
174
+
175
+ /**
176
+ * Get visitor type.
177
+ *
178
+ * @since 1.0.0
179
+ *
180
+ * @return string The type of visitor.
181
+ */
182
+ public function get_visitor_type() {
183
+ // Check for ping services.
184
+ $maybe_pingbot = $this->check_for_pingbots();
185
+
186
+ // Return the service name if it exists.
187
+ if ( false !== $maybe_pingbot ) {
188
+ return $maybe_pingbot;
189
+ }
190
+
191
+ // If no user-agent set as unknown.
192
+ if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
193
+ return 'Unknown';
194
+ }
195
+
196
+ // Check for a bot/crawler.
197
+ $maybe_crawler = $this->check_for_crawlers();
198
+
199
+ // Return the bot name.
200
+ if ( false !== $maybe_crawler ) {
201
+ return $maybe_crawler;
202
+ }
203
+
204
+ return 'Human';
205
+ }
206
+
207
+ /**
208
+ * Check if the visitor is a known service
209
+ *
210
+ * @since 1.1.0
211
+ *
212
+ * @return string|bool The service name, or false if no match found.
213
+ */
214
+ public function check_for_pingbots() {
215
+ $services = apply_filters(
216
+ 'sg_security_custom_ping_services',
217
+ array_merge(
218
+ $this->ping_services, // Our custom services.
219
+ get_option( 'sg_security_user_ping_services', array() ) // User defined services.
220
+ )
221
+ );
222
+
223
+ // Get the current user ip.
224
+ $ip = Helper::get_current_user_ip();
225
+
226
+ // Loop all services.
227
+ foreach ( $services as $key => $service_ip ) {
228
+ // If we have a match, return the service name.
229
+ if ( in_array( $ip, $service_ip ) ) {
230
+ return $key;
231
+ }
232
+ }
233
+
234
+ return false;
235
+ }
236
+ /**
237
+ * Check if the visitor is a bot by user agent.
238
+ *
239
+ * @since 1.1.0
240
+ *
241
+ * @return string|bool $match The bot name. False otherwise.
242
+ */
243
+ public function check_for_crawlers() {
244
+ $crawlers = apply_filters(
245
+ 'sg_security_custom_crawlers',
246
+ array_merge(
247
+ $this->crawlers, // Our custom crawlers.
248
+ get_option( 'sg_security_user_crawlers', array() ) // User defined crawlers.
249
+ )
250
+ );
251
+
252
+ // Build the regex for locating the bot user-agents.
253
+ $regex = sprintf(
254
+ '/(%s)/i',
255
+ implode( '|', $crawlers )
256
+ );
257
+
258
+ // Check if we ahve a match and return the name of the bot.
259
+ if ( preg_match( $regex, $_SERVER['HTTP_USER_AGENT'], $match ) ) { //phpcs:ignore
260
+ return $match[0];
261
+ }
262
+
263
+ return false;
264
+ }
265
+ /**
266
+ * Log page visit.
267
+ *
268
+ * @since 1.0.0
269
+ */
270
+ public function log_visit() {
271
+ if ( defined( 'WP_CLI' ) ) {
272
+ exit;
273
+ }
274
+
275
+ // Bail if request is made with jquery.
276
+ if ( ! empty( $_SERVER['X-Requested-With'] ) ) {
277
+ return;
278
+ }
279
+
280
+ // Bail if it is a request for something else than html page.
281
+ if ( isset( $_SERVER['HTTP_ACCEPT'] ) && false === strpos( $_SERVER['HTTP_ACCEPT'], 'text/html' ) ) { // phpcs:ignore
282
+ return;
283
+ }
284
+
285
+ // List of URLs which hits are excluded from the log.
286
+ $excluded_urls = array(
287
+ 'admin-ajax.php',
288
+ 'wp-comments-post.php',
289
+ '/?unapproved=',
290
+ );
291
+ // Bail if request is made trough excluded URIs.
292
+ foreach ( $excluded_urls as $excluded ) {
293
+ if ( isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( $_SERVER['REQUEST_URI'], $excluded ) ) { // phpcs:ignore
294
+ return;
295
+ }
296
+ }
297
+
298
+ // Do not log the visit if a user is logged in.
299
+ if ( isset( $_SERVER['HTTP_COOKIE'] ) && false !== strpos( $_SERVER['HTTP_COOKIE'], 'wordpress_logged_in_' ) ) { // phpcs:ignore
300
+ return;
301
+ }
302
+
303
+ // Get the curent user ip.
304
+ $ip = Helper::get_current_user_ip();
305
+
306
+ // Prepare the arguments for writing to db.
307
+ $args = array(
308
+ 'ts' => time(),
309
+ 'visitor_id' => $this->get_visitor_by_ip( $ip ),
310
+ 'activity' => $_SERVER['REQUEST_URI'], // phpcs:ignore
311
+ 'description' => $_SERVER['REQUEST_URI'], // phpcs:ignore
312
+ 'ip' => $ip,
313
+ 'code' => http_response_code(),
314
+ 'object_id' => 0,
315
+ 'type' => 'unknown',
316
+ 'hostname' => gethostbyaddr( $ip ), // phpcs:ignore
317
+ 'action' => 'visit',
318
+ 'visitor_type' => $this->get_visitor_type(),
319
+ );
320
+
321
+ // Log the visit in the db.
322
+ $this->insert( $args );
323
+
324
+ exit;
325
+ }
326
+ }
core/Activity_Log/Activity_Log_Users.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Users main class
6
+ */
7
+ class Activity_Log_Users extends Activity_Log_Helper {
8
+ /**
9
+ * Log user login.
10
+ *
11
+ * @since 1.0.0
12
+ *
13
+ * @param string $user_login Username.
14
+ * @param object $user WP_User object.
15
+ */
16
+ public function log_login( $user_login, $user ) {
17
+ $activity = __( 'User Login', 'sg-security' );
18
+ $this->log_event(
19
+ array(
20
+ 'activity' => $activity,
21
+ 'description' => $this->get_user_description( $user->ID, $activity ),
22
+ 'object_id' => $user->ID,
23
+ 'user_id' => $user->ID,
24
+ 'type' => 'user',
25
+ 'action' => 'login',
26
+ )
27
+ );
28
+ }
29
+
30
+ /**
31
+ * Log user logout.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param int $id user ID.
36
+ */
37
+ public function log_logout( $id ) {
38
+ $activity = __( 'User logout', 'sg-security' );
39
+ $this->log_event(
40
+ array(
41
+ 'activity' => $activity,
42
+ 'description' => $this->get_user_description( $id, $activity ),
43
+ 'object_id' => $id,
44
+ 'user_id' => $id,
45
+ 'type' => 'user',
46
+ 'action' => 'logout',
47
+ )
48
+ );
49
+ }
50
+
51
+ /**
52
+ * Log user delete.
53
+ *
54
+ * @since 1.0.0
55
+ *
56
+ * @param int $id user ID.
57
+ */
58
+ public function log_user_delete( $id ) {
59
+ $activity = __( 'User Delete', 'sg-security' );
60
+ $this->log_event(
61
+ array(
62
+ 'activity' => $activity,
63
+ 'description' => $this->get_user_description( $id, $activity ),
64
+ 'object_id' => $id,
65
+ 'type' => 'user',
66
+ 'action' => 'delete',
67
+ )
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Log user register.
73
+ *
74
+ * @since 1.0.0
75
+ *
76
+ * @param int $id user ID.
77
+ */
78
+ public function log_user_register( $id ) {
79
+ $activity = __( 'User Register', 'sg-security' );
80
+ $this->log_event(
81
+ array(
82
+ 'activity' => $activity,
83
+ 'description' => $this->get_user_description( $id, $activity ),
84
+ 'object_id' => $id,
85
+ 'type' => 'user',
86
+ 'action' => 'register',
87
+ )
88
+ );
89
+ }
90
+
91
+ /**
92
+ * Log profile update.
93
+ *
94
+ * @since 1.0.0
95
+ *
96
+ * @param int $id user ID.
97
+ */
98
+ public function log_profile_update( $id ) {
99
+ $activity = __( 'User Update', 'sg-security' );
100
+ $this->log_event(
101
+ array(
102
+ 'activity' => $activity,
103
+ 'description' => $this->get_user_description( $id, $activity ),
104
+ 'object_id' => $id,
105
+ 'type' => 'user',
106
+ 'action' => 'update',
107
+ )
108
+ );
109
+ }
110
+
111
+ /**
112
+ * Log user failed login.
113
+ *
114
+ * @since 1.0.0
115
+ *
116
+ * @param int $id user ID.
117
+ */
118
+ public function log_wrong_password( $id ) {
119
+ $this->log_event(
120
+ array(
121
+ 'activity' => __( 'Failed Login Attempt', 'sg-security' ),
122
+ 'description' => __( 'Failed Login Attempt', 'sg-security' ),
123
+ 'object_id' => $id,
124
+ 'user_id' => $id,
125
+ 'type' => 'user',
126
+ 'action' => 'login',
127
+ 'visitor_type' => 'Human',
128
+ )
129
+ );
130
+ }
131
+
132
+ /**
133
+ * Get user log description
134
+ *
135
+ * @since 1.0.0
136
+ *
137
+ * @param int $user_id User ID.
138
+ * @param string $activity Activity type.
139
+ *
140
+ * @return string The description.
141
+ */
142
+ public function get_user_description( $user_id, $activity ) {
143
+ $user = get_user_by( 'id', $user_id );
144
+ return $activity . ' - ' . $user->data->user_login;
145
+ }
146
+ }
core/Activity_Log/Activity_Log_Weekly_Emails.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ use SiteGround_Helper\Helper_Service;
5
+ use SiteGround_Emails\Email_Service;
6
+
7
+ /**
8
+ * Activity Log Weekly Emails class
9
+ */
10
+ class Activity_Log_Weekly_Emails extends Activity_Log_Helper {
11
+ /**
12
+ * The constructor.
13
+ *
14
+ * @since 1.2.0
15
+ */
16
+ public function __construct() {
17
+
18
+ // Initiate the Email Service Class.
19
+ $this->weekly_report_email = new Email_Service(
20
+ 'sgs_email_cron',
21
+ 'weekly',
22
+ strtotime( 'next monday' ),
23
+ array(
24
+ 'recipients_option' => 'sg_security_notification_emails',
25
+ 'subject' => __( 'Weekly Activity for ', 'sg-security' ) . Helper_Service::get_site_url(),
26
+ 'body_method' => array( '\SG_Security\Activity_Log\Activity_Log_Weekly_Emails', 'generate_message_body' ),
27
+ 'from_name' => 'SiteGround Security',
28
+ )
29
+ );
30
+ }
31
+
32
+ /**
33
+ * Generate the message body and return it to the constructor.
34
+ *
35
+ * @since 1.2.0
36
+ *
37
+ * @return string $message_body HTML of the message body.
38
+ */
39
+ static function generate_message_body() {
40
+ $weekly_emails = new Activity_Log_Weekly_Emails();
41
+
42
+ // Activity Log page URL.
43
+ $activity_log_url = admin_url( '/admin.php?page=activity-log' );
44
+
45
+ // Generate the start date we should collect the data from.
46
+ $start_date = $weekly_emails->get_last_cron_run()->modify( 'last monday' );
47
+ // Generate the end date we should collect the data to.
48
+ $end_date = $weekly_emails->get_last_cron_run();
49
+
50
+ // Get the count of total human visits for the period.
51
+ $total_human = (int) $weekly_emails->get_total_human_stats( $start_date->getTimestamp(), $end_date->getTimestamp() );
52
+ // Get the count of total bots visit for the period.
53
+ $total_bots = (int) $weekly_emails->get_total_bots_stats( $start_date->getTimestamp(), $end_date->getTimestamp() );
54
+ // Get the count of total blocked login attempts.
55
+ $total_blocked_login = (int) get_option( 'sg_security_total_blocked_logins', 0 );
56
+ // Get the count of total blocked visits.
57
+ $total_blocked_visits = (int) get_option( 'sg_security_total_blocked_visits', 0 );
58
+
59
+ // Bail if all stats are 0.
60
+ if (
61
+ 0 === $total_human &&
62
+ 0 === $total_bots &&
63
+ 0 === $total_blocked_login &&
64
+ 0 === $total_blocked_visits
65
+ ) {
66
+ return false;
67
+ }
68
+
69
+ // Get assets from remote server.
70
+ $assets = $weekly_emails->get_remote_assets();
71
+
72
+ // Bail if we do not get the templates.
73
+ if ( false === $assets ) {
74
+ return false;
75
+ }
76
+
77
+ // Sanitize paths.
78
+ $assets = $weekly_emails->prepare_paths( $assets );
79
+
80
+ // Mail template arguments.
81
+ $args = array(
82
+ 'domain' => Helper_Service::get_site_url(),
83
+ 'activity_log_link' => $activity_log_url,
84
+ 'unsubscribe_link' => $activity_log_url,
85
+ 'start_time' => $start_date->format( 'F d' ),
86
+ 'end_time' => $end_date->format( 'F d, Y' ),
87
+ 'is_siteground' => Helper_Service::is_siteground(),
88
+ 'agreed_email_consent' => (int) get_option( 'siteground_email_consent', 0 ),
89
+ 'total_human' => $total_human,
90
+ 'total_bots' => $total_bots,
91
+ 'total_blocked_login' => $total_blocked_login,
92
+ 'total_blocked_visits' => $total_blocked_visits,
93
+ 'email_image' => $assets['image'],
94
+ 'email_body' => $assets['email_body'],
95
+ 'intro_path' => $assets['intro_path'],
96
+ 'learn_more_path' => $assets['learn_more_path'],
97
+ 'non_sg' => $assets['non_sg'],
98
+ 'unsubscribe' => $assets['unsubscribe'],
99
+ );
100
+
101
+ // Turn on output buffering.
102
+ ob_start();
103
+
104
+ // Include the template file.
105
+ include \SG_Security\DIR . '/templates/weekly_report.php';
106
+
107
+ // Pass the contents of the output buffer to the variable.
108
+ $message_body = ob_get_contents();
109
+
110
+ // Clean the output buffer and turn off output buffering.
111
+ ob_end_clean();
112
+
113
+ // Return the message body content as a string.
114
+ return $message_body;
115
+ }
116
+
117
+ /**
118
+ * Get assets from remote json.
119
+ *
120
+ * @since 1.2.4
121
+ *
122
+ * @return bool/array false if we fail the request/Array with data.
123
+ */
124
+ private function get_remote_assets( ){
125
+ // Get the banner content.
126
+ $response = wp_remote_get( 'https://sgwpdemo.com/jsons/sg-security-emails.json' );
127
+
128
+ // Bail if the request fails.
129
+ if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
130
+ return false;
131
+ }
132
+
133
+ // Get the locale.
134
+ $locale = get_locale();
135
+
136
+ // Get the body of the response.
137
+ $body = wp_remote_retrieve_body( $response );
138
+
139
+ // Decode the json response.
140
+ $assets = json_decode( $body, true );
141
+
142
+ // Check if we need to return a specific locale assets.
143
+ if ( array_key_exists( $locale, $assets ) ) {
144
+ // Add the locale name so we skip re-use of get_locale in message builder.
145
+ $assets[ $locale ]['lang'] = $locale;
146
+
147
+ // Return the locale specific assets.
148
+ return $assets[ $locale ];
149
+ }
150
+
151
+ // Set the default locale.
152
+ $assets['default']['lang'] = 'default';
153
+
154
+ // Return the correct assets, title and marketing urls.
155
+ return $assets['default'];
156
+ }
157
+
158
+ /**
159
+ * Update the timestamp when the cron event was last ran.
160
+ *
161
+ * @since 1.2.0
162
+ */
163
+ public function update_last_cron_run_timestamp() {
164
+ update_option( 'sg_security_weekly_email_timestamp', time() );
165
+ }
166
+
167
+ /**
168
+ * Get the last time the cron event was ran.
169
+ *
170
+ * @since 1.2.0
171
+ *
172
+ * @return object $last_run_time DateTime object.
173
+ */
174
+ public function get_last_cron_run() {
175
+ // DateTime object.
176
+ $last_run_time = new \DateTime();
177
+
178
+ // Get the timestamp and convert it to DateTime object.
179
+ $last_run_time->setTimestamp( get_option( 'sg_security_weekly_email_timestamp', time() ) );
180
+
181
+ return $last_run_time;
182
+ }
183
+
184
+ /**
185
+ * Get stats for total human visits in the past week.
186
+ *
187
+ * @since 1.2.0
188
+ *
189
+ * @param int $start_date Start date timestamp.
190
+ * @param int $end_date End date timestamp.
191
+ *
192
+ * @return int The number of total human visits.
193
+ */
194
+ private function get_total_human_stats( $start_date, $end_date ) {
195
+ global $wpdb;
196
+
197
+ return $wpdb->get_var(
198
+ 'SELECT COUNT(*) FROM `' . $wpdb->prefix . 'sgs_log_events' . '`
199
+ WHERE `action` = "visit"
200
+ AND `visitor_type` = "Human"
201
+ AND `type` = "unknown"
202
+ AND `ts` BETWEEN ' . $start_date .' AND ' . $end_date . ' ;'
203
+ );
204
+ }
205
+
206
+ /**
207
+ * Get stats for total bots visits in the past week.
208
+ *
209
+ * @since 1.2.0
210
+ *
211
+ * @param int $start_date Start date timestamp.
212
+ * @param int $end_date End date timestamp.
213
+ *
214
+ * @return int The number of total bots visits.
215
+ */
216
+ private function get_total_bots_stats( $start_date, $end_date ) {
217
+ global $wpdb;
218
+
219
+ return $wpdb->get_var(
220
+ 'SELECT COUNT(*) FROM `' . $wpdb->prefix . 'sgs_log_events' . '`
221
+ WHERE `action` = "visit"
222
+ AND `visitor_type` <>"Human" AND `visitor_type` <>"unknown"
223
+ AND `type` = "unknown"
224
+ AND `ts` BETWEEN ' . $start_date .' AND ' . $end_date . ' ;'
225
+ );
226
+ }
227
+
228
+ /**
229
+ * Reset the block stats counters.
230
+ *
231
+ * @since 1.2.0
232
+ */
233
+ public function reset_weekly_stats_counters() {
234
+ // Reset the total blocked visits counter.
235
+ update_option( 'sg_security_total_blocked_visits', 0 );
236
+ // Reset the total blocked logins counter.
237
+ update_option( 'sg_security_total_blocked_logins', 0 );
238
+ }
239
+
240
+ /**
241
+ * Get notification receipient emails.
242
+ *
243
+ * @since 1.2.0
244
+ *
245
+ * @return Object $data Array Object with the list of emails set to receive notifications.
246
+ */
247
+ public function weekly_report_receipients() {
248
+ $data = array();
249
+
250
+ // Get the currently set receipients.
251
+ $receipients = get_option( 'sg_security_notification_emails', array() );
252
+
253
+ // Return empty array if no receipients are set.
254
+ if ( empty( $receipients ) ) {
255
+ return $data;
256
+ }
257
+
258
+ // Convert the data to an email key array.
259
+ foreach ( $receipients as $entry ) {
260
+ $data[] = array( 'email' => $entry );
261
+ }
262
+
263
+ // Return the data.
264
+ return $data;
265
+ }
266
+
267
+ /**
268
+ * Prepare safe paths for templates.
269
+ *
270
+ * @since 1.3.0
271
+ *
272
+ * @param array $assets The assets array from sgwpdemo.
273
+ *
274
+ * @return array $assets The assets array from sgwpdemo.
275
+ */
276
+ private function prepare_paths( $assets ) {
277
+ // Set the default paths.
278
+ $default_paths = array(
279
+ 'intro_path' => \SG_Security\DIR . '/templates/partials/weekly-report/intro/default.php',
280
+ 'learn_more_path' => \SG_Security\DIR . '/templates/partials/weekly-report/learn-more/default.php',
281
+ );
282
+
283
+ // Skip path traversal if any.
284
+ $file = str_replace(
285
+ '../',
286
+ '',
287
+ $assets['lang']
288
+ );
289
+
290
+ // Merge the default ones with the assets and send them if we have default locale.
291
+ if ( 'default' === $file ) {
292
+ return array_merge( $assets, $default_paths );
293
+ }
294
+
295
+ // Prepare path based on type and language.
296
+ $paths = preg_replace(
297
+ '~{LANG}~',
298
+ $file,
299
+ array(
300
+ 'intro_path' => \SG_Security\DIR . '/templates/partials/weekly-report/intro/{LANG}.php',
301
+ 'learn_more_path' => \SG_Security\DIR . '/templates/partials/weekly-report/learn-more/{LANG}.php',
302
+ )
303
+ );
304
+
305
+ // Loop the new paths.
306
+ foreach ( $paths as $type => $path ) {
307
+
308
+ // Check if the file exists.
309
+ if ( file_exists( $path ) ) {
310
+ // Add the new path based on language.
311
+ $assets[ $type ] = $path;
312
+ continue;
313
+ }
314
+
315
+ // Set the default one if the file is trying to traverse.
316
+ $assets[ $type ] = $default_paths[ $type ];
317
+ }
318
+
319
+ // Return the assets array.
320
+ return $assets;
321
+ }
322
+ }
core/Activity_Log/Activity_Log_Widgets.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Activity_Log;
3
+
4
+ /**
5
+ * Activity Log Widgets main class
6
+ */
7
+ class Activity_Log_Widgets extends Activity_Log_Helper {
8
+ /**
9
+ * Log widget delete
10
+ *
11
+ * @param array $instance The current widget instance's settings.
12
+ * @param array $new_instance Array of new widget settings.
13
+ * @param array $old_instance Array of old widget settings.
14
+ * @param WP_Widget $widget The current widget instance.
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ public function log_widget_update( $instance, $new_instance, $old_instance, $widget ) {
19
+ // Check if we are deleting a widget.
20
+ if ( ! empty( $_POST['sidebar'] ) ) {
21
+ $activity = __( 'Updated Widget', 'sg-security' );
22
+ $this->log_event(
23
+ array(
24
+ 'activity' => $activity,
25
+ 'description' => $this->get_widget_description( $widget->id, $activity ),
26
+ 'object_id' => 0,
27
+ 'type' => 'widget',
28
+ 'action' => 'update',
29
+ )
30
+ );
31
+ }
32
+
33
+ return $instance;
34
+ }
35
+
36
+ /**
37
+ * Log widget delete
38
+ *
39
+ * @since 1.0.0
40
+ */
41
+ public function log_widget_delete() {
42
+ // Bail.
43
+ if ( ! isset( $_REQUEST['delete_widget'] ) ) {
44
+ return;
45
+ }
46
+
47
+ // Bail.
48
+ if (
49
+ 'post' !== strtolower( $_SERVER['REQUEST_METHOD'] ) || //phpcs:ignore
50
+ empty( $_REQUEST['widget-id'] )
51
+ ) {
52
+ return;
53
+ }
54
+
55
+ $activity = __( 'Deleted Widget', 'sg-security' );
56
+ $this->log_event(
57
+ array(
58
+ 'activity' => $activity,
59
+ 'description' => $this->get_widget_description( $_REQUEST['widget-id'] , $activity ), // phpcs:ignore
60
+ 'object_id' => sanitize_text_field( wp_unslash( $_REQUEST['widget-id'] ) ), // phpcs:ignore
61
+ 'type' => 'widget',
62
+ 'action' => 'delete',
63
+ )
64
+ );
65
+ }
66
+
67
+ /**
68
+ * Get widget log description
69
+ *
70
+ * @since 1.0.0
71
+ *
72
+ * @param int $id Widget ID.
73
+ * @param string $activity The activity.
74
+ *
75
+ * @return string The description.
76
+ */
77
+ public function get_widget_description( $id, $activity ) {
78
+ global $wp_registered_widgets;
79
+
80
+ if ( ! isset( $wp_registered_widgets[ $id ]['name'] ) ) {
81
+ return $activity;
82
+ }
83
+ return $activity . ' - ' . $wp_registered_widgets[ $id ]['name'];
84
+ }
85
+ }
core/Admin/Admin.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Admin;
3
+
4
+ use SG_Security;
5
+ use SiteGround_Helper\Helper_Service;
6
+ use SiteGround_i18n\i18n_Service;
7
+
8
+ /**
9
+ * Handle all hooks for our custom admin page.
10
+ */
11
+ class Admin {
12
+
13
+ /**
14
+ * Subpages array.
15
+ *
16
+ * @var array
17
+ */
18
+ public $subpages = array(
19
+ 'site-security' => 'Site Security',
20
+ 'login-settings' => 'Login Security',
21
+ 'activity-log' => 'Activity Log',
22
+ 'post-hack-actions' => 'Post-hack Actions',
23
+ );
24
+
25
+ /**
26
+ * Styles to be dequeued.
27
+ *
28
+ * @var array
29
+ */
30
+ public $dequeued_styles = array(
31
+ 'auxin-front-icon', // Phlox Theme.
32
+ 'mks_shortcodes_simple_line_icons', // Meks Flexible Shortcodes.
33
+ );
34
+
35
+ /**
36
+ * Get the subpages id.
37
+ *
38
+ * @since 1.0.0
39
+ *
40
+ * @return array The subpages id's array.
41
+ */
42
+ public function get_plugin_page_ids() {
43
+ $subpage_ids = array(
44
+ 'toplevel_page_sg-security',
45
+ 'toplevel_page_sg-security-network',
46
+ );
47
+
48
+ foreach ( $this->subpages as $id => $title ) {
49
+ $subpage_ids[] = 'sg-security_page_' . $id . '';
50
+ $subpage_ids[] = 'sg-security_page_' . $id . '-network';
51
+ }
52
+
53
+ return $subpage_ids;
54
+ }
55
+
56
+ /**
57
+ * Hide all errors and notices on our custom dashboard.
58
+ *
59
+ * @since 1.0.0
60
+ */
61
+ public function hide_errors_and_notices() {
62
+ // Hide all error in our page.
63
+ if (
64
+ isset( $_GET['page'] ) &&
65
+ 'sg-security' === $_GET['page']
66
+ ) {
67
+ remove_all_actions( 'network_admin_notices' );
68
+ remove_all_actions( 'user_admin_notices' );
69
+ remove_all_actions( 'admin_notices' );
70
+ remove_all_actions( 'all_admin_notices' );
71
+
72
+ error_reporting( 0 );
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Register the stylesheets for the admin area.
78
+ *
79
+ * @since 1.0.0
80
+ */
81
+ public function enqueue_styles() {
82
+ // Bail if we are on different page.
83
+ if ( false === $this->is_plugin_page() ) {
84
+ return;
85
+ }
86
+
87
+ wp_enqueue_style(
88
+ 'sg-security-admin',
89
+ \SG_Security\URL . '/assets/css/main.min.css',
90
+ array(),
91
+ \SG_Security\VERSION,
92
+ 'all'
93
+ );
94
+
95
+ // Dequeue conflicting styles.
96
+ foreach ( $this->dequeued_styles as $style ) {
97
+ wp_dequeue_style( $style );
98
+ }
99
+
100
+ }
101
+
102
+ /**
103
+ * Register the JavaScript for the admin area.
104
+ *
105
+ * @since 1.0.0
106
+ */
107
+ public function enqueue_scripts() {
108
+ // Enqueue the sg-security script.
109
+ wp_enqueue_script(
110
+ 'sg-security',
111
+ \SG_Security\URL . '/assets/js/admin.js',
112
+ array( 'jquery' ), // Dependencies.
113
+ \SG_Security\VERSION,
114
+ true
115
+ );
116
+
117
+ // Bail if we are on different page.
118
+ if ( false === $this->is_plugin_page() ) {
119
+ return;
120
+ }
121
+
122
+ // Enqueue the sg-security script.
123
+ wp_enqueue_script(
124
+ 'sg-security-admin',
125
+ \SG_Security\URL . '/assets/js/main.min.js',
126
+ array( 'jquery' ), // Dependencies.
127
+ \SG_Security\VERSION,
128
+ true
129
+ );
130
+ }
131
+
132
+ /**
133
+ * Check if this is the SG Security page.
134
+ *
135
+ * @since 1.0.0
136
+ *
137
+ * @return bool True/False
138
+ */
139
+ public function is_plugin_page() {
140
+ // Bail if the page is not an admin screen.
141
+ if ( ! is_admin() ) {
142
+ return false;
143
+ }
144
+
145
+ $current_screen = \get_current_screen();
146
+
147
+ if ( in_array( $current_screen->id, $this->get_plugin_page_ids() ) ) {
148
+ return true;
149
+ }
150
+
151
+ return false;
152
+ }
153
+
154
+ /**
155
+ * Register the top level page into the WordPress admin menu.
156
+ *
157
+ * @since 1.0.0
158
+ */
159
+ public function add_plugin_pages() {
160
+ $page = \add_menu_page(
161
+ __( 'SiteGround Security', 'sg-security' ), // Page title.
162
+ __( 'SG Security', 'sg-security' ), // Menu item title.
163
+ 'manage_options',
164
+ \SG_Security\PLUGIN_SLUG, // Page slug.
165
+ array( $this, 'render' ),
166
+ \SG_Security\URL . '/assets/images/icon.svg'
167
+ );
168
+
169
+ foreach ( $this->subpages as $id => $title ) {
170
+ add_submenu_page(
171
+ \SG_Security\PLUGIN_SLUG, // Parent slug.
172
+ $title,
173
+ $title,
174
+ 'manage_options',
175
+ $id,
176
+ array( $this, 'render' )
177
+ );
178
+ }
179
+ }
180
+
181
+ /**
182
+ * Add styles to WordPress admin head.
183
+ *
184
+ * @since 1.0.0
185
+ */
186
+ public function admin_print_styles() {
187
+ echo '<style>.toplevel_page_sg-security.menu-top .wp-menu-image img { width:20px; margin: auto; } </style>';
188
+
189
+ // Bail if we are on different page.
190
+ if ( ! $this->is_plugin_page() ) {
191
+ return;
192
+ }
193
+
194
+ $current_screen = \get_current_screen();
195
+
196
+ echo '<style>.notice { display:none!important; } </style>';
197
+
198
+ $id = strtoupper( str_replace(
199
+ array(
200
+ 'sg-security_page_',
201
+ '_network',
202
+ '-',
203
+ ),
204
+ array(
205
+ '',
206
+ '',
207
+ '_',
208
+ ),
209
+ $current_screen->id
210
+ ));
211
+
212
+ if ( 'TOPLEVEL_PAGE_SG_SECURITY' === $id ) {
213
+ $id = 'SECURITY_DASHBOARD';
214
+ }
215
+
216
+ $i18n_service = new i18n_Service( 'sg-security' );
217
+
218
+ $data = array(
219
+ 'rest_base' => untrailingslashit( get_rest_url( null, '/' ) ),
220
+ 'home_url' => Helper_Service::get_site_url(),
221
+ 'update_timestamp' => get_option( 'sg_security_update_timestamp', 0 ),
222
+ 'localeSlug' => join( '-', explode( '_', \get_user_locale() ) ),
223
+ 'locale' => $i18n_service->get_i18n_data_json(),
224
+ 'wp_nonce' => wp_create_nonce( 'wp_rest' ),
225
+ 'log_page_url' => admin_url( 'admin.php?page=activity-log' ),
226
+ 'data_consent_popup' => $this->get_popup_settings(),
227
+ );
228
+
229
+ echo '<script>window.addEventListener("load", function(){ SGSecurity.init({page: SGSecurity.PAGE.' . $id . ',config:' . json_encode( $data ) . '})});</script>';
230
+ echo '<style>.toplevel_page_sg-security.menu-top .wp-menu-image img { width:20px; } </style>';
231
+ }
232
+
233
+ /**
234
+ * Display the admin page.
235
+ *
236
+ * @since 1.0.0
237
+ */
238
+ public function render() {
239
+ echo '<div id="sg-security-container"></div>';
240
+ }
241
+
242
+ /**
243
+ * Reorder the submenu pages.
244
+ *
245
+ * @since 1.0.0
246
+ *
247
+ * @param array $menu_order The WP menu order.
248
+ */
249
+ public function reorder_submenu_pages( $menu_order ) {
250
+ // Load the global submenu.
251
+ global $submenu;
252
+ if ( empty( $submenu['sg-security'] ) ) {
253
+ return;
254
+ }
255
+
256
+ $submenu['sg-security'][0][0] = __( 'Dashboard', 'sg-security' );
257
+ }
258
+
259
+ /**
260
+ * Get the popup configuration.
261
+ *
262
+ * @since 1.2.0
263
+ *
264
+ * @return array The popup settings.
265
+ */
266
+ public function get_popup_settings() {
267
+ $settings = array();
268
+
269
+ $data_consent = intval( get_option( 'siteground_data_consent', 0 ) );
270
+ $email_consent = intval( get_option( 'siteground_email_consent', 0 ) );
271
+ $settings_security = intval( get_option( 'siteground_settings_security', 0 ) );
272
+
273
+
274
+ if ( ! empty( $settings_security ) ) {
275
+ return array(
276
+ 'show_data_field' => 0,
277
+ 'show_email_field' => 0,
278
+ );
279
+ }
280
+
281
+ if ( Helper_Service::is_siteground() ) {
282
+ if ( 1 === $data_consent ) {
283
+ return array(
284
+ 'show_data_field' => 0,
285
+ 'show_email_field' => 0,
286
+ );
287
+ }
288
+
289
+ return array(
290
+ 'show_data_field' => 1,
291
+ 'show_email_field' => 0,
292
+ );
293
+ }
294
+
295
+
296
+ $settings = array();
297
+
298
+ $settings['show_data_field'] = 0 === $data_consent ? 1 : 0;
299
+ $settings['show_email_field'] = 0 === $email_consent ? 1 : 0;
300
+
301
+ return $settings;
302
+ }
303
+
304
+ }
core/Block_Service/Block_Service.php ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Block_Service;
3
+
4
+ use SG_Security\Helper\Helper;
5
+
6
+ /**
7
+ * Class that manages User's block related actions.
8
+ */
9
+ class Block_Service {
10
+ /**
11
+ * Block user if IP has a block flag set in the visitors table.
12
+ *
13
+ * @since 1.0.0
14
+ */
15
+ public function block_user_by_ip() {
16
+ global $wpdb;
17
+
18
+ // Bail if table doesn't exist.
19
+ if ( ! Helper::table_exists( $wpdb->sgs_visitors ) ) {
20
+ return;
21
+ }
22
+
23
+ // Check if we have the ip blocked in the database.
24
+ $result = $wpdb->get_col( // phpcs:ignore
25
+ 'SELECT `ip` FROM `' . $wpdb->sgs_visitors . '`
26
+ WHERE `block` = 1
27
+ AND `user_id` = 0
28
+ ;'
29
+ );
30
+
31
+ // Continue if ip is not blocked.
32
+ if ( is_null( $result ) ) {
33
+ return;
34
+ }
35
+
36
+ if ( ! in_array( Helper::get_current_user_ip(), $result ) ) {
37
+ return;
38
+ }
39
+
40
+ // Update the total blocked visits counter.
41
+ update_option( 'sg_security_total_blocked_visits', get_option( 'sg_security_total_blocked_visits', 0 ) + 1 );
42
+
43
+ wp_die(
44
+ esc_html__( 'You don’t have access to this page. Please contact the administrator of this website for further assistance.', 'sg-security' ),
45
+ esc_html__( 'Restricted access', 'sg-security' ),
46
+ array(
47
+ 'sgs_error' => true,
48
+ 'response' => 403,
49
+ )
50
+ );
51
+ }
52
+
53
+ /**
54
+ * Change the user level to subscriber to limit capabilities.
55
+ *
56
+ * @since 1.0.0
57
+ *
58
+ * @param int $id The visitor ID we want to limit.
59
+ *
60
+ * @return array $response
61
+ */
62
+ public function change_user_role( $id ) {
63
+ // Get the user id.
64
+ $user_id = $this->get_user_id_by_id( $id );
65
+
66
+ // Bail if the user is trying to self block.
67
+ if ( wp_get_current_user()->data->ID === $user_id ) {
68
+ return array(
69
+ 'message' => __( 'This will restrict your account to a Subscriber role and will lock you out of the Admin Menu', 'sg-security' ),
70
+ 'result' => 0,
71
+ );
72
+ }
73
+
74
+ // Get the user.
75
+ $user = new \WP_User( $user_id );
76
+
77
+ // Bail if we do not find the user.
78
+ if ( empty( $user->ID ) ) {
79
+ return array(
80
+ 'message' => __( 'User not found.', 'sg-security' ),
81
+ 'result' => 0,
82
+ );
83
+ }
84
+
85
+ // Set the user to subscriber role.
86
+ $user->set_role( 'subscriber' );
87
+
88
+ global $wpdb;
89
+
90
+ // Update the record in the database.
91
+ $result = $wpdb->update( //phpcs:ignore
92
+ $wpdb->sgs_visitors,
93
+ array(
94
+ 'block' => 1,
95
+ 'blocked_on' => time(),
96
+ ),
97
+ array( 'id' => $id )
98
+ );
99
+
100
+ return array(
101
+ 'message' => __( 'User Blocked!.', 'sg-security' ),
102
+ 'result' => 1,
103
+ );
104
+ }
105
+
106
+ /**
107
+ * Block IP.
108
+ *
109
+ * @since 1.0.0
110
+ *
111
+ * @param string $id The id reccord from the database.
112
+ *
113
+ * @return array Response message.
114
+ */
115
+ public function block_ip( $id, $type ) {
116
+ // Get the IP from the database.
117
+ $ip = $this->get_ip_by_id( $id );
118
+
119
+ // Bail if we cannot find the record.
120
+ if ( empty( $ip ) ) {
121
+ return array(
122
+ 'message' => __( 'IP not found.', 'sg-security' ),
123
+ 'result' => 0,
124
+ );
125
+ }
126
+
127
+ // Bail if the user is trying to self block or block the local server.
128
+ if (
129
+ ( Helper::get_current_user_ip() === $ip || '127.0.0.1' === $ip ) &&
130
+ 1 === intval( $type )
131
+ ) {
132
+ return array(
133
+ 'message' => __( 'You cannot block this IP!', 'sg-security' ),
134
+ 'result' => 0,
135
+ );
136
+ }
137
+
138
+ global $wpdb;
139
+
140
+ // Update the record in the database.
141
+ $result = $wpdb->update( //phpcs:ignore
142
+ $wpdb->sgs_visitors,
143
+ array(
144
+ 'block' => $type,
145
+ 'blocked_on' => time(),
146
+ ),
147
+ array( 'id' => $id )
148
+ );
149
+
150
+ // Send an error if the update is unsuccessful.
151
+ if ( false === $result ) {
152
+ return array(
153
+ 'message' => intval( $type ) === 1 ? __( 'Could not block the IP.', 'sg-security' ) : __( 'Could not unblock the IP.', 'sg-security' ),
154
+ 'result' => 0,
155
+ );
156
+ }
157
+
158
+ // IP blocked.
159
+ return array(
160
+ 'message' => intval( $type ) === 1 ? __( 'IP Blocked.', 'sg-security' ) : __( 'IP Unblocked.', 'sg-security' ),
161
+ 'result' => 1,
162
+ );
163
+ }
164
+
165
+ /**
166
+ * Get visitor ip by visitor id.
167
+ *
168
+ * @since 1.0.0
169
+ *
170
+ * @param int $id The id in the visitors table.
171
+ *
172
+ * @return string The IP.
173
+ */
174
+ public function get_ip_by_id( $id ) {
175
+ global $wpdb;
176
+ $maybe_ip = $wpdb->get_row( // phpcs:ignore
177
+ $wpdb->prepare(
178
+ 'SELECT `ip` FROM `' . $wpdb->sgs_visitors . '`
179
+ WHERE `id` = %s
180
+ AND `user_id` = 0
181
+ ;',
182
+ $id
183
+ )
184
+ );
185
+
186
+ if ( empty( $maybe_ip->ip ) ) {
187
+ return false;
188
+ }
189
+
190
+ return $maybe_ip->ip;
191
+ }
192
+
193
+ /**
194
+ * Get user_id by visitor id.
195
+ *
196
+ * @since 1.0.0
197
+ *
198
+ * @param int $id The id in the visitors table.
199
+ *
200
+ * @return string The user id.
201
+ */
202
+ public function get_user_id_by_id( $id ) {
203
+ global $wpdb;
204
+ $maybe_id = $wpdb->get_row( // phpcs:ignore
205
+ $wpdb->prepare(
206
+ 'SELECT `user_id` FROM `' . $wpdb->sgs_visitors . '`
207
+ WHERE `id` = %s
208
+ ;',
209
+ $id
210
+ )
211
+ );
212
+
213
+ if ( empty( $maybe_id->user_id ) ) {
214
+ return false;
215
+ }
216
+
217
+ return $maybe_id->user_id;
218
+ }
219
+
220
+ /**
221
+ * Get visitor status by visitor id.
222
+ *
223
+ * @since 1.0.0
224
+ *
225
+ * @param int $id The id in the visitors table.
226
+ *
227
+ * @return string The user id.
228
+ */
229
+ public function get_visitor_status( $id ) {
230
+ global $wpdb;
231
+ $maybe_id = $wpdb->get_row( // phpcs:ignore
232
+ $wpdb->prepare(
233
+ 'SELECT `block` FROM `' . $wpdb->sgs_visitors . '`
234
+ WHERE `id` = %s
235
+ ;',
236
+ $id
237
+ )
238
+ );
239
+
240
+ if ( ! isset( $maybe_id->block ) ) {
241
+ return array(
242
+ 'result' => 0,
243
+ );
244
+ }
245
+
246
+ // IP blocked.
247
+ return array(
248
+ 'result' => 1,
249
+ 'data' => array(
250
+ 'block' => intval( $maybe_id->block ),
251
+ ),
252
+ );
253
+ }
254
+
255
+ /**
256
+ * Unblock user.
257
+ *
258
+ * @since 1.2.0
259
+ *
260
+ * @param int $id The visitor ID we want to unblock.
261
+ *
262
+ * @return array $response Response message.
263
+ */
264
+ public function unblock_user( $id ) {
265
+ global $wpdb;
266
+
267
+ $wpdb->update(
268
+ $wpdb->sgs_visitors,
269
+ array(
270
+ 'block' => 0,
271
+ 'blocked_on' => null,
272
+ ),
273
+ array( 'id' => $id )
274
+ );
275
+
276
+ return array(
277
+ 'message' => __( 'User Unblocked!.', 'sg-security' ),
278
+ 'result' => 1,
279
+ );
280
+ }
281
+ }
core/Cli/Cli.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ /**
5
+ * SG Security Cli main plugin class
6
+ */
7
+ class Cli {
8
+ /**
9
+ * Init SG Security .
10
+ *
11
+ * @version
12
+ */
13
+ public function register_commands() {
14
+ // Optimize commands.
15
+ \WP_CLI::add_command( 'sg secure', 'SG_Security\Cli\Cli_Secure' );
16
+
17
+ // Limits login attempts.
18
+ \WP_CLI::add_command( 'sg limit-login-attempts', 'SG_Security\Cli\Cli_Limit_Login_Attempts' );
19
+
20
+ // Login access configuration.
21
+ \WP_CLI::add_command( 'sg login-access', 'SG_Security\Cli\Cli_Login_Access' );
22
+
23
+ // List activity logs.
24
+ \WP_CLI::add_command( 'sg list', 'SG_Security\Cli\Cli_List' );
25
+
26
+ // Add ua and ip to the activity log.
27
+ \WP_CLI::add_command( 'sg log', 'SG_Security\Cli\Cli_Log' );
28
+
29
+ // Reset the 2FA setup per user.
30
+ \WP_CLI::add_command( 'sg 2fa', 'SG_Security\Cli\Cli_2fa' );
31
+ }
32
+ }
core/Cli/Cli_2fa.php ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ use SG_Security\Sg_2fa\Sg_2fa;
5
+ /**
6
+ * WP-CLI: wp sg 2fa {action} {setting} value.
7
+ *
8
+ * Run the `wp sg 2fa {action} {setting} value` command to reset 2FA setup for specific user.
9
+ *
10
+ * @since 1.1.1
11
+ * @package Cli
12
+ * @subpackage Cli/2fa
13
+ */
14
+
15
+ /**
16
+ * Define the {@link Cli_2fa} class.
17
+ *
18
+ * @since 1.1.1
19
+ */
20
+ class Cli_2fa {
21
+ /**
22
+ * Enable specific setting for SG Security plugin.
23
+ *
24
+ * ## OPTIONS
25
+ * <action>
26
+ * : Action name.
27
+ * options:
28
+ * - reset
29
+ *
30
+ * <setting>
31
+ * : User ID or username.
32
+ * options:
33
+ * - id
34
+ * - username
35
+ * ---
36
+ * <value>
37
+ * : The user ID or username.
38
+ */
39
+ public function __invoke( $args ) {
40
+ // Bail if no action is provided.
41
+ if ( ! isset( $args[0] ) ) {
42
+ return \WP_CLI::error( 'Please provide an action - reset and the user ID or username. Per example "wp sg 2fa reset --user_id=1". This will reset the 2fa setup for user with ID 1.' );
43
+ }
44
+
45
+ // Initiate the reset action.
46
+ if ( 'reset' === $args[0] ) {
47
+ return $this->reset( $args );
48
+ }
49
+
50
+ \WP_CLI::error( 'Incorrect setting, please user reset as an option and user ID/Username as a value!' );
51
+ }
52
+
53
+ /**
54
+ * Reset user 2FA.
55
+ *
56
+ * @since 1.1.1
57
+ */
58
+ public function reset( $args ) {
59
+ // Get the user.
60
+ $user = ( $args[1] == 'id') ? get_user_by( 'ID', $args[2] ) : get_user_by( 'login', $args[2] );
61
+
62
+ if ( false === $user ) {
63
+ // Return error message if there is no such user.
64
+ \WP_CLI::error( 'User with such ' . $args[1] . ' does not exist!' );
65
+ }
66
+
67
+ // Reset the 2FA for the user.
68
+ if ( Sg_2fa::get_instance()->reset_user_2fa( $user->ID ) ) {
69
+ // Return success message.
70
+ \WP_CLI::success( '2FA successfully reset for ' . $args[1] . ' ' . $args[2] . '!' );
71
+ }
72
+ else {
73
+ // Return error message.
74
+ \WP_CLI::error( 'Incorrect ' . $args[1] . '!' );
75
+ }
76
+ }
77
+ }
core/Cli/Cli_Limit_Login_Attempts.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ use SG_Security\Login_Service\Login_Service;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ /**
7
+ * WP-CLI: wp sg limit-login-attempts value.
8
+ *
9
+ * Run the `wp sg limit-login-attempts value` command to use the limit login attempts functionality.
10
+ *
11
+ * @since 1.0.2
12
+ * @package Cli
13
+ * @subpackage Cli/Cli_Limit_Login_Attempts
14
+ */
15
+
16
+ /**
17
+ * Define the {@link Cli_Limit_Login_Attempts} class.
18
+ *
19
+ * @since 1.0.2
20
+ */
21
+ class Cli_Limit_Login_Attempts {
22
+ /**
23
+ * Enable specific setting for SG Security plugin.
24
+ *
25
+ * ## OPTIONS
26
+ * <value>
27
+ * : The new value of the setting.
28
+ */
29
+ public function __invoke( $args ) {
30
+ $this->login_service = new Login_Service();
31
+
32
+ // Bail if value is not provided.
33
+ if ( ! isset( $args[0] ) ) {
34
+ return \WP_CLI::error( 'Please choose between' . implode( ', ', array_flip( $this->login_service->login_attempts_data ) ) );
35
+ }
36
+
37
+ // Bail if the provided value is not an integer.
38
+ if ( false === is_numeric( $args[0] ) ) {
39
+ \WP_CLI::error( 'Please choose one of the integers: ' . implode( ', ', array_flip( $this->login_service->login_attempts_data ) ) );
40
+ }
41
+
42
+ return $this->change_value( $args[0] );
43
+ }
44
+
45
+ /**
46
+ * Limits the number of login attempts.
47
+ *
48
+ * @since 1.0.2
49
+ *
50
+ * @param string $value The value which will define the login attempts.
51
+ */
52
+ public function change_value( $value ) {
53
+ // Bail if the provided value does not match the required ones.
54
+ if ( ! array_key_exists( intval( $value ), $this->login_service->login_attempts_data ) ) {
55
+ \WP_CLI::error( 'The value ' . $value . ' is not supported. Please choose between ' . implode( ', ', array_flip( $this->login_service->login_attempts_data ) ) );
56
+ }
57
+
58
+ // Updates the login limit in the database.
59
+ $status = Options_Service::change_option( 'login_attempts', $value );
60
+
61
+ // Bail if there is an error.
62
+ if ( 0 === $status ) {
63
+ return \WP_CLI::warning( 'The login limit is already set to ' . $value );
64
+ }
65
+
66
+ // Confirm that the limit was updated succesfully..
67
+ \WP_CLI::success( 'Login limit updated succesfully!' );
68
+ }
69
+ }
core/Cli/Cli_List.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+ use SG_Security\Rest\Rest_Helper_Activity;
6
+ use SG_Security\Helper\Helper;
7
+
8
+ /**
9
+ * WP-CLI: wp sg list {setting} value.
10
+ *
11
+ * Run the `wp sg list value` command to list specific logs.
12
+ *
13
+ * @since 1.1.0
14
+ * @package Cli
15
+ * @subpackage Cli/Cli_List
16
+ */
17
+
18
+ /**
19
+ * Define the {@link Cli_List} class.
20
+ *
21
+ * @since 1.1.0
22
+ */
23
+ class Cli_List {
24
+
25
+ /**
26
+ * The default number of days to show if no period specified.
27
+ *
28
+ * @var integer
29
+ */
30
+ public $period = 1;
31
+
32
+ /**
33
+ * The default inretval on which the data should be gathered.
34
+ *
35
+ * @var null
36
+ */
37
+ public $interval = 0;
38
+
39
+ /**
40
+ * Property for the wp database.
41
+ *
42
+ * @var null
43
+ */
44
+ public $wpdb = null;
45
+
46
+ /**
47
+ * Enable specific setting for SiteGround Optimizer plugin.
48
+ *
49
+ * ## OPTIONS
50
+ *
51
+ * <setting>
52
+ * : Setting name.
53
+ * ---
54
+ * options:
55
+ * - log-unknown
56
+ * - log-registered
57
+ * - log-blocked
58
+ * ---
59
+ *
60
+ * [--days=<days>]
61
+ * : Days interval.
62
+ */
63
+ public function __invoke( $args, $assoc_args ) {
64
+ // Build the method name.
65
+ $method = 'list_' . str_replace( '-', '_', $args[0] );
66
+
67
+ // Check if method exist.
68
+ if ( true !== method_exists( $this, $method ) ) {
69
+ return \WP_CLI::error( 'Non-existing method.' );
70
+ }
71
+
72
+ // Set the custom time period if user has specified it.
73
+ if ( ! empty( $assoc_args ) ) {
74
+ $this->period = intval( $assoc_args['days'] );
75
+ }
76
+
77
+ // Set the interval property.
78
+ $this->interval = time() - 86400 * $this->period;
79
+
80
+ // Set the db property.
81
+ global $wpdb;
82
+ $this->wpdb = $wpdb;
83
+
84
+ // Build the query.
85
+ $this->query = $this->get_query( $args[0] );
86
+
87
+ // Call the Rest Helper Activity to get user-data.
88
+ $this->rest_helper_activity = new Rest_Helper_Activity();
89
+
90
+ // Call the method and send arguments.
91
+ call_user_func( array( $this, $method ) );
92
+ }
93
+
94
+ /**
95
+ * Prepare the query for unknown and registered logs.
96
+ *
97
+ * @since 1.1.0
98
+ *
99
+ * @param string $type The type of log we want.
100
+ *
101
+ * @return string The sql query.
102
+ */
103
+ public function get_query( $type ) {
104
+ global $wpdb;
105
+
106
+ // Bail if table doesn't exist.
107
+ if ( ! Helper::table_exists( $this->wpdb->sgs_log ) ) {
108
+ return false;
109
+ }
110
+
111
+ // Prepare the clauses.
112
+ $select = 'SELECT * FROM ' . $this->wpdb->sgs_log;
113
+ $where = ' WHERE `visitor_type` != "user"';
114
+ $order = ' ORDER BY `ts` DESC;';
115
+
116
+ switch ( $type ) {
117
+ // Set the period for unknown log.
118
+ case 'log-unknown':
119
+ $where .= ' AND `ts` <= ' . time() . ' AND `ts` >= ' . $this->interval;
120
+ break;
121
+ // Change the where clause for registered and add search interval.
122
+ case 'log-registered':
123
+ $where = ' WHERE `visitor_type` = "user" AND `ts` <= ' . time() . ' AND `ts` >= ' . $this->interval;
124
+ break;
125
+ case 'log-blocked':
126
+ $select = 'SELECT * FROM ' . $this->wpdb->sgs_visitors;
127
+ $where = ' WHERE `block` = 1';
128
+ $order = ' ORDER BY `blocked_on` DESC;';
129
+ break;
130
+ }
131
+
132
+ // Return the query.
133
+ return $select . $where . $order;
134
+ }
135
+
136
+ /**
137
+ * List the activity log for unknown visitors.
138
+ *
139
+ * @since 1.1.0
140
+ */
141
+ public function list_log_unknown() {
142
+ // Get the visitors log.
143
+ $visitors = $this->wpdb->get_results( $this->query, ARRAY_A ); // phpcs:ignore
144
+
145
+ $table_data = array();
146
+
147
+ // Format the data and prepare it for printing in the terminal.
148
+ foreach ( $visitors as $visit ) {
149
+ $table_data[] = array(
150
+ 'Timestamp' => get_date_from_gmt( date( 'Y-m-d h:i:s', $visit['ts'] ), 'Y-m-d H:i' ),
151
+ 'Visitor Type' => $visit['visitor_type'],
152
+ 'IP Address' => $visit['ip'],
153
+ 'Page Visited' => $visit['activity'],
154
+ 'Response' => $visit['code'],
155
+ );
156
+ }
157
+
158
+ // Show the logs.
159
+ \WP_CLI\Utils\format_items( 'table', $table_data, array( 'Timestamp', 'Visitor Type', 'IP Address', 'Page Visited', 'Response' ) );
160
+ }
161
+
162
+ /**
163
+ * List the blocked users list.
164
+ *
165
+ * @since 1.1.0
166
+ */
167
+ public function list_log_blocked() {
168
+ // Get the blocked visitors result.
169
+ $results = $this->wpdb->get_results( $this->query, ARRAY_A ); // phpcs:ignore
170
+
171
+ // Get all user visitors from the database.
172
+ $visitors = $this->wpdb->get_results( // phpcs:ignore
173
+ 'SELECT * FROM `' . $this->wpdb->sgs_visitors . '`
174
+ WHERE `user_id` != 0
175
+ ;',
176
+ OBJECT_K
177
+ );
178
+
179
+ // Loop results and get necesary data.
180
+ $data = array();
181
+ foreach ( $results as $entry ) {
182
+ $log = array(
183
+ 'ts' => get_date_from_gmt( date( 'Y-m-d H:i', $entry['blocked_on'] ), 'Y-m-d H:i' ),
184
+ 'user' => $entry['ip'],
185
+ 'visitor_id' => $entry['id'],
186
+ 'object_id' => $entry['user_id'],
187
+ 'type' => 0 == $entry['user_id'] ? 'ip' : 'user',
188
+ );
189
+
190
+ // Check for username.
191
+ if ( ! empty( $entry['user_id'] ) ) {
192
+ $user_data = $this->rest_helper_activity->get_user_data( $log, $visitors );
193
+
194
+ $log['user'] = $user_data['nicename'];
195
+ }
196
+
197
+ // Prepare the data to represent it in the table.
198
+ $data[] = array(
199
+ 'Timestamp' => $log['ts'],
200
+ 'User/IP' => $log['user'],
201
+ );
202
+ }
203
+
204
+ // Show the logs.
205
+ \WP_CLI\Utils\format_items( 'table', $data, array( 'Timestamp', 'User/IP' ) );
206
+ }
207
+
208
+ /**
209
+ * List registered users activity.
210
+ *
211
+ * @since 1.1.0
212
+ */
213
+ public function list_log_registered() {
214
+ // Get user entries.
215
+ $entries = $this->wpdb->get_results( $this->query, ARRAY_A ); // phpcs:ignore
216
+
217
+ // Get visitors data.
218
+ $visitors = $this->wpdb->get_results( // phpcs:ignore
219
+ 'SELECT * FROM `' . $this->wpdb->sgs_visitors . '`
220
+ WHERE `user_id` != 0
221
+ ;',
222
+ OBJECT_K
223
+ );
224
+
225
+ // Populate the data for the table.
226
+ $table_data = array();
227
+ foreach ( $entries as $entry ) {
228
+ // Get the user data.
229
+ $user_data = $this->rest_helper_activity->get_user_data( $entry, $visitors );
230
+
231
+ // Add the data to the table array.
232
+ $table_data[] = array(
233
+ 'Timestamp' => get_date_from_gmt( date( 'Y-m-d H:i', $entry['ts'] ), 'Y-m-d H:i' ),
234
+ 'IP Address' => $entry['ip'],
235
+ 'Activity' => $entry['description'],
236
+ 'Hostname' => $entry['hostname'],
237
+ 'Username' => $user_data['nicename'],
238
+ 'Response' => $entry['code'],
239
+ );
240
+ }
241
+
242
+ // Show the logs.
243
+ \WP_CLI\Utils\format_items( 'table', $table_data, array( 'Timestamp', 'IP Address', 'Activity', 'Hostname', 'Username', 'Response' ) );
244
+ }
245
+ }
core/Cli/Cli_Log.php ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+ /**
6
+ * WP-CLI: wp sg log {setting} value.
7
+ *
8
+ * Run the `wp sg log {setting} {option} {action} {value} {value}` command to change the settgins of specific plugin functionality.
9
+ *
10
+ * @since 1.1.0
11
+ * @package Cli
12
+ * @subpackage Cli/Cli_Log
13
+ */
14
+
15
+ /**
16
+ * Define the {@link Cli_Log} class.
17
+ *
18
+ * @since 1.1.0
19
+ */
20
+ class Cli_Log {
21
+ /**
22
+ * Enable specific setting for SiteGround Security plugin.
23
+ *
24
+ * ## OPTIONS
25
+ *
26
+ * <setting>
27
+ * : Setting name.
28
+ * ---
29
+ * options:
30
+ * - ua
31
+ * - ip
32
+ * ---
33
+ *
34
+ * <action>
35
+ * : Action name.
36
+ * ---
37
+ * options:
38
+ * - add
39
+ * - remove
40
+ * - list
41
+ * <name>
42
+ * : The name.
43
+ * [--ip=<ip>]
44
+ * : The IP.
45
+ */
46
+ public function __invoke( $args, $assoc_args ) {
47
+ // Build the method name.
48
+ $method = $args[0] . '_' . $args[1];
49
+
50
+ // Check if method exist.
51
+ if ( true !== method_exists( $this, $method ) ) {
52
+ return \WP_CLI::error( 'Non-existing method.' );
53
+ }
54
+
55
+ // Set the ip property since it is used for ip only.
56
+ if ( array_key_exists( 'ip', $assoc_args ) ) {
57
+ $this->ip = $assoc_args['ip'];
58
+ }
59
+
60
+ // Call the method and send arguments.
61
+ call_user_func( array( $this, $method ), $args[2] );
62
+ }
63
+
64
+ /**
65
+ * Add ping service to the database.
66
+ *
67
+ * @since 1.1.0
68
+ *
69
+ * @param string $service_name The service name.
70
+ *
71
+ * @return object WP_CLI success/error.
72
+ */
73
+ public function ip_add( $service_name ) {
74
+ // Bail if no IP.
75
+ if ( empty( $this->ip ) ) {
76
+ \WP_CLI::error( 'Please, provide an IP address. Usage wp sg log ip add <name> --ip=<ip>.' );
77
+ }
78
+
79
+ // Bail if the value is not a valid IP address.
80
+ if ( ! filter_var( $this->ip, FILTER_VALIDATE_IP ) ) {
81
+ \WP_CLI::error( 'Please, provide a valid IP address.' );
82
+ }
83
+
84
+ // Get the user ping services.
85
+ $ping_services = get_option( 'sg_security_user_ping_services', array() );
86
+
87
+ // Check if the name alreay exists.
88
+ if ( array_key_exists( $service_name, $ping_services ) ) {
89
+ // Check if the name and ip is in the list.
90
+ if ( in_array( $this->ip, $ping_services[ $service_name ] ) ) {
91
+ return \WP_CLI::success( 'IP and name already in the list.' );
92
+ }
93
+
94
+ // Add the IP to the existing record.
95
+ array_push( $ping_services[ $service_name ], $this->ip );
96
+
97
+ } else {
98
+ // Add the Name and ip to to the services array.
99
+ $ping_services[ $service_name ] = array(
100
+ $this->ip,
101
+ );
102
+ }
103
+
104
+ // Bail with error message if update is not successful.
105
+ if ( false === update_option( 'sg_security_user_ping_services', $ping_services ) ) {
106
+ \WP_CLI::error( 'Error while adding the record to the database.' );
107
+ }
108
+
109
+ return \WP_CLI::success( 'Record added successfully.' );
110
+ }
111
+
112
+ /**
113
+ * Remove ip from the ping services option.
114
+ *
115
+ * @since 1.1.0
116
+ *
117
+ * @param string $service_name The service name.
118
+ *
119
+ * @return object WP_CLI success/error.
120
+ */
121
+ public function ip_remove( $service_name ) {
122
+ // Get the user ping services.
123
+ $ping_services = get_option( 'sg_security_user_ping_services', array() );
124
+
125
+ // Check if the key exists.
126
+ if ( array_key_exists( $service_name, $ping_services ) ) {
127
+ // Search for the array.
128
+ $key = array_search( $this->ip, $ping_services[ $service_name ] );
129
+
130
+ // Check if we have a match with the group and ip.
131
+ if ( false !== $key ) {
132
+ // Remove the value.
133
+ unset( $ping_services[ $service_name ][ $key ] );
134
+ }
135
+
136
+ // Remove the record if no ip's exist in the group.
137
+ if ( empty( $ping_services[ $service_name ] ) ) {
138
+ unset( $ping_services[ $service_name ] );
139
+ }
140
+ }
141
+
142
+ // Bail with error message if update is not successful.
143
+ if ( false === update_option( 'sg_security_user_ping_services', $ping_services ) ) {
144
+ \WP_CLI::error( 'Error while removing the record from the database.' );
145
+ }
146
+
147
+ return \WP_CLI::success( 'Record removed successfully.' );
148
+ }
149
+
150
+ /**
151
+ * Show all list of all ping services.
152
+ *
153
+ * @since 1.1.0
154
+ *
155
+ * @param string $args The service name.
156
+ */
157
+ public function ip_list( $args ) {
158
+ // Check for the magic word.
159
+ if ( 'all' !== $args ) {
160
+ \WP_CLI::error( 'Did you mean: wp sg log ip list all ?' );
161
+ }
162
+
163
+ // Get the values.
164
+ $ping_services = get_option( 'sg_security_user_ping_services', array() );
165
+
166
+ // Create the table data array.
167
+ $table_data = array();
168
+ foreach ( $ping_services as $name => $ip_address ) {
169
+
170
+ // Populate the array.
171
+ $table_data[] = array(
172
+ 'name' => $name,
173
+ 'ip' => implode( ', ', $ip_address ),
174
+ );
175
+ }
176
+
177
+ // Print the table.
178
+ \WP_CLI\Utils\format_items( 'table', $table_data, array( 'name', 'ip' ) );
179
+ }
180
+
181
+ /**
182
+ * Add custom bot by user-agent.
183
+ *
184
+ * @since 1.1.0
185
+ *
186
+ * @param string $user_agent User-agent.
187
+ *
188
+ * @return object WP_CLI success/error.
189
+ */
190
+ public function ua_add( $user_agent ) {
191
+ // Get the user crawlers.
192
+ $crawlers = get_option( 'sg_security_user_crawlers', array() );
193
+
194
+ // Check if user-agent already in the list.
195
+ if ( in_array( $user_agent, $crawlers ) ) {
196
+ \WP_CLI::error( 'User agent already in the list.' );
197
+ }
198
+
199
+ // Add the new crawler to the array.
200
+ $crawlers[] = $user_agent;
201
+
202
+ // Bail with error message if update is not successful.
203
+ if ( false === update_option( 'sg_security_user_crawlers', $crawlers ) ) {
204
+ \WP_CLI::error( 'Error while adding the record to the database.' );
205
+ }
206
+
207
+ return \WP_CLI::success( 'Record added successfully.' );
208
+ }
209
+
210
+ /**
211
+ * Remove custom bot by user-agent.
212
+ *
213
+ * @since 1.1.0
214
+ *
215
+ * @param string $user_agent The service name.
216
+ *
217
+ * @return object WP_CLI success/error.
218
+ */
219
+ public function ua_remove( $user_agent ) {
220
+ // Get the user crawlers.
221
+ $crawlers = get_option( 'sg_security_user_crawlers', array() );
222
+
223
+ // Check if the ua name exists as a record.
224
+ if ( in_array( $user_agent, $crawlers ) ) {
225
+
226
+ // Check if crawler is in the list.
227
+ $key = array_search( $user_agent, $crawlers );
228
+
229
+ if ( false !== $key ) {
230
+ // Remove the value.
231
+ unset( $crawlers[ $key ] );
232
+ }
233
+ }
234
+
235
+ // Bail with error message if update is not successful.
236
+ if ( false === update_option( 'sg_security_user_crawlers', $crawlers ) ) {
237
+ \WP_CLI::error( 'Error while removing the record from the database.' );
238
+ }
239
+
240
+ return \WP_CLI::success( 'Record removed successfully.' );
241
+ }
242
+
243
+ /**
244
+ * Show all list of all crawlers user-agent.
245
+ *
246
+ * @since 1.1.0
247
+ *
248
+ * @param string $args The arguments name.
249
+ */
250
+ public function ua_list( $args ) {
251
+ // Check for the magic word.
252
+ if ( 'all' !== $args ) {
253
+ \WP_CLI::error( 'Did you mean: wp sg log ua list all ?' );
254
+ }
255
+
256
+ // Get the values.
257
+ $crawlers = get_option( 'sg_security_user_crawlers', array() );
258
+
259
+ // Create the table data array.
260
+ $table_data = array();
261
+ foreach ( $crawlers as $key => $user_agent ) {
262
+
263
+ // Populate the array.
264
+ $table_data[] = array(
265
+ 'name' => $user_agent,
266
+ );
267
+ }
268
+
269
+ // Print the table.
270
+ \WP_CLI\Utils\format_items( 'table', $table_data, array( 'name' ) );
271
+ }
272
+ }
core/Cli/Cli_Login_Access.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+
6
+ /**
7
+ * WP-CLI: wp sg login-access {setting} value.
8
+ *
9
+ * Run the `wp sg login-access value` command to add/remove specific IP address in order to allow access to backend.
10
+ *
11
+ * @since 1.0.2
12
+ * @package Cli
13
+ * @subpackage Cli/Cli_Login_Access
14
+ */
15
+
16
+ /**
17
+ * Define the {@link Cli_Login_Access} class.
18
+ *
19
+ * @since 1.0.2
20
+ */
21
+ class Cli_Login_Access {
22
+ /**
23
+ * Enable specific setting for SG Security plugin.
24
+ *
25
+ * ## OPTIONS
26
+ *
27
+ * options:
28
+ * - add
29
+ * - remove
30
+ * - list
31
+ * ---
32
+ * <action>
33
+ * : Setting name.
34
+ * <value>
35
+ * : IP to be whitelisted.
36
+ */
37
+ public function __invoke( $args ) {
38
+ // Bail if no action is provided.
39
+ if ( ! isset( $args[0] ) ) {
40
+ return \WP_CLI::error( 'Please provide an action to list/add/remove.' );
41
+ }
42
+
43
+ switch ( $args[0] ) {
44
+ case 'add':
45
+ $this->add_ip( $args );
46
+ break;
47
+
48
+ case 'remove':
49
+ $this->remove_ip( $args );
50
+ break;
51
+
52
+ case 'list':
53
+ $this->list_ips();
54
+ break;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Adds the provided IP address into the list of IPs that should be allowed to access the backend.
60
+ *
61
+ * @since 1.0.2
62
+ *
63
+ * @param string $args The value that will define the IP that should be allowed to access the backend.
64
+ */
65
+ public function add_ip( $args ) {
66
+ // Bail if a value is not provided.
67
+ if ( ! isset( $args[1] ) ) {
68
+ \WP_CLI::error( 'Please provide an IP address.' );
69
+ }
70
+
71
+ // Bail if the value is not a valid IP address.
72
+ if ( ! $this->filter_ip( $args[1]) ) {
73
+ \WP_CLI::error( 'Please, provide a valid IP address.' );
74
+ }
75
+
76
+ // Bail if the IP address already exists.
77
+ if ( in_array( $args[1], get_option( 'sg_login_access', array() ) ) ) {
78
+ \WP_CLI::error( 'The IP address: ' . $args[1] . ' already exists.' );
79
+ }
80
+
81
+ // Check which are the IPs present at the moment and add them into array.
82
+ $current_ips = get_option( 'sg_login_access', array() );
83
+
84
+ // Add the new IP address to the array.
85
+ array_push( $current_ips, $args[1] );
86
+
87
+ // Push the array into the option.
88
+ update_option( 'sg_login_access', $current_ips );
89
+
90
+ // Confirm that the IP was added successfully.
91
+ \WP_CLI::success( 'The IP address: ' . $args[1] . ' was added successfully.' );
92
+ }
93
+
94
+ /**
95
+ * Removes the provided IP address from the list of IPs that should be allowed to access the backend.
96
+ *
97
+ * @since 1.0.2
98
+ *
99
+ * @param string $args The value that will define the IP that should be removed from the whitelisted IPs.
100
+ */
101
+ public function remove_ip( $args ) {
102
+ // Remove all IP addresses.
103
+ if ( 'all' === $args[1] ) {
104
+
105
+ // Push the array into the option.
106
+ update_option( 'sg_login_access', array() );
107
+
108
+ // Confirm that the IP was removed successfully.
109
+ return \WP_CLI::success( 'All IP addresses were removed successfully.' );
110
+ }
111
+
112
+ // Bail if the value is not a valid IP address.
113
+ if ( ! $this->filter_ip( $args[1]) ) {
114
+ \WP_CLI::error( 'Please, provide a valid IP address.' );
115
+ }
116
+
117
+ // Check which are the IPs present at the moment and add them into an array.
118
+ $current_ips = get_option( 'sg_login_access', array() );
119
+
120
+ // Bail if the IP address is not present.
121
+ if ( ! in_array( $args[1], $current_ips ) ) {
122
+ \WP_CLI::error( 'The IP address: ' . $args[1] . ' does not exist.' );
123
+ }
124
+
125
+ // Find the position of the value in the current IPs and remove it.
126
+ $key = array_search( $args[1], $current_ips );
127
+ unset( $current_ips[ $key ] );
128
+
129
+ // Push the array into the option.
130
+ update_option( 'sg_login_access', $current_ips );
131
+
132
+ // Confirm that the IP was removed successfully.
133
+ \WP_CLI::success( 'The IP address: ' . $args[1] . ' was removed successfully.' );
134
+ }
135
+
136
+ /**
137
+ * Lists all of the IPs that are allowed to access the backend.
138
+ *
139
+ * @since 1.0.2
140
+ */
141
+ public function list_ips() {
142
+ // Check which are the IPs present at the moment and add them into an array.
143
+ $list_arrays = get_option( 'sg_login_access', array() );
144
+
145
+ // Bail if there are no IP addresses present at the moment.
146
+ if ( empty( $list_arrays ) ) {
147
+ return \WP_CLI::error( 'There are no IP addresses present at the moment.' );
148
+ }
149
+
150
+ // Check the current IP addresses and print them out.
151
+ foreach ( $list_arrays as $ips ) {
152
+ echo $ips . "\n"; // phpcs:ignore
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Filter, that checks if the passed variable is a valid IP address.
158
+ *
159
+ * @since 1.2.0
160
+ *
161
+ * @param string $ip The passed IP by the user.
162
+ *
163
+ * @return bool True, if the IP is valid, otherwise - false.
164
+ */
165
+ public function filter_ip( $ip ) {
166
+ // Regex, that validates the IP, including wildcard.
167
+ $ip = explode( '/', $ip );
168
+
169
+ if ( ! filter_var( $ip[0], FILTER_VALIDATE_IP ) ) {
170
+ return false;
171
+ }
172
+
173
+ if ( count( $ip ) > 2 ) {
174
+ return false;
175
+ }
176
+
177
+ if ( isset( $ip[1] ) && ( intval( $ip[1] ) > 32 || intval( $ip[1] ) < 1 || ! is_numeric( $ip[1] ) ) ) {
178
+ return false;
179
+ }
180
+
181
+ return true;
182
+ }
183
+ }
core/Cli/Cli_Secure.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Cli;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+ use SG_Security\Htaccess_Service\Directory_Service;
6
+ use SG_Security\Htaccess_Service\Xmlrpc_Service;
7
+ use SG_Security\Feed_Service\Feed_Service;
8
+ use SG_Security\Loader\Loader;
9
+
10
+ /**
11
+ * WP-CLI: wp sg secure {option} enable/disable.
12
+ *
13
+ * Run the `wp sg secure {option} enable/disable` command to enable/disable specific plugin functionality.
14
+ *
15
+ * @since 1.0.2
16
+ * @package Cli
17
+ * @subpackage Cli/Cli_Secure
18
+ */
19
+
20
+ /**
21
+ * Define the {@link Cli_Secure} class.
22
+ *
23
+ * @since 1.0.2
24
+ */
25
+ class Cli_Secure {
26
+ /**
27
+ * Enable specific optimization for SG Security plugin.
28
+ *
29
+ * ## OPTIONS
30
+ *
31
+ * <optimization>
32
+ * : Optimization name.
33
+ * ---
34
+ * options:
35
+ * - protect-system-folders
36
+ * - hide-wordpress-version
37
+ * - plugins-themes-editor
38
+ * - xml-rpc
39
+ * - rss-atom-feed
40
+ * - xss-protection
41
+ * - 2fa
42
+ * - disable-admin-user
43
+ * ---
44
+ * <action>
45
+ * : The action: enable\disable.
46
+ * Whether to enable or disable the optimization.
47
+ */
48
+ public function __invoke( $args ) {
49
+ // Bail if no action is provided.
50
+ if ( ! isset( $args[0] ) ) {
51
+ return \WP_CLI::error( 'Please choose between enable and disable' );
52
+ }
53
+
54
+ switch ( $args[0] ) {
55
+ case 'protect-system-folders':
56
+ case 'xml-rpc':
57
+ return $this->htaccess_secure( $args );
58
+ case 'xss-protection':
59
+ case 'rss-atom-feed':
60
+ case 'hide-wordpress-version':
61
+ case 'plugins-themes-editor':
62
+ case '2fa':
63
+ case 'disable-admin-user':
64
+ return $this->optimize( $args );
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Enables/Disables the option in the database.
70
+ *
71
+ * @since 1.0.2
72
+ *
73
+ * @param string $args A string that contains the option and the action which should be taken.
74
+ */
75
+ public function optimize( $args ) {
76
+
77
+ $mapping = array(
78
+ 'protect-system-folders' => 'lock_system_folders',
79
+ 'hide-wordpress-version' => 'wp_remove_version',
80
+ 'plugins-themes-editor' => 'disable_file_edit',
81
+ 'xml-rpc' => 'disable_xml_rpc',
82
+ 'rss-atom-feed' => 'disable_feed',
83
+ 'xss-protection' => 'xss_protection',
84
+ '2fa' => 'sg2fa',
85
+ 'disable-admin-user' => 'disable_usernames',
86
+ );
87
+
88
+ // Check the input of the user and proceed depending on the option.
89
+ switch ( $args[1] ) {
90
+ case 'enable':
91
+ $result = Options_Service::enable_option( $mapping[ $args[0] ] );
92
+ break;
93
+
94
+ case 'disable':
95
+ $result = Options_Service::change_option( $mapping[ $args[0] ], 0 );
96
+ break;
97
+
98
+ default:
99
+ \WP_CLI::error( 'There is an issue with changing the status of ' . $args[0] . '. Please check your command.' );
100
+ break;
101
+ }
102
+
103
+ // Bail if there is an error.
104
+ if ( 0 === $result ) {
105
+ return \WP_CLI::error( 'There is an issue with changing the status of ' . $args[0] );
106
+ }
107
+
108
+ // Confirm the successful change.
109
+ \WP_CLI::success( $args[0] . ' was ' . $args[1] . 'd succesfully!' );
110
+ }
111
+
112
+ public function htaccess_secure( $args ) {
113
+ $classes = array(
114
+ 'protect-system-folders' => 'Directory_Service',
115
+ 'xml-rpc' => 'Xmlrpc_Service',
116
+ );
117
+
118
+ $class_name = 'SG_Security\Htaccess_Service\\' . $classes[ $args[0] ];
119
+
120
+ $class = new $class_name();
121
+
122
+ // Disables the protection.
123
+ if ( 'disable' === $args[1] ) {
124
+ $class->toggle_rules( 0 );
125
+ } else {
126
+ // Enables the protection.
127
+ $class->toggle_rules( 1 );
128
+ }
129
+
130
+ // Update option in database.
131
+ $this->optimize( $args );
132
+ }
133
+ }
core/Custom_Login_Url/Custom_Login_Url.php ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Custom_Login_Url;
3
+
4
+ use SG_Security\Helper\Helper;
5
+ use SiteGround_Helper\Helper_Service;
6
+
7
+ /**
8
+ * Custom_Login_Url class which disable the WordPress feed.
9
+ */
10
+ class Custom_Login_Url {
11
+
12
+ /**
13
+ * Sg Security token
14
+ *
15
+ * @var string
16
+ */
17
+ private $token = 'sgs-token';
18
+
19
+ /**
20
+ * User Options
21
+ *
22
+ * @var array
23
+ */
24
+ private $options = array();
25
+
26
+ /**
27
+ * The Constructor
28
+ *
29
+ * @since 1.1.0
30
+ */
31
+ public function __construct() {
32
+ // Set the required options.
33
+ $this->options = array(
34
+ 'new_slug' => get_option( 'sg_security_login_url', 'login' ),
35
+ 'redirect' => get_option( 'sg_security_login_redirect', '404' ),
36
+ 'register' => get_option( 'sg_security_login_register', 'register' ),
37
+ );
38
+ }
39
+
40
+ /**
41
+ * Change the site url to include the custom login url token,
42
+ *
43
+ * @param string $url The URL to be filtered.
44
+ * @param string $path The URL path.
45
+ */
46
+ public function change_site_url( $url, $path = null ) {
47
+ $token = '';
48
+
49
+ $path = is_null( $path ) ? $url : $path;
50
+
51
+ // Get the url path.
52
+ $path = Helper::get_url_path( $path ); //phpcs:ignore
53
+
54
+ preg_match( '~^(.*)\/(wp-login.php)(?:.*)?[\?|&]action=(.*?)(?:\?|&|$)~', $path, $matches );
55
+
56
+ if ( empty( $matches[2] ) ) {
57
+ return $url;
58
+ }
59
+
60
+ if ( empty( $matches[3] ) ) {
61
+ return $url;
62
+ }
63
+
64
+ switch ( $matches[3] ) {
65
+ case 'postpass':
66
+ return $url;
67
+ case 'register':
68
+ $token = 'register';
69
+ break;
70
+ case 'rp':
71
+ $token = 'login';
72
+ return $url;
73
+ }
74
+
75
+ // Add the token to the url if not empty.
76
+ if ( empty( $token ) ) {
77
+ return $url;
78
+ }
79
+
80
+ // Return the url.
81
+ return add_query_arg( $this->token, urlencode( $token ), $url );
82
+ }
83
+
84
+ /**
85
+ * Change the links to the login page in the emails sent to the user.
86
+ *
87
+ * @since 1.1.0
88
+ *
89
+ * @param string $message The email message.
90
+ *
91
+ * @return string Modified message.
92
+ */
93
+ public function change_email_links( $message ) {
94
+ return str_replace( 'wp-login.php', trailingslashit( $this->options['new_slug'] ), $message );
95
+ }
96
+
97
+ /**
98
+ * Handle request paths.
99
+ *
100
+ * @since 1.1.0
101
+ */
102
+ public function handle_request() {
103
+ // Get the path.
104
+ $path = Helper::get_url_path( $_SERVER['REQUEST_URI'] ); //phpcs:ignore
105
+
106
+ if ( $path === $this->options['new_slug'] ) {
107
+ $this->redirect_with_token( 'login', 'wp-login.php' );
108
+ }
109
+
110
+ if ( in_array( $path, array( 'wp-login', 'wp-login.php' ) ) ) {
111
+ $this->handle_login();
112
+ }
113
+
114
+ if ( $path === $this->options['register'] ) {
115
+ $this->handle_registration();
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Handle user logout.
121
+ *
122
+ * @since 1.1.1
123
+ *
124
+ * @param int $user_id The user ID.
125
+ */
126
+ public function wp_logout( $user_id ) {
127
+ // Bail if the user has valid permission cookie.
128
+ if ( $this->is_valid( 'login' ) ) {
129
+ return;
130
+ }
131
+
132
+ // Redirect to the homepage on logout instead redirecting to 404.
133
+ wp_redirect( home_url() );
134
+ exit;
135
+ }
136
+
137
+ /**
138
+ * Adds a token and redirect to the url.
139
+ *
140
+ * @since 1.1.0
141
+ *
142
+ * @param string $type The type of request to add an access token for.
143
+ * @param string $path The path to redirect to.
144
+ */
145
+ private function redirect_with_token( $type, $path ) {
146
+ // Set the cookie so that access via unknown integrations works more smoothly.
147
+ $this->set_permissions_cookie( $type );
148
+
149
+ // Preserve existing query vars and add access token query arg.
150
+ $query_vars = $_GET;
151
+ $query_vars[ $this->token ] = $this->options['new_slug'];
152
+
153
+ $url = add_query_arg( $query_vars, site_url( $path ) );
154
+
155
+ wp_redirect( $url );
156
+ exit;
157
+ }
158
+
159
+ /**
160
+ * Handle login.
161
+ *
162
+ * @since 1.1.0
163
+ */
164
+ private function handle_login() {
165
+ $action = isset( $_GET['action'] ) ? $_GET['action'] : '';
166
+
167
+ if ( 'rp' === $action ) {
168
+ return;
169
+ }
170
+
171
+ if ( 'postpass' === $action ) {
172
+ return;
173
+ }
174
+
175
+ if ( 'register' === $action ) {
176
+ if ( 'wp-signup.php' !== $this->options['register'] ) {
177
+ $this->block( 'register' );
178
+ }
179
+
180
+ return;
181
+ }
182
+
183
+ if (
184
+ has_filter( 'login_form_jetpack_json_api_authorization' ) &&
185
+ 'jetpack_json_api_authorization' === $action
186
+ ) {
187
+ return;
188
+ }
189
+
190
+ if ( 'jetpack-sso' === $action && has_filter( 'login_form_jetpack-sso' ) ) {
191
+ // Jetpack's SSO redirects from wordpress.com to wp-login.php on the site. Only allow this process to
192
+ // continue if they successfully log in, which should happen by login_init in Jetpack which happens just
193
+ // before this action fires.
194
+ add_action( 'login_form_jetpack-sso', array( $this, 'block' ) );
195
+
196
+ return;
197
+ }
198
+
199
+ $this->block( 'login' );
200
+ }
201
+
202
+ /**
203
+ * Block a request to the page.
204
+ *
205
+ * @since 1.1.0
206
+ *
207
+ * @param string $type The block request type.
208
+ */
209
+ private function block( $type = 'login' ) {
210
+ if ( is_user_logged_in() || $this->is_valid( $type ) ) {
211
+ return;
212
+ }
213
+
214
+ // Die if there is no 404 page.
215
+ if ( empty( $this->options['redirect'] ) ) {
216
+ wp_die(
217
+ esc_html__( 'This feature has been disabled.', 'sg-security' ),
218
+ esc_html__( 'Restricted access', 'sg-security' ),
219
+ array(
220
+ 'sgs_error' => true,
221
+ 'response' => 403,
222
+ )
223
+ );
224
+ }
225
+
226
+ // Redirect to 404 page.
227
+ wp_redirect( Helper_Service::get_home_url() . $this->options['redirect'], 302 );
228
+ exit;
229
+ }
230
+
231
+ /**
232
+ * Checks if the user has permissions to view a page.
233
+ *
234
+ * @since 1.1.0
235
+ *
236
+ * @param string $type The permission type.
237
+ *
238
+ * @return boolean True/False.
239
+ */
240
+ private function is_valid( $type ) {
241
+ $cookie = $this->token . '-' . $type . '-' . COOKIEHASH;
242
+
243
+ // Check if the validation cookie is set.
244
+ if (
245
+ isset( $_COOKIE[ $cookie ] ) &&
246
+ $_COOKIE[ $cookie ] === $this->options['new_slug'] //phpcs:ignore
247
+ ) {
248
+ return true;
249
+ }
250
+
251
+ // Check if the token value is set.
252
+ if (
253
+ isset( $_REQUEST[ $this->token ] ) &&
254
+ $_REQUEST[ $this->token ] === $this->options['new_slug']
255
+ ) {
256
+ // Add the permissions cookie.
257
+ $this->set_permissions_cookie( $type );
258
+
259
+ return true;
260
+ }
261
+
262
+ return false;
263
+ }
264
+
265
+ /**
266
+ * Set a cookie which will be used to check if the user has permissions to view a page.
267
+ *
268
+ * @since 1.1.0
269
+ *
270
+ * @param string $type The permissions type.
271
+ */
272
+ private function set_permissions_cookie( $type ) {
273
+ $url_parts = parse_url( Helper_Service::get_site_url() );
274
+ $home_path = trailingslashit( $url_parts['path'] );
275
+
276
+ setcookie(
277
+ $this->token . '-' . $type . '-' . COOKIEHASH,
278
+ $this->options['new_slug'],
279
+ time() + 3600,
280
+ $home_path,
281
+ COOKIE_DOMAIN,
282
+ is_ssl(),
283
+ true
284
+ );
285
+ }
286
+
287
+ /**
288
+ * Handle regostration request.
289
+ *
290
+ * @since 1.1.0
291
+ */
292
+ private function handle_registration() {
293
+ // Check if registration is allowed.
294
+ if ( 1 !== intval( get_option( 'users_can_register', 0 ) ) ) {
295
+ return;
296
+ }
297
+
298
+ if ( empty( get_option( 'users_can_register' ) ) ) {
299
+ return;
300
+ }
301
+
302
+ $this->set_permissions_cookie( 'login' );
303
+
304
+ if ( is_multisite() ) {
305
+ $this->redirect_with_token( 'register', 'wp-signup.php' );
306
+ }
307
+
308
+ $this->redirect_with_token( 'register', 'wp-login.php?action=register' );
309
+ }
310
+
311
+ /**
312
+ * Handle change in user registration option.
313
+ *
314
+ * @since 1.1.0
315
+ *
316
+ * @param (mixed) $old_value The old option value.
317
+ * @param (mixed) $new_value The new option value.
318
+ *
319
+ * @return mixed The new value.
320
+ */
321
+ public function handle_user_registration_change( $old_value, $new_value ) {
322
+ if ( ! empty( get_option( 'sg_security_login_register', false ) ) ) {
323
+ return $new_value;
324
+ }
325
+
326
+ if ( 1 === intval( $new_value ) ) {
327
+ update_option( 'sg_security_show_signup_notice', 1 );
328
+ }
329
+
330
+ return $new_value;
331
+ }
332
+
333
+ /**
334
+ * Displays an admin notice that additional backup codes have been generated.
335
+ *
336
+ * @since 1.1.0
337
+ */
338
+ public function show_notices() {
339
+ // Bail if we shold not show the notice.
340
+ if ( empty( get_option( 'sg_security_show_signup_notice', false ) ) ) {
341
+ return;
342
+ }
343
+
344
+ printf(
345
+ '<div class="notice notice-error" style="position: relative"><p>%1$s</p><button type="button" class="notice-dismiss dismiss-sg-security-notice" data-link="%2$s"><span class="screen-reader-text">Dismiss this notice.</span></button></div>',
346
+ __( 'You have enabled registration for your site, please <a href="' . admin_url( 'admin.php?page=login-settings' ) . '">select a custom registration URL</a>.', 'sg-security' ), // phpcs:ignore
347
+ admin_url( 'admin-ajax.php?action=dismiss_sg_security_notice&notice=show_signup_notice' ) // phpcs:ignore
348
+ );
349
+ }
350
+
351
+ /**
352
+ * Dismiss notice handle.
353
+ *
354
+ * @since 1.1.0
355
+ */
356
+ public function dismiss_backup_codes_notice() {
357
+ $current_user = wp_get_current_user();
358
+
359
+ delete_user_meta( $current_user->data->ID, 'sgs_additional_codes_added' ); //phpcs:ignore
360
+ }
361
+
362
+ /**
363
+ * Hide notices.
364
+ *
365
+ * @since 1.1.0
366
+ */
367
+ public function hide_notice() {
368
+ if ( empty( $_GET['notice'] ) ) {
369
+ return;
370
+ }
371
+
372
+ update_option( 'sg_security_' . $_GET['notice'], 0 ); // phpcs:ignore
373
+
374
+ wp_send_json_success();
375
+ }
376
+
377
+ /**
378
+ * Adds the login token to the confirmation url.
379
+ *
380
+ * @since 1.1.1
381
+ *
382
+ * @param string $content The email content.
383
+ * @param array $email_data Data relating to the account action email.
384
+ *
385
+ * @return string Modified content.
386
+ */
387
+ public function change_email_confirmation_url( $content, $email_data ) {
388
+ // Bail if the request is not personal data removal.
389
+ if (
390
+ 'remove_personal_data' !== $email_data['request']->action_name &&
391
+ 'export_personal_data' !== $email_data['request']->action_name
392
+ ) {
393
+ return $content;
394
+ }
395
+
396
+ // Add the login token to the GDPR confirmation url.
397
+ $confirm_url = add_query_arg(
398
+ $this->token,
399
+ $this->options['new_slug'],
400
+ $email_data['confirm_url']
401
+ );
402
+
403
+ return str_replace(
404
+ '###CONFIRM_URL###',
405
+ esc_url_raw( $confirm_url ),
406
+ $content
407
+ );
408
+ }
409
+
410
+ /**
411
+ * Modify the WPDiscuz comment post login URL.
412
+ *
413
+ * @since 1.2.0
414
+ *
415
+ * @param string $login HTML code returned by the wpdiscuz_login_link filter.
416
+ *
417
+ * @return string $login modified HTML code with the SGS token added to the login link.
418
+ */
419
+ public function custom_login_for_wpdiscuz( $login ) {
420
+ // Get the login URL from the HTML.
421
+ preg_match( '/<a\s+(?:[^>]*?\s+)?href=(["])(.*?)\1/', $login, $match );
422
+
423
+ // Add the token to it.
424
+ $new_url = add_query_arg( $this->token, $this->options['new_slug'], $match[2] );
425
+
426
+ // Replace the URL in the HTML.
427
+ $login = str_replace( $match[2], $new_url, $login);
428
+
429
+ // Return the updated HTML.
430
+ return $login;
431
+ }
432
+ }
core/Deactivator/Deactivator.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Deactivator;
3
+
4
+ use SG_Security\Htaccess_Service\Directory_Service;
5
+ use SG_Security\Htaccess_Service\Xmlrpc_Service;
6
+ use SG_Security\Activity_Log\Activity_Log_Weekly_Emails;
7
+
8
+ /**
9
+ * Class that manages plugin deactivation.
10
+ */
11
+ class Deactivator {
12
+
13
+ /**
14
+ * Run on plugin deactivation.
15
+ *
16
+ * @since 1.0.0
17
+ */
18
+ public function deactivate() {
19
+ // Disable any existing rules for directory hardening.
20
+ $directory_service = new Directory_Service();
21
+ $directory_service->toggle_rules( 0 );
22
+
23
+ // Disable the XML-RPC rules.
24
+ $xml_rpc_service = new Xmlrpc_Service();
25
+ $xml_rpc_service->toggle_rules( 0 );
26
+
27
+ // Delete the Weekly Emails Cron Job.
28
+ $weekly_emails = new Activity_Log_Weekly_Emails();
29
+
30
+ if ( wp_next_scheduled( 'sgs_email_cron' ) ) {
31
+ $weekly_emails->weekly_report_email->unschedule_event();
32
+ }
33
+ }
34
+ }
core/Editors_Service/Editors_Service.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Editors_Service;
3
+
4
+ /**
5
+ * Editor_Service class which disables in-built theme and plugin editors.
6
+ */
7
+ class Editors_Service {
8
+
9
+ /**
10
+ * Disable the in-built theme and plugin editors for all users.
11
+ *
12
+ * @since 1.0.0
13
+ *
14
+ * @param string[] $caps Primitive capabilities required of the user.
15
+ * @param string $cap Capability being checked.
16
+ */
17
+ public function disable_file_edit( $caps, $cap ) {
18
+ if ( in_array( $cap, array( 'edit_themes', 'edit_plugins', 'edit_files' ) ) ) {
19
+ return array( 'sg-security' );
20
+ }
21
+
22
+ return $caps;
23
+ }
24
+ }
core/Feed_Service/Feed_Service.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Feed_Service;
3
+
4
+ /**
5
+ * Feed_Service class which disable the WordPress feed.
6
+ */
7
+ class Feed_Service {
8
+
9
+ /**
10
+ * Disables the WordPress feed.
11
+ *
12
+ * @since 1.0.0
13
+ */
14
+ public function disable_feed() {
15
+ wp_redirect( esc_url( home_url( '/' ) ) );
16
+ }
17
+ }
core/Headers_Service/Headers_Service.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Headers_Service;
3
+
4
+ /**
5
+ * Headers_Service class which adds response headers to the WordPress app.
6
+ */
7
+ class Headers_Service {
8
+
9
+ /**
10
+ * The security headers array, containing the specific options and headers.
11
+ *
12
+ * @var array
13
+ */
14
+ public $headers = array(
15
+ 'xss_protection' => array(
16
+ 'X-Content-Type-Options' => 'nosniff',
17
+ 'X-XSS-Protection' => '1; mode=block',
18
+ ),
19
+ );
20
+
21
+ /**
22
+ * The security headers that need to be added.
23
+ *
24
+ * @var array
25
+ */
26
+ public $security_headers;
27
+
28
+ /**
29
+ * The constructor.
30
+ */
31
+ public function __construct() {
32
+ $this->security_headers = $this->prepare_headers();
33
+ }
34
+
35
+ /**
36
+ * Set the necesery security headers.
37
+ *
38
+ * @since 1.2.1
39
+ *
40
+ * @param array $headers Associative array of headers to be sent.
41
+ */
42
+ public function set_security_headers( $headers ) {
43
+ // Bail if no headers to add.
44
+ if ( empty( $this->security_headers ) ) {
45
+ return $headers;
46
+ }
47
+
48
+ // Loop and modify the headers.
49
+ foreach ( $this->security_headers as $header_key => $header_value ) {
50
+ $headers[ $header_key ] = $header_value;
51
+ }
52
+
53
+ // Return the headers array.
54
+ return $headers;
55
+ }
56
+
57
+ /**
58
+ * Set the necesary security headers for the rest api.
59
+ *
60
+ * @since 1.2.1
61
+ *
62
+ * @param WP_HTTP_Response $result Result to send to the client. Usually a WP_REST_Response.
63
+ */
64
+ public function set_rest_security_headers( $result ) {
65
+ // Return result if no headers to add.
66
+ if ( empty( $this->security_headers ) ) {
67
+ return $result;
68
+ }
69
+
70
+ // Add the specified headers.
71
+ foreach ( $this->security_headers as $header_key => $header_value ) {
72
+ $result->header( $header_key, $header_value );
73
+ }
74
+
75
+ // Return the result to the user.
76
+ return $result;
77
+ }
78
+
79
+ /**
80
+ * Prepare the headers.
81
+ *
82
+ * @since 1.2.1
83
+ *
84
+ * @return array $prepared_headers The security headers we need to add.
85
+ */
86
+ public function prepare_headers() {
87
+ $headers = array();
88
+
89
+ // Loop trough all headers.
90
+ foreach ( $this->headers as $header_option => $security_headers ) {
91
+
92
+ // Check if the security optimization is enabled.
93
+ if ( 1 !== (int) get_option( 'sg_security_' . $header_option, 0 ) ) {
94
+ continue;
95
+ }
96
+
97
+ // Add the header to the array if optimization enabled.
98
+ foreach ( $security_headers as $header_key => $header_value ) {
99
+ $headers[ $header_key ] = $header_value;
100
+ }
101
+ }
102
+
103
+ return $headers;
104
+ }
105
+ }
core/Helper/Helper.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Helper;
3
+
4
+ use SG_Security;
5
+ use SiteGround_Helper\Helper_Service;
6
+ use SG_Security\Salt_Shaker\Salt_Shaker;
7
+ use \WP_Session_Tokens;
8
+
9
+ /**
10
+ * Helper functions and main initialization class.
11
+ */
12
+ class Helper {
13
+
14
+ /**
15
+ * Get the current user's IP address.
16
+ *
17
+ * @since 1.0.0
18
+ *
19
+ * @return string The users's IP.
20
+ */
21
+ public static function get_current_user_ip() {
22
+ // Bail if the key doesn't exists or IP not valid.
23
+ if (
24
+ ! isset( $_SERVER['REMOTE_ADDR'] ) ||
25
+ ! filter_var( $_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP )
26
+ ) {
27
+ // Return the local IP by default.
28
+ return '127.0.0.1';
29
+ }
30
+
31
+ // Return the users's IP Address.
32
+ return preg_replace( '/^::1$/', '127.0.0.1', $_SERVER['REMOTE_ADDR'] ); //phpcs:ignore
33
+ }
34
+
35
+ /**
36
+ * Sets the server IP address.
37
+ *
38
+ * @since 1.1.0
39
+ */
40
+ public static function set_server_ip() {
41
+ update_option( 'sg_security_server_address', \gethostbyname( \gethostname() ) );
42
+ }
43
+
44
+ /**
45
+ * Get the path without home url path.
46
+ *
47
+ * @since 1.0.0
48
+ *
49
+ * @param string $url The URL.
50
+ *
51
+ * @return string The URL path.
52
+ */
53
+ public static function get_url_path( $url ) {
54
+ // Get the site url parts.
55
+ $url_parts = parse_url( Helper_Service::get_site_url() );
56
+ // Get the home path.
57
+ $home_path = ! empty( $url_parts['path'] ) ? trailingslashit( $url_parts['path'] ) : '/';
58
+
59
+ // Remove the query args from the url.
60
+ $url = explode( '?', preg_replace( '|//+|', '/', $url ) );
61
+ // Get the url path.
62
+ $path = parse_url( $url[0], PHP_URL_PATH );
63
+ // Return the path without home path.
64
+ return str_replace( $home_path, '', $path );
65
+
66
+ }
67
+
68
+ /**
69
+ * Set custom wp_die callback.
70
+ *
71
+ * @since 1.1.0
72
+ *
73
+ * @return array Array with the callable function for our custom wp_die.
74
+ */
75
+ public function custom_wp_die_handler() {
76
+ return array( $this, 'custom_wp_die_callback' );
77
+ }
78
+
79
+ /**
80
+ * Custom wp_die callback.
81
+ *
82
+ * @since 1.1.0
83
+ *
84
+ * @param string $message The error message.
85
+ * @param string $title The error title.
86
+ * @param array $args Array with additional args.
87
+ */
88
+ public function custom_wp_die_callback( $message, $title, $args ) {
89
+ // Call the default wp_die_handler if the custom param is not set or a WP_Error object is present.
90
+ if ( is_object( $message ) || empty( $args['sgs_error'] ) ) {
91
+ _default_wp_die_handler( $message, $title, $args );
92
+ }
93
+
94
+ // Include the error template.
95
+ include SG_Security\DIR . '/templates/error.php';
96
+ exit;
97
+ }
98
+
99
+ /**
100
+ * Checks if the table exists in the database.
101
+ *
102
+ * @since 1.2.0
103
+ *
104
+ * @param string $table_name The name of the table
105
+ *
106
+ * @return boolean True/False.
107
+ */
108
+ public static function table_exists( $table_name ) {
109
+ global $wpdb;
110
+
111
+ // Bail if table doesn't exist.
112
+ if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) {
113
+ return false;
114
+ }
115
+
116
+ return true;
117
+ }
118
+
119
+ /**
120
+ * Force user logout.
121
+ *
122
+ * @since 1.2.2
123
+ */
124
+ public function logout_users() {
125
+ // Init the salt shaker
126
+ $this->salt_shaker = new Salt_Shaker();
127
+
128
+ // Change salts
129
+ $this->salt_shaker->change_salts();
130
+
131
+ // Destroy all sessions.
132
+ WP_Session_Tokens::destroy_all_for_all_users();
133
+ }
134
+
135
+ /**
136
+ * Encrypt data method.
137
+ *
138
+ * @since 1.2.4
139
+ *
140
+ * @param string $data The string we will encrypt.
141
+ * @param string $key The string used for encryption key.
142
+ *
143
+ * @return string The encrypted data.
144
+ */
145
+ public static function sgs_encrypt( $data, $key ) {
146
+ // Remove the base64 encoding from our key.
147
+ $encryption_key = base64_decode( $key . AUTH_SALT );
148
+
149
+ // Define cipher and generate an initialization vector.
150
+ $cipher = 'AES-256-CBC';
151
+ $ivlen = openssl_cipher_iv_length( $cipher );
152
+ $iv = openssl_random_pseudo_bytes( $ivlen );
153
+
154
+ $raw_value = openssl_encrypt( implode( '|', $data ), $cipher, $encryption_key, OPENSSL_RAW_DATA, $iv );
155
+
156
+ // Return the encrypted data.
157
+ return base64_encode( $iv . $raw_value );
158
+ }
159
+
160
+ /**
161
+ * Decrypt data method.
162
+ *
163
+ * @since 1.2.4
164
+ *
165
+ * @param string $data The string we will decrypt.
166
+ * @param string $key The string used as an encryption key.
167
+ *
168
+ * @return string The decrypted data.
169
+ */
170
+ public static function sgs_decrypt( $data, $key ) {
171
+ // Remove the base64 encoding from our data.
172
+ $raw_value = base64_decode( $data, true );
173
+
174
+ // Remove the base64 encoding from our key.
175
+ $encryption_key = base64_decode( $key . AUTH_SALT );
176
+
177
+ // Define cipher and get the initialization vector.
178
+ $cipher = 'AES-256-CBC';
179
+ $ivlen = openssl_cipher_iv_length( $cipher );
180
+ $iv = substr( $raw_value, 0, $ivlen );
181
+
182
+ $raw_value = substr( $raw_value, $ivlen );
183
+
184
+ // Return the decrypted data.
185
+ $decrypted = openssl_decrypt( $raw_value, 'AES-256-CBC', $encryption_key, OPENSSL_RAW_DATA, $iv );
186
+
187
+ return explode( '|', $decrypted );
188
+ }
189
+ }
core/Htaccess_Service/Abstract_Htaccess_Service.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Htaccess_Service;
3
+
4
+ use SG_Security;
5
+ use SiteGround_Helper\Helper_Service;
6
+
7
+ /**
8
+ * SG Security Abstract_Htaccess_Service main plugin class.
9
+ */
10
+ abstract class Abstract_Htaccess_Service {
11
+
12
+ /**
13
+ * WordPress filesystem.
14
+ *
15
+ * @since 1.0.0
16
+ *
17
+ * @access private
18
+ *
19
+ * @var The WP Filesystem.
20
+ */
21
+ protected $wp_filesystem = null;
22
+
23
+ /**
24
+ * Path to htaccess file.
25
+ *
26
+ * @since 1.0.0
27
+ *
28
+ * @access private
29
+ *
30
+ * @var string The path to htaccess file.
31
+ */
32
+ public $path = null;
33
+
34
+ /**
35
+ * The singleton instance.
36
+ *
37
+ * @since 1.0.0
38
+ *
39
+ * @var \Abstract_Htaccess_Service The singleton instance.
40
+ */
41
+ public static $instance;
42
+
43
+ /**
44
+ * The constructor.
45
+ *
46
+ * @since 1.0.0
47
+ */
48
+ public function __construct() {
49
+ if ( null === $this->wp_filesystem ) {
50
+ $this->wp_filesystem = Helper_Service::setup_wp_filesystem();
51
+ }
52
+
53
+ self::$instance = $this;
54
+ }
55
+
56
+ /**
57
+ * Get the singleton instance.
58
+ *
59
+ * @since 1.0.0
60
+ *
61
+ * @return \Abstract_Htaccess_Service The singleton instance.
62
+ */
63
+ public static function get_instance() {
64
+ return self::$instance;
65
+ }
66
+
67
+ /**
68
+ * Set the htaccess path.
69
+ *
70
+ * @since 1.0.0
71
+ */
72
+ public function set_htaccess_path() {
73
+ $filepath = $this->get_filepath();
74
+
75
+ // Create the htaccess if it doesn't exists.
76
+ if ( ! is_file( $filepath ) ) {
77
+ $this->wp_filesystem->touch( $filepath );
78
+ }
79
+
80
+ // Bail if it isn't writable.
81
+ if ( ! $this->wp_filesystem->is_writable( $filepath ) ) {
82
+ return false;
83
+ }
84
+
85
+ // Finally set the path.
86
+ $this->path = $filepath;
87
+ }
88
+
89
+ /**
90
+ * Disable the rule and remove it from the htaccess.
91
+ *
92
+ * @since 1.0.0
93
+ *
94
+ * @return bool True on success, false otherwise.
95
+ */
96
+ public function disable() {
97
+ // Bail if htaccess doesn't exists.
98
+ if ( empty( $this->path ) ) {
99
+ return false;
100
+ }
101
+
102
+ // Bail if the rule is already disabled.
103
+ if ( ! $this->is_enabled() ) {
104
+ return true;
105
+ }
106
+
107
+ // Get the content of htaccess.
108
+ $content = $this->wp_filesystem->get_contents( $this->path );
109
+
110
+ // Remove the rule.
111
+ $new_content = preg_replace( $this->rules['disabled'], '', $content );
112
+
113
+ return $this->lock_and_write( $new_content );
114
+ }
115
+
116
+ /**
117
+ * Add rule to htaccess and enable it.
118
+ *
119
+ * @since 1.0.0
120
+ *
121
+ * @return bool True on success, false otherwise.
122
+ */
123
+ public function enable() {
124
+ // Bail if htaccess doesn't exists.
125
+ if ( empty( $this->path ) ) {
126
+ return false;
127
+ }
128
+
129
+ // Bail if the rule is already enabled.
130
+ if ( $this->is_enabled() ) {
131
+ return true;
132
+ }
133
+
134
+ // Disable all other rules first.
135
+ $content = preg_replace(
136
+ $this->rules['disable_all'],
137
+ '',
138
+ $this->wp_filesystem->get_contents( $this->path )
139
+ );
140
+
141
+ // Get the new rule.
142
+ $new_rule = $this->wp_filesystem->get_contents( SG_Security\DIR . '/templates/' . $this->template );
143
+
144
+ // Add the rule and write the new htaccess.
145
+ $content = $new_rule . PHP_EOL . $content;
146
+
147
+ // Whitelist files if the service has any.
148
+ $content = $this->do_replacement( $content );
149
+
150
+ // Return the result.
151
+ return $this->lock_and_write( $content );
152
+ }
153
+
154
+ /**
155
+ * Lock file and write something in it.
156
+ *
157
+ * @since 1.0.0
158
+ *
159
+ * @param string $content Content to add.
160
+ *
161
+ * @return bool True on success, false otherwise.
162
+ */
163
+ protected function lock_and_write( $content ) {
164
+ $fp = fopen( $this->path, 'w+' );
165
+
166
+ if ( flock( $fp, LOCK_EX ) ) {
167
+ fwrite( $fp, $content );
168
+ flock( $fp, LOCK_UN );
169
+ fclose( $fp );
170
+ return true;
171
+ }
172
+
173
+ fclose( $fp );
174
+ return false;
175
+ }
176
+
177
+ /**
178
+ * Do a replacement.
179
+ *
180
+ * @since 1.0.0
181
+ *
182
+ * @param string $content The htaccess content.
183
+ *
184
+ * @return string New htaccess content with replacement.
185
+ */
186
+ public function do_replacement( $content ) {
187
+ return $content;
188
+ }
189
+
190
+ /**
191
+ * Get the filepath to the htaccess.
192
+ *
193
+ * @since 1.0.0
194
+ *
195
+ * @return string Path to the htaccess.
196
+ */
197
+ public function get_filepath() {
198
+ return $this->wp_filesystem->abspath() . '.htaccess';
199
+ }
200
+
201
+ /**
202
+ * Toogle specific rule.
203
+ *
204
+ * @since 1.0.0
205
+ *
206
+ * @param boolean $type Whether to enable or disable the rules.
207
+ */
208
+ public function toggle_rules( $type = 1 ) {
209
+ $this->set_htaccess_path();
210
+ ( 1 === $type ) ? $this->enable() : $this->disable();
211
+ }
212
+
213
+ /**
214
+ * Check if rule is enabled.
215
+ *
216
+ * @since 1.0.0
217
+ *
218
+ * @return boolean True if the rule is enabled, false otherwise.
219
+ */
220
+ public function is_enabled() {
221
+ // Get the content of htaccess.
222
+ $content = $this->wp_filesystem->get_contents( $this->path );
223
+
224
+ // Return the result.
225
+ return preg_match( $this->rules['enabled'], $content );
226
+ }
227
+ }
core/Htaccess_Service/Directory_Service.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Htaccess_Service;
3
+
4
+ use SG_Security;
5
+
6
+ /**
7
+ * Class managing the directory hardening related htaccess rules.
8
+ */
9
+ class Directory_Service extends Abstract_Htaccess_Service {
10
+
11
+ /**
12
+ * The path to the htaccess template.
13
+ *
14
+ * @var string
15
+ */
16
+ public $template = 'directory-hardening.tpl';
17
+
18
+ /**
19
+ * Array with files to the whitelisted.
20
+ *
21
+ * @var array
22
+ */
23
+ public $whitelist = array();
24
+
25
+ /**
26
+ * Array with files to the whitelisted.
27
+ *
28
+ * @var array
29
+ */
30
+ public $types = array(
31
+ 'content' => array(
32
+ 'whitelist' => array(),
33
+ ),
34
+ 'includes' => array(
35
+ 'whitelist' => array(
36
+ 'wp-tinymce.php',
37
+ 'ms-files.php',
38
+ ),
39
+ ),
40
+ 'uploads' => array(
41
+ 'whitelist' => array(),
42
+ ),
43
+ );
44
+
45
+ /**
46
+ * Regular expressions to check if the rules are enabled.
47
+ *
48
+ * @since 1.0.0
49
+ *
50
+ * @access public
51
+ *
52
+ * @var array Regular expressions to check if the rules are enabled.
53
+ */
54
+ public $rules = array(
55
+ 'enabled' => '/\#\s+SGS Directory Hardening/si',
56
+ 'disabled' => '/\#\s+SGS\s+Directory\s+Hardening(.+?)\#\s+SGS\s+Directory\s+Hardening\s+END(\n)?/ims',
57
+ 'disable_all' => '/\#\s+SGS\s+Directory\s+Hardening(.+?)\#\s+SGS\s+Directory\s+Hardening\s+END(\n)?/ims',
58
+ );
59
+
60
+ /**
61
+ * Get the filepath to the htaccess file.
62
+ *
63
+ * @since 1.0.0
64
+ */
65
+ public function get_filepath() {
66
+ switch ( $this->type ) {
67
+ case 'includes':
68
+ return $this->wp_filesystem->abspath() . WPINC . '/.htaccess';
69
+ break;
70
+
71
+ case 'uploads':
72
+ $upload_dir = wp_upload_dir();
73
+ return $upload_dir['basedir'] . '/.htaccess';
74
+ break;
75
+
76
+ case 'content':
77
+ return $this->wp_filesystem->wp_content_dir() . '.htaccess';
78
+ break;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Add whitelist rule for specifc or user files.
84
+ *
85
+ * @since 1.0.0
86
+ *
87
+ * @param string $content The generated custom rule for a directory.
88
+ *
89
+ * @return string $content The modified rule, containing the whitelist.
90
+ */
91
+ public function do_replacement( $content ) {
92
+ // Add custom whitelist.
93
+ $this->types[ $this->type ]['whitelist'] = apply_filters( 'sgs_whitelist_wp_' . $this->type, $this->types[ $this->type ]['whitelist'] );
94
+
95
+ // Bail the there is nothing to whitelist.
96
+ if ( empty( $this->types[ $this->type ]['whitelist'] ) ) {
97
+ return str_replace( '{REPLACEMENT}', '', $content );
98
+ }
99
+
100
+ $whitelisted_files = '';
101
+ // Get the whitelist template.
102
+ $whitelist_template = $this->wp_filesystem->get_contents( SG_Security\DIR . '/templates/whitelist-file.tpl' );
103
+
104
+ // Loop through the files and create whitelist rules.
105
+ foreach ( $this->types[ $this->type ]['whitelist'] as $file ) {
106
+ $whitelisted_files .= str_replace( '{FILENAME}', $file, $whitelist_template ) . PHP_EOL;
107
+ }
108
+
109
+ // Add the whitelisted files.
110
+ return str_replace( '{REPLACEMENT}', $whitelisted_files, $content );
111
+ }
112
+
113
+ /**
114
+ * Enable all hardening rules.
115
+ *
116
+ * @since 1.0.0
117
+ *
118
+ * @param boolean $enable Whether to enable or disable the rules.
119
+ */
120
+ public function toggle_rules( $enable = 1 ) {
121
+ foreach ( $this->types as $type => $data ) {
122
+ $this->type = $type;
123
+ $this->set_htaccess_path();
124
+
125
+ // Enable the rules.
126
+ if ( 1 === intval( $enable ) ) {
127
+ $this->enable();
128
+ continue;
129
+ }
130
+
131
+ // Disable and remove htaccess files otherwise.
132
+ $this->disable();
133
+ $this->maybe_remove_htaccess();
134
+
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Check if we need to remove the htaccess files after disable if they are empty.
140
+ *
141
+ * @since 1.0.1
142
+ *
143
+ * @return bool True/False if we deleted the files.
144
+ */
145
+ public function maybe_remove_htaccess() {
146
+ // Get the filepath of the file.
147
+ $path = $this->get_filepath();
148
+
149
+ // Bail if it isn't writable.
150
+ if ( ! $this->wp_filesystem->is_writable( $path ) ) {
151
+ return;
152
+ }
153
+
154
+ // Bail if the file is not empty.
155
+ if ( ! empty( trim( $this->wp_filesystem->get_contents( $path ) ) ) ) {
156
+ return;
157
+ }
158
+
159
+ return $this->wp_filesystem->delete( $path );
160
+ }
161
+ }
core/Htaccess_Service/Headers_Service.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Htaccess_Service;
3
+
4
+ /**
5
+ * Class managing the header related htaccess rules.
6
+ */
7
+ class Headers_Service extends Abstract_Htaccess_Service {
8
+
9
+ /**
10
+ * The path to the htaccess template.
11
+ *
12
+ * @var string
13
+ */
14
+ public $template = 'xss-headers.tpl';
15
+
16
+ /**
17
+ * Regular expressions to check if the rules are enabled.
18
+ *
19
+ * @since 1.0.0
20
+ *
21
+ * @access public
22
+ *
23
+ * @var array Regular expressions to check if the rules are enabled.
24
+ */
25
+ public $rules = array(
26
+ 'enabled' => '/\#\s+SGS XSS Header Service/si',
27
+ 'disabled' => '/\#\s+SGS\s+XSS\s+Header\s+Service(.+?)\#\s+SGS\s+XSS\s+Header\s+Service\s+END(\n)?/ims',
28
+ 'disable_all' => '/\#\s+SGS\s+XSS\s+Header\s+Service(.+?)\#\s+SGS\s+XSS\s+Header\s+Service\s+END(\n)?/ims',
29
+ );
30
+ }
core/Htaccess_Service/Hsts_Service.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Htaccess_Service;
3
+
4
+ /**
5
+ * Class managing the HSTS Header related htaccess rules.
6
+ */
7
+ class Hsts_Service extends Abstract_Htaccess_Service {
8
+
9
+ /**
10
+ * The path to the htaccess template.
11
+ *
12
+ * @var string
13
+ */
14
+ public $template = 'hsts-headers.tpl';
15
+
16
+ /**
17
+ * Regular expressions to check if the rules are enabled.
18
+ *
19
+ * @since 1.0.0
20
+ *
21
+ * @access public
22
+ *
23
+ * @var array Regular expressions to check if the rules are enabled.
24
+ */
25
+ public $rules = array(
26
+ 'enabled' => '/\#\s+SGS HSTS Header Service/si',
27
+ 'disabled' => '/\#\s+SGS\s+HSTS\s+Header\s+Service(.+?)\#\s+SGS\s+HSTS\s+Header\s+Service\s+END(\n)?/ims',
28
+ 'disable_all' => '/\#\s+SGS\s+HSTS\s+Header\s+Service\s+<IfModule mod_headers\.c>()\s+<\/IfModule>\s+\#\s+SGS\s+HSTS\s+Header\s+Service\s+END(\n)?/ims',
29
+ );
30
+ }
core/Htaccess_Service/Xmlrpc_Service.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Htaccess_Service;
3
+
4
+ /**
5
+ * Class managing the xml-rpc related htaccess rules.
6
+ */
7
+ class Xmlrpc_Service extends Abstract_Htaccess_Service {
8
+
9
+ /**
10
+ * Array containing all plugins using XML-RPC.
11
+ *
12
+ * @since 1.0.0
13
+ *
14
+ * @var array All known plugins using XML-RPC.
15
+ */
16
+ private $xml_rpc_plugin_list = array(
17
+ 'jetpack/jetpack.php',
18
+ );
19
+
20
+ /**
21
+ * The path to the htaccess template.
22
+ *
23
+ * @var string
24
+ */
25
+ public $template = 'xml-rpc.tpl';
26
+
27
+ /**
28
+ * Regular expressions to check if the rules are enabled.
29
+ *
30
+ * @since 1.0.0
31
+ *
32
+ * @access public
33
+ *
34
+ * @var array Regular expressions to check if the rules are enabled.
35
+ */
36
+ public $rules = array(
37
+ 'enabled' => '/\#\s+SGS XMLRPC Disable Service/si',
38
+ 'disabled' => '/\#\s+SGS\s+XMLRPC\s+Disable\s+Service(.+?)\#\s+SGS\s+XMLRPC\s+Disable\s+Service\s+END(\n)?/ims',
39
+ 'disable_all' => '/\#\s+SGS\s+XMLRPC\s+Disable\s+Service(.+?)\#\s+SGS\s+XMLRPC\s+Disable\s+Service\s+END(\n)?/ims',
40
+ );
41
+
42
+ /**
43
+ * Check if we have active plugins that are using XML-RPC.
44
+ *
45
+ * @since 1.0.0
46
+ *
47
+ * @return array The array containing known active plugins using XML-RPC or empty array if none are active.
48
+ */
49
+ public function plugins_using_xml_rpc() {
50
+ // Get the list of active plugins.
51
+ $active_plugins = get_option( 'active_plugins', array() );
52
+
53
+ // The array that will contain conflicting plugins if there are any.
54
+ $maybe_conflict = array();
55
+
56
+ // Check if the function exists, since we are connecting a bit early.
57
+ if ( ! function_exists( 'get_plugin_data' ) ) {
58
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
59
+ }
60
+
61
+ // Loop trough active plugins and check if any is present in the known plugins that use XML-RPC.
62
+ foreach ( $active_plugins as $key => $plugin ) {
63
+ // Continue if the plugin is not in the list.
64
+ if ( ! in_array( $plugin, $this->xml_rpc_plugin_list ) ) {
65
+ continue;
66
+ }
67
+
68
+ // Get the plugin data and push it to an array.
69
+ $plugin_data = get_plugin_data( ABSPATH . 'wp-content/plugins/' . $plugin );
70
+ $maybe_conflict[] = $plugin_data['Name'];
71
+ }
72
+
73
+ // Return the names of all active plugins that use XML-RPC or empty array to be consistent for the FE management.
74
+ return $maybe_conflict;
75
+ }
76
+ }
core/Install_Service/Install.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ /**
5
+ * SG Security Install main plugin class.
6
+ */
7
+ abstract class Install {
8
+
9
+ /**
10
+ * The default install version. Overridden by the installation packages.
11
+ *
12
+ * @since 1.0.1
13
+ *
14
+ * @access protected
15
+ *
16
+ * @var string $version The install version.
17
+ */
18
+ protected static $version = '0.0.0';
19
+
20
+ /**
21
+ * Return the current version of the installation.
22
+ *
23
+ * @since 1.0.1
24
+ */
25
+ public function get_version() {
26
+ return static::$version;
27
+ }
28
+
29
+ /**
30
+ * Run the install procedure. This function must be implemented by superclasses.
31
+ *
32
+ * @since 1.0.1
33
+ *
34
+ * @return mixed The result.
35
+ */
36
+ abstract public function install();
37
+
38
+ }
core/Install_Service/Install_1_0_1.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Install_Service\Install;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ use SG_Security\Htaccess_Service\Directory_Service;
7
+ use SG_Security\Htaccess_Service\Headers_Service;
8
+ use SG_Security\Htaccess_Service\Xmlrpc_Service;
9
+
10
+ /**
11
+ * The instalation package version class.
12
+ */
13
+ class Install_1_0_1 extends Install {
14
+
15
+ /**
16
+ * The default install version. Overridden by the installation packages.
17
+ *
18
+ * @since 1.0.1
19
+ *
20
+ * @access protected
21
+ *
22
+ * @var string $version The install version.
23
+ */
24
+ protected static $version = '1.0.1';
25
+
26
+ /**
27
+ * Run the install procedure.
28
+ *
29
+ * @since 1.0.1
30
+ */
31
+ public function install() {
32
+ $default_options = array(
33
+ 'lock_system_folders',
34
+ 'disable_file_edit',
35
+ 'wp_remove_version',
36
+ 'disable_xml_rpc',
37
+ 'xss_protection',
38
+ 'disable_usernames',
39
+ );
40
+
41
+ // Enable the main options on install.
42
+ foreach ( $default_options as $option ) {
43
+ Options_Service::enable_option( $option );
44
+ }
45
+
46
+ $deps = array(
47
+ 'Directory_Service',
48
+ 'Xmlrpc_Service',
49
+ );
50
+
51
+ // Do the additional actions.
52
+ foreach ( $deps as $dep ) {
53
+ $class_name = 'SG_Security\Htaccess_Service\\' . $dep;
54
+ $class = new $class_name();
55
+ $class->toggle_rules( 1 );
56
+ }
57
+
58
+ update_option( 'sg_security_login_attempts', 5 );
59
+ }
60
+ }
core/Install_Service/Install_1_1_0.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Sg_2fa\Sg_2fa;
5
+
6
+ /**
7
+ * The instalation package version class.
8
+ */
9
+ class Install_1_1_0 extends Install {
10
+
11
+ /**
12
+ * The default install version. Overridden by the installation packages.
13
+ *
14
+ * @since 1.1.0
15
+ *
16
+ * @access protected
17
+ *
18
+ * @var string $version The install version.
19
+ */
20
+ protected static $version = '1.1.0';
21
+
22
+ /**
23
+ * Run the install procedure.
24
+ *
25
+ * @since 1.1.0
26
+ */
27
+ public function install() {
28
+ // Setting the Server Address.
29
+ add_option( 'sg_security_server_address', \gethostbyname( \gethostname() ), '', 'no' );
30
+
31
+ // Setting the login type option to default upon installation.
32
+ update_option( 'sg_security_login_type', 'default' );
33
+
34
+ $sg_2fa = new Sg_2fa();
35
+
36
+ $users = get_users( array(
37
+ 'role__in' => $sg_2fa->get_2fa_user_roles(),
38
+ 'fields' => array( 'ID' ),
39
+ 'meta_query' => array(
40
+ array(
41
+ 'key' => 'sg_security_2fa_configured',
42
+ 'value' => 1,
43
+ 'compare' => '=',
44
+ ),
45
+ ),
46
+ ) );
47
+
48
+ foreach ( $users as $user ) {
49
+ $sg_2fa->generate_user_backup_codes( $user->ID );
50
+ update_user_meta( $user->ID, 'sgs_additional_codes_added', 1 );
51
+ }
52
+ }
53
+ }
core/Install_Service/Install_1_1_1.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Sg_2fa\Sg_2fa;
5
+ use SG_Security\Options_Service\Options_Service;
6
+
7
+ /**
8
+ * The instalation package version class.
9
+ */
10
+ class Install_1_1_1 extends Install {
11
+
12
+ /**
13
+ * The default install version. Overridden by the installation packages.
14
+ *
15
+ * @since 1.1.1
16
+ *
17
+ * @access protected
18
+ *
19
+ * @var string $version The install version.
20
+ */
21
+ protected static $version = '1.1.1';
22
+
23
+ /**
24
+ * Run the install procedure.
25
+ *
26
+ * @since 1.1.1
27
+ */
28
+ public function install() {
29
+ $sg_2fa = new Sg_2fa();
30
+
31
+ // Bail if the 2FA option is not enabled.
32
+ if ( ! Options_Service::is_enabled( 'sg2fa' ) ) {
33
+ return;
34
+ }
35
+
36
+ $users = get_users( array(
37
+ 'role__in' => $sg_2fa->get_2fa_user_roles(),
38
+ 'fields' => array( 'ID' ),
39
+ 'meta_query' => array(
40
+ array(
41
+ 'key' => 'sg_security_2fa_secret',
42
+ 'compare' => 'EXISTS',
43
+ ),
44
+ ),
45
+ ) );
46
+
47
+ foreach ( $users as $user ) {
48
+ $sg_2fa->generate_user_qr( $user->ID );
49
+ }
50
+ }
51
+ }
core/Install_Service/Install_1_2_0.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ /**
5
+ * The instalation package version class.
6
+ */
7
+ class Install_1_2_0 extends Install {
8
+
9
+ /**
10
+ * The default install version. Overridden by the installation packages.
11
+ *
12
+ * @since 1.2.0
13
+ *
14
+ * @access protected
15
+ *
16
+ * @var string $version The install version.
17
+ */
18
+ protected static $version = '1.2.0';
19
+
20
+ /**
21
+ * Run the install procedure.
22
+ *
23
+ * @since 1.2.0
24
+ */
25
+ public function install() {
26
+ global $wpdb;
27
+
28
+ // Change the the events and visitors tables charset.
29
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}sgs_log_events` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;" );
30
+ $wpdb->query( "ALTER TABLE `{$wpdb->prefix}sgs_log_visitors` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;" );
31
+
32
+ // Setting the notification email option for Weekly emails.
33
+ add_option( 'sg_security_notification_emails', array( get_bloginfo( 'admin_email' ) ) );
34
+
35
+ // Update the last run timestamp, so when the event run - it will be used as a start date.
36
+ update_option( 'sg_security_weekly_email_timestamp', time() );
37
+ }
38
+ }
core/Install_Service/Install_1_2_1.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Install_Service\Install;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ use SG_Security\Htaccess_Service\Headers_Service;
7
+ /**
8
+ * The instalation package version class.
9
+ */
10
+ class Install_1_2_1 extends Install {
11
+
12
+ /**
13
+ * The default install version. Overridden by the installation packages.
14
+ *
15
+ * @since 1.2.1
16
+ *
17
+ * @access protected
18
+ *
19
+ * @var string $version The install version.
20
+ */
21
+ protected static $version = '1.2.1';
22
+
23
+ /**
24
+ * Run the install procedure.
25
+ *
26
+ * @since 1.2.1
27
+ */
28
+ public function install() {
29
+ $this->maybe_remove_xss_htaccess();
30
+ }
31
+
32
+ /**
33
+ * Method wich determines if we need to make changes to the htaccess file.
34
+ *
35
+ * @since 1.2.1
36
+ *
37
+ * @param integer $counter Flag for making changes to the file.
38
+ */
39
+ public function maybe_remove_xss_htaccess( $counter = 0 ) {
40
+ // Skip if the option is disabled
41
+ if ( false === Options_Service::is_enabled( 'xss_protection' ) ) {
42
+ return;
43
+ }
44
+
45
+ // Initialize XSS instance.
46
+ $xss_service = new Headers_Service();
47
+
48
+ // Remove the rules using the old Class.
49
+ // We are not chanigng the options, since we will serve the header in a new way.
50
+ $xss_service->toggle_rules( 0 );
51
+ }
52
+ }
core/Install_Service/Install_1_2_2.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Install_Service\Install;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ /**
7
+ * The instalation package version class.
8
+ */
9
+ class Install_1_2_2 extends Install {
10
+
11
+ /**
12
+ * The default install version. Overridden by the installation packages.
13
+ *
14
+ * @since 1.2.2
15
+ *
16
+ * @access protected
17
+ *
18
+ * @var string $version The install version.
19
+ */
20
+ protected static $version = '1.2.2';
21
+
22
+ /**
23
+ * Run the install procedure.
24
+ *
25
+ * @since 1.2.2
26
+ */
27
+ public function install() {
28
+ if ( Options_Service::is_enabled( 'sg2fa' ) ) {
29
+ // Schedule event to force logout.
30
+ wp_schedule_single_event( time() + 1800, 'sgs_force_logout' );
31
+ }
32
+ }
33
+ }
core/Install_Service/Install_1_2_3.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Install_Service\Install;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ /**
7
+ * The instalation package version class.
8
+ */
9
+ class Install_1_2_3 extends Install {
10
+
11
+ /**
12
+ * The default install version. Overridden by the installation packages.
13
+ *
14
+ * @since 1.2.3
15
+ *
16
+ * @access protected
17
+ *
18
+ * @var string $version The install version.
19
+ */
20
+ protected static $version = '1.2.3';
21
+
22
+ /**
23
+ * Run the install procedure.
24
+ *
25
+ * @since 1.2.3
26
+ */
27
+ public function install() {
28
+ if ( Options_Service::is_enabled( 'sg2fa' ) ) {
29
+ // Schedule event to force logout.
30
+ wp_schedule_single_event( time() + 1800, 'sgs_force_logout' );
31
+ }
32
+ }
33
+ }
core/Install_Service/Install_1_2_5.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Install_Service\Install;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ use SG_Security\Htaccess_Service\Hsts_Service;
7
+
8
+ /**
9
+ * The instalation package version class.
10
+ */
11
+ class Install_1_2_5 extends Install {
12
+
13
+ /**
14
+ * The default install version. Overridden by the installation packages.
15
+ *
16
+ * @since 1.2.5
17
+ *
18
+ * @access protected
19
+ *
20
+ * @var string $version The install version.
21
+ */
22
+ protected static $version = '1.2.5';
23
+
24
+ /**
25
+ * Run the install procedure.
26
+ *
27
+ * @since 1.2.5
28
+ */
29
+ public function install() {
30
+ $this->remove_hsts_settings();
31
+ }
32
+
33
+ /**
34
+ * Remove the hsts settings.
35
+ *
36
+ * @since 1.2.5
37
+ */
38
+ public function remove_hsts_settings() {
39
+ // Initialize HSTS instance.
40
+ $hsts_service = new Hsts_Service();
41
+
42
+ // Toggle the hsts off.
43
+ $hsts_service->toggle_rules( 0 );
44
+
45
+ // Toggle off the option as well.
46
+ Options_Service::change_option( 'hsts_protection', 0 );
47
+ }
48
+ }
core/Install_Service/Install_1_3_2.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Install_Service;
3
+
4
+ use SG_Security\Install_Service\Install;
5
+ use SG_Security\Sg_2fa\Sg_2fa;
6
+
7
+ /**
8
+ * The instalation package version class.
9
+ */
10
+ class Install_1_3_2 extends Install {
11
+
12
+ /**
13
+ * The default install version. Overridden by the installation packages.
14
+ *
15
+ * @since 1.3.2
16
+ *
17
+ * @access protected
18
+ *
19
+ * @var string $version The install version.
20
+ */
21
+ protected static $version = '1.3.2';
22
+
23
+ /**
24
+ * Constructs a new instance.
25
+ *
26
+ * @since 1.3.2
27
+ */
28
+ public function __construct() {
29
+ // Init 2FA.
30
+ $this->sg_2fa = new Sg_2fa();
31
+ }
32
+
33
+ /**
34
+ * Run the install procedure.
35
+ *
36
+ * @since 1.3.2
37
+ */
38
+ public function install() {
39
+ $this->hash_existing_backup_codes();
40
+ $this->delete_unnecessary_backup_codes();
41
+ }
42
+
43
+ /**
44
+ * Hash 2FA users backup codes.
45
+ *
46
+ * @since 1.3.2
47
+ */
48
+ public function hash_existing_backup_codes() {
49
+ // Get all users with 2FA configured in order to hash the backup codes.
50
+ $users_2fa_configured = get_users(
51
+ array(
52
+ 'role__in' => $this->sg_2fa->get_2fa_user_roles(),
53
+ 'fields' => array( 'ID' ),
54
+ 'meta_query' => array(
55
+ array(
56
+ 'key' => 'sg_security_2fa_configured',
57
+ 'value' => '1',
58
+ 'compare' => '=',
59
+ ),
60
+ array(
61
+ 'key' => 'sg_security_2fa_backup_codes',
62
+ 'compare' => 'EXISTS',
63
+ ),
64
+ ),
65
+ )
66
+ );
67
+
68
+ // Hash their backup codes.
69
+ foreach ( $users_2fa_configured as $user ) {
70
+ // Get the user backup codes.
71
+ $backup_codes = get_user_meta( $user->ID, 'sg_security_2fa_backup_codes', true ); // phpcs:ignore
72
+
73
+ // Store the backup codes hashed.
74
+ $this->sg_2fa->store_hashed_user_meta( $user->ID, 'sg_security_2fa_backup_codes', $backup_codes );
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Delete unnecessary backup codes.
80
+ *
81
+ * @since 1.3.2
82
+ */
83
+ public function delete_unnecessary_backup_codes() {
84
+ // Get all users with backup codes which have not yet configured 2FA.
85
+ $users_with_backup_codes = get_users(
86
+ array(
87
+ 'fields' => array( 'ID' ),
88
+ 'meta_query' => array(
89
+ 'relation' => 'AND',
90
+ array(
91
+ 'key' => 'sg_security_2fa_configured',
92
+ 'compare' => 'NOT EXISTS',
93
+ ),
94
+ array(
95
+ 'key' => 'sg_security_2fa_backup_codes',
96
+ 'compare' => 'EXISTS',
97
+ ),
98
+ ),
99
+ )
100
+ );
101
+
102
+ // Delete their backup codes.
103
+ foreach ( $users_with_backup_codes as $user ) {
104
+ // Get the user backup codes.
105
+ delete_user_meta( $user->ID, 'sg_security_2fa_backup_codes' ); // phpcs:ignore
106
+ }
107
+ }
108
+ }
core/Install_Service/Install_Service.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace SG_Security\Install_Service;
4
+
5
+ use SG_Security\Install_Service\Install_1_0_1;
6
+ use SG_Security\Install_Service\Install_1_1_0;
7
+ use SG_Security\Install_Service\Install_1_1_1;
8
+ use SG_Security\Install_Service\Install_1_2_0;
9
+ use SG_Security\Install_Service\Install_1_2_1;
10
+ use SG_Security\Install_Service\Install_1_2_2;
11
+ use SG_Security\Install_Service\Install_1_2_3;
12
+ use SG_Security\Install_Service\Install_1_2_5;
13
+ use SG_Security\Install_Service\Install_1_3_2;
14
+
15
+ /**
16
+ * Define the Install interface.
17
+ *
18
+ * @since 1.0.1
19
+ */
20
+ class Install_Service {
21
+
22
+ /**
23
+ * The constructor.
24
+ *
25
+ * @since 1.0.1
26
+ */
27
+ public function __construct() {
28
+ // Get the install services.
29
+ $this->installs = array(
30
+ new Install_1_0_1(),
31
+ new Install_1_1_0(),
32
+ new Install_1_1_1(),
33
+ new Install_1_2_0(),
34
+ new Install_1_2_1(),
35
+ new Install_1_2_2(),
36
+ new Install_1_2_3(),
37
+ new Install_1_2_5(),
38
+ new Install_1_3_2(),
39
+ );
40
+ }
41
+
42
+ /**
43
+ * Loop through all versions and install the updates.
44
+ *
45
+ * @since 1.0.1
46
+ *
47
+ * @return void
48
+ */
49
+ public function install() {
50
+ // Use a transient to avoid concurrent installation calls.
51
+ if ( $this->install_required() && false === get_transient( '_sg_security_installing' ) ) {
52
+ set_transient( '_sg_security_installing', true, 5 * MINUTE_IN_SECONDS );
53
+
54
+ // Do the install.
55
+ $this->do_install();
56
+
57
+ // Delete the transient after the install.
58
+ delete_transient( '_sg_security_installing' );
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Perform the actual installation.
64
+ *
65
+ * @since 1.0.1
66
+ */
67
+ private function do_install() {
68
+
69
+ $version = null;
70
+
71
+ foreach ( $this->installs as $install ) {
72
+ // Get the install version.
73
+ $version = $install->get_version();
74
+
75
+ if ( version_compare( $version, $this->get_current_version(), '>' ) ) {
76
+ // Install version.
77
+ $install->install();
78
+
79
+ // Bump the version.
80
+ update_option( 'sg_security_version', $version );
81
+
82
+ update_option( 'sg_security_update_timestamp', time() );
83
+ }
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Retrieve the current version.
89
+ *
90
+ * @return type
91
+ */
92
+ private function get_current_version() {
93
+ return get_option( 'sg_security_version', '0.0.0' );
94
+ }
95
+
96
+ /**
97
+ * Checks whether update is required.
98
+ *
99
+ * @since 1.0.1
100
+ *
101
+ * @return bool True/false/
102
+ */
103
+ private function install_required() {
104
+ foreach ( $this->installs as $install ) {
105
+ // Get the install version.
106
+ $version = $install->get_version();
107
+
108
+ if ( version_compare( $version, $this->get_current_version(), '>' ) ) {
109
+ return true;
110
+ }
111
+ }
112
+
113
+ return false;
114
+ }
115
+ }
core/Loader/Loader.php ADDED
@@ -0,0 +1,543 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Loader;
3
+
4
+ use SG_Security;
5
+ use SG_Security\Options_Service\Options_Service;
6
+ use SiteGround_Data\Settings;
7
+
8
+ /**
9
+ * Loader functions and main initialization class.
10
+ */
11
+ class Loader {
12
+
13
+ /**
14
+ * Dependencies.
15
+ *
16
+ * @var array
17
+ */
18
+ public $dependencies = array(
19
+ 'admin',
20
+ 'helper',
21
+ 'usernames_service',
22
+ 'feed_service',
23
+ 'wp_version_service',
24
+ 'editors_service',
25
+ 'password_service',
26
+ 'sg_2fa',
27
+ 'login_service',
28
+ 'activity_log',
29
+ 'rest',
30
+ 'block_service',
31
+ 'install_service',
32
+ 'cli',
33
+ 'custom_login_url',
34
+ 'headers_service',
35
+ 'readme_service',
36
+ );
37
+
38
+ /**
39
+ * External dependencies.
40
+ *
41
+ * @var array
42
+ */
43
+ public $external_dependencies = array(
44
+ 'Settings_Page' => array(
45
+ 'namespace' => 'Data',
46
+ 'hook' => 'settings_page',
47
+ ),
48
+ 'Settings' => array(
49
+ 'namespace' => 'Data',
50
+ 'hook' => 'settings',
51
+ ),
52
+ 'Helper_Service' => array(
53
+ 'namespace' => 'Helper',
54
+ ),
55
+ 'i18n_Service' => array(
56
+ 'namespace' => 'i18n',
57
+ 'hook' => 'i18n',
58
+ 'args' => 'sg-security',
59
+ ),
60
+ );
61
+
62
+ /**
63
+ * Create a new helper.
64
+ */
65
+ public function __construct() {
66
+ $this->load_external_dependencies();
67
+ $this->load_dependencies();
68
+ $this->add_hooks();
69
+ }
70
+
71
+ /**
72
+ * Add our custom settings page hooks.
73
+ *
74
+ * @since 1.2.1
75
+ */
76
+ public function add_settings_page_hooks() {
77
+ add_action( 'admin_menu', array( $this->settings_page, 'register_settings_page' ) );
78
+
79
+ add_action( 'admin_init', array( $this->settings_page, 'add_setting_fields' ) );
80
+
81
+ add_filter( 'allowed_options', array( $this->settings_page, 'change_allowed_options' ) );
82
+
83
+ // Register rest route.
84
+ add_action( 'rest_api_init', array( $this->settings_page, 'register_rest_routes' ) );
85
+ }
86
+
87
+ /**
88
+ * Add the data collector hooks.
89
+ *
90
+ * @since 1.3.0
91
+ */
92
+ public function add_settings_hooks() {
93
+ if ( 0 === intval( get_option( 'siteground_data_consent', 0 ) ) ) {
94
+ return;
95
+ }
96
+
97
+ $settings = ! method_exists( 'Siteground_Data\\Settings', 'get_instance' ) ? new Settings() : Settings::get_instance();
98
+
99
+ // Schedule Cron Job for sending the data.
100
+ $settings->schedule_cron_job();
101
+
102
+ add_action( 'admin_init', array( $settings, 'handle_settings_update' ) );
103
+
104
+ // Hook on wp login to send data, when the cron is disabled.
105
+ if ( defined( 'DISABLE_WP_CRON' ) && 1 === intval( DISABLE_WP_CRON ) ) {
106
+ add_action( 'wp_login', array( $settings, 'send_data_on_login' ) );
107
+ }
108
+
109
+ // Check if there is old data to be sent over.
110
+ add_action( 'siteground_data_collector_cron', array( $settings, 'check_for_old_data' ), 9 );
111
+ // Sent the data.
112
+ add_action( 'siteground_data_collector_cron', array( $settings, 'send_data' ), 10 );
113
+ // Add the custom cron interval.
114
+ add_action( 'cron_schedules', array( $settings, 'add_siteground_data_interval' ) );
115
+ }
116
+
117
+ /**
118
+ * Load all of our external dependencies
119
+ *
120
+ * @since 1.2.1
121
+ */
122
+ public function load_external_dependencies() {
123
+ // Loop trough all deps.
124
+ foreach ( $this->external_dependencies as $library => $props ) {
125
+
126
+ // Build the class.
127
+ $class = 'SiteGround_' . $props['namespace'] . '\\' . $library;
128
+
129
+ // Check if class exists.
130
+ if ( ! class_exists( $class ) ) {
131
+ throw new \Exception( 'Unknown library type "' . $library . '".' );
132
+ }
133
+
134
+ // Lowercase the classsname we are going to use in the object context.
135
+ $classname = strtolower( $library );
136
+
137
+ // Check if we need to add any arguments when calling the class.
138
+ $this->$classname = true === array_key_exists( 'args', $props ) ? new $class( $props['args'] ) : new $class();
139
+
140
+ // Check if we need to add hooks for the specific dependency.
141
+ if ( array_key_exists( 'hook', $props ) ) {
142
+ call_user_func( array( $this, 'add_' . $props['hook'] . '_hooks' ) );
143
+ }
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Load the main plugin dependencies.
149
+ *
150
+ * @since 1.0.0
151
+ */
152
+ public function load_dependencies() {
153
+ foreach ( $this->dependencies as $dependency ) {
154
+ $this->factory( $dependency );
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Create a new dependency.
160
+ *
161
+ * @since 1.0.0
162
+ *
163
+ * @param string $dependency The type of the dependency.
164
+ *
165
+ * @throws \Exception Exception If the type is not supported.
166
+ */
167
+ public function factory( $dependency ) {
168
+ $type = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $dependency ) ) );
169
+
170
+ $class = 'SG_Security\\' . $type . '\\' . $type;
171
+
172
+ if ( ! class_exists( $class ) ) {
173
+ throw new \Exception( 'Unknown dependency type "' . $type . '".' );
174
+ }
175
+
176
+ $this->$dependency = new $class();
177
+ }
178
+
179
+ /**
180
+ * Add the hooks that the plugin will use to do the magic.
181
+ *
182
+ * @since 1.0.0
183
+ */
184
+ public function add_hooks() {
185
+ foreach ( $this->dependencies as $type ) {
186
+ call_user_func( array( $this, 'add_' . $type . '_hooks' ) );
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Add install service hooks.
192
+ *
193
+ * @since 1.0.1
194
+ */
195
+ public function add_install_service_hooks() {
196
+ add_action( 'upgrader_process_complete', array( $this->install_service, 'install' ) );
197
+ }
198
+
199
+ /**
200
+ * Add hooks that will be called in the dashboard.
201
+ *
202
+ * @since 1.0.0
203
+ */
204
+ public function add_admin_hooks() {
205
+ add_action( 'admin_menu', array( $this->admin, 'add_plugin_pages' ) );
206
+ add_filter( 'custom_menu_order', array( $this->admin, 'reorder_submenu_pages' ) );
207
+ add_action( 'admin_enqueue_scripts', array( $this->admin, 'enqueue_styles' ), 11 );
208
+ add_action( 'admin_enqueue_scripts', array( $this->admin, 'enqueue_scripts' ) );
209
+ add_action( 'admin_print_styles', array( $this->admin, 'admin_print_styles' ) );
210
+ add_action( 'admin_init', array( $this->admin, 'hide_errors_and_notices' ), PHP_INT_MAX );
211
+ }
212
+
213
+ /**
214
+ * Add hooks needed for helper functions.
215
+ *
216
+ * @since 1.0.0
217
+ */
218
+ public function add_helper_hooks() {
219
+ add_action( 'init', array( $this->helper_service, 'hide_warnings_in_rest_api' ) );
220
+ add_action( '_core_updated_successfully', array( $this->helper, 'set_server_ip' ) );
221
+ add_filter( 'wp_die_handler', array( $this->helper, 'custom_wp_die_handler' ) );
222
+ add_action( 'sgs_force_logout', array( $this->helper, 'logout_users' ) );
223
+ }
224
+
225
+ /**
226
+ * Add rest hooks.
227
+ *
228
+ * @since 1.0.0
229
+ */
230
+ public function add_rest_hooks() {
231
+ add_action( 'rest_api_init', array( $this->rest, 'register_rest_routes' ) );
232
+ }
233
+
234
+ /**
235
+ * Add custom login url hooks.
236
+ *
237
+ * @since 1.1.0
238
+ */
239
+ public function add_custom_login_url_hooks() {
240
+ // Bail if custom URL is not set.
241
+ if ( 'custom' !== get_option( 'sg_security_login_type', false ) ) {
242
+ return;
243
+ }
244
+
245
+ add_filter( 'user_request_action_email_content', array( $this->custom_login_url, 'change_email_confirmation_url' ), 10, 2 );
246
+ add_filter( 'site_url', array( $this->custom_login_url, 'change_site_url' ), 100, 2 );
247
+ add_filter( 'wp_logout', array( $this->custom_login_url, 'wp_logout' ) );
248
+ add_filter( 'network_site_url', array( $this->custom_login_url, 'change_site_url' ), 100, 2 );
249
+ add_filter( 'wp_redirect', array( $this->custom_login_url, 'change_site_url' ) );
250
+ add_filter( 'plugins_loaded', array( $this->custom_login_url, 'handle_request' ), 1 );
251
+ add_filter( 'wp_new_user_notification_email', array( $this->custom_login_url, 'change_email_links' ) );
252
+ add_action( 'update_option_users_can_register', array( $this->custom_login_url, 'handle_user_registration_change' ), 10, 2 );
253
+ add_action( 'wp_ajax_dismiss_sg_security_notice', array( $this->custom_login_url, 'hide_notice' ) );
254
+ add_action( 'admin_notices', array( $this->custom_login_url, 'show_notices' ) );
255
+ add_filter( 'wpdiscuz_login_link', array( $this->custom_login_url, 'custom_login_for_wpdiscuz' ) );
256
+ }
257
+
258
+ /**
259
+ * Add username hooks.
260
+ *
261
+ * @since 1.0.0
262
+ */
263
+ public function add_usernames_service_hooks() {
264
+ // Bail if the option is not enabled.
265
+ if ( ! Options_Service::is_enabled( 'disable_usernames' ) ) {
266
+ return;
267
+ }
268
+
269
+ add_action( 'illegal_user_logins', array( $this->usernames_service, 'get_illegal_usernames' ) );
270
+ }
271
+
272
+ /**
273
+ * Remove the plugin/theme editor.
274
+ *
275
+ * @since 1.0.0
276
+ */
277
+ public function add_editors_service_hooks() {
278
+ // Bail if the option is not enabled.
279
+ if ( ! Options_Service::is_enabled( 'disable_file_edit' ) ) {
280
+ return;
281
+ }
282
+
283
+ // Disable the themes/plugins editor.
284
+ add_action( 'map_meta_cap', array( $this->editors_service, 'disable_file_edit' ), 10, 2 );
285
+ }
286
+
287
+ /**
288
+ * Remove the WordPress version meta tag and parameter.
289
+ *
290
+ * @since 1.0.0
291
+ */
292
+ public function add_wp_version_service_hooks() {
293
+ // Bail if the option is not enabled.
294
+ if ( ! Options_Service::is_enabled( 'wp_remove_version' ) ) {
295
+ return;
296
+ }
297
+
298
+ // Return empty string to the_generator, so no version is shown in the site head section and inside the RSS feed.
299
+ add_filter( 'the_generator', '__return_empty_string' );
300
+
301
+ // Strip any version parameter from scripts and styles.
302
+ // add_filter( 'style_loader_src', array( $this->wp_version_service, 'remove_script_and_styles_version' ), PHP_INT_MAX );
303
+ // add_filter( 'script_loader_src', array( $this->wp_version_service, 'remove_script_and_styles_version' ), PHP_INT_MAX );
304
+ }
305
+
306
+ /**
307
+ * Disable the WordPress feed.
308
+ *
309
+ * @since 1.0.0
310
+ */
311
+ public function add_feed_service_hooks() {
312
+
313
+ // Bail if the option is not enabled.
314
+ if ( ! Options_Service::is_enabled( 'disable_feed', 0 ) ) {
315
+ return;
316
+ }
317
+
318
+ add_action( 'do_feed', array( $this->feed_service, 'disable_feed' ), 1 );
319
+ add_action( 'do_feed_rdf', array( $this->feed_service, 'disable_feed' ), 1 );
320
+ add_action( 'do_feed_rss', array( $this->feed_service, 'disable_feed' ), 1 );
321
+ add_action( 'do_feed_rss2', array( $this->feed_service, 'disable_feed' ), 1 );
322
+ add_action( 'do_feed_atom', array( $this->feed_service, 'disable_feed' ), 1 );
323
+ add_action( 'do_feed_rss2_comments', array( $this->feed_service, 'disable_feed' ), 1 );
324
+ add_action( 'do_feed_atom_comments', array( $this->feed_service, 'disable_feed' ), 1 );
325
+
326
+ remove_action( 'wp_head', 'feed_links_extra', 3 );
327
+ remove_action( 'wp_head', 'feed_links', 2 );
328
+ }
329
+
330
+ /**
331
+ * Reset password hooks.
332
+ *
333
+ * @since 1.0.0
334
+ */
335
+ public function add_password_service_hooks() {
336
+ add_action( 'wp_login', array( $this->password_service, 'force_password_reset' ), 2 );
337
+ add_action( 'resetpass_form', array( $this->password_service, 'hidden_login_field' ) );
338
+ add_action( 'validate_password_reset', array( $this->password_service, 'validate_password' ), 10, 2 );
339
+ add_action( 'password_reset', array( $this->password_service, 'remove_password_reset_meta' ) );
340
+ add_action( 'login_message', array( $this->password_service, 'add_custom_login_message' ) );
341
+ }
342
+
343
+ /**
344
+ * Add two-factor auth hooks.
345
+ *
346
+ * @since 1.0.0
347
+ */
348
+ public function add_sg_2fa_hooks() {
349
+ add_action( 'update_option_sg_security_sg2fa', array( $this->sg_2fa, 'handle_option_change' ), 10, 2 );
350
+ add_action( 'add_option_sg_security_sg2fa', array( $this->sg_2fa, 'handle_option_change' ), 10, 2 );
351
+
352
+ // Bail if the option is not enabled.
353
+ if ( ! Options_Service::is_enabled( 'sg2fa' ) ) {
354
+ return;
355
+ }
356
+
357
+ add_action( 'wp_login', array( $this->sg_2fa, 'init_2fa' ), 10, 2 );
358
+ add_action( 'login_form_sgs2fa', array( $this->sg_2fa, 'validate_2fa_login' ) );
359
+ add_action( 'login_form_sgs2fabc', array( $this->sg_2fa, 'validate_2fabc_login' ) );
360
+ add_action( 'login_form_load_sgs2fabc', array( $this->sg_2fa, 'load_backup_codes_form' ) );
361
+ add_action( 'show_user_profile', array( $this->sg_2fa, 'show_profile_security' ), 10, 1 );
362
+ add_action( 'edit_user_profile', array( $this->sg_2fa, 'show_profile_security' ), 10, 1 );
363
+ }
364
+
365
+ /**
366
+ * Add login service hooks
367
+ *
368
+ * @since 1.0.0
369
+ */
370
+ public function add_login_service_hooks() {
371
+ add_action( 'login_head', array( $this->login_service, 'restrict_login_to_ips' ), PHP_INT_MAX - 1 );
372
+
373
+ // Bail if optimization is disabled.
374
+ if ( 0 === intval( get_option( 'sg_security_login_attempts', 0 ) ) ) {
375
+ return;
376
+ }
377
+
378
+ // Check the login attempts for an IP and block the access to the login page.
379
+ add_action( 'login_head', array( $this->login_service, 'maybe_block_login_access' ), PHP_INT_MAX );
380
+ // Add login attempts for ip.
381
+ add_filter( 'login_errors', array( $this->login_service, 'log_login_attempt' ) );
382
+ // Reset login attempts for an ip on successful login.
383
+ add_filter( 'wp_login', array( $this->login_service, 'reset_login_attempts' ) );
384
+ }
385
+
386
+ /**
387
+ * Add data to the activity log for unknown user.
388
+ *
389
+ * @since 1.0.0
390
+ */
391
+ public function add_activity_log_hooks() {
392
+ // Fires only for Multisite. Add log, visitors table if network active.
393
+ add_action( 'wp_insert_site', array( $this->activity_log, 'create_subsite_log_tables' ) );
394
+
395
+ // Set the cron job for deleting the old logs.
396
+ add_action( 'init', array( $this->activity_log, 'set_sgs_logs_cron' ) );
397
+ // Delete old logs if cron is disabled.
398
+ add_action( 'admin_init', array( $this->activity_log, 'delete_logs_on_admin_page' ) );
399
+ // Run the cron daily to check for expired logs and delete them.
400
+ add_action( 'siteground_security_clear_logs_cron', array( $this->activity_log, 'delete_old_activity_logs' ) );
401
+
402
+ // Attachments.
403
+ add_action( 'add_attachment', array( $this->activity_log->attachments, 'log_add_attachment' ) );
404
+ add_action( 'edit_attachment', array( $this->activity_log->attachments, 'log_edit_attachment' ) );
405
+ add_action( 'delete_attachment', array( $this->activity_log->attachments, 'log_delete_attachment' ) );
406
+
407
+ // Comments.
408
+ add_action( 'wp_insert_comment', array( $this->activity_log->comments, 'log_comment_insert' ) );
409
+ add_action( 'edit_comment', array( $this->activity_log->comments, 'log_comment_edit' ) );
410
+ add_action( 'delete_comment', array( $this->activity_log->comments, 'log_comment_delete' ) );
411
+ add_action( 'spam_comment', array( $this->activity_log->comments, 'log_comment_spam' ) );
412
+ add_action( 'unspam_comment', array( $this->activity_log->comments, 'log_comment_unspam' ) );
413
+ add_action( 'trash_comment', array( $this->activity_log->comments, 'log_comment_trash' ) );
414
+ add_action( 'untrash_comment', array( $this->activity_log->comments, 'log_comment_untrash' ) );
415
+ // RESEARCH IF WE NEED THIS, SINCE WE HAVE ALL TRANSITIONS ABOVE
416
+ add_action( 'transition_comment_status', array( $this->activity_log->comments, 'log_comment_status_transition' ), 10, 3 );
417
+
418
+ // Core.
419
+ add_action( '_core_updated_successfully', array( $this->activity_log->core, 'log_core_update' ) );
420
+
421
+ // Export.
422
+ add_action( 'export_wp', array( $this->activity_log->export, 'log_export' ) );
423
+
424
+ // Options.
425
+ add_action( 'updated_option', array( $this->activity_log->options, 'log_option_update' ), 10, 3 );
426
+
427
+ // Plugins.
428
+ add_action( 'activated_plugin', array( $this->activity_log->plugins, 'log_plugin_activate' ) );
429
+ add_action( 'deactivated_plugin', array( $this->activity_log->plugins, 'log_plugin_deactivate' ) );
430
+ add_filter( 'update_option_recently_edited', array( $this->activity_log->plugins, 'log_plugin_edit' ), 10, 2 );
431
+ add_action( 'upgrader_process_complete', array( $this->activity_log->plugins, 'log_plugin_update' ), 10, 2 );
432
+ add_action( 'upgrader_process_complete', array( $this->activity_log->plugins, 'log_plugin_install' ), 10, 2 );
433
+
434
+ // Post.
435
+ add_action( 'delete_post', array( $this->activity_log->posts, 'log_post_delete' ), 10, 2 );
436
+ add_action( 'transition_post_status', array( $this->activity_log->posts, 'log_post_status_transition' ), 10, 3 );
437
+
438
+ // Taxonomy.
439
+ add_action( 'created_term', array( $this->activity_log->taxonomies, 'log_term_create' ), 10, 3 );
440
+ add_action( 'edited_term', array( $this->activity_log->taxonomies, 'log_term_edit' ), 10, 3 );
441
+ add_action( 'delete_term', array( $this->activity_log->taxonomies, 'log_term_delete' ), 10, 4 );
442
+
443
+ // Theme.
444
+ add_action( 'switch_theme', array( $this->activity_log->themes, 'log_theme_switch' ), 10, 2 );
445
+ add_filter( 'update_option_recently_edited', array( $this->activity_log->themes, 'log_theme_edit' ), 10, 2 );
446
+ add_action( 'upgrader_process_complete', array( $this->activity_log->themes, 'log_theme_update' ), 10, 2 );
447
+ add_action( 'upgrader_process_complete', array( $this->activity_log->themes, 'log_theme_install' ), 10, 2 );
448
+ add_action( 'delete_site_transient_update_themes', array( $this->activity_log->themes, 'log_theme_delete' ) );
449
+ add_action( 'customize_save', array( $this->activity_log->themes, 'log_theme_customizer_edit' ) );
450
+
451
+ // User.
452
+ add_action( 'wp_login', array( $this->activity_log->users, 'log_login' ), 1, 2 );
453
+ add_action( 'wp_logout', array( $this->activity_log->users, 'log_logout' ) );
454
+ add_action( 'delete_user', array( $this->activity_log->users, 'log_user_delete' ) );
455
+ add_action( 'user_register', array( $this->activity_log->users, 'log_user_register' ) );
456
+ add_action( 'profile_update', array( $this->activity_log->users, 'log_profile_update' ) );
457
+
458
+ // Widgets.
459
+ add_filter( 'widget_update_callback', array( $this->activity_log->widgets, 'log_widget_update' ), 9999, 4 );
460
+ add_filter( 'sidebar_admin_setup', array( $this->activity_log->widgets, 'log_widget_delete' ) );
461
+
462
+ // Register unknow activity.
463
+ register_shutdown_function( array( $this->activity_log->unknown, 'log_visit' ) );
464
+
465
+ // Get the list of weekly email receipients.
466
+ $weekly_email_receipients = get_option( 'sg_security_notification_emails', array() );
467
+
468
+ if ( empty( $weekly_email_receipients ) ) {
469
+ $this->activity_log->weekly_emails->weekly_report_email->unschedule_event();
470
+ } else {
471
+ // Schedule weekly report event.
472
+ if ( ! wp_next_scheduled( 'sgs_email_cron' ) ) {
473
+ $this->activity_log->weekly_emails->weekly_report_email->schedule_event();
474
+ }
475
+ }
476
+
477
+ // Update the weekly report timestamp before the mail is sent.
478
+ add_action( 'sgs_email_cron', array( $this->activity_log->weekly_emails, 'update_last_cron_run_timestamp' ), 1 );
479
+
480
+ // Sent the weekly report email.
481
+ add_action( 'sgs_email_cron', array( $this->activity_log->weekly_emails->weekly_report_email, 'sg_handle_email' ) );
482
+
483
+ // Reset the weekly report stats counters after the mail is sent.
484
+ add_action( 'sgs_email_cron', array( $this->activity_log->weekly_emails, 'reset_weekly_stats_counters' ), PHP_INT_MAX );
485
+ }
486
+
487
+ /**
488
+ * Add i18n hooks.
489
+ *
490
+ * @since 1.0.0
491
+ */
492
+ public function add_i18n_hooks() {
493
+ // Load the plugin textdomain.
494
+ add_action( 'after_setup_theme', array( $this->i18n_service, 'load_textdomain' ), 9999 );
495
+ // Generate JSON translations.
496
+ add_action( 'upgrader_process_complete', array( $this->i18n_service, 'update_json_translations' ), 10, 2 );
497
+ }
498
+
499
+ /**
500
+ * Manage blocked users.
501
+ *
502
+ * @since 1.0.0.
503
+ */
504
+ public function add_block_service_hooks() {
505
+ // Block user by ip.
506
+ add_action( 'init', array( $this->block_service, 'block_user_by_ip' ) );
507
+ }
508
+
509
+ /**
510
+ * WP CLI functionality added.
511
+ *
512
+ * @since 1.0.2.
513
+ */
514
+ public function add_cli_hooks() {
515
+ // If we’re in `WP_CLI` load the related files.
516
+ if ( class_exists( 'WP_CLI' ) ) {
517
+ add_action( 'init', array( $this->cli, 'register_commands' ) );
518
+ }
519
+ }
520
+
521
+ /**
522
+ * Add headers_service hooks.
523
+ *
524
+ * @since 1.2.1
525
+ */
526
+ public function add_headers_service_hooks() {
527
+ // Add security headers.
528
+ add_action( 'wp_headers', array( $this->headers_service, 'set_security_headers' ) );
529
+ // Add security headers for rest.
530
+ add_filter( 'rest_post_dispatch', array( $this->headers_service, 'set_rest_security_headers' ) );
531
+ }
532
+ /**
533
+ * Add readme_service hooks.
534
+ *
535
+ * @since 1.2.8
536
+ */
537
+ public function add_readme_service_hooks() {
538
+ // Add action to delete the README on WP core update, if option is set.
539
+ if ( 1 === intval( get_option( 'sg_security_delete_readme', 0 ) ) ) {
540
+ add_action( '_core_updated_successfully', array( $this->readme_service, 'delete_readme' ) );
541
+ }
542
+ }
543
+ }
core/Login_Service/Login_Service.php ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Login_Service;
3
+
4
+ use SG_Security\Helper\Helper;
5
+
6
+ /**
7
+ * Class that manages User's Log-in services.
8
+ */
9
+ class Login_Service {
10
+
11
+ /**
12
+ * The maximum allowed login attempts.
13
+ *
14
+ * @var integer
15
+ */
16
+ public $login_attempts_limit = 0;
17
+
18
+ /**
19
+ * Login attempts data
20
+ *
21
+ * @var array
22
+ */
23
+ public $login_attempts_data = array(
24
+ 0 => 'OFF',
25
+ 3 => '3',
26
+ 5 => '5',
27
+ );
28
+
29
+ /**
30
+ * The constructor.
31
+ *
32
+ * @since 1.0.0
33
+ */
34
+ public function __construct() {
35
+ $this->login_attempts_limit = get_option( 'sg_security_login_attempts', 0 );
36
+ }
37
+
38
+ /**
39
+ * Check if this ip has access to login page.
40
+ *
41
+ * @since 1.0.0
42
+ */
43
+ public function restrict_login_to_ips() {
44
+ // Get the list of allowed IP addresses.
45
+ $allowed_ips = get_option( 'sg_login_access', array() );
46
+
47
+ // Bail if the allowed ip list is empty.
48
+ if ( empty( $allowed_ips ) ) {
49
+ return true;
50
+ }
51
+
52
+ foreach ( $allowed_ips as $allowed_ip ) {
53
+ if ( Helper::get_current_user_ip() === $allowed_ip ) {
54
+ return true;
55
+ }
56
+ if ( false !== strpos( $allowed_ip, '/' ) && $this->ip_in_range( Helper::get_current_user_ip(), $allowed_ip ) ) {
57
+ return true;
58
+ }
59
+ }
60
+
61
+ // Update the total blocked logins counter.
62
+ update_option( 'sg_security_total_blocked_logins', get_option( 'sg_security_total_blocked_logins', 0 ) + 1 );
63
+
64
+ wp_die(
65
+ esc_html__( 'You don’t have access to this page. Please contact the administrator of this website for further assistance.', 'sg-security' ),
66
+ esc_html__( 'Restricted access', 'sg-security' ),
67
+ array(
68
+ 'sgs_error' => true,
69
+ 'response' => 403,
70
+ )
71
+ );
72
+ }
73
+
74
+ /**
75
+ * Restrict access to login for unsuccessfull attempts.
76
+ *
77
+ * @since 1.0.0
78
+ */
79
+ public function maybe_block_login_access() {
80
+ // Get the user ip.
81
+ $user_ip = Helper::get_current_user_ip();
82
+ // Get login attemps data.
83
+ $login_attempts = get_option( 'sg_security_unsuccessful_login', array() );
84
+
85
+ // Bail if the user doesn't have attempts.
86
+ if ( empty( $login_attempts[ $user_ip ]['timestamp'] ) ) {
87
+ return;
88
+ }
89
+
90
+ // Bail if ip, has reached login attempts limit.
91
+ if ( $login_attempts[ $user_ip ]['timestamp'] > time() ) {
92
+
93
+ // Update the total blocked logins counter.
94
+ update_option( 'sg_security_total_blocked_logins', get_option( 'sg_security_total_blocked_logins', 0 ) + 1 );
95
+
96
+ wp_die(
97
+ esc_html__( 'You don’t have access to this page. Please contact the administrator of this website for further assistance.', 'sg-security' ),
98
+ esc_html__( 'The access to that page has been restricted by the administrator of this website', 'sg-security' ),
99
+ array(
100
+ 'sgs_error' => true,
101
+ 'response' => 403,
102
+ )
103
+ );
104
+ }
105
+
106
+ // Reset the login attempts if the restriction time has ended and the user was banned for maximum amount of time.
107
+ if (
108
+ $login_attempts[ $user_ip ]['timestamp'] < time() &&
109
+ $login_attempts[ $user_ip ]['attempts'] >= $this->login_attempts_limit * 3
110
+ ) {
111
+ unset( $login_attempts[ $user_ip ] );
112
+ update_option( 'sg_security_unsuccessful_login', $login_attempts );
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Add login attempt for specific ip address.
118
+ *
119
+ * @since 1.0.0
120
+ *
121
+ * @param string $error The login error.
122
+ */
123
+ public function log_login_attempt( $error ) {
124
+ global $errors;
125
+
126
+ // Check for errors global since custom login urls plugin are not always returning it.
127
+ if ( empty( $errors ) ) {
128
+ return $error;
129
+ }
130
+
131
+ $err_codes = $errors->get_error_codes();
132
+ // Invalid username.
133
+ if (
134
+ ! in_array( 'invalid_username', $err_codes ) &&
135
+ ! in_array( 'incorrect_password', $err_codes )
136
+ ) {
137
+ return $error;
138
+ }
139
+
140
+ // Get the current user ip.
141
+ $user_ip = Helper::get_current_user_ip();
142
+ // Get the login attempts data.
143
+ $login_attempts = get_option( 'sg_security_unsuccessful_login', array() );
144
+
145
+ // Add the ip to the list if it does not exist.
146
+ if ( ! array_key_exists( $user_ip, $login_attempts ) ) {
147
+ $login_attempts[ $user_ip ] = array(
148
+ 'attempts' => 0,
149
+ 'timestamp' => '',
150
+ );
151
+ }
152
+
153
+ // Increase the attempt count.
154
+ $login_attempts[ $user_ip ]['attempts']++;
155
+
156
+ // Check if we are reaching the limits.
157
+ switch ( $login_attempts[ $user_ip ]['attempts'] ) {
158
+ // Add a restriction time if we reach the limits.
159
+ case $login_attempts[ $user_ip ]['attempts'] == $this->login_attempts_limit:
160
+ // Set 1 hour limit.
161
+ $login_attempts[ $user_ip ]['timestamp'] = time() + 3600;
162
+ break;
163
+
164
+ case $login_attempts[ $user_ip ]['attempts'] == $this->login_attempts_limit * 2:
165
+ // Set 24 hours limit.
166
+ $login_attempts[ $user_ip ]['timestamp'] = time() + 86400;
167
+ break;
168
+
169
+ case $login_attempts[ $user_ip ]['attempts'] > $this->login_attempts_limit * 3:
170
+ // Set 7 days limit.
171
+ $login_attempts[ $user_ip ]['timestamp'] = time() + 604800;
172
+ break;
173
+
174
+ // Do not set restriction if we do not reach any limits.
175
+ default:
176
+ $login_attempts[ $user_ip ]['timestamp'] = '';
177
+ break;
178
+ }
179
+
180
+ // Update the login attempts data.
181
+ update_option( 'sg_security_unsuccessful_login', $login_attempts );
182
+
183
+ return $error;
184
+ }
185
+
186
+ /**
187
+ * Reset login attempts on successful login.
188
+ *
189
+ * @since 1.0.0
190
+ */
191
+ public function reset_login_attempts() {
192
+ // Get the current user ip.
193
+ $user_ip = Helper::get_current_user_ip();
194
+ // Get the login attempts data.
195
+ $login_attempts = get_option( 'sg_security_unsuccessful_login', array() );
196
+
197
+ // Bail if the IP doens't exists in the unsuccessful logins.
198
+ if ( ! array_key_exists( $user_ip, $login_attempts ) ) {
199
+ return;
200
+ }
201
+
202
+ // Remove the IP from the option.
203
+ unset( $login_attempts[ $user_ip ] );
204
+
205
+ // Update the option with the new value.
206
+ update_option( 'sg_security_unsuccessful_login', $login_attempts );
207
+ }
208
+
209
+ /**
210
+ * Get login attempts data for the react app.
211
+ *
212
+ * @since 1.0.0
213
+ *
214
+ * @param int $value The current value.
215
+ *
216
+ * @return array Login attempts data.
217
+ */
218
+ public function get_login_attempts_data( $value ) {
219
+ $data = array();
220
+
221
+ foreach ( $this->login_attempts_data as $key => $label ) {
222
+ $data[] = array(
223
+ 'value' => $key,
224
+ 'selected' => $key === $value ? 1 : 0,
225
+ 'label' => $label,
226
+ );
227
+ }
228
+
229
+ return $data;
230
+ }
231
+ /**
232
+ * Search an IP range for a given IP.
233
+ *
234
+ * @since 1.2.0
235
+ *
236
+ * @param string $ip The ip to be searched for.
237
+ * @param string $range The range to be searched in.
238
+ *
239
+ * @return bool True, if IP is contained in the range.
240
+ */
241
+ public function ip_in_range( $ip, $range ) {
242
+ $range = explode( '/', $range );
243
+ // Get the netmask from the range.
244
+ $netmask = $range[1];
245
+ // Get the base range ip and convert to long.
246
+ $start_ip = ip2long( $range[0] );
247
+ // Get the count of the possible IPs.
248
+ $ip_count = 1 << ( 32 - $netmask );
249
+
250
+ // Iterate through all possible IPs and return true on match, false if not found.
251
+ for ( $i = 0; $i < $ip_count - 1; $i++ ) {
252
+ if ( long2ip( ( $start_ip + $i ) ) === $ip ) {
253
+ return true;
254
+ }
255
+ }
256
+ return false;
257
+ }
258
+ }
core/Message_Service/Message_Service.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Message_Service;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+
6
+ /**
7
+ * Message service class.
8
+ */
9
+ class Message_Service {
10
+
11
+ /**
12
+ * Prepare response message for react app.
13
+ *
14
+ * @since 1.0.0
15
+ *
16
+ * @param bool $status The result of operation.
17
+ * @param string $key The option key.
18
+ * @param bool $type True for enable, false for disable option.
19
+ *
20
+ * @return string The response message.
21
+ */
22
+ public static function get_response_message( $result, $option, $type = '' ) {
23
+ // Array containing message responses.
24
+ $messages = array(
25
+ 'simple' => array(
26
+ 'force_password_reset' => array(
27
+ __( 'Failed to force password reset.', 'sg-security' ),
28
+ __( 'All users will be asked to reset their passwords on next login.', 'sg-security' ),
29
+ ),
30
+ 'reinstall_plugins' => array(
31
+ __( 'Failed to reinstall plugins.', 'sg-security' ),
32
+ __( 'Plugins reinstalled.', 'sg-security' ),
33
+ ),
34
+ 'logout_users' => array(
35
+ __( 'Failed to log out all users.', 'sg-security' ),
36
+ __( 'All users are logged out.', 'sg-security' ),
37
+ ),
38
+ ),
39
+ 'complex' => array(
40
+ 'delete_readme' => array(
41
+ array(
42
+ __( 'Failed to disble deletion of Readme.html.', 'sg-security' ),
43
+ __( 'Deletion of Readme.html is disabled.', 'sg-security' ),
44
+ ),
45
+ array(
46
+ __( 'Failed to enable deletion of Readme.html.', 'sg-security' ),
47
+ __( 'Deletion of Readme.html is enabled.', 'sg-security' ),
48
+ ),
49
+ ),
50
+ 'lock_system_folders' => array(
51
+ array(
52
+ __( 'Failed to disable System Folders protection.', 'sg-security' ),
53
+ __( 'System Folders protection is disabled.', 'sg-security' ),
54
+ ),
55
+ array(
56
+ __( 'Failed to enable System Folders protection.', 'sg-security' ),
57
+ __( 'System Folders protection is enabled.', 'sg-security' ),
58
+ ),
59
+ ),
60
+ 'disable_file_edit' => array(
61
+ array(
62
+ __( 'Failed to enable Themes & Plugins Editor.', 'sg-security' ),
63
+ __( 'Themes & Plugins Editor is enabled.', 'sg-security' ),
64
+ ),
65
+ array(
66
+ __( 'Failed to Disable Themes & Plugins Editor.', 'sg-security' ),
67
+ __( 'Themes & Plugins Editor is disabled.', 'sg-security' ),
68
+ ),
69
+ ),
70
+ 'wp_remove_version' => array(
71
+ array(
72
+ __( 'Failed to show WordPress version.', 'sg-security' ),
73
+ __( 'WordPress version is now visible.', 'sg-security' ),
74
+ ),
75
+ array(
76
+ __( 'Failed to hide WordPress version.', 'sg-security' ),
77
+ __( 'WordPress version is now hidden.', 'sg-security' ),
78
+ ),
79
+ ),
80
+ 'disable_xml_rpc' => array(
81
+ array(
82
+ __( 'Failed to disable XML-RPC.', 'sg-security' ),
83
+ __( 'XML-RPC is enabled.', 'sg-security' ),
84
+ ),
85
+ array(
86
+ __( 'Failed to enable XML-RPC.', 'sg-security' ),
87
+ __( 'XML-RPC is disabled.', 'sg-security' ),
88
+ ),
89
+ ),
90
+ 'disable_feed' => array(
91
+ array(
92
+ __( 'Failed to enable RSS/ATOM feeds.', 'sg-security' ),
93
+ __( 'RSS/ATOM feeds is enabled.', 'sg-security' ),
94
+ ),
95
+ array(
96
+ __( 'Failed to Disable RSS/ATOM feeds.', 'sg-security' ),
97
+ __( 'RSS/ATOM feeds is disabled.', 'sg-security' ),
98
+ ),
99
+ ),
100
+ 'xss_protection' => array(
101
+ array(
102
+ __( 'Failed to disable Advanced XSS Protection.', 'sg-security' ),
103
+ __( 'Advanced XSS Protection is disabled.', 'sg-security' ),
104
+ ),
105
+ array(
106
+ __( 'Failed to enable Advanced XSS Protection.', 'sg-security' ),
107
+ __( 'Advanced XSS Protection is enabled.', 'sg-security' ),
108
+ ),
109
+ ),
110
+ 'sg2fa' => array(
111
+ array(
112
+ __( 'Failed to disable Two-factor Authentication for Admin Users.', 'sg-security' ),
113
+ __( 'Two-factor Authentication for Admin Users is disabled.', 'sg-security' ),
114
+ ),
115
+ array(
116
+ __( 'Failed to enable Two-factor Authentication for Admin Users.', 'sg-security' ),
117
+ __( 'Two-factor Authentication for Admin Users is enabled.', 'sg-security' ),
118
+ ),
119
+ ),
120
+ 'disable_usernames' => array(
121
+ array(
122
+ __( 'Failed to Enable Common usernames.', 'sg-security' ),
123
+ __( 'Common usernames are enabled.', 'sg-security' ),
124
+ ),
125
+ array(
126
+ __( 'Failed to Disable Common usernames.', 'sg-security' ),
127
+ __( 'Common usernames are disabled.', 'sg-security' ),
128
+ ),
129
+ ),
130
+ 'hsts_protection' => array(
131
+ array(
132
+ __( 'Failed to disable Force HTTP Strict-Transport-Security (HSTS).', 'sg-security' ),
133
+ __( 'Force HTTP Strict-Transport-Security (HSTS) is disabled.', 'sg-security' ),
134
+ ),
135
+ array(
136
+ __( 'Failed to enable Force HTTP Strict-Transport-Security (HSTS).', 'sg-security' ),
137
+ __( 'Force HTTP Strict-Transport-Security (HSTS) is enabled.', 'sg-security' ),
138
+ ),
139
+ ),
140
+ ),
141
+ );
142
+
143
+ if ( '' !== $type ) {
144
+ return $messages['complex'][ $option ][ $type ][ intval( $result ) ];
145
+ }
146
+
147
+ return $messages['simple'][ $option ][ intval( $result ) ];
148
+ }
149
+ }
core/Options_Service/Options_Service.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Options_Service;
3
+
4
+ /**
5
+ * Options_Service class that handles all options checks.
6
+ */
7
+ class Options_Service {
8
+
9
+ /**
10
+ * Check if a single boolean setting is enabled.
11
+ *
12
+ * @since 1.0.0
13
+ *
14
+ * @param string $key Setting field key.
15
+ * @param bool $is_multisite Whether to check multisite option or regular option.
16
+ *
17
+ * @return boolean True if the setting is enabled, false otherwise.
18
+ */
19
+ public static function is_enabled( $key, $is_multisite = false ) {
20
+ $key = self::add_key_prefix( $key );
21
+ $value = false === $is_multisite ? get_option( $key ) : get_site_option( $key );
22
+
23
+ if ( 1 === (int) $value ) {
24
+ return true;
25
+ }
26
+
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * Enable a single boolean setting.
32
+ *
33
+ * @since 1.0.0
34
+ *
35
+ * @param string $key Setting field key.
36
+ * @param bool $is_multisite Whether to check multisite option or regular option.
37
+ *
38
+ * @return bool True on success, false otherwise.
39
+ */
40
+ public static function enable_option( $key, $is_multisite = false ) {
41
+ $key = self::add_key_prefix( $key );
42
+ // Don't try to enable already enabled option.
43
+ if ( self::is_enabled( $key, $is_multisite ) ) {
44
+ return true;
45
+ }
46
+
47
+ // Update the option.
48
+ $result = false === $is_multisite ? update_option( $key, 1 ) : update_site_option( $key, 1 );
49
+
50
+ // Return the result.
51
+ return $result;
52
+ }
53
+
54
+ /**
55
+ * Disable a single boolean setting.
56
+ *
57
+ * @since 1.0.0
58
+ *
59
+ * @param string $key Setting field key.
60
+ * @param bool $is_multisite Whether to check multisite option or regular option.
61
+ *
62
+ * @return bool True on success, false otherwise.
63
+ */
64
+ public static function disable_option( $key, $is_multisite = false ) {
65
+ $key = self::add_key_prefix( $key );
66
+ // Don't try to disable already disabled option.
67
+ if ( ! self::is_enabled( $key, $is_multisite ) ) {
68
+ return true;
69
+ }
70
+
71
+ // Update the option.
72
+ $result = false === $is_multisite ? update_option( $key, 0 ) : update_site_option( $key, 0 );
73
+
74
+ // Return the result.
75
+ return $result;
76
+ }
77
+
78
+ /**
79
+ * Change an option.
80
+ *
81
+ * @since 1.0.0
82
+ *
83
+ * @param string $key Setting field key.
84
+ * @param string $value Setting value.
85
+ * @param bool $is_multisite Whether to check multisite option or regular option.
86
+ *
87
+ * @return bool True on success, false otherwise.
88
+ */
89
+ public static function change_option( $key, $value, $is_multisite = false ) {
90
+ $key = self::add_key_prefix( $key );
91
+
92
+ // Update the option.
93
+ $result = false === $is_multisite ? update_option( $key, $value ) : update_site_option( $key, $value );
94
+
95
+ // Return the result.
96
+ return intval( $result );
97
+ }
98
+
99
+ /**
100
+ * Adds a prefix to the option key.
101
+ *
102
+ * @since 1.0.0
103
+ *
104
+ * @param string $key Prefixed key.
105
+ */
106
+ public static function add_key_prefix( $key ) {
107
+ return 'sg_security_' . $key;
108
+ }
109
+
110
+ /**
111
+ * Checks if the `option_key` paramether exists in rest data.
112
+ *
113
+ * @since 1.0.0
114
+ *
115
+ * @param object $request Request data.
116
+ *
117
+ * @return string The option key.
118
+ */
119
+ private function validate_key( $request ) {
120
+ $data = json_decode( $request->get_body(), true );
121
+
122
+ // Bail if the option key is not set.
123
+ if ( empty( $data['option_key'] ) ) {
124
+ wp_send_json_error();
125
+ }
126
+
127
+ return $data['option_key'];
128
+ }
129
+
130
+ /**
131
+ * Provide all plugin options.
132
+ *
133
+ * @since 1.0.0
134
+ */
135
+ public function fetch_options() {
136
+ global $wpdb;
137
+ global $blog_id;
138
+
139
+ $prefix = $wpdb->get_blog_prefix( $blog_id );
140
+
141
+ $options = array();
142
+
143
+ $site_options = $wpdb->get_results(
144
+ "
145
+ SELECT REPLACE( option_name, 'sg_security_', '' ) AS name, option_value AS value
146
+ FROM {$prefix}options
147
+ WHERE option_name LIKE '%sg_security_%'
148
+ "
149
+ );
150
+
151
+ foreach ( $site_options as $option ) {
152
+ // Try to unserialize the value.
153
+ $value = maybe_unserialize( $option->value );
154
+
155
+ if (
156
+ ! is_array( $value ) &&
157
+ null !== filter_var( $value, FILTER_VALIDATE_BOOLEAN )
158
+ ) {
159
+ $value = intval( $value );
160
+ }
161
+
162
+ $options[ $option->name ] = $value;
163
+ }
164
+
165
+ return $options;
166
+ }
167
+ }
core/Password_Service/Password_Service.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Password_Service;
3
+
4
+ /**
5
+ * Class that manages password reset services.
6
+ */
7
+ class Password_Service {
8
+
9
+ /**
10
+ * Update user meta, so users are forced to change their passwords upon next login.
11
+ *
12
+ * @since 1.0.0
13
+ */
14
+ public function invalidate_passwords() {
15
+ // Get all users.
16
+ $users = get_users( array( 'fields' => array( 'ID' ) ) );
17
+
18
+ // Loop and update the user meta.
19
+ foreach ( $users as $user ) {
20
+ update_user_meta( $user->ID, 'sg_security_force_password_reset', 1 );
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Check if the user has changed his password after a force reset.
26
+ *
27
+ * @since 1.0.0
28
+ *
29
+ * @param string $username The username - either email or username.
30
+ */
31
+ public function force_password_reset( $username ) {
32
+ // Try to get the user by username.
33
+ $user = get_user_by( 'login', $username );
34
+
35
+ // If not, try getting the user by email.
36
+ if ( false === $user ) {
37
+ $user = get_user_by( 'email', $username );
38
+ }
39
+
40
+ // Bail if we have no match.
41
+ if ( false === $user ) {
42
+ return $username;
43
+ }
44
+
45
+ // Get the current user if the user param is empty.
46
+ if ( empty( $user ) ) {
47
+ $user = wp_get_current_user();
48
+ }
49
+
50
+ // Bail if there is no user.
51
+ if ( empty( $user->ID ) ) {
52
+ return;
53
+ }
54
+
55
+ // Bail if the user has changed the password.
56
+ if ( 1 !== (int) get_user_meta( $user->ID, 'sg_security_force_password_reset', true ) ) {
57
+ return;
58
+ }
59
+
60
+ // Remove the auth cookie.
61
+ wp_clear_auth_cookie();
62
+
63
+ // Retirect to the reset url.
64
+ wp_redirect( self::get_redirect_url( $user ) );
65
+ exit;
66
+ }
67
+
68
+ /**
69
+ * Get the reset password url.
70
+ *
71
+ * @since 1.0.0
72
+ *
73
+ * @param object $user WP_User obejct.
74
+ *
75
+ * @return string The reset password url.
76
+ */
77
+ public static function get_redirect_url( $user ) {
78
+ return sprintf(
79
+ site_url( 'wp-login.php?action=rp&key=%s&login=%s&sgsrp=1' ),
80
+ get_password_reset_key( $user ),
81
+ rawurlencode( $user->user_login )
82
+ );
83
+ }
84
+
85
+ /**
86
+ * Redirect to password reset page.
87
+ *
88
+ * @since 1.0.0
89
+ */
90
+ public function password_reset_redirect() {
91
+ $user = wp_get_current_user();
92
+
93
+ // Bail if there is no user.
94
+ if ( empty( $user->ID ) ) {
95
+ return;
96
+ }
97
+
98
+ // Bail if the user has changed the password.
99
+ if ( 1 !== (int) get_user_meta( $user->ID, 'sg_security_force_password_reset', true ) ) { // phpcs:ignore
100
+ return;
101
+ }
102
+
103
+ // Retirect to the reset url.
104
+ wp_redirect( site_url( 'wp-login.php?action=rp&sgsrp=1' ) );
105
+ exit;
106
+ }
107
+
108
+ /**
109
+ * Add a hidden field to the password reset form.
110
+ *
111
+ * @since 1.1.0
112
+ */
113
+ public function hidden_login_field() {
114
+ // Add the field only if you are on the password reset page forced by the plugin.
115
+ if (
116
+ isset( $_GET['sgsrp'] ) ||
117
+ isset( $_POST['sgsrp_field'] ) // phpcs:ignore
118
+ ) {
119
+ echo '<input type="hidden" value="1" id="sgsrp_field" name="sgsrp_field"/>';
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Validate the password.
125
+ *
126
+ * @since 1.1.0
127
+ *
128
+ * @param WP_Error $errors WP_Errors object.
129
+ * @param WP_User $user WP_User object.
130
+ */
131
+ public function validate_password( $errors, $user ) {
132
+ // Bail if we are not on the forced password reset form.
133
+ if ( ! isset( $_POST['sgsrp_field'] ) ) { // phpcs:ignore
134
+ return;
135
+ }
136
+
137
+ // Return error if the entered password matches the previously used one.
138
+ if (
139
+ isset( $_POST['pass1'] ) && // phpcs:ignore
140
+ wp_check_password( $_POST['pass1'], $user->user_pass ) // phpcs:ignore
141
+ ) {
142
+ $errors->add( 'error', 'You can not use your old password.', '' );
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Remove the password reset meta.
148
+ *
149
+ * @since 1.0.0
150
+ *
151
+ * @param object $user The user object.
152
+ */
153
+ public function remove_password_reset_meta( $user ) {
154
+ update_user_meta( $user->ID, 'sg_security_force_password_reset', 0 ); // phpcs:ignore
155
+ }
156
+
157
+ /**
158
+ * Add custom reset password message.
159
+ *
160
+ * @since 1.0.0
161
+ *
162
+ * @param string $message The custom login message.
163
+ */
164
+ public function add_custom_login_message( $message ) {
165
+ // Bail if we don't force the password reset.
166
+ if ( ! isset( $_GET['sgsrp'] ) ) {
167
+ return $message;
168
+ }
169
+
170
+ // Return the custom message.
171
+ return '<p class="message reset-pass">' . esc_html__( 'The administrator of this site has requested that you change your password. Enter your new password below or generate one.', 'sg-security' ) . '</p>';
172
+ }
173
+ }
core/Plugins_Service/Plugins_Service.php ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Plugins_Service;
3
+
4
+ if ( ! class_exists( '\Plugin_Upgrader' ) ) {
5
+ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
6
+ }
7
+
8
+ /**
9
+ * Plugins_Service class that handles plugins update and install.
10
+ */
11
+ class Plugins_Service {
12
+
13
+ /**
14
+ * Plugins that shouldn't be reinstalled.
15
+ *
16
+ * @var array
17
+ */
18
+ public $do_not_reinstall = array(
19
+ 'sg-security',
20
+ );
21
+
22
+ /**
23
+ * Enable maintanance mode.
24
+ *
25
+ * @since 1.0.0
26
+ */
27
+ public function maintanance_mode() {
28
+ wp_die(
29
+ esc_html__( 'Website under planned maintenance. Please check back later.', 'sg-security' ),
30
+ esc_html__( 'Under Maintenance', 'sg-security' ),
31
+ array(
32
+ 'sgs_error' => true,
33
+ 'response' => 403,
34
+ )
35
+ );
36
+ }
37
+
38
+ /**
39
+ * Reinstall the free plugins.
40
+ *
41
+ * @since 1.0.0
42
+ */
43
+ public function reinstall_plugins() {
44
+ $plugins = $this->get_plugins_data();
45
+
46
+ foreach ( $plugins as $plugin ) {
47
+ $this->resintall_plugin( $plugin );
48
+ }
49
+
50
+ return 1;
51
+ }
52
+
53
+ /**
54
+ * Get the plugins basic info.
55
+ *
56
+ * @since 1.0.0
57
+ *
58
+ * @return array The installed plugins info.
59
+ */
60
+ public function get_plugins_data() {
61
+ // Check if we need to require the Class.
62
+ if ( ! function_exists( 'get_plugin_data' ) ) {
63
+ require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
64
+ }
65
+
66
+ $plugins = array();
67
+ // Get the plugins data.
68
+ $installed_plugins = \get_plugins();
69
+
70
+ // Get only what we need as information.
71
+ foreach ( $installed_plugins as $plugin => $key ) {
72
+ // Default values for the plugin extra attributes.
73
+ $delimiter = strpos( $plugin, '/' ) ? '/' : '.';
74
+ $parts = explode( $delimiter, $plugin, 2 );
75
+ $slug = $parts[0];
76
+
77
+ // Bail if the plugin should not be reinstalled.
78
+ if ( in_array( $slug, $this->do_not_reinstall ) ) {
79
+ continue;
80
+ }
81
+
82
+ // Add extra atributes so we make things less complicated.
83
+ $plugins[] = array(
84
+ 'path' => $plugin,
85
+ 'name' => $key['Name'],
86
+ 'version' => $key['Version'],
87
+ 'is_active' => (int) is_plugin_active( $plugin ),
88
+ 'slug' => $slug,
89
+ );
90
+ }
91
+
92
+ return $plugins;
93
+ }
94
+
95
+ /**
96
+ * Start the plugin installation process.
97
+ *
98
+ * @since 1.0.0.
99
+ *
100
+ * @param array $plugin The array containing the data needed for a successful reinstal.
101
+ *
102
+ * @return bool/array true/false or array containing the error data.
103
+ */
104
+ public function resintall_plugin( $plugin ) {
105
+ // Bail if plugin data is empty.
106
+ if ( empty( $plugin ) ) {
107
+ return false;
108
+ }
109
+
110
+ // Build the download url.
111
+ $package = sprintf(
112
+ 'https://downloads.wordpress.org/plugin/%s.%s.zip',
113
+ $plugin['slug'],
114
+ $plugin['version']
115
+ );
116
+
117
+
118
+ $headers = get_headers( $package, true );
119
+
120
+ // Bail if the fetch fails.
121
+ if ( empty( $headers ) ) {
122
+ return;
123
+ }
124
+
125
+ // Bail if response is not 200.
126
+ if (
127
+ ! empty( $headers ) &&
128
+ 'HTTP/1.1 200 OK' !== $headers[0]
129
+ ) {
130
+ return;
131
+ }
132
+
133
+ // Deactivate the plugin if is active.
134
+ if ( $plugin['is_active'] ) {
135
+ deactivate_plugins( $plugin['path'] );
136
+ }
137
+
138
+ try {
139
+ if ( true !== delete_plugins( array( $plugin['path'] ) ) ) {
140
+ return false;
141
+ };
142
+ } catch ( \Error $e ) {
143
+ return;
144
+ }
145
+
146
+ // Prepare the necesary dependencies.
147
+ $skin = new \WP_Ajax_Upgrader_Skin();
148
+ $upgrader = new \Plugin_Upgrader( $skin );
149
+ $result = $upgrader->install( $package );
150
+
151
+ activate_plugin( $plugin['path'] );
152
+
153
+ // Refresh plugin update information.
154
+ wp_clean_plugins_cache();
155
+
156
+ return $result;
157
+
158
+ }
159
+ }
core/Readme_Service/Readme_Service.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Readme_Service;
3
+
4
+ /**
5
+ * Class that manages the Readme.html services.
6
+ */
7
+ class Readme_Service {
8
+
9
+ /**
10
+ * Check if the file exist in the root directory of the WP Instalation
11
+ *
12
+ * @since 1.0.0
13
+ *
14
+ * @return bool true if the file exists, false otherwise.
15
+ */
16
+ public function readme_exist() {
17
+ // Check if the readme.html file exists in the root of the application.
18
+ if ( file_exists( ABSPATH . 'readme.html' ) ) {
19
+ return true;
20
+ }
21
+
22
+ return false;
23
+ }
24
+
25
+ /**
26
+ * Remove the readme.html file from the root directory of WP Instalation.
27
+ *
28
+ * @since 1.0.0
29
+ *
30
+ * @return bool true if the file was removed, false otherwise.
31
+ */
32
+ public function delete_readme() {
33
+ // Check if the readme.html file exists in the root of the application.
34
+ if ( ! $this->readme_exist() ) {
35
+ return true;
36
+ }
37
+
38
+ // Check if file permissions are set accordingly.
39
+ if ( 600 >= intval( substr( sprintf( '%o', fileperms( ABSPATH . 'readme.html' ) ), -3 ) ) ) {
40
+ return false;
41
+ }
42
+
43
+ // Try to remove the file.
44
+ if ( @unlink( ABSPATH . 'readme.html' ) === false ) {
45
+ return false;
46
+ }
47
+
48
+ return true;
49
+ }
50
+ }
core/Rest/Rest.php ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ /**
5
+ * Main Rest class.
6
+ */
7
+ class Rest {
8
+
9
+ const REST_NAMESPACE = 'sg-security/v1';
10
+
11
+ /**
12
+ * The constructor.
13
+ */
14
+ public function __construct() {
15
+ $this->options_helper = new Rest_Helper_Options();
16
+ $this->post_hack_helper = new Rest_Helper_Post_Hack_Actions();
17
+ $this->site_security_helper = new Rest_Helper_Site_Security();
18
+ $this->login_helper = new Rest_Helper_Login();
19
+ $this->dashboard_helper = new Rest_Helper_Dashboard();
20
+ $this->activity_helper = new Rest_Helper_Activity();
21
+ }
22
+
23
+ /**
24
+ * Check if a given request has admin access
25
+ *
26
+ * @since 1.0.0
27
+ *
28
+ * @param WP_REST_Request $request Full data about the request.
29
+ */
30
+ public function check_permissions( $request ) {
31
+ return current_user_can( 'activate_plugins' );
32
+ }
33
+
34
+ /**
35
+ * Register rest routes.
36
+ *
37
+ * @since 1.0.0
38
+ */
39
+ public function register_rest_routes() {
40
+ $this->register_options_routes();
41
+ $this->register_post_hack_action_routes();
42
+ $this->register_site_security_routes();
43
+ $this->register_login_routes();
44
+ $this->register_dashboard_routes();
45
+ $this->register_activity_log_routes();
46
+ }
47
+
48
+ /**
49
+ * Register options rest routes.
50
+ *
51
+ * @since 1.0.0
52
+ */
53
+ public function register_options_routes() {
54
+ register_rest_route(
55
+ self::REST_NAMESPACE, '/fetch-options/', array(
56
+ 'methods' => 'POST',
57
+ 'callback' => array( $this->options_helper, 'fetch_options' ),
58
+ 'permission_callback' => array( $this, 'check_permissions' ),
59
+ )
60
+ );
61
+ }
62
+
63
+ /**
64
+ * Register post hack rest routes.
65
+ *
66
+ * @since 1.0.0
67
+ */
68
+ public function register_post_hack_action_routes() {
69
+ register_rest_route(
70
+ self::REST_NAMESPACE, '/reinstall-plugins/', array(
71
+ 'methods' => 'POST',
72
+ 'callback' => array( $this->post_hack_helper, 'resinstall_plugins' ),
73
+ 'permission_callback' => array( $this, 'check_permissions' ),
74
+ )
75
+ );
76
+
77
+ register_rest_route(
78
+ self::REST_NAMESPACE, '/force-password-reset/', array(
79
+ 'methods' => 'POST',
80
+ 'callback' => array( $this->post_hack_helper, 'force_password_reset' ),
81
+ 'permission_callback' => array( $this, 'check_permissions' ),
82
+ )
83
+ );
84
+
85
+ register_rest_route(
86
+ self::REST_NAMESPACE, '/logout-users/', array(
87
+ 'methods' => 'POST',
88
+ 'callback' => array( $this->post_hack_helper, 'logout_users' ),
89
+ 'permission_callback' => array( $this, 'check_permissions' ),
90
+ )
91
+ );
92
+ }
93
+
94
+ /**
95
+ * Register site security rest routes.
96
+ *
97
+ * @since 1.0.0
98
+ */
99
+ public function register_site_security_routes() {
100
+ register_rest_route(
101
+ self::REST_NAMESPACE, '/lock-system-folders/', array(
102
+ 'methods' => 'POST',
103
+ 'callback' => array( $this->site_security_helper, 'lock_system_folders' ),
104
+ 'permission_callback' => array( $this, 'check_permissions' ),
105
+ )
106
+ );
107
+
108
+ register_rest_route(
109
+ self::REST_NAMESPACE, '/disable-editors/', array(
110
+ 'methods' => 'POST',
111
+ 'callback' => array( $this->site_security_helper, 'disable_editors' ),
112
+ 'permission_callback' => array( $this, 'check_permissions' ),
113
+ )
114
+ );
115
+
116
+ register_rest_route(
117
+ self::REST_NAMESPACE, '/hide-wp-version/', array(
118
+ 'methods' => 'POST',
119
+ 'callback' => array( $this->site_security_helper, 'hide_wp_version' ),
120
+ 'permission_callback' => array( $this, 'check_permissions' ),
121
+ )
122
+ );
123
+
124
+ register_rest_route(
125
+ self::REST_NAMESPACE, '/disable-xml-rpc/', array(
126
+ 'methods' => 'POST',
127
+ 'callback' => array( $this->site_security_helper, 'disable_xml_rpc' ),
128
+ 'permission_callback' => array( $this, 'check_permissions' ),
129
+ )
130
+ );
131
+
132
+ register_rest_route(
133
+ self::REST_NAMESPACE, '/disable-feeds/', array(
134
+ 'methods' => 'POST',
135
+ 'callback' => array( $this->site_security_helper, 'disable_feeds' ),
136
+ 'permission_callback' => array( $this, 'check_permissions' ),
137
+ )
138
+ );
139
+
140
+ register_rest_route(
141
+ self::REST_NAMESPACE, '/delete-readme/', array(
142
+ 'methods' => 'POST',
143
+ 'callback' => array( $this->site_security_helper, 'delete_readme' ),
144
+ 'permission_callback' => array( $this, 'check_permissions' ),
145
+ )
146
+ );
147
+
148
+ register_rest_route(
149
+ self::REST_NAMESPACE, '/xss-protection/', array(
150
+ 'methods' => 'POST',
151
+ 'callback' => array( $this->site_security_helper, 'xss_protection' ),
152
+ 'permission_callback' => array( $this, 'check_permissions' ),
153
+ )
154
+ );
155
+
156
+ register_rest_route(
157
+ self::REST_NAMESPACE, '/hsts-protection/', array(
158
+ 'methods' => 'POST',
159
+ 'callback' => array( $this->site_security_helper, 'hsts_protection' ),
160
+ 'permission_callback' => array( $this, 'check_permissions' ),
161
+ )
162
+ );
163
+ }
164
+
165
+ /**
166
+ * Register login rest routes.
167
+ *
168
+ * @since 1.0.0
169
+ */
170
+ public function register_login_routes() {
171
+ register_rest_route(
172
+ self::REST_NAMESPACE, '/2fa/', array(
173
+ 'methods' => 'POST',
174
+ 'callback' => array( $this->login_helper, 'sg2fa' ),
175
+ 'permission_callback' => array( $this, 'check_permissions' ),
176
+ )
177
+ );
178
+
179
+ register_rest_route(
180
+ self::REST_NAMESPACE, '/reset-user-2fa/(?P<id>\d+)', array(
181
+ 'methods' => 'POST',
182
+ 'callback' => array( $this->login_helper, 'reset_user_2fa' ),
183
+ 'permission_callback' => array( $this, 'check_permissions' ),
184
+ 'args' => array(
185
+ 'id' => array(
186
+ 'validate_callback' => function( $param, $request, $key ) {
187
+ return is_numeric( $param );
188
+ },
189
+ ),
190
+ ),
191
+ )
192
+ );
193
+
194
+ register_rest_route(
195
+ self::REST_NAMESPACE, '/disable-admin-username/', array(
196
+ 'methods' => 'POST',
197
+ 'callback' => array( $this->login_helper, 'disable_admin_username' ),
198
+ 'permission_callback' => array( $this, 'check_permissions' ),
199
+ )
200
+ );
201
+
202
+ register_rest_route(
203
+ self::REST_NAMESPACE, '/login-access/', array(
204
+ 'methods' => 'POST',
205
+ 'callback' => array( $this->login_helper, 'login_access' ),
206
+ 'permission_callback' => array( $this, 'check_permissions' ),
207
+ )
208
+ );
209
+
210
+ register_rest_route(
211
+ self::REST_NAMESPACE, '/limit-login-attempts/', array(
212
+ 'methods' => 'POST',
213
+ 'callback' => array( $this->login_helper, 'limit_login_attempts' ),
214
+ 'permission_callback' => array( $this, 'check_permissions' ),
215
+ )
216
+ );
217
+
218
+ register_rest_route(
219
+ self::REST_NAMESPACE, '/custom-login-url/', array(
220
+ 'methods' => 'POST',
221
+ 'callback' => array( $this->login_helper, 'custom_login_url' ),
222
+ 'permission_callback' => array( $this, 'check_permissions' ),
223
+ )
224
+ );
225
+
226
+ }
227
+
228
+ /**
229
+ * Register dashboard rest routes.
230
+ *
231
+ * @since 1.0.0
232
+ */
233
+ public function register_dashboard_routes() {
234
+ register_rest_route(
235
+ self::REST_NAMESPACE, '/notifications/', array(
236
+ 'methods' => 'POST',
237
+ 'callback' => array( $this->dashboard_helper, 'notifications' ),
238
+ 'permission_callback' => array( $this, 'check_permissions' ),
239
+ )
240
+ );
241
+
242
+ register_rest_route(
243
+ self::REST_NAMESPACE, '/hardening/', array(
244
+ 'methods' => 'POST',
245
+ 'callback' => array( $this->dashboard_helper, 'hardening' ),
246
+ 'permission_callback' => array( $this, 'check_permissions' ),
247
+ )
248
+ );
249
+
250
+ register_rest_route(
251
+ self::REST_NAMESPACE, '/e-book/', array(
252
+ 'methods' => 'POST',
253
+ 'callback' => array( $this->dashboard_helper, 'ebook' ),
254
+ 'permission_callback' => array( $this, 'check_permissions' ),
255
+ )
256
+ );
257
+
258
+ register_rest_route(
259
+ self::REST_NAMESPACE, '/rate/', array(
260
+ 'methods' => array( 'POST' ),
261
+ 'callback' => array( $this->dashboard_helper, 'rate' ),
262
+ 'permission_callback' => array( $this, 'check_permissions' ),
263
+ )
264
+ );
265
+ }
266
+
267
+ /**
268
+ * Register activity log rest routes.
269
+ *
270
+ * @since 1.0.0
271
+ */
272
+ public function register_activity_log_routes() {
273
+ register_rest_route(
274
+ self::REST_NAMESPACE, '/activity-unknown/', array(
275
+ 'methods' => 'POST',
276
+ 'callback' => array( $this->activity_helper, 'unknown_activity' ),
277
+ 'permission_callback' => array( $this, 'check_permissions' ),
278
+ )
279
+ );
280
+
281
+ register_rest_route(
282
+ self::REST_NAMESPACE, '/activity-registered/', array(
283
+ 'methods' => 'POST',
284
+ 'callback' => array( $this->activity_helper, 'registered_activity' ),
285
+ 'permission_callback' => array( $this, 'check_permissions' ),
286
+ )
287
+ );
288
+
289
+ register_rest_route(
290
+ self::REST_NAMESPACE, '/blocked-users/', array(
291
+ 'methods' => 'POST',
292
+ 'callback' => array( $this->activity_helper, 'get_blocked_user' ),
293
+ 'permission_callback' => array( $this, 'check_permissions' ),
294
+ )
295
+ );
296
+
297
+ register_rest_route(
298
+ self::REST_NAMESPACE, '/block-ip/(?P<id>\d+)', array(
299
+ 'methods' => 'POST',
300
+ 'callback' => array( $this->activity_helper, 'block_ip' ),
301
+ 'permission_callback' => array( $this, 'check_permissions' ),
302
+ 'args' => array(
303
+ 'ip' => array(
304
+ 'validate_callback' => function( $param, $request, $key ) {
305
+ return filter_var( $param, FILTER_VALIDATE_IP );
306
+ },
307
+ ),
308
+ ),
309
+ )
310
+ );
311
+
312
+ register_rest_route(
313
+ self::REST_NAMESPACE, '/login-unblock/', array(
314
+ 'methods' => 'POST',
315
+ 'callback' => array( $this->activity_helper, 'login_unblock' ),
316
+ 'permission_callback' => array( $this, 'check_permissions' ),
317
+ )
318
+ );
319
+
320
+ register_rest_route(
321
+ self::REST_NAMESPACE, '/block-user/(?P<id>\d+)', array(
322
+ 'methods' => 'POST',
323
+ 'callback' => array( $this->activity_helper, 'block_user' ),
324
+ 'permission_callback' => array( $this, 'check_permissions' ),
325
+ 'args' => array(
326
+ 'id' => array(
327
+ 'validate_callback' => function( $param, $request, $key ) {
328
+ return is_numeric( $param );
329
+ },
330
+ ),
331
+ ),
332
+ )
333
+ );
334
+
335
+ register_rest_route(
336
+ self::REST_NAMESPACE, '/get-visitor-status/(?P<id>\d+)', array(
337
+ 'methods' => 'POST',
338
+ 'callback' => array( $this->activity_helper, 'get_visitor_status' ),
339
+ 'permission_callback' => array( $this, 'check_permissions' ),
340
+ 'args' => array(
341
+ 'ip' => array(
342
+ 'validate_callback' => function( $param, $request, $key ) {
343
+ return is_numeric( $param );
344
+ },
345
+ ),
346
+ ),
347
+ )
348
+ );
349
+
350
+ register_rest_route(
351
+ self::REST_NAMESPACE, '/weekly-report/', array(
352
+ 'methods' => 'POST',
353
+ 'callback' => array( $this->activity_helper, 'get_weekly_report_recipients' ),
354
+ 'permission_callback' => array( $this, 'check_permissions' ),
355
+ )
356
+ );
357
+
358
+ register_rest_route(
359
+ self::REST_NAMESPACE, '/notification-emails/', array(
360
+ 'methods' => 'POST',
361
+ 'callback' => array( $this->activity_helper, 'manage_notification_emails' ),
362
+ 'permission_callback' => array( $this, 'check_permissions' ),
363
+ )
364
+ );
365
+ }
366
+ }
core/Rest/Rest_Helper.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+ use SG_Security\Message_Service\Message_Service;
6
+
7
+ /**
8
+ * Rest Helper class that process all rest requests and provide json output for react app.
9
+ */
10
+ abstract class Rest_Helper {
11
+
12
+ /**
13
+ * Checks if the `option_key` paramether exists in rest data.
14
+ *
15
+ * @since 1.0.0
16
+ *
17
+ * @param object $request Request data.
18
+ * @param string $key The option key.
19
+ * @param bool $bail Whether to send json error or to return a response.
20
+ *
21
+ * @return string The option value.
22
+ */
23
+ public function validate_and_get_option_value( $request, $key, $bail = true ) {
24
+ $data = json_decode( $request->get_body(), true );
25
+
26
+ // Bail if the option key is not set.
27
+ if ( ! isset( $data[ $key ] ) ) {
28
+ return true === $bail ? self::send_json( 'Something went wrong', 400 ) : false;
29
+ }
30
+
31
+ return $data[ $key ];
32
+ }
33
+
34
+ /**
35
+ * Change the option value.
36
+ *
37
+ * @since 1.0.0
38
+ *
39
+ * @param object $key Request data.
40
+ * @param string $value The option value.
41
+ *
42
+ * @return bool True if the option is enabled, false otherwise.
43
+ */
44
+ public function change_option( $key, $value ) {
45
+ return Options_Service::change_option( $key, $value );
46
+ }
47
+
48
+ /**
49
+ * Custom json response.
50
+ *
51
+ * @since 1.0.0
52
+ *
53
+ * @param string $message The response message.
54
+ * @param integer $result The result of the optimization.
55
+ * @param array $data Additional data to be send.
56
+ */
57
+ public static function send_json( $message, $result = 1, $data = array() ) {
58
+ // Prepare the status code, based on the optimization result.
59
+ $status_code = 1 === $result ? 200 : 400;
60
+
61
+ if ( ! headers_sent() ) {
62
+ header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
63
+
64
+ if ( null !== $status_code ) {
65
+ status_header( $status_code );
66
+ }
67
+ }
68
+
69
+ echo wp_json_encode(
70
+ array(
71
+ 'data' => $data,
72
+ 'message' => $message,
73
+ 'status' => $status_code,
74
+ )
75
+ );
76
+ exit;
77
+ }
78
+
79
+ /**
80
+ * Prepare the response message for the plugin interface.
81
+ *
82
+ * @since 1.0.0
83
+ *
84
+ * @param int $result The result of the optimization.
85
+ * @param string $option The option name.
86
+ *
87
+ * @return string The response message.
88
+ */
89
+ public function get_response_message( $result, $option ) {
90
+ return Message_Service::get_response_message( $result, $option );
91
+ }
92
+ }
core/Rest/Rest_Helper_Activity.php ADDED
@@ -0,0 +1,784 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security\Block_Service\Block_Service;
5
+ use SG_Security\Helper\Helper;
6
+ use SG_Security\Activity_Log\Activity_Log_Weekly_Emails;
7
+
8
+ /**
9
+ * Rest Helper class that manages all of the options.
10
+ */
11
+ class Rest_Helper_Activity extends Rest_Helper {
12
+
13
+ /**
14
+ * Entries per page.
15
+ *
16
+ * @var int
17
+ */
18
+ public $number_of_entries = 30;
19
+
20
+ /**
21
+ * The constructor.
22
+ */
23
+ public function __construct() {
24
+ $this->block_service = new Block_Service();
25
+ $this->weekly_emails = new Activity_Log_Weekly_Emails();
26
+ }
27
+
28
+ /**
29
+ * Get the total number of entries.
30
+ *
31
+ * @since 1.0.0
32
+ *
33
+ * @param boolean $registered Whether to return total entries for registered or unknown.
34
+ *
35
+ * @return int Total number of pages to dispaly.
36
+ */
37
+ public function get_total_pages( $query ) {
38
+ global $wpdb;
39
+
40
+ $query = preg_replace( '~LIMIT(.*)$~', ';', $query );
41
+
42
+ $total_entries = $wpdb->get_results( // phpcs:ignore
43
+ $query, // phpcs:ignore
44
+ ARRAY_A
45
+ );
46
+
47
+ return ceil( count( $total_entries ) / $this->number_of_entries );
48
+ }
49
+
50
+ /**
51
+ * Get unknown activity filters.
52
+ *
53
+ * @since 1.0.0
54
+ *
55
+ * @param object $request The rest request.
56
+ *
57
+ * @return array The unknown activity filters.
58
+ */
59
+ public function get_unknown_filters( $request ) {
60
+ global $wpdb;
61
+
62
+ // Bail if table doesn't exist.
63
+ if ( ! Helper::table_exists( $wpdb->sgs_log ) ) {
64
+ return array();
65
+ }
66
+
67
+ $db_fields = $wpdb->get_results( // phpcs:ignore
68
+ 'SELECT `ts`, `code`, `visitor_type`, `ip` FROM `' . $wpdb->sgs_log . '`
69
+ WHERE `visitor_type` != "user"
70
+ ;',
71
+ ARRAY_A
72
+ );
73
+
74
+ $body = json_decode( $request->get_body(), 1 );
75
+
76
+ $filters = $this->get_request_filters( $request );
77
+
78
+ $dates = array();
79
+ $visitor_types = array();
80
+ $codes = array();
81
+ $ips = array();
82
+
83
+ foreach ( $db_fields as $entry ) {
84
+ // Get dates.
85
+ $dates[] = $entry['ts'];
86
+
87
+ // Get visitor types.
88
+ $visitor_types[ $entry['visitor_type'] ] = array(
89
+ 'label' => $entry['visitor_type'],
90
+ 'value' => $entry['visitor_type'],
91
+ );
92
+
93
+ // Get status code.
94
+ $codes[ $entry['code'] ] = array(
95
+ 'label' => $entry['code'],
96
+ 'value' => $entry['code'],
97
+ );
98
+
99
+ // Get status code.
100
+ $ips[ $entry['ip'] ] = array(
101
+ 'label' => $entry['ip'],
102
+ 'value' => $entry['ip'],
103
+ );
104
+ }
105
+
106
+ return array(
107
+ array(
108
+ 'type' => 'datepicker',
109
+ 'groupTitle' => 'By Date',
110
+ 'wp_name' => 'date',
111
+ 'children' => array(
112
+ array(
113
+ 'id' => 'from',
114
+ 'label' => 'From',
115
+ 'value' => end( $dates ),
116
+ ),
117
+ array(
118
+ 'id' => 'to',
119
+ 'label' => 'To',
120
+ 'value' => array_shift( $dates ),
121
+ ),
122
+ ),
123
+ ),
124
+ array(
125
+ 'type' => 'dropdown',
126
+ 'wp_name' => 'type',
127
+ 'children' => array(
128
+ array(
129
+ 'id' => 1,
130
+ 'label' => 'By Visitor Type',
131
+ 'optionLabel' => 'label',
132
+ 'optionValue' => 'value',
133
+ 'searchable' => true,
134
+ 'placeholder' => 'Select or start typing',
135
+ 'options' => array_values( $visitor_types ),
136
+ 'value' => ! empty( $filters['type'] ) ? $filters['type'] : null,
137
+ ),
138
+ ),
139
+ ),
140
+ array(
141
+ 'type' => 'dropdown',
142
+ 'wp_name' => 'code',
143
+ 'children' => array(
144
+ array(
145
+ 'id' => 2,
146
+ 'label' => 'By Response',
147
+ 'optionLabel' => 'label',
148
+ 'optionValue' => 'value',
149
+ 'searchable' => true,
150
+ 'placeholder' => 'Select or start typing',
151
+ 'options' => array_values( $codes ),
152
+ 'value' => ! empty( $filters['code'] ) ? $filters['code'] : null,
153
+ ),
154
+ ),
155
+ ),
156
+ array(
157
+ 'type' => 'dropdown',
158
+ 'wp_name' => 'ip',
159
+ 'children' => array(
160
+ array(
161
+ 'placeholder' => 'Select or start typing',
162
+ 'label' => 'By IP',
163
+ 'optionLabel' => 'label',
164
+ 'optionValue' => 'value',
165
+ 'searchable' => true,
166
+ 'options' => array_values( $ips ),
167
+ 'value' => ! empty( $filters['ip'] ) ? $filters['ip'] : null,
168
+ ),
169
+ ),
170
+ ),
171
+ );
172
+ }
173
+
174
+ /**
175
+ * Get registered activity filters.
176
+ *
177
+ * @since 1.0.0
178
+ *
179
+ * @param object $request The rest request.
180
+ *
181
+ * @return array The registered activity filters.
182
+ */
183
+ public function get_registered_activity_filters( $request, $visitors ) {
184
+ global $wpdb;
185
+
186
+ // Bail if table doesn't exist.
187
+ if ( ! Helper::table_exists( $wpdb->sgs_log ) ) {
188
+ return array();
189
+ }
190
+
191
+ $db_fields = $wpdb->get_results( // phpcs:ignore
192
+ 'SELECT `ts`, `activity`, `visitor_id` FROM `' . $wpdb->sgs_log . '`
193
+ WHERE `visitor_type` = "user"
194
+ ;',
195
+ ARRAY_A
196
+ );
197
+
198
+ $body = json_decode( $request->get_body(), 1 );
199
+
200
+ $filters = $this->get_request_filters( $request, true );
201
+
202
+ $dates = array();
203
+ $activities = array();
204
+ $users = array();
205
+
206
+ foreach ( $db_fields as $entry ) {
207
+ $user_data = $this->get_user_data( $entry, $visitors );
208
+ $dates[] = $entry['ts'];
209
+
210
+ $activities[ $entry['activity'] ] = array(
211
+ 'label' => $entry['activity'],
212
+ 'value' => $entry['activity'],
213
+ );
214
+
215
+ $users[ $entry['visitor_id'] ] = array(
216
+ 'label' => $user_data['nicename'],
217
+ 'value' => $entry['visitor_id'],
218
+ );
219
+ }
220
+
221
+ return array(
222
+ array(
223
+ 'type' => 'datepicker',
224
+ 'groupTitle' => 'By Date',
225
+ 'wp_name' => 'date',
226
+ 'children' => array(
227
+ array(
228
+ 'id' => 'from',
229
+ 'label' => 'From',
230
+ 'value' => end( $dates ),
231
+ ),
232
+ array(
233
+ 'id' => 'to',
234
+ 'label' => 'To',
235
+ 'value' => array_shift( $dates ),
236
+ ),
237
+ ),
238
+ ),
239
+ array(
240
+ 'type' => 'dropdown',
241
+ 'wp_name' => 'user',
242
+ 'children' => array(
243
+ array(
244
+ 'id' => 1,
245
+ 'label' => 'By User',
246
+ 'optionLabel' => 'label',
247
+ 'optionValue' => 'value',
248
+ 'placeholder' => 'Select or start typing',
249
+ 'searchable' => true,
250
+ 'options' => array_values( $users ),
251
+ 'value' => ! empty( $filters['user'] ) ? $filters['user'] : null,
252
+ ),
253
+ ),
254
+ ),
255
+ array(
256
+ 'type' => 'dropdown',
257
+ 'wp_name' => 'activity',
258
+ 'children' => array(
259
+ array(
260
+ 'id' => 2,
261
+ 'label' => 'By Activity',
262
+ 'optionLabel' => 'label',
263
+ 'optionValue' => 'value',
264
+ 'searchable' => true,
265
+ 'placeholder' => 'Select or start typing',
266
+ 'options' => array_values( $activities ),
267
+ 'value' => ! empty( $filters['activity'] ) ? $filters['activity'] : null,
268
+ ),
269
+ ),
270
+ ),
271
+ );
272
+ }
273
+
274
+ /**
275
+ * Get the activity of non logged-in users.
276
+ *
277
+ * @since 1.0.0
278
+ *
279
+ * @param object $request Request data.
280
+ */
281
+ public function unknown_activity( $request ) {
282
+ global $wpdb;
283
+
284
+ $paged = $this->validate_and_get_option_value( $request, 'page', false );
285
+ $limited_view = $this->validate_and_get_option_value( $request, 'limitedView', false ); // phpcs:ignore
286
+ $data = array();
287
+
288
+ // Bail if table doesn't exist.
289
+ if ( ! Helper::table_exists( $wpdb->sgs_visitors ) ) {
290
+ // Send the options to react app.
291
+ self::send_json(
292
+ '',
293
+ 0,
294
+ array(
295
+ 'entries' => $data,
296
+ 'filters' => $this->get_unknown_filters( $request, array() ),
297
+ 'page' => false === $paged ? 1 : $paged,
298
+ 'pages' => 1,
299
+ )
300
+ );
301
+ }
302
+
303
+ $query = $this->get_query( $request );
304
+ $entries = $wpdb->get_results( $query, ARRAY_A ); // phpcs:ignore
305
+
306
+ $users = $wpdb->get_results( // phpcs:ignore
307
+ 'SELECT * FROM `' . $wpdb->sgs_visitors . '`
308
+ WHERE `user_id` = 0
309
+ ;',
310
+ OBJECT_K
311
+ );
312
+
313
+ foreach ( $entries as $entry ) {
314
+ $data[] = array(
315
+ 'id' => $entry['id'],
316
+ 'ts' => get_date_from_gmt( date( 'Y-m-d H:i', $entry['ts'] ), 'Y-m-d H:i' ),
317
+ 'ip' => $entry['ip'],
318
+ 'page_visited' => $entry['description'],
319
+ 'type' => $entry['visitor_type'],
320
+ 'hostname' => $entry['hostname'],
321
+ 'response' => $entry['code'],
322
+ 'visitor_id' => $entry['visitor_id'],
323
+ 'block' => $users[ $entry['visitor_id'] ]->block,
324
+ );
325
+ }
326
+
327
+ // Send the options to react app.
328
+ self::send_json(
329
+ '',
330
+ 1,
331
+ array(
332
+ 'entries' => $data,
333
+ 'filters' => $this->get_unknown_filters( $request, $entries ),
334
+ 'page' => false === $paged ? 1 : $paged,
335
+ 'pages' => ! empty( $limited_view ) ? 1 : $this->get_total_pages( $query ),
336
+ )
337
+ );
338
+ }
339
+
340
+ /**
341
+ * Get activity of registered users.
342
+ *
343
+ * @since 1.0.0
344
+ *
345
+ * @param object $request Request data.
346
+ */
347
+ public function registered_activity( $request ) {
348
+ global $wpdb;
349
+
350
+ $paged = $this->validate_and_get_option_value( $request, 'page', false );
351
+ $limited_view = $this->validate_and_get_option_value( $request, 'limitedView', false ); // phpcs:ignore
352
+ $data = array();
353
+ $query = $this->get_query( $request, true );
354
+
355
+ // Bail if table doesn't exist.
356
+ if ( ! Helper::table_exists( $wpdb->sgs_visitors ) ) {
357
+ // Send the options to react app.
358
+ self::send_json(
359
+ '',
360
+ 0,
361
+ array(
362
+ 'entries' => $data,
363
+ 'filters' => $this->get_unknown_filters( $request, array() ),
364
+ 'page' => false === $paged ? 1 : $paged,
365
+ 'pages' => 1,
366
+ )
367
+ );
368
+ }
369
+
370
+ $entries = $wpdb->get_results( $query, ARRAY_A ); // phpcs:ignore
371
+
372
+ $visitors = $wpdb->get_results( // phpcs:ignore
373
+ 'SELECT * FROM `' . $wpdb->sgs_visitors . '`
374
+ WHERE `user_id` != 0
375
+ ;',
376
+ OBJECT_K
377
+ );
378
+
379
+ foreach ( $entries as $entry ) {
380
+ $user_data = $this->get_user_data( $entry, $visitors );
381
+ $data[] = array(
382
+ 'id' => $entry['id'],
383
+ 'ts' => get_date_from_gmt( date( 'Y-m-d H:i', $entry['ts'] ), 'Y-m-d H:i' ),
384
+ 'ip' => $entry['ip'],
385
+ 'activity' => $entry['description'],
386
+ 'hostname' => $entry['hostname'],
387
+ 'user' => $user_data['nicename'],
388
+ 'block' => $user_data['blocked'],
389
+ 'response' => $entry['code'],
390
+ 'visitor_id' => $entry['visitor_id'],
391
+ 'do_not_block' => $user_data['do_not_block'],
392
+ );
393
+ }
394
+
395
+ // Send the options to react app.
396
+ self::send_json(
397
+ '',
398
+ 1,
399
+ array(
400
+ 'entries' => $data,
401
+ 'filters' => $this->get_registered_activity_filters( $request, $visitors ),
402
+ 'page' => false === $paged ? 1 : $paged,
403
+ 'pages' => ! empty( $limited_view ) ? 1 : $this->get_total_pages( $query ),
404
+ )
405
+ );
406
+ }
407
+
408
+ /**
409
+ * Get user data by activity
410
+ *
411
+ * @since 1.0.0
412
+ *
413
+ * @param array $log_entry Log data.
414
+ * @param array $users Users data.
415
+ *
416
+ * @return array User data.
417
+ */
418
+ public function get_user_data( $log_entry, $users ) {
419
+ // Include the template.php if the function doesn't exists.
420
+ if ( ! function_exists( 'get_user_by' ) ) {
421
+ require_once ABSPATH . '/wp-includes/pluggable.php';
422
+ }
423
+
424
+ $visitor_data = $users[ $log_entry['visitor_id'] ];
425
+
426
+ $user = \get_user_by( 'id', $visitor_data->user_id );
427
+
428
+ if ( 'wpcli' === $log_entry['object_id'] ) {
429
+ return array(
430
+ 'nicename' => __( 'WP CLI', 'sg-security' ),
431
+ 'blocked' => 0,
432
+ 'do_not_block' => 1,
433
+ );
434
+ }
435
+
436
+ if ( 'system' === $log_entry['object_id'] ) {
437
+ return array(
438
+ 'nicename' => __( 'Server Systems', 'sg-security' ),
439
+ 'blocked' => 0,
440
+ 'do_not_block' => 1,
441
+ );
442
+ }
443
+
444
+ if ( empty( $user ) ) {
445
+ return array(
446
+ 'nicename' => __( 'Unknown user', 'sg-security' ),
447
+ 'blocked' => 0,
448
+ 'do_not_block' => 0,
449
+ );
450
+ }
451
+
452
+ return array(
453
+ 'nicename' => $user->data->user_login,
454
+ 'blocked' => $visitor_data->block,
455
+ 'do_not_block' => 0,
456
+ 'ts' => $visitor_data->blocked_on,
457
+ );
458
+ }
459
+
460
+ /**
461
+ * Get log entries.
462
+ *
463
+ * @since 1.0.0
464
+ *
465
+ * @param array $params Array of params.
466
+ * @param boolean $registered Whether to get unknown or registered logs.
467
+ *
468
+ * @return array Array of all found entries.
469
+ */
470
+ public function get_query( $request, $registered = false ) {
471
+ global $wpdb;
472
+
473
+ $filters = $this->get_request_filters( $request );
474
+ $paged = $this->validate_and_get_option_value( $request, 'page', false );
475
+ $limitedView = $this->validate_and_get_option_value( $request, 'limitedView', false ); // phpcs:ignore
476
+
477
+ // Clauses.
478
+ $select = 'SELECT * FROM ' . $wpdb->sgs_log;
479
+ $where = ' WHERE `visitor_type` != "user"';
480
+ $order = ' ORDER BY `ts` DESC';
481
+ $limit = ' LIMIT ' . ( ! empty( $limitedView ) ? 5 : $this->number_of_entries ); // phpcs:ignore
482
+ $offset = '';
483
+
484
+ // Change the visitor type.
485
+ if ( true === $registered ) {
486
+ $where = ' WHERE `visitor_type` = "user"';
487
+ }
488
+
489
+ if ( ! empty( $filters['type'] ) ) {
490
+ $where = ' WHERE `visitor_type` = "' . esc_sql( $filters['type'] ) . '"';
491
+ }
492
+
493
+ if ( ! empty( $filters['user'] ) ) {
494
+ $where .= ' AND `visitor_id` = "' . esc_sql( $filters['user'] ) . '"';
495
+ }
496
+
497
+ if ( ! empty( $filters['activity'] ) ) {
498
+ $where .= ' AND `activity` = "' . esc_sql( $filters['activity'] ) . '"';
499
+ }
500
+
501
+ if ( ! empty( $filters['from'] ) ) {
502
+ $where .= ' AND `ts` <= "' . esc_sql( $filters['from'] ) . '"';
503
+ }
504
+
505
+ if ( ! empty( $filters['to'] ) ) {
506
+ $where .= ' AND `ts` >= "' . esc_sql( $filters['to'] ) . '"';
507
+ }
508
+
509
+ if ( ! empty( $filters['ip'] ) ) {
510
+ $where .= ' AND `ip` LIKE "%' . esc_sql( $filters['ip'] ) . '%"';
511
+ }
512
+
513
+ if ( ! empty( $filters['code'] ) ) {
514
+ $where .= ' AND `code` = "' . esc_sql( $filters['code'] ) . '"';
515
+ }
516
+
517
+ if ( ! empty( $paged ) ) {
518
+ $offset .= ' OFFSET ' . intval( ( esc_sql( $paged ) * $this->number_of_entries ) - $this->number_of_entries );
519
+ }
520
+
521
+ return $select . $where . $order . $limit . $offset . ';';
522
+ }
523
+
524
+ public function get_request_filters( $request ) {
525
+ $body = json_decode( $request->get_body(), 1 );
526
+ $filters = array();
527
+
528
+ if ( ! empty( $body['filters'] ) ) {
529
+ foreach ( $body['filters'] as $filter ) {
530
+ if ( 'date' === $filter['wp_name'] ) {
531
+ $filters['from'] = $filter['children'][0]['value'];
532
+ $filters['to'] = $filter['children'][1]['value'];
533
+
534
+ continue;
535
+ }
536
+ $filters[ $filter['wp_name'] ] = $filter['children'][0]['value'];
537
+ }
538
+ }
539
+
540
+ return $filters;
541
+ }
542
+
543
+ /**
544
+ * Block an IP address.
545
+ *
546
+ * @since 1.0.0
547
+ *
548
+ * @param object $request Request data.
549
+ */
550
+ public function block_ip( $request ) {
551
+ $params = $request->get_params( $request );
552
+ $body = json_decode( $request->get_body(), true );
553
+
554
+ if ( empty( $params['id'] ) ) {
555
+ self::send_json(
556
+ __( 'Missing ID param!', 'sg-security' ),
557
+ 0
558
+ );
559
+ }
560
+
561
+ $response = $this->block_service->block_ip( $params['id'], $body['block'] );
562
+
563
+ self::send_json(
564
+ $response['message'],
565
+ $response['result']
566
+ );
567
+ }
568
+
569
+ /**
570
+ * Unblock an IP address, blocked by the Limit Login Attempts functionality.
571
+ *
572
+ * @since 1.2.2
573
+ *
574
+ * @param object $request Request data.
575
+ */
576
+ public function login_unblock( $request ) {
577
+ // Get the request body.
578
+ $body = json_decode( $request->get_body(), true );
579
+
580
+ // Bail if IP is not passed.
581
+ if ( empty( $body['ip'] ) ) {
582
+ self::send_json(
583
+ __( 'Missing IP param!', 'sg-security' ),
584
+ 0
585
+ );
586
+ }
587
+
588
+ // Get the unsuccessfull login attempts data.
589
+ $login_attempts = get_option( 'sg_security_unsuccessful_login', array() );
590
+
591
+ // Remove the IP from the option.
592
+ unset( $login_attempts[ $body['ip'] ] );
593
+
594
+ // Update the option with the new value.
595
+ update_option( 'sg_security_unsuccessful_login', $login_attempts );
596
+
597
+ // Send the response.
598
+ self::send_json(
599
+ __( 'IP Unblocked.', 'sg-security' ),
600
+ 1
601
+ );
602
+ }
603
+
604
+ /**
605
+ * Limit user capabilities based on ID.
606
+ *
607
+ * @since 1.0.0
608
+ *
609
+ * @param Object $request The request object.
610
+ */
611
+ public function block_user( $request ) {
612
+ // Get the request params.
613
+ $params = $request->get_params( $request );
614
+ // Get the request body.
615
+ $body = json_decode( $request->get_body(), true );
616
+
617
+ if ( empty( $params['id'] ) ) {
618
+ self::send_json(
619
+ __( 'Missing ID param!', 'sg-security' ),
620
+ 0
621
+ );
622
+ }
623
+
624
+ switch ( $body['block'] ) {
625
+ // Unblock request.
626
+ case 0:
627
+ $response = $this->block_service->unblock_user( $params['id'] );
628
+ break;
629
+ // Block request.
630
+ case 1:
631
+ $response = $this->block_service->change_user_role( $params['id'] );
632
+ break;
633
+ }
634
+
635
+ // Send the response.
636
+ self::send_json(
637
+ $response['message'],
638
+ $response['result']
639
+ );
640
+ }
641
+
642
+ /**
643
+ * Limit user capabilities based on ID.
644
+ *
645
+ * @since 1.0.0
646
+ *
647
+ * @param Object $request The request object.
648
+ */
649
+ public function get_visitor_status( $request ) {
650
+ $params = $request->get_params( $request );
651
+
652
+ if ( empty( $params['id'] ) ) {
653
+ self::send_json(
654
+ __( 'Missing ID param!', 'sg-security' ),
655
+ 0
656
+ );
657
+ }
658
+
659
+ $response = $this->block_service->get_visitor_status( $params['id'] );
660
+
661
+ self::send_json(
662
+ '',
663
+ $response['result'],
664
+ $response['data']
665
+ );
666
+ }
667
+
668
+ /**
669
+ * Ge the blocked users/IPs
670
+ *
671
+ * @since 1.0.0
672
+ *
673
+ * @param Object $request The request object.
674
+ */
675
+ public function get_blocked_user( $request ) {
676
+ global $wpdb;
677
+ $results = $wpdb->get_results( // phpcs:ignore
678
+ 'SELECT * FROM `' . $wpdb->sgs_visitors . '`
679
+ WHERE `block` = 1
680
+ ;',
681
+ ARRAY_A
682
+ );
683
+
684
+ $visitors = $wpdb->get_results( // phpcs:ignore
685
+ 'SELECT * FROM `' . $wpdb->sgs_visitors . '`
686
+ WHERE `user_id` != 0
687
+ ;',
688
+ OBJECT_K
689
+ );
690
+
691
+ $data = array();
692
+
693
+ // Get the unsuccessfull login attempts data.
694
+ $limit_login_attempts = get_option( 'sg_security_unsuccessful_login', array() );
695
+
696
+ foreach ( $results as $entry ) {
697
+ $log = array(
698
+ 'ts' => get_date_from_gmt( date( 'Y-m-d H:i', $entry['blocked_on'] ), 'Y-m-d H:i' ),
699
+ 'user' => $entry['ip'],
700
+ 'visitor_id' => $entry['id'],
701
+ 'object_id' => $entry['user_id'],
702
+ 'type' => 0 == $entry['user_id'] ? 'ip' : 'user',
703
+ );
704
+
705
+ if ( ! empty( $entry['user_id'] ) ) {
706
+ $user_data = $this->get_user_data( $log, $visitors );
707
+ $log['user'] = $user_data['nicename'];
708
+ }
709
+
710
+ $data[] = $log;
711
+ }
712
+
713
+ foreach ( $limit_login_attempts as $ip => $attempt ) {
714
+ // Check if IP is blocked.
715
+ if ( empty ( $attempt['timestamp'] ) ) {
716
+ continue;
717
+ }
718
+
719
+ $log = array(
720
+ 'ts' => get_date_from_gmt( date( 'Y-m-d H:i', $attempt['timestamp'] ), 'Y-m-d H:i' ),
721
+ 'user' => $ip,
722
+ 'visitor_id' => 0,
723
+ 'object_id' => $ip,
724
+ 'type' => 'ip',
725
+ );
726
+
727
+ $data[] = $log;
728
+ }
729
+
730
+ // Send the options to react app.
731
+ self::send_json(
732
+ '',
733
+ 1,
734
+ array(
735
+ 'entries' => $data,
736
+ )
737
+ );
738
+ }
739
+
740
+ /**
741
+ * Get the emails set to receive weekly report email.
742
+ *
743
+ * @since 1.2.0
744
+ *
745
+ * @param Object $request The request object.
746
+ */
747
+ public function get_weekly_report_recipients( $request ) {
748
+ $data = $this->weekly_emails->weekly_report_receipients();
749
+
750
+ // Send the options to react app.
751
+ self::send_json(
752
+ '',
753
+ 1,
754
+ array(
755
+ 'entries' => $data,
756
+ 'max_emails' => 5,
757
+ )
758
+ );
759
+ }
760
+
761
+ /**
762
+ * Manage the weekly report notification email addresses.
763
+ *
764
+ * @since 1.2.0
765
+ *
766
+ * @param Object $request The request object.
767
+ */
768
+ public function manage_notification_emails( $request ) {
769
+ $data = json_decode( $request->get_body(), true );
770
+
771
+ // Update the option.
772
+ update_option( 'sg_security_notification_emails', array_unique( array_column( $data['entries'], 'email' ) ) );
773
+
774
+ self::send_json(
775
+ __( 'Notification emails updated.', 'sg-security' ),
776
+ 1,
777
+ array(
778
+ 'weeklyReports' => array(
779
+ $this->weekly_emails->weekly_report_receipients(),
780
+ ),
781
+ )
782
+ );
783
+ }
784
+ }
core/Rest/Rest_Helper_Dashboard.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security;
5
+ use SiteGround_Helper\Helper_Service;
6
+
7
+ /**
8
+ * Rest Helper class that manages the plugin dashboard.
9
+ */
10
+ class Rest_Helper_Dashboard extends Rest_Helper {
11
+
12
+ /**
13
+ * Sends notifications info.
14
+ *
15
+ * @since 1.0.0
16
+ */
17
+ public function notifications() {
18
+ // Prepare the response array.
19
+ $response = array();
20
+
21
+ // Add notification if we have updates available.
22
+ if ( true === Helper_Service::has_updates() ) {
23
+ $response = array(
24
+ array(
25
+ 'title' => __( 'YOUR WORDPRESS NEEDS ATTENTION', 'sg-security' ),
26
+ 'text' => __( 'There are new updates for your website. Keeping your WordPress updated is crucial for your website security', 'sg-security' ),
27
+ 'button_text' => __( 'Update', 'sg-security' ),
28
+ 'button_link' => admin_url( 'update-core.php' ),
29
+ ),
30
+ );
31
+ }
32
+
33
+ // Send the response.
34
+ self::send_json(
35
+ '',
36
+ 1,
37
+ $response
38
+ );
39
+ }
40
+
41
+ /**
42
+ * Send information about the security hardening boxes.
43
+ *
44
+ * @since 1.0.0
45
+ */
46
+ public function hardening() {
47
+ self::send_json(
48
+ '',
49
+ 1,
50
+ array(
51
+ array(
52
+ 'icon' => 'product-ssl-wildcard',
53
+ 'icon_color' => 'royal',
54
+ 'text' => __( 'Set up rules to harden your website security and prevent malware, bruteforce and other security issues.', 'sg-security' ),
55
+ 'button_text' => __( 'Manage Security', 'sg-security' ),
56
+ 'button_link' => admin_url( 'admin.php?page=site-security' ),
57
+ 'title' => __( 'Site Security', 'sg-security' ),
58
+ ),
59
+ array(
60
+ 'icon' => 'product-ssl-encryption',
61
+ 'icon_color' => 'grassy',
62
+ 'text' => __( 'Protect your login from unauthorised visitors, bots and other human or automated attacks.', 'sg-security' ),
63
+ 'button_text' => __( 'Manage Login', 'sg-security' ),
64
+ 'button_link' => admin_url( 'admin.php?page=login-settings' ),
65
+ 'title' => __( 'Login Security', 'sg-security' ),
66
+ ),
67
+ )
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Sends information about the free ebook.
73
+ *
74
+ * @since 1.0.2
75
+ */
76
+ public function ebook() {
77
+ self::send_json(
78
+ '',
79
+ 1,
80
+ $this->get_remote_banners()
81
+ );
82
+ }
83
+
84
+ /**
85
+ * Sends information whether we should display the rating box
86
+ *
87
+ * @since 1.0.2
88
+ *
89
+ * @param object $request Request data.
90
+ */
91
+ public function rate( $request ) {
92
+ $show = $this->validate_and_get_option_value( $request, 'show', false );
93
+
94
+ if ( false === $show ) {
95
+ self::send_json(
96
+ '',
97
+ 1,
98
+ array(
99
+ 'show' => intval( get_option( 'sg_security_show_rating', 1 ) ),
100
+ )
101
+ );
102
+ }
103
+
104
+ update_option( 'sg_security_show_rating', $show );
105
+
106
+ self::send_json(
107
+ '',
108
+ 1,
109
+ array(
110
+ 'show' => intval( $show ),
111
+ )
112
+ );
113
+ }
114
+
115
+ /**
116
+ * Make a remote request to fetch the banner assets and texts in the dashboard.
117
+ *
118
+ * @since 1.2.0
119
+ *
120
+ * @return array $result The array containing the link and titles.
121
+ */
122
+ public function get_remote_banners() {
123
+ // Get the banner content.
124
+ $response = wp_remote_get( 'https://sgwpdemo.com/jsons/sg-security-banners.json' );
125
+
126
+ // Bail if the request fails.
127
+ if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
128
+ self::send_json_error( 'Error' );
129
+ }
130
+
131
+ // Get the locale.
132
+ $locale = get_locale();
133
+
134
+ // Determine the type of asset we are going to show.
135
+ $type = Helper_Service::is_siteground() ? 'ebook' : 'banners';
136
+
137
+ // Get the body of the response.
138
+ $body = wp_remote_retrieve_body( $response );
139
+
140
+ // Decode the json response.
141
+ $banners = json_decode( $body, true );
142
+
143
+ // Return the correct assets, title and marketing urls.
144
+ return array_key_exists( $locale, $banners[ $type ] ) ? $banners[ $type ][ $locale ] : $banners[ $type ]['default'];
145
+ }
146
+ }
core/Rest/Rest_Helper_Login.php ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security\Rest\Rest_Helper_Options;
5
+ use SG_Security\Sg_2fa\Sg_2fa;
6
+ use SG_Security\Login_Service\Login_Service;
7
+ use SG_Security\Usernames_Service\Usernames_Service;
8
+ use SG_Security\Message_Service\Message_Service;
9
+ use SiteGround_Helper\Helper_Service;
10
+
11
+ /**
12
+ * Rest Helper class that manages the login security.
13
+ */
14
+ class Rest_Helper_Login extends Rest_Helper {
15
+
16
+ /**
17
+ * The constructor.
18
+ */
19
+ public function __construct() {
20
+ $this->rest_helper_options = new Rest_Helper_Options();
21
+ $this->sg_2fa = new Sg_2fa();
22
+ $this->login_service = new Login_Service();
23
+ $this->usernames_service = new Usernames_Service();
24
+ }
25
+
26
+ /**
27
+ * Setting custom login URL.
28
+ *
29
+ * @since 1.1.0
30
+ *
31
+ * @param object $request Request data.
32
+ */
33
+ public function custom_login_url( $request ) {
34
+ $data = json_decode( $request->get_body(), true );
35
+ $login_allowed = intval( get_option( 'users_can_register', false ) );
36
+
37
+ // Bail if the both urls are the same.
38
+ if ( $data['login'] === $data['signup'] ) {
39
+ self::send_json(
40
+ __( 'Login and signup URL cannot be the same.', 'sg-security' ),
41
+ 0
42
+ );
43
+ }
44
+
45
+ // Bail if the login or signup urls are the default urls.
46
+ if (
47
+ 'wp-login.php' === $data['login'] ||
48
+ 'wp-signup.php' === $data['signup']
49
+ ) {
50
+ self::send_json(
51
+ __( 'You cannot use the default URL.', 'sg-security' ),
52
+ 0
53
+ );
54
+ }
55
+
56
+ update_option( 'sg_security_login_type', $data['type'] );
57
+ update_option( 'sg_security_login_url', str_replace( Helper_Service::get_home_url(), '', $data['login'] ) );
58
+ if ( ! empty( $data['signup'] ) ) {
59
+ update_option( 'sg_security_login_register', str_replace( Helper_Service::get_home_url(), '', $data['signup'] ) );
60
+ }
61
+
62
+ self::send_json(
63
+ 'Login URL changed!',
64
+ 1,
65
+ array(
66
+ 'login_url' => array(
67
+ array(
68
+ 'type' => 'custom',
69
+ 'label' => 'Custom',
70
+ 'login' => get_option( 'sg_security_login_url', '' ),
71
+ 'signup' => 1 === $login_allowed ? get_option( 'sg_security_login_register', '' ) : null,
72
+ 'selected' => 'custom' === $login_type ? 1 : 0,
73
+ ),
74
+ array(
75
+ 'type' => 'default',
76
+ 'label' => 'Default',
77
+ 'login' => wp_login_url(),
78
+ 'signup' => 1 === $login_allowed ? site_url( 'wp-signup.php' ) : null,
79
+ 'selected' => 'default' === $login_type ? 1 : 0,
80
+ ),
81
+ ),
82
+ )
83
+ );
84
+ }
85
+
86
+
87
+ /**
88
+ * Update the login access.
89
+ *
90
+ * @since 1.0.0
91
+ *
92
+ * @param object $request Request data.
93
+ */
94
+ public function login_access( $request ) {
95
+ $data = json_decode( $request->get_body(), true );
96
+
97
+ update_option( 'sg_login_access', $data );
98
+ self::send_json(
99
+ 'Login access updated!',
100
+ 1,
101
+ array(
102
+ 'login_access' => $data,
103
+ )
104
+ );
105
+ }
106
+
107
+ /**
108
+ * Set the 2fa.
109
+ *
110
+ * @since 1.0.0
111
+ *
112
+ * @param object $request Request data.
113
+ */
114
+ public function sg2fa( $request ) {
115
+ $this->rest_helper_options->change_option_from_rest( $request, 'sg2fa' );
116
+ }
117
+
118
+ /**
119
+ * Reset user 2fa.
120
+ *
121
+ * @since 1.1.1
122
+ *
123
+ * @param Object $request The request object.
124
+ */
125
+ public function reset_user_2fa( $request ) {
126
+ $params = $request->get_params( $request );
127
+
128
+ if ( empty( $params['id'] ) ) {
129
+ self::send_json(
130
+ __( 'Missing ID param!', 'sg-security' ),
131
+ 0
132
+ );
133
+ }
134
+
135
+ $response = $this->sg_2fa->reset_user_2fa( $params['id'] );
136
+
137
+ self::send_json(
138
+ $response['message'],
139
+ $response['result'],
140
+ array( 'reset_2fa' => $this->sg_2fa->check_for_users_using_2fa() )
141
+ );
142
+ }
143
+
144
+ /**
145
+ * Disable the admin username.
146
+ *
147
+ * @since 1.0.0
148
+ *
149
+ * @param object $request Request data.
150
+ */
151
+ public function disable_admin_username( $request ) {
152
+ $new_usernames = $this->validate_and_get_option_value( $request, 'admin_names', false );
153
+ $value = $this->validate_and_get_option_value( $request, 'disable_usernames', false );
154
+
155
+ // Check if we need to update any usernames, provided by the user.
156
+ if ( ! empty( $new_usernames ) ) {
157
+ $update_result = $this->usernames_service->update_common_usernames( $new_usernames );
158
+ }
159
+
160
+ // Return false, when trying to enable the option, but username updates fail.
161
+ // Add the failed updates array if any.
162
+ if ( ! empty( $update_result ) ) {
163
+ self::send_json(
164
+ Message_Service::get_response_message( 0, 'disable_usernames', 0 ),
165
+ 0,
166
+ array(
167
+ 'disable_usernames' => 0,
168
+ 'usernames_data' => $update_result,
169
+ )
170
+ );
171
+ }
172
+
173
+ $result = $this->change_option( 'disable_usernames', $value );
174
+
175
+ // Set the response message.
176
+ self::send_json(
177
+ Message_Service::get_response_message( $result, 'disable_usernames', $value ),
178
+ $result,
179
+ array(
180
+ 'disable_usernames' => $value,
181
+ )
182
+ );
183
+ }
184
+
185
+ /**
186
+ * Limit the number of unsuccessful login attempts.
187
+ *
188
+ * @since 1.0.0
189
+ *
190
+ * @param object $request Request data.
191
+ */
192
+ public function limit_login_attempts( $request ) {
193
+ $attempts = intval( $this->validate_and_get_option_value( $request, 'login_attempts' ) );
194
+
195
+ update_option( 'sg_security_login_attempts', $attempts );
196
+
197
+ delete_option( 'sg_security_unsuccessful_login' );
198
+
199
+ self::send_json(
200
+ 'Login attempts limited!',
201
+ 1,
202
+ $this->login_service->get_login_attempts_data( intval( get_option( 'sg_security_login_attempts', 0 ) ) )
203
+ );
204
+ }
205
+ }
core/Rest/Rest_Helper_Options.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security\Options_Service\Options_Service;
5
+ use SG_Security\Message_Service\Message_Service;
6
+ use SG_Security\Sg_2fa\Sg_2fa;
7
+ use SG_Security\Login_Service\Login_Service;
8
+ use SG_Security\Usernames_Service\Usernames_Service;
9
+
10
+ /**
11
+ * Rest Helper class that manages all of the options.
12
+ */
13
+ class Rest_Helper_Options extends Rest_Helper {
14
+
15
+ /**
16
+ * The constructor.
17
+ */
18
+ public function __construct() {
19
+ $this->options_service = new Options_Service();
20
+ $this->sg_2fa = new Sg_2fa();
21
+ $this->login_service = new Login_Service();
22
+ $this->usernames_service = new Usernames_Service();
23
+ }
24
+
25
+ /**
26
+ * Checks if the option key exists.
27
+ *
28
+ * @since 1.0.0
29
+ *
30
+ * @param object $request Request data.
31
+ * @param string $option The option name.
32
+ */
33
+ public function change_option_from_rest( $request, $option ) {
34
+ $value = $this->validate_and_get_option_value( $request, $option );
35
+ $result = $this->change_option( $option, $value );
36
+
37
+ // Set the response message.
38
+ self::send_json(
39
+ Message_Service::get_response_message( $result, $option, $value ),
40
+ $result,
41
+ array(
42
+ $option => $value,
43
+ )
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Provide all plugin options.
49
+ *
50
+ * @since 1.0.0
51
+ *
52
+ * @param object $request Request data.
53
+ */
54
+ public function fetch_options( $request ) {
55
+ // Get the option key.
56
+ $data = json_decode( $request->get_body(), true );
57
+ $login_type = get_option( 'sg_security_login_type', 'default' );
58
+ $login_allowed = get_option( 'users_can_register', false );
59
+
60
+ $pages = array(
61
+ 'security' => array(
62
+ 'lock_system_folders' => intval( get_option( 'sg_security_lock_system_folders', 0 ) ),
63
+ 'disable_file_edit' => intval( get_option( 'sg_security_disable_file_edit', 0 ) ),
64
+ 'wp_remove_version' => intval( get_option( 'sg_security_wp_remove_version', 0 ) ),
65
+ 'disable_xml_rpc' => intval( get_option( 'sg_security_disable_xml_rpc', 0 ) ),
66
+ 'disable_feed' => intval( get_option( 'sg_security_disable_feed', 0 ) ),
67
+ 'xss_protection' => intval( get_option( 'sg_security_xss_protection', 0 ) ),
68
+ 'xss_protection' => intval( get_option( 'sg_security_xss_protection', 0 ) ),
69
+ 'hsts_protection' => intval( get_option( 'sg_security_hsts_protection', 0 ) ),
70
+ 'delete_readme' => intval( get_option( 'sg_security_delete_readme', 0 ) ),
71
+ ),
72
+ 'login' => array(
73
+ 'sg2fa' => intval( get_option( 'sg_security_sg2fa', 0 ) ),
74
+ 'reset_2fa' => $this->sg_2fa->check_for_users_using_2fa(),
75
+ 'disable_usernames' => intval( get_option( 'sg_security_disable_usernames', 0 ) ),
76
+ 'usernames_data' => $this->usernames_service->check_for_common_usernames(),
77
+ 'login_access' => get_option( 'sg_login_access', array() ),
78
+ 'login_attempts' => $this->login_service->get_login_attempts_data( intval( get_option( 'sg_security_login_attempts', 0 ) ) ),
79
+ 'login_url' => array(
80
+ array(
81
+ 'type' => 'custom',
82
+ 'label' => 'Custom',
83
+ 'login' => get_option( 'sg_security_login_url', '' ),
84
+ 'signup' => 1 === intval( $login_allowed ) ? get_option( 'sg_security_login_register', '' ) : null,
85
+ 'selected' => 'custom' === $login_type ? 1 : 0,
86
+ ),
87
+ array(
88
+ 'type' => 'default',
89
+ 'label' => 'Default',
90
+ 'login' => wp_login_url(),
91
+ 'signup' => 1 === intval( $login_allowed ) ? site_url( 'wp-signup.php' ) : null,
92
+ 'selected' => 'default' === $login_type ? 1 : 0,
93
+ ),
94
+ ),
95
+ ),
96
+ );
97
+
98
+ // Send the error message if page does not exist.
99
+ if ( ! array_key_exists( $data['page'], $pages ) ) {
100
+ self::send_json( '', 0 );
101
+ }
102
+
103
+ // Send the response to react app.
104
+ self::send_json( '', 1, $pages[ $data['page'] ] );
105
+ }
106
+ }
core/Rest/Rest_Helper_Post_Hack_Actions.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security\Salt_Shaker\Salt_Shaker;
5
+ use SG_Security\Plugins_Service\Plugins_Service;
6
+ use SG_Security\Password_Service\Password_Service;
7
+ use \WP_Session_Tokens;
8
+
9
+ /**
10
+ * Rest Helper class that manages all of the post hack actions.
11
+ */
12
+ class Rest_Helper_Post_Hack_Actions extends Rest_Helper {
13
+
14
+ /**
15
+ * The constructor.
16
+ */
17
+ public function __construct() {
18
+ $this->salt_shaker = new Salt_Shaker();
19
+ $this->plugins_service = new Plugins_Service();
20
+ $this->password_service = new Password_Service();
21
+ }
22
+
23
+ /**
24
+ * Reinstalls all free plugins.
25
+ *
26
+ * @since 1.0.0
27
+ */
28
+ public function resinstall_plugins() {
29
+ $result = $this->plugins_service->reinstall_plugins();
30
+ // Reinstall plugins.
31
+ self::send_json(
32
+ $this->get_response_message( $result, 'reinstall_plugins' ),
33
+ $result
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Force passwords reset.
39
+ *
40
+ * @since 1.0.0
41
+ */
42
+ public function force_password_reset() {
43
+ $this->salt_shaker->change_salts();
44
+ // Destroy all sessions.
45
+ WP_Session_Tokens::destroy_all_for_all_users();
46
+
47
+ $this->password_service->invalidate_passwords();
48
+ // Force password reset.
49
+ self::send_json(
50
+ $this->get_response_message( 1, 'force_password_reset' )
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Logs out all users
56
+ *
57
+ * @since 1.0.0
58
+ */
59
+ public function logout_users() {
60
+ $this->salt_shaker->change_salts();
61
+ // Destroy all sessions.
62
+ WP_Session_Tokens::destroy_all_for_all_users();
63
+
64
+ // Logout all users.
65
+ self::send_json(
66
+ $this->get_response_message( 1, 'logout_users' )
67
+ );
68
+ }
69
+ }
core/Rest/Rest_Helper_Site_Security.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Rest;
3
+
4
+ use SG_Security\Rest\Rest_Helper_Options;
5
+ use SG_Security\Readme_Service\Readme_Service;
6
+ use SG_Security\Htaccess_Service\Directory_Service;
7
+ use SG_Security\Htaccess_Service\Headers_Service;
8
+ use SG_Security\Htaccess_Service\Xmlrpc_Service;
9
+ use SG_Security\Htaccess_Service\Hsts_Service;
10
+ use SG_Security\Message_Service\Message_Service;
11
+ use SG_Security\Options_Service\Options_Service;
12
+
13
+ /**
14
+ * Rest Helper class that manages the site security.
15
+ */
16
+ class Rest_Helper_Site_Security extends Rest_Helper {
17
+
18
+ /**
19
+ * The constructor.
20
+ */
21
+ public function __construct() {
22
+ $this->readme_service = new Readme_Service();
23
+ $this->rest_helper_options = new Rest_Helper_Options();
24
+ $this->directory_service = new Directory_Service();
25
+ $this->hsts_service = new Hsts_Service();
26
+ $this->xmlrpc_service = new Xmlrpc_Service();
27
+ }
28
+
29
+ /**
30
+ * Locks system folders.
31
+ *
32
+ * @since 1.0.0
33
+ *
34
+ * @param object $request Request data.
35
+ */
36
+ public function lock_system_folders( $request ) {
37
+ $value = $this->validate_and_get_option_value( $request, 'lock_system_folders' );
38
+ $this->directory_service->toggle_rules( $value );
39
+
40
+ $this->rest_helper_options->change_option_from_rest( $request, 'lock_system_folders' );
41
+ }
42
+
43
+ /**
44
+ * Disable the theme/plugins editor.
45
+ *
46
+ * @since 1.0.0
47
+ *
48
+ * @param object $request Request data.
49
+ */
50
+ public function disable_editors( $request ) {
51
+ $this->rest_helper_options->change_option_from_rest( $request, 'disable_file_edit' );
52
+ }
53
+
54
+ /**
55
+ * WP Version Removal
56
+ *
57
+ * @since 1.0.0
58
+ *
59
+ * @param object $request Request data.
60
+ */
61
+ public function hide_wp_version( $request ) {
62
+ $this->rest_helper_options->change_option_from_rest( $request, 'wp_remove_version' );
63
+ }
64
+
65
+ /**
66
+ * Disable XML-RPC
67
+ *
68
+ * @since 1.0.0
69
+ *
70
+ * @param object $request Request data.
71
+ */
72
+ public function disable_xml_rpc( $request ) {
73
+ $value = $this->validate_and_get_option_value( $request, 'disable_xml_rpc' );
74
+ $result = $this->xmlrpc_service->toggle_rules( $value );
75
+
76
+ if ( false === $result ) {
77
+ self::send_json(
78
+ Message_Service::get_response_message( $result, 'disable_xml_rpc', $value ),
79
+ $result
80
+ );
81
+ }
82
+
83
+ $this->rest_helper_options->change_option_from_rest( $request, 'disable_xml_rpc' );
84
+ }
85
+
86
+ /**
87
+ * Disable RSS and ATOM Feeds
88
+ *
89
+ * @since 1.0.0
90
+ *
91
+ * @param object $request Request data.
92
+ */
93
+ public function disable_feeds( $request ) {
94
+ $this->rest_helper_options->change_option_from_rest( $request, 'disable_feed' );
95
+ }
96
+
97
+ /**
98
+ * Enable advanced XSS protection.
99
+ *
100
+ * @since 1.0.0
101
+ *
102
+ * @param object $request Request data.
103
+ */
104
+ public function xss_protection( $request ) {
105
+ $this->rest_helper_options->change_option_from_rest( $request, 'xss_protection' );
106
+ }
107
+
108
+ /**
109
+ * Enable HSTS protection.
110
+ *
111
+ * @since 1.1.0
112
+ *
113
+ * @param object $request Request data.
114
+ */
115
+ public function hsts_protection( $request ) {
116
+ $value = $this->validate_and_get_option_value( $request, 'hsts_protection' );
117
+
118
+ $this->hsts_service->toggle_rules( $value );
119
+
120
+ $this->rest_helper_options->change_option_from_rest( $request, 'hsts_protection' );
121
+ }
122
+
123
+ /**
124
+ * Deletes the WP readme.
125
+ *
126
+ * @since 1.0.0
127
+ */
128
+ public function delete_readme( $request ) {
129
+
130
+ // Get and validate value.
131
+ $value = $this->validate_and_get_option_value( $request, 'delete_readme' );
132
+
133
+ // If enabling, delete readme on request, continue if not.
134
+ if ( 1 === intval( $value ) ) {
135
+ $this->readme_service->delete_readme();
136
+ }
137
+
138
+ // Change the option in the DB, so that on the next update the hook for deleting the readme is called.
139
+ $this->rest_helper_options->change_option_from_rest( $request, 'delete_readme' );
140
+ }
141
+ }
core/Salt_Shaker/Salt_Shaker.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Salt_Shaker;
3
+
4
+ /**
5
+ * Class that manages User's Log-out services.
6
+ */
7
+ class Salt_Shaker {
8
+
9
+ /**
10
+ * The salts we need to change in order to logout all users.
11
+ *
12
+ * @var array
13
+ */
14
+ public $salts_array = array(
15
+ 'AUTH_KEY',
16
+ 'SECURE_AUTH_KEY',
17
+ 'LOGGED_IN_KEY',
18
+ 'NONCE_KEY',
19
+ 'AUTH_SALT',
20
+ 'SECURE_AUTH_SALT',
21
+ 'LOGGED_IN_SALT',
22
+ 'NONCE_SALT',
23
+ );
24
+
25
+ /**
26
+ * Regex for finding the salts we need to change.
27
+ *
28
+ * @var string
29
+ */
30
+ public $regex = '/^define\((\s)?[\'"]SALT_CONSTANT[\'"](\s)?,(.*?)\);/';
31
+
32
+ /**
33
+ * The path to the wp-config.
34
+ *
35
+ * @var string
36
+ */
37
+ public $config_file = ABSPATH . 'wp-config.php';
38
+
39
+ /**
40
+ * The path to the temporary wp-config we are creating.
41
+ *
42
+ * @var string
43
+ */
44
+ public $tmp_config_file = ABSPATH . 'wp-config-tmp.php';
45
+
46
+ /**
47
+ * The salt generator api.
48
+ *
49
+ * @var string
50
+ */
51
+ public $wp_salt_api = 'https://api.wordpress.org/secret-key/1.1/salt/';
52
+
53
+ /**
54
+ * Check if the config exists.
55
+ *
56
+ * @since 1.0.0
57
+ *
58
+ * @return string|bool The path to the config file if exists. False otherwise.
59
+ */
60
+ public function config_exist() {
61
+ if ( file_exists( $this->config_file ) &&
62
+ is_writable( $this->config_file )
63
+ ) {
64
+ return $this->config_file;
65
+ }
66
+
67
+ return false;
68
+ }
69
+
70
+ /**
71
+ * Get fresh salts from the API.
72
+ *
73
+ * @since 1.0.0
74
+ *
75
+ * @return bool|string False if we dont get a response, the fresh salts otherwise.
76
+ */
77
+ public function get_fresh_salts() {
78
+ // Get the salts from the salts generator.
79
+ $api_salts = wp_remote_get( $this->wp_salt_api );
80
+
81
+ // Bail if we don't get a response.
82
+ if ( 200 !== wp_remote_retrieve_response_code( $api_salts ) ) {
83
+ return false;
84
+ }
85
+
86
+ // Create the salts array.
87
+ $new_salts = explode( "\n", wp_remote_retrieve_body( $api_salts ) );
88
+
89
+ return $new_salts;
90
+ }
91
+
92
+ /**
93
+ * Start the change of salts.
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @return bool False if we fail one of the checks, true if we change the salts.
98
+ */
99
+ public function change_salts() {
100
+ // Bail if the config does not exist or is unwritable.
101
+ if ( false === $this->config_exist() ) {
102
+ return false;
103
+ }
104
+
105
+ // Get the fresh salts.
106
+ $new_salts = $this->get_fresh_salts();
107
+
108
+ // Bail if we dont get a response from the api.
109
+ if ( false === $new_salts ) {
110
+ return false;
111
+ }
112
+
113
+ // Check and save the file permissions.
114
+ $config_permissions = fileperms( $this->config_file );
115
+
116
+ // Open the File Stream.
117
+ $reading_config = fopen( $this->config_file, 'r' );
118
+ $writing_config = fopen( $this->tmp_config_file, 'w' );
119
+
120
+ // Check if we can lock the files and set LOCK_EX to acquire an exclusive lock (writer).
121
+ if (
122
+ ! flock( $reading_config, LOCK_EX ) ||
123
+ ! flock( $writing_config, LOCK_EX )
124
+ ) {
125
+ echo 'Cant lock the file.';
126
+
127
+ // Close the files, we are not editing since we cannot lock the file.
128
+ fclose( $reading_config );
129
+ fclose( $writing_config );
130
+
131
+ return false;
132
+ }
133
+
134
+ // While the pointer is not at the end of the file do some salt check.
135
+ while ( ! feof( $reading_config ) ) {
136
+
137
+ // Get the contents of the line.
138
+ $line = fgets( $reading_config );
139
+
140
+ $line = $this->replace_salts( $line, $new_salts );
141
+
142
+ // Write the new salt to the file.
143
+ fputs( $writing_config, $line );
144
+ }
145
+
146
+ // Close the file and unlock it.
147
+ fclose( $reading_config );
148
+ fclose( $writing_config );
149
+
150
+ // Rename the file.
151
+ rename( $this->tmp_config_file, $this->config_file );
152
+
153
+ // Keep the original permissions of wp-config.php.
154
+ chmod( $this->config_file, $config_permissions );
155
+
156
+ return true;
157
+ }
158
+
159
+ /**
160
+ * Loop the salts, find them in the config file and replace them with the newly genereated ones.
161
+ *
162
+ * @since 1.0.0
163
+ *
164
+ * @param string $line A line from the wp-config.
165
+ * @param array $new_salts The new salts generated from the API.
166
+ *
167
+ * @return string The edited lines.
168
+ */
169
+ public function replace_salts( $line, $new_salts ) {
170
+ // Loop trough salts, find the ones we are trying to change.
171
+ foreach ( $this->salts_array as $salt_key => $salt_value ) {
172
+
173
+ // Build the regex and replace the Salt constant with the key.
174
+ $regex = str_replace( 'SALT_CONSTANT', $salt_value, $this->regex );
175
+
176
+ // If we have a match prepare the change of salts.
177
+ if ( preg_match( $regex, $line, $match ) ) {
178
+ // Change the line with the new salt.
179
+ $line = $new_salts[ $salt_key ] . "\n";
180
+ }
181
+ }
182
+
183
+ return $line;
184
+ }
185
+ }
core/Sg_2fa/Sg_2fa.php ADDED
@@ -0,0 +1,827 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SG_Security\Sg_2fa;
3
+
4
+ use PHPGangsta_GoogleAuthenticator;
5
+ use SG_Security;
6
+
7
+ use PragmaRX\Recovery\Recovery;
8
+ use \WP_Session_Tokens;
9
+
10
+ /**
11
+ * Class that manages 2FA related services.
12
+ */
13
+ class Sg_2fa {
14
+ /**
15
+ * The singleton instance.
16
+ *
17
+ * @since 1.1.1
18
+ *
19
+ * @var \Sg_2fa The singleton instance.
20
+ */
21
+ public static $instance;
22
+
23
+ /**
24
+ * Roles that should be forced to use 2FA.
25
+ *
26
+ * @var array
27
+ */
28
+ public $roles = array(
29
+ 'editor',
30
+ 'administrator',
31
+ );
32
+
33
+ /**
34
+ * The constructor.
35
+ *
36
+ * @since 1.0.0
37
+ */
38
+ public function __construct() {
39
+ $this->google_authenticator = new PHPGangsta_GoogleAuthenticator();
40
+ $this->recovery = new Recovery();
41
+ }
42
+
43
+ /**
44
+ * Get the singleton instance.
45
+ *
46
+ * @since 1.1.1
47
+ *
48
+ * @return \Sg_2fa The singleton instance.
49
+ */
50
+ public static function get_instance() {
51
+ if ( null == self::$instance ) {
52
+ self::$instance = new self();
53
+ }
54
+ return self::$instance;
55
+ }
56
+
57
+ /**
58
+ * Get the roles that apply for 2FA.
59
+ *
60
+ * @since 1.2.0
61
+ *
62
+ * @return array The roles, that have 2FA enabled.
63
+ */
64
+ public function get_2fa_user_roles() {
65
+ return apply_filters( 'sg_security_2fa_roles', $this->roles );
66
+ }
67
+
68
+ /**
69
+ * Generate QR code for specific user.
70
+ *
71
+ * @since 1.0.0
72
+ *
73
+ * @param object $user The WP_USER object.
74
+ *
75
+ * @return string The QR code URL.
76
+ */
77
+ public function generate_qr_code( $user ) {
78
+ // Build the title for the authenticator.
79
+ $title = get_home_url() . ' (' . $user->user_email . ')';
80
+
81
+ // Get the user secret code.
82
+ $secret = get_user_meta( $user->ID, 'sg_security_2fa_secret', true ); // phpcs:ignore
83
+
84
+ // Return the URL.
85
+ return $this->google_authenticator->getQRCodeGoogleUrl( $title, $secret );
86
+ }
87
+
88
+ /**
89
+ * Verify the authenticaion code.
90
+ *
91
+ * @since 1.0.0
92
+ *
93
+ * @param string $code One time code from the authenticator app.
94
+ * @param int $user_id The user ID.
95
+ *
96
+ * @return bool True if the code is valid, false otherwise.
97
+ */
98
+ public function check_authentication_code( $code, $user_id ) {
99
+ // Get the user secret.
100
+ $secret = get_user_meta( $user_id, 'sg_security_2fa_secret', true ); // phpcs:ignore
101
+
102
+ // Verify the code.
103
+ return $this->google_authenticator->verifyCode( $secret, $code, 2 );
104
+ }
105
+
106
+ /**
107
+ * Enable 2FA.
108
+ *
109
+ * @since 1.0.0
110
+ *
111
+ * @return bool True on success, false on failure.
112
+ */
113
+ public function enable_2fa() {
114
+ $users = get_users(
115
+ array(
116
+ 'role__in' => $this->get_2fa_user_roles(),
117
+ )
118
+ );
119
+
120
+ if ( empty( $users ) ) {
121
+ return true;
122
+ }
123
+
124
+ foreach ( $users as $user ) {
125
+ // Get the user by the user id.
126
+ $user = get_userdata( $user->data->ID );
127
+
128
+ if ( empty( array_intersect( $this->get_2fa_user_roles(), $user->roles ) ) ) {
129
+ continue;
130
+ }
131
+
132
+ $session_tokens = WP_Session_Tokens::get_instance( $user->data->ID );
133
+ $session_tokens->destroy_all();
134
+ }
135
+
136
+ return true;
137
+ }
138
+
139
+ /**
140
+ * Handle 2FA option change.
141
+ *
142
+ * @since 1.0.0
143
+ *
144
+ * @param mixed $old_value Old option value.
145
+ * @param mixed $new_value New option value.
146
+ */
147
+ public function handle_option_change( $old_value, $new_value ) {
148
+ if ( 1 == $new_value ) {
149
+ $this->enable_2fa();
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Generate the user secret.
155
+ *
156
+ * @since 1.0.0
157
+ *
158
+ * @param int $user_id WordPress user ID.
159
+ *
160
+ * @return mixed True on success, false on failure, user ID if the secre