Sucuri Security – Auditing, Malware Scanner and Security Hardening - Version 1.7.14

Version Description

  • Added alternative method to send email alerts
  • Added button to reset options with explanation
  • Added suggestion for new users to check plugin settings
  • Allow mark as fixed non-writable core files
  • Fixed display menus items single or network panels
  • Fixed handle boolean values in PHP config retrieval
  • Fixed non-standard content location in core integrity
  • Fixed user identifier as integer on password reset
  • Modified css and js files to reduce size
  • Modified do not load resources on hidden sidebar
  • Modified fully redesign of general settings page
  • Modified hide update warning if versions are the same
  • Modified wording of post-types alert settings
  • Removed ellipsis of long IPv6 addresses in last logins
  • Removed unnecessary dns lookups in infosys page
  • Removed unnecessary monospace fonts in settings status
  • Removed unnecessary ssl verification option processor
Download this release

Release Info

Developer yorman
Plugin Icon 128x128 Sucuri Security – Auditing, Malware Scanner and Security Hardening
Version 1.7.14
Comparing to
See all releases

Code changes from version 1.7.13 to 1.7.14

Files changed (36) hide show
  1. inc/css/sucuri-scanner.min.css +1 -0
  2. inc/css/sucuriscan-default-css.css +0 -392
  3. inc/js/d3.min.js +5 -0
  4. inc/js/d3.v3.min.js +0 -5
  5. inc/js/sucuri-scanner.min.js +1 -0
  6. inc/js/sucuriscan-scripts.js +0 -80
  7. inc/tpl/base.html.tpl +1 -60
  8. inc/tpl/bsidebar.html.tpl +67 -0
  9. inc/tpl/hardening-panel.html.tpl +35 -0
  10. inc/tpl/hardening-whitelist.html.tpl +96 -0
  11. inc/tpl/hardening-whitelist.snippet.tpl +9 -0
  12. inc/tpl/hardening.html.tpl +19 -37
  13. inc/tpl/integrity-auditlogs.html.tpl +1 -1
  14. inc/tpl/integrity-corefiles.html.tpl +7 -7
  15. inc/tpl/integrity-corefiles.snippet.tpl +2 -4
  16. inc/tpl/lastlogins-all.snippet.tpl +1 -1
  17. inc/tpl/malwarescan-resmalware.html.tpl +16 -0
  18. inc/tpl/settings-apirecovery.html.tpl +29 -0
  19. inc/tpl/settings-apiregistered.html.tpl +11 -1
  20. inc/tpl/settings-general-apikey.html.tpl +59 -0
  21. inc/tpl/settings-general-apiproxy.html.tpl +23 -0
  22. inc/tpl/settings-general-apissl.html.tpl +38 -0
  23. inc/tpl/settings-general-apitimeout.html.tpl +34 -0
  24. inc/tpl/settings-general-commentmonitor.html.tpl +38 -0
  25. inc/tpl/settings-general-datastorage.html.tpl +54 -0
  26. inc/tpl/settings-general-ipdiscoverer.html.tpl +52 -0
  27. inc/tpl/settings-general-pwdcollector.html.tpl +39 -0
  28. inc/tpl/settings-general-resetoptions.html.tpl +38 -0
  29. inc/tpl/settings-general-reverseproxy.html.tpl +47 -0
  30. inc/tpl/settings-general-xhrmonitor.html.tpl +45 -0
  31. inc/tpl/settings-general.html.tpl +21 -195
  32. inc/tpl/settings-ignorerules.html.tpl +5 -4
  33. inc/tpl/setup-form.html.tpl +19 -3
  34. readme.txt +21 -2
  35. sucuri.php +1026 -678
  36. uninstall.php +6 -0
inc/css/sucuri-scanner.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .sucuriscan-wrap *,.sucuriscan-wrap *:before,.sucuriscan-wrap *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.sucuriscan-clearfix:before,.sucuriscan-clearfix:after{display:table;content:' '}.sucuriscan-clearfix:after{clear:both}.sucuriscan-hidden{display:none !important}.sucuriscan-opacity{opacity:.6}.sucuriscan-monospace{font-family:Menlo,Monaco,monospace,courier}.sucuriscan-ellipsis{overflow:hidden;display:inline-block;white-space:nowrap;text-overflow:ellipsis}.sucuriscan-wraptext{word-break:break-all}.sucuriscan-pull-left{float:left}.sucuriscan-pull-right{float:right}.sucuriscan-list li{list-style:disc;margin:0 0 5px 15px}.sucuriscan-gradient,.sucuriscan-modal-header,.sucuriscan-maincontent .sucuriscan-table tr>th,.sucuriscan-leftside #poststuff h3{background-color:#f1f1f1;background-image:-webkit-gradient(linear,left top,left bottom,from(#f9f9f9),to(#ececec));background-image:-webkit-linear-gradient(top,#f9f9f9,#ececec);background-image:-moz-linear-gradient(top,#f9f9f9,#ececec);background-image:-ms-linear-gradient(top,#f9f9f9,#ececec);background-image:-o-linear-gradient(top,#f9f9f9,#ececec);background-image:linear-gradient(top,#f9f9f9,#ececec);filter:"progid: DXImageTransform.Microsoft.Gradient(startColorstr=#f9f9f9, endColorstr=#ececec)";-ms-filter:"progid: DXImageTransform.Microsoft.Gradient(startColorstr=#f9f9f9, endColorstr=#ececec)"}.wp-core-ui .button-success,.wp-core-ui .button-success.focus,.wp-core-ui .button-success.hover,.wp-core-ui .button-success:focus,.wp-core-ui .button-success:hover{background:#8dcd5a;border-color:#48a325;box-shadow:inset 0 1px 0 rgba(195,230,180,0.6)}.wp-core-ui .button-success.focus,.wp-core-ui .button-success.hover,.wp-core-ui .button-success:focus,.wp-core-ui .button-success:hover{background:#69be48}.wp-core-ui .button-success.focus,.wp-core-ui .button-success:focus{border-color:#23500e}.wp-core-ui .button-success.active,.wp-core-ui .button-success.active:focus,.wp-core-ui .button-success.active:hover,.wp-core-ui .button-success:active{background:#47a61b;border-color:#358400}.wp-core-ui .button-success-disabled,.wp-core-ui .button-success.disabled,.wp-core-ui .button-success:disabled,.wp-core-ui .button-success[disabled]{color:#b2e794 !important;background:#74ba29 !important;border-color:#3f7f1b !important}.wp-core-ui .button-danger,.wp-core-ui .button-danger.focus,.wp-core-ui .button-danger.hover,.wp-core-ui .button-danger:focus,.wp-core-ui .button-danger:hover{background:#cd5050;border-color:#a52121;box-shadow:inset 0 1px 0 rgba(230,170,170,0.6)}.wp-core-ui .button-danger.focus,.wp-core-ui .button-danger.hover,.wp-core-ui .button-danger:focus,.wp-core-ui .button-danger:hover{background:#be4242}.wp-core-ui .button-danger.focus,.wp-core-ui .button-danger:focus{border-color:#500e0e}.wp-core-ui .button-danger.active,.wp-core-ui .button-danger.active:focus,.wp-core-ui .button-danger.active:hover,.wp-core-ui .button-danger:active{background:#a61b1b;border-color:#840000}.wp-core-ui .button-danger-disabled,.wp-core-ui .button-danger.disabled,.wp-core-ui .button-danger:disabled,.wp-core-ui .button-danger[disabled]{color:#e79494 !important;background:#ba2929 !important;border-color:#7f1b1b !important}.wp-core-ui .sucuriscan-btnblock{display:block;width:100%;text-align:center}.sucuriscan-overlay{position:fixed;top:0;left:0;bottom:0;right:0;z-index:9990;background:rgba(0,0,0,0.5)}.sucuriscan-modal{position:absolute;top:25px;left:15%;z-index:9990;width:55%}.sucuriscan-modal-outside{position:relative;left:0;border:1px solid #ddd}.sucuriscan-modal-inside{background:#fff;padding:20px}.sucuriscan-modal-header{padding:0;border-bottom:1px solid #ddd}#poststuff h3.sucuriscan-modal-title,.sucuriscan-leftside #poststuff h3.sucuriscan-modal-title,.sucuriscan-modal-header .sucuriscan-modal-title{margin:0;padding:0;float:left;line-height:38px;margin-left:10px;border-bottom:0}.sucuriscan-modal-header .sucuriscan-modal-logo{display:inline-block;float:left;margin-top:8px;margin-left:18px}.sucuriscan-modal-header .sucuriscan-modal-logo img{height:22px}.sucuriscan-modal-close{display:inline-block;position:absolute;top:0;right:0;font-size:16px;font-weight:bold;text-decoration:none;line-height:38px;padding:0 15px;border-left:1px solid #ddd}.sucuriscan-modal-inside p:first-child{margin-top:0}.sucuriscan-modal-inside p:last-child{margin-bottom:0}.sucuriscan-label,.sucuriscan-label-default,.sucuriscan-label-unknown,.sucuriscan-label-primary,.sucuriscan-label-success,.sucuriscan-label-info,.sucuriscan-label-notice,.sucuriscan-label-warning,.sucuriscan-label-danger,.sucuriscan-label-error{display:inline;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;padding:.2em .6em .3em;border-radius:.25em}.sucuriscan-label-default,.sucuriscan-label-unknown{background:#777}.sucuriscan-label-danger,.sucuriscan-label-error{background:#d9534f}.sucuriscan-label-info,.sucuriscan-label-notice{background:#5bc0de}.sucuriscan-label-warning{background:#f0ad4e}.sucuriscan-label-success{background:#5cb85c}.sucuriscan-label-primary{background:#428bca}.sucuriscan-wrap{margin-top:20px}.sucuriscan-wrap .sucuriscan-maincontent{margin:20px 0}.sucuriscan-wrap .sucuriscan-leftside{width:73.5%;float:left}.sucuriscan-wrap .sucuriscan-onecolumn{width:100%}.sucuriscan-wrap .sucuriscan-sidebar{width:25%;float:right}.sucuriscan-wrap #warnings_hook{line-height:initial;padding:0}.sucuriscan-wrap .sucuriscan-navbar{padding-top:20px;padding-left:6px}.sucuriscan-wrap .sucuriscan-navbar .nav-tab{margin-right:0}.sucuriscan-header,.sucuriscan-footer{position:relative;min-width:255px;background:#333;margin:0;padding:10px;border-radius:4px}.sucuriscan-footer .sucuriscan-help{color:#fff;float:right;text-align:right}.sucuriscan-footer .sucuriscan-help p{line-height:38px;margin:0 10px 0 0;padding:0}.sucuriscan-wrap .sucuriscan-logo,.sucuriscan-wrap .sucuriscan-header h2,.sucuriscan-wrap .sucuriscan-footer h2{float:left;margin:0;padding:0}.sucuriscan-wrap .sucuriscan-logo{display:inline-block}.sucuriscan-wrap .sucuriscan-logo img{display:block}.sucuriscan-wrap .sucuriscan-header h2,.sucuriscan-wrap .sucuriscan-footer h2{color:#fff;line-height:38px;margin-left:10px;text-shadow:#000 0 1px 0}.sucuriscan-leftside #poststuff .postbox:last-child{margin-bottom:0}.sucuriscan-leftside #poststuff .postbox h3{border-bottom:1px solid #ddd}.sucuriscan-maincontent abbr{text-decoration:underline;cursor:help}.wrap div.sucuriscan-setup-notice{background:#bbe8f5;margin:0 0 20px 0;padding:0;border:1px solid #bbb;border-radius:3px;-webkit-box-shadow:none;box-shadow:none}.wrap div.sucuriscan-setup-notice .sucuriscan-setup-image,.wrap div.sucuriscan-setup-notice .sucuriscan-setup-image img{border-radius:3px 0 0 3px}.wrap div.sucuriscan-setup-notice .sucuriscan-setup-image{background:#333;margin:-1px 0 -1px -1px;padding:7px 10px;border-right:1px solid transparent}.wrap div.sucuriscan-setup-notice .sucuriscan-setup-form{padding:4px;padding-left:0}.wrap div.sucuriscan-setup-notice p{font-size:14px;line-height:20px;margin:0 0 0 10px;padding:7px 0}.wrap div.sucuriscan-setup-notice,.wrap div.sucuriscan-setup-notice .sucuriscan-setup-image{border-color:#4393ac}.wp-core-ui .sucuriscan-review-hero,.wp-core-ui .button.sucuriscan-review-hero{position:relative;top:-2px;right:-15px;height:initial;line-height:30px;float:right;padding:0 20px}.sucuriscan-input-group>label{display:inline-block;border:1px solid #ddd;border-right:0;line-height:26px;float:left;padding:0 10px;background:#eee}.sucuriscan-input-group>input[type=text]{margin:0;padding-bottom:4px}.sucuriscan-input-group>select{vertical-align:initial;margin:0}.sucuriscan-table-setup td{vertical-align:top}.sucuriscan-table-setup .sucuriscan-description{font-size:12px;margin-top:10px}.sucuriscan-dismiss-setup{font-size:10px;line-height:28px}.sucuriscan-maincontent .sucuriscan-table{margin-top:12px}.sucuriscan-maincontent .sucuriscan-table tr>th{border-top:1px solid #e5e5e5;border-bottom:1px solid #e5e5e5}.sucuriscan-maincontent .sucuriscan-table tr:first-child th{border-top:0}.sucuriscan-maincontent .sucuriscan-table td.check-column{padding:8px 10px}.sucuriscan-maincontent .sucuriscan-striped-table tr:nth-child(even){background:#f5f5f5}.sucuriscan-table-double-title tr:first-child th{border-bottom:0}.sucuriscan-table-triple-title tr:first-child th,.sucuriscan-table-triple-title tr:first-child+tr th{border-bottom:0}.sucuriscan-table-quad-title tr:first-child th,.sucuriscan-table-quad-title tr:first-child+tr th,.sucuriscan-table-quad-title tr:first-child+tr+tr th{border-bottom:0}.sucuriscan-table-description{border-left-width:1px !important;box-shadow:none}.sucuriscan-table-description .inside{border-bottom:0 !important}.widefat td.td-with-button{text-align:right;padding:3px 10px}.widefat td.td-with-button button{min-width:90px}.widefat td.td-with-button select{height:initial;line-height:initial;vertical-align:top;margin:0;padding:2px 0 3px 0}.widefat th.check-column{line-height:36px;padding:0}.widefat th.check-column input[type=checkbox]{margin:1px 0 0 10px}.sucuriscan-list-as-table{background:#fff;border:1px solid #e5e5e5}.sucuriscan-list-as-table li{line-height:30px;word-break:break-all;margin:0;padding:0 10px}.sucuriscan-list-as-table li:nth-child(odd){background:#f5f5f5}.sucuriscan-list-as-table-scrollable{height:300px;overflow:hidden;overflow-y:scroll}.sucuriscan-maincontent .thead-with-button{padding:5px 5px 5px 10px}.sucuriscan-maincontent .thead-with-button>span{display:inline-block;line-height:28px}.sucuriscan-maincontent .thead-with-button .input-text{line-height:26px}.sucuriscan-maincontent .thead-with-button select{margin:0;padding:0}.sucuriscan-maincontent .thead-topright-action{display:inline-block;float:right}.sucuriscan-ad{color:#fff;padding:20px;margin-bottom:20px}.sucuriscan-ad h3,.sucuriscan-ad h4,.sucuriscan-ad .sucuriscan-ad-btn{font-family:Arial,Helvetica,sans-serif;color:#fff;margin:0}.sucuriscan-ad h3{font-size:18px;font-weight:300}.sucuriscan-ad h4{font-size:22px;font-weight:bold;margin-top:10px}.sucuriscan-ad .sucuriscan-ad-btn{display:block;font-size:13px;font-weight:bold;text-align:center;text-decoration:none;text-transform:uppercase;margin-top:20px;padding:5px;border-radius:20px}.sucuriscan-ad .sucuriscan-ad-footer{margin-top:20px;margin-bottom:0}.sucuriscan-ad .sucuriscan-ad-footer ul{margin:0}.sucuriscan-ad .sucuriscan-ad-footer li{font-size:12px;color:#fff;list-style:disc;margin:0 0 0 16px}.sucuriscan-ad .sucuriscan-ad-footer li.featured{color:#fde44c}.sucuriscan-scanner-video{width:100%;background:#fff;border:1px solid #ddd}.sucuriscan-sidebar .sucuriscan-supportbtn{width:100%;height:initial;text-align:center;line-height:36px;margin-top:15px;padding:0}.wp-core-ui .sucuriscan-hide-ads{display:block;color:#666;font-size:11px;text-decoration:underline;margin-top:15px;padding:0}.wp-core-ui .sucuriscan-hide-ads:focus{color:#000;box-shadow:none}.sucuriscan-ad-firewall{background:#606e77}.sucuriscan-ad-firewall .sucuriscan-ad-btn{background:#606e77;border:1px solid #fff}.sucuriscan-ad-firewall .sucuriscan-ad-btn:hover{background:#85929b}.sucuriscan-ad-antivirus{background:#04833e;padding-bottom:0}.sucuriscan-ad-antivirus .sucuriscan-ad-website{display:block;text-decoration:none;margin-top:20px}.sucuriscan-ad-antivirus .sucuriscan-ad-website img{display:block;max-width:100%}.sucuriscan-ad-antivirus .sucuriscan-ad-btn{background-color:#e8840a;background-image:-webkit-gradient(linear,left top,left bottom,from(#e8840a),to(#ef7f02));background-image:-webkit-linear-gradient(top,#e8840a,#ef7f02);background-image:-moz-linear-gradient(top,#e8840a,#ef7f02);background-image:-ms-linear-gradient(top,#e8840a,#ef7f02);background-image:-o-linear-gradient(top,#e8840a,#ef7f02);background-image:linear-gradient(top,#e8840a,#ef7f02);filter:"progid: DXImageTransform.Microsoft.Gradient(startColorstr=#e8840a, endColorstr=#ef7f02)";-ms-filter:"progid: DXImageTransform.Microsoft.Gradient(startColorstr=#e8840a, endColorstr=#ef7f02)";box-shadow:inset 0 1px 1px #eaac3a;border:1px solid #d17301}div.sucuriscan-alert{position:relative;margin:0 0 20px 0}div.sucuriscan-alert>a.close{position:absolute;top:10px;right:10px;font-size:18px;font-weight:bold;text-decoration:none}.sucuriscan-inline-alert,.sucuriscan-inline-alert-updated,.sucuriscan-inline-alert-error,.sucuriscan-inline-alert-warning,.sucuriscan-inline-alert-info{background:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1);padding:0;border-left:4px solid #ddd}.sucuriscan-inline-alert>p,.sucuriscan-inline-alert-updated>p,.sucuriscan-inline-alert-error>p,.sucuriscan-inline-alert-warning>p,.sucuriscan-inline-alert-info>p{margin:0;padding:8px 12px;border:1px solid #ddd;border-left:0}.sucuriscan-inline-alert-updated,.sucuriscan-inline-alert-warning,.sucuriscan-inline-alert-error,.sucuriscan-inline-alert-info{margin-bottom:10px}.sucuriscan-inline-alert-updated{border-left-color:#7ad03a}.sucuriscan-inline-alert-warning{border-left-color:#ffba00}.sucuriscan-inline-alert-error{border-left-color:#dd3d36}.sucuriscan-inline-alert-info{border-left-color:#2ea2cc}.sucuriscan-tabs>ul{margin:0}.sucuriscan-tabs>ul li,.sucuriscan-tabs>ul li>a{display:inline-block}.sucuriscan-tabs>ul li{margin-bottom:0}.sucuriscan-tabs>ul li>a{background:#e5e5e5;font-size:13px;font-weight:bold;color:#333;line-height:38px;text-decoration:none;padding:0 10px}.sucuriscan-tabs>ul li>a.sucuriscan-tab-active{background:#fff;border:1px solid #e1e1e1;border-bottom:0}.sucuriscan-tabs>ul li.sucuriscan-red-tab a{background:#ff8a83;color:#fff}.sucuriscan-tabs>ul li.sucuriscan-red-tab a.sucuriscan-tab-active{background:#dd3d36;border-color:#dd3d36}.sucuriscan-maincontent .sucuriscan-tab-containers>div>table{margin-top:0}.sucuriscan-maincontent .sucuriscan-tab-containers>div>#poststuff{margin-top:0}.sucuriscan-getapi-div{background:#fff;margin:0 0 20px 0;border:1px solid #e5e5e5;border-radius:3px}.sucuriscan-getapi-div p{margin:0;padding:10px}.sucuriscan-getapi-form button.button-primary{width:100%;height:initial;line-height:30px;margin:0 0 -1px 0;padding:0;border-radius:0 0 3px 3px}.sucuriscan-malwarescan-message{margin-bottom:20px !important}.sucuriscan-loading{background:#fff;text-align:center;padding:30px;padding-bottom:15px;border:1px solid #ddd;border-radius:4px}.sucuriscan-loading p,.sucuriscan-loading h3{margin:0;padding:0}.sucuriscan-loading .title{font-size:28px;margin-bottom:10px}.sucuriscan-loading .description{font-size:16px}.sucuriscan-sitelogo{width:190px;height:100px;background:url('http://sitecheck.sucuri.net/images/sucuri-sprite.png') no-repeat;margin:0 auto}.sucuriscan-sitecheck-form{margin:20px 0 0 0}.sucuriscan-sitecheck-form .button.button-hero{padding:0 46px}.sucuriscan-loading .sucuriscan-sitecheck-disclaimer{text-align:justify;padding-top:20px;border-top:1px solid #ddd}.sucuriscan-loading .sucuriscan-sitecheck-disclaimer p{font-size:10px}.sucuriscan-maincontent .sucuriscan-border{border:0;border-left:4px solid #ddd}.sucuriscan-maincontent .sucuriscan-border>h3,.sucuriscan-maincontent .sucuriscan-border>.inside{border-top:1px solid #e5e5e5;border-right:1px solid #e5e5e5}.sucuriscan-maincontent .sucuriscan-border>h3{border-bottom:0}.sucuriscan-maincontent .sucuriscan-border>.inside{margin-top:0 !important;border-bottom:1px solid #ddd}.sucuriscan-maincontent .sucuriscan-border-good,.sucuriscan-maincontent .sucuriscan-border-success{border-left-color:#7ad03a}.sucuriscan-maincontent .sucuriscan-border-bad,.sucuriscan-maincontent .sucuriscan-border-danger{border-left-color:#dd3d36}.sucuriscan-maincontent .sucuriscan-border-info{border-left-color:#2ea2cc}.sucuriscan-maincontent .sucuriscan-cleanup-btn{margin:20px 0 0 0}.sucuriscan-scanner-results .sucuriscan-scanner-details tr:nth-child(even),.sucuriscan-scanner-results .sucuriscan-scanner-links tr:nth-child(even){background:#f5f5f5}.sucuriscan-scanner-results td.sucuriscan-border-bad{border-left-width:4px;border-left-style:solid}.sucuriscan-scanner-results .sucuriscan-malware-link{text-align:right}.sucuriscan-scanner-results .sucuriscan-malware-link a:hover{color:#fff}.sucuriscan-malware-payload{background:#f5f5f5;word-break:break-all;margin:-2px -15px -15px -15px;padding:15px}.sucuriscan-maincontent .sucuriscan-corefiles,.sucuriscan-maincontent .sucuriscan-integrity-message,.sucuriscan-maincontent .sucuriscan-wordpress-outdated,.sucuriscan-maincontent .sucuriscan-auditlogs{margin-top:0;margin-bottom:20px}.sucuriscan-maincontent .sucuriscan-auditlogs{margin-bottom:0}.sucuriscan-auditlogs .sucuriscan-list-as-table{margin-bottom:0}.sucuriscan-auditlogs .sucuriscan-maxper-page{text-align:right}.sucuriscan-auditlogs .sucuriscan-label{display:inline-block;width:18px;text-transform:uppercase;line-height:13px;cursor:pointer;border-radius:50%}.sucuriscan-auditlogs .sucuriscan-auditlog-success,.sucuriscan-label-added{background:#5cb85c}.sucuriscan-auditlogs .sucuriscan-auditlog-debug{background:#c690ec}.sucuriscan-auditlogs .sucuriscan-auditlog-info{background:#5bc0de}.sucuriscan-auditlogs .sucuriscan-auditlog-notice{background:#428bca}.sucuriscan-auditlogs .sucuriscan-auditlog-warning,.sucuriscan-label-modified{background:#f0ad4e}.sucuriscan-auditlogs .sucuriscan-auditlog-error,.sucuriscan-label-removed{background:#f27d7d}.sucuriscan-auditlogs .sucuriscan-auditlog-critical{background:#000}.sucuriscan-maincontent .sucuriscan-audit-report{border-left-width:1px}.sucuriscan-audit-report .sucuriscan-report-row{margin-bottom:10px}.sucuriscan-audit-report .sucuriscan-report-row:last-child{margin-bottom:0}.sucuriscan-audit-report .sucuriscan-report-chart{width:49%;border:1px solid #ddd}.sucuriscan-audit-report .sucuriscan-report-chart h4,.sucuriscan-audit-report .sucuriscan-report-chart h5{font-weight:normal;text-align:center;margin:0}.sucuriscan-audit-report .sucuriscan-report-chart h4{font-size:18px;margin-top:10px}.sucuriscan-audit-report .sucuriscan-report-chart h5{font-size:12px;margin-top:5px}.sucuriscan-maincontent .sucuriscan-audit-report .sucuriscan-inline-alert-info{margin-top:10px}.sucuriscan-status-type{display:inline-block;width:20px;background:#ddd;text-align:center;text-transform:uppercase;margin-right:10px;padding:0 3px;border:1px solid transparent;border-radius:3px}td.sucuriscan-corefiles-warning>div{background:#f2dede;color:#a94442;border-color:#ebccd1}.sucuriscan-maincontent .sucuriscan-corefiles .sucuriscan-label{text-transform:capitalize}.sucuriscan-maincontent td.sucuriscan-corefiles-warning,.sucuriscan-maincontent td.sucuriscan-corefiles-warning p{margin:0;padding:0}.sucuriscan-maincontent td.sucuriscan-corefiles-warning div{padding:10px;border-width:1px;border-style:solid}.sucuriscan-maincontent td.sucuriscan-corefiles-warning code{font-size:12px;padding:0 5px}.sucuriscan-maincontent .sucuriscan-integrity-message{position:relative}.sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-mark,.sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-failure{position:absolute;top:1px;right:1px;background:#ddd;font-weight:bold;color:#fff;line-height:35px;padding:0 10px;border-left:1px solid #ddd}.sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-mark{background:#7ad03a}.sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-failure{background:#dd3d36;border-left:0}.sucuriscan-maincontent .sucuriscan-ignoredfiles{margin-top:0}.sucuriscan-ignore-file form{padding:10px;padding-top:0;border-bottom:1px solid #ddd;border-right:1px solid #ddd}.sucuriscan-ignore-file p{border-bottom:0}.sucuriscan-ignore-file-input{width:80%}.sucuriscan-ignore-file-button{width:18%}.sucuriscan-maincontent .sucuriscan-modifiedfiles .sucuriscan-ellipsis{width:100px}.sucuriscan-monitoring-settings{margin-bottom:20px}.sucuriscan-monitoring-settings td.td-with-button{text-align:left}.sucuriscan-monitoring-settings .sucuriscan-list-as-table{margin:0}.sucuriscan-monitoring-apikey-form .input-text{width:85%}.sucuriscan-monitoring-logs .thead-with-button .button{width:65px}.sucuriscan-monitoring-logs .thead-with-button .input-text,.sucuriscan-monitoring-logs .thead-with-button select{width:250px}.sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form select{width:70px}.sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form select+select{width:112px}.sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form select+select+select{width:60px}.sucuriscan-monitoring-logs .sucuriscan-target-date{font-size:12px;color:#999;margin-right:5px}.sucuriscan-monitoring-logs .sucuriscan-denial-type{font-size:14px}.sucuriscan-monitoring-logs .sucuriscan-denial-type-date{font-style:italic;color:#999}.sucuriscan-request-summary{margin:-15px;margin-top:-3px}.sucuriscan-request-summary td{font-size:14px}.sucuriscan-request-summary tr td:first-child{font-weight:bold}.sucuriscan-request-summary td+td{word-break:break-all}.sucuriscan-hstatus{position:relative;margin:0 -12px;padding:10px 12px;border:1px solid transparent}.sucuriscan-hstatus-0{background-color:#f2dede;color:#a94442;border-color:#ebccd1}.sucuriscan-hstatus-1{background-color:#dff0d8;color:#3c763d;border-color:#d6e9c6}.sucuriscan-hstatus-2{background-color:#dee4f2;color:#4263a9;border-color:#ccd0eb}.sucuriscan-hstatus .button-primary,.sucuriscan-hstatus .button-secondary{position:absolute;top:5px;right:5px}.sucuriscan-hardening .postbox .inside pre{background:#eaeaea;padding:10px}.sucuriscan-hardening-whitelist form{margin-top:15px}.sucuriscan-hardening-whitelist form label{line-height:29px;font-size:12px;background-color:#eee;padding:0 10px;display:inline-block;border:1px solid #ddd;border-right:0}.sucuriscan-hardening-whitelist form input[type=text]{margin:0;padding:5px}.sucuriscan-hardening-whitelist form select{height:initial;padding:4px;margin:0}.sucuriscan-hardening-whitelist form select,.sucuriscan-hardening-whitelist form input[type=text],.sucuriscan-hardening-whitelist form .button{margin-right:5px}.sucuriscan-maincontent .sucuriscan-table.sucuriscan-hardening-whitelist-table{margin-top:0}.sucuriscan-lastlogin-outof{font-style:italic;color:#999;margin-right:10px}.sucuriscan-admins-lastlogins .sucuriscan-ellipsis{width:170px}.sucuriscan-admins-lastlogins td{padding:4px 8px}.sucuriscan-pattern-search-inputbox{margin-top:12px}.sucuriscan-pattern-search-inputbox .input-text{width:84.7777%;line-height:30px;margin:0;margin-right:6px}.sucuriscan-pattern-search-inputbox .input-button{width:14%;height:initial;line-height:35px}.sucuriscan-pattern-search .sucuriscan-cleanup-btn{margin-top:12px}.sucuriscan-pattern-search table label{color:#999}.sucuriscan-pattern-search .sucuriscan-grep-text em{color:#ea3838}.sucuriscan-about ul{margin-left:20px}.sucuriscan-about ul li{list-style:initial}.sucuriscan-about li label{font-weight:bold;vertical-align:initial}.sucuriscan-apikey-registered .sucuriscan-pull-right{width:400px}.sucuriscan-apikey-registered .sucuriscan-sitelogo{background-position:0 -17px;height:83px}.sucuriscan-setup-instructions .form-table{margin-top:15px}.sucuriscan-setup-instructions .form-table td{padding:0;padding-bottom:12px}.sucuriscan-setup-instructions .form-table select{max-width:400px}.sucuriscan-pagination{display:inline-block;margin:0;padding:0;border-radius:4px}.sucuriscan-pagination>li{display:inline}.sucuriscan-pagination>li>a,.sucuriscan-pagination>li>span{position:relative;background:#fff;color:#428bca;line-height:1.42857143;text-decoration:none;float:left;margin-left:-1px;padding:6px 12px;border:1px solid #ddd}.sucuriscan-pagination>li:first-child>a,.sucuriscan-pagination>li:first-child>span{margin-left:0;border-radius:4px 0 0 4px}.sucuriscan-pagination>li:last-child>a,.sucuriscan-pagination>li:last-child>span{border-radius:0 4px 4px 0}.sucuriscan-pagination>li>a.sucuriscan-pagination-active,.sucuriscan-pagination>li>a:hover{background:#0074a2;color:#fff}.sucuriscan_wpconfig_keys_updated textarea{width:100%;height:250px;background:#f5f5f5;font-size:12px;resize:vertical;margin:20px 0 0 0}.sucuriscan-maincontent .sucuriscan-last-logins{margin-top:0}.sucuriscan-maincontent .sucuriscan-last-logins .sucuriscan-ellipsis{width:150px;line-height:inherit}.sucuriscan-maincontent .sucuriscan-full-textarea{width:100%;height:400px;line-height:normal;resize:vertical;padding:10px}.sucuriscan-maincontent .sucuriscan-settings{margin-top:0}.sucuriscan-maincontent .sucuriscan-settings form{display:inline-block}.sucuriscan-maincontent .sucuriscan-settings select,.sucuriscan-maincontent .sucuriscan-settings .input-text{width:220px;margin:0}.sucuriscan-maincontent .sucuriscan-settings-notifications{margin-top:0}.sucuriscan-maincontent .sucuriscan-settings-notifications .dashicons-before:before{margin-right:5px}.sucuriscan-maincontent .sucuriscan-settings-ignorescanning{margin-top:0}.sucuriscan-maincontent .sucuriscan-settings-trustip{margin-top:0}.sucuriscan-maincontent .sucuriscan-wpcron-list{margin-top:0}.sucuriscan-maincontent .sucuriscan-infosys-htaccess .inside{border-bottom:1px solid #ddd !important}.sucuriscan-maincontent .sucuriscan-infosys-htaccess .inside .sucuriscan-inline-alert-updated{margin-bottom:10px}.sucuriscan-maincontent .sucuriscan-errorlogs .inside .sucuriscan-inline-alert-error{margin-top:10px}.sucuriscan-maincontent .sucuriscan-subject-formats{margin:0}.sucuriscan-maincontent .sucuriscan-subject-formats input[type=text]{width:40%;margin-left:10px}.c3 svg{font:10px sans-serif}.c3 line,.c3 path{fill:none;stroke:#000}.c3 text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.c3-bars path,.c3-event-rect,.c3-legend-item-tile,.c3-xgrid-focus,.c3-ygrid{shape-rendering:crispEdges}.c3-chart-arc path{stroke:#fff}.c3-chart-arc text{fill:#fff;font-size:13px}.c3-grid line{stroke:#aaa}.c3-grid text{fill:#aaa}.c3-xgrid,.c3-ygrid{stroke-dasharray:3 3}.c3-text.c3-empty{fill:gray;font-size:2em}.c3-line{stroke-width:1px}.c3-circle._expanded_{stroke-width:1px;stroke:#fff}.c3-selected-circle{fill:#fff;stroke-width:2px}.c3-bar{stroke-width:0}.c3-bar._expanded_{fill-opacity:.75}.c3-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}.c3-target.c3-focused{opacity:1}.c3-target.c3-focused path.c3-line,.c3-target.c3-focused path.c3-step{stroke-width:2px}.c3-target.c3-defocused{opacity:.3 !important}.c3-region{fill:#4682b4;fill-opacity:.1}.c3-brush .extent{fill-opacity:.1}.c3-legend-item{font-size:12px}.c3-legend-item-hidden{opacity:.15}.c3-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.c3-tooltip-container{z-index:10}.c3-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777}.c3-tooltip tr{border:1px solid #CCC}.c3-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#FFF}.c3-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.c3-tooltip td>span{display:inline-block;width:10px;height:10px;margin-right:6px}.c3-tooltip td.value{text-align:right}.c3-area{stroke-width:0;opacity:.2}.c3-chart-arcs .c3-chart-arcs-background{fill:#e0e0e0;stroke:none}.c3-chart-arcs .c3-chart-arcs-gauge-unit{fill:#000;font-size:16px}.c3-chart-arcs .c3-chart-arcs-gauge-max,.c3-chart-arcs .c3-chart-arcs-gauge-min{fill:#777}.c3-chart-arc .c3-gauge-value{fill:#000}@media(max-width:620px){.sucuriscan-tabs>ul li,.sucuriscan-tabs>ul li>a{display:block}.sucuriscan-getapi-form button.button-primary{line-height:40px}}@media(max-width:768px){.sucuriscan-wrap .sucuriscan-leftside,.sucuriscan-wrap .sucuriscan-sidebar,.sucuriscan-wrap .sucuriscan-footer .sucuriscan-logo,.sucuriscan-wrap .sucuriscan-footer .sucuriscan-help{float:none}.sucuriscan-wrap .sucuriscan-leftside,.sucuriscan-wrap .sucuriscan-sidebar{width:100%}.sucuriscan-wrap .sucuriscan-sidebar{margin-top:20px}.sucuriscan-wrap .sucuriscan-footer .sucuriscan-logo{display:table;margin:0 auto}}@media(max-width:920px){.sucuriscan-wrap .sucuriscan-navbar{padding-left:0;padding-right:0}.sucuriscan-wrap .sucuriscan-navbar .nav-tab{display:block;line-height:20px;margin:0}.sucuriscan-wrap .sucuriscan-navbar .nav-tab:last-child{border-bottom:1px solid #ccc}.wp-core-ui .sucuriscan-review-hero,.wp-core-ui .button.sucuriscan-review-hero{top:0;right:0;display:block;width:100%;margin:10px 0}}.sucuriscan-maincontent #poststuff{min-width:initial;padding-top:0}.sucuriscan-maincontent .widefat tbody th.check-column{padding:6px 0 3px 0}.sucuriscan-maincontent .hardening-box .primary-secondary{margin:0 0 0 10px}.sucuriscan-maincontent hr{border:0;border-top:1px solid #999}.sucuriscan-maincontent table td>table{background:#fff}.sucuriscan-maincontent table td>table th{padding:4px 8px}
inc/css/sucuriscan-default-css.css DELETED
@@ -1,392 +0,0 @@
1
- /**
2
- * Sucuri Security - SiteCheck Malware Scanner
3
- * Copyright (C) 2010-2015 Sucuri Security - http://sucuri.net
4
- * Released under the GPL - see LICENSE file for details.
5
- */
6
- /* Generic Styles */
7
- .sucuriscan-wrap *, .sucuriscan-wrap *:before, .sucuriscan-wrap *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
8
- .sucuriscan-clearfix:before, .sucuriscan-clearfix:after{display:table;content:' '}
9
- .sucuriscan-clearfix:after{clear:both}
10
- .sucuriscan-visible{}
11
- .sucuriscan-hidden{display:none !important}
12
- .sucuriscan-opacity{opacity:0.6}
13
- .sucuriscan-monospace{font-family:Menlo, Monaco, monospace, courier}
14
- .sucuriscan-ellipsis{overflow:hidden;display:inline-block;white-space:nowrap;text-overflow:ellipsis}
15
- .sucuriscan-wraptext{word-break:break-all}
16
- .sucuriscan-pull-left{float:left}
17
- .sucuriscan-pull-right{float:right}
18
- .sucuriscan-list li{list-style:disc;margin:0 0 5px 15px}
19
- .sucuriscan-gradient, .sucuriscan-modal-header, .sucuriscan-maincontent .sucuriscan-table tr > th{
20
- background-color: #f1f1f1;
21
- background-image: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));
22
- background-image: -webkit-linear-gradient(top, #f9f9f9, #ececec);
23
- background-image: -moz-linear-gradient(top, #f9f9f9, #ececec);
24
- background-image: -ms-linear-gradient(top, #f9f9f9, #ececec);
25
- background-image: -o-linear-gradient(top, #f9f9f9, #ececec);
26
- background-image: linear-gradient(top, #f9f9f9, #ececec);
27
- filter: "progid:DXImageTransform.Microsoft.Gradient(startColorstr=#f9f9f9, endColorstr=#ececec)";
28
- -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(startColorstr=#f9f9f9, endColorstr=#ececec)";
29
- }
30
- /* WordPress Extra Buttons (success) */
31
- .wp-core-ui .button-success, .wp-core-ui .button-success.focus, .wp-core-ui .button-success.hover, .wp-core-ui .button-success:focus, .wp-core-ui .button-success:hover{background:#8dcd5a;border-color:#48a325;box-shadow:inset 0 1px 0 rgba(195, 230, 180, 0.6)}
32
- .wp-core-ui .button-success.focus, .wp-core-ui .button-success.hover, .wp-core-ui .button-success:focus, .wp-core-ui .button-success:hover{background:#69be48}
33
- .wp-core-ui .button-success.focus, .wp-core-ui .button-success:focus{border-color:#23500e}
34
- .wp-core-ui .button-success.active, .wp-core-ui .button-success.active:focus, .wp-core-ui .button-success.active:hover, .wp-core-ui .button-success:active{background:#47a61b;border-color:#358400}
35
- .wp-core-ui .button-success-disabled, .wp-core-ui .button-success.disabled, .wp-core-ui .button-success:disabled, .wp-core-ui .button-success[disabled]{color:#b2e794 !important;background:#74ba29 !important;border-color:#3f7f1b !important}
36
- /* WordPress Extra Buttons (danger) */
37
- .wp-core-ui .button-danger, .wp-core-ui .button-danger.focus, .wp-core-ui .button-danger.hover, .wp-core-ui .button-danger:focus, .wp-core-ui .button-danger:hover{background:#cd5050;border-color:#a52121;box-shadow:inset 0 1px 0 rgba(230, 170, 170, 0.6)}
38
- .wp-core-ui .button-danger.focus, .wp-core-ui .button-danger.hover, .wp-core-ui .button-danger:focus, .wp-core-ui .button-danger:hover{background:#be4242}
39
- .wp-core-ui .button-danger.focus, .wp-core-ui .button-danger:focus{border-color:#500e0e}
40
- .wp-core-ui .button-danger.active, .wp-core-ui .button-danger.active:focus, .wp-core-ui .button-danger.active:hover, .wp-core-ui .button-danger:active{background:#a61b1b;border-color:#840000}
41
- .wp-core-ui .button-danger-disabled, .wp-core-ui .button-danger.disabled, .wp-core-ui .button-danger:disabled, .wp-core-ui .button-danger[disabled]{color:#e79494 !important;background:#ba2929 !important;border-color:#7f1b1b !important}
42
- .wp-core-ui .sucuriscan-btnblock{display:block;width:100%;text-align:center}
43
- /* Modal Window */
44
- .sucuriscan-overlay{position:fixed;top:0;left:0;bottom:0;right:0;z-index:9990;background:rgba(0, 0, 0, 0.5)}
45
- .sucuriscan-modal{position:fixed;top:52px;left:26%;z-index:9990;width:48%}
46
- .sucuriscan-modal-outside{position:relative;left:0;border:1px solid #ddd}
47
- .sucuriscan-modal-inside{background:#fff;padding:20px}
48
- .sucuriscan-modal-header{padding:0;border-bottom:1px solid #ddd}
49
- .sucuriscan-modal-header .sucuriscan-modal-title{float:left;line-height:38px;margin:0;margin-left:10px}
50
- .sucuriscan-modal-header .sucuriscan-modal-logo{display:inline-block;float:left;margin-top:8px;margin-left:18px}
51
- .sucuriscan-modal-header .sucuriscan-modal-logo img{height:22px}
52
- .sucuriscan-modal-close{display:inline-block;position:absolute;top:0;right:0;font-size:16px;font-weight:bold;text-decoration:none;line-height:38px;padding:0 15px;border-left:1px solid #ddd}
53
- .sucuriscan-modal-inside p:first-child{margin-top:0}
54
- .sucuriscan-modal-inside p:last-child{margin-bottom:0}
55
- /* Label and Tags */
56
- .sucuriscan-label, .sucuriscan-label-default, .sucuriscan-label-unknown, .sucuriscan-label-primary, .sucuriscan-label-success, .sucuriscan-label-info, .sucuriscan-label-notice, .sucuriscan-label-warning, .sucuriscan-label-danger, .sucuriscan-label-error{display:inline;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;padding:0.2em 0.6em 0.3em;border-radius:0.25em}
57
- .sucuriscan-label-default, .sucuriscan-label-unknown{background:#777}
58
- .sucuriscan-label-danger, .sucuriscan-label-error{background:#d9534f}
59
- .sucuriscan-label-info, .sucuriscan-label-notice{background:#5bc0de}
60
- .sucuriscan-label-warning{background:#f0ad4e}
61
- .sucuriscan-label-success{background:#5cb85c}
62
- .sucuriscan-label-primary{background:#428bca}
63
- /* Interface Wrapper */
64
- .sucuriscan-wrap{margin-top:20px}
65
- .sucuriscan-wrap .sucuriscan-maincontent{margin:20px 0}
66
- .sucuriscan-wrap .sucuriscan-leftside{width:73.5%;float:left}
67
- .sucuriscan-wrap .sucuriscan-twocolumns{}
68
- .sucuriscan-wrap .sucuriscan-onecolumn{width:100%}
69
- .sucuriscan-wrap .sucuriscan-sidebar{width:25%;float:right}
70
- .sucuriscan-wrap #warnings_hook{line-height:initial;padding:0}
71
- .sucuriscan-wrap .sucuriscan-navbar{padding-top:20px;padding-left:6px}
72
- .sucuriscan-wrap .sucuriscan-navbar .nav-tab{margin-right:0}
73
- .sucuriscan-header, .sucuriscan-footer{position:relative;min-width:255px;background:#333;margin:0;padding:10px;border-radius:4px}
74
- .sucuriscan-footer .sucuriscan-help{color:#fff;float:right;text-align:right}
75
- .sucuriscan-footer .sucuriscan-help p{line-height:38px;margin:0 10px 0 0;padding:0}
76
- .sucuriscan-wrap .sucuriscan-logo, .sucuriscan-wrap .sucuriscan-header h2, .sucuriscan-wrap .sucuriscan-footer h2{float:left;margin:0;padding:0}
77
- .sucuriscan-wrap .sucuriscan-logo{display:inline-block}
78
- .sucuriscan-wrap .sucuriscan-logo img{display:block}
79
- .sucuriscan-wrap .sucuriscan-header h2, .sucuriscan-wrap .sucuriscan-footer h2{color:#fff;line-height:38px;margin-left:10px;text-shadow:#000 0 1px 0}
80
- .sucuriscan-leftside #poststuff .postbox:last-child{margin-bottom:0}
81
- .sucuriscan-maincontent abbr{text-decoration:underline;cursor:help}
82
- /* Page Setup Notice */
83
- .wrap div.sucuriscan-setup-notice{background:#bbe8f5;margin:0 0 20px 0;padding:0;border:1px solid #bbb;border-radius:3px;-webkit-box-shadow:none;box-shadow:none}
84
- .wrap div.sucuriscan-setup-notice .sucuriscan-setup-image, .wrap div.sucuriscan-setup-notice .sucuriscan-setup-image img{border-radius:3px 0 0 3px}
85
- .wrap div.sucuriscan-setup-notice .sucuriscan-setup-image{background:#333;margin:-1px 0 -1px -1px;padding:7px 10px;border-right:1px solid transparent}
86
- .wrap div.sucuriscan-setup-notice .sucuriscan-setup-form{padding:4px;padding-left:0}
87
- .wrap div.sucuriscan-setup-notice p{font-size:14px;line-height:20px;margin:0 0 0 10px;padding:7px 0}
88
- .wrap div.sucuriscan-setup-notice, .wrap div.sucuriscan-setup-notice .sucuriscan-setup-image{border-color:#4393ac}
89
- .wp-core-ui .sucuriscan-review-hero, .wp-core-ui .button.sucuriscan-review-hero{position:relative;top:-2px;right:-15px;height:initial;line-height:30px;float:right;padding:0 20px}
90
- .sucuriscan-table-setup{}
91
- .sucuriscan-table-setup td{vertical-align:top}
92
- .sucuriscan-table-setup .sucuriscan-description{font-size:12px;margin-top:10px}
93
- /* Table Styles */
94
- .sucuriscan-maincontent .sucuriscan-table{margin-top:12px}
95
- .sucuriscan-maincontent .sucuriscan-table tr > th{border-top:1px solid #e5e5e5;border-bottom:1px solid #e5e5e5}
96
- .sucuriscan-maincontent .sucuriscan-table tr:first-child th{border-top:0}
97
- .sucuriscan-maincontent .sucuriscan-table td.check-column{padding:8px 10px}
98
- .sucuriscan-maincontent .sucuriscan-striped-table tr:nth-child(even){background:#f5f5f5}
99
- .sucuriscan-table-double-title tr:first-child th{border-bottom:0}
100
- .sucuriscan-table-triple-title tr:first-child th, .sucuriscan-table-triple-title tr:first-child + tr th{border-bottom:0}
101
- .sucuriscan-table-quad-title tr:first-child th, .sucuriscan-table-quad-title tr:first-child + tr th, .sucuriscan-table-quad-title tr:first-child + tr + tr th{border-bottom:0}
102
- .sucuriscan-table-description{border-left-width:1px !important;box-shadow:none}
103
- .sucuriscan-table-description .inside{border-bottom:0 !important}
104
- .widefat td.td-with-button{text-align:right;padding:3px 10px}
105
- .widefat td.td-with-button button{min-width:90px}
106
- .widefat td.td-with-button select{height:initial;line-height:initial;vertical-align:top;margin:0;padding:2px 0 3px 0}
107
- .sucuriscan-list-as-table{background:#fff;border:1px solid #e5e5e5}
108
- .sucuriscan-list-as-table li{line-height:30px;word-break:break-all;margin:0;padding:0 10px}
109
- .sucuriscan-list-as-table li:nth-child(odd){background:#f5f5f5}
110
- .sucuriscan-list-as-table-scrollable{height:300px;overflow:hidden;overflow-y:scroll}
111
- /* Table Top-Right Buttons */
112
- .sucuriscan-maincontent .thead-with-button{padding:5px 5px 5px 10px}
113
- .sucuriscan-maincontent .thead-with-button > span{display:inline-block;line-height:28px}
114
- .sucuriscan-maincontent .thead-with-button .input-text{line-height:26px}
115
- .sucuriscan-maincontent .thead-with-button select{margin:0;padding:0}
116
- .sucuriscan-maincontent .thead-topright-action{display:inline-block;float:right}
117
- /* Sidebar Styles */
118
- .sucuriscan-ad {color:#fff;padding:20px;margin-bottom:20px}
119
- .sucuriscan-ad h3, .sucuriscan-ad h4, .sucuriscan-ad .sucuriscan-ad-btn {font-family:Arial, Helvetica, sans-serif;color:#fff;margin:0}
120
- .sucuriscan-ad h3 {font-size:18px;font-weight:300}
121
- .sucuriscan-ad h4 {font-size:22px;font-weight:bold;margin-top:10px}
122
- .sucuriscan-ad .sucuriscan-ad-btn {display:block;font-size:13px;font-weight:bold;text-align:center;text-decoration:none;text-transform:uppercase;margin-top:20px;padding:5px;border-radius:20px}
123
- .sucuriscan-ad .sucuriscan-ad-footer {margin-top:20px;margin-bottom:0}
124
- .sucuriscan-ad .sucuriscan-ad-footer ul {margin:0}
125
- .sucuriscan-ad .sucuriscan-ad-footer li {font-size:12px;color:#fff;list-style:disc;margin:0 0 0 16px}
126
- .sucuriscan-ad .sucuriscan-ad-footer li.featured {color:#fde44c}
127
- .sucuriscan-scanner-video{width:100%;background:#fff;border:1px solid #ddd}
128
- .sucuriscan-sidebar .sucuriscan-supportbtn{width:100%;height:initial;text-align:center;line-height:36px;margin-top:15px;padding:0}
129
- /* Sidebar Firewall Styles */
130
- .sucuriscan-ad-firewall {background:#606e77}
131
- .sucuriscan-ad-firewall .sucuriscan-ad-btn {background:#606e77;border:1px solid #fff}
132
- .sucuriscan-ad-firewall .sucuriscan-ad-btn:hover {background:#85929b}
133
- /* Sidebar Antivirus Styles */
134
- .sucuriscan-ad-antivirus {background:#04833e;padding-bottom:0}
135
- .sucuriscan-ad-antivirus .sucuriscan-ad-website {display:block;text-decoration:none;margin-top:20px}
136
- .sucuriscan-ad-antivirus .sucuriscan-ad-website img {display:block;max-width:100%}
137
- .sucuriscan-ad-antivirus .sucuriscan-ad-btn {
138
- background-color: #e8840a;
139
- background-image: -webkit-gradient(linear, left top, left bottom, from(#e8840a), to(#ef7f02));
140
- background-image: -webkit-linear-gradient(top, #e8840a, #ef7f02);
141
- background-image: -moz-linear-gradient(top, #e8840a, #ef7f02);
142
- background-image: -ms-linear-gradient(top, #e8840a, #ef7f02);
143
- background-image: -o-linear-gradient(top, #e8840a, #ef7f02);
144
- background-image: linear-gradient(top, #e8840a, #ef7f02);
145
- filter: "progid:DXImageTransform.Microsoft.Gradient(startColorstr=#e8840a, endColorstr=#ef7f02)";
146
- -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(startColorstr=#e8840a, endColorstr=#ef7f02)";
147
- box-shadow: inset 0px 1px 1px #eaac3a;
148
- border:1px solid #d17301;
149
- }
150
- /* WordPress Alerts */
151
- div.sucuriscan-alert{position:relative;margin:0 0 20px 0}
152
- div.sucuriscan-alert > a.close{position:absolute;top:10px;right:10px;font-size:18px;font-weight:bold;text-decoration:none}
153
- .sucuriscan-inline-alert, .sucuriscan-inline-alert-updated, .sucuriscan-inline-alert-error, .sucuriscan-inline-alert-warning, .sucuriscan-inline-alert-info{background:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding:0;border-left:4px solid #ddd}
154
- .sucuriscan-inline-alert > p, .sucuriscan-inline-alert-updated > p, .sucuriscan-inline-alert-error > p, .sucuriscan-inline-alert-warning > p, .sucuriscan-inline-alert-info > p{margin:0;padding:8px 12px;border:1px solid #ddd;border-left:0}
155
- .sucuriscan-inline-alert-updated + div, .sucuriscan-inline-alert-warning + div, .sucuriscan-inline-alert-error + div, .sucuriscan-inline-alert-info + div{margin-top:10px}
156
- .sucuriscan-inline-alert-updated{border-left-color:#7ad03a}
157
- .sucuriscan-inline-alert-warning{border-left-color:#ffba00}
158
- .sucuriscan-inline-alert-error{border-left-color:#dd3d36}
159
- .sucuriscan-inline-alert-info{border-left-color:#2ea2cc}
160
- /* Tabulation Panels */
161
- .sucuriscan-tabs{}
162
- .sucuriscan-tabs > ul{margin:0}
163
- .sucuriscan-tabs > ul li, .sucuriscan-tabs > ul li > a{display:inline-block}
164
- .sucuriscan-tabs > ul li{margin-bottom:0}
165
- .sucuriscan-tabs > ul li > a{background:#e5e5e5;font-size:13px;font-weight:bold;color:#333;line-height:38px;text-decoration:none;padding:0 10px}
166
- .sucuriscan-tabs > ul li > a.sucuriscan-tab-active{background:#fff;border:1px solid #e1e1e1;border-bottom:0}
167
- .sucuriscan-tabs > ul li.sucuriscan-red-tab a{background:#ff8a83;color:#fff}
168
- .sucuriscan-tabs > ul li.sucuriscan-red-tab a.sucuriscan-tab-active{background:#dd3d36;border-color:#dd3d36}
169
- .sucuriscan-maincontent .sucuriscan-tab-containers > div > table{margin-top:0}
170
- .sucuriscan-maincontent .sucuriscan-tab-containers > div > #poststuff{margin-top:0}
171
- /* Get API Form */
172
- .sucuriscan-getapi-div{background:#fff;margin:0 0 20px 0;border:1px solid #e5e5e5;border-radius:3px}
173
- .sucuriscan-getapi-div p{margin:0;padding:10px}
174
- .sucuriscan-getapi-form{}
175
- .sucuriscan-getapi-form button.button-primary{width:100%;height:initial;line-height:30px;margin:0 0 -1px 0;padding:0;border-radius:0 0 3px 3px}
176
- /* Scanner Page */
177
- .sucuriscan-malwarescan-message{margin-bottom:20px !important}
178
- .sucuriscan-loading{background:#fff;text-align:center;padding:30px;padding-bottom:15px;border:1px solid #ddd;border-radius:4px}
179
- .sucuriscan-loading p, .sucuriscan-loading h3{margin:0;padding:0}
180
- .sucuriscan-loading .title{font-size:28px;margin-bottom:10px}
181
- .sucuriscan-loading .description{font-size:16px}
182
- .sucuriscan-sitelogo{width:190px;height:100px;background:url('http://sitecheck.sucuri.net/images/sucuri-sprite.png') no-repeat;margin:0 auto}
183
- .sucuriscan-sitecheck-form{margin:20px 0 0 0}
184
- .sucuriscan-sitecheck-form .button.button-hero{padding:0 46px}
185
- .sucuriscan-loading .sucuriscan-sitecheck-disclaimer{text-align:justify;padding-top:20px;border-top:1px solid #ddd}
186
- .sucuriscan-loading .sucuriscan-sitecheck-disclaimer p{font-size:10px}
187
- /* Scanner Results */
188
- .sucuriscan-maincontent .sucuriscan-border{border:0;border-left:4px solid #ddd}
189
- .sucuriscan-maincontent .sucuriscan-border > h3, .sucuriscan-maincontent .sucuriscan-border > .inside{border-top:1px solid #e5e5e5;border-right:1px solid #e5e5e5}
190
- .sucuriscan-maincontent .sucuriscan-border > h3{border-bottom:0}
191
- .sucuriscan-maincontent .sucuriscan-border > .inside{margin-top:0 !important;border-bottom:1px solid #ddd}
192
- .sucuriscan-maincontent .sucuriscan-border-good, .sucuriscan-maincontent .sucuriscan-border-success{border-left-color:#7ad03a}
193
- .sucuriscan-maincontent .sucuriscan-border-bad, .sucuriscan-maincontent .sucuriscan-border-danger{border-left-color:#dd3d36}
194
- .sucuriscan-maincontent .sucuriscan-border-info{border-left-color:#2ea2cc}
195
- .sucuriscan-maincontent .sucuriscan-cleanup-btn{margin:20px 0 0 0}
196
- .sucuriscan-scanner-results .sucuriscan-scanner-details tr:nth-child(even),
197
- .sucuriscan-scanner-results .sucuriscan-scanner-links tr:nth-child(even){background:#f5f5f5}
198
- .sucuriscan-scanner-results td.sucuriscan-border-bad{border-left-width:4px;border-left-style:solid}
199
- .sucuriscan-scanner-results .sucuriscan-malware-link{text-align:right}
200
- .sucuriscan-scanner-results .sucuriscan-malware-link a:hover{color:#fff}
201
- .sucuriscan-malware-payload{background:#f5f5f5;word-break:break-all;margin:-2px -15px -15px -15px;padding:15px}
202
- /* Generic Panel Magin Styles */
203
- .sucuriscan-maincontent .sucuriscan-corefiles,
204
- .sucuriscan-maincontent .sucuriscan-integrity-message,
205
- .sucuriscan-maincontent .sucuriscan-wordpress-outdated,
206
- .sucuriscan-maincontent .sucuriscan-auditlogs{margin-top:0;margin-bottom:20px}
207
- /* Audit Logs Styles */
208
- .sucuriscan-maincontent .sucuriscan-auditlogs{margin-bottom:0}
209
- .sucuriscan-auditlogs .sucuriscan-list-as-table{margin-bottom:0}
210
- .sucuriscan-auditlogs .sucuriscan-maxper-page{text-align:right}
211
- .sucuriscan-auditlogs .sucuriscan-label{display:inline-block;width:18px;text-transform:uppercase;line-height:13px;cursor:pointer;border-radius:50%}
212
- .sucuriscan-auditlogs .sucuriscan-auditlog-success, .sucuriscan-label-added{background:#5cb85c}
213
- .sucuriscan-auditlogs .sucuriscan-auditlog-debug{background:#c690ec}
214
- .sucuriscan-auditlogs .sucuriscan-auditlog-info{background:#5bc0de}
215
- .sucuriscan-auditlogs .sucuriscan-auditlog-notice{background:#428bca}
216
- .sucuriscan-auditlogs .sucuriscan-auditlog-warning, .sucuriscan-label-modified{background:#f0ad4e}
217
- .sucuriscan-auditlogs .sucuriscan-auditlog-error, .sucuriscan-label-removed{background:#f27d7d}
218
- .sucuriscan-auditlogs .sucuriscan-auditlog-critical{background:#000000}
219
- /* Audit Report Styles */
220
- .sucuriscan-maincontent .sucuriscan-audit-report{border-left-width:1px}
221
- .sucuriscan-audit-report .sucuriscan-report-row{margin-bottom:10px}
222
- .sucuriscan-audit-report .sucuriscan-report-row:last-child{margin-bottom:0}
223
- .sucuriscan-audit-report .sucuriscan-report-chart{width:49%;border:1px solid #ddd}
224
- .sucuriscan-audit-report .sucuriscan-report-chart h4, .sucuriscan-audit-report .sucuriscan-report-chart h5{font-weight:normal;text-align:center;margin:0}
225
- .sucuriscan-audit-report .sucuriscan-report-chart h4{font-size:18px;margin-top:10px}
226
- .sucuriscan-audit-report .sucuriscan-report-chart h5{font-size:12px;margin-top:5px}
227
- .sucuriscan-maincontent .sucuriscan-audit-report .sucuriscan-inline-alert-info{margin-top:10px}
228
- /* Integrity Styles */
229
- .sucuriscan-status-type{display:inline-block;width:20px;background:#ddd;text-align:center;text-transform:uppercase;margin-right:10px;padding:0 3px;border:1px solid transparent;border-radius:3px}
230
- td.sucuriscan-corefiles-warning > div{background:#f2dede;color:#a94442;border-color:#ebccd1}
231
- .sucuriscan-maincontent .sucuriscan-corefiles .sucuriscan-label{text-transform:capitalize}
232
- .sucuriscan-maincontent td.sucuriscan-corefiles-warning, .sucuriscan-maincontent td.sucuriscan-corefiles-warning p{margin:0;padding:0}
233
- .sucuriscan-maincontent td.sucuriscan-corefiles-warning div{padding:10px;border-width:1px;border-style:solid}
234
- .sucuriscan-maincontent td.sucuriscan-corefiles-warning code{font-size:12px;padding:0 5px}
235
- .sucuriscan-maincontent .sucuriscan-integrity-message{position:relative}
236
- .sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-mark,
237
- .sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-failure{position:absolute;top:1px;right:1px;background:#ddd;font-weight:bold;color:#fff;line-height:35px;padding:0 10px;border-left:1px solid #ddd}
238
- .sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-mark{background:#7ad03a}
239
- .sucuriscan-maincontent .sucuriscan-integrity-message .sucuriscan-integrity-failure{background:#dd3d36;border-left:0}
240
- .sucuriscan-maincontent .sucuriscan-ignoredfiles{margin-top:0}
241
- .sucuriscan-ignore-file form{padding:10px;padding-top:0;border-bottom:1px solid #ddd;border-right:1px solid #ddd}
242
- .sucuriscan-ignore-file p{border-bottom:none}
243
- .sucuriscan-ignore-file-input{width:80%}
244
- .sucuriscan-ignore-file-button{width:18%}
245
- .sucuriscan-maincontent .sucuriscan-modifiedfiles .sucuriscan-ellipsis{width:100px}
246
- /* Monitoring Styles */
247
- .sucuriscan-monitoring-settings{margin-bottom:20px}
248
- .sucuriscan-monitoring-settings td.td-with-button{text-align:left}
249
- .sucuriscan-monitoring-settings .sucuriscan-list-as-table{margin:0}
250
- .sucuriscan-monitoring-apikey-form .input-text{width:85%}
251
- .sucuriscan-monitoring-clear-cache-form{}
252
- .sucuriscan-monitoring-logs{}
253
- .sucuriscan-monitoring-logs .thead-with-button .button{width:65px}
254
- .sucuriscan-monitoring-logs .thead-with-button .input-text, .sucuriscan-monitoring-logs .thead-with-button select{width:250px}
255
- .sucuriscan-monitoring-logs .sucuriscan-monitoring-search-form{}
256
- .sucuriscan-monitoring-logs .sucuriscan-monitoring-denial-types-form{}
257
- .sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form{}
258
- .sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form select{width:70px}
259
- .sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form select + select{width:112px}
260
- .sucuriscan-monitoring-logs .sucuriscan-monitoring-date-form select + select + select{width:60px}
261
- .sucuriscan-monitoring-logs .sucuriscan-target-date{font-size:12px;color:#999;margin-right:5px}
262
- .sucuriscan-monitoring-logs .sucuriscan-denial-type{font-size:14px}
263
- .sucuriscan-monitoring-logs .sucuriscan-denial-type-date{font-style:italic;color:#999}
264
- /* Monitoring AccessLog Styles */
265
- .sucuriscan-request-summary{margin:-15px;margin-top:-3px}
266
- .sucuriscan-request-summary td{font-size:14px}
267
- .sucuriscan-request-summary tr td:first-child{font-weight:bold}
268
- .sucuriscan-request-summary td+td{word-break:break-all}
269
- /* Hardening Status */
270
- .sucuriscan-hstatus{position:relative;margin:0 -12px;padding:10px 12px;border:1px solid transparent}
271
- .sucuriscan-hstatus-0{background-color:#f2dede;color:#a94442;border-color:#ebccd1}
272
- .sucuriscan-hstatus-1{background-color:#dff0d8;color:#3c763d;border-color:#d6e9c6}
273
- .sucuriscan-hstatus-2{background-color:#dee4f2;color:#4263a9;border-color:#ccd0eb}
274
- .sucuriscan-hstatus .button-primary, .sucuriscan-hstatus .button-secondary{position:absolute;top:5px;right:5px}
275
- .sucuriscan-hardening .postbox .inside pre{background:#eaeaea;padding:10px}
276
- /* Last Logins Styles */
277
- .sucuriscan-lastlogin-outof{font-style:italic;color:#999;margin-right:10px}
278
- .sucuriscan-admins-lastlogins .sucuriscan-ellipsis{width:170px}
279
- .sucuriscan-admins-lastlogins td{padding:4px 8px}
280
- .sucuriscan-lastlogins-failed{}
281
- /* Pattern Search Styles */
282
- .sucuriscan-pattern-search {}
283
- .sucuriscan-pattern-search-inputbox {margin-top:12px}
284
- .sucuriscan-pattern-search-inputbox .input-text {width:84.7777%;line-height:30px;margin:0;margin-right:6px}
285
- .sucuriscan-pattern-search-inputbox .input-button {width:14%;height:initial;line-height:35px}
286
- .sucuriscan-pattern-search .sucuriscan-cleanup-btn {margin-top:12px}
287
- .sucuriscan-pattern-search table label {color:#999}
288
- .sucuriscan-pattern-search .sucuriscan-grep-text em{color:#ea3838}
289
- /* About Page */
290
- .sucuriscan-about ul{margin-left:20px}
291
- .sucuriscan-about ul li{list-style:initial}
292
- .sucuriscan-about li label{font-weight:bold;vertical-align:initial}
293
- /* API Registered Modal */
294
- .sucuriscan-apikey-registered{}
295
- .sucuriscan-apikey-registered .sucuriscan-pull-right{width:400px}
296
- .sucuriscan-apikey-registered .sucuriscan-sitelogo{background-position:0 -17px;height:83px}
297
- /* Setup Instructions Modal */
298
- .sucuriscan-setup-instructions{}
299
- .sucuriscan-setup-instructions .form-table{}
300
- .sucuriscan-setup-instructions .form-table td{padding:0;padding-bottom:12px}
301
- .sucuriscan-setup-instructions .form-table select{max-width:400px}
302
- /* Pagination Styles */
303
- .sucuriscan-pagination{display:inline-block;margin:0;padding:0;border-radius:4px}
304
- .sucuriscan-pagination>li{display:inline}
305
- .sucuriscan-pagination>li>a, .sucuriscan-pagination>li>span{position:relative;background:#fff;color:#428bca;line-height:1.42857143;text-decoration: none;float:left;margin-left:-1px;padding:6px 12px;border:1px solid #ddd}
306
- .sucuriscan-pagination>li:first-child>a, .sucuriscan-pagination>li:first-child>span{margin-left:0;border-radius:4px 0 0 4px}
307
- .sucuriscan-pagination>li:last-child>a, .sucuriscan-pagination>li:last-child>span{border-radius:0 4px 4px 0}
308
- .sucuriscan-pagination>li>a.sucuriscan-pagination-active, .sucuriscan-pagination>li>a:hover{background:#0074a2;color:#fff}
309
- /* Resetter Styles */
310
- .sucuriscan_wpconfig_keys_updated textarea{width:100%;height:250px;background:#f5f5f5;font-size:12px;resize:vertical;margin:20px 0 0 0}
311
- .sucuriscan-maincontent .sucuriscan-last-logins{margin-top:0}
312
- .sucuriscan-maincontent .sucuriscan-last-logins .sucuriscan-ellipsis{width:150px;line-height:inherit}
313
- .sucuriscan-maincontent .sucuriscan-full-textarea{width:100%;height:400px;line-height:normal;resize:vertical;padding:10px}
314
- .sucuriscan-maincontent .sucuriscan-settings{margin-top:0}
315
- .sucuriscan-maincontent .sucuriscan-settings form{display:inline-block}
316
- .sucuriscan-maincontent .sucuriscan-settings select, .sucuriscan-maincontent .sucuriscan-settings .input-text{width:220px;margin:0}
317
- .sucuriscan-maincontent .sucuriscan-settings-notifications{margin-top:0}
318
- .sucuriscan-maincontent .sucuriscan-settings-notifications .dashicons-before:before{margin-right:5px}
319
- .sucuriscan-maincontent .sucuriscan-settings-ignorescanning{margin-top:0}
320
- .sucuriscan-maincontent .sucuriscan-settings-trustip{margin-top:0}
321
- .sucuriscan-maincontent .sucuriscan-settings-heartbeat{}
322
- .sucuriscan-maincontent .sucuriscan-wpcron-list{margin-top:0}
323
- .sucuriscan-maincontent .sucuriscan-infosys-htaccess .inside{border-bottom:1px solid #ddd !important}
324
- .sucuriscan-maincontent .sucuriscan-infosys-htaccess .inside .sucuriscan-inline-alert-updated{margin-bottom:10px}
325
- .sucuriscan-maincontent .sucuriscan-errorlogs .inside .sucuriscan-inline-alert-error{margin-top:10px}
326
- .sucuriscan-maincontent .sucuriscan-errorlogs-list{}
327
- .sucuriscan-maincontent .sucuriscan-subject-formats{margin:0}
328
- .sucuriscan-maincontent .sucuriscan-subject-formats input[type=text]{width:40%;margin-left:10px}
329
- /* 3CJS Chart styles */
330
- .c3 svg{font:10px sans-serif}
331
- .c3 line,.c3 path{fill:none;stroke:#000}
332
- .c3 text{-webkit-user-select:none;-moz-user-select:none;user-select:none}
333
- .c3-bars path,.c3-event-rect,.c3-legend-item-tile,.c3-xgrid-focus,.c3-ygrid{shape-rendering:crispEdges}
334
- .c3-chart-arc path{stroke:#fff}
335
- .c3-chart-arc text{fill:#fff;font-size:13px}
336
- .c3-grid line{stroke:#aaa}
337
- .c3-grid text{fill:#aaa}
338
- .c3-xgrid,.c3-ygrid{stroke-dasharray:3 3}
339
- .c3-text.c3-empty{fill:gray;font-size:2em}
340
- .c3-line{stroke-width:1px}
341
- .c3-circle._expanded_{stroke-width:1px;stroke:#fff}
342
- .c3-selected-circle{fill:#fff;stroke-width:2px}
343
- .c3-bar{stroke-width:0}
344
- .c3-bar._expanded_{fill-opacity:.75}
345
- .c3-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}
346
- .c3-target.c3-focused{opacity:1}
347
- .c3-target.c3-focused path.c3-line,.c3-target.c3-focused path.c3-step{stroke-width:2px}
348
- .c3-target.c3-defocused{opacity:.3!important}
349
- .c3-region{fill:#4682b4;fill-opacity:.1}
350
- .c3-brush .extent{fill-opacity:.1}
351
- .c3-legend-item{font-size:12px}
352
- .c3-legend-item-hidden{opacity:.15}
353
- .c3-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}
354
- .c3-tooltip-container{z-index:10}
355
- .c3-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777}
356
- .c3-tooltip tr{border:1px solid #CCC}
357
- .c3-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#FFF}
358
- .c3-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}
359
- .c3-tooltip td>span{display:inline-block;width:10px;height:10px;margin-right:6px}
360
- .c3-tooltip td.value{text-align:right}
361
- .c3-area{stroke-width:0;opacity:.2}
362
- .c3-chart-arcs .c3-chart-arcs-background{fill:#e0e0e0;stroke:none}
363
- .c3-chart-arcs .c3-chart-arcs-gauge-unit{fill:#000;font-size:16px}
364
- .c3-chart-arcs .c3-chart-arcs-gauge-max,.c3-chart-arcs .c3-chart-arcs-gauge-min{fill:#777}
365
- .c3-chart-arc .c3-gauge-value{fill:#000}
366
- /* Responsive Styles */
367
- @media (max-width: 620px) {
368
- .sucuriscan-tabs > ul li, .sucuriscan-tabs > ul li > a{display:block}
369
- .sucuriscan-getapi-form button.button-primary{line-height:40px}
370
- }
371
- @media (max-width: 768px) {
372
- .sucuriscan-wrap .sucuriscan-leftside,
373
- .sucuriscan-wrap .sucuriscan-sidebar,
374
- .sucuriscan-wrap .sucuriscan-footer .sucuriscan-logo,
375
- .sucuriscan-wrap .sucuriscan-footer .sucuriscan-help{float:none}
376
- .sucuriscan-wrap .sucuriscan-leftside, .sucuriscan-wrap .sucuriscan-sidebar{width:100%}
377
- .sucuriscan-wrap .sucuriscan-sidebar{margin-top:20px}
378
- .sucuriscan-wrap .sucuriscan-footer .sucuriscan-logo{display:table;margin:0 auto}
379
- }
380
- @media (max-width: 920px) {
381
- .sucuriscan-wrap .sucuriscan-navbar{padding-left:0;padding-right:0}
382
- .sucuriscan-wrap .sucuriscan-navbar .nav-tab{display:block;line-height:20px;margin:0}
383
- .sucuriscan-wrap .sucuriscan-navbar .nav-tab:last-child{border-bottom:1px solid #ccc}
384
- .wp-core-ui .sucuriscan-review-hero, .wp-core-ui .button.sucuriscan-review-hero{top:0;right:0;display:block;width:100%;margin:10px 0}
385
- }
386
- /* Old styles */
387
- .sucuriscan-maincontent #poststuff{min-width:initial;padding-top:0}
388
- .sucuriscan-maincontent .widefat tbody th.check-column{padding:6px 0 3px 0}
389
- .sucuriscan-maincontent .hardening-box .primary-secondary{margin:0 0 0 10px}
390
- .sucuriscan-maincontent hr{border:none;border-top:1px solid #999}
391
- .sucuriscan-maincontent table td > table{background:#fff}
392
- .sucuriscan-maincontent table td > table th{padding:4px 8px}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/js/d3.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ !function(){function n(n){return n&&(n.ownerDocument||n.document||n).documentElement}function t(n){return n&&(n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView)}function e(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function r(n){return null===n?0/0:+n}function u(n){return!isNaN(n)}function i(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function o(n){return n.length}function a(n){for(var t=1;n*t%1;)t*=10;return t}function c(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function l(){this._=Object.create(null)}function s(n){return(n+="")===pa||n[0]===va?va+n:n}function f(n){return(n+="")[0]===va?n.slice(1):n}function h(n){return s(n)in this._}function g(n){return(n=s(n))in this._&&delete this._[n]}function p(){var n=[];for(var t in this._)n.push(f(t));return n}function v(){var n=0;for(var t in this._)++n;return n}function d(){for(var n in this._)return!1;return!0}function m(){this._=Object.create(null)}function y(n){return n}function M(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=da.length;r>e;++e){var u=da[e]+t;if(u in n)return u}}function b(){}function _(){}function w(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new l;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function S(){ta.event.preventDefault()}function k(){for(var n,t=ta.event;n=t.sourceEvent;)t=n;return t}function E(n){for(var t=new _,e=0,r=arguments.length;++e<r;)t[arguments[e]]=w(t);return t.of=function(e,r){return function(u){try{var i=u.sourceEvent=ta.event;u.target=n,ta.event=u,t[u.type].apply(e,r)}finally{ta.event=i}}},t}function A(n){return ya(n,_a),n}function N(n){return"function"==typeof n?n:function(){return Ma(n,this)}}function C(n){return"function"==typeof n?n:function(){return xa(n,this)}}function z(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ta.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?i:u}function q(n){return n.trim().replace(/\s+/g," ")}function L(n){return new RegExp("(?:^|\\s+)"+ta.requote(n)+"(?:\\s+|$)","g")}function T(n){return(n+"").trim().split(/^|\s+/)}function R(n,t){function e(){for(var e=-1;++e<u;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<u;)n[e](this,r)}n=T(n).map(D);var u=n.length;return"function"==typeof t?r:e}function D(n){var t=L(n);return function(e,r){if(u=e.classList)return r?u.add(n):u.remove(n);var u=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||e.setAttribute("class",q(u+" "+n))):e.setAttribute("class",q(u.replace(t," ")))}}function P(n,t,e){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,e)}function i(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?i:u}function U(n,t){function e(){delete this[n]}function r(){this[n]=t}function u(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?u:r}function j(n){function t(){var t=this.ownerDocument,e=this.namespaceURI;return e?t.createElementNS(e,n):t.createElement(n)}function e(){return this.ownerDocument.createElementNS(n.space,n.local)}return"function"==typeof n?n:(n=ta.ns.qualify(n)).local?e:t}function F(){var n=this.parentNode;n&&n.removeChild(this)}function H(n){return{__data__:n}}function O(n){return function(){return ba(this,n)}}function I(n){return arguments.length||(n=e),function(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}}function Y(n,t){for(var e=0,r=n.length;r>e;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function Z(n){return ya(n,Sa),n}function V(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t<c;);return o}}function X(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function u(){var u=c(t,ra(arguments));r.call(this),this.addEventListener(n,this[o]=u,u.$=e),u._=t}function i(){var t,e=new RegExp("^__on([^.]+)"+ta.requote(n)+"$");for(var r in this)if(t=r.match(e)){var u=this[r];this.removeEventListener(t[1],u,u.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=$;a>0&&(n=n.slice(0,a));var l=ka.get(n);return l&&(n=l,c=B),a?t?u:r:t?b:i}function $(n,t){return function(e){var r=ta.event;ta.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ta.event=r}}}function B(n,t){var e=$(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function W(e){var r=".dragsuppress-"+ ++Aa,u="click"+r,i=ta.select(t(e)).on("touchmove"+r,S).on("dragstart"+r,S).on("selectstart"+r,S);if(null==Ea&&(Ea="onselectstart"in e?!1:x(e.style,"userSelect")),Ea){var o=n(e).style,a=o[Ea];o[Ea]="none"}return function(n){if(i.on(r,null),Ea&&(o[Ea]=a),n){var t=function(){i.on(u,null)};i.on(u,function(){S(),t()},!0),setTimeout(t,0)}}}function J(n,e){e.changedTouches&&(e=e.changedTouches[0]);var r=n.ownerSVGElement||n;if(r.createSVGPoint){var u=r.createSVGPoint();if(0>Na){var i=t(n);if(i.scrollX||i.scrollY){r=ta.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=r[0][0].getScreenCTM();Na=!(o.f||o.e),r.remove()}}return Na?(u.x=e.pageX,u.y=e.pageY):(u.x=e.clientX,u.y=e.clientY),u=u.matrixTransform(n.getScreenCTM().inverse()),[u.x,u.y]}var a=n.getBoundingClientRect();return[e.clientX-a.left-n.clientLeft,e.clientY-a.top-n.clientTop]}function G(){return ta.event.changedTouches[0].identifier}function K(n){return n>0?1:0>n?-1:0}function Q(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function nt(n){return n>1?0:-1>n?qa:Math.acos(n)}function tt(n){return n>1?Ra:-1>n?-Ra:Math.asin(n)}function et(n){return((n=Math.exp(n))-1/n)/2}function rt(n){return((n=Math.exp(n))+1/n)/2}function ut(n){return((n=Math.exp(2*n))-1)/(n+1)}function it(n){return(n=Math.sin(n/2))*n}function ot(){}function at(n,t,e){return this instanceof at?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof at?new at(n.h,n.s,n.l):bt(""+n,_t,at):new at(n,t,e)}function ct(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new mt(u(n+120),u(n),u(n-120))}function lt(n,t,e){return this instanceof lt?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof lt?new lt(n.h,n.c,n.l):n instanceof ft?gt(n.l,n.a,n.b):gt((n=wt((n=ta.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new lt(n,t,e)}function st(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new ft(e,Math.cos(n*=Da)*t,Math.sin(n)*t)}function ft(n,t,e){return this instanceof ft?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof ft?new ft(n.l,n.a,n.b):n instanceof lt?st(n.h,n.c,n.l):wt((n=mt(n)).r,n.g,n.b):new ft(n,t,e)}function ht(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=pt(u)*Xa,r=pt(r)*$a,i=pt(i)*Ba,new mt(dt(3.2404542*u-1.5371385*r-.4985314*i),dt(-.969266*u+1.8760108*r+.041556*i),dt(.0556434*u-.2040259*r+1.0572252*i))}function gt(n,t,e){return n>0?new lt(Math.atan2(e,t)*Pa,Math.sqrt(t*t+e*e),n):new lt(0/0,0/0,n)}function pt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function vt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function dt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function mt(n,t,e){return this instanceof mt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof mt?new mt(n.r,n.g,n.b):bt(""+n,mt,ct):new mt(n,t,e)}function yt(n){return new mt(n>>16,n>>8&255,255&n)}function Mt(n){return yt(n)+""}function xt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function bt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/.exec(n=n.toLowerCase()))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(kt(u[0]),kt(u[1]),kt(u[2]))}return(i=Ga.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function _t(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new at(r,u,c)}function wt(n,t,e){n=St(n),t=St(t),e=St(e);var r=vt((.4124564*n+.3575761*t+.1804375*e)/Xa),u=vt((.2126729*n+.7151522*t+.072175*e)/$a),i=vt((.0193339*n+.119192*t+.9503041*e)/Ba);return ft(116*u-16,500*(r-u),200*(u-i))}function St(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function kt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Et(n){return"function"==typeof n?n:function(){return n}}function At(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Nt(t,e,n,r)}}function Nt(n,t,e,r){function u(){var n,t=c.status;if(!t&&zt(c)||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return void o.error.call(i,r)}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=ta.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=ta.event;ta.event=n;try{o.progress.call(i,c)}finally{ta.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ra(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ta.rebind(i,o,"on"),null==r?i:i.get(Ct(r))}function Ct(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function zt(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qt(){var n=Lt(),t=Tt()-n;t>24?(isFinite(t)&&(clearTimeout(tc),tc=setTimeout(qt,t)),nc=0):(nc=1,rc(qt))}function Lt(){var n=Date.now();for(ec=Ka;ec;)n>=ec.t&&(ec.f=ec.c(n-ec.t)),ec=ec.n;return n}function Tt(){for(var n,t=Ka,e=1/0;t;)t.f?t=n?n.n=t.n:Ka=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return Qa=n,e}function Rt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Dt(n,t){var e=Math.pow(10,3*ga(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Pt(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],o=0,a=r[0],c=0;u>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),i.push(n.substring(u-=a,u+a)),!((c+=a+1)>t));)a=r[o=(o+1)%r.length];return i.reverse().join(e)}:y;return function(n){var e=ic.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===o)&&(l=r="0",o="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=oc.get(g)||Ut;var M=l&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>p){var c=ta.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!l&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===o?u+n+k:">"===o?k+u+n:"^"===o?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function Ut(n){return n+""}function jt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ft(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new cc(e-1)),1),e}function i(n,e){return t(n=new cc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{cc=jt;var r=new jt;return r._=n,o(r,t,e)}finally{cc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Ht(n);return c.floor=c,c.round=Ht(r),c.ceil=Ht(u),c.offset=Ht(i),c.range=a,n}function Ht(n){return function(t,e){try{cc=jt;var r=new jt;return r._=t,n(r,e)._}finally{cc=Date}}}function Ot(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.slice(c,a)),null!=(u=sc[e=n.charAt(++a)])&&(e=n.charAt(++a)),(i=N[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),o.push(e),c=a+1);return o.push(n.slice(c,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},u=e(r,n,t,0);if(u!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var i=null!=r.Z&&cc!==jt,o=new(i?jt:cc);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+(r.Z/100|0),r.M+r.Z%100,r.S,r.L),i?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var u,i,o,a=0,c=t.length,l=e.length;c>a;){if(r>=l)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=C[o in sc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.slice(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,N.c.toString(),t,r)}function c(n,t,r){return e(n,N.x.toString(),t,r)}function l(n,t,r){return e(n,N.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{cc=jt;var t=new cc;return t._=n,r(t)}finally{cc=Date}}var r=t(n);return e.parse=function(n){try{cc=jt;var t=r.parse(n);return t&&t._}finally{cc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ae;var M=ta.map(),x=Yt(v),b=Zt(v),_=Yt(d),w=Zt(d),S=Yt(m),k=Zt(m),E=Yt(y),A=Zt(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var N={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return It(n.getDate(),t,2)},e:function(n,t){return It(n.getDate(),t,2)},H:function(n,t){return It(n.getHours(),t,2)},I:function(n,t){return It(n.getHours()%12||12,t,2)},j:function(n,t){return It(1+ac.dayOfYear(n),t,3)},L:function(n,t){return It(n.getMilliseconds(),t,3)},m:function(n,t){return It(n.getMonth()+1,t,2)},M:function(n,t){return It(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return It(n.getSeconds(),t,2)},U:function(n,t){return It(ac.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return It(ac.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return It(n.getFullYear()%100,t,2)},Y:function(n,t){return It(n.getFullYear()%1e4,t,4)},Z:ie,"%":function(){return"%"}},C={a:r,A:u,b:i,B:o,c:a,d:Qt,e:Qt,H:te,I:te,j:ne,L:ue,m:Kt,M:ee,p:s,S:re,U:Xt,w:Vt,W:$t,x:c,X:l,y:Wt,Y:Bt,Z:Jt,"%":oe};return t}function It(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function Yt(n){return new RegExp("^(?:"+n.map(ta.requote).join("|")+")","i")}function Zt(n){for(var t=new l,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Vt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Xt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e));return r?(n.U=+r[0],e+r[0].length):-1}function $t(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e));return r?(n.W=+r[0],e+r[0].length):-1}function Bt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Wt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.y=Gt(+r[0]),e+r[0].length):-1}function Jt(n,t,e){return/^[+-]\d{4}$/.test(t=t.slice(e,e+5))?(n.Z=-t,e+5):-1}function Gt(n){return n+(n>68?1900:2e3)}function Kt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Qt(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function ne(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function te(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ee(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function re(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ue(n,t,e){fc.lastIndex=0;var r=fc.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ie(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=ga(t)/60|0,u=ga(t)%60;return e+It(r,"0",2)+It(u,"0",2)}function oe(n,t,e){hc.lastIndex=0;var r=hc.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ae(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function ce(){}function le(n,t,e){var r=e.s=n+t,u=r-n,i=r-u;e.t=n-i+(t-u)}function se(n,t){n&&dc.hasOwnProperty(n.type)&&dc[n.type](n,t)}function fe(n,t,e){var r,u=-1,i=n.length-e;for(t.lineStart();++u<i;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function he(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)fe(n[e],t,1);t.polygonEnd()}function ge(){function n(n,t){n*=Da,t=t*Da/2+qa/4;var e=n-r,o=e>=0?1:-1,a=o*e,c=Math.cos(t),l=Math.sin(t),s=i*l,f=u*c+s*Math.cos(a),h=s*o*Math.sin(a);yc.add(Math.atan2(h,f)),r=n,u=c,i=l}var t,e,r,u,i;Mc.point=function(o,a){Mc.point=n,r=(t=o)*Da,u=Math.cos(a=(e=a)*Da/2+qa/4),i=Math.sin(a)},Mc.lineEnd=function(){n(t,e)}}function pe(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function ve(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function de(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function me(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function ye(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Me(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function xe(n){return[Math.atan2(n[1],n[0]),tt(n[2])]}function be(n,t){return ga(n[0]-t[0])<Ca&&ga(n[1]-t[1])<Ca}function _e(n,t){n*=Da;var e=Math.cos(t*=Da);we(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function we(n,t,e){++xc,_c+=(n-_c)/xc,wc+=(t-wc)/xc,Sc+=(e-Sc)/xc}function Se(){function n(n,u){n*=Da;var i=Math.cos(u*=Da),o=i*Math.cos(n),a=i*Math.sin(n),c=Math.sin(u),l=Math.atan2(Math.sqrt((l=e*c-r*a)*l+(l=r*o-t*c)*l+(l=t*a-e*o)*l),t*o+e*a+r*c);bc+=l,kc+=l*(t+(t=o)),Ec+=l*(e+(e=a)),Ac+=l*(r+(r=c)),we(t,e,r)}var t,e,r;qc.point=function(u,i){u*=Da;var o=Math.cos(i*=Da);t=o*Math.cos(u),e=o*Math.sin(u),r=Math.sin(i),qc.point=n,we(t,e,r)}}function ke(){qc.point=_e}function Ee(){function n(n,t){n*=Da;var e=Math.cos(t*=Da),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),l=u*c-i*a,s=i*o-r*c,f=r*a-u*o,h=Math.sqrt(l*l+s*s+f*f),g=r*o+u*a+i*c,p=h&&-nt(g)/h,v=Math.atan2(h,g);Nc+=p*l,Cc+=p*s,zc+=p*f,bc+=v,kc+=v*(r+(r=o)),Ec+=v*(u+(u=a)),Ac+=v*(i+(i=c)),we(r,u,i)}var t,e,r,u,i;qc.point=function(o,a){t=o,e=a,qc.point=n,o*=Da;var c=Math.cos(a*=Da);r=c*Math.cos(o),u=c*Math.sin(o),i=Math.sin(a),we(r,u,i)},qc.lineEnd=function(){n(t,e),qc.lineEnd=ke,qc.point=_e}}function Ae(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function Ne(){return!0}function Ce(n,t,e,r,u){var i=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(be(e,r)){u.lineStart();for(var a=0;t>a;++a)u.point((e=n[a])[0],e[1]);return void u.lineEnd()}var c=new qe(e,n,null,!0),l=new qe(e,null,c,!1);c.o=l,i.push(c),o.push(l),c=new qe(r,n,null,!1),l=new qe(r,null,c,!0),c.o=l,i.push(c),o.push(l)}}),o.sort(t),ze(i),ze(o),i.length){for(var a=0,c=e,l=o.length;l>a;++a)o[a].e=c=!c;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,l=s.length;l>a;++a)u.point((f=s[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var a=s.length-1;a>=0;--a)u.point((f=s[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function ze(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r<t;)u.n=e=n[r],e.p=u,u=e;u.n=e=n[0],e.p=u}}function qe(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Le(n,t,e,r){return function(u,i){function o(t,e){var r=u(t,e);n(t=r[0],e=r[1])&&i.point(t,e)}function a(n,t){var e=u(n,t);d.point(e[0],e[1])}function c(){y.point=a,d.lineStart()}function l(){y.point=o,d.lineEnd()}function s(n,t){v.push([n,t]);var e=u(n,t);x.point(e[0],e[1])}function f(){x.lineStart(),v=[]}function h(){s(v[0][0],v[0][1]),x.lineEnd();var n,t=x.clean(),e=M.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r)if(1&t){n=e[0];var u,r=n.length-1,o=-1;if(r>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++o<r;)i.point((u=n[o])[0],u[1]);i.lineEnd()}}else r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Te))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:l,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=l,g=ta.merge(g);var n=Fe(m,p);g.length?(b||(i.polygonStart(),b=!0),Ce(g,De,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=Re(),x=t(M),b=!1;return y}}function Te(n){return n.length>1}function Re(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:b,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function De(n,t){return((n=n.x)[0]<0?n[1]-Ra-Ca:Ra-n[1])-((t=t.x)[0]<0?t[1]-Ra-Ca:Ra-t[1])}function Pe(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?qa:-qa,c=ga(i-e);ga(c-qa)<Ca?(n.point(e,r=(r+o)/2>0?Ra:-Ra),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=qa&&(ga(e-u)<Ca&&(e-=u*Ca),ga(i-a)<Ca&&(i-=a*Ca),r=Ue(e,r,i,o),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=i,r=o),u=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function Ue(n,t,e,r){var u,i,o=Math.sin(n-e);return ga(o)>Ca?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function je(n,t,e,r){var u;if(null==n)u=e*Ra,r.point(-qa,u),r.point(0,u),r.point(qa,u),r.point(qa,0),r.point(qa,-u),r.point(0,-u),r.point(-qa,-u),r.point(-qa,0),r.point(-qa,u);else if(ga(n[0]-t[0])>Ca){var i=n[0]<t[0]?qa:-qa;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(t[0],t[1])}function Fe(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;yc.reset();for(var a=0,c=t.length;c>a;++a){var l=t[a],s=l.length;if(s)for(var f=l[0],h=f[0],g=f[1]/2+qa/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=l[d];var m=n[0],y=n[1]/2+qa/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>qa,k=p*M;if(yc.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*La:b,S^h>=e^m>=e){var E=de(pe(f),pe(n));Me(E);var A=de(u,E);Me(A);var N=(S^b>=0?-1:1)*tt(A[2]);(r>N||r===N&&(E[0]||E[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Ca>i||Ca>i&&0>yc)^1&o}function He(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?qa:-qa),h):0;if(!e&&(l=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(be(e,g)||be(p,g))&&(p[0]+=Ca,p[1]+=Ca,v=t(p[0],p[1]))),v!==c)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&be(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=pe(n),u=pe(t),o=[1,0,0],a=de(r,u),c=ve(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=i*c/s,h=-i*l/s,g=de(o,a),p=ye(o,f),v=ye(a,h);me(p,v);var d=g,m=ve(p,d),y=ve(d,d),M=m*m-y*(ve(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=ye(d,(-m-x)/y);if(me(b,p),b=xe(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=ga(A-qa)<Ca,C=N||Ca>A;if(!N&&k>E&&(_=k,k=E,E=_),C?N?k+E>0^b[1]<(ga(b[0]-w)<Ca?k:E):k<=b[1]&&b[1]<=E:A>qa^(w<=b[0]&&b[0]<=S)){var z=ye(d,(-m+x)/y);return me(z,p),[b,xe(z)]}}}function u(t,e){var r=o?n:qa-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=ga(i)>Ca,c=gr(n,6*Da);return Le(t,e,c,o?[0,-n]:[-qa,n-qa])}function Oe(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,l=o.y,s=a.x,f=a.y,h=0,g=1,p=s-c,v=f-l;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-l,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-l,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:l+h*v}),1>g&&(u.b={x:c+g*p,y:l+g*v}),u}}}}}}function Ie(n,t,e,r){function u(r,u){return ga(r[0]-n)<Ca?u>0?0:3:ga(r[0]-e)<Ca?u>0?2:1:ga(r[1]-t)<Ca?u>0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,l=a[0];c>o;++o)i=a[o],l[1]<=r?i[1]>r&&Q(l,i,n)>0&&++t:i[1]<=r&&Q(l,i,n)<0&&--t,l=i;return 0!==t}function l(i,a,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,M),x&&w&&A.rejoin(),v.push(A.buffer())),C.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Tc,Math.min(Tc,n)),t=Math.max(-Tc,Math.min(Tc,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};N(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,E=a,A=Re(),N=Oe(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=ta.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),u&&Ce(v,i,t,l,a),a.polygonEnd()),v=d=m=null}};return C}}function Ye(n){var t=0,e=qa/3,r=ir(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*qa/180,e=n[1]*qa/180):[t/qa*180,e/qa*180]},u}function Ze(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,tt((i-(n*n+e*e)*u*u)/(2*u))]},e}function Ve(){function n(n,t){Dc+=u*n-r*t,r=n,u=t}var t,e,r,u;Hc.point=function(i,o){Hc.point=n,t=r=i,e=u=o},Hc.lineEnd=function(){n(t,e)}}function Xe(n,t){Pc>n&&(Pc=n),n>jc&&(jc=n),Uc>t&&(Uc=t),t>Fc&&(Fc=t)}function $e(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=Be(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=Be(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Be(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function We(n,t){_c+=n,wc+=t,++Sc}function Je(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);kc+=o*(t+n)/2,Ec+=o*(e+r)/2,Ac+=o,We(t=n,e=r)}var t,e;Ic.point=function(r,u){Ic.point=n,We(t=r,e=u)}}function Ge(){Ic.point=We}function Ke(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);kc+=o*(r+n)/2,Ec+=o*(u+t)/2,Ac+=o,o=u*n-r*t,Nc+=o*(r+n),Cc+=o*(u+t),zc+=3*o,We(r=n,u=t)}var t,e,r,u;Ic.point=function(i,o){Ic.point=n,We(t=r=i,e=u=o)},Ic.lineEnd=function(){n(t,e)}}function Qe(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,La)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:b};return a}function nr(n){function t(n){return(a?r:e)(n)}function e(t){return rr(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=0/0,S.point=i,t.lineStart()}function i(e,r){var i=pe([e,r]),o=n(e,r);u(M,x,y,b,_,w,M=o[0],x=o[1],y=e,b=i[0],_=i[1],w=i[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=l,S.lineEnd=s}function l(n,t){i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c
2
+ },polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,l,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=a+g,_=c+p,w=l+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),E=ga(ga(w)-1)<Ca||ga(r-h)<Ca?(r+h)/2:Math.atan2(_,b),A=n(E,k),N=A[0],C=A[1],z=N-t,q=C-e,L=M*z-y*q;(L*L/x>i||ga((y*z+M*q)/x-.5)>.3||o>a*g+c*p+l*v)&&(u(t,e,r,a,c,l,N,C,E,b/=S,_/=S,w,d,m),m.point(N,C),u(N,C,E,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Da),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function tr(n){var t=nr(function(t,e){return n([t*Pa,e*Pa])});return function(n){return or(t(n))}}function er(n){this.stream=n}function rr(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ur(n){return ir(function(){return n})()}function ir(n){function t(n){return n=a(n[0]*Da,n[1]*Da),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Pa,n[1]*Pa]}function r(){a=Ae(o=lr(m,M,x),i);var n=i(v,d);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,o,a,c,l,s,f=nr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,M=0,x=0,b=Lc,_=y,w=null,S=null;return t.stream=function(n){return s&&(s.valid=!1),s=or(b(o,f(_(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(b=null==n?(w=n,Lc):He((w=+n)*Da),u()):w},t.clipExtent=function(n){return arguments.length?(S=n,_=n?Ie(n[0][0],n[0][1],n[1][0],n[1][1]):y,u()):S},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Da,d=n[1]%360*Da,r()):[v*Pa,d*Pa]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Da,M=n[1]%360*Da,x=n.length>2?n[2]%360*Da:0,r()):[m*Pa,M*Pa,x*Pa]},ta.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function or(n){return rr(n,function(t,e){n.point(t*Da,e*Da)})}function ar(n,t){return[n,t]}function cr(n,t){return[n>qa?n-La:-qa>n?n+La:n,t]}function lr(n,t,e){return n?t||e?Ae(fr(n),hr(t,e)):fr(n):t||e?hr(t,e):cr}function sr(n){return function(t,e){return t+=n,[t>qa?t-La:-qa>t?t+La:t,e]}}function fr(n){var t=sr(n);return t.invert=sr(-n),t}function hr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*u;return[Math.atan2(c*i-s*o,a*r-l*u),tt(s*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*i-c*o;return[Math.atan2(c*i+l*o,a*r+s*u),tt(s*r-a*u)]},e}function gr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=pr(e,u),i=pr(e,i),(o>0?i>u:u>i)&&(u+=o*La)):(u=n+o*La,i=n-.5*c);for(var l,s=u;o>0?s>i:i>s;s-=c)a.point((l=xe([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],l[1])}}function pr(n,t){var e=pe(t);e[0]-=n,Me(e);var r=nt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ca)%(2*Math.PI)}function vr(n,t,e){var r=ta.range(n,t-Ca,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function dr(n,t,e){var r=ta.range(n,t-Ca,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function mr(n){return n.source}function yr(n){return n.target}function Mr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),l=u*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(it(r-t)+u*o*it(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,u=e*l+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Pa,Math.atan2(o,Math.sqrt(r*r+u*u))*Pa]}:function(){return[n*Pa,t*Pa]};return p.distance=h,p}function xr(){function n(n,u){var i=Math.sin(u*=Da),o=Math.cos(u),a=ga((n*=Da)-t),c=Math.cos(a);Yc+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Zc.point=function(u,i){t=u*Da,e=Math.sin(i*=Da),r=Math.cos(i),Zc.point=n},Zc.lineEnd=function(){Zc.point=Zc.lineEnd=b}}function br(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function _r(n,t){function e(n,t){o>0?-Ra+Ca>t&&(t=-Ra+Ca):t>Ra-Ca&&(t=Ra-Ca);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(qa/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=K(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Ra]},e):Sr}function wr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return ga(u)<Ca?ar:(e.invert=function(n,t){var e=i-t;return[Math.atan2(n,e)/u,i-K(u)*Math.sqrt(n*n+e*e)]},e)}function Sr(n,t){return[n,Math.log(Math.tan(qa/4+t/2))]}function kr(n){var t,e=ur(n),r=e.scale,u=e.translate,i=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=u.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=i.apply(e,arguments);if(o===e){if(t=null==n){var a=qa*r(),c=u();i([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Er(n,t){return[Math.log(Math.tan(qa/4+t/2)),-n]}function Ar(n){return n[0]}function Nr(n){return n[1]}function Cr(n){for(var t=n.length,e=[0,1],r=2,u=2;t>u;u++){for(;r>1&&Q(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function zr(n,t){return n[0]-t[0]||n[1]-t[1]}function qr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Lr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(u-i))/(f*o-a*s);return[u+h*o,c+h*s]}function Tr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Rr(){tu(this),this.edge=this.site=this.circle=null}function Dr(n){var t=el.pop()||new Rr;return t.site=n,t}function Pr(n){Xr(n),Qc.remove(n),el.push(n),tu(n)}function Ur(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Pr(n);for(var c=i;c.circle&&ga(e-c.circle.x)<Ca&&ga(r-c.circle.cy)<Ca;)i=c.P,a.unshift(c),Pr(c),c=i;a.unshift(c),Xr(c);for(var l=o;l.circle&&ga(e-l.circle.x)<Ca&&ga(r-l.circle.cy)<Ca;)o=l.N,a.push(l),Pr(l),l=o;a.push(l),Xr(l);var s,f=a.length;for(s=1;f>s;++s)l=a[s],c=a[s-1],Kr(l.edge,c.site,l.site,u);c=a[0],l=a[f-1],l.edge=Jr(c.site,l.site,null,u),Vr(c),Vr(l)}function jr(n){for(var t,e,r,u,i=n.x,o=n.y,a=Qc._;a;)if(r=Fr(a,o)-i,r>Ca)a=a.L;else{if(u=i-Hr(a,o),!(u>Ca)){r>-Ca?(t=a.P,e=a):u>-Ca?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Dr(n);if(Qc.insert(t,c),t||e){if(t===e)return Xr(t),e=Dr(t.site),Qc.insert(c,e),c.edge=e.edge=Jr(t.site,c.site),Vr(t),void Vr(e);if(!e)return void(c.edge=Jr(t.site,c.site));Xr(t),Xr(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};Kr(e.edge,l,p,x),c.edge=Jr(l,n,null,x),e.edge=Jr(n,p,null,x),Vr(t),Vr(e)}}function Fr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/i-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+u-i/2)))/f+r:(r+a)/2}function Hr(n,t){var e=n.N;if(e)return Fr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Or(n){this.site=n,this.edges=[]}function Ir(n){for(var t,e,r,u,i,o,a,c,l,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=Kc,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)s=a[o].end(),r=s.x,u=s.y,l=a[++o%c].start(),t=l.x,e=l.y,(ga(r-t)>Ca||ga(u-e)>Ca)&&(a.splice(o,0,new Qr(Gr(i.site,s,ga(r-f)<Ca&&p-u>Ca?{x:f,y:ga(t-f)<Ca?e:p}:ga(u-p)<Ca&&h-r>Ca?{x:ga(e-p)<Ca?t:h,y:p}:ga(r-h)<Ca&&u-g>Ca?{x:h,y:ga(t-h)<Ca?e:g}:ga(u-g)<Ca&&r-f>Ca?{x:ga(e-g)<Ca?t:f,y:g}:null),i.site,null)),++c)}function Yr(n,t){return t.angle-n.angle}function Zr(){tu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Vr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,u=n.site,i=e.site;if(r!==i){var o=u.x,a=u.y,c=r.x-o,l=r.y-a,s=i.x-o,f=i.y-a,h=2*(c*f-l*s);if(!(h>=-za)){var g=c*c+l*l,p=s*s+f*f,v=(f*g-l*p)/h,d=(c*p-s*g)/h,f=d+a,m=rl.pop()||new Zr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=tl._;M;)if(m.y<M.y||m.y===M.y&&m.x<=M.x){if(!M.L){y=M.P;break}M=M.L}else{if(!M.R){y=M;break}M=M.R}tl.insert(y,m),y||(nl=m)}}}}function Xr(n){var t=n.circle;t&&(t.P||(nl=t.N),tl.remove(t),rl.push(t),tu(t),n.circle=null)}function $r(n){for(var t,e=Gc,r=Oe(n[0][0],n[0][1],n[1][0],n[1][1]),u=e.length;u--;)t=e[u],(!Br(t,n)||!r(t)||ga(t.a.x-t.b.x)<Ca&&ga(t.a.y-t.b.y)<Ca)&&(t.a=t.b=null,e.splice(u,1))}function Br(n,t){var e=n.b;if(e)return!0;var r,u,i=n.a,o=t[0][0],a=t[1][0],c=t[0][1],l=t[1][1],s=n.l,f=n.r,h=s.x,g=s.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(i){if(i.y>=l)return}else i={x:d,y:c};e={x:d,y:l}}else{if(i){if(i.y<c)return}else i={x:d,y:l};e={x:d,y:c}}}else if(r=(h-p)/(v-g),u=m-r*d,-1>r||r>1)if(h>p){if(i){if(i.y>=l)return}else i={x:(c-u)/r,y:c};e={x:(l-u)/r,y:l}}else{if(i){if(i.y<c)return}else i={x:(l-u)/r,y:l};e={x:(c-u)/r,y:c}}else if(v>g){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.x<o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}return n.a=i,n.b=e,!0}function Wr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Jr(n,t,e,r){var u=new Wr(n,t);return Gc.push(u),e&&Kr(u,n,t,e),r&&Kr(u,t,n,r),Kc[n.i].edges.push(new Qr(u,n,t)),Kc[t.i].edges.push(new Qr(u,t,n)),u}function Gr(n,t,e){var r=new Wr(n,null);return r.a=t,r.b=e,Gc.push(r),r}function Kr(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function Qr(n,t,e){var r=n.a,u=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function nu(){this._=null}function tu(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function eu(n,t){var e=t,r=t.R,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function ru(n,t){var e=t,r=t.L,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function uu(n){for(;n.L;)n=n.L;return n}function iu(n,t){var e,r,u,i=n.sort(ou).pop();for(Gc=[],Kc=new Array(n.length),Qc=new nu,tl=new nu;;)if(u=nl,i&&(!u||i.y<u.y||i.y===u.y&&i.x<u.x))(i.x!==e||i.y!==r)&&(Kc[i.i]=new Or(i),jr(i),e=i.x,r=i.y),i=n.pop();else{if(!u)break;Ur(u.arc)}t&&($r(t),Ir(t));var o={cells:Kc,edges:Gc};return Qc=tl=Gc=Kc=null,o}function ou(n,t){return t.y-n.y||t.x-n.x}function au(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function cu(n){return n.x}function lu(n){return n.y}function su(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function fu(n,t,e,r,u,i){if(!n(t,e,r,u,i)){var o=.5*(e+u),a=.5*(r+i),c=t.nodes;c[0]&&fu(n,c[0],e,r,o,a),c[1]&&fu(n,c[1],o,r,u,a),c[2]&&fu(n,c[2],e,a,o,i),c[3]&&fu(n,c[3],o,a,u,i)}}function hu(n,t,e,r,u,i,o){var a,c=1/0;return function l(n,s,f,h,g){if(!(s>i||f>o||r>h||u>g)){if(p=n.point){var p,v=t-n.x,d=e-n.y,m=v*v+d*d;if(c>m){var y=Math.sqrt(c=m);r=t-y,u=e-y,i=t+y,o=e+y,a=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:l(n,s,f,x,b);break;case 1:l(n,x,f,h,b);break;case 2:l(n,s,b,x,g);break;case 3:l(n,x,b,h,g)}}}(n,r,u,i,o),a}function gu(n,t){n=ta.rgb(n),t=ta.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+xt(Math.round(e+i*n))+xt(Math.round(r+o*n))+xt(Math.round(u+a*n))}}function pu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=mu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function vu(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function du(n,t){var e,r,u,i=il.lastIndex=ol.lastIndex=0,o=-1,a=[],c=[];for(n+="",t+="";(e=il.exec(n))&&(r=ol.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:vu(e,r)})),i=ol.lastIndex;return i<t.length&&(u=t.slice(i),a[o]?a[o]+=u:a[++o]=u),a.length<2?c[0]?(t=c[0].x,function(n){return t(n)+""}):function(){return t}:(t=c.length,function(n){for(var e,r=0;t>r;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function mu(n,t){for(var e,r=ta.interpolators.length;--r>=0&&!(e=ta.interpolators[r](n,t)););return e}function yu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(mu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function Mu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function xu(n){return function(t){return 1-n(1-t)}}function bu(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function _u(n){return n*n}function wu(n){return n*n*n}function Su(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function ku(n){return function(t){return Math.pow(t,n)}}function Eu(n){return 1-Math.cos(n*Ra)}function Au(n){return Math.pow(2,10*(n-1))}function Nu(n){return 1-Math.sqrt(1-n*n)}function Cu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/La*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*La/t)}}function zu(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function qu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Lu(n,t){n=ta.hcl(n),t=ta.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return st(e+i*n,r+o*n,u+a*n)+""}}function Tu(n,t){n=ta.hsl(n),t=ta.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return ct(e+i*n,r+o*n,u+a*n)+""}}function Ru(n,t){n=ta.lab(n),t=ta.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ht(e+i*n,r+o*n,u+a*n)+""}}function Du(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Pu(n){var t=[n.a,n.b],e=[n.c,n.d],r=ju(t),u=Uu(t,e),i=ju(Fu(e,t,-u))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*Pa,this.translate=[n.e,n.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*Pa:0}function Uu(n,t){return n[0]*t[0]+n[1]*t[1]}function ju(n){var t=Math.sqrt(Uu(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Fu(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Hu(n,t){var e,r=[],u=[],i=ta.transform(n),o=ta.transform(t),a=i.translate,c=o.translate,l=i.rotate,s=o.rotate,f=i.skew,h=o.skew,g=i.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:vu(a[0],c[0])},{i:3,x:vu(a[1],c[1])})):r.push(c[0]||c[1]?"translate("+c+")":""),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:vu(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:vu(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:vu(g[0],p[0])},{i:e-2,x:vu(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i<e;)r[(t=u[i]).i]=t.x(n);return r.join("")}}function Ou(n,t){return t=(t-=n=+n)||1/t,function(e){return(e-n)/t}}function Iu(n,t){return t=(t-=n=+n)||1/t,function(e){return Math.max(0,Math.min(1,(e-n)/t))}}function Yu(n){for(var t=n.source,e=n.target,r=Vu(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function Zu(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Vu(n,t){if(n===t)return n;for(var e=Zu(n),r=Zu(t),u=e.pop(),i=r.pop(),o=null;u===i;)o=u,u=e.pop(),i=r.pop();return o}function Xu(n){n.fixed|=2}function $u(n){n.fixed&=-7}function Bu(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Wu(n){n.fixed&=-5}function Ju(n,t,e){var r=0,u=0;if(n.charge=0,!n.leaf)for(var i,o=n.nodes,a=o.length,c=-1;++c<a;)i=o[c],null!=i&&(Ju(i,t,e),n.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,u+=l*n.point.y}n.cx=r/n.charge,n.cy=u/n.charge}function Gu(n,t){return ta.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=ri,n}function Ku(n,t){for(var e=[n];null!=(n=e.pop());)if(t(n),(u=n.children)&&(r=u.length))for(var r,u;--r>=0;)e.push(u[r])}function Qu(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++o<u;)e.push(i[o]);for(;null!=(n=r.pop());)t(n)}function ni(n){return n.children}function ti(n){return n.value}function ei(n,t){return t.value-n.value}function ri(n){return ta.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function ui(n){return n.x}function ii(n){return n.y}function oi(n,t,e){n.y0=t,n.y=e}function ai(n){return ta.range(n.length)}function ci(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function li(n){for(var t,e=1,r=0,u=n[0][1],i=n.length;i>e;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function si(n){return n.reduce(fi,0)}function fi(n,t){return n+t[1]}function hi(n,t){return gi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function gi(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function pi(n){return[ta.min(n),ta.max(n)]}function vi(n,t){return n.value-t.value}function di(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function mi(n,t){n._pack_next=t,t._pack_prev=n}function yi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function Mi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,u,i,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(xi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(u=e[1],u.x=u.r,u.y=0,t(u),l>2))for(i=e[2],wi(r,u,i),t(i),di(r,i),r._pack_prev=i,di(i,u),u=r._pack_next,o=3;l>o;o++){wi(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(yi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!yi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.r<r.r?mi(r,u=a):mi(r=c,u),o--):(di(r,i),u=i,t(i))}var m=(s+f)/2,y=(h+g)/2,M=0;for(o=0;l>o;o++)i=e[o],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(bi)}}function xi(n){n._pack_next=n._pack_prev=n}function bi(n){delete n._pack_next,delete n._pack_prev}function _i(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i<o;)_i(u[i],t,e,r)}function wi(n,t,e){var r=n.r+e.r,u=t.x-n.x,i=t.y-n.y;if(r&&(u||i)){var o=t.r+e.r,a=u*u+i*i;o*=o,r*=r;var c=.5+(r-o)/(2*a),l=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*u+l*i,e.y=n.y+c*i-l*u}else e.x=n.x+r,e.y=n.y}function Si(n,t){return n.parent==t.parent?1:2}function ki(n){var t=n.children;return t.length?t[0]:n.t}function Ei(n){var t,e=n.children;return(t=e.length)?e[t-1]:n.t}function Ai(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function Ni(n){for(var t,e=0,r=0,u=n.children,i=u.length;--i>=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Ci(n,t,e){return n.a.parent===t.parent?n.a:e}function zi(n){return 1+ta.max(n,function(n){return n.y})}function qi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Li(n){var t=n.children;return t&&t.length?Li(t[0]):n}function Ti(n){var t,e=n.children;return e&&(t=e.length)?Ti(e[t-1]):n}function Ri(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Di(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Pi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Ui(n){return n.rangeExtent?n.rangeExtent():Pi(n.range())}function ji(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Fi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Hi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:ml}function Oi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)u.push(e(n[o-1],n[o])),i.push(r(t[o-1],t[o]));return function(t){var e=ta.bisect(n,t,1,a)-1;return i[e](u[e](t))}}function Ii(n,t,e,r){function u(){var u=Math.min(n.length,t.length)>2?Oi:ji,c=r?Iu:Ou;return o=u(n,t,c,e),a=u(t,n,c,mu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Du)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Xi(n,t)},i.tickFormat=function(t,e){return $i(n,t,e)},i.nice=function(t){return Zi(n,t),u()},i.copy=function(){return Ii(n,t,e,r)},u()}function Yi(n,t){return ta.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Zi(n,t){return Fi(n,Hi(Vi(n,t)[2]))}function Vi(n,t){null==t&&(t=10);var e=Pi(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Xi(n,t){return ta.range.apply(ta,Vi(n,t))}function $i(n,t,e){var r=Vi(n,t);if(e){var u=ic.exec(e);if(u.shift(),"s"===u[8]){var i=ta.formatPrefix(Math.max(ga(r[0]),ga(r[1])));return u[7]||(u[7]="."+Bi(i.scale(r[2]))),u[8]="f",e=ta.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Wi(u[8],r)),e=u.join("")}else e=",."+Bi(r[2])+"f";return ta.format(e)}function Bi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Wi(n,t){var e=Bi(t[2]);return n in yl?Math.abs(e-Bi(Math.max(ga(t[0]),ga(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Ji(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Fi(r.map(u),e?Math:xl);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Pi(r),o=[],a=n[0],c=n[1],l=Math.floor(u(a)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(i(l)*h);o.push(i(l))}else for(o.push(i(l));l++<s;)for(var h=f-1;h>0;h--)o.push(i(l)*h);for(l=0;o[l]<a;l++);for(s=o.length;o[s-1]>c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return Ml;arguments.length<2?t=Ml:"function"!=typeof t&&(t=ta.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Ji(n.copy(),t,e,r)},Yi(o,n)}function Gi(n,t,e){function r(t){return n(u(t))}var u=Ki(t),i=Ki(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Xi(e,n)},r.tickFormat=function(n,t){return $i(e,n,t)},r.nice=function(n){return r.domain(Zi(e,n))},r.exponent=function(o){return arguments.length?(u=Ki(t=o),i=Ki(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Gi(n.copy(),t,e)},Yi(r,n)}function Ki(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Qi(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return ta.range(n.length).map(function(n){return t+e*n})}var u,i,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new l;for(var i,o=-1,a=r.length;++o<a;)u.has(i=r[o])||u.set(i,n.push(i));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(i=n,o=0,t={t:"range",a:arguments},e):i},e.rangePoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=(c+l)/2,0):(l-c)/(n.length-1+a);return i=r(c+s*a/2,s),o=0,t={t:"rangePoints",a:arguments},e},e.rangeRoundPoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=l=Math.round((c+l)/2),0):(l-c)/(n.length-1+a)|0;return i=r(c+Math.round(s*a/2+(l-c-(n.length-1+a)*s)/2),s),o=0,t={t:"rangeRoundPoints",a:arguments},e},e.rangeBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=(f-s)/(n.length-a+2*c);return i=r(s+h*c,h),l&&i.reverse(),o=h*(1-a),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=Math.floor((f-s)/(n.length-a+2*c));return i=r(s+Math.round((f-s-(n.length-a)*h)/2),h),l&&i.reverse(),o=Math.round(h*(1-a)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Pi(t.a[0])},e.copy=function(){return Qi(n,t)},e.domain(n)}function no(n,t){function i(){var e=0,r=t.length;for(a=[];++e<r;)a[e-1]=ta.quantile(n,e/r);return o}function o(n){return isNaN(n=+n)?void 0:t[ta.bisect(a,n)]}var a;return o.domain=function(t){return arguments.length?(n=t.map(r).filter(u).sort(e),i()):n},o.range=function(n){return arguments.length?(t=n,i()):t},o.quantiles=function(){return a},o.invertExtent=function(e){return e=t.indexOf(e),0>e?[0/0,0/0]:[e>0?a[e-1]:n[0],e<a.length?a[e]:n[n.length-1]]},o.copy=function(){return no(n,t)},i()}function to(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(i*(t-n))))]}function u(){return i=e.length/(t-n),o=e.length-1,r}var i,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],u()):[n,t]},r.range=function(n){return arguments.length?(e=n,u()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return to(n,t,e)},u()}function eo(n,t){function e(e){return e>=e?t[ta.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return eo(n,t)},e}function ro(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Xi(n,t)},t.tickFormat=function(t,e){return $i(n,t,e)},t.copy=function(){return ro(n)},t}function uo(){return 0}function io(n){return n.innerRadius}function oo(n){return n.outerRadius}function ao(n){return n.startAngle}function co(n){return n.endAngle}function lo(n){return n&&n.padAngle}function so(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function fo(n,t,e,r,u){var i=n[0]-t[0],o=n[1]-t[1],a=(u?r:-r)/Math.sqrt(i*i+o*o),c=a*o,l=-a*i,s=n[0]+c,f=n[1]+l,h=t[0]+c,g=t[1]+l,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(M*M*y-x*x),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,E=_-p,A=w-v,N=S-p,C=k-v;return E*E+A*A>N*N+C*C&&(_=S,w=k),[[_-c,w-l],[_*e/M,w*e/M]]}function ho(n){function t(t){function o(){l.push("M",i(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=Et(e),p=Et(r);++f<h;)u.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(o(),s=[]);return s.length&&o(),l.length?l.join(""):null}var e=Ar,r=Nr,u=Ne,i=go,o=i.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?i=n:(i=El.get(n)||go).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function go(n){return n.join("L")}function po(n){return go(n)+"Z"}function vo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&u.push("H",r[0]),u.join("")}function mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("V",(r=n[t])[1],"H",r[0]);return u.join("")}function yo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r=n[t])[0],"V",r[1]);return u.join("")}function Mo(n,t){return n.length<4?go(n):n[1]+_o(n.slice(1,-1),wo(n,t))}function xo(n,t){return n.length<3?go(n):n[0]+_o((n.push(n[0]),n),wo([n[n.length-2]].concat(n,[n[1]]),t))}function bo(n,t){return n.length<3?go(n):n[0]+_o(n,wo(n,t))}function _o(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return go(n);var e=n.length!=t.length,r="",u=n[0],i=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(i[0]-2*o[0]/3)+","+(i[1]-2*o[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var l=2;l<t.length;l++,c++)i=n[c],a=t[l],r+="S"+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1]}if(e){var s=n[c];r+="Q"+(i[0]+2*a[0]/3)+","+(i[1]+2*a[1]/3)+","+s[0]+","+s[1]}return r}function wo(n,t){for(var e,r=[],u=(1-t)/2,i=n[0],o=n[1],a=1,c=n.length;++a<c;)e=i,i=o,o=n[a],r.push([u*(o[0]-e[0]),u*(o[1]-e[1])]);return r}function So(n){if(n.length<3)return go(n);var t=1,e=n.length,r=n[0],u=r[0],i=r[1],o=[u,u,u,(r=n[1])[0]],a=[i,i,i,r[1]],c=[u,",",i,"L",No(Cl,o),",",No(Cl,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),Co(c,o,a);return n.pop(),c.push("L",r),c.join("")}function ko(n){if(n.length<4)return go(n);for(var t,e=[],r=-1,u=n.length,i=[0],o=[0];++r<3;)t=n[r],i.push(t[0]),o.push(t[1]);for(e.push(No(Cl,i)+","+No(Cl,o)),--r;++r<u;)t=n[r],i.shift(),i.push(t[0]),o.shift(),o.push(t[1]),Co(e,i,o);return e.join("")}function Eo(n){for(var t,e,r=-1,u=n.length,i=u+4,o=[],a=[];++r<4;)e=n[r%u],o.push(e[0]),a.push(e[1]);for(t=[No(Cl,o),",",No(Cl,a)],--r;++r<i;)e=n[r%u],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),Co(t,o,a);return t.join("")}function Ao(n,t){var e=n.length-1;if(e)for(var r,u,i=n[0][0],o=n[0][1],a=n[e][0]-i,c=n[e][1]-o,l=-1;++l<=e;)r=n[l],u=l/e,r[0]=t*r[0]+(1-t)*(i+u*a),r[1]=t*r[1]+(1-t)*(o+u*c);return So(n)}function No(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function Co(n,t,e){n.push("C",No(Al,t),",",No(Al,e),",",No(Nl,t),",",No(Nl,e),",",No(Cl,t),",",No(Cl,e))}function zo(n,t){return(t[1]-n[1])/(t[0]-n[0])}function qo(n){for(var t=0,e=n.length-1,r=[],u=n[0],i=n[1],o=r[0]=zo(u,i);++t<e;)r[t]=(o+(o=zo(u=i,i=n[t+1])))/2;return r[t]=o,r}function Lo(n){for(var t,e,r,u,i=[],o=qo(n),a=-1,c=n.length-1;++a<c;)t=zo(n[a],n[a+1]),ga(t)<Ca?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,u=e*e+r*r,u>9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function To(n){return n.length<3?go(n):n[0]+_o(n,Lo(n))}function Ro(n){for(var t,e,r,u=-1,i=n.length;++u<i;)t=n[u],e=t[0],r=t[1]-Ra,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Do(n){function t(t){function c(){v.push("M",a(n(m),f),s,l(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,M=t.length,x=Et(e),b=Et(u),_=e===r?function(){return g}:Et(r),w=u===i?function(){return p}:Et(i);++y<M;)o.call(this,h=t[y],y)?(d.push([g=+x.call(this,h,y),p=+b.call(this,h,y)]),m.push([+_.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],m=[]);return d.length&&c(),v.length?v.join(""):null}var e=Ar,r=Ar,u=0,i=Nr,o=Ne,a=go,c=a.key,l=a,s="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r
3
+ },t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=El.get(n)||go).key,l=a.reverse||a,s=a.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(f=n,t):f},t}function Po(n){return n.radius}function Uo(n){return[n.x,n.y]}function jo(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]-Ra;return[e*Math.cos(r),e*Math.sin(r)]}}function Fo(){return 64}function Ho(){return"circle"}function Oo(n){var t=Math.sqrt(n/qa);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Io(n){return function(){var t,e;(t=this[n])&&(e=t[t.active])&&(--t.count?delete t[t.active]:delete this[n],t.active+=.5,e.event&&e.event.interrupt.call(this,this.__data__,e.index))}}function Yo(n,t,e){return ya(n,Pl),n.namespace=t,n.id=e,n}function Zo(n,t,e,r){var u=n.id,i=n.namespace;return Y(n,"function"==typeof e?function(n,o,a){n[i][u].tween.set(t,r(e.call(n,n.__data__,o,a)))}:(e=r(e),function(n){n[i][u].tween.set(t,e)}))}function Vo(n){return null==n&&(n=""),function(){this.textContent=n}}function Xo(n){return null==n?"__transition__":"__transition_"+n+"__"}function $o(n,t,e,r,u){var i=n[e]||(n[e]={active:0,count:0}),o=i[r];if(!o){var a=u.time;o=i[r]={tween:new l,time:a,delay:u.delay,duration:u.duration,ease:u.ease,index:t},u=null,++i.count,ta.timer(function(u){function c(e){if(i.active>r)return s();var u=i[i.active];u&&(--i.count,delete i[i.active],u.event&&u.event.interrupt.call(n,n.__data__,u.index)),i.active=r,o.event&&o.event.start.call(n,n.__data__,t),o.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&v.push(r)}),h=o.ease,f=o.duration,ta.timer(function(){return p.c=l(e||1)?Ne:l,1},0,a)}function l(e){if(i.active!==r)return 1;for(var u=e/f,a=h(u),c=v.length;c>0;)v[--c].call(n,a);return u>=1?(o.event&&o.event.end.call(n,n.__data__,t),s()):void 0}function s(){return--i.count?delete i[r]:delete n[e],1}var f,h,g=o.delay,p=ec,v=[];return p.t=g+a,u>=g?c(u-g):void(p.c=c)},0,a)}}function Bo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function Wo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function Jo(n){return n.toISOString()}function Go(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=ta.bisect(Vl,u);return i==Vl.length?[t.year,Vi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Vl[i-1]<Vl[i]/u?i-1:i]:[Bl,Vi(n,e)[2]]}return r.invert=function(t){return Ko(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Ko)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Ko(+e+1),t).length}var i=r.domain(),o=Pi(i),a=null==n?u(o,10):"number"==typeof n&&u(o,n);return a&&(n=a[0],t=a[1]),r.domain(Fi(i,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Ko(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Ko(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Pi(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Ko(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Go(n.copy(),t,e)},Yi(r,n)}function Ko(n){return new Date(n)}function Qo(n){return JSON.parse(n.responseText)}function na(n){var t=ua.createRange();return t.selectNode(ua.body),t.createContextualFragment(n.responseText)}var ta={version:"3.5.6"},ea=[].slice,ra=function(n){return ea.call(n)},ua=this.document;if(ua)try{ra(ua.documentElement.childNodes)[0].nodeType}catch(ia){ra=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}if(Date.now||(Date.now=function(){return+new Date}),ua)try{ua.createElement("DIV").style.setProperty("opacity",0,"")}catch(oa){var aa=this.Element.prototype,ca=aa.setAttribute,la=aa.setAttributeNS,sa=this.CSSStyleDeclaration.prototype,fa=sa.setProperty;aa.setAttribute=function(n,t){ca.call(this,n,t+"")},aa.setAttributeNS=function(n,t,e){la.call(this,n,t,e+"")},sa.setProperty=function(n,t,e){fa.call(this,n,t+"",e)}}ta.ascending=e,ta.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ta.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&e>r&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&e>r&&(e=r)}return e},ta.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&r>e&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&r>e&&(e=r)}return e},ta.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=n[i])&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=n[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;++i<o;)if(null!=(r=t.call(n,n[i],i))&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=t.call(n,n[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},ta.sum=function(n,t){var e,r=0,i=n.length,o=-1;if(1===arguments.length)for(;++o<i;)u(e=+n[o])&&(r+=e);else for(;++o<i;)u(e=+t.call(n,n[o],o))&&(r+=e);return r},ta.mean=function(n,t){var e,i=0,o=n.length,a=-1,c=o;if(1===arguments.length)for(;++a<o;)u(e=r(n[a]))?i+=e:--c;else for(;++a<o;)u(e=r(t.call(n,n[a],a)))?i+=e:--c;return c?i/c:void 0},ta.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),u=+n[r-1],i=e-r;return i?u+i*(n[r]-u):u},ta.median=function(n,t){var i,o=[],a=n.length,c=-1;if(1===arguments.length)for(;++c<a;)u(i=r(n[c]))&&o.push(i);else for(;++c<a;)u(i=r(t.call(n,n[c],c)))&&o.push(i);return o.length?ta.quantile(o.sort(e),.5):void 0},ta.variance=function(n,t){var e,i,o=n.length,a=0,c=0,l=-1,s=0;if(1===arguments.length)for(;++l<o;)u(e=r(n[l]))&&(i=e-a,a+=i/++s,c+=i*(e-a));else for(;++l<o;)u(e=r(t.call(n,n[l],l)))&&(i=e-a,a+=i/++s,c+=i*(e-a));return s>1?c/(s-1):void 0},ta.deviation=function(){var n=ta.variance.apply(this,arguments);return n?Math.sqrt(n):n};var ha=i(e);ta.bisectLeft=ha.left,ta.bisect=ta.bisectRight=ha.right,ta.bisector=function(n){return i(1===n.length?function(t,r){return e(n(t),r)}:n)},ta.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=Math.random()*i--|0,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},ta.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ta.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},ta.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=ta.min(arguments,o),e=new Array(t);++n<t;)for(var r,u=-1,i=e[n]=new Array(r);++u<r;)i[u]=arguments[u][n];return e},ta.transpose=function(n){return ta.zip.apply(ta,n)},ta.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ta.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ta.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ta.merge=function(n){for(var t,e,r,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(e=new Array(o);--u>=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var ga=Math.abs;ta.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,u=[],i=a(ga(e)),o=-1;if(n*=i,t*=i,e*=i,0>e)for(;(r=n+e*++o)>t;)u.push(r/i);else for(;(r=n+e*++o)<t;)u.push(r/i);return u},ta.map=function(n,t){var e=new l;if(n instanceof l)n.forEach(function(n,t){e.set(n,t)});else if(Array.isArray(n)){var r,u=-1,i=n.length;if(1===arguments.length)for(;++u<i;)e.set(u,n[u]);else for(;++u<i;)e.set(t.call(n,r=n[u],u),r)}else for(var o in n)e.set(o,n[o]);return e};var pa="__proto__",va="\x00";c(l,{has:h,get:function(n){return this._[s(n)]},set:function(n,t){return this._[s(n)]=t},remove:g,keys:p,values:function(){var n=[];for(var t in this._)n.push(this._[t]);return n},entries:function(){var n=[];for(var t in this._)n.push({key:f(t),value:this._[t]});return n},size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,f(t),this._[t])}}),ta.nest=function(){function n(t,o,a){if(a>=i.length)return r?r.call(u,o):e?o.sort(e):o;for(var c,s,f,h,g=-1,p=o.length,v=i[a++],d=new l;++g<p;)(h=d.get(c=v(s=o[g])))?h.push(s):d.set(c,[s]);return t?(s=t(),f=function(e,r){s.set(e,n(t,r,a))}):(s={},f=function(e,r){s[e]=n(t,r,a)}),d.forEach(f),s}function t(n,e){if(e>=i.length)return n;var r=[],u=o[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ta.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return o[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ta.set=function(n){var t=new m;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},c(m,{has:h,add:function(n){return this._[s(n+="")]=!0,n},remove:g,values:p,size:v,empty:d,forEach:function(n){for(var t in this._)n.call(this,f(t))}}),ta.behavior={},ta.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r<u;)n[e=arguments[r]]=M(n,t,t[e]);return n};var da=["webkit","ms","moz","Moz","o","O"];ta.dispatch=function(){for(var n=new _,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=w(n);return n},_.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ta.event=null,ta.requote=function(n){return n.replace(ma,"\\$&")};var ma=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ya={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Ma=function(n,t){return t.querySelector(n)},xa=function(n,t){return t.querySelectorAll(n)},ba=function(n,t){var e=n.matches||n[x(n,"matchesSelector")];return(ba=function(n,t){return e.call(n,t)})(n,t)};"function"==typeof Sizzle&&(Ma=function(n,t){return Sizzle(n,t)[0]||null},xa=Sizzle,ba=Sizzle.matchesSelector),ta.selection=function(){return ta.select(ua.documentElement)};var _a=ta.selection.prototype=[];_a.select=function(n){var t,e,r,u,i=[];n=N(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,l=r.length;++c<l;)(u=r[c])?(t.push(e=n.call(u,u.__data__,c,o)),e&&"__data__"in u&&(e.__data__=u.__data__)):t.push(null)}return A(i)},_a.selectAll=function(n){var t,e,r=[];n=C(n);for(var u=-1,i=this.length;++u<i;)for(var o=this[u],a=-1,c=o.length;++a<c;)(e=o[a])&&(r.push(t=ra(n.call(e,e.__data__,a,u))),t.parentNode=e);return A(r)};var wa={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ta.ns={prefix:wa,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.slice(0,t),n=n.slice(t+1)),wa.hasOwnProperty(e)?{space:wa[e],local:n}:n}},_a.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ta.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(z(t,n[t]));return this}return this.each(z(n,t))},_a.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=T(n)).length,u=-1;if(t=e.classList){for(;++u<r;)if(!t.contains(n[u]))return!1}else for(t=e.getAttribute("class");++u<r;)if(!L(n[u]).test(t))return!1;return!0}for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},_a.style=function(n,e,r){var u=arguments.length;if(3>u){if("string"!=typeof n){2>u&&(e="");for(r in n)this.each(P(r,n[r],e));return this}if(2>u){var i=this.node();return t(i).getComputedStyle(i,null).getPropertyValue(n)}r=""}return this.each(P(n,e,r))},_a.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(U(t,n[t]));return this}return this.each(U(n,t))},_a.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},_a.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},_a.append=function(n){return n=j(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},_a.insert=function(n,t){return n=j(n),t=N(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},_a.remove=function(){return this.each(F)},_a.data=function(n,t){function e(n,e){var r,u,i,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),v=new Array(o);if(t){var d,m=new l,y=new Array(o);for(r=-1;++r<o;)m.has(d=t.call(u=n[r],u.__data__,r))?v[r]=u:m.set(d,u),y[r]=d;for(r=-1;++r<f;)(u=m.get(d=t.call(e,i=e[r],r)))?u!==!0&&(g[r]=u,u.__data__=i):p[r]=H(i),m.set(d,!0);for(r=-1;++r<o;)m.get(y[r])!==!0&&(v[r]=n[r])}else{for(r=-1;++r<h;)u=n[r],i=e[r],u?(u.__data__=i,g[r]=u):p[r]=H(i);for(;f>r;++r)p[r]=H(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,a.push(p),c.push(g),s.push(v)}var r,u,i=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++i<o;)(u=r[i])&&(n[i]=u.__data__);return n}var a=Z([]),c=A([]),s=A([]);if("function"==typeof n)for(;++i<o;)e(r=this[i],n.call(r,r.parentNode.__data__,i));else for(;++i<o;)e(r=this[i],n);return c.enter=function(){return a},c.exit=function(){return s},c},_a.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},_a.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=O(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return A(u)},_a.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},_a.sort=function(n){n=I.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},_a.each=function(n){return Y(this,function(t,e,r){n.call(t,t.__data__,e,r)})},_a.call=function(n){var t=ra(arguments);return n.apply(t[0]=this,t),this},_a.empty=function(){return!this.node()},_a.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},_a.size=function(){var n=0;return Y(this,function(){++n}),n};var Sa=[];ta.selection.enter=Z,ta.selection.enter.prototype=Sa,Sa.append=_a.append,Sa.empty=_a.empty,Sa.node=_a.node,Sa.call=_a.call,Sa.size=_a.size,Sa.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++a<c;){r=(u=this[a]).update,o.push(t=[]),t.parentNode=u.parentNode;for(var l=-1,s=u.length;++l<s;)(i=u[l])?(t.push(r[l]=e=n.call(u.parentNode,i.__data__,l,a)),e.__data__=i.__data__):t.push(null)}return A(o)},Sa.insert=function(n,t){return arguments.length<2&&(t=V(this)),_a.insert.call(this,n,t)},ta.select=function(t){var e;return"string"==typeof t?(e=[Ma(t,ua)],e.parentNode=ua.documentElement):(e=[t],e.parentNode=n(t)),A([e])},ta.selectAll=function(n){var t;return"string"==typeof n?(t=ra(xa(n,ua)),t.parentNode=ua.documentElement):(t=n,t.parentNode=null),A([t])},_a.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var ka=ta.map({mouseenter:"mouseover",mouseleave:"mouseout"});ua&&ka.forEach(function(n){"on"+n in ua&&ka.remove(n)});var Ea,Aa=0;ta.mouse=function(n){return J(n,k())};var Na=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;ta.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=k().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return J(n,r)},ta.behavior.drag=function(){function n(){this.on("mousedown.drag",i).on("touchstart.drag",o)}function e(n,t,e,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&ta.event.target===f),g({type:"dragend"}))}var l,s=this,f=ta.event.target,h=s.parentNode,g=r.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=ta.select(e(f)).on(i+d,a).on(o+d,c),y=W(f),M=t(h,v);u?(l=u.apply(s,arguments),l=[l.x-M[0],l.y-M[1]]):l=[0,0],g({type:"dragstart"})}}var r=E(n,"drag","dragstart","dragend"),u=null,i=e(b,ta.mouse,t,"mousemove","mouseup"),o=e(G,ta.touch,y,"touchmove","touchend");return n.origin=function(t){return arguments.length?(u=t,n):u},ta.rebind(n,r,"on")},ta.touches=function(n,t){return arguments.length<2&&(t=k().touches),t?ra(t).map(function(t){var e=J(n,t);return e.identifier=t.identifier,e}):[]};var Ca=1e-6,za=Ca*Ca,qa=Math.PI,La=2*qa,Ta=La-Ca,Ra=qa/2,Da=qa/180,Pa=180/qa,Ua=Math.SQRT2,ja=2,Fa=4;ta.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=rt(v),o=i/(ja*h)*(e*ut(Ua*t+v)-et(v));return[r+o*l,u+o*s,i*e/rt(Ua*t+v)]}return[r+n*l,u+n*s,i*Math.exp(Ua*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Fa*f)/(2*i*ja*h),p=(c*c-i*i-Fa*f)/(2*c*ja*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Ua;return e.duration=1e3*y,e},ta.behavior.zoom=function(){function n(n){n.on(q,f).on(Oa+".zoom",g).on("dblclick.zoom",p).on(R,h)}function e(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function r(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function u(n){k.k=Math.max(N[0],Math.min(N[1],n))}function i(n,t){t=r(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function o(t,e,r,o){t.__chart__={x:k.x,y:k.y,k:k.k},u(Math.pow(2,o)),i(d=e,r),t=ta.select(t),C>0&&(t=t.transition().duration(C)),t.call(n.event)}function a(){b&&b.domain(x.range().map(function(n){return(n-k.x)/k.k}).map(x.invert)),w&&w.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function c(n){z++||n({type:"zoomstart"})}function l(n){a(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function s(n){--z||(n({type:"zoomend"}),d=null)}function f(){function n(){f=1,i(ta.mouse(u),g),l(a)}function r(){h.on(L,null).on(T,null),p(f&&ta.event.target===o),s(a)}var u=this,o=ta.event.target,a=D.of(u,arguments),f=0,h=ta.select(t(u)).on(L,n).on(T,r),g=e(ta.mouse(u)),p=W(u);Dl.call(u),c(a)}function h(){function n(){var n=ta.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=e(n))}),n}function t(){var t=ta.event.target;ta.select(t).on(x,r).on(b,a),_.push(t);for(var e=ta.event.changedTouches,u=0,i=e.length;i>u;++u)d[e[u].identifier]=null;var c=n(),l=Date.now();if(1===c.length){if(500>l-M){var s=c[0];o(p,s,d[s.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),S()}M=l}else if(c.length>1){var s=c[0],f=c[1],h=s[0]-f[0],g=s[1]-f[1];m=h*h+g*g}}function r(){var n,t,e,r,o=ta.touches(p);Dl.call(p);for(var a=0,c=o.length;c>a;++a,r=null)if(e=o[a],r=d[e.identifier]){if(t)break;n=e,t=r}if(r){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+r[0])/2,(t[1]+r[1])/2],u(f*g)}M=null,i(n,t),l(v)}function a(){if(ta.event.touches.length){for(var t=ta.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}ta.selectAll(_).on(y,null),w.on(q,f).on(R,h),E(),s(v)}var g,p=this,v=D.of(p,arguments),d={},m=0,y=".zoom-"+ta.event.changedTouches[0].identifier,x="touchmove"+y,b="touchend"+y,_=[],w=ta.select(p),E=W(p);t(),c(v),w.on(q,null).on(R,t)}function g(){var n=D.of(this,arguments);y?clearTimeout(y):(Dl.call(this),v=e(d=m||ta.mouse(this)),c(n)),y=setTimeout(function(){y=null,s(n)},50),S(),u(Math.pow(2,.002*Ha())*k.k),i(d,v),l(n)}function p(){var n=ta.mouse(this),t=Math.log(k.k)/Math.LN2;o(this,n,e(n),ta.event.shiftKey?Math.ceil(t)-1:Math.floor(t)+1)}var v,d,m,y,M,x,b,_,w,k={x:0,y:0,k:1},A=[960,500],N=Ia,C=250,z=0,q="mousedown.zoom",L="mousemove.zoom",T="mouseup.zoom",R="touchstart.zoom",D=E(n,"zoomstart","zoom","zoomend");return Oa||(Oa="onwheel"in ua?(Ha=function(){return-ta.event.deltaY*(ta.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ua?(Ha=function(){return ta.event.wheelDelta},"mousewheel"):(Ha=function(){return-ta.event.detail},"MozMousePixelScroll")),n.event=function(n){n.each(function(){var n=D.of(this,arguments),t=k;Tl?ta.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},c(n)}).tween("zoom:zoom",function(){var e=A[0],r=A[1],u=d?d[0]:e/2,i=d?d[1]:r/2,o=ta.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:u-r[0]*a,y:i-r[1]*a,k:a},l(n)}}).each("interrupt.zoom",function(){s(n)}).each("end.zoom",function(){s(n)}):(this.__chart__=k,c(n),l(n),s(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},a(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},a(),n):k.k},n.scaleExtent=function(t){return arguments.length?(N=null==t?Ia:[+t[0],+t[1]],n):N},n.center=function(t){return arguments.length?(m=t&&[+t[0],+t[1]],n):m},n.size=function(t){return arguments.length?(A=t&&[+t[0],+t[1]],n):A},n.duration=function(t){return arguments.length?(C=+t,n):C},n.x=function(t){return arguments.length?(b=t,x=t.copy(),k={x:0,y:0,k:1},n):b},n.y=function(t){return arguments.length?(w=t,_=t.copy(),k={x:0,y:0,k:1},n):w},ta.rebind(n,D,"on")};var Ha,Oa,Ia=[0,1/0];ta.color=ot,ot.prototype.toString=function(){return this.rgb()+""},ta.hsl=at;var Ya=at.prototype=new ot;Ya.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,this.l/n)},Ya.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new at(this.h,this.s,n*this.l)},Ya.rgb=function(){return ct(this.h,this.s,this.l)},ta.hcl=lt;var Za=lt.prototype=new ot;Za.brighter=function(n){return new lt(this.h,this.c,Math.min(100,this.l+Va*(arguments.length?n:1)))},Za.darker=function(n){return new lt(this.h,this.c,Math.max(0,this.l-Va*(arguments.length?n:1)))},Za.rgb=function(){return st(this.h,this.c,this.l).rgb()},ta.lab=ft;var Va=18,Xa=.95047,$a=1,Ba=1.08883,Wa=ft.prototype=new ot;Wa.brighter=function(n){return new ft(Math.min(100,this.l+Va*(arguments.length?n:1)),this.a,this.b)},Wa.darker=function(n){return new ft(Math.max(0,this.l-Va*(arguments.length?n:1)),this.a,this.b)},Wa.rgb=function(){return ht(this.l,this.a,this.b)},ta.rgb=mt;var Ja=mt.prototype=new ot;Ja.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new mt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new mt(u,u,u)},Ja.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new mt(n*this.r,n*this.g,n*this.b)},Ja.hsl=function(){return _t(this.r,this.g,this.b)},Ja.toString=function(){return"#"+xt(this.r)+xt(this.g)+xt(this.b)};var Ga=ta.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Ga.forEach(function(n,t){Ga.set(n,yt(t))}),ta.functor=Et,ta.xhr=At(y),ta.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=Nt(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=l)return o;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++<l;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}s=e+2;var r=n.charCodeAt(e+1);return 13===r?(u=!0,10===n.charCodeAt(e+2)&&++s):10===r&&(u=!0),n.slice(t+1,e).replace(/""/g,'"')}for(;l>s;){var r=n.charCodeAt(s++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==c)continue;return n.slice(t,s-a)}return n.slice(t)}for(var r,u,i={},o={},a=[],l=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,f++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new m,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},ta.csv=ta.dsv(",","text/csv"),ta.tsv=ta.dsv(" ","text/tab-separated-values");var Ka,Qa,nc,tc,ec,rc=this[x(this,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ta.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};Qa?Qa.n=i:Ka=i,Qa=i,nc||(tc=clearTimeout(tc),nc=1,rc(qt))},ta.timer.flush=function(){Lt(),Tt()},ta.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var uc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Dt);ta.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ta.round(n,Rt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),uc[8+e/3]};var ic=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,oc=ta.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ta.round(n,Rt(n,t))).toFixed(Math.max(0,Math.min(20,Rt(n*(1+1e-15),t))))}}),ac=ta.time={},cc=Date;jt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){lc.setUTCDate.apply(this._,arguments)},setDay:function(){lc.setUTCDay.apply(this._,arguments)},setFullYear:function(){lc.setUTCFullYear.apply(this._,arguments)},setHours:function(){lc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){lc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){lc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){lc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){lc.setUTCSeconds.apply(this._,arguments)},setTime:function(){lc.setTime.apply(this._,arguments)}};var lc=Date.prototype;ac.year=Ft(function(n){return n=ac.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),ac.years=ac.year.range,ac.years.utc=ac.year.utc.range,ac.day=Ft(function(n){var t=new cc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),ac.days=ac.day.range,ac.days.utc=ac.day.utc.range,ac.dayOfYear=function(n){var t=ac.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=ac[n]=Ft(function(n){return(n=ac.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=ac.year(n).getDay();return Math.floor((ac.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});ac[n+"s"]=e.range,ac[n+"s"].utc=e.utc.range,ac[n+"OfYear"]=function(n){var e=ac.year(n).getDay();return Math.floor((ac.dayOfYear(n)+(e+t)%7)/7)}}),ac.week=ac.sunday,ac.weeks=ac.sunday.range,ac.weeks.utc=ac.sunday.utc.range,ac.weekOfYear=ac.sundayOfYear;var sc={"-":"",_:" ",0:"0"},fc=/^\s*\d+/,hc=/^%/;ta.locale=function(n){return{numberFormat:Pt(n),timeFormat:Ot(n)}};var gc=ta.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ta.format=gc.numberFormat,ta.geo={},ce.prototype={s:0,t:0,add:function(n){le(n,this.t,pc),le(pc.s,this.s,this),this.s?this.t+=pc.t:this.s=pc.t
4
+ },reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var pc=new ce;ta.geo.stream=function(n,t){n&&vc.hasOwnProperty(n.type)?vc[n.type](n,t):se(n,t)};var vc={Feature:function(n,t){se(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++r<u;)se(e[r].geometry,t)}},dc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){fe(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)fe(e[r],t,0)},Polygon:function(n,t){he(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)he(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,u=e.length;++r<u;)se(e[r],t)}};ta.geo.area=function(n){return mc=0,ta.geo.stream(n,Mc),mc};var mc,yc=new ce,Mc={sphere:function(){mc+=4*qa},point:b,lineStart:b,lineEnd:b,polygonStart:function(){yc.reset(),Mc.lineStart=ge},polygonEnd:function(){var n=2*yc;mc+=0>n?4*qa+n:n,Mc.lineStart=Mc.lineEnd=Mc.point=b}};ta.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=pe([t*Da,e*Da]);if(m){var u=de(m,r),i=[u[1],-u[0],0],o=de(i,u);Me(o),o=xe(o);var c=t-p,l=c>0?1:-1,v=o[0]*Pa*l,d=ga(c)>180;if(d^(v>l*p&&l*t>v)){var y=o[1]*Pa;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>l*p&&l*t>v)){var y=-o[1]*Pa;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=ga(r)>180?r+(r>0?360:-360):r}else v=n,d=e;Mc.point(n,e),t(n,e)}function i(){Mc.lineStart()}function o(){u(v,d),Mc.lineEnd(),ga(y)>Ca&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var s,f,h,g,p,v,d,m,y,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=u,b.lineStart=i,b.lineEnd=o,y=0,Mc.polygonStart()},polygonEnd:function(){Mc.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>yc?(s=-(h=180),f=-(g=90)):y>Ca?g=90:-Ca>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ta.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],l(e[0],u)||l(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,s=e[0],h=u[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ta.geo.centroid=function(n){xc=bc=_c=wc=Sc=kc=Ec=Ac=Nc=Cc=zc=0,ta.geo.stream(n,qc);var t=Nc,e=Cc,r=zc,u=t*t+e*e+r*r;return za>u&&(t=kc,e=Ec,r=Ac,Ca>bc&&(t=_c,e=wc,r=Sc),u=t*t+e*e+r*r,za>u)?[0/0,0/0]:[Math.atan2(e,t)*Pa,tt(r/Math.sqrt(u))*Pa]};var xc,bc,_c,wc,Sc,kc,Ec,Ac,Nc,Cc,zc,qc={sphere:b,point:_e,lineStart:Se,lineEnd:ke,polygonStart:function(){qc.lineStart=Ee},polygonEnd:function(){qc.lineStart=Se}},Lc=Le(Ne,Pe,je,[-qa,-qa/2]),Tc=1e9;ta.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ie(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ta.geo.conicEqualArea=function(){return Ye(Ze)}).raw=Ze,ta.geo.albers=function(){return ta.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ta.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=ta.geo.albers(),o=ta.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ta.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Ca,f+.12*l+Ca],[s-.214*l-Ca,f+.234*l-Ca]]).stream(c).point,u=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Ca,f+.166*l+Ca],[s-.115*l-Ca,f+.234*l-Ca]]).stream(c).point,n},n.scale(1070)};var Rc,Dc,Pc,Uc,jc,Fc,Hc={point:b,lineStart:b,lineEnd:b,polygonStart:function(){Dc=0,Hc.lineStart=Ve},polygonEnd:function(){Hc.lineStart=Hc.lineEnd=Hc.point=b,Rc+=ga(Dc/2)}},Oc={point:Xe,lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Ic={point:We,lineStart:Je,lineEnd:Ge,polygonStart:function(){Ic.lineStart=Ke},polygonEnd:function(){Ic.point=We,Ic.lineStart=Je,Ic.lineEnd=Ge}};ta.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),ta.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return Rc=0,ta.geo.stream(n,u(Hc)),Rc},n.centroid=function(n){return _c=wc=Sc=kc=Ec=Ac=Nc=Cc=zc=0,ta.geo.stream(n,u(Ic)),zc?[Nc/zc,Cc/zc]:Ac?[kc/Ac,Ec/Ac]:Sc?[_c/Sc,wc/Sc]:[0/0,0/0]},n.bounds=function(n){return jc=Fc=-(Pc=Uc=1/0),ta.geo.stream(n,u(Oc)),[[Pc,Uc],[jc,Fc]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||tr(n):y,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new $e:new Qe(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(ta.geo.albersUsa()).context(null)},ta.geo.transform=function(n){return{stream:function(t){var e=new er(t);for(var r in n)e[r]=n[r];return e}}},er.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ta.geo.projection=ur,ta.geo.projectionMutator=ir,(ta.geo.equirectangular=function(){return ur(ar)}).raw=ar.invert=ar,ta.geo.rotation=function(n){function t(t){return t=n(t[0]*Da,t[1]*Da),t[0]*=Pa,t[1]*=Pa,t}return n=lr(n[0]%360*Da,n[1]*Da,n.length>2?n[2]*Da:0),t.invert=function(t){return t=n.invert(t[0]*Da,t[1]*Da),t[0]*=Pa,t[1]*=Pa,t},t},cr.invert=ar,ta.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=lr(-n[0]*Da,-n[1]*Da,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Pa,n[1]*=Pa}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=gr((t=+r)*Da,u*Da),n):t},n.precision=function(r){return arguments.length?(e=gr(t*Da,(u=+r)*Da),n):u},n.angle(90)},ta.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Da,u=n[1]*Da,i=t[1]*Da,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},ta.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ta.range(Math.ceil(i/d)*d,u,d).map(h).concat(ta.range(Math.ceil(l/m)*m,c,m).map(g)).concat(ta.range(Math.ceil(r/p)*p,e,p).filter(function(n){return ga(n%d)>Ca}).map(s)).concat(ta.range(Math.ceil(a/v)*v,o,v).filter(function(n){return ga(n%m)>Ca}).map(f))}var e,r,u,i,o,a,c,l,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=vr(a,o,90),f=dr(r,e,y),h=vr(l,c,90),g=dr(i,u,y),n):y},n.majorExtent([[-180,-90+Ca],[180,90-Ca]]).minorExtent([[-180,-80-Ca],[180,80+Ca]])},ta.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=mr,u=yr;return n.distance=function(){return ta.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},ta.geo.interpolate=function(n,t){return Mr(n[0]*Da,n[1]*Da,t[0]*Da,t[1]*Da)},ta.geo.length=function(n){return Yc=0,ta.geo.stream(n,Zc),Yc};var Yc,Zc={sphere:b,point:b,lineStart:xr,lineEnd:b,polygonStart:b,polygonEnd:b},Vc=br(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ta.geo.azimuthalEqualArea=function(){return ur(Vc)}).raw=Vc;var Xc=br(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},y);(ta.geo.azimuthalEquidistant=function(){return ur(Xc)}).raw=Xc,(ta.geo.conicConformal=function(){return Ye(_r)}).raw=_r,(ta.geo.conicEquidistant=function(){return Ye(wr)}).raw=wr;var $c=br(function(n){return 1/n},Math.atan);(ta.geo.gnomonic=function(){return ur($c)}).raw=$c,Sr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Ra]},(ta.geo.mercator=function(){return kr(Sr)}).raw=Sr;var Bc=br(function(){return 1},Math.asin);(ta.geo.orthographic=function(){return ur(Bc)}).raw=Bc;var Wc=br(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ta.geo.stereographic=function(){return ur(Wc)}).raw=Wc,Er.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Ra]},(ta.geo.transverseMercator=function(){var n=kr(Er),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Er,ta.geom={},ta.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=Et(e),i=Et(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(zr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var l=Cr(a),s=Cr(c),f=s[0]===l[0],h=s[s.length-1]===l[l.length-1],g=[];for(t=l.length-1;t>=0;--t)g.push(n[a[l[t]][2]]);for(t=+f;t<s.length-h;++t)g.push(n[a[s[t]][2]]);return g}var e=Ar,r=Nr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ta.geom.polygon=function(n){return ya(n,Jc),n};var Jc=ta.geom.polygon.prototype=[];Jc.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],u=0;++t<e;)n=r,r=this[t],u+=n[1]*r[0]-n[0]*r[1];return.5*u},Jc.centroid=function(n){var t,e,r=-1,u=this.length,i=0,o=0,a=this[u-1];for(arguments.length||(n=-1/(6*this.area()));++r<u;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],i+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[i*n,o*n]},Jc.clip=function(n){for(var t,e,r,u,i,o,a=Tr(n),c=-1,l=this.length-Tr(this),s=this[l-1];++c<l;){for(t=n.slice(),n.length=0,u=this[c],i=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],qr(o,s,u)?(qr(i,s,u)||n.push(Lr(i,o,s,u)),n.push(o)):qr(i,s,u)&&n.push(Lr(i,o,s,u)),i=o;a&&n.push(n[0]),s=u}return n};var Gc,Kc,Qc,nl,tl,el=[],rl=[];Or.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(Yr),t.length},Qr.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},nu.prototype={insert:function(n,t){var e,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=uu(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(u=r.R,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.R&&(eu(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ru(this,r))):(u=r.L,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.L&&(ru(this,e),n=e,e=n.U),e.C=!1,r.C=!0,eu(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,u=n.U,i=n.L,o=n.R;if(e=i?o?uu(o):i:o,u?u.L===n?u.L=e:u.R=e:this._=e,i&&o?(r=e.C,e.C=n.C,e.L=i,i.U=e,e!==o?(u=e.U,e.U=n.U,n=e.R,u.L=n,e.R=o,o.U=e):(e.U=u,u=e,n=e.R)):(r=n.C,n=e),n&&(n.U=u),!r){if(n&&n.C)return void(n.C=!1);do{if(n===this._)break;if(n===u.L){if(t=u.R,t.C&&(t.C=!1,u.C=!0,eu(this,u),t=u.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,ru(this,t),t=u.R),t.C=u.C,u.C=t.R.C=!1,eu(this,u),n=this._;break}}else if(t=u.L,t.C&&(t.C=!1,u.C=!0,ru(this,u),t=u.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,eu(this,t),t=u.L),t.C=u.C,u.C=t.L.C=!1,ru(this,u),n=this._;break}t.C=!0,n=u,u=u.U}while(!n.C);n&&(n.C=!1)}}},ta.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],u=a[0][1],i=a[1][0],o=a[1][1];return iu(e(n),a).cells.forEach(function(e,a){var c=e.edges,l=e.site,s=t[a]=c.length?c.map(function(n){var t=n.start();return[t.x,t.y]}):l.x>=r&&l.x<=i&&l.y>=u&&l.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];s.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Ca)*Ca,y:Math.round(o(n,t)/Ca)*Ca,i:t}})}var r=Ar,u=Nr,i=r,o=u,a=ul;return n?t(n):(t.links=function(n){return iu(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return iu(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Yr),c=-1,l=a.length,s=a[l-1].edge,f=s.l===o?s.r:s.l;++c<l;)u=s,i=f,s=a[c].edge,f=s.l===o?s.r:s.l,r<i.i&&r<f.i&&au(o,i,f)<0&&t.push([n[r],n[i.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(i=Et(r=n),t):r},t.y=function(n){return arguments.length?(o=Et(u=n),t):u},t.clipExtent=function(n){return arguments.length?(a=null==n?ul:n,t):a===ul?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===ul?null:a&&a[1]},t)};var ul=[[-1e6,-1e6],[1e6,1e6]];ta.geom.delaunay=function(n){return ta.geom.voronoi().triangles(n)},ta.geom.quadtree=function(n,t,e,r,u){function i(n){function i(n,t,e,r,u,i,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(ga(c-e)+ga(s-r)<.01)l(n,t,e,r,u,i,o,a);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,u,i,o,a),l(n,t,e,r,u,i,o,a)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,u,i,o,a)}function l(n,t,e,r,u,o,a,c){var l=.5*(u+a),s=.5*(o+c),f=e>=l,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=su()),f?u=l:a=l,h?o=s:c=s,i(n,t,e,r,u,o,a,c)}var s,f,h,g,p,v,d,m,y,M=Et(a),x=Et(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.x<v&&(v=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=su();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){fu(n,k,v,d,m,y)},k.find=function(n){return hu(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g<p;)i(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=s=null,k}var o,a=Ar,c=Nr;return(o=arguments.length)?(a=cu,c=lu,3===o&&(u=e,r=t,e=t=0),i(n)):(i.x=function(n){return arguments.length?(a=n,i):a},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,e],[r,u]]},i.size=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=e=0,r=+n[0],u=+n[1]),i):null==t?null:[r-t,u-e]},i)},ta.interpolateRgb=gu,ta.interpolateObject=pu,ta.interpolateNumber=vu,ta.interpolateString=du;var il=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ol=new RegExp(il.source,"g");ta.interpolate=mu,ta.interpolators=[function(n,t){var e=typeof t;return("string"===e?Ga.has(t.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(t)?gu:du:t instanceof ot?gu:Array.isArray(t)?yu:"object"===e&&isNaN(t)?pu:vu)(n,t)}],ta.interpolateArray=yu;var al=function(){return y},cl=ta.map({linear:al,poly:ku,quad:function(){return _u},cubic:function(){return wu},sin:function(){return Eu},exp:function(){return Au},circle:function(){return Nu},elastic:Cu,back:zu,bounce:function(){return qu}}),ll=ta.map({"in":y,out:xu,"in-out":bu,"out-in":function(n){return bu(xu(n))}});ta.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=cl.get(e)||al,r=ll.get(r)||y,Mu(r(e.apply(null,ea.call(arguments,1))))},ta.interpolateHcl=Lu,ta.interpolateHsl=Tu,ta.interpolateLab=Ru,ta.interpolateRound=Du,ta.transform=function(n){var t=ua.createElementNS(ta.ns.prefix.svg,"g");return(ta.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Pu(e?e.matrix:sl)})(n)},Pu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var sl={a:1,b:0,c:0,d:1,e:0,f:0};ta.interpolateTransform=Hu,ta.layout={},ta.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Yu(n[e]));return t}},ta.layout.chord=function(){function n(){var n,l,f,h,g,p={},v=[],d=ta.range(i),m=[];for(e=[],r=[],n=0,h=-1;++h<i;){for(l=0,g=-1;++g<i;)l+=u[h][g];v.push(l),m.push(ta.range(i)),n+=l}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(u[t][n],u[t][e])})}),n=(La-s*i)/n,l=0,h=-1;++h<i;){for(f=l,g=-1;++g<i;){var y=d[h],M=m[y][g],x=u[y][M],b=l,_=l+=x*n;p[y+"-"+M]={index:y,subindex:M,startAngle:b,endAngle:_,value:x}}r[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;++h<i;)for(g=h-1;++g<i;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,u,i,o,a,c,l={},s=0;return l.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,e=r=null,l):u},l.padding=function(n){return arguments.length?(s=n,e=r=null,l):s},l.sortGroups=function(n){return arguments.length?(o=n,e=r=null,l):o},l.sortSubgroups=function(n){return arguments.length?(a=n,e=null,l):a},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},ta.layout.force=function(){function n(n){return function(t,e,r,u){if(t.point!==n){var i=t.cx-n.x,o=t.cy-n.y,a=u-e,c=i*i+o*o;if(c>a*a/d){if(p>c){var l=t.charge/c;n.px-=i*l,n.py-=o*l}return!0}if(t.point&&c&&p>c){var l=t.pointCharge/c;n.px-=i*l,n.py-=o*l}}return!t.charge}}function t(n){n.px=ta.event.x,n.py=ta.event.y,a.resume()}var e,r,u,i,o,a={},c=ta.dispatch("start","tick","end"),l=[1,1],s=.9,f=fl,h=hl,g=-30,p=gl,v=.1,d=.64,m=[],M=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,y,x,b=m.length,_=M.length;for(e=0;_>e;++e)a=M[e],f=a.source,h=a.target,y=h.x-f.x,x=h.y-f.y,(p=y*y+x*x)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,y*=p,x*=p,h.x-=y*(d=f.weight/(h.weight+f.weight)),h.y-=x*d,f.x+=y*(d=1-d),f.y+=x*d);if((d=r*v)&&(y=l[0]/2,x=l[1]/2,e=-1,d))for(;++e<b;)a=m[e],a.x+=(y-a.x)*d,a.y+=(x-a.y)*d;if(g)for(Ju(t=ta.geom.quadtree(m),r,o),e=-1;++e<b;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<b;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*s,a.y-=(a.py-(a.py=a.y))*s);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(M=n,a):M},a.size=function(n){return arguments.length?(l=n,a):l},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(s=+n,a):s},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ta.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;s>a;++a){var u=M[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,l=o.length;++a<l;)if(!isNaN(i=o[a][n]))return i;return Math.random()*r}var t,e,r,c=m.length,s=M.length,p=l[0],v=l[1];for(t=0;c>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;s>t;++t)r=M[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;s>t;++t)u[t]=+f.call(this,M[t],t);else for(t=0;s>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;s>t;++t)i[t]=+h.call(this,M[t],t);else for(t=0;s>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=ta.behavior.drag().origin(y).on("dragstart.force",Xu).on("drag.force",t).on("dragend.force",$u)),arguments.length?void this.on("mouseover.force",Bu).on("mouseout.force",Wu).call(e):e},ta.rebind(a,c,"on")};var fl=20,hl=1,gl=1/0;ta.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(l=e.call(n,i,i.depth))&&(c=l.length)){for(var c,l,s;--c>=0;)o.push(s=l[c]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=l}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Qu(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=ei,e=ni,r=ti;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Ku(t,function(n){n.children&&(n.value=0)}),Qu(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ta.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;++l<o;)n(a=i[l],e,c=a.value*r,u),e+=c}}function t(n){var e=n.children,r=0;if(e&&(u=e.length))for(var u,i=-1;++i<u;)r=Math.max(r,t(e[i]));return 1+r}function e(e,i){var o=r.call(this,e,i);return n(o[0],0,u[0],u[1]/t(o[0])),o}var r=ta.layout.hierarchy(),u=[1,1];return e.size=function(n){return arguments.length?(u=n,e):u},Gu(e,r)},ta.layout.pie=function(){function n(o){var a,c=o.length,l=o.map(function(e,r){return+t.call(n,e,r)}),s=+("function"==typeof r?r.apply(this,arguments):r),f=("function"==typeof u?u.apply(this,arguments):u)-s,h=Math.min(Math.abs(f)/c,+("function"==typeof i?i.apply(this,arguments):i)),g=h*(0>f?-1:1),p=(f-c*g)/ta.sum(l),v=ta.range(c),d=[];return null!=e&&v.sort(e===pl?function(n,t){return l[t]-l[n]}:function(n,t){return e(o[n],o[t])}),v.forEach(function(n){d[n]={data:o[n],value:a=l[n],startAngle:s,endAngle:s+=a*p+g,padAngle:h}}),d}var t=Number,e=pl,r=0,u=La,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var pl={};ta.layout.stack=function(){function n(a,c){if(!(h=a.length))return a;var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=ta.permute(l,f),s=ta.permute(s,f);var h,g,p,v,d=r.call(n,s,c),m=l[0].length;for(p=0;m>p;++p)for(u.call(n,l[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,l[g][p],v+=s[g-1][p][1],s[g][p][1]);return a}var t=y,e=ai,r=ci,u=oi,i=ui,o=ii;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:vl.get(t)||ai,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:dl.get(t)||ci,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var vl=ta.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(li),i=n.map(si),o=ta.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],l.push(e)):(c+=i[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ta.range(n.length).reverse()},"default":ai}),dl=ta.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:ci});ta.layout.histogram=function(){function n(n,i){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;++i<g;)o=c[i]=[],o.dx=f[i+1]-(o.x=f[i]),o.y=0;if(g>0)for(i=-1;++i<h;)a=l[i],a>=s[0]&&a<=s[1]&&(o=c[ta.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=pi,u=hi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Et(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return gi(n,t)}:Et(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ta.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Qu(a,function(n){n.r=+s(n.value)}),Qu(a,Mi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;Qu(a,function(n){n.r+=f}),Qu(a,Mi),Qu(a,function(n){n.r-=f})}return _i(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=ta.layout.hierarchy().sort(vi),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Gu(n,e)},ta.layout.tree=function(){function n(n,u){var s=o.call(this,n,u),f=s[0],h=t(f);if(Qu(h,e),h.parent.m=-h.z,Ku(h,r),l)Ku(f,i);else{var g=f,p=f,v=f;Ku(f,function(n){n.x<g.x&&(g=n),n.x>p.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);Ku(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Ni(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],l=u.m,s=i.m,f=o.m,h=c.m;o=Ei(o),u=ki(u),o&&u;)c=ki(c),i=Ei(i),i.a=n,r=o.z+f-u.z-l+a(o._,u._),r>0&&(Ai(Ci(o,n,e),n,r),l+=r,s+=r),f+=o.m,l+=u.m,h+=c.m,s+=i.m;o&&!Ei(i)&&(i.t=o,i.m+=f-s),u&&!ki(c)&&(c.t=u,c.m+=l-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=ta.layout.hierarchy().sort(null).value(null),a=Si,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?i:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:i,n):l?c:null},Gu(n,o)},ta.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],l=0;Qu(c,function(n){var t=n.children;t&&t.length?(n.x=qi(t),n.y=zi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Li(c),f=Ti(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return Qu(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=ta.layout.hierarchy().sort(null).value(null),e=Si,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Gu(n,t)},ta.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++u<i;)r=(e=n[u]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,l=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,v))<=p?(h.pop(),p=a):(s.area-=s.pop().area,u(s,v,l,!1),v=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,l,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++i<o;)u=n[i],u.x=a,u.y=l,u.dy=s,a+=u.dx=Math.min(e.x+e.dx-a,s?c(u.area/s):0);u.z=!0,u.dx+=e.x+e.dx-a,e.y+=s,e.dy-=s}else{for((r||s>e.dx)&&(s=e.dx);++i<o;)u=n[i],u.x=a,u.y=l,u.dx=s,l+=u.dy=Math.min(e.y+e.dy-l,s?c(u.area/s):0);u.z=!1,u.dy+=e.y+e.dy-l,e.x+=s,e.dx-=s}}function i(r){var u=o||a(r),i=u[0];return i.x=0,i.y=0,i.dx=l[0],i.dy=l[1],o&&a.revalue(i),n([i],i.dx*i.dy/i.value),(o?e:t)(i),h&&(o=u),u}var o,a=ta.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Ri,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));
5
+ return i.size=function(n){return arguments.length?(l=n,i):l},i.padding=function(n){function t(t){var e=n.call(i,t,t.depth);return null==e?Ri(t):Di(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Di(t,n)}if(!arguments.length)return s;var r;return f=null==(s=n)?Ri:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,o=null,i):h},i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},Gu(i,a)},ta.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=ta.random.normal.apply(ta,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ta.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ta.scale={};var ml={floor:y,ceil:y};ta.scale.linear=function(){return Ii([0,1],[0,1],mu,!1)};var yl={s:1,g:1,p:1,r:1,e:1};ta.scale.log=function(){return Ji(ta.scale.linear().domain([0,1]),10,!0,[1,10])};var Ml=ta.format(".0e"),xl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ta.scale.pow=function(){return Gi(ta.scale.linear(),1,[0,1])},ta.scale.sqrt=function(){return ta.scale.pow().exponent(.5)},ta.scale.ordinal=function(){return Qi([],{t:"range",a:[[]]})},ta.scale.category10=function(){return ta.scale.ordinal().range(bl)},ta.scale.category20=function(){return ta.scale.ordinal().range(_l)},ta.scale.category20b=function(){return ta.scale.ordinal().range(wl)},ta.scale.category20c=function(){return ta.scale.ordinal().range(Sl)};var bl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(Mt),_l=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(Mt),wl=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(Mt),Sl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(Mt);ta.scale.quantile=function(){return no([],[])},ta.scale.quantize=function(){return to(0,1,[0,1])},ta.scale.threshold=function(){return eo([.5],[0,1])},ta.scale.identity=function(){return ro([0,1])},ta.svg={},ta.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),l=Math.max(0,+r.apply(this,arguments)),s=o.apply(this,arguments)-Ra,f=a.apply(this,arguments)-Ra,h=Math.abs(f-s),g=s>f?0:1;if(n>l&&(p=l,l=n,n=p),h>=Ta)return t(l,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,E=0,A=0,N=[];if((m=(+c.apply(this,arguments)||0)/2)&&(d=i===kl?Math.sqrt(n*n+l*l):+i.apply(this,arguments),g||(A*=-1),l&&(A=tt(d/l*Math.sin(m))),n&&(E=tt(d/n*Math.sin(m)))),l){y=l*Math.cos(s+A),M=l*Math.sin(s+A),x=l*Math.cos(f-A),b=l*Math.sin(f-A);var C=Math.abs(f-s-2*A)<=qa?0:1;if(A&&so(y,M,x,b)===g^C){var z=(s+f)/2;y=l*Math.cos(z),M=l*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-E),w=n*Math.sin(f-E),S=n*Math.cos(s+E),k=n*Math.sin(s+E);var q=Math.abs(s-f+2*E)<=qa?0:1;if(E&&so(_,w,S,k)===1-g^q){var L=(s+f)/2;_=n*Math.cos(L),w=n*Math.sin(L),S=k=null}}else _=w=0;if((p=Math.min(Math.abs(l-n)/2,+u.apply(this,arguments)))>.001){v=l>n^g?0:1;var T=null==S?[_,w]:null==x?[y,M]:Lr([y,M],[S,k],[x,b],[_,w]),R=y-T[0],D=M-T[1],P=x-T[0],U=b-T[1],j=1/Math.sin(Math.acos((R*P+D*U)/(Math.sqrt(R*R+D*D)*Math.sqrt(P*P+U*U)))/2),F=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(null!=x){var H=Math.min(p,(l-F)/(j+1)),O=fo(null==S?[_,w]:[S,k],[y,M],l,H,g),I=fo([x,b],[_,w],l,H,g);p===H?N.push("M",O[0],"A",H,",",H," 0 0,",v," ",O[1],"A",l,",",l," 0 ",1-g^so(O[1][0],O[1][1],I[1][0],I[1][1]),",",g," ",I[1],"A",H,",",H," 0 0,",v," ",I[0]):N.push("M",O[0],"A",H,",",H," 0 1,",v," ",I[0])}else N.push("M",y,",",M);if(null!=S){var Y=Math.min(p,(n-F)/(j-1)),Z=fo([y,M],[S,k],n,-Y,g),V=fo([_,w],null==x?[y,M]:[x,b],n,-Y,g);p===Y?N.push("L",V[0],"A",Y,",",Y," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^so(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",Y,",",Y," 0 0,",v," ",Z[0]):N.push("L",V[0],"A",Y,",",Y," 0 0,",v," ",Z[0])}else N.push("L",_,",",w)}else N.push("M",y,",",M),null!=x&&N.push("A",l,",",l," 0 ",C,",",g," ",x,",",b),N.push("L",_,",",w),null!=S&&N.push("A",n,",",n," 0 ",q,",",1-g," ",S,",",k);return N.push("Z"),N.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=io,r=oo,u=uo,i=kl,o=ao,a=co,c=lo;return n.innerRadius=function(t){return arguments.length?(e=Et(t),n):e},n.outerRadius=function(t){return arguments.length?(r=Et(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=Et(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==kl?kl:Et(t),n):i},n.startAngle=function(t){return arguments.length?(o=Et(t),n):o},n.endAngle=function(t){return arguments.length?(a=Et(t),n):a},n.padAngle=function(t){return arguments.length?(c=Et(t),n):c},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Ra;return[Math.cos(t)*n,Math.sin(t)*n]},n};var kl="auto";ta.svg.line=function(){return ho(y)};var El=ta.map({linear:go,"linear-closed":po,step:vo,"step-before":mo,"step-after":yo,basis:So,"basis-open":ko,"basis-closed":Eo,bundle:Ao,cardinal:bo,"cardinal-open":Mo,"cardinal-closed":xo,monotone:To});El.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var Al=[0,2/3,1/3,0],Nl=[0,1/3,2/3,0],Cl=[0,1/6,2/3,1/6];ta.svg.line.radial=function(){var n=ho(Ro);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},mo.reverse=yo,yo.reverse=mo,ta.svg.area=function(){return Do(y)},ta.svg.area.radial=function(){var n=Do(Ro);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ta.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)-Ra,s=l.call(n,u,r)-Ra;return{r:i,a0:o,a1:s,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>qa)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=mr,o=yr,a=Po,c=ao,l=co;return n.radius=function(t){return arguments.length?(a=Et(t),n):a},n.source=function(t){return arguments.length?(i=Et(t),n):i},n.target=function(t){return arguments.length?(o=Et(t),n):o},n.startAngle=function(t){return arguments.length?(c=Et(t),n):c},n.endAngle=function(t){return arguments.length?(l=Et(t),n):l},n},ta.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=mr,e=yr,r=Uo;return n.source=function(e){return arguments.length?(t=Et(e),n):t},n.target=function(t){return arguments.length?(e=Et(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ta.svg.diagonal.radial=function(){var n=ta.svg.diagonal(),t=Uo,e=n.projection;return n.projection=function(n){return arguments.length?e(jo(t=n)):t},n},ta.svg.symbol=function(){function n(n,r){return(zl.get(t.call(this,n,r))||Oo)(e.call(this,n,r))}var t=Ho,e=Fo;return n.type=function(e){return arguments.length?(t=Et(e),n):t},n.size=function(t){return arguments.length?(e=Et(t),n):e},n};var zl=ta.map({circle:Oo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Ll)),e=t*Ll;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/ql),e=t*ql/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/ql),e=t*ql/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ta.svg.symbolTypes=zl.keys();var ql=Math.sqrt(3),Ll=Math.tan(30*Da);_a.transition=function(n){for(var t,e,r=Tl||++Ul,u=Xo(n),i=[],o=Rl||{time:Date.now(),ease:Su,delay:0,duration:250},a=-1,c=this.length;++a<c;){i.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(e=l[s])&&$o(e,s,u,r,o),t.push(e)}return Yo(i,u,r)},_a.interrupt=function(n){return this.each(null==n?Dl:Io(Xo(n)))};var Tl,Rl,Dl=Io(Xo()),Pl=[],Ul=0;Pl.call=_a.call,Pl.empty=_a.empty,Pl.node=_a.node,Pl.size=_a.size,ta.transition=function(n,t){return n&&n.transition?Tl?n.transition(t):n:ta.selection().transition(n)},ta.transition.prototype=Pl,Pl.select=function(n){var t,e,r,u=this.id,i=this.namespace,o=[];n=N(n);for(var a=-1,c=this.length;++a<c;){o.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(r=l[s])&&(e=n.call(r,r.__data__,s,a))?("__data__"in r&&(e.__data__=r.__data__),$o(e,s,i,u,r[i][u]),t.push(e)):t.push(null)}return Yo(o,i,u)},Pl.selectAll=function(n){var t,e,r,u,i,o=this.id,a=this.namespace,c=[];n=C(n);for(var l=-1,s=this.length;++l<s;)for(var f=this[l],h=-1,g=f.length;++h<g;)if(r=f[h]){i=r[a][o],e=n.call(r,r.__data__,h,l),c.push(t=[]);for(var p=-1,v=e.length;++p<v;)(u=e[p])&&$o(u,p,a,o,i),t.push(u)}return Yo(c,a,o)},Pl.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=O(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Yo(u,this.namespace,this.id)},Pl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):Y(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Pl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Hu:mu,a=ta.ns.qualify(n);return Zo(this,"attr."+n,t,a.local?i:u)},Pl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=ta.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Pl.style=function(n,e,r){function u(){this.style.removeProperty(n)}function i(e){return null==e?u:(e+="",function(){var u,i=t(this).getComputedStyle(this,null).getPropertyValue(n);return i!==e&&(u=mu(i,e),function(t){this.style.setProperty(n,u(t),r)})})}var o=arguments.length;if(3>o){if("string"!=typeof n){2>o&&(e="");for(r in n)this.style(r,n[r],e);return this}r=""}return Zo(this,"style."+n,e,i)},Pl.styleTween=function(n,e,r){function u(u,i){var o=e.call(this,u,i,t(this).getComputedStyle(this,null).getPropertyValue(n));return o&&function(t){this.style.setProperty(n,o(t),r)}}return arguments.length<3&&(r=""),this.tween("style."+n,u)},Pl.text=function(n){return Zo(this,"text",n,Vo)},Pl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Pl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ta.ease.apply(ta,arguments)),Y(this,function(r){r[e][t].ease=n}))},Pl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:Y(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Pl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:Y(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Pl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=Rl,i=Tl;try{Tl=e,Y(this,function(t,u,i){Rl=t[r][e],n.call(t,t.__data__,u,i)})}finally{Rl=u,Tl=i}}else Y(this,function(u){var i=u[r][e];(i.event||(i.event=ta.dispatch("start","end","interrupt"))).on(n,t)});return this},Pl.transition=function(){for(var n,t,e,r,u=this.id,i=++Ul,o=this.namespace,a=[],c=0,l=this.length;l>c;c++){a.push(n=[]);for(var t=this[c],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[o][u],$o(e,s,o,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Yo(a,o,i)},ta.svg.axis=function(){function n(n){n.each(function(){var n,l=ta.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):y:t,p=l.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ca),d=ta.transition(p.exit()).style("opacity",Ca).remove(),m=ta.transition(p.order()).style("opacity",1),M=Math.max(u,0)+o,x=Ui(f),b=l.selectAll(".domain").data([0]),_=(b.enter().append("path").attr("class","domain"),ta.transition(b));v.append("line"),v.append("text");var w,S,k,E,A=v.select("line"),N=m.select("line"),C=p.select("text").text(g),z=v.select("text"),q=m.select("text"),L="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=Bo,w="x",k="y",S="x2",E="y2",C.attr("dy",0>L?"0em":".71em").style("text-anchor","middle"),_.attr("d","M"+x[0]+","+L*i+"V0H"+x[1]+"V"+L*i)):(n=Wo,w="y",k="x",S="y2",E="x2",C.attr("dy",".32em").style("text-anchor",0>L?"end":"start"),_.attr("d","M"+L*i+","+x[0]+"H0V"+x[1]+"H"+L*i)),A.attr(E,L*u),z.attr(k,L*M),N.attr(S,0).attr(E,L*u),q.attr(w,0).attr(k,L*M),f.rangeBand){var T=f,R=T.rangeBand()/2;s=f=function(n){return T(n)+R}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=ta.scale.linear(),r=jl,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Fl?t+"":jl,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var jl="bottom",Fl={top:1,right:1,bottom:1,left:1};ta.svg.brush=function(){function n(t){t.each(function(){var t=ta.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),o=t.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=t.selectAll(".resize").data(v,y);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Hl[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var c,f=ta.transition(t),h=ta.transition(o);l&&(c=Ui(l),h.attr("x",c[0]).attr("width",c[1]-c[0]),r(f)),s&&(c=Ui(s),h.attr("y",c[0]).attr("height",c[1]-c[0]),u(f)),e(f)})}function e(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+f[+/e$/.test(n)]+","+h[+/^s/.test(n)]+")"})}function r(n){n.select(".extent").attr("x",f[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1]-f[0])}function u(n){n.select(".extent").attr("y",h[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==ta.event.keyCode&&(C||(M=null,q[0]-=f[1],q[1]-=h[1],C=2),S())}function v(){32==ta.event.keyCode&&2==C&&(q[0]+=f[1],q[1]+=h[1],C=0,S())}function d(){var n=ta.mouse(b),t=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(ta.event.altKey?(M||(M=[(f[0]+f[1])/2,(h[0]+h[1])/2]),q[0]=f[+(n[0]<M[0])],q[1]=h[+(n[1]<M[1])]):M=null),A&&m(n,l,0)&&(r(k),t=!0),N&&m(n,s,1)&&(u(k),t=!0),t&&(e(k),w({type:"brush",mode:C?"move":"resize"}))}function m(n,t,e){var r,u,i=Ui(t),c=i[0],l=i[1],s=q[e],v=e?h:f,d=v[1]-v[0];return C&&(c-=s,l-=d+s),r=(e?p:g)?Math.max(c,Math.min(l,n[e])):n[e],C?u=(r+=s)+d:(M&&(s=Math.max(c,Math.min(l,2*M[e]-r))),r>s?(u=r,r=s):u=s),v[0]!=r||v[1]!=u?(e?a=null:o=null,v[0]=r,v[1]=u,!0):void 0}function y(){d(),k.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ta.select("body").style("cursor",null),L.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),z(),w({type:"brushend"})}var M,x,b=this,_=ta.select(ta.event.target),w=c.of(b,arguments),k=ta.select(b),E=_.datum(),A=!/^(n|s)$/.test(E)&&l,N=!/^(e|w)$/.test(E)&&s,C=_.classed("extent"),z=W(b),q=ta.mouse(b),L=ta.select(t(b)).on("keydown.brush",i).on("keyup.brush",v);if(ta.event.changedTouches?L.on("touchmove.brush",d).on("touchend.brush",y):L.on("mousemove.brush",d).on("mouseup.brush",y),k.interrupt().selectAll("*").interrupt(),C)q[0]=f[0]-q[0],q[1]=h[0]-q[1];else if(E){var T=+/w$/.test(E),R=+/^n/.test(E);x=[f[1-T]-q[0],h[1-R]-q[1]],q[0]=f[T],q[1]=h[R]}else ta.event.altKey&&(M=q.slice());k.style("pointer-events","none").selectAll(".resize").style("display",null),ta.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),d()}var o,a,c=E(n,"brushstart","brush","brushend"),l=null,s=null,f=[0,0],h=[0,0],g=!0,p=!0,v=Ol[0];return n.event=function(n){n.each(function(){var n=c.of(this,arguments),t={x:f,y:h,i:o,j:a},e=this.__chart__||t;this.__chart__=t,Tl?ta.select(this).transition().each("start.brush",function(){o=e.i,a=e.j,f=e.x,h=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=yu(f,t.x),r=yu(h,t.y);return o=a=null,function(u){f=t.x=e(u),h=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=t.i,a=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(l=t,v=Ol[!l<<1|!s],n):l},n.y=function(t){return arguments.length?(s=t,v=Ol[!l<<1|!s],n):s},n.clamp=function(t){return arguments.length?(l&&s?(g=!!t[0],p=!!t[1]):l?g=!!t:s&&(p=!!t),n):l&&s?[g,p]:l?g:s?p:null},n.extent=function(t){var e,r,u,i,c;return arguments.length?(l&&(e=t[0],r=t[1],s&&(e=e[0],r=r[0]),o=[e,r],l.invert&&(e=l(e),r=l(r)),e>r&&(c=e,e=r,r=c),(e!=f[0]||r!=f[1])&&(f=[e,r])),s&&(u=t[0],i=t[1],l&&(u=u[1],i=i[1]),a=[u,i],s.invert&&(u=s(u),i=s(i)),u>i&&(c=u,u=i,i=c),(u!=h[0]||i!=h[1])&&(h=[u,i])),n):(l&&(o?(e=o[0],r=o[1]):(e=f[0],r=f[1],l.invert&&(e=l.invert(e),r=l.invert(r)),e>r&&(c=e,e=r,r=c))),s&&(a?(u=a[0],i=a[1]):(u=h[0],i=h[1],s.invert&&(u=s.invert(u),i=s.invert(i)),u>i&&(c=u,u=i,i=c))),l&&s?[[e,u],[r,i]]:l?[e,r]:s&&[u,i])},n.clear=function(){return n.empty()||(f=[0,0],h=[0,0],o=a=null),n},n.empty=function(){return!!l&&f[0]==f[1]||!!s&&h[0]==h[1]},ta.rebind(n,c,"on")};var Hl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ol=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Il=ac.format=gc.timeFormat,Yl=Il.utc,Zl=Yl("%Y-%m-%dT%H:%M:%S.%LZ");Il.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:Zl,Jo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Jo.toString=Zl.toString,ac.second=Ft(function(n){return new cc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),ac.seconds=ac.second.range,ac.seconds.utc=ac.second.utc.range,ac.minute=Ft(function(n){return new cc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),ac.minutes=ac.minute.range,ac.minutes.utc=ac.minute.utc.range,ac.hour=Ft(function(n){var t=n.getTimezoneOffset()/60;return new cc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),ac.hours=ac.hour.range,ac.hours.utc=ac.hour.utc.range,ac.month=Ft(function(n){return n=ac.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),ac.months=ac.month.range,ac.months.utc=ac.month.utc.range;var Vl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Xl=[[ac.second,1],[ac.second,5],[ac.second,15],[ac.second,30],[ac.minute,1],[ac.minute,5],[ac.minute,15],[ac.minute,30],[ac.hour,1],[ac.hour,3],[ac.hour,6],[ac.hour,12],[ac.day,1],[ac.day,2],[ac.week,1],[ac.month,1],[ac.month,3],[ac.year,1]],$l=Il.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ne]]),Bl={range:function(n,t,e){return ta.range(Math.ceil(n/e)*e,+t,e).map(Ko)},floor:y,ceil:y};Xl.year=ac.year,ac.scale=function(){return Go(ta.scale.linear(),Xl,$l)};var Wl=Xl.map(function(n){return[n[0].utc,n[1]]}),Jl=Yl.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ne]]);Wl.year=ac.year.utc,ac.scale.utc=function(){return Go(ta.scale.linear(),Wl,Jl)},ta.text=At(function(n){return n.responseText}),ta.json=function(n,t){return Nt(n,"application/json",Qo,t)},ta.html=function(n,t){return Nt(n,"text/html",na,t)},ta.xml=At(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(ta):"object"==typeof module&&module.exports&&(module.exports=ta),this.d3=ta}();
inc/js/d3.v3.min.js DELETED
@@ -1,5 +0,0 @@
1
- !function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null===n?0/0:+n}function e(n){return!isNaN(n)}function r(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)<0?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n(t[i],e)>0?u=i:r=i+1}return r}}}function u(n){return n.length}function i(n){for(var t=1;n*t%1;)t*=10;return t}function o(n,t){for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}function a(){this._=Object.create(null)}function c(n){return(n+="")===da||n[0]===ma?ma+n:n}function l(n){return(n+="")[0]===ma?n.slice(1):n}function s(n){return c(n)in this._}function f(n){return(n=c(n))in this._&&delete this._[n]}function h(){var n=[];for(var t in this._)n.push(l(t));return n}function g(){var n=0;for(var t in this._)++n;return n}function p(){for(var n in this._)return!1;return!0}function v(){this._=Object.create(null)}function d(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function m(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e=0,r=ya.length;r>e;++e){var u=ya[e]+t;if(u in n)return u}}function y(){}function M(){}function x(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new a;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function b(){ta.event.preventDefault()}function _(){for(var n,t=ta.event;n=t.sourceEvent;)t=n;return t}function w(n){for(var t=new M,e=0,r=arguments.length;++e<r;)t[arguments[e]]=x(t);return t.of=function(e,r){return function(u){try{var i=u.sourceEvent=ta.event;u.target=n,ta.event=u,t[u.type].apply(e,r)}finally{ta.event=i}}},t}function S(n){return xa(n,ka),n}function k(n){return"function"==typeof n?n:function(){return ba(n,this)}}function E(n){return"function"==typeof n?n:function(){return _a(n,this)}}function A(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=ta.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?i:u}function N(n){return n.trim().replace(/\s+/g," ")}function C(n){return new RegExp("(?:^|\\s+)"+ta.requote(n)+"(?:\\s+|$)","g")}function z(n){return(n+"").trim().split(/^|\s+/)}function q(n,t){function e(){for(var e=-1;++e<u;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<u;)n[e](this,r)}n=z(n).map(L);var u=n.length;return"function"==typeof t?r:e}function L(n){var t=C(n);return function(e,r){if(u=e.classList)return r?u.add(n):u.remove(n);var u=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||e.setAttribute("class",N(u+" "+n))):e.setAttribute("class",N(u.replace(t," ")))}}function T(n,t,e){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,e)}function i(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?i:u}function R(n,t){function e(){delete this[n]}function r(){this[n]=t}function u(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?u:r}function D(n){return"function"==typeof n?n:(n=ta.ns.qualify(n)).local?function(){return this.ownerDocument.createElementNS(n.space,n.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,n)}}function P(){var n=this.parentNode;n&&n.removeChild(this)}function U(n){return{__data__:n}}function j(n){return function(){return Sa(this,n)}}function F(t){return arguments.length||(t=n),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function H(n,t){for(var e=0,r=n.length;r>e;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function O(n){return xa(n,Aa),n}function Y(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t<c;);return o}}function I(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function u(){var u=c(t,ra(arguments));r.call(this),this.addEventListener(n,this[o]=u,u.$=e),u._=t}function i(){var t,e=new RegExp("^__on([^.]+)"+ta.requote(n)+"$");for(var r in this)if(t=r.match(e)){var u=this[r];this.removeEventListener(t[1],u,u.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=Z;a>0&&(n=n.slice(0,a));var l=Ca.get(n);return l&&(n=l,c=V),a?t?u:r:t?y:i}function Z(n,t){return function(e){var r=ta.event;ta.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{ta.event=r}}}function V(n,t){var e=Z(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function X(){var n=".dragsuppress-"+ ++qa,t="click"+n,e=ta.select(oa).on("touchmove"+n,b).on("dragstart"+n,b).on("selectstart"+n,b);if(za){var r=ia.style,u=r[za];r[za]="none"}return function(i){if(e.on(n,null),za&&(r[za]=u),i){var o=function(){e.on(t,null)};e.on(t,function(){b(),o()},!0),setTimeout(o,0)}}}function $(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>La&&(oa.scrollX||oa.scrollY)){e=ta.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();La=!(u.f||u.e),e.remove()}return La?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function B(){return ta.event.changedTouches[0].identifier}function W(){return ta.event.target}function J(){return oa}function G(n){return n>0?1:0>n?-1:0}function K(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function Q(n){return n>1?0:-1>n?Da:Math.acos(n)}function nt(n){return n>1?ja:-1>n?-ja:Math.asin(n)}function tt(n){return((n=Math.exp(n))-1/n)/2}function et(n){return((n=Math.exp(n))+1/n)/2}function rt(n){return((n=Math.exp(2*n))-1)/(n+1)}function ut(n){return(n=Math.sin(n/2))*n}function it(){}function ot(n,t,e){return this instanceof ot?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof ot?new ot(n.h,n.s,n.l):xt(""+n,bt,ot):new ot(n,t,e)}function at(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,new dt(u(n+120),u(n),u(n-120))}function ct(n,t,e){return this instanceof ct?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof ct?new ct(n.h,n.c,n.l):n instanceof st?ht(n.l,n.a,n.b):ht((n=_t((n=ta.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new ct(n,t,e)}function lt(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new st(e,Math.cos(n*=Fa)*t,Math.sin(n)*t)}function st(n,t,e){return this instanceof st?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof st?new st(n.l,n.a,n.b):n instanceof ct?lt(n.h,n.c,n.l):_t((n=dt(n)).r,n.g,n.b):new st(n,t,e)}function ft(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=gt(u)*Ja,r=gt(r)*Ga,i=gt(i)*Ka,new dt(vt(3.2404542*u-1.5371385*r-.4985314*i),vt(-.969266*u+1.8760108*r+.041556*i),vt(.0556434*u-.2040259*r+1.0572252*i))}function ht(n,t,e){return n>0?new ct(Math.atan2(e,t)*Ha,Math.sqrt(t*t+e*e),n):new ct(0/0,0/0,n)}function gt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function pt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function vt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function dt(n,t,e){return this instanceof dt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof dt?new dt(n.r,n.g,n.b):xt(""+n,dt,at):new dt(n,t,e)}function mt(n){return new dt(n>>16,255&n>>8,255&n)}function yt(n){return mt(n)+""}function Mt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function xt(n,t,e){var r,u,i,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(u=r[2].split(","),r[1]){case"hsl":return e(parseFloat(u[0]),parseFloat(u[1])/100,parseFloat(u[2])/100);case"rgb":return t(St(u[0]),St(u[1]),St(u[2]))}return(i=tc.get(n))?t(i.r,i.g,i.b):(null==n||"#"!==n.charAt(0)||isNaN(i=parseInt(n.slice(1),16))||(4===n.length?(o=(3840&i)>>4,o=o>>4|o,a=240&i,a=a>>4|a,c=15&i,c=c<<4|c):7===n.length&&(o=(16711680&i)>>16,a=(65280&i)>>8,c=255&i)),t(o,a,c))}function bt(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),new ot(r,u,c)}function _t(n,t,e){n=wt(n),t=wt(t),e=wt(e);var r=pt((.4124564*n+.3575761*t+.1804375*e)/Ja),u=pt((.2126729*n+.7151522*t+.072175*e)/Ga),i=pt((.0193339*n+.119192*t+.9503041*e)/Ka);return st(116*u-16,500*(r-u),200*(u-i))}function wt(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function St(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function kt(n){return"function"==typeof n?n:function(){return n}}function Et(n){return n}function At(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Nt(t,e,n,r)}}function Nt(n,t,e,r){function u(){var n,t=c.status;if(!t&&zt(c)||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=ta.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!oa.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=ta.event;ta.event=n;try{o.progress.call(i,c)}finally{ta.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(l=n,i):l},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(ra(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var s in a)c.setRequestHeader(s,a[s]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},ta.rebind(i,o,"on"),null==r?i:i.get(Ct(r))}function Ct(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function zt(n){var t=n.responseType;return t&&"text"!==t?n.response:n.responseText}function qt(){var n=Lt(),t=Tt()-n;t>24?(isFinite(t)&&(clearTimeout(ic),ic=setTimeout(qt,t)),uc=0):(uc=1,ac(qt))}function Lt(){var n=Date.now();for(oc=ec;oc;)n>=oc.t&&(oc.f=oc.c(n-oc.t)),oc=oc.n;return n}function Tt(){for(var n,t=ec,e=1/0;t;)t.f?t=n?n.n=t.n:ec=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return rc=n,e}function Rt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Dt(n,t){var e=Math.pow(10,3*va(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Pt(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r&&e?function(n,t){for(var u=n.length,i=[],o=0,a=r[0],c=0;u>0&&a>0&&(c+a+1>t&&(a=Math.max(1,t-c)),i.push(n.substring(u-=a,u+a)),!((c+=a+1)>t));)a=r[o=(o+1)%r.length];return i.reverse().join(e)}:Et;return function(n){var e=lc.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"-",c=e[4]||"",l=e[5],s=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1,y=!0;switch(h&&(h=+h.substring(1)),(l||"0"===r&&"="===o)&&(l=r="0",o="="),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":y=!1;case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=sc.get(g)||Ut;var M=l&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):"-"===a?"":a;if(0>p){var c=ta.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x,b,_=n.lastIndexOf(".");if(0>_){var w=y?n.lastIndexOf("e"):-1;0>w?(x=n,b=""):(x=n.substring(0,w),b=n.substring(w))}else x=n.substring(0,_),b=t+n.substring(_+1);!l&&f&&(x=i(x,1/0));var S=v.length+x.length+b.length+(M?0:u.length),k=s>S?new Array(S=s-S+1).join(r):"";return M&&(x=i(k+x,k.length?s-b.length:1/0)),u+=v,n=x+b,("<"===o?u+n+k:">"===o?k+u+n:"^"===o?k.substring(0,S>>=1)+u+n+k.substring(S):u+(M?n:k+n))+e}}}function Ut(n){return n+""}function jt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ft(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new hc(e-1)),1),e}function i(n,e){return t(n=new hc(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{hc=jt;var r=new jt;return r._=n,o(r,t,e)}finally{hc=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Ht(n);return c.floor=c,c.round=Ht(r),c.ceil=Ht(u),c.offset=Ht(i),c.range=a,n}function Ht(n){return function(t,e){try{hc=jt;var r=new jt;return r._=t,n(r,e)._}finally{hc=Date}}}function Ot(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.slice(c,a)),null!=(u=pc[e=n.charAt(++a)])&&(e=n.charAt(++a)),(i=N[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),o.push(e),c=a+1);return o.push(n.slice(c,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},u=e(r,n,t,0);if(u!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var i=null!=r.Z&&hc!==jt,o=new(i?jt:hc);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+(0|r.Z/100),r.M+r.Z%100,r.S,r.L),i?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var u,i,o,a=0,c=t.length,l=e.length;c>a;){if(r>=l)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=C[o in pc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.slice(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){x.lastIndex=0;var r=x.exec(t.slice(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.slice(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.slice(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,N.c.toString(),t,r)}function c(n,t,r){return e(n,N.x.toString(),t,r)}function l(n,t,r){return e(n,N.X.toString(),t,r)}function s(n,t,e){var r=M.get(t.slice(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{hc=jt;var t=new hc;return t._=n,r(t)}finally{hc=Date}}var r=t(n);return e.parse=function(n){try{hc=jt;var t=r.parse(n);return t&&t._}finally{hc=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ae;var M=ta.map(),x=It(v),b=Zt(v),_=It(d),w=Zt(d),S=It(m),k=Zt(m),E=It(y),A=Zt(y);p.forEach(function(n,t){M.set(n.toLowerCase(),t)});var N={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return Yt(n.getDate(),t,2)},e:function(n,t){return Yt(n.getDate(),t,2)},H:function(n,t){return Yt(n.getHours(),t,2)},I:function(n,t){return Yt(n.getHours()%12||12,t,2)},j:function(n,t){return Yt(1+fc.dayOfYear(n),t,3)},L:function(n,t){return Yt(n.getMilliseconds(),t,3)},m:function(n,t){return Yt(n.getMonth()+1,t,2)},M:function(n,t){return Yt(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return Yt(n.getSeconds(),t,2)},U:function(n,t){return Yt(fc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Yt(fc.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return Yt(n.getFullYear()%100,t,2)},Y:function(n,t){return Yt(n.getFullYear()%1e4,t,4)},Z:ie,"%":function(){return"%"}},C={a:r,A:u,b:i,B:o,c:a,d:Qt,e:Qt,H:te,I:te,j:ne,L:ue,m:Kt,M:ee,p:s,S:re,U:Xt,w:Vt,W:$t,x:c,X:l,y:Wt,Y:Bt,Z:Jt,"%":oe};return t}function Yt(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function It(n){return new RegExp("^(?:"+n.map(ta.requote).join("|")+")","i")}function Zt(n){for(var t=new a,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Vt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Xt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e));return r?(n.U=+r[0],e+r[0].length):-1}function $t(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e));return r?(n.W=+r[0],e+r[0].length):-1}function Bt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Wt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.y=Gt(+r[0]),e+r[0].length):-1}function Jt(n,t,e){return/^[+-]\d{4}$/.test(t=t.slice(e,e+5))?(n.Z=-t,e+5):-1}function Gt(n){return n+(n>68?1900:2e3)}function Kt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Qt(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function ne(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function te(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function ee(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function re(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ue(n,t,e){vc.lastIndex=0;var r=vc.exec(t.slice(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ie(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=0|va(t)/60,u=va(t)%60;return e+Yt(r,"0",2)+Yt(u,"0",2)}function oe(n,t,e){dc.lastIndex=0;var r=dc.exec(t.slice(e,e+1));return r?e+r[0].length:-1}function ae(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function ce(){}function le(n,t,e){var r=e.s=n+t,u=r-n,i=r-u;e.t=n-i+(t-u)}function se(n,t){n&&xc.hasOwnProperty(n.type)&&xc[n.type](n,t)}function fe(n,t,e){var r,u=-1,i=n.length-e;for(t.lineStart();++u<i;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function he(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)fe(n[e],t,1);t.polygonEnd()}function ge(){function n(n,t){n*=Fa,t=t*Fa/2+Da/4;var e=n-r,o=e>=0?1:-1,a=o*e,c=Math.cos(t),l=Math.sin(t),s=i*l,f=u*c+s*Math.cos(a),h=s*o*Math.sin(a);_c.add(Math.atan2(h,f)),r=n,u=c,i=l}var t,e,r,u,i;wc.point=function(o,a){wc.point=n,r=(t=o)*Fa,u=Math.cos(a=(e=a)*Fa/2+Da/4),i=Math.sin(a)},wc.lineEnd=function(){n(t,e)}}function pe(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function ve(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function de(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function me(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function ye(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Me(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function xe(n){return[Math.atan2(n[1],n[0]),nt(n[2])]}function be(n,t){return va(n[0]-t[0])<Ta&&va(n[1]-t[1])<Ta}function _e(n,t){n*=Fa;var e=Math.cos(t*=Fa);we(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function we(n,t,e){++Sc,Ec+=(n-Ec)/Sc,Ac+=(t-Ac)/Sc,Nc+=(e-Nc)/Sc}function Se(){function n(n,u){n*=Fa;var i=Math.cos(u*=Fa),o=i*Math.cos(n),a=i*Math.sin(n),c=Math.sin(u),l=Math.atan2(Math.sqrt((l=e*c-r*a)*l+(l=r*o-t*c)*l+(l=t*a-e*o)*l),t*o+e*a+r*c);kc+=l,Cc+=l*(t+(t=o)),zc+=l*(e+(e=a)),qc+=l*(r+(r=c)),we(t,e,r)}var t,e,r;Dc.point=function(u,i){u*=Fa;var o=Math.cos(i*=Fa);t=o*Math.cos(u),e=o*Math.sin(u),r=Math.sin(i),Dc.point=n,we(t,e,r)}}function ke(){Dc.point=_e}function Ee(){function n(n,t){n*=Fa;var e=Math.cos(t*=Fa),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),l=u*c-i*a,s=i*o-r*c,f=r*a-u*o,h=Math.sqrt(l*l+s*s+f*f),g=r*o+u*a+i*c,p=h&&-Q(g)/h,v=Math.atan2(h,g);Lc+=p*l,Tc+=p*s,Rc+=p*f,kc+=v,Cc+=v*(r+(r=o)),zc+=v*(u+(u=a)),qc+=v*(i+(i=c)),we(r,u,i)}var t,e,r,u,i;Dc.point=function(o,a){t=o,e=a,Dc.point=n,o*=Fa;var c=Math.cos(a*=Fa);r=c*Math.cos(o),u=c*Math.sin(o),i=Math.sin(a),we(r,u,i)},Dc.lineEnd=function(){n(t,e),Dc.lineEnd=ke,Dc.point=_e}}function Ae(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function Ne(){return!0}function Ce(n,t,e,r,u){var i=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(be(e,r)){u.lineStart();for(var a=0;t>a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new qe(e,n,null,!0),l=new qe(e,null,c,!1);c.o=l,i.push(c),o.push(l),c=new qe(r,n,null,!1),l=new qe(r,null,c,!0),c.o=l,i.push(c),o.push(l)}}),o.sort(t),ze(i),ze(o),i.length){for(var a=0,c=e,l=o.length;l>a;++a)o[a].e=c=!c;for(var s,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;s=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,l=s.length;l>a;++a)u.point((f=s[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){s=g.p.z;for(var a=s.length-1;a>=0;--a)u.point((f=s[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,s=g.z,p=!p}while(!g.v);u.lineEnd()}}}function ze(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r<t;)u.n=e=n[r],e.p=u,u=e;u.n=e=n[0],e.p=u}}function qe(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Le(n,t,e,r){return function(u,i){function o(t,e){var r=u(t,e);n(t=r[0],e=r[1])&&i.point(t,e)}function a(n,t){var e=u(n,t);d.point(e[0],e[1])}function c(){y.point=a,d.lineStart()}function l(){y.point=o,d.lineEnd()}function s(n,t){v.push([n,t]);var e=u(n,t);x.point(e[0],e[1])}function f(){x.lineStart(),v=[]}function h(){s(v[0][0],v[0][1]),x.lineEnd();var n,t=x.clean(),e=M.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r)if(1&t){n=e[0];var u,r=n.length-1,o=-1;if(r>0){for(b||(i.polygonStart(),b=!0),i.lineStart();++o<r;)i.point((u=n[o])[0],u[1]);i.lineEnd()}}else r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Te))}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:l,polygonStart:function(){y.point=s,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=l,g=ta.merge(g);var n=Fe(m,p);g.length?(b||(i.polygonStart(),b=!0),Ce(g,De,n,e,i)):n&&(b||(i.polygonStart(),b=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),b&&(i.polygonEnd(),b=!1),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},M=Re(),x=t(M),b=!1;return y}}function Te(n){return n.length>1}function Re(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:y,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function De(n,t){return((n=n.x)[0]<0?n[1]-ja-Ta:ja-n[1])-((t=t.x)[0]<0?t[1]-ja-Ta:ja-t[1])}function Pe(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?Da:-Da,c=va(i-e);va(c-Da)<Ta?(n.point(e,r=(r+o)/2>0?ja:-ja),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=Da&&(va(e-u)<Ta&&(e-=u*Ta),va(i-a)<Ta&&(i-=a*Ta),r=Ue(e,r,i,o),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=i,r=o),u=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function Ue(n,t,e,r){var u,i,o=Math.sin(n-e);return va(o)>Ta?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function je(n,t,e,r){var u;if(null==n)u=e*ja,r.point(-Da,u),r.point(0,u),r.point(Da,u),r.point(Da,0),r.point(Da,-u),r.point(0,-u),r.point(-Da,-u),r.point(-Da,0),r.point(-Da,u);else if(va(n[0]-t[0])>Ta){var i=n[0]<t[0]?Da:-Da;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(t[0],t[1])}function Fe(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;_c.reset();for(var a=0,c=t.length;c>a;++a){var l=t[a],s=l.length;if(s)for(var f=l[0],h=f[0],g=f[1]/2+Da/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===s&&(d=0),n=l[d];var m=n[0],y=n[1]/2+Da/4,M=Math.sin(y),x=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>Da,k=p*M;if(_c.add(Math.atan2(k*_*Math.sin(w),v*x+k*Math.cos(w))),i+=S?b+_*Pa:b,S^h>=e^m>=e){var E=de(pe(f),pe(n));Me(E);var A=de(u,E);Me(A);var N=(S^b>=0?-1:1)*nt(A[2]);(r>N||r===N&&(E[0]||E[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=M,v=x,f=n}}return(-Ta>i||Ta>i&&0>_c)^1&o}function He(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,l,s;return{lineStart:function(){l=c=!1,s=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?Da:-Da),h):0;if(!e&&(l=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(be(e,g)||be(p,g))&&(p[0]+=Ta,p[1]+=Ta,v=t(p[0],p[1]))),v!==c)s=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(s=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&be(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return s|(l&&c)<<1}}}function r(n,t,e){var r=pe(n),u=pe(t),o=[1,0,0],a=de(r,u),c=ve(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=i*c/s,h=-i*l/s,g=de(o,a),p=ye(o,f),v=ye(a,h);me(p,v);var d=g,m=ve(p,d),y=ve(d,d),M=m*m-y*(ve(p,p)-1);if(!(0>M)){var x=Math.sqrt(M),b=ye(d,(-m-x)/y);if(me(b,p),b=xe(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(_=w,w=S,S=_);var A=S-w,N=va(A-Da)<Ta,C=N||Ta>A;if(!N&&k>E&&(_=k,k=E,E=_),C?N?k+E>0^b[1]<(va(b[0]-w)<Ta?k:E):k<=b[1]&&b[1]<=E:A>Da^(w<=b[0]&&b[0]<=S)){var z=ye(d,(-m+x)/y);return me(z,p),[b,xe(z)]}}}function u(t,e){var r=o?n:Da-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=va(i)>Ta,c=gr(n,6*Fa);return Le(t,e,c,o?[0,-n]:[-Da,n-Da])}function Oe(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,l=o.y,s=a.x,f=a.y,h=0,g=1,p=s-c,v=f-l;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-l,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-l,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:l+h*v}),1>g&&(u.b={x:c+g*p,y:l+g*v}),u}}}}}}function Ye(n,t,e,r){function u(r,u){return va(r[0]-n)<Ta?u>0?0:3:va(r[0]-e)<Ta?u>0?2:1:va(r[1]-t)<Ta?u>0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,l=a[0];c>o;++o)i=a[o],l[1]<=r?i[1]>r&&K(l,i,n)>0&&++t:i[1]<=r&&K(l,i,n)<0&&--t,l=i;return 0!==t}function l(i,a,c,l){var s=0,f=0;if(null==i||(s=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function s(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){s(n,t)&&a.point(n,t)}function h(){C.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,M),x&&w&&A.rejoin(),v.push(A.buffer())),C.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Uc,Math.min(Uc,n)),t=Math.max(-Uc,Math.min(Uc,t));var e=s(n,t);if(d&&m.push([n,t]),S)y=n,M=t,x=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};N(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,M,x,b,_,w,S,k,E=a,A=Re(),N=Oe(n,t,e,r),C={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=ta.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),l(null,null,1,a),a.lineEnd()),u&&Ce(v,i,t,l,a),a.polygonEnd()),v=d=m=null}};return C}}function Ie(n){var t=0,e=Da/3,r=ir(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*Da/180,e=n[1]*Da/180):[180*(t/Da),180*(e/Da)]},u}function Ze(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,nt((i-(n*n+e*e)*u*u)/(2*u))]},e}function Ve(){function n(n,t){Fc+=u*n-r*t,r=n,u=t}var t,e,r,u;Zc.point=function(i,o){Zc.point=n,t=r=i,e=u=o},Zc.lineEnd=function(){n(t,e)}}function Xe(n,t){Hc>n&&(Hc=n),n>Yc&&(Yc=n),Oc>t&&(Oc=t),t>Ic&&(Ic=t)}function $e(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=Be(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=Be(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Be(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function We(n,t){Ec+=n,Ac+=t,++Nc}function Je(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);Cc+=o*(t+n)/2,zc+=o*(e+r)/2,qc+=o,We(t=n,e=r)}var t,e;Xc.point=function(r,u){Xc.point=n,We(t=r,e=u)}}function Ge(){Xc.point=We}function Ke(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);Cc+=o*(r+n)/2,zc+=o*(u+t)/2,qc+=o,o=u*n-r*t,Lc+=o*(r+n),Tc+=o*(u+t),Rc+=3*o,We(r=n,u=t)}var t,e,r,u;Xc.point=function(i,o){Xc.point=n,We(t=r=i,e=u=o)},Xc.lineEnd=function(){n(t,e)}}function Qe(n){function t(t,e){n.moveTo(t+o,e),n.arc(t,e,o,0,Pa)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:y};return a}function nr(n){function t(n){return(a?r:e)(n)}function e(t){return rr(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){M=0/0,S.point=i,t.lineStart()}function i(e,r){var i=pe([e,r]),o=n(e,r);u(M,x,y,b,_,w,M=o[0],x=o[1],y=e,b=i[0],_=i[1],w=i[2],a,t),t.point(M,x)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=l,S.lineEnd=s}function l(n,t){i(f=n,h=t),g=M,p=x,v=b,d=_,m=w,S.point=i}function s(){u(M,x,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,M,x,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,l,s,f,h,g,p,v,d,m){var y=s-t,M=f-e,x=y*y+M*M;if(x>4*i&&d--){var b=a+g,_=c+p,w=l+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),E=va(va(w)-1)<Ta||va(r-h)<Ta?(r+h)/2:Math.atan2(_,b),A=n(E,k),N=A[0],C=A[1],z=N-t,q=C-e,L=M*z-y*q;
2
- (L*L/x>i||va((y*z+M*q)/x-.5)>.3||o>a*g+c*p+l*v)&&(u(t,e,r,a,c,l,N,C,E,b/=S,_/=S,w,d,m),m.point(N,C),u(N,C,E,b,_,w,s,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Fa),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function tr(n){var t=nr(function(t,e){return n([t*Ha,e*Ha])});return function(n){return or(t(n))}}function er(n){this.stream=n}function rr(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ur(n){return ir(function(){return n})()}function ir(n){function t(n){return n=a(n[0]*Fa,n[1]*Fa),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*Ha,n[1]*Ha]}function r(){a=Ae(o=lr(m,y,M),i);var n=i(v,d);return c=g-n[0]*h,l=p+n[1]*h,u()}function u(){return s&&(s.valid=!1,s=null),t}var i,o,a,c,l,s,f=nr(function(n,t){return n=i(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,M=0,x=Pc,b=Et,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=or(x(o,f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(x=null==n?(_=n,Pc):He((_=+n)*Fa),u()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=n?Ye(n[0][0],n[0][1],n[1][0],n[1][1]):Et,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Fa,d=n[1]%360*Fa,r()):[v*Ha,d*Ha]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Fa,y=n[1]%360*Fa,M=n.length>2?n[2]%360*Fa:0,r()):[m*Ha,y*Ha,M*Ha]},ta.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function or(n){return rr(n,function(t,e){n.point(t*Fa,e*Fa)})}function ar(n,t){return[n,t]}function cr(n,t){return[n>Da?n-Pa:-Da>n?n+Pa:n,t]}function lr(n,t,e){return n?t||e?Ae(fr(n),hr(t,e)):fr(n):t||e?hr(t,e):cr}function sr(n){return function(t,e){return t+=n,[t>Da?t-Pa:-Da>t?t+Pa:t,e]}}function fr(n){var t=sr(n);return t.invert=sr(-n),t}function hr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*u;return[Math.atan2(c*i-s*o,a*r-l*u),nt(s*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*i-c*o;return[Math.atan2(c*i+l*o,a*r+s*u),nt(s*r-a*u)]},e}function gr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=pr(e,u),i=pr(e,i),(o>0?i>u:u>i)&&(u+=o*Pa)):(u=n+o*Pa,i=n-.5*c);for(var l,s=u;o>0?s>i:i>s;s-=c)a.point((l=xe([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],l[1])}}function pr(n,t){var e=pe(t);e[0]-=n,Me(e);var r=Q(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ta)%(2*Math.PI)}function vr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function dr(n,t,e){var r=ta.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function mr(n){return n.source}function yr(n){return n.target}function Mr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),l=u*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(ut(r-t)+u*o*ut(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,u=e*l+t*f,o=e*i+t*a;return[Math.atan2(u,r)*Ha,Math.atan2(o,Math.sqrt(r*r+u*u))*Ha]}:function(){return[n*Ha,t*Ha]};return p.distance=h,p}function xr(){function n(n,u){var i=Math.sin(u*=Fa),o=Math.cos(u),a=va((n*=Fa)-t),c=Math.cos(a);$c+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;Bc.point=function(u,i){t=u*Fa,e=Math.sin(i*=Fa),r=Math.cos(i),Bc.point=n},Bc.lineEnd=function(){Bc.point=Bc.lineEnd=y}}function br(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function _r(n,t){function e(n,t){o>0?-ja+Ta>t&&(t=-ja+Ta):t>ja-Ta&&(t=ja-Ta);var e=o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(Da/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=G(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-ja]},e):Sr}function wr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return va(u)<Ta?ar:(e.invert=function(n,t){var e=i-t;return[Math.atan2(n,e)/u,i-G(u)*Math.sqrt(n*n+e*e)]},e)}function Sr(n,t){return[n,Math.log(Math.tan(Da/4+t/2))]}function kr(n){var t,e=ur(n),r=e.scale,u=e.translate,i=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=u.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=i.apply(e,arguments);if(o===e){if(t=null==n){var a=Da*r(),c=u();i([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Er(n,t){return[Math.log(Math.tan(Da/4+t/2)),-n]}function Ar(n){return n[0]}function Nr(n){return n[1]}function Cr(n){for(var t=n.length,e=[0,1],r=2,u=2;t>u;u++){for(;r>1&&K(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function zr(n,t){return n[0]-t[0]||n[1]-t[1]}function qr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Lr(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(u-i))/(f*o-a*s);return[u+h*o,c+h*s]}function Tr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Rr(){tu(this),this.edge=this.site=this.circle=null}function Dr(n){var t=ol.pop()||new Rr;return t.site=n,t}function Pr(n){Xr(n),rl.remove(n),ol.push(n),tu(n)}function Ur(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Pr(n);for(var c=i;c.circle&&va(e-c.circle.x)<Ta&&va(r-c.circle.cy)<Ta;)i=c.P,a.unshift(c),Pr(c),c=i;a.unshift(c),Xr(c);for(var l=o;l.circle&&va(e-l.circle.x)<Ta&&va(r-l.circle.cy)<Ta;)o=l.N,a.push(l),Pr(l),l=o;a.push(l),Xr(l);var s,f=a.length;for(s=1;f>s;++s)l=a[s],c=a[s-1],Kr(l.edge,c.site,l.site,u);c=a[0],l=a[f-1],l.edge=Jr(c.site,l.site,null,u),Vr(c),Vr(l)}function jr(n){for(var t,e,r,u,i=n.x,o=n.y,a=rl._;a;)if(r=Fr(a,o)-i,r>Ta)a=a.L;else{if(u=i-Hr(a,o),!(u>Ta)){r>-Ta?(t=a.P,e=a):u>-Ta?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Dr(n);if(rl.insert(t,c),t||e){if(t===e)return Xr(t),e=Dr(t.site),rl.insert(c,e),c.edge=e.edge=Jr(t.site,c.site),Vr(t),Vr(e),void 0;if(!e)return c.edge=Jr(t.site,c.site),void 0;Xr(t),Xr(e);var l=t.site,s=l.x,f=l.y,h=n.x-s,g=n.y-f,p=e.site,v=p.x-s,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,M=v*v+d*d,x={x:(d*y-g*M)/m+s,y:(h*M-v*y)/m+f};Kr(e.edge,l,p,x),c.edge=Jr(l,n,null,x),e.edge=Jr(n,p,null,x),Vr(t),Vr(e)}}function Fr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,l=c-t;if(!l)return a;var s=a-r,f=1/i-1/l,h=s/l;return f?(-h+Math.sqrt(h*h-2*f*(s*s/(-2*l)-c+l/2+u-i/2)))/f+r:(r+a)/2}function Hr(n,t){var e=n.N;if(e)return Fr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Or(n){this.site=n,this.edges=[]}function Yr(n){for(var t,e,r,u,i,o,a,c,l,s,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=el,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)s=a[o].end(),r=s.x,u=s.y,l=a[++o%c].start(),t=l.x,e=l.y,(va(r-t)>Ta||va(u-e)>Ta)&&(a.splice(o,0,new Qr(Gr(i.site,s,va(r-f)<Ta&&p-u>Ta?{x:f,y:va(t-f)<Ta?e:p}:va(u-p)<Ta&&h-r>Ta?{x:va(e-p)<Ta?t:h,y:p}:va(r-h)<Ta&&u-g>Ta?{x:h,y:va(t-h)<Ta?e:g}:va(u-g)<Ta&&r-f>Ta?{x:va(e-g)<Ta?t:f,y:g}:null),i.site,null)),++c)}function Ir(n,t){return t.angle-n.angle}function Zr(){tu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Vr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,u=n.site,i=e.site;if(r!==i){var o=u.x,a=u.y,c=r.x-o,l=r.y-a,s=i.x-o,f=i.y-a,h=2*(c*f-l*s);if(!(h>=-Ra)){var g=c*c+l*l,p=s*s+f*f,v=(f*g-l*p)/h,d=(c*p-s*g)/h,f=d+a,m=al.pop()||new Zr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,M=il._;M;)if(m.y<M.y||m.y===M.y&&m.x<=M.x){if(!M.L){y=M.P;break}M=M.L}else{if(!M.R){y=M;break}M=M.R}il.insert(y,m),y||(ul=m)}}}}function Xr(n){var t=n.circle;t&&(t.P||(ul=t.N),il.remove(t),al.push(t),tu(t),n.circle=null)}function $r(n){for(var t,e=tl,r=Oe(n[0][0],n[0][1],n[1][0],n[1][1]),u=e.length;u--;)t=e[u],(!Br(t,n)||!r(t)||va(t.a.x-t.b.x)<Ta&&va(t.a.y-t.b.y)<Ta)&&(t.a=t.b=null,e.splice(u,1))}function Br(n,t){var e=n.b;if(e)return!0;var r,u,i=n.a,o=t[0][0],a=t[1][0],c=t[0][1],l=t[1][1],s=n.l,f=n.r,h=s.x,g=s.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(i){if(i.y>=l)return}else i={x:d,y:c};e={x:d,y:l}}else{if(i){if(i.y<c)return}else i={x:d,y:l};e={x:d,y:c}}}else if(r=(h-p)/(v-g),u=m-r*d,-1>r||r>1)if(h>p){if(i){if(i.y>=l)return}else i={x:(c-u)/r,y:c};e={x:(l-u)/r,y:l}}else{if(i){if(i.y<c)return}else i={x:(l-u)/r,y:l};e={x:(c-u)/r,y:c}}else if(v>g){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.x<o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}return n.a=i,n.b=e,!0}function Wr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Jr(n,t,e,r){var u=new Wr(n,t);return tl.push(u),e&&Kr(u,n,t,e),r&&Kr(u,t,n,r),el[n.i].edges.push(new Qr(u,n,t)),el[t.i].edges.push(new Qr(u,t,n)),u}function Gr(n,t,e){var r=new Wr(n,null);return r.a=t,r.b=e,tl.push(r),r}function Kr(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function Qr(n,t,e){var r=n.a,u=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function nu(){this._=null}function tu(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function eu(n,t){var e=t,r=t.R,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function ru(n,t){var e=t,r=t.L,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function uu(n){for(;n.L;)n=n.L;return n}function iu(n,t){var e,r,u,i=n.sort(ou).pop();for(tl=[],el=new Array(n.length),rl=new nu,il=new nu;;)if(u=ul,i&&(!u||i.y<u.y||i.y===u.y&&i.x<u.x))(i.x!==e||i.y!==r)&&(el[i.i]=new Or(i),jr(i),e=i.x,r=i.y),i=n.pop();else{if(!u)break;Ur(u.arc)}t&&($r(t),Yr(t));var o={cells:el,edges:tl};return rl=il=tl=el=null,o}function ou(n,t){return t.y-n.y||t.x-n.x}function au(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function cu(n){return n.x}function lu(n){return n.y}function su(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function fu(n,t,e,r,u,i){if(!n(t,e,r,u,i)){var o=.5*(e+u),a=.5*(r+i),c=t.nodes;c[0]&&fu(n,c[0],e,r,o,a),c[1]&&fu(n,c[1],o,r,u,a),c[2]&&fu(n,c[2],e,a,o,i),c[3]&&fu(n,c[3],o,a,u,i)}}function hu(n,t,e,r,u,i,o){var a,c=1/0;return function l(n,s,f,h,g){if(!(s>i||f>o||r>h||u>g)){if(p=n.point){var p,v=t-p[0],d=e-p[1],m=v*v+d*d;if(c>m){var y=Math.sqrt(c=m);r=t-y,u=e-y,i=t+y,o=e+y,a=p}}for(var M=n.nodes,x=.5*(s+h),b=.5*(f+g),_=t>=x,w=e>=b,S=w<<1|_,k=S+4;k>S;++S)if(n=M[3&S])switch(3&S){case 0:l(n,s,f,x,b);break;case 1:l(n,x,f,h,b);break;case 2:l(n,s,b,x,g);break;case 3:l(n,x,b,h,g)}}}(n,r,u,i,o),a}function gu(n,t){n=ta.rgb(n),t=ta.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+Mt(Math.round(e+i*n))+Mt(Math.round(r+o*n))+Mt(Math.round(u+a*n))}}function pu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=mu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function vu(n,t){return n=+n,t=+t,function(e){return n*(1-e)+t*e}}function du(n,t){var e,r,u,i=ll.lastIndex=sl.lastIndex=0,o=-1,a=[],c=[];for(n+="",t+="";(e=ll.exec(n))&&(r=sl.exec(t));)(u=r.index)>i&&(u=t.slice(i,u),a[o]?a[o]+=u:a[++o]=u),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:vu(e,r)})),i=sl.lastIndex;return i<t.length&&(u=t.slice(i),a[o]?a[o]+=u:a[++o]=u),a.length<2?c[0]?(t=c[0].x,function(n){return t(n)+""}):function(){return t}:(t=c.length,function(n){for(var e,r=0;t>r;++r)a[(e=c[r]).i]=e.x(n);return a.join("")})}function mu(n,t){for(var e,r=ta.interpolators.length;--r>=0&&!(e=ta.interpolators[r](n,t)););return e}function yu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(mu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function Mu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function xu(n){return function(t){return 1-n(1-t)}}function bu(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function _u(n){return n*n}function wu(n){return n*n*n}function Su(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function ku(n){return function(t){return Math.pow(t,n)}}function Eu(n){return 1-Math.cos(n*ja)}function Au(n){return Math.pow(2,10*(n-1))}function Nu(n){return 1-Math.sqrt(1-n*n)}function Cu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Pa*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Pa/t)}}function zu(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function qu(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Lu(n,t){n=ta.hcl(n),t=ta.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return lt(e+i*n,r+o*n,u+a*n)+""}}function Tu(n,t){n=ta.hsl(n),t=ta.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return at(e+i*n,r+o*n,u+a*n)+""}}function Ru(n,t){n=ta.lab(n),t=ta.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ft(e+i*n,r+o*n,u+a*n)+""}}function Du(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Pu(n){var t=[n.a,n.b],e=[n.c,n.d],r=ju(t),u=Uu(t,e),i=ju(Fu(e,t,-u))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*Ha,this.translate=[n.e,n.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*Ha:0}function Uu(n,t){return n[0]*t[0]+n[1]*t[1]}function ju(n){var t=Math.sqrt(Uu(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Fu(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Hu(n,t){var e,r=[],u=[],i=ta.transform(n),o=ta.transform(t),a=i.translate,c=o.translate,l=i.rotate,s=o.rotate,f=i.skew,h=o.skew,g=i.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:vu(a[0],c[0])},{i:3,x:vu(a[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:vu(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:vu(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:vu(g[0],p[0])},{i:e-2,x:vu(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i<e;)r[(t=u[i]).i]=t.x(n);return r.join("")}}function Ou(n,t){return t=(t-=n=+n)||1/t,function(e){return(e-n)/t}}function Yu(n,t){return t=(t-=n=+n)||1/t,function(e){return Math.max(0,Math.min(1,(e-n)/t))}}function Iu(n){for(var t=n.source,e=n.target,r=Vu(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function Zu(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Vu(n,t){if(n===t)return n;for(var e=Zu(n),r=Zu(t),u=e.pop(),i=r.pop(),o=null;u===i;)o=u,u=e.pop(),i=r.pop();return o}function Xu(n){n.fixed|=2}function $u(n){n.fixed&=-7}function Bu(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Wu(n){n.fixed&=-5}function Ju(n,t,e){var r=0,u=0;if(n.charge=0,!n.leaf)for(var i,o=n.nodes,a=o.length,c=-1;++c<a;)i=o[c],null!=i&&(Ju(i,t,e),n.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,u+=l*n.point.y}n.cx=r/n.charge,n.cy=u/n.charge}function Gu(n,t){return ta.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=ri,n}function Ku(n,t){for(var e=[n];null!=(n=e.pop());)if(t(n),(u=n.children)&&(r=u.length))for(var r,u;--r>=0;)e.push(u[r])}function Qu(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(i=n.children)&&(u=i.length))for(var u,i,o=-1;++o<u;)e.push(i[o]);for(;null!=(n=r.pop());)t(n)}function ni(n){return n.children}function ti(n){return n.value}function ei(n,t){return t.value-n.value}function ri(n){return ta.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function ui(n){return n.x}function ii(n){return n.y}function oi(n,t,e){n.y0=t,n.y=e}function ai(n){return ta.range(n.length)}function ci(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function li(n){for(var t,e=1,r=0,u=n[0][1],i=n.length;i>e;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function si(n){return n.reduce(fi,0)}function fi(n,t){return n+t[1]}function hi(n,t){return gi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function gi(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function pi(n){return[ta.min(n),ta.max(n)]}function vi(n,t){return n.value-t.value}function di(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function mi(n,t){n._pack_next=t,t._pack_prev=n}function yi(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function Mi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,u,i,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(xi),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(u=e[1],u.x=u.r,u.y=0,t(u),l>2))for(i=e[2],wi(r,u,i),t(i),di(r,i),r._pack_prev=i,di(i,u),u=r._pack_next,o=3;l>o;o++){wi(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(yi(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!yi(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.r<r.r?mi(r,u=a):mi(r=c,u),o--):(di(r,i),u=i,t(i))}var m=(s+f)/2,y=(h+g)/2,M=0;for(o=0;l>o;o++)i=e[o],i.x-=m,i.y-=y,M=Math.max(M,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=M,e.forEach(bi)}}function xi(n){n._pack_next=n._pack_prev=n}function bi(n){delete n._pack_next,delete n._pack_prev}function _i(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i<o;)_i(u[i],t,e,r)}function wi(n,t,e){var r=n.r+e.r,u=t.x-n.x,i=t.y-n.y;if(r&&(u||i)){var o=t.r+e.r,a=u*u+i*i;o*=o,r*=r;var c=.5+(r-o)/(2*a),l=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*u+l*i,e.y=n.y+c*i-l*u}else e.x=n.x+r,e.y=n.y}function Si(n,t){return n.parent==t.parent?1:2}function ki(n){var t=n.children;return t.length?t[0]:n.t}function Ei(n){var t,e=n.children;return(t=e.length)?e[t-1]:n.t}function Ai(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function Ni(n){for(var t,e=0,r=0,u=n.children,i=u.length;--i>=0;)t=u[i],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Ci(n,t,e){return n.a.parent===t.parent?n.a:e}function zi(n){return 1+ta.max(n,function(n){return n.y})}function qi(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Li(n){var t=n.children;return t&&t.length?Li(t[0]):n}function Ti(n){var t,e=n.children;return e&&(t=e.length)?Ti(e[t-1]):n}function Ri(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Di(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function Pi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Ui(n){return n.rangeExtent?n.rangeExtent():Pi(n.range())}function ji(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Fi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Hi(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:bl}function Oi(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)u.push(e(n[o-1],n[o])),i.push(r(t[o-1],t[o]));return function(t){var e=ta.bisect(n,t,1,a)-1;return i[e](u[e](t))}}function Yi(n,t,e,r){function u(){var u=Math.min(n.length,t.length)>2?Oi:ji,c=r?Yu:Ou;return o=u(n,t,c,e),a=u(t,n,c,mu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Du)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Xi(n,t)},i.tickFormat=function(t,e){return $i(n,t,e)},i.nice=function(t){return Zi(n,t),u()},i.copy=function(){return Yi(n,t,e,r)},u()}function Ii(n,t){return ta.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Zi(n,t){return Fi(n,Hi(Vi(n,t)[2]))}function Vi(n,t){null==t&&(t=10);var e=Pi(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Xi(n,t){return ta.range.apply(ta,Vi(n,t))}function $i(n,t,e){var r=Vi(n,t);if(e){var u=lc.exec(e);if(u.shift(),"s"===u[8]){var i=ta.formatPrefix(Math.max(va(r[0]),va(r[1])));return u[7]||(u[7]="."+Bi(i.scale(r[2]))),u[8]="f",e=ta.format(u.join("")),function(n){return e(i.scale(n))+i.symbol}}u[7]||(u[7]="."+Wi(u[8],r)),e=u.join("")}else e=",."+Bi(r[2])+"f";return ta.format(e)}function Bi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Wi(n,t){var e=Bi(t[2]);return n in _l?Math.abs(e-Bi(Math.max(va(t[0]),va(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Ji(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Fi(r.map(u),e?Math:Sl);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=Pi(r),o=[],a=n[0],c=n[1],l=Math.floor(u(a)),s=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(s-l)){if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(i(l)*h);o.push(i(l))}else for(o.push(i(l));l++<s;)for(var h=f-1;h>0;h--)o.push(i(l)*h);for(l=0;o[l]<a;l++);for(s=o.length;o[s-1]>c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return wl;arguments.length<2?t=wl:"function"!=typeof t&&(t=ta.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return Ji(n.copy(),t,e,r)},Ii(o,n)}function Gi(n,t,e){function r(t){return n(u(t))}var u=Ki(t),i=Ki(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Xi(e,n)},r.tickFormat=function(n,t){return $i(e,n,t)},r.nice=function(n){return r.domain(Zi(e,n))},r.exponent=function(o){return arguments.length?(u=Ki(t=o),i=Ki(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Gi(n.copy(),t,e)},Ii(r,n)}function Ki(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Qi(n,t){function e(e){return i[((u.get(e)||("range"===t.t?u.set(e,n.push(e)):0/0))-1)%i.length]}function r(t,e){return ta.range(n.length).map(function(n){return t+e*n})}var u,i,o;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new a;for(var i,o=-1,c=r.length;++o<c;)u.has(i=r[o])||u.set(i,n.push(i));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(i=n,o=0,t={t:"range",a:arguments},e):i},e.rangePoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=(c+l)/2,0):(l-c)/(n.length-1+a);return i=r(c+s*a/2,s),o=0,t={t:"rangePoints",a:arguments},e},e.rangeRoundPoints=function(u,a){arguments.length<2&&(a=0);var c=u[0],l=u[1],s=n.length<2?(c=l=Math.round((c+l)/2),0):0|(l-c)/(n.length-1+a);return i=r(c+Math.round(s*a/2+(l-c-(n.length-1+a)*s)/2),s),o=0,t={t:"rangeRoundPoints",a:arguments},e},e.rangeBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=(f-s)/(n.length-a+2*c);return i=r(s+h*c,h),l&&i.reverse(),o=h*(1-a),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,a,c){arguments.length<2&&(a=0),arguments.length<3&&(c=a);var l=u[1]<u[0],s=u[l-0],f=u[1-l],h=Math.floor((f-s)/(n.length-a+2*c));return i=r(s+Math.round((f-s-(n.length-a)*h)/2),h),l&&i.reverse(),o=Math.round(h*(1-a)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Pi(t.a[0])},e.copy=function(){return Qi(n,t)},e.domain(n)}function no(r,u){function i(){var n=0,t=u.length;for(a=[];++n<t;)a[n-1]=ta.quantile(r,n/t);return o}function o(n){return isNaN(n=+n)?void 0:u[ta.bisect(a,n)]}var a;return o.domain=function(u){return arguments.length?(r=u.map(t).filter(e).sort(n),i()):r},o.range=function(n){return arguments.length?(u=n,i()):u},o.quantiles=function(){return a},o.invertExtent=function(n){return n=u.indexOf(n),0>n?[0/0,0/0]:[n>0?a[n-1]:r[0],n<a.length?a[n]:r[r.length-1]]},o.copy=function(){return no(r,u)},i()}function to(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(i*(t-n))))]}function u(){return i=e.length/(t-n),o=e.length-1,r}var i,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],u()):[n,t]},r.range=function(n){return arguments.length?(e=n,u()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return to(n,t,e)},u()}function eo(n,t){function e(e){return e>=e?t[ta.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return eo(n,t)},e}function ro(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Xi(n,t)},t.tickFormat=function(t,e){return $i(n,t,e)},t.copy=function(){return ro(n)},t}function uo(){return 0}function io(n){return n.innerRadius}function oo(n){return n.outerRadius}function ao(n){return n.startAngle}function co(n){return n.endAngle}function lo(n){return n&&n.padAngle}function so(n,t,e,r){return(n-e)*t-(t-r)*n>0?0:1}function fo(n,t,e,r,u){var i=n[0]-t[0],o=n[1]-t[1],a=(u?r:-r)/Math.sqrt(i*i+o*o),c=a*o,l=-a*i,s=n[0]+c,f=n[1]+l,h=t[0]+c,g=t[1]+l,p=(s+h)/2,v=(f+g)/2,d=h-s,m=g-f,y=d*d+m*m,M=e-r,x=s*g-h*f,b=(0>m?-1:1)*Math.sqrt(M*M*y-x*x),_=(x*m-d*b)/y,w=(-x*d-m*b)/y,S=(x*m+d*b)/y,k=(-x*d+m*b)/y,E=_-p,A=w-v,N=S-p,C=k-v;return E*E+A*A>N*N+C*C&&(_=S,w=k),[[_-c,w-l],[_*e/M,w*e/M]]}function ho(n){function t(t){function o(){l.push("M",i(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=kt(e),p=kt(r);++f<h;)u.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(o(),s=[]);return s.length&&o(),l.length?l.join(""):null}var e=Ar,r=Nr,u=Ne,i=go,o=i.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?i=n:(i=zl.get(n)||go).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function go(n){return n.join("L")}function po(n){return go(n)+"Z"}function vo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&u.push("H",r[0]),u.join("")}function mo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("V",(r=n[t])[1],"H",r[0]);return u.join("")}function yo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r=n[t])[0],"V",r[1]);return u.join("")}function Mo(n,t){return n.length<4?go(n):n[1]+_o(n.slice(1,-1),wo(n,t))}function xo(n,t){return n.length<3?go(n):n[0]+_o((n.push(n[0]),n),wo([n[n.length-2]].concat(n,[n[1]]),t))}function bo(n,t){return n.length<3?go(n):n[0]+_o(n,wo(n,t))}function _o(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return go(n);var e=n.length!=t.length,r="",u=n[0],i=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(i[0]-2*o[0]/3)+","+(i[1]-2*o[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var l=2;l<t.length;l++,c++)i=n[c],a=t[l],r+="S"+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1]}if(e){var s=n[c];r+="Q"+(i[0]+2*a[0]/3)+","+(i[1]+2*a[1]/3)+","+s[0]+","+s[1]}return r}function wo(n,t){for(var e,r=[],u=(1-t)/2,i=n[0],o=n[1],a=1,c=n.length;++a<c;)e=i,i=o,o=n[a],r.push([u*(o[0]-e[0]),u*(o[1]-e[1])]);return r}function So(n){if(n.length<3)return go(n);var t=1,e=n.length,r=n[0],u=r[0],i=r[1],o=[u,u,u,(r=n[1])[0]],a=[i,i,i,r[1]],c=[u,",",i,"L",No(Tl,o),",",No(Tl,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),Co(c,o,a);return n.pop(),c.push("L",r),c.join("")}function ko(n){if(n.length<4)return go(n);for(var t,e=[],r=-1,u=n.length,i=[0],o=[0];++r<3;)t=n[r],i.push(t[0]),o.push(t[1]);for(e.push(No(Tl,i)+","+No(Tl,o)),--r;++r<u;)t=n[r],i.shift(),i.push(t[0]),o.shift(),o.push(t[1]),Co(e,i,o);return e.join("")}function Eo(n){for(var t,e,r=-1,u=n.length,i=u+4,o=[],a=[];++r<4;)e=n[r%u],o.push(e[0]),a.push(e[1]);for(t=[No(Tl,o),",",No(Tl,a)],--r;++r<i;)e=n[r%u],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),Co(t,o,a);return t.join("")}function Ao(n,t){var e=n.length-1;if(e)for(var r,u,i=n[0][0],o=n[0][1],a=n[e][0]-i,c=n[e][1]-o,l=-1;++l<=e;)r=n[l],u=l/e,r[0]=t*r[0]+(1-t)*(i+u*a),r[1]=t*r[1]+(1-t)*(o+u*c);return So(n)}function No(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function Co(n,t,e){n.push("C",No(ql,t),",",No(ql,e),",",No(Ll,t),",",No(Ll,e),",",No(Tl,t),",",No(Tl,e))}function zo(n,t){return(t[1]-n[1])/(t[0]-n[0])}function qo(n){for(var t=0,e=n.length-1,r=[],u=n[0],i=n[1],o=r[0]=zo(u,i);++t<e;)r[t]=(o+(o=zo(u=i,i=n[t+1])))/2;return r[t]=o,r}function Lo(n){for(var t,e,r,u,i=[],o=qo(n),a=-1,c=n.length-1;++a<c;)t=zo(n[a],n[a+1]),va(t)<Ta?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,u=e*e+r*r,u>9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function To(n){return n.length<3?go(n):n[0]+_o(n,Lo(n))}function Ro(n){for(var t,e,r,u=-1,i=n.length;++u<i;)t=n[u],e=t[0],r=t[1]-ja,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Do(n){function t(t){function c(){v.push("M",a(n(m),f),s,l(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,M=t.length,x=kt(e),b=kt(u),_=e===r?function(){return g}:kt(r),w=u===i?function(){return p}:kt(i);++y<M;)o.call(this,h=t[y],y)?(d.push([g=+x.call(this,h,y),p=+b.call(this,h,y)]),m.push([+_.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],m=[]);return d.length&&c(),v.length?v.join(""):null}var e=Ar,r=Ar,u=0,i=Nr,o=Ne,a=go,c=a.key,l=a,s="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=zl.get(n)||go).key,l=a.reverse||a,s=a.closed?"M":"L",t):c
3
- },t.tension=function(n){return arguments.length?(f=n,t):f},t}function Po(n){return n.radius}function Uo(n){return[n.x,n.y]}function jo(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]-ja;return[e*Math.cos(r),e*Math.sin(r)]}}function Fo(){return 64}function Ho(){return"circle"}function Oo(n){var t=Math.sqrt(n/Da);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Yo(n){return function(){var t,e;(t=this[n])&&(e=t[t.active])&&(--t.count?delete t[t.active]:delete this[n],t.active+=.5,e.event&&e.event.interrupt.call(this,this.__data__,e.index))}}function Io(n,t,e){return xa(n,Hl),n.namespace=t,n.id=e,n}function Zo(n,t,e,r){var u=n.id,i=n.namespace;return H(n,"function"==typeof e?function(n,o,a){n[i][u].tween.set(t,r(e.call(n,n.__data__,o,a)))}:(e=r(e),function(n){n[i][u].tween.set(t,e)}))}function Vo(n){return null==n&&(n=""),function(){this.textContent=n}}function Xo(n){return null==n?"__transition__":"__transition_"+n+"__"}function $o(n,t,e,r,u){var i=n[e]||(n[e]={active:0,count:0}),o=i[r];if(!o){var c=u.time;o=i[r]={tween:new a,time:c,delay:u.delay,duration:u.duration,ease:u.ease,index:t},u=null,++i.count,ta.timer(function(u){function a(e){if(i.active>r)return s();var u=i[i.active];u&&(--i.count,delete i[i.active],u.event&&u.event.interrupt.call(n,n.__data__,u.index)),i.active=r,o.event&&o.event.start.call(n,n.__data__,t),o.tween.forEach(function(e,r){(r=r.call(n,n.__data__,t))&&v.push(r)}),h=o.ease,f=o.duration,ta.timer(function(){return p.c=l(e||1)?Ne:l,1},0,c)}function l(e){if(i.active!==r)return 1;for(var u=e/f,a=h(u),c=v.length;c>0;)v[--c].call(n,a);return u>=1?(o.event&&o.event.end.call(n,n.__data__,t),s()):void 0}function s(){return--i.count?delete i[r]:delete n[e],1}var f,h,g=o.delay,p=oc,v=[];return p.t=g+c,u>=g?a(u-g):(p.c=a,void 0)},0,c)}}function Bo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate("+(isFinite(r)?r:e(n))+",0)"})}function Wo(n,t,e){n.attr("transform",function(n){var r=t(n);return"translate(0,"+(isFinite(r)?r:e(n))+")"})}function Jo(n){return n.toISOString()}function Go(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=ta.bisect(Wl,u);return i==Wl.length?[t.year,Vi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/Wl[i-1]<Wl[i]/u?i-1:i]:[Kl,Vi(n,e)[2]]}return r.invert=function(t){return Ko(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Ko)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Ko(+e+1),t).length}var i=r.domain(),o=Pi(i),a=null==n?u(o,10):"number"==typeof n&&u(o,n);return a&&(n=a[0],t=a[1]),r.domain(Fi(i,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Ko(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Ko(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Pi(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Ko(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Go(n.copy(),t,e)},Ii(r,n)}function Ko(n){return new Date(n)}function Qo(n){return JSON.parse(n.responseText)}function na(n){var t=ua.createRange();return t.selectNode(ua.body),t.createContextualFragment(n.responseText)}var ta={version:"3.5.3"};Date.now||(Date.now=function(){return+new Date});var ea=[].slice,ra=function(n){return ea.call(n)},ua=document,ia=ua.documentElement,oa=window;try{ra(ia.childNodes)[0].nodeType}catch(aa){ra=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{ua.createElement("div").style.setProperty("opacity",0,"")}catch(ca){var la=oa.Element.prototype,sa=la.setAttribute,fa=la.setAttributeNS,ha=oa.CSSStyleDeclaration.prototype,ga=ha.setProperty;la.setAttribute=function(n,t){sa.call(this,n,t+"")},la.setAttributeNS=function(n,t,e){fa.call(this,n,t,e+"")},ha.setProperty=function(n,t,e){ga.call(this,n,t+"",e)}}ta.ascending=n,ta.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},ta.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&e>r&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&e>r&&(e=r)}return e},ta.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i;)if(null!=(r=n[u])&&r>=r){e=r;break}for(;++u<i;)null!=(r=n[u])&&r>e&&(e=r)}else{for(;++u<i;)if(null!=(r=t.call(n,n[u],u))&&r>=r){e=r;break}for(;++u<i;)null!=(r=t.call(n,n[u],u))&&r>e&&(e=r)}return e},ta.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=n[i])&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=n[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;++i<o;)if(null!=(r=t.call(n,n[i],i))&&r>=r){e=u=r;break}for(;++i<o;)null!=(r=t.call(n,n[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},ta.sum=function(n,t){var r,u=0,i=n.length,o=-1;if(1===arguments.length)for(;++o<i;)e(r=+n[o])&&(u+=r);else for(;++o<i;)e(r=+t.call(n,n[o],o))&&(u+=r);return u},ta.mean=function(n,r){var u,i=0,o=n.length,a=-1,c=o;if(1===arguments.length)for(;++a<o;)e(u=t(n[a]))?i+=u:--c;else for(;++a<o;)e(u=t(r.call(n,n[a],a)))?i+=u:--c;return c?i/c:void 0},ta.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),u=+n[r-1],i=e-r;return i?u+i*(n[r]-u):u},ta.median=function(r,u){var i,o=[],a=r.length,c=-1;if(1===arguments.length)for(;++c<a;)e(i=t(r[c]))&&o.push(i);else for(;++c<a;)e(i=t(u.call(r,r[c],c)))&&o.push(i);return o.length?ta.quantile(o.sort(n),.5):void 0},ta.variance=function(n,r){var u,i,o=n.length,a=0,c=0,l=-1,s=0;if(1===arguments.length)for(;++l<o;)e(u=t(n[l]))&&(i=u-a,a+=i/++s,c+=i*(u-a));else for(;++l<o;)e(u=t(r.call(n,n[l],l)))&&(i=u-a,a+=i/++s,c+=i*(u-a));return s>1?c/(s-1):void 0},ta.deviation=function(){var n=ta.variance.apply(this,arguments);return n?Math.sqrt(n):n};var pa=r(n);ta.bisectLeft=pa.left,ta.bisect=ta.bisectRight=pa.right,ta.bisector=function(t){return r(1===t.length?function(e,r){return n(t(e),r)}:t)},ta.shuffle=function(n,t,e){(i=arguments.length)<3&&(e=n.length,2>i&&(t=0));for(var r,u,i=e-t;i;)u=0|Math.random()*i--,r=n[i+t],n[i+t]=n[u+t],n[u+t]=r;return n},ta.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},ta.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},ta.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=ta.min(arguments,u),e=new Array(t);++n<t;)for(var r,i=-1,o=e[n]=new Array(r);++i<r;)o[i]=arguments[i][n];return e},ta.transpose=function(n){return ta.zip.apply(ta,n)},ta.keys=function(n){var t=[];for(var e in n)t.push(e);return t},ta.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},ta.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},ta.merge=function(n){for(var t,e,r,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(e=new Array(o);--u>=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var va=Math.abs;ta.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/e)throw new Error("infinite range");var r,u=[],o=i(va(e)),a=-1;if(n*=o,t*=o,e*=o,0>e)for(;(r=n+e*++a)>t;)u.push(r/o);else for(;(r=n+e*++a)<t;)u.push(r/o);return u},ta.map=function(n,t){var e=new a;if(n instanceof a)n.forEach(function(n,t){e.set(n,t)});else if(Array.isArray(n)){var r,u=-1,i=n.length;if(1===arguments.length)for(;++u<i;)e.set(u,n[u]);else for(;++u<i;)e.set(t.call(n,r=n[u],u),r)}else for(var o in n)e.set(o,n[o]);return e};var da="__proto__",ma="\x00";o(a,{has:s,get:function(n){return this._[c(n)]},set:function(n,t){return this._[c(n)]=t},remove:f,keys:h,values:function(){var n=[];for(var t in this._)n.push(this._[t]);return n},entries:function(){var n=[];for(var t in this._)n.push({key:l(t),value:this._[t]});return n},size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t),this._[t])}}),ta.nest=function(){function n(t,o,c){if(c>=i.length)return r?r.call(u,o):e?o.sort(e):o;for(var l,s,f,h,g=-1,p=o.length,v=i[c++],d=new a;++g<p;)(h=d.get(l=v(s=o[g])))?h.push(s):d.set(l,[s]);return t?(s=t(),f=function(e,r){s.set(e,n(t,r,c))}):(s={},f=function(e,r){s[e]=n(t,r,c)}),d.forEach(f),s}function t(n,e){if(e>=i.length)return n;var r=[],u=o[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,u={},i=[],o=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(ta.map,e,0),0)},u.key=function(n){return i.push(n),u},u.sortKeys=function(n){return o[i.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},ta.set=function(n){var t=new v;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},o(v,{has:s,add:function(n){return this._[c(n+="")]=!0,n},remove:f,values:h,size:g,empty:p,forEach:function(n){for(var t in this._)n.call(this,l(t))}}),ta.behavior={},ta.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r<u;)n[e=arguments[r]]=d(n,t,t[e]);return n};var ya=["webkit","ms","moz","Moz","o","O"];ta.dispatch=function(){for(var n=new M,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=x(n);return n},M.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.slice(e+1),n=n.slice(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},ta.event=null,ta.requote=function(n){return n.replace(Ma,"\\$&")};var Ma=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,xa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ba=function(n,t){return t.querySelector(n)},_a=function(n,t){return t.querySelectorAll(n)},wa=ia.matches||ia[m(ia,"matchesSelector")],Sa=function(n,t){return wa.call(n,t)};"function"==typeof Sizzle&&(ba=function(n,t){return Sizzle(n,t)[0]||null},_a=Sizzle,Sa=Sizzle.matchesSelector),ta.selection=function(){return Na};var ka=ta.selection.prototype=[];ka.select=function(n){var t,e,r,u,i=[];n=k(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,l=r.length;++c<l;)(u=r[c])?(t.push(e=n.call(u,u.__data__,c,o)),e&&"__data__"in u&&(e.__data__=u.__data__)):t.push(null)}return S(i)},ka.selectAll=function(n){var t,e,r=[];n=E(n);for(var u=-1,i=this.length;++u<i;)for(var o=this[u],a=-1,c=o.length;++a<c;)(e=o[a])&&(r.push(t=ra(n.call(e,e.__data__,a,u))),t.parentNode=e);return S(r)};var Ea={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};ta.ns={prefix:Ea,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.slice(0,t),n=n.slice(t+1)),Ea.hasOwnProperty(e)?{space:Ea[e],local:n}:n}},ka.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=ta.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(A(t,n[t]));return this}return this.each(A(n,t))},ka.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=z(n)).length,u=-1;if(t=e.classList){for(;++u<r;)if(!t.contains(n[u]))return!1}else for(t=e.getAttribute("class");++u<r;)if(!C(n[u]).test(t))return!1;return!0}for(t in n)this.each(q(t,n[t]));return this}return this.each(q(n,t))},ka.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(T(e,n[e],t));return this}if(2>r)return oa.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(T(n,t,e))},ka.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},ka.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},ka.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},ka.append=function(n){return n=D(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},ka.insert=function(n,t){return n=D(n),t=k(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},ka.remove=function(){return this.each(P)},ka.data=function(n,t){function e(n,e){var r,u,i,o=n.length,f=e.length,h=Math.min(o,f),g=new Array(f),p=new Array(f),v=new Array(o);if(t){var d,m=new a,y=new Array(o);for(r=-1;++r<o;)m.has(d=t.call(u=n[r],u.__data__,r))?v[r]=u:m.set(d,u),y[r]=d;for(r=-1;++r<f;)(u=m.get(d=t.call(e,i=e[r],r)))?u!==!0&&(g[r]=u,u.__data__=i):p[r]=U(i),m.set(d,!0);for(r=-1;++r<o;)m.get(y[r])!==!0&&(v[r]=n[r])}else{for(r=-1;++r<h;)u=n[r],i=e[r],u?(u.__data__=i,g[r]=u):p[r]=U(i);for(;f>r;++r)p[r]=U(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),l.push(g),s.push(v)}var r,u,i=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++i<o;)(u=r[i])&&(n[i]=u.__data__);return n}var c=O([]),l=S([]),s=S([]);if("function"==typeof n)for(;++i<o;)e(r=this[i],n.call(r,r.parentNode.__data__,i));else for(;++i<o;)e(r=this[i],n);return l.enter=function(){return c},l.exit=function(){return s},l},ka.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},ka.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=j(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return S(u)},ka.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},ka.sort=function(n){n=F.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},ka.each=function(n){return H(this,function(t,e,r){n.call(t,t.__data__,e,r)})},ka.call=function(n){var t=ra(arguments);return n.apply(t[0]=this,t),this},ka.empty=function(){return!this.node()},ka.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},ka.size=function(){var n=0;return H(this,function(){++n}),n};var Aa=[];ta.selection.enter=O,ta.selection.enter.prototype=Aa,Aa.append=ka.append,Aa.empty=ka.empty,Aa.node=ka.node,Aa.call=ka.call,Aa.size=ka.size,Aa.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++a<c;){r=(u=this[a]).update,o.push(t=[]),t.parentNode=u.parentNode;for(var l=-1,s=u.length;++l<s;)(i=u[l])?(t.push(r[l]=e=n.call(u.parentNode,i.__data__,l,a)),e.__data__=i.__data__):t.push(null)}return S(o)},Aa.insert=function(n,t){return arguments.length<2&&(t=Y(this)),ka.insert.call(this,n,t)},ta.select=function(n){var t=["string"==typeof n?ba(n,ua):n];return t.parentNode=ia,S([t])},ta.selectAll=function(n){var t=ra("string"==typeof n?_a(n,ua):n);return t.parentNode=ia,S([t])};var Na=ta.select(ia);ka.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(I(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(I(n,t,e))};var Ca=ta.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ca.forEach(function(n){"on"+n in ua&&Ca.remove(n)});var za="onselectstart"in ua?null:m(ia.style,"userSelect"),qa=0;ta.mouse=function(n){return $(n,_())};var La=/WebKit/.test(oa.navigator.userAgent)?-1:0;ta.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=_().changedTouches),t)for(var r,u=0,i=t.length;i>u;++u)if((r=t[u]).identifier===e)return $(n,r)},ta.behavior.drag=function(){function n(){this.on("mousedown.drag",u).on("touchstart.drag",i)}function t(n,t,u,i,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-M[0],e=r[1]-M[1],p|=n|e,M=r,g({type:"drag",x:r[0]+l[0],y:r[1]+l[1],dx:n,dy:e}))}function c(){t(h,v)&&(m.on(i+d,null).on(o+d,null),y(p&&ta.event.target===f),g({type:"dragend"}))}var l,s=this,f=ta.event.target,h=s.parentNode,g=e.of(s,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=ta.select(u()).on(i+d,a).on(o+d,c),y=X(),M=t(h,v);r?(l=r.apply(s,arguments),l=[l.x-M[0],l.y-M[1]]):l=[0,0],g({type:"dragstart"})}}var e=w(n,"drag","dragstart","dragend"),r=null,u=t(y,ta.mouse,J,"mousemove","mouseup"),i=t(B,ta.touch,W,"touchmove","touchend");return n.origin=function(t){return arguments.length?(r=t,n):r},ta.rebind(n,e,"on")},ta.touches=function(n,t){return arguments.length<2&&(t=_().touches),t?ra(t).map(function(t){var e=$(n,t);return e.identifier=t.identifier,e}):[]};var Ta=1e-6,Ra=Ta*Ta,Da=Math.PI,Pa=2*Da,Ua=Pa-Ta,ja=Da/2,Fa=Da/180,Ha=180/Da,Oa=Math.SQRT2,Ya=2,Ia=4;ta.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=et(v),o=i/(Ya*h)*(e*rt(Oa*t+v)-tt(v));return[r+o*l,u+o*s,i*e/et(Oa*t+v)]}return[r+n*l,u+n*s,i*Math.exp(Oa*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],l=o-r,s=a-u,f=l*l+s*s,h=Math.sqrt(f),g=(c*c-i*i+Ia*f)/(2*i*Ya*h),p=(c*c-i*i-Ia*f)/(2*c*Ya*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Oa;return e.duration=1e3*y,e},ta.behavior.zoom=function(){function n(n){n.on(z,s).on(Xa+".zoom",h).on("dblclick.zoom",g).on(T,f)}function t(n){return[(n[0]-k.x)/k.k,(n[1]-k.y)/k.k]}function e(n){return[n[0]*k.k+k.x,n[1]*k.k+k.y]}function r(n){k.k=Math.max(A[0],Math.min(A[1],n))}function u(n,t){t=e(t),k.x+=n[0]-t[0],k.y+=n[1]-t[1]}function i(t,e,i,o){t.__chart__={x:k.x,y:k.y,k:k.k},r(Math.pow(2,o)),u(v=e,i),t=ta.select(t),N>0&&(t=t.transition().duration(N)),t.call(n.event)}function o(){x&&x.domain(M.range().map(function(n){return(n-k.x)/k.k}).map(M.invert)),S&&S.domain(_.range().map(function(n){return(n-k.y)/k.k}).map(_.invert))}function a(n){C++||n({type:"zoomstart"})}function c(n){o(),n({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function l(n){--C||n({type:"zoomend"}),v=null}function s(){function n(){s=1,u(ta.mouse(r),h),c(o)}function e(){f.on(q,null).on(L,null),g(s&&ta.event.target===i),l(o)}var r=this,i=ta.event.target,o=R.of(r,arguments),s=0,f=ta.select(oa).on(q,n).on(L,e),h=t(ta.mouse(r)),g=X();Fl.call(r),a(o)}function f(){function n(){var n=ta.touches(p);return g=k.k,n.forEach(function(n){n.identifier in d&&(d[n.identifier]=t(n))}),n}function e(){var t=ta.event.target;ta.select(t).on(x,o).on(_,h),w.push(t);for(var e=ta.event.changedTouches,r=0,u=e.length;u>r;++r)d[e[r].identifier]=null;var a=n(),c=Date.now();if(1===a.length){if(500>c-y){var l=a[0];i(p,l,d[l.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),b()}y=c}else if(a.length>1){var l=a[0],s=a[1],f=l[0]-s[0],g=l[1]-s[1];m=f*f+g*g}}function o(){var n,t,e,i,o=ta.touches(p);Fl.call(p);for(var a=0,l=o.length;l>a;++a,i=null)if(e=o[a],i=d[e.identifier]){if(t)break;n=e,t=i}if(i){var s=(s=e[0]-n[0])*s+(s=e[1]-n[1])*s,f=m&&Math.sqrt(s/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*g)}y=null,u(n,t),c(v)}function h(){if(ta.event.touches.length){for(var t=ta.event.changedTouches,e=0,r=t.length;r>e;++e)delete d[t[e].identifier];for(var u in d)return void n()}ta.selectAll(w).on(M,null),S.on(z,s).on(T,f),E(),l(v)}var g,p=this,v=R.of(p,arguments),d={},m=0,M=".zoom-"+ta.event.changedTouches[0].identifier,x="touchmove"+M,_="touchend"+M,w=[],S=ta.select(p),E=X();e(),a(v),S.on(z,null).on(T,e)}function h(){var n=R.of(this,arguments);m?clearTimeout(m):(p=t(v=d||ta.mouse(this)),Fl.call(this),a(n)),m=setTimeout(function(){m=null,l(n)},50),b(),r(Math.pow(2,.002*Za())*k.k),u(v,p),c(n)}function g(){var n=ta.mouse(this),e=Math.log(k.k)/Math.LN2;i(this,n,t(n),ta.event.shiftKey?Math.ceil(e)-1:Math.floor(e)+1)}var p,v,d,m,y,M,x,_,S,k={x:0,y:0,k:1},E=[960,500],A=Va,N=250,C=0,z="mousedown.zoom",q="mousemove.zoom",L="mouseup.zoom",T="touchstart.zoom",R=w(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=R.of(this,arguments),t=k;Ul?ta.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},a(n)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],u=v?v[0]:e/2,i=v?v[1]:r/2,o=ta.interpolateZoom([(u-k.x)/k.k,(i-k.y)/k.k,e/k.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),a=e/r[2];this.__chart__=k={x:u-r[0]*a,y:i-r[1]*a,k:a},c(n)}}).each("interrupt.zoom",function(){l(n)}).each("end.zoom",function(){l(n)}):(this.__chart__=k,a(n),c(n),l(n))})},n.translate=function(t){return arguments.length?(k={x:+t[0],y:+t[1],k:k.k},o(),n):[k.x,k.y]},n.scale=function(t){return arguments.length?(k={x:k.x,y:k.y,k:+t},o(),n):k.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Va:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(d=t&&[+t[0],+t[1]],n):d},n.size=function(t){return arguments.length?(E=t&&[+t[0],+t[1]],n):E},n.duration=function(t){return arguments.length?(N=+t,n):N},n.x=function(t){return arguments.length?(x=t,M=t.copy(),k={x:0,y:0,k:1},n):x},n.y=function(t){return arguments.length?(S=t,_=t.copy(),k={x:0,y:0,k:1},n):S},ta.rebind(n,R,"on")};var Za,Va=[0,1/0],Xa="onwheel"in ua?(Za=function(){return-ta.event.deltaY*(ta.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ua?(Za=function(){return ta.event.wheelDelta},"mousewheel"):(Za=function(){return-ta.event.detail},"MozMousePixelScroll");ta.color=it,it.prototype.toString=function(){return this.rgb()+""},ta.hsl=ot;var $a=ot.prototype=new it;$a.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new ot(this.h,this.s,this.l/n)},$a.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new ot(this.h,this.s,n*this.l)},$a.rgb=function(){return at(this.h,this.s,this.l)},ta.hcl=ct;var Ba=ct.prototype=new it;Ba.brighter=function(n){return new ct(this.h,this.c,Math.min(100,this.l+Wa*(arguments.length?n:1)))},Ba.darker=function(n){return new ct(this.h,this.c,Math.max(0,this.l-Wa*(arguments.length?n:1)))},Ba.rgb=function(){return lt(this.h,this.c,this.l).rgb()},ta.lab=st;var Wa=18,Ja=.95047,Ga=1,Ka=1.08883,Qa=st.prototype=new it;Qa.brighter=function(n){return new st(Math.min(100,this.l+Wa*(arguments.length?n:1)),this.a,this.b)},Qa.darker=function(n){return new st(Math.max(0,this.l-Wa*(arguments.length?n:1)),this.a,this.b)},Qa.rgb=function(){return ft(this.l,this.a,this.b)},ta.rgb=dt;var nc=dt.prototype=new it;nc.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),new dt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new dt(u,u,u)},nc.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new dt(n*this.r,n*this.g,n*this.b)},nc.hsl=function(){return bt(this.r,this.g,this.b)},nc.toString=function(){return"#"+Mt(this.r)+Mt(this.g)+Mt(this.b)};var tc=ta.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});tc.forEach(function(n,t){tc.set(n,mt(t))}),ta.functor=kt,ta.xhr=At(Et),ta.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=Nt(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(s>=l)return o;if(u)return u=!1,i;var t=s;if(34===n.charCodeAt(t)){for(var e=t;e++<l;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}s=e+2;var r=n.charCodeAt(e+1);return 13===r?(u=!0,10===n.charCodeAt(e+2)&&++s):10===r&&(u=!0),n.slice(t+1,e).replace(/""/g,'"')}for(;l>s;){var r=n.charCodeAt(s++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==c)continue;return n.slice(t,s-a)}return n.slice(t)}for(var r,u,i={},o={},a=[],l=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();t&&null==(h=t(h,f++))||a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new v,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},ta.csv=ta.dsv(",","text/csv"),ta.tsv=ta.dsv(" ","text/tab-separated-values");var ec,rc,uc,ic,oc,ac=oa[m(oa,"requestAnimationFrame")]||function(n){setTimeout(n,17)};ta.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};rc?rc.n=i:ec=i,rc=i,uc||(ic=clearTimeout(ic),uc=1,ac(qt))},ta.timer.flush=function(){Lt(),Tt()},ta.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var cc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Dt);ta.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=ta.round(n,Rt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),cc[8+e/3]};var lc=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,sc=ta.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=ta.round(n,Rt(n,t))).toFixed(Math.max(0,Math.min(20,Rt(n*(1+1e-15),t))))}}),fc=ta.time={},hc=Date;jt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){gc.setUTCDate.apply(this._,arguments)},setDay:function(){gc.setUTCDay.apply(this._,arguments)},setFullYear:function(){gc.setUTCFullYear.apply(this._,arguments)},setHours:function(){gc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){gc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){gc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){gc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){gc.setUTCSeconds.apply(this._,arguments)},setTime:function(){gc.setTime.apply(this._,arguments)}};var gc=Date.prototype;fc.year=Ft(function(n){return n=fc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),fc.years=fc.year.range,fc.years.utc=fc.year.utc.range,fc.day=Ft(function(n){var t=new hc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),fc.days=fc.day.range,fc.days.utc=fc.day.utc.range,fc.dayOfYear=function(n){var t=fc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=fc[n]=Ft(function(n){return(n=fc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});fc[n+"s"]=e.range,fc[n+"s"].utc=e.utc.range,fc[n+"OfYear"]=function(n){var e=fc.year(n).getDay();return Math.floor((fc.dayOfYear(n)+(e+t)%7)/7)}}),fc.week=fc.sunday,fc.weeks=fc.sunday.range,fc.weeks.utc=fc.sunday.utc.range,fc.weekOfYear=fc.sundayOfYear;var pc={"-":"",_:" ",0:"0"},vc=/^\s*\d+/,dc=/^%/;ta.locale=function(n){return{numberFormat:Pt(n),timeFormat:Ot(n)}};var mc=ta.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});ta.format=mc.numberFormat,ta.geo={},ce.prototype={s:0,t:0,add:function(n){le(n,this.t,yc),le(yc.s,this.s,this),this.s?this.t+=yc.t:this.s=yc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var yc=new ce;ta.geo.stream=function(n,t){n&&Mc.hasOwnProperty(n.type)?Mc[n.type](n,t):se(n,t)};var Mc={Feature:function(n,t){se(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++r<u;)se(e[r].geometry,t)}},xc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)n=e[r],t.point(n[0],n[1],n[2])
4
- },LineString:function(n,t){fe(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)fe(e[r],t,0)},Polygon:function(n,t){he(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)he(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,u=e.length;++r<u;)se(e[r],t)}};ta.geo.area=function(n){return bc=0,ta.geo.stream(n,wc),bc};var bc,_c=new ce,wc={sphere:function(){bc+=4*Da},point:y,lineStart:y,lineEnd:y,polygonStart:function(){_c.reset(),wc.lineStart=ge},polygonEnd:function(){var n=2*_c;bc+=0>n?4*Da+n:n,wc.lineStart=wc.lineEnd=wc.point=y}};ta.geo.bounds=function(){function n(n,t){M.push(x=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=pe([t*Fa,e*Fa]);if(m){var u=de(m,r),i=[u[1],-u[0],0],o=de(i,u);Me(o),o=xe(o);var c=t-p,l=c>0?1:-1,v=o[0]*Ha*l,d=va(c)>180;if(d^(v>l*p&&l*t>v)){var y=o[1]*Ha;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>l*p&&l*t>v)){var y=-o[1]*Ha;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){x[0]=s,x[1]=h,b.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=va(r)>180?r+(r>0?360:-360):r}else v=n,d=e;wc.point(n,e),t(n,e)}function i(){wc.lineStart()}function o(){u(v,d),wc.lineEnd(),va(y)>Ta&&(s=-(h=180)),x[0]=s,x[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var s,f,h,g,p,v,d,m,y,M,x,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=u,b.lineStart=i,b.lineEnd=o,y=0,wc.polygonStart()},polygonEnd:function(){wc.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>_c?(s=-(h=180),f=-(g=90)):y>Ta?g=90:-Ta>y&&(f=-90),x[0]=s,x[1]=h}};return function(n){g=h=-(s=f=1/0),M=[],ta.geo.stream(n,b);var t=M.length;if(t){M.sort(c);for(var e,r=1,u=M[0],i=[u];t>r;++r)e=M[r],l(e[0],u)||l(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,s=e[0],h=u[1])}return M=x=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),ta.geo.centroid=function(n){Sc=kc=Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,Dc);var t=Lc,e=Tc,r=Rc,u=t*t+e*e+r*r;return Ra>u&&(t=Cc,e=zc,r=qc,Ta>kc&&(t=Ec,e=Ac,r=Nc),u=t*t+e*e+r*r,Ra>u)?[0/0,0/0]:[Math.atan2(e,t)*Ha,nt(r/Math.sqrt(u))*Ha]};var Sc,kc,Ec,Ac,Nc,Cc,zc,qc,Lc,Tc,Rc,Dc={sphere:y,point:_e,lineStart:Se,lineEnd:ke,polygonStart:function(){Dc.lineStart=Ee},polygonEnd:function(){Dc.lineStart=Se}},Pc=Le(Ne,Pe,je,[-Da,-Da/2]),Uc=1e9;ta.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Ye(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(ta.geo.conicEqualArea=function(){return Ie(Ze)}).raw=Ze,ta.geo.albers=function(){return ta.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},ta.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=ta.geo.albers(),o=ta.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=ta.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var l=i.scale(),s=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+Ta,f+.12*l+Ta],[s-.214*l-Ta,f+.234*l-Ta]]).stream(c).point,u=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+Ta,f+.166*l+Ta],[s-.115*l-Ta,f+.234*l-Ta]]).stream(c).point,n},n.scale(1070)};var jc,Fc,Hc,Oc,Yc,Ic,Zc={point:y,lineStart:y,lineEnd:y,polygonStart:function(){Fc=0,Zc.lineStart=Ve},polygonEnd:function(){Zc.lineStart=Zc.lineEnd=Zc.point=y,jc+=va(Fc/2)}},Vc={point:Xe,lineStart:y,lineEnd:y,polygonStart:y,polygonEnd:y},Xc={point:We,lineStart:Je,lineEnd:Ge,polygonStart:function(){Xc.lineStart=Ke},polygonEnd:function(){Xc.point=We,Xc.lineStart=Je,Xc.lineEnd=Ge}};ta.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),ta.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return jc=0,ta.geo.stream(n,u(Zc)),jc},n.centroid=function(n){return Ec=Ac=Nc=Cc=zc=qc=Lc=Tc=Rc=0,ta.geo.stream(n,u(Xc)),Rc?[Lc/Rc,Tc/Rc]:qc?[Cc/qc,zc/qc]:Nc?[Ec/Nc,Ac/Nc]:[0/0,0/0]},n.bounds=function(n){return Yc=Ic=-(Hc=Oc=1/0),ta.geo.stream(n,u(Vc)),[[Hc,Oc],[Yc,Ic]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||tr(n):Et,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new $e:new Qe(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(ta.geo.albersUsa()).context(null)},ta.geo.transform=function(n){return{stream:function(t){var e=new er(t);for(var r in n)e[r]=n[r];return e}}},er.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},ta.geo.projection=ur,ta.geo.projectionMutator=ir,(ta.geo.equirectangular=function(){return ur(ar)}).raw=ar.invert=ar,ta.geo.rotation=function(n){function t(t){return t=n(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t}return n=lr(n[0]%360*Fa,n[1]*Fa,n.length>2?n[2]*Fa:0),t.invert=function(t){return t=n.invert(t[0]*Fa,t[1]*Fa),t[0]*=Ha,t[1]*=Ha,t},t},cr.invert=ar,ta.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=lr(-n[0]*Fa,-n[1]*Fa,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=Ha,n[1]*=Ha}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=gr((t=+r)*Fa,u*Fa),n):t},n.precision=function(r){return arguments.length?(e=gr(t*Fa,(u=+r)*Fa),n):u},n.angle(90)},ta.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Fa,u=n[1]*Fa,i=t[1]*Fa,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),l=Math.cos(u),s=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},ta.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return ta.range(Math.ceil(i/d)*d,u,d).map(h).concat(ta.range(Math.ceil(l/m)*m,c,m).map(g)).concat(ta.range(Math.ceil(r/p)*p,e,p).filter(function(n){return va(n%d)>Ta}).map(s)).concat(ta.range(Math.ceil(a/v)*v,o,v).filter(function(n){return va(n%m)>Ta}).map(f))}var e,r,u,i,o,a,c,l,s,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],l=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[i,l],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,s=vr(a,o,90),f=dr(r,e,y),h=vr(l,c,90),g=dr(i,u,y),n):y},n.majorExtent([[-180,-90+Ta],[180,90-Ta]]).minorExtent([[-180,-80-Ta],[180,80+Ta]])},ta.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=mr,u=yr;return n.distance=function(){return ta.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},ta.geo.interpolate=function(n,t){return Mr(n[0]*Fa,n[1]*Fa,t[0]*Fa,t[1]*Fa)},ta.geo.length=function(n){return $c=0,ta.geo.stream(n,Bc),$c};var $c,Bc={sphere:y,point:y,lineStart:xr,lineEnd:y,polygonStart:y,polygonEnd:y},Wc=br(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(ta.geo.azimuthalEqualArea=function(){return ur(Wc)}).raw=Wc;var Jc=br(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},Et);(ta.geo.azimuthalEquidistant=function(){return ur(Jc)}).raw=Jc,(ta.geo.conicConformal=function(){return Ie(_r)}).raw=_r,(ta.geo.conicEquidistant=function(){return Ie(wr)}).raw=wr;var Gc=br(function(n){return 1/n},Math.atan);(ta.geo.gnomonic=function(){return ur(Gc)}).raw=Gc,Sr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-ja]},(ta.geo.mercator=function(){return kr(Sr)}).raw=Sr;var Kc=br(function(){return 1},Math.asin);(ta.geo.orthographic=function(){return ur(Kc)}).raw=Kc;var Qc=br(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(ta.geo.stereographic=function(){return ur(Qc)}).raw=Qc,Er.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-ja]},(ta.geo.transverseMercator=function(){var n=kr(Er),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Er,ta.geom={},ta.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=kt(e),i=kt(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(zr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var l=Cr(a),s=Cr(c),f=s[0]===l[0],h=s[s.length-1]===l[l.length-1],g=[];for(t=l.length-1;t>=0;--t)g.push(n[a[l[t]][2]]);for(t=+f;t<s.length-h;++t)g.push(n[a[s[t]][2]]);return g}var e=Ar,r=Nr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},ta.geom.polygon=function(n){return xa(n,nl),n};var nl=ta.geom.polygon.prototype=[];nl.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],u=0;++t<e;)n=r,r=this[t],u+=n[1]*r[0]-n[0]*r[1];return.5*u},nl.centroid=function(n){var t,e,r=-1,u=this.length,i=0,o=0,a=this[u-1];for(arguments.length||(n=-1/(6*this.area()));++r<u;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],i+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[i*n,o*n]},nl.clip=function(n){for(var t,e,r,u,i,o,a=Tr(n),c=-1,l=this.length-Tr(this),s=this[l-1];++c<l;){for(t=n.slice(),n.length=0,u=this[c],i=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],qr(o,s,u)?(qr(i,s,u)||n.push(Lr(i,o,s,u)),n.push(o)):qr(i,s,u)&&n.push(Lr(i,o,s,u)),i=o;a&&n.push(n[0]),s=u}return n};var tl,el,rl,ul,il,ol=[],al=[];Or.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(Ir),t.length},Qr.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},nu.prototype={insert:function(n,t){var e,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=uu(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(u=r.R,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.R&&(eu(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ru(this,r))):(u=r.L,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.L&&(ru(this,e),n=e,e=n.U),e.C=!1,r.C=!0,eu(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,u=n.U,i=n.L,o=n.R;if(e=i?o?uu(o):i:o,u?u.L===n?u.L=e:u.R=e:this._=e,i&&o?(r=e.C,e.C=n.C,e.L=i,i.U=e,e!==o?(u=e.U,e.U=n.U,n=e.R,u.L=n,e.R=o,o.U=e):(e.U=u,u=e,n=e.R)):(r=n.C,n=e),n&&(n.U=u),!r){if(n&&n.C)return n.C=!1,void 0;do{if(n===this._)break;if(n===u.L){if(t=u.R,t.C&&(t.C=!1,u.C=!0,eu(this,u),t=u.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,ru(this,t),t=u.R),t.C=u.C,u.C=t.R.C=!1,eu(this,u),n=this._;break}}else if(t=u.L,t.C&&(t.C=!1,u.C=!0,ru(this,u),t=u.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,eu(this,t),t=u.L),t.C=u.C,u.C=t.L.C=!1,ru(this,u),n=this._;break}t.C=!0,n=u,u=u.U}while(!n.C);n&&(n.C=!1)}}},ta.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],u=a[0][1],i=a[1][0],o=a[1][1];return iu(e(n),a).cells.forEach(function(e,a){var c=e.edges,l=e.site,s=t[a]=c.length?c.map(function(n){var t=n.start();return[t.x,t.y]}):l.x>=r&&l.x<=i&&l.y>=u&&l.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];s.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Ta)*Ta,y:Math.round(o(n,t)/Ta)*Ta,i:t}})}var r=Ar,u=Nr,i=r,o=u,a=cl;return n?t(n):(t.links=function(n){return iu(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return iu(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(Ir),c=-1,l=a.length,s=a[l-1].edge,f=s.l===o?s.r:s.l;++c<l;)u=s,i=f,s=a[c].edge,f=s.l===o?s.r:s.l,r<i.i&&r<f.i&&au(o,i,f)<0&&t.push([n[r],n[i.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(i=kt(r=n),t):r},t.y=function(n){return arguments.length?(o=kt(u=n),t):u},t.clipExtent=function(n){return arguments.length?(a=null==n?cl:n,t):a===cl?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===cl?null:a&&a[1]},t)};var cl=[[-1e6,-1e6],[1e6,1e6]];ta.geom.delaunay=function(n){return ta.geom.voronoi().triangles(n)},ta.geom.quadtree=function(n,t,e,r,u){function i(n){function i(n,t,e,r,u,i,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(va(c-e)+va(s-r)<.01)l(n,t,e,r,u,i,o,a);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,u,i,o,a),l(n,t,e,r,u,i,o,a)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,u,i,o,a)}function l(n,t,e,r,u,o,a,c){var l=.5*(u+a),s=.5*(o+c),f=e>=l,h=r>=s,g=h<<1|f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=su()),f?u=l:a=l,h?o=s:c=s,i(n,t,e,r,u,o,a,c)}var s,f,h,g,p,v,d,m,y,M=kt(a),x=kt(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],s.x<v&&(v=s.x),s.y<d&&(d=s.y),s.x>m&&(m=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+M(s=n[g],g),_=+x(s,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=su();if(k.add=function(n){i(k,n,+M(n,++g),+x(n,g),v,d,m,y)},k.visit=function(n){fu(n,k,v,d,m,y)},k.find=function(n){return hu(k,n[0],n[1],v,d,m,y)},g=-1,null==t){for(;++g<p;)i(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=s=null,k}var o,a=Ar,c=Nr;return(o=arguments.length)?(a=cu,c=lu,3===o&&(u=e,r=t,e=t=0),i(n)):(i.x=function(n){return arguments.length?(a=n,i):a},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,e],[r,u]]},i.size=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=e=0,r=+n[0],u=+n[1]),i):null==t?null:[r-t,u-e]},i)},ta.interpolateRgb=gu,ta.interpolateObject=pu,ta.interpolateNumber=vu,ta.interpolateString=du;var ll=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sl=new RegExp(ll.source,"g");ta.interpolate=mu,ta.interpolators=[function(n,t){var e=typeof t;return("string"===e?tc.has(t)||/^(#|rgb\(|hsl\()/.test(t)?gu:du:t instanceof it?gu:Array.isArray(t)?yu:"object"===e&&isNaN(t)?pu:vu)(n,t)}],ta.interpolateArray=yu;var fl=function(){return Et},hl=ta.map({linear:fl,poly:ku,quad:function(){return _u},cubic:function(){return wu},sin:function(){return Eu},exp:function(){return Au},circle:function(){return Nu},elastic:Cu,back:zu,bounce:function(){return qu}}),gl=ta.map({"in":Et,out:xu,"in-out":bu,"out-in":function(n){return bu(xu(n))}});ta.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.slice(0,t):n,r=t>=0?n.slice(t+1):"in";return e=hl.get(e)||fl,r=gl.get(r)||Et,Mu(r(e.apply(null,ea.call(arguments,1))))},ta.interpolateHcl=Lu,ta.interpolateHsl=Tu,ta.interpolateLab=Ru,ta.interpolateRound=Du,ta.transform=function(n){var t=ua.createElementNS(ta.ns.prefix.svg,"g");return(ta.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Pu(e?e.matrix:pl)})(n)},Pu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var pl={a:1,b:0,c:0,d:1,e:0,f:0};ta.interpolateTransform=Hu,ta.layout={},ta.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Iu(n[e]));return t}},ta.layout.chord=function(){function n(){var n,l,f,h,g,p={},v=[],d=ta.range(i),m=[];for(e=[],r=[],n=0,h=-1;++h<i;){for(l=0,g=-1;++g<i;)l+=u[h][g];v.push(l),m.push(ta.range(i)),n+=l}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(u[t][n],u[t][e])})}),n=(Pa-s*i)/n,l=0,h=-1;++h<i;){for(f=l,g=-1;++g<i;){var y=d[h],M=m[y][g],x=u[y][M],b=l,_=l+=x*n;p[y+"-"+M]={index:y,subindex:M,startAngle:b,endAngle:_,value:x}}r[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;++h<i;)for(g=h-1;++g<i;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,u,i,o,a,c,l={},s=0;return l.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,e=r=null,l):u},l.padding=function(n){return arguments.length?(s=n,e=r=null,l):s},l.sortGroups=function(n){return arguments.length?(o=n,e=r=null,l):o},l.sortSubgroups=function(n){return arguments.length?(a=n,e=null,l):a},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},ta.layout.force=function(){function n(n){return function(t,e,r,u){if(t.point!==n){var i=t.cx-n.x,o=t.cy-n.y,a=u-e,c=i*i+o*o;if(c>a*a/d){if(p>c){var l=t.charge/c;n.px-=i*l,n.py-=o*l}return!0}if(t.point&&c&&p>c){var l=t.pointCharge/c;n.px-=i*l,n.py-=o*l}}return!t.charge}}function t(n){n.px=ta.event.x,n.py=ta.event.y,a.resume()}var e,r,u,i,o,a={},c=ta.dispatch("start","tick","end"),l=[1,1],s=.9,f=vl,h=dl,g=-30,p=ml,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,M,x,b=m.length,_=y.length;for(e=0;_>e;++e)a=y[e],f=a.source,h=a.target,M=h.x-f.x,x=h.y-f.y,(p=M*M+x*x)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,M*=p,x*=p,h.x-=M*(d=f.weight/(h.weight+f.weight)),h.y-=x*d,f.x+=M*(d=1-d),f.y+=x*d);if((d=r*v)&&(M=l[0]/2,x=l[1]/2,e=-1,d))for(;++e<b;)a=m[e],a.x+=(M-a.x)*d,a.y+=(x-a.y)*d;if(g)for(Ju(t=ta.geom.quadtree(m),r,o),e=-1;++e<b;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<b;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*s,a.y-=(a.py-(a.py=a.y))*s);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(l=n,a):l},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(s=+n,a):s},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),ta.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;l>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,l=o.length;++a<l;)if(!isNaN(i=o[a][n]))return i;return Math.random()*r}var t,e,r,c=m.length,s=y.length,p=l[0],v=l[1];for(t=0;c>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;s>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;s>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;s>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;s>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;s>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=ta.behavior.drag().origin(Et).on("dragstart.force",Xu).on("drag.force",t).on("dragend.force",$u)),arguments.length?(this.on("mouseover.force",Bu).on("mouseout.force",Wu).call(e),void 0):e},ta.rebind(a,c,"on")};var vl=20,dl=1,ml=1/0;ta.layout.hierarchy=function(){function n(u){var i,o=[u],a=[];for(u.depth=0;null!=(i=o.pop());)if(a.push(i),(l=e.call(n,i,i.depth))&&(c=l.length)){for(var c,l,s;--c>=0;)o.push(s=l[c]),s.parent=i,s.depth=i.depth+1;r&&(i.value=0),i.children=l}else r&&(i.value=+r.call(n,i,i.depth)||0),delete i.children;return Qu(u,function(n){var e,u;t&&(e=n.children)&&e.sort(t),r&&(u=n.parent)&&(u.value+=n.value)}),a}var t=ei,e=ni,r=ti;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Ku(t,function(n){n.children&&(n.value=0)}),Qu(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},ta.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;++l<o;)n(a=i[l],e,c=a.value*r,u),e+=c}}function t(n){var e=n.children,r=0;if(e&&(u=e.length))for(var u,i=-1;++i<u;)r=Math.max(r,t(e[i]));return 1+r}function e(e,i){var o=r.call(this,e,i);return n(o[0],0,u[0],u[1]/t(o[0])),o}var r=ta.layout.hierarchy(),u=[1,1];return e.size=function(n){return arguments.length?(u=n,e):u},Gu(e,r)},ta.layout.pie=function(){function n(o){var a,c=o.length,l=o.map(function(e,r){return+t.call(n,e,r)}),s=+("function"==typeof r?r.apply(this,arguments):r),f=("function"==typeof u?u.apply(this,arguments):u)-s,h=Math.min(Math.abs(f)/c,+("function"==typeof i?i.apply(this,arguments):i)),g=h*(0>f?-1:1),p=(f-c*g)/ta.sum(l),v=ta.range(c),d=[];return null!=e&&v.sort(e===yl?function(n,t){return l[t]-l[n]}:function(n,t){return e(o[n],o[t])}),v.forEach(function(n){d[n]={data:o[n],value:a=l[n],startAngle:s,endAngle:s+=a*p+g,padAngle:h}}),d}var t=Number,e=yl,r=0,u=Pa,i=0;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n.padAngle=function(t){return arguments.length?(i=t,n):i},n};var yl={};ta.layout.stack=function(){function n(a,c){if(!(h=a.length))return a;var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=ta.permute(l,f),s=ta.permute(s,f);var h,g,p,v,d=r.call(n,s,c),m=l[0].length;for(p=0;m>p;++p)for(u.call(n,l[0][p],v=d[p],s[0][p][1]),g=1;h>g;++g)u.call(n,l[g][p],v+=s[g-1][p][1],s[g][p][1]);return a}var t=Et,e=ai,r=ci,u=oi,i=ui,o=ii;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:Ml.get(t)||ai,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:xl.get(t)||ci,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var Ml=ta.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(li),i=n.map(si),o=ta.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],l.push(e)):(c+=i[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return ta.range(n.length).reverse()},"default":ai}),xl=ta.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,u=0;s>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:ci});ta.layout.histogram=function(){function n(n,i){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,i),f=u.call(this,s,l,i),i=-1,h=l.length,g=f.length-1,p=t?1:1/h;++i<g;)o=c[i]=[],o.dx=f[i+1]-(o.x=f[i]),o.y=0;if(g>0)for(i=-1;++i<h;)a=l[i],a>=s[0]&&a<=s[1]&&(o=c[ta.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=pi,u=hi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=kt(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return gi(n,t)}:kt(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},ta.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],l=u[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Qu(a,function(n){n.r=+s(n.value)}),Qu(a,Mi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;Qu(a,function(n){n.r+=f}),Qu(a,Mi),Qu(a,function(n){n.r-=f})}return _i(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=ta.layout.hierarchy().sort(vi),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Gu(n,e)},ta.layout.tree=function(){function n(n,u){var s=o.call(this,n,u),f=s[0],h=t(f);if(Qu(h,e),h.parent.m=-h.z,Ku(h,r),l)Ku(f,i);else{var g=f,p=f,v=f;Ku(f,function(n){n.x<g.x&&(g=n),n.x>p.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=c[0]/(p.x+a(p,g)/2+d),y=c[1]/(v.depth||1);Ku(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return s}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var u,i=t.children,o=0,a=i.length;a>o;++o)r.push((i[o]=u={_:i[o],parent:t,children:(u=i[o].children)&&u.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=u);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Ni(n);var i=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-i):n.z=i}else r&&(n.z=r.z+a(n._,r._));n.parent.A=u(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function u(n,t,e){if(t){for(var r,u=n,i=n,o=t,c=u.parent.children[0],l=u.m,s=i.m,f=o.m,h=c.m;o=Ei(o),u=ki(u),o&&u;)c=ki(c),i=Ei(i),i.a=n,r=o.z+f-u.z-l+a(o._,u._),r>0&&(Ai(Ci(o,n,e),n,r),l+=r,s+=r),f+=o.m,l+=u.m,h+=c.m,s+=i.m;o&&!Ei(i)&&(i.t=o,i.m+=f-s),u&&!ki(c)&&(c.t=u,c.m+=l-h,e=n)}return e}function i(n){n.x*=c[0],n.y=n.depth*c[1]}var o=ta.layout.hierarchy().sort(null).value(null),a=Si,c=[1,1],l=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(l=null==(c=t)?i:null,n):l?null:c},n.nodeSize=function(t){return arguments.length?(l=null==(c=t)?null:i,n):l?c:null},Gu(n,o)},ta.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],l=0;Qu(c,function(n){var t=n.children;t&&t.length?(n.x=qi(t),n.y=zi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Li(c),f=Ti(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return Qu(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=ta.layout.hierarchy().sort(null).value(null),e=Si,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Gu(n,t)},ta.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++u<i;)r=(e=n[u]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,l=f(e),s=[],h=i.slice(),p=1/0,v="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||(a=r(s,v))<=p?(h.pop(),p=a):(s.area-=s.pop().area,u(s,v,l,!1),v=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(u(s,v,l,!0),s.length=s.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);++i<o;)u=n[i],u.x=a,u.y=l,u.dy=s,a+=u.dx=Math.min(e.x+e.dx-a,s?c(u.area/s):0);u.z=!0,u.dx+=e.x+e.dx-a,e.y+=s,e.dy-=s}else{for((r||s>e.dx)&&(s=e.dx);++i<o;)u=n[i],u.x=a,u.y=l,u.dx=s,l+=u.dy=Math.min(e.y+e.dy-l,s?c(u.area/s):0);u.z=!1,u.dy+=e.y+e.dy-l,e.x+=s,e.dx-=s}}function i(r){var u=o||a(r),i=u[0];return i.x=0,i.y=0,i.dx=l[0],i.dy=l[1],o&&a.revalue(i),n([i],i.dx*i.dy/i.value),(o?e:t)(i),h&&(o=u),u}var o,a=ta.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Ri,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(n){return arguments.length?(l=n,i):l},i.padding=function(n){function t(t){var e=n.call(i,t,t.depth);return null==e?Ri(t):Di(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Di(t,n)}if(!arguments.length)return s;var r;return f=null==(s=n)?Ri:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,o=null,i):h
5
- },i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},Gu(i,a)},ta.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=ta.random.normal.apply(ta,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=ta.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},ta.scale={};var bl={floor:Et,ceil:Et};ta.scale.linear=function(){return Yi([0,1],[0,1],mu,!1)};var _l={s:1,g:1,p:1,r:1,e:1};ta.scale.log=function(){return Ji(ta.scale.linear().domain([0,1]),10,!0,[1,10])};var wl=ta.format(".0e"),Sl={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};ta.scale.pow=function(){return Gi(ta.scale.linear(),1,[0,1])},ta.scale.sqrt=function(){return ta.scale.pow().exponent(.5)},ta.scale.ordinal=function(){return Qi([],{t:"range",a:[[]]})},ta.scale.category10=function(){return ta.scale.ordinal().range(kl)},ta.scale.category20=function(){return ta.scale.ordinal().range(El)},ta.scale.category20b=function(){return ta.scale.ordinal().range(Al)},ta.scale.category20c=function(){return ta.scale.ordinal().range(Nl)};var kl=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(yt),El=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(yt),Al=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(yt),Nl=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(yt);ta.scale.quantile=function(){return no([],[])},ta.scale.quantize=function(){return to(0,1,[0,1])},ta.scale.threshold=function(){return eo([.5],[0,1])},ta.scale.identity=function(){return ro([0,1])},ta.svg={},ta.svg.arc=function(){function n(){var n=Math.max(0,+e.apply(this,arguments)),l=Math.max(0,+r.apply(this,arguments)),s=o.apply(this,arguments)-ja,f=a.apply(this,arguments)-ja,h=Math.abs(f-s),g=s>f?0:1;if(n>l&&(p=l,l=n,n=p),h>=Ua)return t(l,g)+(n?t(n,1-g):"")+"Z";var p,v,d,m,y,M,x,b,_,w,S,k,E=0,A=0,N=[];if((m=(+c.apply(this,arguments)||0)/2)&&(d=i===Cl?Math.sqrt(n*n+l*l):+i.apply(this,arguments),g||(A*=-1),l&&(A=nt(d/l*Math.sin(m))),n&&(E=nt(d/n*Math.sin(m)))),l){y=l*Math.cos(s+A),M=l*Math.sin(s+A),x=l*Math.cos(f-A),b=l*Math.sin(f-A);var C=Math.abs(f-s-2*A)<=Da?0:1;if(A&&so(y,M,x,b)===g^C){var z=(s+f)/2;y=l*Math.cos(z),M=l*Math.sin(z),x=b=null}}else y=M=0;if(n){_=n*Math.cos(f-E),w=n*Math.sin(f-E),S=n*Math.cos(s+E),k=n*Math.sin(s+E);var q=Math.abs(s-f+2*E)<=Da?0:1;if(E&&so(_,w,S,k)===1-g^q){var L=(s+f)/2;_=n*Math.cos(L),w=n*Math.sin(L),S=k=null}}else _=w=0;if((p=Math.min(Math.abs(l-n)/2,+u.apply(this,arguments)))>.001){v=l>n^g?0:1;var T=null==S?[_,w]:null==x?[y,M]:Lr([y,M],[S,k],[x,b],[_,w]),R=y-T[0],D=M-T[1],P=x-T[0],U=b-T[1],j=1/Math.sin(Math.acos((R*P+D*U)/(Math.sqrt(R*R+D*D)*Math.sqrt(P*P+U*U)))/2),F=Math.sqrt(T[0]*T[0]+T[1]*T[1]);if(null!=x){var H=Math.min(p,(l-F)/(j+1)),O=fo(null==S?[_,w]:[S,k],[y,M],l,H,g),Y=fo([x,b],[_,w],l,H,g);p===H?N.push("M",O[0],"A",H,",",H," 0 0,",v," ",O[1],"A",l,",",l," 0 ",1-g^so(O[1][0],O[1][1],Y[1][0],Y[1][1]),",",g," ",Y[1],"A",H,",",H," 0 0,",v," ",Y[0]):N.push("M",O[0],"A",H,",",H," 0 1,",v," ",Y[0])}else N.push("M",y,",",M);if(null!=S){var I=Math.min(p,(n-F)/(j-1)),Z=fo([y,M],[S,k],n,-I,g),V=fo([_,w],null==x?[y,M]:[x,b],n,-I,g);p===I?N.push("L",V[0],"A",I,",",I," 0 0,",v," ",V[1],"A",n,",",n," 0 ",g^so(V[1][0],V[1][1],Z[1][0],Z[1][1]),",",1-g," ",Z[1],"A",I,",",I," 0 0,",v," ",Z[0]):N.push("L",V[0],"A",I,",",I," 0 0,",v," ",Z[0])}else N.push("L",_,",",w)}else N.push("M",y,",",M),null!=x&&N.push("A",l,",",l," 0 ",C,",",g," ",x,",",b),N.push("L",_,",",w),null!=S&&N.push("A",n,",",n," 0 ",q,",",1-g," ",S,",",k);return N.push("Z"),N.join("")}function t(n,t){return"M0,"+n+"A"+n+","+n+" 0 1,"+t+" 0,"+-n+"A"+n+","+n+" 0 1,"+t+" 0,"+n}var e=io,r=oo,u=uo,i=Cl,o=ao,a=co,c=lo;return n.innerRadius=function(t){return arguments.length?(e=kt(t),n):e},n.outerRadius=function(t){return arguments.length?(r=kt(t),n):r},n.cornerRadius=function(t){return arguments.length?(u=kt(t),n):u},n.padRadius=function(t){return arguments.length?(i=t==Cl?Cl:kt(t),n):i},n.startAngle=function(t){return arguments.length?(o=kt(t),n):o},n.endAngle=function(t){return arguments.length?(a=kt(t),n):a},n.padAngle=function(t){return arguments.length?(c=kt(t),n):c},n.centroid=function(){var n=(+e.apply(this,arguments)+ +r.apply(this,arguments))/2,t=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-ja;return[Math.cos(t)*n,Math.sin(t)*n]},n};var Cl="auto";ta.svg.line=function(){return ho(Et)};var zl=ta.map({linear:go,"linear-closed":po,step:vo,"step-before":mo,"step-after":yo,basis:So,"basis-open":ko,"basis-closed":Eo,bundle:Ao,cardinal:bo,"cardinal-open":Mo,"cardinal-closed":xo,monotone:To});zl.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var ql=[0,2/3,1/3,0],Ll=[0,1/3,2/3,0],Tl=[0,1/6,2/3,1/6];ta.svg.line.radial=function(){var n=ho(Ro);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},mo.reverse=yo,yo.reverse=mo,ta.svg.area=function(){return Do(Et)},ta.svg.area.radial=function(){var n=Do(Ro);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},ta.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+u(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)-ja,s=l.call(n,u,r)-ja;return{r:i,a0:o,a1:s,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(s),i*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Da)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=mr,o=yr,a=Po,c=ao,l=co;return n.radius=function(t){return arguments.length?(a=kt(t),n):a},n.source=function(t){return arguments.length?(i=kt(t),n):i},n.target=function(t){return arguments.length?(o=kt(t),n):o},n.startAngle=function(t){return arguments.length?(c=kt(t),n):c},n.endAngle=function(t){return arguments.length?(l=kt(t),n):l},n},ta.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=mr,e=yr,r=Uo;return n.source=function(e){return arguments.length?(t=kt(e),n):t},n.target=function(t){return arguments.length?(e=kt(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},ta.svg.diagonal.radial=function(){var n=ta.svg.diagonal(),t=Uo,e=n.projection;return n.projection=function(n){return arguments.length?e(jo(t=n)):t},n},ta.svg.symbol=function(){function n(n,r){return(Rl.get(t.call(this,n,r))||Oo)(e.call(this,n,r))}var t=Ho,e=Fo;return n.type=function(e){return arguments.length?(t=kt(e),n):t},n.size=function(t){return arguments.length?(e=kt(t),n):e},n};var Rl=ta.map({circle:Oo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Pl)),e=t*Pl;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Dl),e=t*Dl/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Dl),e=t*Dl/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});ta.svg.symbolTypes=Rl.keys();var Dl=Math.sqrt(3),Pl=Math.tan(30*Fa);ka.transition=function(n){for(var t,e,r=Ul||++Ol,u=Xo(n),i=[],o=jl||{time:Date.now(),ease:Su,delay:0,duration:250},a=-1,c=this.length;++a<c;){i.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(e=l[s])&&$o(e,s,u,r,o),t.push(e)}return Io(i,u,r)},ka.interrupt=function(n){return this.each(null==n?Fl:Yo(Xo(n)))};var Ul,jl,Fl=Yo(Xo()),Hl=[],Ol=0;Hl.call=ka.call,Hl.empty=ka.empty,Hl.node=ka.node,Hl.size=ka.size,ta.transition=function(n,t){return n&&n.transition?Ul?n.transition(t):n:Na.transition(n)},ta.transition.prototype=Hl,Hl.select=function(n){var t,e,r,u=this.id,i=this.namespace,o=[];n=k(n);for(var a=-1,c=this.length;++a<c;){o.push(t=[]);for(var l=this[a],s=-1,f=l.length;++s<f;)(r=l[s])&&(e=n.call(r,r.__data__,s,a))?("__data__"in r&&(e.__data__=r.__data__),$o(e,s,i,u,r[i][u]),t.push(e)):t.push(null)}return Io(o,i,u)},Hl.selectAll=function(n){var t,e,r,u,i,o=this.id,a=this.namespace,c=[];n=E(n);for(var l=-1,s=this.length;++l<s;)for(var f=this[l],h=-1,g=f.length;++h<g;)if(r=f[h]){i=r[a][o],e=n.call(r,r.__data__,h,l),c.push(t=[]);for(var p=-1,v=e.length;++p<v;)(u=e[p])&&$o(u,p,a,o,i),t.push(u)}return Io(c,a,o)},Hl.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=j(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Io(u,this.namespace,this.id)},Hl.tween=function(n,t){var e=this.id,r=this.namespace;return arguments.length<2?this.node()[r][e].tween.get(n):H(this,null==t?function(t){t[r][e].tween.remove(n)}:function(u){u[r][e].tween.set(n,t)})},Hl.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Hu:mu,a=ta.ns.qualify(n);return Zo(this,"attr."+n,t,a.local?i:u)},Hl.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=ta.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Hl.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=oa.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=mu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Zo(this,"style."+n,t,u)},Hl.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,oa.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Hl.text=function(n){return Zo(this,"text",n,Vo)},Hl.remove=function(){var n=this.namespace;return this.each("end.transition",function(){var t;this[n].count<2&&(t=this.parentNode)&&t.removeChild(this)})},Hl.ease=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].ease:("function"!=typeof n&&(n=ta.ease.apply(ta,arguments)),H(this,function(r){r[e][t].ease=n}))},Hl.delay=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].delay:H(this,"function"==typeof n?function(r,u,i){r[e][t].delay=+n.call(r,r.__data__,u,i)}:(n=+n,function(r){r[e][t].delay=n}))},Hl.duration=function(n){var t=this.id,e=this.namespace;return arguments.length<1?this.node()[e][t].duration:H(this,"function"==typeof n?function(r,u,i){r[e][t].duration=Math.max(1,n.call(r,r.__data__,u,i))}:(n=Math.max(1,n),function(r){r[e][t].duration=n}))},Hl.each=function(n,t){var e=this.id,r=this.namespace;if(arguments.length<2){var u=jl,i=Ul;try{Ul=e,H(this,function(t,u,i){jl=t[r][e],n.call(t,t.__data__,u,i)})}finally{jl=u,Ul=i}}else H(this,function(u){var i=u[r][e];(i.event||(i.event=ta.dispatch("start","end","interrupt"))).on(n,t)});return this},Hl.transition=function(){for(var n,t,e,r,u=this.id,i=++Ol,o=this.namespace,a=[],c=0,l=this.length;l>c;c++){a.push(n=[]);for(var t=this[c],s=0,f=t.length;f>s;s++)(e=t[s])&&(r=e[o][u],$o(e,s,o,i,{time:r.time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration})),n.push(e)}return Io(a,o,i)},ta.svg.axis=function(){function n(n){n.each(function(){var n,l=ta.select(this),s=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):Et:t,p=l.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ta),d=ta.transition(p.exit()).style("opacity",Ta).remove(),m=ta.transition(p.order()).style("opacity",1),y=Math.max(u,0)+o,M=Ui(f),x=l.selectAll(".domain").data([0]),b=(x.enter().append("path").attr("class","domain"),ta.transition(x));v.append("line"),v.append("text");var _,w,S,k,E=v.select("line"),A=m.select("line"),N=p.select("text").text(g),C=v.select("text"),z=m.select("text"),q="top"===r||"left"===r?-1:1;if("bottom"===r||"top"===r?(n=Bo,_="x",S="y",w="x2",k="y2",N.attr("dy",0>q?"0em":".71em").style("text-anchor","middle"),b.attr("d","M"+M[0]+","+q*i+"V0H"+M[1]+"V"+q*i)):(n=Wo,_="y",S="x",w="y2",k="x2",N.attr("dy",".32em").style("text-anchor",0>q?"end":"start"),b.attr("d","M"+q*i+","+M[0]+"H0V"+M[1]+"H"+q*i)),E.attr(k,q*u),C.attr(S,q*y),A.attr(w,0).attr(k,q*u),z.attr(_,0).attr(S,q*y),f.rangeBand){var L=f,T=L.rangeBand()/2;s=f=function(n){return L(n)+T}}else s.rangeBand?s=f:d.call(n,f,s);v.call(n,s,f),m.call(n,f,f)})}var t,e=ta.scale.linear(),r=Yl,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Il?t+"":Yl,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Yl="bottom",Il={top:1,right:1,bottom:1,left:1};ta.svg.brush=function(){function n(i){i.each(function(){var i=ta.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,Et);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Zl[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var s,f=ta.transition(i),h=ta.transition(o);c&&(s=Ui(c),h.attr("x",s[0]).attr("width",s[1]-s[0]),e(f)),l&&(s=Ui(l),h.attr("y",s[0]).attr("height",s[1]-s[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",s[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1]-s[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==ta.event.keyCode&&(N||(y=null,z[0]-=s[1],z[1]-=f[1],N=2),b())}function p(){32==ta.event.keyCode&&2==N&&(z[0]+=s[1],z[1]+=f[1],N=0,b())}function v(){var n=ta.mouse(x),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),N||(ta.event.altKey?(y||(y=[(s[0]+s[1])/2,(f[0]+f[1])/2]),z[0]=s[+(n[0]<y[0])],z[1]=f[+(n[1]<y[1])]):y=null),E&&d(n,c,0)&&(e(S),u=!0),A&&d(n,l,1)&&(r(S),u=!0),u&&(t(S),w({type:"brush",mode:N?"move":"resize"}))}function d(n,t,e){var r,u,a=Ui(t),c=a[0],l=a[1],p=z[e],v=e?f:s,d=v[1]-v[0];return N&&(c-=p,l-=d+p),r=(e?g:h)?Math.max(c,Math.min(l,n[e])):n[e],N?u=(r+=p)+d:(y&&(p=Math.max(c,Math.min(l,2*y[e]-r))),r>p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function m(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),ta.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),C(),w({type:"brushend"})}var y,M,x=this,_=ta.select(ta.event.target),w=a.of(x,arguments),S=ta.select(x),k=_.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&l,N=_.classed("extent"),C=X(),z=ta.mouse(x),q=ta.select(oa).on("keydown.brush",u).on("keyup.brush",p);if(ta.event.changedTouches?q.on("touchmove.brush",v).on("touchend.brush",m):q.on("mousemove.brush",v).on("mouseup.brush",m),S.interrupt().selectAll("*").interrupt(),N)z[0]=s[0]-z[0],z[1]=f[0]-z[1];else if(k){var L=+/w$/.test(k),T=+/^n/.test(k);M=[s[1-L]-z[0],f[1-T]-z[1]],z[0]=s[L],z[1]=f[T]}else ta.event.altKey&&(y=z.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),ta.select("body").style("cursor",_.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=w(n,"brushstart","brush","brushend"),c=null,l=null,s=[0,0],f=[0,0],h=!0,g=!0,p=Vl[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:s,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,Ul?ta.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,s=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=yu(s,t.x),r=yu(f,t.y);return i=o=null,function(u){s=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=Vl[!c<<1|!l],n):c},n.y=function(t){return arguments.length?(l=t,p=Vl[!c<<1|!l],n):l},n.clamp=function(t){return arguments.length?(c&&l?(h=!!t[0],g=!!t[1]):c?h=!!t:l&&(g=!!t),n):c&&l?[h,g]:c?h:l?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],l&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=s[0]||r!=s[1])&&(s=[e,r])),l&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],l.invert&&(u=l(u),a=l(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=s[0],r=s[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),l&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],l.invert&&(u=l.invert(u),a=l.invert(a)),u>a&&(h=u,u=a,a=h))),c&&l?[[e,u],[r,a]]:c?[e,r]:l&&[u,a])},n.clear=function(){return n.empty()||(s=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&s[0]==s[1]||!!l&&f[0]==f[1]},ta.rebind(n,a,"on")};var Zl={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Vl=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Xl=fc.format=mc.timeFormat,$l=Xl.utc,Bl=$l("%Y-%m-%dT%H:%M:%S.%LZ");Xl.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Jo:Bl,Jo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Jo.toString=Bl.toString,fc.second=Ft(function(n){return new hc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),fc.seconds=fc.second.range,fc.seconds.utc=fc.second.utc.range,fc.minute=Ft(function(n){return new hc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),fc.minutes=fc.minute.range,fc.minutes.utc=fc.minute.utc.range,fc.hour=Ft(function(n){var t=n.getTimezoneOffset()/60;return new hc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),fc.hours=fc.hour.range,fc.hours.utc=fc.hour.utc.range,fc.month=Ft(function(n){return n=fc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),fc.months=fc.month.range,fc.months.utc=fc.month.utc.range;var Wl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Jl=[[fc.second,1],[fc.second,5],[fc.second,15],[fc.second,30],[fc.minute,1],[fc.minute,5],[fc.minute,15],[fc.minute,30],[fc.hour,1],[fc.hour,3],[fc.hour,6],[fc.hour,12],[fc.day,1],[fc.day,2],[fc.week,1],[fc.month,1],[fc.month,3],[fc.year,1]],Gl=Xl.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ne]]),Kl={range:function(n,t,e){return ta.range(Math.ceil(n/e)*e,+t,e).map(Ko)},floor:Et,ceil:Et};Jl.year=fc.year,fc.scale=function(){return Go(ta.scale.linear(),Jl,Gl)};var Ql=Jl.map(function(n){return[n[0].utc,n[1]]}),ns=$l.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ne]]);Ql.year=fc.year.utc,fc.scale.utc=function(){return Go(ta.scale.linear(),Ql,ns)},ta.text=At(function(n){return n.responseText}),ta.json=function(n,t){return Nt(n,"application/json",Qo,t)},ta.html=function(n,t){return Nt(n,"text/html",na,t)},ta.xml=At(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(ta):"object"==typeof module&&module.exports&&(module.exports=ta),this.d3=ta}();
 
 
 
 
 
inc/js/sucuri-scanner.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function sucuriscan_alert_close(b){var a=document.getElementById("sucuriscan-alert-"+b);a.parentNode.removeChild(a)}jQuery(document).ready(function(c){c(".sucuriscan-modal-btn").on("click",function(e){e.preventDefault();var f=c(this).data("modalid");c("div."+f).removeClass("sucuriscan-hidden")});c(".sucuriscan-overlay, .sucuriscan-modal-close").on("click",function(e){e.preventDefault();c(".sucuriscan-overlay").addClass("sucuriscan-hidden");c(".sucuriscan-modal").addClass("sucuriscan-hidden")});if(c(".sucuriscan-tabs").length){var d="sucuriscan-hidden";var b="sucuriscan-tab-active";var a=location.href.split("#")[1];c(".sucuriscan-tabs > ul a").on("click",function(k){k.preventDefault();var h=c(this);var j=h.data("tabname");var f=c(".sucuriscan-tab-containers > #sucuriscan-"+j);if(f.length){var g=location.href.replace(location.hash,"");var i=g+"#"+j;window.history.pushState({},document.title,i);c(".sucuriscan-tabs > ul a").removeClass(b);c(".sucuriscan-tab-containers > div").addClass(d);h.addClass(b);f.removeClass(d)}});c(".sucuriscan-tab-containers > div").addClass(d);if(a!=undefined){c(".sucuriscan-tabs > ul li a").each(function(e,f){if(c(f).data("tabname")==a){c(f).trigger("click")}})}else{c(".sucuriscan-tabs > ul li:first-child a").trigger("click")}}c("#sucuriscan-corefiles-show").on("click",function(h){h.preventDefault();var f=c(this);var g=f.data("action");if(g=="show"){c(".sucuriscan-corefiles thead tr:last-child, .sucuriscan-corefiles tbody > tr").removeClass("sucuriscan-hidden");f.html("Hide files").data("action","hide")}else{c(".sucuriscan-corefiles thead tr:last-child, .sucuriscan-corefiles tbody > tr").addClass("sucuriscan-hidden");f.html("Show files").data("action","show")}});c("#sucuriscan_last_days").on("change",function(){c(this).closest("form").submit()})});
inc/js/sucuriscan-scripts.js DELETED
@@ -1,80 +0,0 @@
1
- /**
2
- * Sucuri Security - SiteCheck Malware Scanner
3
- * Copyright (C) 2010-2015 Sucuri Security - http://sucuri.net
4
- * Released under the GPL - see LICENSE file for details.
5
- */
6
-
7
- function sucuriscan_alert_close(id){
8
- var element = document.getElementById('sucuriscan-alert-'+id);
9
- element.parentNode.removeChild(element);
10
- }
11
-
12
- jQuery(document).ready(function($){
13
- $('.sucuriscan-modal-btn').on('click', function(ev){
14
- ev.preventDefault();
15
- var modalid = $(this).data('modalid');
16
- $('div.' + modalid).removeClass('sucuriscan-hidden');
17
- });
18
-
19
- $('.sucuriscan-overlay, .sucuriscan-modal-close').on('click', function(ev){
20
- ev.preventDefault();
21
- $('.sucuriscan-overlay').addClass('sucuriscan-hidden');
22
- $('.sucuriscan-modal').addClass('sucuriscan-hidden');
23
- });
24
-
25
- if( $('.sucuriscan-tabs').length ){
26
- var hidden_class = 'sucuriscan-hidden';
27
- var active_class = 'sucuriscan-tab-active';
28
- var anchor = location.href.split('#')[1];
29
-
30
- $('.sucuriscan-tabs > ul a').on('click', function(e){
31
- e.preventDefault();
32
-
33
- var button = $(this);
34
- var container_id = button.data('tabname');
35
- var container = $('.sucuriscan-tab-containers > #sucuriscan-'+container_id);
36
-
37
- if( container.length ){
38
- var current_href = location.href.replace(location.hash, '');
39
- var new_location_href = current_href + '#' + container_id;
40
- window.history.pushState( {}, document.title, new_location_href );
41
-
42
- $('.sucuriscan-tabs > ul a').removeClass(active_class);
43
- $('.sucuriscan-tab-containers > div').addClass(hidden_class);
44
- button.addClass(active_class);
45
- container.removeClass(hidden_class)
46
- }
47
- });
48
-
49
- $('.sucuriscan-tab-containers > div').addClass(hidden_class);
50
-
51
- if( anchor != undefined ){
52
- $('.sucuriscan-tabs > ul li a').each(function(i, el){
53
- if( $(el).data('tabname') == anchor ){
54
- $(el).trigger('click');
55
- }
56
- });
57
- } else {
58
- $('.sucuriscan-tabs > ul li:first-child a').trigger('click');
59
- }
60
- }
61
-
62
- $('#sucuriscan-corefiles-show').on('click', function(e){
63
- e.preventDefault();
64
-
65
- var this_button = $(this);
66
- var action = this_button.data('action');
67
-
68
- if( action == 'show' ){
69
- $('.sucuriscan-corefiles thead tr:last-child, .sucuriscan-corefiles tbody > tr').removeClass('sucuriscan-hidden');
70
- this_button.html('Hide files').data('action', 'hide');
71
- } else {
72
- $('.sucuriscan-corefiles thead tr:last-child, .sucuriscan-corefiles tbody > tr').addClass('sucuriscan-hidden');
73
- this_button.html('Show files').data('action', 'show');
74
- }
75
- });
76
-
77
- $('#sucuriscan_last_days').on('change', function(){
78
- $(this).closest('form').submit();
79
- });
80
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/tpl/base.html.tpl CHANGED
@@ -25,66 +25,7 @@
25
 
26
  </div>
27
 
28
- <div class="sucuriscan-sidebar sucuriscan-%%SUCURI.AdsVisibility%%">
29
-
30
- <div class="sucuriscan-ad sucuriscan-ad-firewall">
31
- <div class="sucuriscan-clearfix">
32
- <div class="sucuriscan-pull-left">
33
- <h3>Do you want to</h3>
34
- <h4>Stop Hackers?</h4>
35
- </div>
36
- <div class="sucuriscan-pull-right">
37
- <img src="%%SUCURI.SucuriURL%%/inc/images/cloudproxy-logo-x42.png" alt="CloudProxy WAF" />
38
- </div>
39
- </div>
40
-
41
- <a href="http://goo.gl/9sD2sh" target="_blank" class="sucuriscan-ad-btn">Protect Your Website Today</a>
42
-
43
- <div class="sucuriscan-ad-footer">
44
- <ul>
45
- <li>Sucuri CloudProxy Firewall</li>
46
- <li class="featured">Stopping 33M+ attacks a month</li>
47
- <li>Web Application Firewall Protection</li>
48
- <li>Virtual Website Patching</li>
49
- <li>Cloud Intrusion Prevention System</li>
50
- <li>High Security Website Monitoring</li>
51
- <li>Malicious Traffic Filtering</li>
52
- </ul>
53
- </div>
54
- </div>
55
-
56
- <div class="sucuriscan-ad sucuriscan-ad-antivirus">
57
- <div class="sucuriscan-clearfix">
58
- <h3>Have you been hacked?</h3>
59
- <h4>Blacklisted by Google?</h4>
60
- </div>
61
-
62
- <a href="http://goo.gl/vEwZq6" target="_blank" class="sucuriscan-ad-btn">Get Clean Today</a>
63
-
64
- <div class="sucuriscan-ad-footer sucuriscan-clearfix">
65
- <div class="sucuriscan-pull-left">
66
- <ul>
67
- <li>Sucuri Antivirus</li>
68
- <li class="featured">Servicing 250k+ domains</li>
69
- <li class="featured">Cleaning 300+ websites a day</li>
70
- </ul>
71
- </div>
72
- <div class="sucuriscan-pull-right">
73
- <img src="%%SUCURI.SucuriURL%%/inc/images/antivirus-logo-x42.png" alt="Sucuri Antivirus" />
74
- </div>
75
- </div>
76
-
77
- <a href="https://sucuri.net/" target="_blank" class="sucuriscan-ad-website">
78
- <img src="%%SUCURI.SucuriURL%%/inc/images/sucuri-website.png" alt="Sucuri Website" />
79
- </a>
80
- </div>
81
-
82
- <iframe src="https://www.youtube-nocookie.com/embed/EVa9FY3nKuQ" height="250" class="sucuriscan-scanner-video" allowfullscreen></iframe>
83
-
84
- <a href="https://wordpress.org/support/plugin/sucuri-scanner" target="_blank"
85
- class="button button-primary sucuriscan-supportbtn">Visit Support Forum</a>
86
-
87
- </div>
88
 
89
  </div>
90
 
25
 
26
  </div>
27
 
28
+ %%SUCURI.PageSidebarContent%%
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
  </div>
31
 
inc/tpl/bsidebar.html.tpl ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="sucuriscan-sidebar sucuriscan-%%SUCURI.AdsVisibility%%">
3
+
4
+ <div class="sucuriscan-ad sucuriscan-ad-firewall">
5
+ <div class="sucuriscan-clearfix">
6
+ <div class="sucuriscan-pull-left">
7
+ <h3>Do you want to</h3>
8
+ <h4>Stop Hackers?</h4>
9
+ </div>
10
+ <div class="sucuriscan-pull-right">
11
+ <img src="%%SUCURI.SucuriURL%%/inc/images/cloudproxy-logo-x42.png" alt="CloudProxy WAF" />
12
+ </div>
13
+ </div>
14
+
15
+ <a href="http://goo.gl/9sD2sh" target="_blank" class="sucuriscan-ad-btn">Protect Your Website Today</a>
16
+
17
+ <div class="sucuriscan-ad-footer">
18
+ <ul>
19
+ <li>Sucuri CloudProxy Firewall</li>
20
+ <li class="featured">Stopping 33M+ attacks a month</li>
21
+ <li>Web Application Firewall Protection</li>
22
+ <li>Virtual Website Patching</li>
23
+ <li>Cloud Intrusion Prevention System</li>
24
+ <li>High Security Website Monitoring</li>
25
+ <li>Malicious Traffic Filtering</li>
26
+ </ul>
27
+ </div>
28
+ </div>
29
+
30
+ <div class="sucuriscan-ad sucuriscan-ad-antivirus">
31
+ <div class="sucuriscan-clearfix">
32
+ <h3>Have you been hacked?</h3>
33
+ <h4>Blacklisted by Google?</h4>
34
+ </div>
35
+
36
+ <a href="http://goo.gl/vEwZq6" target="_blank" class="sucuriscan-ad-btn">Get Clean Today</a>
37
+
38
+ <div class="sucuriscan-ad-footer sucuriscan-clearfix">
39
+ <div class="sucuriscan-pull-left">
40
+ <ul>
41
+ <li>Sucuri Antivirus</li>
42
+ <li class="featured">Servicing 250k+ domains</li>
43
+ <li class="featured">Cleaning 300+ websites a day</li>
44
+ </ul>
45
+ </div>
46
+ <div class="sucuriscan-pull-right">
47
+ <img src="%%SUCURI.SucuriURL%%/inc/images/antivirus-logo-x42.png" alt="Sucuri Antivirus" />
48
+ </div>
49
+ </div>
50
+
51
+ <a href="https://sucuri.net/" target="_blank" class="sucuriscan-ad-website">
52
+ <img src="%%SUCURI.SucuriURL%%/inc/images/sucuri-website.png" alt="Sucuri Website" />
53
+ </a>
54
+ </div>
55
+
56
+ <iframe src="https://www.youtube-nocookie.com/embed/EVa9FY3nKuQ" height="250" class="sucuriscan-scanner-video" allowfullscreen></iframe>
57
+
58
+ <a href="https://wordpress.org/support/plugin/sucuri-scanner" target="_blank"
59
+ class="button button-primary sucuriscan-supportbtn">Visit Support Forum</a>
60
+
61
+ <form action="%%SUCURI.URL.Settings%%" method="post">
62
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
63
+ <input type="hidden" name="sucuriscan_ads_visibility" value="disable" />
64
+ <button type="submit" class="button-link sucuriscan-hide-ads">Hide this column</button>
65
+ </form>
66
+
67
+ </div>
inc/tpl/hardening-panel.html.tpl ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div id="poststuff">
3
+ <form method="post">
4
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
5
+ <input type="hidden" name="sucuriscan_run_hardening" value="1" />
6
+
7
+ %%SUCURI.Hardening.Version%%
8
+
9
+ %%SUCURI.Hardening.CloudProxy%%
10
+
11
+ %%SUCURI.Hardening.RemoveGenerator%%
12
+
13
+ %%SUCURI.Hardening.NginxPhpFpm%%
14
+
15
+ %%SUCURI.Hardening.Upload%%
16
+
17
+ %%SUCURI.Hardening.WpContent%%
18
+
19
+ %%SUCURI.Hardening.WpIncludes%%
20
+
21
+ %%SUCURI.Hardening.PhpVersion%%
22
+
23
+ %%SUCURI.Hardening.SecretKeys%%
24
+
25
+ %%SUCURI.Hardening.Readme%%
26
+
27
+ %%SUCURI.Hardening.AdminUser%%
28
+
29
+ %%SUCURI.Hardening.FileEditor%%
30
+
31
+ %%SUCURI.Hardening.DBTables%%
32
+
33
+ %%SUCURI.Hardening.ErrorLog%%
34
+ </form>
35
+ </div>
inc/tpl/hardening-whitelist.html.tpl ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div id="poststuff" class="sucuriscan-hardening-whitelist">
3
+ <div class="postbox sucuriscan-border sucuriscan-table-description">
4
+ <h3>Whitelist Blocked PHP Files</h3>
5
+
6
+ <div class="inside">
7
+ <p>
8
+ After you apply the hardening in either the includes, content, and/or upload
9
+ directories the plugin will add a rule in the access control file to deny access
10
+ to any PHP file located in these folders, this is a good precaution in case that
11
+ an attacker is able to upload a shell script; with a few exceptions the
12
+ <em>"index.php"</em> is the only one that should be publicly accessible, however
13
+ many theme/plugin developers decide to use these folders to process some
14
+ operations, in this case applying the hardening <strong>may break</strong> their
15
+ functionality.
16
+ </p>
17
+
18
+ <div class="sucuriscan-inline-alert-info">
19
+ <p>
20
+ Note that whitelisted files are global inside the selected directory, this means
21
+ that if you whitelist a file named <em>"thumbnail.php"</em> it will match every
22
+ file with the same name in all the sub-folders. If you want something more
23
+ specific read the <a href="https://httpd.apache.org/docs/2.4/mod/core.html"
24
+ target="_blank">official documentation</a>.
25
+ </p>
26
+ </div>
27
+
28
+ <div class="sucuriscan-inline-alert-warning">
29
+ <p>
30
+ Be warned that whitelisting a PHP file with vulnerabilities will open security
31
+ holes in your website that can be exploited by malicious users. If you do not
32
+ fully understand the purpose of this form and/or do not know what whitelisting
33
+ a PHP file means then ask for support in the <a target="_blank"
34
+ href="https://wordpress.org/support/plugin/sucuri-scanner">forums</a>.
35
+ </p>
36
+ </div>
37
+
38
+ <form action="%%SUCURI.URL.Hardening%%#whitelist" method="post">
39
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
40
+
41
+ <div class="sucuriscan-clearfix">
42
+ <div class="sucuriscan-pull-left">
43
+ <label>Whitelist PHP file:</label>
44
+ </div>
45
+ <div class="sucuriscan-pull-left">
46
+ <input type="text" name="sucuriscan_hardening_whitelist" placeholder="e.g. wp-tinymce.php" />
47
+ </div>
48
+ <div class="sucuriscan-pull-left">
49
+ <select name="sucuriscan_hardening_folder">
50
+ <option value="wp-includes">wp-includes</option>
51
+ <option value="wp-content">wp-content</option>
52
+ <option value="wp-content/uploads">wp-content/uploads</option>
53
+ </select>
54
+ </div>
55
+ <div class="sucuriscan-pull-left">
56
+ <button type="submit" class="button button-primary">Proceed</button>
57
+ </div>
58
+ </div>
59
+ </form>
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <form action="%%SUCURI.URL.Hardening%%#whitelist" method="post">
65
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
66
+
67
+ <table class="wp-list-table widefat sucuriscan-table sucuriscan-hardening-whitelist-table">
68
+ <thead>
69
+ <th class="manage-column column-cb check-column">
70
+ <label class="screen-reader-text" for="cb-select-all-1">Select All</label>
71
+ <input id="cb-select-all-1" type="checkbox">
72
+ </th>
73
+ <th class="manage-column">Filename</th>
74
+ <th class="manage-column">Base Directory</th>
75
+ <th class="manage-column">Regular Expression</th>
76
+ </thead>
77
+
78
+ <tbody>
79
+ %%SUCURI.HardeningWhitelist.List%%
80
+
81
+ <tr class="sucuriscan-%%SUCURI.HardeningWhitelist.NoItemsVisibility%%">
82
+ <td colspan="4">
83
+ <em>List is empty.</em>
84
+ </td>
85
+ </tr>
86
+ </tbody>
87
+
88
+ <tfoot>
89
+ <tr>
90
+ <td colspan="4">
91
+ <button type="submit" class="button button-primary">Delete</button>
92
+ </td>
93
+ </tr>
94
+ </tfoot>
95
+ </table>
96
+ </form>
inc/tpl/hardening-whitelist.snippet.tpl ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ <tr class="%%SUCURI.HardeningWhitelist.CssClass%%">
3
+ <td class="check-column">
4
+ <input type="checkbox" name="sucuriscan_hardening_rmfwhite[]" value="%%SUCURI.HardeningWhitelist.Regexp%%" />
5
+ </td>
6
+ <td>%%SUCURI.HardeningWhitelist.File%%</td>
7
+ <td>%%SUCURI.HardeningWhitelist.Folder%%</td>
8
+ <td><span class="sucuriscan-monospace sucuriscan-wraptext">%%SUCURI.HardeningWhitelist.Regexp%%</span></td>
9
+ </tr>
inc/tpl/hardening.html.tpl CHANGED
@@ -1,39 +1,21 @@
1
 
2
- <div id="poststuff">
3
-
4
- <form method="post">
5
-
6
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
7
- <input type="hidden" name="sucuriscan_run_hardening" value="1" />
8
-
9
- %%SUCURI.Hardening.Version%%
10
-
11
- %%SUCURI.Hardening.CloudProxy%%
12
-
13
- %%SUCURI.Hardening.RemoveGenerator%%
14
-
15
- %%SUCURI.Hardening.NginxPhpFpm%%
16
-
17
- %%SUCURI.Hardening.Upload%%
18
-
19
- %%SUCURI.Hardening.WpContent%%
20
-
21
- %%SUCURI.Hardening.WpIncludes%%
22
-
23
- %%SUCURI.Hardening.PhpVersion%%
24
-
25
- %%SUCURI.Hardening.SecretKeys%%
26
-
27
- %%SUCURI.Hardening.Readme%%
28
-
29
- %%SUCURI.Hardening.AdminUser%%
30
-
31
- %%SUCURI.Hardening.FileEditor%%
32
-
33
- %%SUCURI.Hardening.DBTables%%
34
-
35
- %%SUCURI.Hardening.ErrorLog%%
36
-
37
- </form>
38
-
39
  </div>
1
 
2
+ <div class="sucuriscan-tabs">
3
+ <ul>
4
+ <li>
5
+ <a href="#" data-tabname="hardening">Hardening Options</a>
6
+ </li>
7
+ <li>
8
+ <a href="#" data-tabname="whitelist">Whitelist Blocked PHP Files</a>
9
+ </li>
10
+ </ul>
11
+
12
+ <div class="sucuriscan-tab-containers">
13
+ <div id="sucuriscan-hardening">
14
+ %%SUCURI.Hardening.Panel%%
15
+ </div>
16
+
17
+ <div id="sucuriscan-whitelist">
18
+ %%SUCURI.Hardening.Whitelist%%
19
+ </div>
20
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  </div>
inc/tpl/integrity-auditlogs.html.tpl CHANGED
@@ -15,7 +15,7 @@
15
 
16
  <tr>
17
  <th>&nbsp;</th>
18
- <th width="160">Date</th>
19
  <th>Username</th>
20
  <th>IP Address</th>
21
  <th>Event Message</th>
15
 
16
  <tr>
17
  <th>&nbsp;</th>
18
+ <th width="170">Date</th>
19
  <th>Username</th>
20
  <th>IP Address</th>
21
  <th>Event Message</th>
inc/tpl/integrity-corefiles.html.tpl CHANGED
@@ -14,12 +14,12 @@
14
 
15
  <div class="inside">
16
  <p>
17
- Error retrieving the WordPress core hashes. The information used by the plugin
18
- to determine the integrity of the core files is retrieved and controlled by
19
- WordPress. Any error message related with this tool is likely related with a
20
- modification in their API service that is not supported yet. It is also possible
21
- that your website is not able to communicate with this server due to a missing
22
- HTTP transport tool.
23
  </p>
24
  </div>
25
  </div>
@@ -58,7 +58,7 @@
58
  </th>
59
  <th width="80" class="manage-column">Status</th>
60
  <th width="100" class="manage-column">File Size</th>
61
- <th width="170" class="manage-column">Modified At</th>
62
  <th class="manage-column">File Path</th>
63
  </tr>
64
  </thead>
14
 
15
  <div class="inside">
16
  <p>
17
+ Error retrieving the <a href="%%SUCURI.CoreFiles.RemoteChecksumsURL%%" target="_blank">
18
+ WordPress core hashes</a>. The information used by the plugin to determine the
19
+ integrity of the core files is retrieved and controlled by WordPress. Any error
20
+ message related with this tool is likely related with a modification in their
21
+ API service that is not supported yet. It is also possible that your website is
22
+ not able to communicate with this server due to a missing HTTP transport tool.
23
  </p>
24
  </div>
25
  </div>
58
  </th>
59
  <th width="80" class="manage-column">Status</th>
60
  <th width="100" class="manage-column">File Size</th>
61
+ <th width="180" class="manage-column">Modified At</th>
62
  <th class="manage-column">File Path</th>
63
  </tr>
64
  </thead>
inc/tpl/integrity-corefiles.snippet.tpl CHANGED
@@ -1,10 +1,8 @@
1
 
2
  <tr class="%%SUCURI.CoreFiles.CssClass%% sucuriscan-hidden">
3
  <td class="check-column">
4
- <input type="checkbox" name="sucuriscan_integrity_files[]"
5
- value="%%SUCURI.CoreFiles.FilePath%%" %%SUCURI.CoreFiles.IsFixtableFile%% />
6
- <input type="hidden" name="sucuriscan_integrity_types[]"
7
- value="%%SUCURI.CoreFiles.StatusType%%" %%SUCURI.CoreFiles.IsFixtableFile%% />
8
  </td>
9
  <td><span class="sucuriscan-label sucuriscan-label-%%SUCURI.CoreFiles.StatusType%%">%%SUCURI.CoreFiles.StatusType%%</span></td>
10
  <td><em title="%%SUCURI.CoreFiles.FileSizeNumber%% bytes">~%%SUCURI.CoreFiles.FileSizeHuman%%</em></td>
1
 
2
  <tr class="%%SUCURI.CoreFiles.CssClass%% sucuriscan-hidden">
3
  <td class="check-column">
4
+ <input type="checkbox" name="sucuriscan_integrity_files[]" value="%%SUCURI.CoreFiles.FilePath%%" />
5
+ <input type="hidden" name="sucuriscan_integrity_types[]" value="%%SUCURI.CoreFiles.StatusType%%" %%SUCURI.CoreFiles.IsFixtableFile%% />
 
 
6
  </td>
7
  <td><span class="sucuriscan-label sucuriscan-label-%%SUCURI.CoreFiles.StatusType%%">%%SUCURI.CoreFiles.StatusType%%</span></td>
8
  <td><em title="%%SUCURI.CoreFiles.FileSizeNumber%% bytes">~%%SUCURI.CoreFiles.FileSizeHuman%%</em></td>
inc/tpl/lastlogins-all.snippet.tpl CHANGED
@@ -2,7 +2,7 @@
2
  <tr class="%%SUCURI.UserList.CssClass%%">
3
  <td>%%SUCURI.UserList.Number%%</td>
4
  <td>%%SUCURI.UserList.Displayname%% (%%SUCURI.UserList.Username%%)</td>
5
- <td><span class="sucuriscan-ellipsis sucuriscan-monospace" title="%%SUCURI.UserList.RemoteAddr%%">%%SUCURI.UserList.RemoteAddr%%</span></td>
6
  <td><span class="sucuriscan-ellipsis" title="%%SUCURI.UserList.Hostname%%">%%SUCURI.UserList.Hostname%%</span></td>
7
  <td><span title="%%SUCURI.UserList.Datetime%%">%%SUCURI.UserList.TimeAgo%%</span></td>
8
  <td><a href="%%SUCURI.UserList.UserURL%%" target="_blank">Edit</a></td>
2
  <tr class="%%SUCURI.UserList.CssClass%%">
3
  <td>%%SUCURI.UserList.Number%%</td>
4
  <td>%%SUCURI.UserList.Displayname%% (%%SUCURI.UserList.Username%%)</td>
5
+ <td><span class="sucuriscan-monospace">%%SUCURI.UserList.RemoteAddr%%</span></td>
6
  <td><span class="sucuriscan-ellipsis" title="%%SUCURI.UserList.Hostname%%">%%SUCURI.UserList.Hostname%%</span></td>
7
  <td><span title="%%SUCURI.UserList.Datetime%%">%%SUCURI.UserList.TimeAgo%%</span></td>
8
  <td><a href="%%SUCURI.UserList.UserURL%%" target="_blank">Edit</a></td>
inc/tpl/malwarescan-resmalware.html.tpl CHANGED
@@ -16,6 +16,22 @@
16
 
17
  <tbody>
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  %%SUCURI.MalwarePayloadList%%
20
 
21
  <tr class="sucuriscan-%%SUCURI.NoMalwareRowVisibility%%">
16
 
17
  <tbody>
18
 
19
+ <tr>
20
+ <td colspan="3">
21
+ <p>
22
+ To reduce the bandwidth consumption and the amount of HTTP requests sent by your
23
+ website to the SiteCheck API service this plugin will cache the results of every
24
+ scan for <strong>%%SUCURI.CacheLifeTime%% seconds</strong>. If you want to get
25
+ fresh results after modifications suggested by the scanner then go to the <a
26
+ href="%%SUCURI.URL.Settings%%#settings-scanner">scanner settings</a> page and
27
+ click the button in front of the label <em>"Reset sitecheck logs"</em>, then
28
+ come back to this page and run a new malware scan. Note that SiteCheck may cache
29
+ the results of the scan as well in its own server and there is no way you can
30
+ refresh that information from this plugin, in this case you have to be patient.
31
+ </p>
32
+ </td>
33
+ </tr>
34
+
35
  %%SUCURI.MalwarePayloadList%%
36
 
37
  <tr class="sucuriscan-%%SUCURI.NoMalwareRowVisibility%%">
inc/tpl/settings-apirecovery.html.tpl ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="sucuriscan-clearfix">
3
+ <p>
4
+ If this operation was successful you will receive a message in the email used
5
+ during the registration of the API key <em>(usually the email of the main admin
6
+ user)</em>, this message contains the key in plain text, copy and paste the key
7
+ in the form field below. The plugin will verify the authenticity of the key
8
+ sending an initial HTTP request to the API service, if this fails the key will
9
+ be removed automatically and you will have to start the process all over again.
10
+ </p>
11
+
12
+ <p>
13
+ There are cases where this operation can fail, an example would be when the
14
+ email address is not associated with the domain anymore, this happens when the
15
+ base URL changes <em>(from www to none or viceversa)</em>. There is also a limit
16
+ on the number of recovery attempts that you may request during certain period of
17
+ time, if you are having issues recovering the key please send an email explaining
18
+ the situation to <a href="mailto:info@sucuri.net">info@sucuri.net</a>
19
+ </p>
20
+
21
+ <form action="%%SUCURI.URL.Settings%%" method="post">
22
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
23
+ <span class="sucuriscan-input-group">
24
+ <label>Plugin API Key:</label>
25
+ <input type="text" name="sucuriscan_manual_api_key" class="input-text" />
26
+ </span>
27
+ <button type="submit" class="button-primary">Proceed</button>
28
+ </form>
29
+ </div>
inc/tpl/settings-apiregistered.html.tpl CHANGED
@@ -10,6 +10,16 @@
10
  and better posture, all with the intent of reducing risk.
11
  </p>
12
 
13
- <a href="%%SUCURI.URL.Home%%" class="button button-primary">Go to the dashboard</a>
 
 
 
 
 
 
 
 
 
 
14
  </div>
15
  </div>
10
  and better posture, all with the intent of reducing risk.
11
  </p>
12
 
13
+ <div class="sucuriscan-inline-alert-warning">
14
+ <p>
15
+ <b>WARNING:</b> It is very important that you go to the settings page and
16
+ configure the plugin to work in certain way following the configuration of the
17
+ server where your website is being hosted; do not ignore this or else you may
18
+ end up affecting the performance of your website.
19
+ </p>
20
+ </div>
21
+
22
+ <a href="%%SUCURI.URL.Home%%" class="button button-primary">Dashboard</a>
23
+ <a href="%%SUCURI.URL.Settings%%" class="button button-primary">Settings</a>
24
  </div>
25
  </div>
inc/tpl/settings-general-apikey.html.tpl ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ %%SUCURI.ModalWhenAPIRegistered%%
3
+
4
+ %%SUCURI.ModalForApiKeyRecovery%%
5
+
6
+ <div class="postbox">
7
+ <h3>Plugin API Key</h3>
8
+
9
+ <div class="inside">
10
+ <p>
11
+ Most of the tools in this plugin can be used without a specific configuration,
12
+ but the core features <strong>require an API key</strong> to communicate with
13
+ the Sucuri services. The key is generated using your administrator e-mail and
14
+ the domain of this site, this will allow you to have access to our free
15
+ monitoring tool and other extra features.
16
+ </p>
17
+
18
+ <div class="sucuriscan-inline-alert-info">
19
+ <p>
20
+
21
+ Generating an API key implies that you agree to send the information collected
22
+ by the plugin to the Sucuri API service which is a remote server where the
23
+ information for the audit logs is stored, this is to prevent malicious users to
24
+ delete the logs during an attack which may affect an investigation if you
25
+ suspect that your website was hacked. We also use this information to display <a
26
+ href="https://sucuri.net/security-reports/brute-force/" target="_blank">statistics
27
+ </a> and try to use the data in an anonymous way as we are concerned about your
28
+ privacy too. Please do not generate an API key if you do not agree with this,
29
+ you can keep using the plugin without it anyway.
30
+ </p>
31
+ </div>
32
+
33
+ <div class="sucuriscan-inline-alert-warning sucuriscan-%%SUCURI.InvalidDomainVisibility%%">
34
+ <p>
35
+ Your domain <code>%%SUCURI.CleanDomain%%</code> does not seems to have a DNS
36
+ <code>A</code> record so it will be considered as <em>invalid</em> by the API
37
+ interface when you request the generation of a new key. Adding <code>www</code>
38
+ at the beginning of the domain name may fix this issue. If you do not understand
39
+ what is this then send an email to our support team requesting the key.
40
+ </p>
41
+ </div>
42
+
43
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-0 sucuriscan-%%SUCURI.APIKey.RecoverVisibility%%">
44
+ <div class="sucuriscan-monospace">Plugin API Key: %%SUCURI.APIKey%%</div>
45
+ <form action="%%SUCURI.URL.Settings%%" method="post">
46
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
47
+ <button type="submit" name="sucuriscan_recover_key" class="button-primary">Recover</button>
48
+ </form>
49
+ </div>
50
+
51
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-1 sucuriscan-%%SUCURI.APIKey.RemoveVisibility%%">
52
+ <div class="sucuriscan-monospace">Plugin API Key: ec456e75e9e5ad48577da3382b627a42</div>
53
+ <form action="%%SUCURI.URL.Settings%%" method="post">
54
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
55
+ <button type="submit" name="sucuriscan_remove_api_key" class="button-primary button-danger">Remove</button>
56
+ </form>
57
+ </div>
58
+ </div>
59
+ </div>
inc/tpl/settings-general-apiproxy.html.tpl ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>API Communication via Proxy</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ All the HTTP requests used to communicate with the API service are being sent
8
+ using the WordPress built-in functions, so <em>(almost)</em> all its official
9
+ features are inherited, this is useful if you need to pass these HTTP requests
10
+ through a proxy. According to the <a href="http://codex.wordpress.org/HTTP_API"
11
+ target="_blank">official documentation</a> you have to add some constants to the
12
+ main configuration file: <em>WP_PROXY_HOST, WP_PROXY_PORT, WP_PROXY_USERNAME,
13
+ WP_PROXY_PASSWORD</em>.
14
+ </p>
15
+
16
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2 sucuriscan-monospace">
17
+ <div>HTTP Proxy Hostname: %%SUCURI.APIProxy.Host%%</div>
18
+ <div>HTTP Proxy Port num: %%SUCURI.APIProxy.Port%%</div>
19
+ <div>HTTP Proxy Username: %%SUCURI.APIProxy.Username%%</div>
20
+ <div>HTTP Proxy Password: <span class="sucuriscan-label-%%SUCURI.APIProxy.PasswordType%%">%%SUCURI.APIProxy.PasswordText%%</span></div>
21
+ </div>
22
+ </div>
23
+ </div>
inc/tpl/settings-general-apissl.html.tpl ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>API Request and SSL</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ SSL is a cryptographic protocols designed to provide communications security
8
+ over a computer network. The primary goal of the TLS protocol <em>(and its
9
+ predecessor SSL - Secure Sockets Layer)</em> is to provide privacy and data
10
+ integrity between two communicating computer applications. When you have this
11
+ option enabled <em>(by default)</em> it forces the plugin to send the HTTP
12
+ requests to the API service via TLS.
13
+ </p>
14
+
15
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-%%SUCURI.VerifySSLCertCssClass%%">
16
+ <span>%%SUCURI.VerifySSLCert%%</span>
17
+ </div>
18
+
19
+ <p>
20
+ Either because the SSL certificate of the API service has expired or because the
21
+ HTTP transport protocol offered by your hosting provider does not supports SSL
22
+ you may want to deactivate this option, but be aware that <a target="_blank"
23
+ href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack">MITM attacks</a>
24
+ can take advantage of this to steal information from your website.
25
+ </p>
26
+
27
+ <form action="%%SUCURI.URL.Settings%%" method="post">
28
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
29
+ <span class="sucuriscan-input-group">
30
+ <label>SSL Certificate Verification:</label>
31
+ <select name="sucuriscan_verify_ssl_cert">
32
+ %%SUCURI.VerifySSLCertOptions%%
33
+ </select>
34
+ </span>
35
+ <button type="submit" class="button-primary">Proceed</button>
36
+ </form>
37
+ </div>
38
+ </div>
inc/tpl/settings-general-apitimeout.html.tpl ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>API Request Timeout</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ The plugin sends the data of events triggered by WordPress when it considers
8
+ the action is suspicious, it sends this information via HTTP requests using
9
+ <a href="https://developer.wordpress.org/reference/functions/wp_remote_post/"
10
+ target="_blank">built-in functions</a> provided by WordPress and waits some
11
+ seconds <em>(90 by default)</em> to get a response.
12
+ </p>
13
+
14
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
15
+ <span>Wait <b>%%SUCURI.RequestTimeout%%</b> before timeout</span>
16
+ </div>
17
+
18
+ <p>
19
+ If you start experiencing issues related with the timeout of the requests
20
+ you may consider to increase the number of seconds to wait for the response.
21
+ You may also want to check with your hosting provider to see if there is
22
+ something in the server blocking the connection.
23
+ </p>
24
+
25
+ <form action="%%SUCURI.URL.Settings%%" method="post">
26
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
27
+ <span class="sucuriscan-input-group">
28
+ <label>HTTP Request Timeout (in secs)</label>
29
+ <input type="text" name="sucuriscan_request_timeout" class="input-text" />
30
+ </span>
31
+ <button type="submit" class="button-primary">Proceed</button>
32
+ </form>
33
+ </div>
34
+ </div>
inc/tpl/settings-general-commentmonitor.html.tpl ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>User Comment Monitor</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ User comments are the main source of spam in WordPress websites, this option
8
+ enables the monitoring of data sent via the comment forms loaded in every page
9
+ and post. Remember that the plugin sends this information to the Sucuri servers
10
+ so if you do not agree with this you must keep this option disabled. Among the
11
+ data included in the report for each comment there are identifiers of the post
12
+ and user account <em>(usually null for guest comments)</em>, the IP address of
13
+ the author, the email address of the author, the user-agent of the web browser
14
+ used by the author to create the comment, the current date, the status which
15
+ usually falls under the category of not approved, and the message itself.
16
+ </p>
17
+
18
+ <div class="sucuriscan-inline-alert-info">
19
+ <p>
20
+ We also use this information in an anonymous way to generate <a target="_blank"
21
+ href="https://sucuri.net/security-reports/brute-force/">statistics</a> of usage
22
+ that help us improve our service.
23
+ </p>
24
+ </div>
25
+
26
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
27
+ <span>User Comment Monitor is %%SUCURI.CommentMonitorStatus%%</span>
28
+
29
+ <form action="%%SUCURI.URL.Settings%%" method="post">
30
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
31
+ <input type="hidden" name="sucuriscan_comment_monitor" value="%%SUCURI.CommentMonitorSwitchValue%%" />
32
+ <button type="submit" class="button-primary %%SUCURI.CommentMonitorSwitchCssClass%%">
33
+ %%SUCURI.CommentMonitorSwitchText%%
34
+ </button>
35
+ </form>
36
+ </div>
37
+ </div>
38
+ </div>
inc/tpl/settings-general-datastorage.html.tpl ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>Plugin Data Storage Path</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ This is the directory where the plugin will store the security logs, the list of
8
+ files marked as fixed in the core integrity tool, the cache for the malware
9
+ scanner and 3rd-party plugin metadata. The directory is blocked from public
10
+ visibility if <strong>and only if</strong> the site is being hosted by the
11
+ Apache web server. Additionally, every PHP file has an exit point in its header
12
+ to prevent the content to be printed.
13
+ </p>
14
+
15
+ <div class="sucuriscan-inline-alert-warning">
16
+ <p>
17
+ Note that the virtual protection added by the plugin to these files is not bullet
18
+ proof, it may be bypassed and depending on the configuration of the server it may
19
+ leak information, but this is better than to store the data in the database and
20
+ wait for a SQL injection to be used to attack the rest of the site.
21
+ </p>
22
+ </div>
23
+
24
+ <div class="sucuriscan-inline-alert-info">
25
+ <p>
26
+ There are some entries in the options table that will be moved to a plain text
27
+ file during the development of the next version of the plugin, this is part of
28
+ a plan to include a way to import and export the settings of this extension to
29
+ other sites in an easy way. This is necessary as importing data into a database
30
+ may open security holes <em>(depending on how the code is written)</em> to reduce
31
+ the risk we will use plain text files which makes things a bit safer.
32
+ </p>
33
+ </div>
34
+
35
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
36
+ <span class="sucuriscan-monospace">%%SUCURI.DatastorePath%%</span>
37
+ </div>
38
+
39
+ <p>
40
+ Some people may prefer to use a folder that is not in the document root of the
41
+ website to add another layer of protection to the data, feel free to change this
42
+ path if you want, make sure to use absolute paths.
43
+ </p>
44
+
45
+ <form action="%%SUCURI.URL.Settings%%" method="post">
46
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
47
+ <span class="sucuriscan-input-group">
48
+ <label>Data storage path:</label>
49
+ <input type="text" name="sucuriscan_datastore_path" class="input-text" />
50
+ </span>
51
+ <button type="submit" class="button-primary">Proceed</button>
52
+ </form>
53
+ </div>
54
+ </div>
inc/tpl/settings-general-ipdiscoverer.html.tpl ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>IP Address Discoverer</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ The IP address discoverer will use DNS lookups to automatically detect if the
8
+ website is behind <a href="https://sucuri.net/website-firewall/"
9
+ target="_blank">CloudProxy</a> in which case will modify the global server
10
+ variable <em>Remote-Addr</em> to set the real IP of the website's visitors. This
11
+ check runs on every WordPress init action and that is why it may slow down your
12
+ website as some hosting providers rely on slow DNS servers which makes the
13
+ operation take more time than it should.
14
+ </p>
15
+
16
+ <div class="sucuriscan-inline-alert-warning">
17
+ <p>
18
+ <b>IMPORTANT:</b> This option <em>(if enabled)</em> may slow down your website.
19
+ </p>
20
+ </div>
21
+
22
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
23
+ <span>IP Address Discoverer is %%SUCURI.DnsLookupsStatus%%</span>
24
+
25
+ <form action="%%SUCURI.URL.Settings%%" method="post">
26
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
27
+ <input type="hidden" name="sucuriscan_dns_lookups" value="%%SUCURI.DnsLookupsSwitchValue%%" />
28
+ <button type="submit" class="button-primary %%SUCURI.DnsLookupsSwitchCssClass%%">
29
+ %%SUCURI.DnsLookupsSwitchText%%
30
+ </button>
31
+ </form>
32
+ </div>
33
+
34
+ <p>
35
+ If you are experiencing issues with the automatic detection of IP address of
36
+ your visitors, with the security logs, or with the response time of your website
37
+ please send an email to <a href="mailto:info@sucuri.net">info@sucuri.net</a>
38
+ explaining the situation and attach the information displayed below, this may
39
+ help to troubleshoot the issue more easily; alternatively you may also ask for
40
+ help in the forums.
41
+ </p>
42
+
43
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2 sucuriscan-monospace">
44
+ <div>CloudProxy is %%SUCURI.IsUsingCloudProxy%%</div>
45
+ <div>Website URL: %%SUCURI.WebsiteURL%%</div>
46
+ <div>Top Level Domain: %%SUCURI.TopLevelDomain%%</div>
47
+ <div>Website Hostname: %%SUCURI.WebsiteHostName%%</div>
48
+ <div>Website Host Address: %%SUCURI.WebsiteHostAddress%%</div>
49
+ <div>IP Address: %%SUCURI.RemoteAddress%% (%%SUCURI.RemoteAddressHeader%%)</div>
50
+ </div>
51
+ </div>
52
+ </div>
inc/tpl/settings-general-pwdcollector.html.tpl ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>Failed Login Password Collector</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ <b>Please do not enable this option</b> unless you understand the consequences.
8
+ The plugin monitors all the user login attempts, when an user authentication
9
+ succeeds it logs the event and sends an alert to the administrator if the option
10
+ is enabled. Same thing happens for failed login attempts with two extra features:
11
+ you can opt to send a summary of all the failed logins occured during the same
12
+ hour and/or force the plugin to collect the password used in every authentication
13
+ attempt to see if the attackers are getting close to your real password or not.
14
+ </p>
15
+
16
+ <div class="sucuriscan-inline-alert-warning">
17
+ <p>
18
+ You must be careful with this option as it will also log the attempts that you
19
+ <em>(as a legitimate user)</em> send, if by mistake you mistype a character in
20
+ the password the plugin will log this and it will be sent to the Sucuri servers.
21
+ If a malicious user gets access to your API key or your security logs he/she will
22
+ know the mistyped password and will use it to improve his attacks against your
23
+ website.
24
+ </p>
25
+ </div>
26
+
27
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
28
+ <span>Failed Login Password Collector is %%SUCURI.PwdCollectorStatus%%</span>
29
+
30
+ <form action="%%SUCURI.URL.Settings%%" method="post">
31
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
32
+ <input type="hidden" name="sucuriscan_collect_wrong_passwords" value="%%SUCURI.PwdCollectorSwitchValue%%" />
33
+ <button type="submit" class="button-primary %%SUCURI.PwdCollectorSwitchCssClass%%">
34
+ %%SUCURI.PwdCollectorSwitchText%%
35
+ </button>
36
+ </form>
37
+ </div>
38
+ </div>
39
+ </div>
inc/tpl/settings-general-resetoptions.html.tpl ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>Reset Options</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ This action will delete all the entries inserted by the plugin in the options
8
+ table of the current database, including the API key. Make sure that you
9
+ understand the consequences of this operation before you proceed, this can not
10
+ be reverted and you may lose access to the data that was already collected by
11
+ the plugin. This will also revert the hardening applied in the WordPress core
12
+ directories, but not the hardening applied to other parts of the site as they
13
+ can not be easily reverted, refer to the hardening page for more information.
14
+ </p>
15
+
16
+ <p>
17
+ The information stored in the security logs will be deleted as well, but the
18
+ information that was previously sent to the API service will remain untouched
19
+ as there is no easy way to guarantee that this action is not being requested
20
+ by a malicious user looking for a way to hide his fingerprints after an attack.
21
+ If you are the real owner of this website and want to delete the information
22
+ stored in the Sucuri servers then send an email to our support team and we may
23
+ consider the case.
24
+ </p>
25
+
26
+ <form action="%%SUCURI.URL.Settings%%" method="post">
27
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
28
+ <p>
29
+ <label>
30
+ <input type="hidden" name="sucuriscan_process_form" value="0" />
31
+ <input type="checkbox" name="sucuriscan_process_form" value="1" />
32
+ <span>I understand that this operation can not be reverted.</span>
33
+ </label>
34
+ </p>
35
+ <button type="submit" name="sucuriscan_reset_options" class="button-primary button-danger">Reset Everything</button>
36
+ </form>
37
+ </div>
38
+ </div>
inc/tpl/settings-general-reverseproxy.html.tpl ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>Reverse Proxy and IP Address</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ The event monitor uses the API address of the origin of the request to track the
8
+ actions, the plugin uses two methods to retrieve this: the main method uses the
9
+ global server variable <em>Remote-Addr</em> available in most modern web
10
+ servers, an alternative method uses custom HTTP headers <em>(which are unsafe by
11
+ default)</em>. You should not worry about this option unless you know what a
12
+ reverse proxy is.
13
+ </p>
14
+
15
+ <p>
16
+ Services like <a href="https://sucuri.net/website-firewall/" target="_blank">
17
+ CloudProxy</a> once active forces the network traffic to pass through them to
18
+ filter any security threat that may affect the original server. A side effect
19
+ of this is that the real IP address is no longer available in the global server
20
+ variable <em>Remote-Addr</em> but in a custom HTTP header with a name provided
21
+ by the service. CloudProxy uses <em>"X-Sucuri-ClientIP"</em>, CloudFlare uses
22
+ <em>"CF-Connecting-IP"</em>, others use <em>"X-Forwarded-For"</em>.
23
+ </p>
24
+
25
+ <div class="sucuriscan-inline-alert-warning">
26
+ <p>
27
+ When this option is enabled the plugin will go through a list of common HTTP
28
+ headers to retrieve the real IP address of the origin of the requests. Note
29
+ that this information can be spoofed and malicious people may use this to
30
+ hide their real IP during an attack. You must not enable this option unless
31
+ you are completely sure that your site is behind a proxy/firewall.
32
+ </p>
33
+ </div>
34
+
35
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
36
+ <span>Reverse Proxy Support is %%SUCURI.ReverseProxyStatus%%</span>
37
+
38
+ <form action="%%SUCURI.URL.Settings%%" method="post">
39
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
40
+ <input type="hidden" name="sucuriscan_revproxy" value="%%SUCURI.ReverseProxySwitchValue%%" />
41
+ <button type="submit" class="button-primary %%SUCURI.ReverseProxySwitchCssClass%%">
42
+ %%SUCURI.ReverseProxySwitchText%%
43
+ </button>
44
+ </form>
45
+ </div>
46
+ </div>
47
+ </div>
inc/tpl/settings-general-xhrmonitor.html.tpl ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div class="postbox">
3
+ <h3>XML HTTP Request Monitor</h3>
4
+
5
+ <div class="inside">
6
+ <p>
7
+ Ajax <em>(also known as XHR)</em> is a set of web development techniques
8
+ utilizing many web technologies used on the client-side to create asynchronous
9
+ Web applications. With Ajax, web applications can send data to and retrieve from
10
+ a server asynchronously <em>(in the background)</em> without interfering with
11
+ the display and behavior of the existing page. Data can be retrieved using the
12
+ <em>XMLHttpRequest</em> object.
13
+ </p>
14
+
15
+ <p>
16
+ Ajax requests can be vulnerable to CSRF and many other attacks depending on the
17
+ way the code is written, many web developers use this technique to offer a non-
18
+ blocking interface in their themes and extensions which are later distributed on
19
+ the Internet, their code is not audited and people end up installing things in
20
+ their websites with security holes which are later exploited by malicious users.
21
+ </p>
22
+
23
+ <div class="sucuriscan-inline-alert-warning">
24
+ <p>
25
+ It is possible that the response time of your website gets affected after the
26
+ activation of this option, this is due to the way Ajax works and how WordPress
27
+ processes the requests. Keep this option disabled if you experience issues
28
+ related with the load time of the external pages or the administration
29
+ dashboard.
30
+ </p>
31
+ </div>
32
+
33
+ <div class="sucuriscan-hstatus sucuriscan-hstatus-2">
34
+ <span>User Comment Monitor is %%SUCURI.XhrMonitorStatus%%</span>
35
+
36
+ <form action="%%SUCURI.URL.Settings%%" method="post">
37
+ <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
38
+ <input type="hidden" name="sucuriscan_xhr_monitor" value="%%SUCURI.XhrMonitorSwitchValue%%" />
39
+ <button type="submit" class="button-primary %%SUCURI.XhrMonitorSwitchCssClass%%">
40
+ %%SUCURI.XhrMonitorSwitchText%%
41
+ </button>
42
+ </form>
43
+ </div>
44
+ </div>
45
+ </div>
inc/tpl/settings-general.html.tpl CHANGED
@@ -1,90 +1,30 @@
1
 
2
- %%SUCURI.ModalWhenAPIRegistered%%
 
3
 
4
- <table class="wp-list-table widefat sucuriscan-table sucuriscan-striped-table sucuriscan-settings">
5
- <thead>
6
- <tr>
7
- <th colspan="3" class="thead-with-button">
8
- <span>General Settings</span>
9
- <form action="%%SUCURI.URL.Settings%%" method="post" class="thead-topright-action">
10
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
11
- <button type="submit" name="sucuriscan_reset_options" class="button-primary">Reset plugin options</button>
12
- </form>
13
- </th>
14
- </tr>
15
- </thead>
16
 
17
- <tbody>
18
 
19
- <tr>
20
- <td colspan="3">
21
- <p>
22
- Most of the tools in this plugin can be used without a specific configuration,
23
- but the core features <strong>require an API key</strong> to communicate with
24
- the Sucuri services. The key is generated using your administrator e-mail and
25
- the domain of this site, this will allow you to have access to our free
26
- monitoring tool forever even if you remove the API key and generate it again.
27
- </p>
28
 
29
- <div class="sucuriscan-inline-alert-info">
30
- <p>
31
- All the HTTP requests used to communicate with the API service are being sent
32
- using the WordPress built-in functions, so <em>(almost)</em> all its official
33
- features are inherited, this is useful if you need to pass these HTTP requests
34
- through a proxy. According to the <a href="http://codex.wordpress.org/HTTP_API"
35
- target="_blank">official documentation</a> you have to add some constants to the
36
- main configuration file: <em>WP_PROXY_HOST, WP_PROXY_PORT, WP_PROXY_USERNAME,
37
- WP_PROXY_PASSWORD</em>.
38
- </p>
39
- </div>
40
 
41
- <div class="sucuriscan-inline-alert-warning sucuriscan-%%SUCURI.InvalidDomainVisibility%%">
42
- <p>
43
- Your domain <code>%%SUCURI.CleanDomain%%</code> does not seems to have a DNS
44
- <code>A</code> record so it will be considered as <em>invalid</em> by the API
45
- interface when you request the generation of a new key. Adding <code>www</code>
46
- at the beginning of the domain name may fix this issue.
47
- </p>
48
- </div>
49
- </td>
50
- </tr>
51
 
52
- <tr>
53
- <td width="200">Sucuri API key</td>
54
- <td>
55
- <span class="sucuriscan-monospace">%%SUCURI.APIKey%%</span>
56
- </td>
57
- <td width="350" class="td-with-button">
58
- <form action="%%SUCURI.URL.Settings%%" method="post" class="sucuriscan-%%SUCURI.APIKey.RecoverVisibility%%">
59
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
60
- <button type="submit" name="sucuriscan_recover_key" class="button-primary">Recover</button>
61
- </form>
62
 
63
- <form action="%%SUCURI.URL.Settings%%" method="post" class="sucuriscan-%%SUCURI.APIKey.ManualKeyFormVisibility%%">
64
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
65
- <input type="text" name="sucuriscan_manual_api_key" class="input-text" placeholder="API key sent to your email" />
66
- <button type="submit" class="button-primary">Save</button>
67
- </form>
68
 
69
- <form action="%%SUCURI.URL.Settings%%" method="post" class="sucuriscan-%%SUCURI.APIKey.RemoveVisibility%%">
70
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
71
- <button type="submit" name="sucuriscan_remove_api_key" class="button-primary button-danger">Remove</button>
72
- </form>
73
- </td>
74
- </tr>
75
 
76
- <tr>
77
- <td>Log storage path</td>
78
- <td class="sucuriscan-wraptext"><span class="sucuriscan-monospace" title="%%SUCURI.DatastorePath%%">%%SUCURI.DatastorePath%%</span></td>
79
- <td class="td-with-button">
80
- <form action="%%SUCURI.URL.Settings%%" method="post">
81
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
82
- <input type="text" name="sucuriscan_datastore_path" class="input-text" placeholder="Directory to save logs..." />
83
- <button type="submit" class="button-primary">Change</button>
84
- </form>
85
- </td>
86
- </tr>
87
 
 
 
 
 
 
88
  <tr>
89
  <td>Test email alerts</td>
90
  <td><em>(Test ability to send email alerts)</em></td>
@@ -137,109 +77,6 @@
137
  </td>
138
  </tr>
139
 
140
- <tr>
141
- <td>API request with SSL</td>
142
- <td>%%SUCURI.VerifySSLCert%%</td>
143
- <td class="td-with-button">
144
- <form action="%%SUCURI.URL.Settings%%" method="post">
145
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
146
- <select name="sucuriscan_verify_ssl_cert">
147
- %%SUCURI.VerifySSLCertOptions%%
148
- </select>
149
- <button type="submit" class="button-primary">Change</button>
150
- </form>
151
- </td>
152
- </tr>
153
-
154
- <tr>
155
- <td>API request timeout</td>
156
- <td>%%SUCURI.RequestTimeout%%</td>
157
- <td class="td-with-button">
158
- <form action="%%SUCURI.URL.Settings%%" method="post">
159
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
160
- <input type="text" name="sucuriscan_request_timeout" class="input-text" placeholder="Timeout in seconds..." />
161
- <button type="submit" class="button-primary">Change</button>
162
- </form>
163
- </td>
164
- </tr>
165
-
166
- <tr>
167
- <td>API proxy <em>(host:port)</em></td>
168
- <td><span class="sucuriscan-monospace">%%SUCURI.APIProxy.Host%%:%%SUCURI.APIProxy.Port%%</span></td>
169
- <td>&nbsp;</td>
170
- </tr>
171
-
172
- <tr>
173
- <td>API proxy <em>(auth)</em></td>
174
- <td>
175
- <span class="sucuriscan-monospace">%%SUCURI.APIProxy.Username%%</span>
176
- <span class="sucuriscan-label-%%SUCURI.APIProxy.PasswordType%%">
177
- <em>password is %%SUCURI.APIProxy.PasswordText%%</em>
178
- </span>
179
- </td>
180
- <td>&nbsp;</td>
181
- </tr>
182
-
183
- <tr>
184
- <td>API test request</td>
185
- <td><em>(Test ability to send HTTP requests)</em></td>
186
- <td class="td-with-button">
187
- <form action="%%SUCURI.URL.Settings%%" method="post">
188
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
189
- <input type="hidden" name="sucuriscan_debug_request" value="1" />
190
- <button type="submit" class="button-primary">Proceed</button>
191
- </form>
192
- </td>
193
- </tr>
194
-
195
- <tr>
196
- <td>Support reverse proxy</td>
197
- <td>%%SUCURI.ReverseProxyStatus%%</td>
198
- <td class="td-with-button">
199
- <form action="%%SUCURI.URL.Settings%%" method="post">
200
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
201
- <input type="hidden" name="sucuriscan_revproxy" value="%%SUCURI.ReverseProxySwitchValue%%" />
202
- <button type="submit" class="button-primary %%SUCURI.ReverseProxySwitchCssClass%%">%%SUCURI.ReverseProxySwitchText%%</button>
203
- </form>
204
- </td>
205
- </tr>
206
-
207
- <tr>
208
- <td>Execute DNS lookups</td>
209
- <td>%%SUCURI.DnsLookupsStatus%%</td>
210
- <td class="td-with-button">
211
- <form action="%%SUCURI.URL.Settings%%" method="post">
212
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
213
- <input type="hidden" name="sucuriscan_dns_lookups" value="%%SUCURI.DnsLookupsSwitchValue%%" />
214
- <button type="submit" class="button-primary %%SUCURI.DnsLookupsSwitchCssClass%%">%%SUCURI.DnsLookupsSwitchText%%</button>
215
- </form>
216
- </td>
217
- </tr>
218
-
219
- <tr>
220
- <td>Allow comment monitor</td>
221
- <td>%%SUCURI.CommentMonitorStatus%%</td>
222
- <td class="td-with-button">
223
- <form action="%%SUCURI.URL.Settings%%" method="post">
224
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
225
- <input type="hidden" name="sucuriscan_comment_monitor" value="%%SUCURI.CommentMonitorSwitchValue%%" />
226
- <button type="submit" class="button-primary %%SUCURI.CommentMonitorSwitchCssClass%%">%%SUCURI.CommentMonitorSwitchText%%</button>
227
- </form>
228
- </td>
229
- </tr>
230
-
231
- <tr>
232
- <td>Allow XHR monitor</td>
233
- <td>%%SUCURI.XhrMonitorStatus%%</td>
234
- <td class="td-with-button">
235
- <form action="%%SUCURI.URL.Settings%%" method="post">
236
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
237
- <input type="hidden" name="sucuriscan_xhr_monitor" value="%%SUCURI.XhrMonitorSwitchValue%%" />
238
- <button type="submit" class="button-primary %%SUCURI.XhrMonitorSwitchCssClass%%">%%SUCURI.XhrMonitorSwitchText%%</button>
239
- </form>
240
- </td>
241
- </tr>
242
-
243
  <tr>
244
  <td>Display audit report</td>
245
  <td>%%SUCURI.AuditReportStatus%%</td>
@@ -265,25 +102,14 @@
265
  </tr>
266
 
267
  <tr>
268
- <td>Collect failed passwords</td>
269
- <td>%%SUCURI.CollectWrongPasswords%%</td>
270
  <td class="td-with-button">
271
  <form action="%%SUCURI.URL.Settings%%" method="post">
272
  <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
273
- <input type="text" name="sucuriscan_collect_wrong_passwords" class="input-text" placeholder="Type: YES or NO" />
274
- <button type="submit" class="button-primary">Change</button>
275
- </form>
276
- </td>
277
- </tr>
278
-
279
- <tr>
280
- <td>Plugin advertisement</td>
281
- <td>%%SUCURI.AdsVisibility%%</td>
282
- <td class="td-with-button">
283
- <form action="%%SUCURI.URL.Settings%%" method="post">
284
- <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
285
- <input type="text" name="sucuriscan_ads_visibility" class="input-text" placeholder="Type: SHOW or HIDE" />
286
- <button type="submit" class="button-primary">Change</button>
287
  </form>
288
  </td>
289
  </tr>
1
 
2
+ <div id="poststuff" class="sucuriscan-general-settings">
3
+ %%SUCURI.SettingsSection.ApiKey%%
4
 
5
+ %%SUCURI.SettingsSection.DataStorage%%
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ %%SUCURI.SettingsSection.ApiProxy%%
8
 
9
+ %%SUCURI.SettingsSection.ApiSSL%%
 
 
 
 
 
 
 
 
10
 
11
+ %%SUCURI.SettingsSection.ApiTimeout%%
 
 
 
 
 
 
 
 
 
 
12
 
13
+ %%SUCURI.SettingsSection.ReverseProxy%%
 
 
 
 
 
 
 
 
 
14
 
15
+ %%SUCURI.SettingsSection.PasswordCollector%%
 
 
 
 
 
 
 
 
 
16
 
17
+ %%SUCURI.SettingsSection.IPDiscoverer%%
 
 
 
 
18
 
19
+ %%SUCURI.SettingsSection.CommentMonitor%%
 
 
 
 
 
20
 
21
+ %%SUCURI.SettingsSection.XhrMonitor%%
 
 
 
 
 
 
 
 
 
 
22
 
23
+ %%SUCURI.SettingsSection.ResetOptions%%
24
+ </div>
25
+
26
+ <table class="wp-list-table widefat sucuriscan-table sucuriscan-striped-table sucuriscan-settings">
27
+ <tbody>
28
  <tr>
29
  <td>Test email alerts</td>
30
  <td><em>(Test ability to send email alerts)</em></td>
77
  </td>
78
  </tr>
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  <tr>
81
  <td>Display audit report</td>
82
  <td>%%SUCURI.AuditReportStatus%%</td>
102
  </tr>
103
 
104
  <tr>
105
+ <td>Current Timezone</td>
106
+ <td>%%SUCURI.CustomTimezone%% <em>(%%SUCURI.CurrentDatetime%%)</em></td>
107
  <td class="td-with-button">
108
  <form action="%%SUCURI.URL.Settings%%" method="post">
109
  <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
110
+ <a href="options-general.php" target="_blank" class="button">
111
+ <span>Change Timezone from the Settings/General page</span>
112
+ </a>
 
 
 
 
 
 
 
 
 
 
 
113
  </form>
114
  </td>
115
  </tr>
inc/tpl/settings-ignorerules.html.tpl CHANGED
@@ -22,10 +22,11 @@
22
  <div class="inside">
23
  <p>
24
  This is a list of registered <a href="http://codex.wordpress.org/Post_Types"
25
- target="_blank">Post Types</a>, since you have enabled the email notifications
26
- for <strong>new site content</strong>, we will send you an alert if any of these
27
- <code>post-types</code> are changed. You may want to ignore some of them, in
28
- which case you can use the buttons in the table bellow to do that.
 
29
  </p>
30
  </div>
31
  </div>
22
  <div class="inside">
23
  <p>
24
  This is a list of registered <a href="http://codex.wordpress.org/Post_Types"
25
+ target="_blank">Post Types</a>, since you have enabled the <strong>email alerts
26
+ for new or modified content</strong>, we will send you an alert if any of these
27
+ <code>post-types</code> are created and/or updated. You may want to ignore some
28
+ of them as some 3rd-party extensions create temporary data in the posts table
29
+ to track changes in their own tools.
30
  </p>
31
  </div>
32
  </div>
inc/tpl/setup-form.html.tpl CHANGED
@@ -5,10 +5,18 @@
5
  them as long as the domain name and email address are different. The key is used
6
  to authenticate the HTTP requests sent by the plugin to a public API service
7
  managed by Sucuri Inc. Do not generate the key if you disagree with this.
8
- Contact us at <a href="mailto:info@sucuri.net">info@sucuri.net</a> if you
9
- believe that sensitive data is being sent to us.
10
  </p>
11
 
 
 
 
 
 
 
 
 
 
 
12
  <form action="%%SUCURI.URL.Settings%%" method="post">
13
  <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
14
  <input type="hidden" name="sucuriscan_plugin_api_key" value="1" />
@@ -50,5 +58,13 @@
50
  </tbody>
51
  </table>
52
 
53
- <button type="submit" class="button button-primary">Proceed</button>
 
 
 
 
 
 
 
 
54
  </form>
5
  them as long as the domain name and email address are different. The key is used
6
  to authenticate the HTTP requests sent by the plugin to a public API service
7
  managed by Sucuri Inc. Do not generate the key if you disagree with this.
 
 
8
  </p>
9
 
10
+ <div class="sucuriscan-inline-alert-info">
11
+ <p>
12
+ If you experience issues generating the API key you can request one sending the
13
+ domain name and email address that you want to use to <a href="mailto:info@sucuri.net">
14
+ info@sucuri.net</a>. Note that setting a key in a development environment does
15
+ not makes sense, if you are trying to do that in a local or stage environment
16
+ please consider to dismiss this alert.
17
+ </p>
18
+ </div>
19
+
20
  <form action="%%SUCURI.URL.Settings%%" method="post">
21
  <input type="hidden" name="sucuriscan_page_nonce" value="%%SUCURI.PageNonce%%" />
22
  <input type="hidden" name="sucuriscan_plugin_api_key" value="1" />
58
  </tbody>
59
  </table>
60
 
61
+ <div class="sucuriscan-clearfix">
62
+ <div class="sucuriscan-pull-left">
63
+ <button type="submit" class="button button-primary">Proceed</button>
64
+ </div>
65
+ <div class="sucuriscan-pull-right">
66
+ <a href="%%SUCURI.URL.Home%%&sucuriscan_dismiss_setup"
67
+ class="sucuriscan-dismiss-setup">Do not show this again</a>
68
+ </div>
69
+ </div>
70
  </form>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dd@sucuri.net
3
  Donate Link: http://sucuri.net/
4
  Tags: malware, security, firewall, scan, spam, virus, sucuri, protection,WordPress Security, Login Security,Security Auditing,File Integrity,htaccess,phishing,backdoors,SQL Injection, RFI, LFI, XSS, CSRF, website firewall, Website Security, Performance Optimization, Zero Day, Software Vulnerability, Exploits, Hacks, Attackers, Bad Actors, Reverse Proxy, Two Factor Security, Two Factor Authentication, Security Logs, HeatBleed Vulnerability, Website Protection, Bash Vulnerability, RevSlider Vulnerability, MailPoet Vulnerability, Malware Prevention, Website Firewall, Website AntiVirus, Security Response, Security Detection, Security Prevention
5
  Requires at least:3.2
6
- Stable tag:1.7.13
7
- Tested up to: 4.2.3
8
 
9
  The Sucuri WordPress Security plugin is a security toolset for security integrity monitoring, malware detection and security hardening.
10
 
@@ -352,6 +352,25 @@ service from the WordPress dashboard.
352
 
353
  == Changelog ==
354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  = 1.7.13 =
356
  * Fixed issue affecting site performance
357
  * Fixed clear hardening of previous versions
3
  Donate Link: http://sucuri.net/
4
  Tags: malware, security, firewall, scan, spam, virus, sucuri, protection,WordPress Security, Login Security,Security Auditing,File Integrity,htaccess,phishing,backdoors,SQL Injection, RFI, LFI, XSS, CSRF, website firewall, Website Security, Performance Optimization, Zero Day, Software Vulnerability, Exploits, Hacks, Attackers, Bad Actors, Reverse Proxy, Two Factor Security, Two Factor Authentication, Security Logs, HeatBleed Vulnerability, Website Protection, Bash Vulnerability, RevSlider Vulnerability, MailPoet Vulnerability, Malware Prevention, Website Firewall, Website AntiVirus, Security Response, Security Detection, Security Prevention
5
  Requires at least:3.2
6
+ Stable tag: 1.7.14
7
+ Tested up to: 4.3.1
8
 
9
  The Sucuri WordPress Security plugin is a security toolset for security integrity monitoring, malware detection and security hardening.
10
 
352
 
353
  == Changelog ==
354
 
355
+ = 1.7.14 =
356
+ * Added alternative method to send email alerts
357
+ * Added button to reset options with explanation
358
+ * Added suggestion for new users to check plugin settings
359
+ * Allow mark as fixed non-writable core files
360
+ * Fixed display menus items single or network panels
361
+ * Fixed handle boolean values in PHP config retrieval
362
+ * Fixed non-standard content location in core integrity
363
+ * Fixed user identifier as integer on password reset
364
+ * Modified css and js files to reduce size
365
+ * Modified do not load resources on hidden sidebar
366
+ * Modified fully redesign of general settings page
367
+ * Modified hide update warning if versions are the same
368
+ * Modified wording of post-types alert settings
369
+ * Removed ellipsis of long IPv6 addresses in last logins
370
+ * Removed unnecessary dns lookups in infosys page
371
+ * Removed unnecessary monospace fonts in settings status
372
+ * Removed unnecessary ssl verification option processor
373
+
374
  = 1.7.13 =
375
  * Fixed issue affecting site performance
376
  * Fixed clear hardening of previous versions
sucuri.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Sucuri Security - Auditing, Malware Scanner and Hardening
4
  Plugin URI: http://wordpress.sucuri.net/
5
  Description: The <a href="http://sucuri.net/" target="_blank">Sucuri</a> plugin provides the website owner the best Activity Auditing, SiteCheck Remote Malware Scanning, Effective Security Hardening and Post-Hack features. SiteCheck will check for malware, spam, blacklisting and other security issues like .htaccess redirects, hidden eval code, etc. The best thing about it is it's completely free.
6
  Author: Sucuri, INC
7
- Version: 1.7.13
8
  Author URI: http://sucuri.net
9
  */
10
 
@@ -66,7 +66,7 @@ define( 'SUCURISCAN', 'sucuriscan' );
66
  /**
67
  * Current version of the plugin's code.
68
  */
69
- define( 'SUCURISCAN_VERSION', '1.7.13' );
70
 
71
  /**
72
  * The name of the Sucuri plugin main file.
@@ -157,6 +157,17 @@ define( 'SUCURISCAN_GET_PLUGINS_LIFETIME', 1800 );
157
  * considering the total number of lines that this file will have.
158
  */
159
  if ( defined( 'SUCURISCAN' ) ) {
 
 
 
 
 
 
 
 
 
 
 
160
  /**
161
  * List an associative array with the sub-pages of this plugin.
162
  *
@@ -188,13 +199,14 @@ if ( defined( 'SUCURISCAN' ) ) {
188
  $sucuriscan_notify_options = array(
189
  'sucuriscan_notify_plugin_change' => 'Receive email alerts for <strong>Sucuri</strong> plugin changes',
190
  'sucuriscan_prettify_mails' => 'Receive email alerts in HTML <em>(there may be issues with some mail services)</em>',
 
191
  'sucuriscan_lastlogin_redirection' => 'Allow redirection after login to report the last-login information',
192
  'sucuriscan_notify_scan_checksums' => 'Receive email alerts for core integrity checks',
193
  'sucuriscan_notify_user_registration' => 'user:Receive email alerts for new user registration',
194
  'sucuriscan_notify_success_login' => 'user:Receive email alerts for successful login attempts',
195
  'sucuriscan_notify_failed_login' => 'user:Receive email alerts for failed login attempts',
196
  'sucuriscan_notify_bruteforce_attack' => 'user:Receive email alerts for password guessing brute force attacks',
197
- 'sucuriscan_notify_post_publication' => 'Receive email alerts for new content <em>(posts, attachments, forms, etc)</em>',
198
  'sucuriscan_notify_website_updated' => 'Receive email alerts when the WordPress version is updated',
199
  'sucuriscan_notify_settings_updated' => 'Receive email alerts when your website settings are updated',
200
  'sucuriscan_notify_theme_editor' => 'Receive email alerts when a file is modified with theme/plugin editor',
@@ -283,7 +295,14 @@ if ( defined( 'SUCURISCAN' ) ) {
283
  add_action( 'admin_init', 'SucuriScanInterface::create_datastore_folder' );
284
  add_action( 'admin_init', 'SucuriScanInterface::handle_old_plugins' );
285
  add_action( 'admin_enqueue_scripts', 'SucuriScanInterface::enqueue_scripts', 1 );
286
- add_action( 'admin_menu', 'SucuriScanInterface::add_interface_menu' );
 
 
 
 
 
 
 
287
 
288
  /**
289
  * Attach Ajax requests to a custom page handler.
@@ -328,7 +347,7 @@ if ( defined( 'SUCURISCAN' ) ) {
328
  'xmlrpc_publish_post',
329
  );
330
 
331
- if ( SucuriScanOption::get_option( ':xhr_monitor' ) === 'enabled' ) {
332
  $sucuriscan_hooks[] = 'all';
333
  }
334
 
@@ -352,7 +371,7 @@ if ( defined( 'SUCURISCAN' ) ) {
352
  * the plugin to execute the filesystem scans, the project integrity, and the
353
  * email notifications.
354
  */
355
- add_action( 'admin_notices', 'SucuriScanInterface::setup_notice' );
356
 
357
  /**
358
  * Heartbeat API
@@ -414,11 +433,14 @@ class SucuriScan {
414
  public static function ini_get( $property = '' ){
415
  $ini_value = ini_get( $property );
416
 
417
- if ( empty($ini_value) || is_null( $ini_value ) ) {
 
 
 
 
418
  switch ( $property ) {
419
  case 'error_log': $ini_value = 'error_log'; break;
420
  case 'safe_mode': $ini_value = 'Off'; break;
421
- case 'allow_url_fopen': $ini_value = '1'; break;
422
  case 'memory_limit': $ini_value = '128M'; break;
423
  case 'upload_max_filesize': $ini_value = '2M'; break;
424
  case 'post_max_size': $ini_value = '8M'; break;
@@ -742,7 +764,7 @@ class SucuriScan {
742
  * @return boolean TRUE if reverse proxies must be supported, FALSE otherwise.
743
  */
744
  public static function support_reverse_proxy(){
745
- return (bool) ( SucuriScanOption::get_option( ':revproxy' ) === 'enabled' );
746
  }
747
 
748
  /**
@@ -759,7 +781,7 @@ class SucuriScan {
759
  public static function execute_dns_lookups(){
760
  if (
761
  ( defined( 'NOT_USING_CLOUDPROXY' ) && NOT_USING_CLOUDPROXY === true )
762
- || SucuriScanOption::get_option( ':dns_lookups' ) === 'disabled'
763
  ) {
764
  return false;
765
  }
@@ -912,21 +934,16 @@ class SucuriScan {
912
  * @param integer $timestamp Unix timestamp.
913
  * @return string The date, translated if locale specifies it.
914
  */
915
- public static function datetime( $timestamp = 0 ){
916
- if ( is_numeric( $timestamp ) && $timestamp > 0 ) {
917
- $gmt_offset = get_option( 'gmt_offset' );
918
- $date_format = get_option( 'date_format' );
919
- $time_format = get_option( 'time_format' );
920
- $tz_format = sprintf( '%s %s', $date_format, $time_format );
921
 
922
- if ( is_numeric( $gmt_offset ) ) {
923
- $timestamp += ( $gmt_offset * 3600 );
924
- }
925
-
926
- return date_i18n( $tz_format, $timestamp );
927
  }
928
 
929
- return null;
930
  }
931
 
932
  /**
@@ -935,9 +952,7 @@ class SucuriScan {
935
  * @return string The date, translated if locale specifies it.
936
  */
937
  public static function current_datetime(){
938
- $local_time = self::local_time();
939
-
940
- return self::datetime( $local_time );
941
  }
942
 
943
  /**
@@ -2556,6 +2571,7 @@ class SucuriScanOption extends SucuriScanRequest {
2556
  'sucuriscan_collect_wrong_passwords' => 'disabled',
2557
  'sucuriscan_comment_monitor' => 'disabled',
2558
  'sucuriscan_datastore_path' => '',
 
2559
  'sucuriscan_dns_lookups' => 'enabled',
2560
  'sucuriscan_email_subject' => 'Sucuri Alert, :domain, :event',
2561
  'sucuriscan_emails_per_hour' => 5,
@@ -2607,6 +2623,7 @@ class SucuriScanOption extends SucuriScanRequest {
2607
  'sucuriscan_site_version' => '0.0',
2608
  'sucuriscan_sitecheck_counter' => 0,
2609
  'sucuriscan_sitecheck_scanner' => 'enabled',
 
2610
  'sucuriscan_verify_ssl_cert' => 'false',
2611
  'sucuriscan_xhr_monitor' => 'disabled',
2612
  );
@@ -2752,6 +2769,26 @@ class SucuriScanOption extends SucuriScanRequest {
2752
  return false;
2753
  }
2754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2755
  /**
2756
  * Delete all the plugin options from the database.
2757
  *
@@ -3051,7 +3088,7 @@ class SucuriScanEvent extends SucuriScan {
3051
 
3052
  // The filesystem scanner can be disabled from the settings page.
3053
  if (
3054
- SucuriScanOption::get_option( ':fs_scanner' ) == 'disabled'
3055
  && $force_scan === false
3056
  ) {
3057
  return false;
@@ -3911,7 +3948,7 @@ class SucuriScanHook extends SucuriScanEvent {
3911
  && property_exists( $comment, 'comment_ID' )
3912
  && property_exists( $comment, 'comment_agent' )
3913
  && property_exists( $comment, 'comment_author_IP' )
3914
- && SucuriScanOption::get_option( ':comment_monitor' ) === 'enabled'
3915
  ) {
3916
  $data_set = array(
3917
  'id' => $comment->comment_ID,
@@ -4480,33 +4517,6 @@ class SucuriScanAPI extends SucuriScanOption {
4480
  return self::process_response( $response, $params, $args );
4481
  }
4482
 
4483
- /**
4484
- * Test ability of the site to send HTTP requests.
4485
- *
4486
- * @return string Response data from the remote service.
4487
- */
4488
- public static function test_api_call(){
4489
- $params = array();
4490
- $params['first'] = microtime();
4491
- $params['lorem'] = microtime();
4492
- $params['middle'] = microtime();
4493
- $params['foobar'] = microtime();
4494
- $params['last'] = microtime();
4495
- $response_data = '{invalid_data}';
4496
-
4497
- $response = self::api_call( 'http://httpbin.org/post', 'POST', $params );
4498
-
4499
- if (
4500
- is_array( $response )
4501
- && array_key_exists( 'body_raw', $response )
4502
- && is_string( $response['body_raw'] )
4503
- ) {
4504
- $response_data = $response['body_raw'];
4505
- }
4506
-
4507
- return $response_data;
4508
- }
4509
-
4510
  /**
4511
  * Check whether the plugin API key is valid or not.
4512
  *
@@ -5633,7 +5643,7 @@ class SucuriScanMail extends SucuriScanOption {
5633
  * @return boolean Whether the emails will be in HTML or Plain/Text.
5634
  */
5635
  public static function prettify_mails(){
5636
- return ( self::get_option( ':prettify_mails' ) === 'enabled' );
5637
  }
5638
 
5639
  /**
@@ -5685,7 +5695,27 @@ class SucuriScanMail extends SucuriScanOption {
5685
  }
5686
 
5687
  $subject = self::get_email_subject( $subject );
5688
- $mail_sent = wp_mail( $email, $subject, $message, $headers );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5689
 
5690
  if ( $mail_sent ) {
5691
  $emails_sent_num = (int) self::get_option( ':emails_sent' );
@@ -5905,16 +5935,16 @@ class SucuriScanTemplate extends SucuriScanRequest {
5905
  }
5906
 
5907
  // Hide the advertisements from the layout.
5908
- $ads_visibility = SucuriScanOption::get_option( ':ads_visibility' );
5909
-
5910
- if ( $ads_visibility == 'disabled' ) {
5911
  $params['LayoutType'] = 'onecolumn';
5912
  $params['AdsVisibility'] = 'hidden';
5913
  $params['ReviewNavbarButton'] = 'visible';
 
5914
  } else {
5915
  $params['LayoutType'] = 'twocolumns';
5916
  $params['AdsVisibility'] = 'visible';
5917
  $params['ReviewNavbarButton'] = 'hidden';
 
5918
  }
5919
 
5920
  return $params;
@@ -5988,7 +6018,7 @@ class SucuriScanTemplate extends SucuriScanRequest {
5988
  foreach ( $sub_pages as $sub_page_func => $sub_page_title ) {
5989
  if (
5990
  $sub_page_func == 'sucuriscan_scanner'
5991
- && self::is_sitecheck_disabled()
5992
  ) {
5993
  continue;
5994
  }
@@ -6245,24 +6275,6 @@ class SucuriScanTemplate extends SucuriScanRequest {
6245
  return $html_links;
6246
  }
6247
 
6248
- /**
6249
- * Check whether the SiteCheck scanner and the malware scan page are disabled.
6250
- *
6251
- * @return boolean TRUE if the SiteCheck scanner and malware scan page are disabled.
6252
- */
6253
- public static function is_sitecheck_disabled(){
6254
- return (bool) ( SucuriScanOption::get_option( ':sitecheck_scanner' ) === 'disabled' );
6255
- }
6256
-
6257
- /**
6258
- * Check whether the SiteCheck scanner and the malware scan page are enabled.
6259
- *
6260
- * @return boolean TRUE if the SiteCheck scanner and malware scan page are enabled.
6261
- */
6262
- public static function is_sitecheck_enabled(){
6263
- return (bool) ( SucuriScanOption::get_option( ':sitecheck_scanner' ) !== 'disabled' );
6264
- }
6265
-
6266
  }
6267
 
6268
  /**
@@ -6309,7 +6321,7 @@ class SucuriScanFSScanner extends SucuriScan {
6309
  * @return boolean Whether the feature to ignore files is enabled or not.
6310
  */
6311
  public static function will_ignore_scanning(){
6312
- return ( SucuriScanOption::get_option( ':ignore_scanning' ) === 'enabled' );
6313
  }
6314
 
6315
  /**
@@ -6710,13 +6722,13 @@ class SucuriScanInterface {
6710
  $asset_version = substr( SUCURISCAN_PLUGIN_CHECKSUM, 0, 7 );
6711
  }
6712
 
6713
- wp_register_style( 'sucuriscan', SUCURISCAN_URL . '/inc/css/sucuriscan-default-css.css', array(), $asset_version );
6714
- wp_register_script( 'sucuriscan', SUCURISCAN_URL . '/inc/js/sucuriscan-scripts.js', array(), $asset_version );
6715
  wp_enqueue_style( 'sucuriscan' );
6716
  wp_enqueue_script( 'sucuriscan' );
6717
 
6718
  if ( SucuriScanRequest::get( 'page', 'sucuriscan' ) !== false ) {
6719
- wp_register_script( 'sucuriscan2', SUCURISCAN_URL . '/inc/js/d3.v3.min.js', array(), $asset_version );
6720
  wp_register_script( 'sucuriscan3', SUCURISCAN_URL . '/inc/js/c3.min.js', array(), $asset_version );
6721
  wp_enqueue_script( 'sucuriscan2' );
6722
  wp_enqueue_script( 'sucuriscan3' );
@@ -6750,7 +6762,7 @@ class SucuriScanInterface {
6750
  foreach ( $sucuriscan_pages as $sub_page_func => $sub_page_title ) {
6751
  if (
6752
  $sub_page_func == 'sucuriscan_scanner'
6753
- && SucuriScanTemplate::is_sitecheck_disabled()
6754
  ) {
6755
  continue;
6756
  }
@@ -6809,39 +6821,39 @@ class SucuriScanInterface {
6809
  * @return void
6810
  */
6811
  public static function create_datastore_folder(){
6812
- $plugin_upload_folder = SucuriScan::datastore_folder_path();
6813
 
6814
- if ( ! file_exists( $plugin_upload_folder ) ) {
6815
- $datastore_folder_created = @mkdir( $plugin_upload_folder, 0755, true );
 
6816
 
6817
- if ( $datastore_folder_created ) {
6818
- // Create last-logins datastore file.
6819
- sucuriscan_lastlogins_datastore_exists();
6820
 
6821
- // Create a htaccess file to deny access from all.
6822
- @file_put_contents(
6823
- $plugin_upload_folder . '/.htaccess',
6824
- "Order Deny,Allow\nDeny from all\n",
6825
- LOCK_EX
6826
- );
6827
 
6828
- // Create an index.html to avoid directory listing.
6829
- @file_put_contents(
6830
- $plugin_upload_folder . '/index.html',
6831
- '<!-- Prevent the directory listing. -->',
6832
- LOCK_EX
6833
- );
6834
- } else {
6835
- SucuriScanOption::delete_option( ':datastore_path' );
6836
- SucuriScanInterface::error(
6837
- 'Data folder does not exists and could not be created. Try to <a href="' .
6838
- SucuriScanTemplate::get_url( 'settings' ) . '">click this link</a> to see
6839
- if the plugin is able to fix this error automatically, if this message
6840
- reappears you will need to either change the location of the directory from
6841
- the plugin general settings page or create this directory manually and give it
6842
- write permissions:<code>' . $plugin_upload_folder . '</code>.'
6843
- );
6844
- }
6845
  }
6846
  }
6847
 
@@ -6958,12 +6970,18 @@ class SucuriScanInterface {
6958
  && SucuriScanRequest::post( ':recover_key' ) === false
6959
  && ! SucuriScanRequest::post( ':manual_api_key' )
6960
  ) {
6961
- echo SucuriScanTemplate::get_section( 'setup-notice' );
6962
- echo SucuriScanTemplate::get_modal('setup-form', array(
6963
- 'Visibility' => 'hidden',
6964
- 'Title' => 'Sucuri API key generation',
6965
- 'CssClass' => 'sucuriscan-setup-instructions',
6966
- ));
 
 
 
 
 
 
6967
  }
6968
  }
6969
 
@@ -7083,6 +7101,7 @@ function sucuriscan_sitecheck_info( $scan_results = array() ){
7083
  */
7084
  function sucuriscan_sitecheck_scanner_results( $scan_results = false, $template_variables = array() ){
7085
  $secvars = array(
 
7086
  'WebsiteStatus' => 'Site status unknown',
7087
  'NoMalwareRowVisibility' => 'visible',
7088
  'FixButtonVisibility' => 'hidden',
@@ -7945,12 +7964,11 @@ class SucuriScanHardening extends SucuriScan {
7945
  * Currently supports Apache 2.2 and 2.4 and denies access to all PHP files with
7946
  * any mixed extension case.
7947
  *
7948
- * @param string $directory Valid directory path.
7949
- * @return array List of access control rules.
7950
  */
7951
- private static function get_rules( $directory = '' ){
7952
- $directory = basename( $directory );
7953
- $rules = array(
7954
  '<FilesMatch "\.(?i:php)$">',
7955
  ' <IfModule !mod_authz_core.c>',
7956
  ' Order allow,deny',
@@ -7961,17 +7979,6 @@ class SucuriScanHardening extends SucuriScan {
7961
  ' </IfModule>',
7962
  '</FilesMatch>',
7963
  );
7964
-
7965
- if ( $directory == 'wp-includes' ) {
7966
- $rules[] = '<Files wp-tinymce.php>';
7967
- $rules[] = ' Allow from all';
7968
- $rules[] = '</Files>';
7969
- $rules[] = '<Files ms-files.php>';
7970
- $rules[] = ' Allow from all';
7971
- $rules[] = '</Files>';
7972
- }
7973
-
7974
- return $rules;
7975
  }
7976
 
7977
  /**
@@ -7983,29 +7990,29 @@ class SucuriScanHardening extends SucuriScan {
7983
  * @param string $directory Valid directory path where to place the access rules.
7984
  * @return boolean True if the rules are successfully added, false otherwise.
7985
  */
7986
- public static function harden_directory( $directory = '' ){
7987
- if (
7988
- file_exists( $directory)
7989
- && is_writable( $directory )
7990
- && is_dir( $directory )
7991
  ) {
7992
  $fhandle = false;
7993
- $target = $directory . '/.htaccess';
7994
- $deny_rules = self::get_rules( $directory );
7995
 
7996
- if ( file_exists( $target ) ) {
7997
- self::fix_previous_hardening( $directory );
7998
- $fhandle = @fopen( $target, 'a' );
7999
  } else {
8000
- $fhandle = @fopen( $target, 'w' );
8001
  }
8002
 
8003
- if ( $fhandle ) {
8004
- $rules_str = implode( "\n", $deny_rules );
8005
- $written = fwrite( $fhandle, $rules_str );
8006
- fclose( $fhandle );
8007
 
8008
- return (bool) ( $written !== false );
8009
  }
8010
  }
8011
 
@@ -8020,22 +8027,23 @@ class SucuriScanHardening extends SucuriScan {
8020
  * @param string $directory Valid directory path where to access rules are.
8021
  * @return boolean True if the rules are successfully deleted, false otherwise.
8022
  */
8023
- public static function unharden_directory( $directory = '' ){
8024
- if ( self::is_hardened( $directory ) ) {
8025
- $deny_rules = self::get_rules( $directory );
8026
- $fpath = $directory . '/.htaccess';
8027
- $content = @file_get_contents( $fpath );
 
8028
 
8029
- if ( $content ) {
8030
- $rules_str = implode( "\n", $deny_rules );
8031
- $content = str_replace( $rules_str, '', $content );
8032
- $written = @file_put_contents( $fpath, $content );
8033
 
8034
- if ( filesize( $fpath ) === 0 ) {
8035
- @unlink( $fpath );
8036
  }
8037
 
8038
- return (bool) ( $written !== false );
8039
  }
8040
  }
8041
 
@@ -8048,17 +8056,18 @@ class SucuriScanHardening extends SucuriScan {
8048
  * @param string $directory Valid directory path.
8049
  * @return boolean True if the access control file was fixed.
8050
  */
8051
- private static function fix_previous_hardening( $directory = '' ){
8052
- $fpath = $directory . '/.htaccess';
8053
- $content = @file_get_contents( $fpath );
 
8054
  $rules = "<Files *.php>\ndeny from all\n</Files>";
8055
 
8056
- if ( $content ) {
8057
- if ( strpos( $content, $rules ) !== false ) {
8058
- $content = str_replace( $rules, '', $content );
8059
- $written = @file_put_contents( $fpath, $content );
8060
 
8061
- return (bool) ( $written !== false );
8062
  }
8063
  }
8064
 
@@ -8071,22 +8080,17 @@ class SucuriScanHardening extends SucuriScan {
8071
  * @param string $directory Valid directory path.
8072
  * @return boolean True if the directory is hardened, false otherwise.
8073
  */
8074
- public static function is_hardened( $directory = '' ){
8075
- if (
8076
- file_exists( $directory )
8077
- && is_dir( $directory )
8078
- ) {
8079
- $fpath = $directory . '/.htaccess';
8080
 
8081
- if (
8082
- file_exists( $fpath )
8083
- && is_readable( $fpath )
8084
- ) {
8085
- $rules = self::get_rules( $directory );
8086
- $rules_str = implode( "\n", $rules );
8087
- $content = @file_get_contents( $fpath );
8088
 
8089
- if ( strpos( $content, $rules_str ) !== false ) {
8090
  return true;
8091
  }
8092
  }
@@ -8095,6 +8099,67 @@ class SucuriScanHardening extends SucuriScan {
8095
  return false;
8096
  }
8097
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8098
  }
8099
 
8100
  /**
@@ -8108,8 +8173,16 @@ class SucuriScanHardening extends SucuriScan {
8108
  function sucuriscan_hardening_page(){
8109
  SucuriScanInterface::check_permissions();
8110
 
8111
- if (
8112
- SucuriScanRequest::post( ':run_hardening' )
 
 
 
 
 
 
 
 
8113
  && ! SucuriScanInterface::check_nonce()
8114
  ) {
8115
  unset($_POST['sucuriscan_run_hardening']);
@@ -8133,9 +8206,9 @@ function sucuriscan_hardening_page(){
8133
  'Hardening.ErrorLog' => sucuriscan_harden_errorlog(),
8134
  );
8135
 
8136
- if ( SucuriScan::is_nginx_server() === true ) {
8137
  $template_variables['Hardening.NginxPhpFpm'] = sucuriscan_harden_nginx_phpfpm();
8138
- } elseif ( SucuriScan::is_iis_server() === true ) {
8139
  /* TODO: Include IIS (Internet Information Services) hardening options. */
8140
  } else {
8141
  $template_variables['Hardening.Upload'] = sucuriscan_harden_upload();
@@ -8143,7 +8216,71 @@ function sucuriscan_hardening_page(){
8143
  $template_variables['Hardening.WpIncludes'] = sucuriscan_harden_wpincludes();
8144
  }
8145
 
8146
- echo SucuriScanTemplate::get_template( 'hardening', $template_variables );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8147
  }
8148
 
8149
  /**
@@ -8430,6 +8567,8 @@ function sucuriscan_harden_wpincludes(){
8430
 
8431
  if ( $result === true ) {
8432
  $message = 'Hardening applied to the library directory';
 
 
8433
  SucuriScanEvent::report_notice_event( $message );
8434
  SucuriScanInterface::info( $message );
8435
  } else {
@@ -8440,6 +8579,8 @@ function sucuriscan_harden_wpincludes(){
8440
 
8441
  if ( $result === true ) {
8442
  $message = 'Hardening reverted in the library directory';
 
 
8443
  SucuriScanEvent::report_error_event( $message );
8444
  SucuriScanInterface::info( $message );
8445
  } else {
@@ -8814,7 +8955,8 @@ function sucuriscan_harden_errorlog(){
8814
  *
8815
  * @return void
8816
  */
8817
- function sucuriscan_page(){
 
8818
  SucuriScanInterface::check_permissions();
8819
 
8820
  // Process all form submissions.
@@ -8827,7 +8969,7 @@ function sucuriscan_page(){
8827
  'AuditLogs' => sucuriscan_auditlogs(),
8828
  );
8829
 
8830
- echo SucuriScanTemplate::get_template( 'integrity', $template_variables );
8831
  }
8832
 
8833
  /**
@@ -8837,23 +8979,24 @@ function sucuriscan_page(){
8837
  *
8838
  * @return void
8839
  */
8840
- function sucuriscan_integrity_form_submissions(){
8841
- if ( SucuriScanInterface::check_nonce() ) {
 
8842
  // Force the execution of the filesystem scanner.
8843
- if ( SucuriScanRequest::post( ':force_scan' ) !== false ) {
8844
- SucuriScanEvent::notify_event( 'plugin_change', 'Filesystem scan forced at: ' . date( 'r' ) );
8845
- SucuriScanEvent::filesystem_scan( true );
8846
  }
8847
 
8848
  // Restore, Remove, Mark as fixed the core files.
8849
  $allowed_actions = '(restore|delete|fixed)';
8850
- $integrity_action = SucuriScanRequest::post( ':integrity_action', $allowed_actions );
8851
 
8852
- if ( $integrity_action !== false ) {
8853
- $cache = new SucuriScanCache( 'integrity' );
8854
- $integrity_files = SucuriScanRequest::post( ':integrity_files', '_array' );
8855
- $integrity_types = SucuriScanRequest::post( ':integrity_types', '_array' );
8856
- $files_selected = count( $integrity_files );
8857
  $files_affected = array();
8858
  $files_processed = 0;
8859
  $action_titles = array(
@@ -8862,34 +9005,34 @@ function sucuriscan_integrity_form_submissions(){
8862
  'fixed' => 'Core file marked as fixed',
8863
  );
8864
 
8865
- if ( $integrity_files ) {
8866
- foreach ( (array) $integrity_files as $i => $file_path ) {
8867
  $full_path = ABSPATH . $file_path;
8868
  $status_type = $integrity_types[ $i ];
8869
 
8870
- switch ( $integrity_action ) {
8871
  case 'restore':
8872
- $file_content = SucuriScanAPI::get_original_core_file( $file_path );
8873
- if ( $file_content ) {
8874
- $restored = @file_put_contents( $full_path, $file_content, LOCK_EX );
8875
  $files_processed += ( $restored ? 1 : 0 );
8876
  $files_affected[] = $full_path;
8877
  }
8878
  break;
8879
  case 'delete':
8880
- if ( @unlink( $full_path ) ) {
8881
  $files_processed += 1;
8882
  $files_affected[] = $full_path;
8883
  }
8884
  break;
8885
  case 'fixed':
8886
- $cache_key = md5( $file_path );
8887
  $cache_value = array(
8888
  'file_path' => $file_path,
8889
  'file_status' => $status_type,
8890
  'ignored_at' => time(),
8891
  );
8892
- $cached = $cache->add( $cache_key, $cache_value );
8893
  $files_processed += ( $cached ? 1 : 0 );
8894
  $files_affected[] = $full_path;
8895
  break;
@@ -8897,20 +9040,26 @@ function sucuriscan_integrity_form_submissions(){
8897
  }
8898
 
8899
  // Report files affected as a single event.
8900
- if ( ! empty($files_affected) ) {
8901
- $message_tpl = ( count( $files_affected ) > 1 )
8902
  ? '%s: (multiple entries): %s'
8903
  : '%s: %s';
8904
  $message = sprintf(
8905
  $message_tpl,
8906
  $action_titles[ $integrity_action ],
8907
- @implode( ',', $files_affected )
8908
  );
8909
 
8910
- switch ( $integrity_action ) {
8911
- case 'restore': SucuriScanEvent::report_info_event( $message ); break;
8912
- case 'delete': SucuriScanEvent::report_notice_event( $message ); break;
8913
- case 'fixed': SucuriScanEvent::report_warning_event( $message ); break;
 
 
 
 
 
 
8914
  }
8915
  }
8916
 
@@ -8932,17 +9081,18 @@ function sucuriscan_integrity_form_submissions(){
8932
  * @param boolean $recursive Either TRUE or FALSE if the scan should be performed recursively.
8933
  * @return array List of arrays containing the md5sum and last modification time of the files found.
8934
  */
8935
- function sucuriscan_get_integrity_tree( $dir = './', $recursive = false ){
8936
- $abs_path = rtrim( ABSPATH, '/' );
 
8937
 
8938
  $file_info = new SucuriScanFileInfo();
8939
  $file_info->ignore_files = false;
8940
  $file_info->ignore_directories = false;
8941
  $file_info->run_recursively = $recursive;
8942
- $file_info->scan_interface = SucuriScanOption::get_option( ':scan_interface' );
8943
- $integrity_tree = $file_info->get_directory_tree_md5( $dir, true );
8944
 
8945
- if ( ! $integrity_tree ) {
8946
  $integrity_tree = array();
8947
  }
8948
 
@@ -8955,12 +9105,13 @@ function sucuriscan_get_integrity_tree( $dir = './', $recursive = false ){
8955
  *
8956
  * @return void
8957
  */
8958
- function sucuriscan_auditlogs(){
 
8959
  // Initialize the values for the pagination.
8960
  $max_per_page = SUCURISCAN_AUDITLOGS_PER_PAGE;
8961
  $page_number = SucuriScanTemplate::get_page_number();
8962
  $logs_limit = $page_number * $max_per_page;
8963
- $audit_logs = SucuriScanAPI::get_logs( $logs_limit );
8964
 
8965
  $template_variables = array(
8966
  'PageTitle' => 'Audit Logs',
@@ -8973,51 +9124,50 @@ function sucuriscan_auditlogs(){
8973
  'AuditLogs.EnableAuditReportVisibility' => 'hidden',
8974
  );
8975
 
8976
- if ( $audit_logs ) {
8977
  $counter_i = 0;
8978
- $total_items = count( $audit_logs->output_data );
8979
  $iterator_start = ($page_number - 1) * $max_per_page;
8980
  $iterator_end = $total_items;
8981
 
8982
- if (
8983
- $audit_logs->total_entries >= $max_per_page
8984
- && SucuriScanOption::get_option( ':audit_report' ) !== 'enabled'
8985
  ) {
8986
  $template_variables['AuditLogs.EnableAuditReportVisibility'] = 'visible';
8987
  }
8988
 
8989
- for ( $i = $iterator_start; $i < $total_items; $i++ ) {
8990
- if ( $counter_i > $max_per_page ) {
8991
  break;
8992
  }
8993
 
8994
- if ( isset($audit_logs->output_data[ $i ]) ) {
8995
  $audit_log = $audit_logs->output_data[ $i ];
8996
 
8997
  $css_class = ( $counter_i % 2 == 0 ) ? '' : 'alternate';
8998
  $snippet_data = array(
8999
  'AuditLog.CssClass' => $css_class,
9000
- 'AuditLog.Event' => SucuriScan::escape( $audit_log['event'] ),
9001
- 'AuditLog.EventTitle' => SucuriScan::escape( ucfirst( $audit_log['event'] ) ),
9002
- 'AuditLog.DateTime' => SucuriScan::datetime( $audit_log['timestamp'] ),
9003
- 'AuditLog.Account' => SucuriScan::escape( $audit_log['account'] ),
9004
- 'AuditLog.Username' => SucuriScan::escape( $audit_log['username'] ),
9005
- 'AuditLog.RemoteAddress' => SucuriScan::escape( $audit_log['remote_addr'] ),
9006
- 'AuditLog.Message' => SucuriScan::escape( $audit_log['message'] ),
9007
  'AuditLog.Extra' => '',
9008
  );
9009
 
9010
  // Print every file_list information item in a separate table.
9011
- if ( $audit_log['file_list'] ) {
9012
  $css_scrollable = $audit_log['file_list_count'] > 10 ? 'sucuriscan-list-as-table-scrollable' : '';
9013
  $snippet_data['AuditLog.Extra'] .= '<ul class="sucuriscan-list-as-table ' . $css_scrollable . '">';
9014
- foreach ( $audit_log['file_list'] as $log_extra ) {
9015
- $snippet_data['AuditLog.Extra'] .= '<li>' . SucuriScan::escape( $log_extra ) . '</li>';
9016
  }
9017
  $snippet_data['AuditLog.Extra'] .= '</ul>';
9018
  }
9019
 
9020
- $template_variables['AuditLogs.List'] .= SucuriScanTemplate::get_snippet( 'integrity-auditlogs', $snippet_data );
9021
  $counter_i += 1;
9022
  }
9023
  }
@@ -9025,14 +9175,14 @@ function sucuriscan_auditlogs(){
9025
  $template_variables['AuditLogs.Count'] = $counter_i;
9026
  $template_variables['AuditLogs.NoItemsVisibility'] = 'hidden';
9027
 
9028
- if ( $total_items > 1 ) {
9029
- $max_pages = ceil( $audit_logs->total_entries / $max_per_page );
9030
 
9031
- if ( $max_pages > SUCURISCAN_MAX_PAGINATION_BUTTONS ) {
9032
  $max_pages = SUCURISCAN_MAX_PAGINATION_BUTTONS;
9033
  }
9034
 
9035
- if ( $max_pages > 1 ) {
9036
  $template_variables['AuditLogs.PaginationVisibility'] = 'visible';
9037
  $template_variables['AuditLogs.PaginationLinks'] = SucuriScanTemplate::get_pagination(
9038
  '%%SUCURI.URL.Home%%',
@@ -9043,7 +9193,7 @@ function sucuriscan_auditlogs(){
9043
  }
9044
  }
9045
 
9046
- return SucuriScanTemplate::get_section( 'integrity-auditlogs', $template_variables );
9047
  }
9048
  /**
9049
  * Print a HTML code with the content of the logs audited by the remote Sucuri
@@ -9051,12 +9201,13 @@ function sucuriscan_auditlogs(){
9051
  *
9052
  * @return void
9053
  */
9054
- function sucuriscan_auditreport(){
 
9055
  $audit_report = false;
9056
- $logs4report = SucuriScanOption::get_option( ':logs4report' );
9057
 
9058
- if ( SucuriScanOption::get_option( ':audit_report' ) !== 'disabled' ) {
9059
- $audit_report = SucuriScanAPI::get_audit_report( $logs4report );
9060
  }
9061
 
9062
  $template_variables = array(
@@ -9071,40 +9222,40 @@ function sucuriscan_auditreport(){
9071
  'AuditReport.Logs4Report' => $logs4report,
9072
  );
9073
 
9074
- if ( $audit_report ) {
9075
- $template_variables['AuditReport.EventColors'] = @implode( ',', $audit_report['event_colors'] );
9076
 
9077
  // Generate report chart data for the events per type.
9078
- foreach ( $audit_report['events_per_type'] as $event => $times ) {
9079
  $template_variables['AuditReport.EventsPerType'] .= sprintf(
9080
  "[ '%s', %d ],\n",
9081
- ucwords( $event . "\x20events" ),
9082
  $times
9083
  );
9084
  }
9085
 
9086
  // Generate report chart data for the events per login.
9087
- foreach ( $audit_report['events_per_login'] as $event => $times ) {
9088
  $template_variables['AuditReport.EventsPerLogin'] .= sprintf(
9089
  "[ '%s', %d ],\n",
9090
- ucwords( $event . "\x20logins" ),
9091
  $times
9092
  );
9093
  }
9094
 
9095
  // Generate report chart data for the events per user.
9096
- foreach ( $audit_report['events_per_user'] as $event => $times ) {
9097
- $template_variables['AuditReport.EventsPerUserCategories'] .= sprintf( '"%s",', $event );
9098
- $template_variables['AuditReport.EventsPerUserSeries'] .= sprintf( '%d,', $times );
9099
  }
9100
 
9101
  // Generate report chart data for the events per remote address.
9102
- foreach ( $audit_report['events_per_ipaddress'] as $event => $times ) {
9103
- $template_variables['AuditReport.EventsPerIPAddressCategories'] .= sprintf( '"%s",', $event );
9104
- $template_variables['AuditReport.EventsPerIPAddressSeries'] .= sprintf( '%d,', $times );
9105
  }
9106
 
9107
- return SucuriScanTemplate::get_section( 'integrity-auditreport', $template_variables );
9108
  }
9109
 
9110
  return '';
@@ -9115,46 +9266,46 @@ function sucuriscan_auditreport(){
9115
  *
9116
  * @return string Panel with a warning advising that WordPress is outdated.
9117
  */
9118
- function sucuriscan_wordpress_outdated(){
 
9119
  $site_version = SucuriScan::site_version();
9120
  $updates = get_core_updates();
9121
- $cp = ( ! is_array( $updates ) || empty($updates) ? 1 : 0 );
9122
 
9123
  $template_variables = array(
9124
  'WordPress.Version' => $site_version,
9125
  'WordPress.NewVersion' => '0.0.0',
9126
  'WordPress.NewLocale' => 'default',
9127
- 'WordPress.UpdateURL' => admin_url( 'update-core.php' ),
9128
  'WordPress.DownloadURL' => '#',
9129
  'WordPress.UpdateVisibility' => 'hidden',
9130
  );
9131
 
9132
- if (
9133
- isset($updates[0])
9134
  && $updates[0] instanceof stdClass
9135
- && property_exists( $updates[0], 'version' )
9136
- && property_exists( $updates[0], 'download' )
9137
  ) {
9138
  $template_variables['WordPress.NewVersion'] = $updates[0]->version;
9139
  $template_variables['WordPress.DownloadURL'] = $updates[0]->download;
9140
 
9141
- if ( property_exists( $updates[0], 'locale' ) ) {
9142
  $template_variables['WordPress.NewLocale'] = $updates[0]->locale;
9143
  }
9144
 
9145
- if (
9146
- $updates[0]->response == 'latest'
9147
  || $updates[0]->response == 'development'
 
9148
  ) {
9149
  $cp = 1;
9150
  }
9151
  }
9152
 
9153
- if ( $cp == 0 ) {
9154
  $template_variables['WordPress.UpdateVisibility'] = 'visible';
9155
  }
9156
 
9157
- return SucuriScanTemplate::get_section( 'integrity-wpoutdate', $template_variables );
9158
  }
9159
 
9160
  /**
@@ -9167,7 +9318,8 @@ function sucuriscan_wordpress_outdated(){
9167
  * @param boolean $send_email If the HTML code returned will be sent via email.
9168
  * @return string HTML code with a list of files that were affected.
9169
  */
9170
- function sucuriscan_core_files( $send_email = false ){
 
9171
  $site_version = SucuriScan::site_version();
9172
  $affected_files = 0;
9173
 
@@ -9177,47 +9329,50 @@ function sucuriscan_core_files( $send_email = false ){
9177
  'CoreFiles.GoodVisibility' => 'visible',
9178
  'CoreFiles.BadVisibility' => 'hidden',
9179
  'CoreFiles.FailureVisibility' => 'hidden',
 
9180
  );
9181
 
9182
- if ( $site_version && SucuriScanOption::get_option( ':scan_checksums' ) == 'enabled' ) {
9183
  // Check if there are added, removed, or modified files.
9184
- $latest_hashes = sucuriscan_check_core_integrity( $site_version );
 
 
 
9185
 
9186
- if ( $latest_hashes ) {
9187
- $cache = new SucuriScanCache( 'integrity' );
9188
  $ignored_files = $cache->get_all();
9189
  $counter = 0;
9190
 
9191
- foreach ( $latest_hashes as $list_type => $file_list ) {
9192
- if (
9193
- $list_type == 'stable'
9194
  || empty($file_list)
9195
  ) {
9196
  continue;
9197
  }
9198
 
9199
- foreach ( $file_list as $file_info ) {
9200
  $file_path = $file_info['filepath'];
9201
- $full_filepath = sprintf( '%s/%s', rtrim( ABSPATH, '/' ), $file_path );
9202
 
9203
  // Skip files that were marked as fixed.
9204
- if ( $ignored_files ) {
9205
  // Get the checksum of the base file name.
9206
- $file_path_checksum = md5( $file_path );
9207
 
9208
- if ( array_key_exists( $file_path_checksum, $ignored_files ) ) {
9209
  continue;
9210
  }
9211
  }
9212
 
9213
  // Add extra information to the file list.
9214
  $css_class = ( $counter % 2 == 0 ) ? '' : 'alternate';
9215
- $file_size = @filesize( $full_filepath );
9216
  $is_fixable_html = '';
9217
  $is_fixable_text = '';
9218
 
9219
  // Check whether the file can be fixed automatically or not.
9220
- if ( $file_info['is_fixable'] !== true ) {
9221
  $css_class .= ' sucuriscan-opacity';
9222
  $is_fixable_html = 'disabled="disbled"';
9223
  $is_fixable_text = '(must be fixed manually)';
@@ -9229,9 +9384,9 @@ function sucuriscan_core_files( $send_email = false ){
9229
  'CoreFiles.StatusType' => $list_type,
9230
  'CoreFiles.FilePath' => $file_path,
9231
  'CoreFiles.FileSize' => $file_size,
9232
- 'CoreFiles.FileSizeHuman' => SucuriScan::human_filesize( $file_size ),
9233
- 'CoreFiles.FileSizeNumber' => number_format( $file_size ),
9234
- 'CoreFiles.ModifiedAt' => SucuriScan::datetime( $file_info['modified_at'] ),
9235
  'CoreFiles.IsFixtableFile' => $is_fixable_html,
9236
  'CoreFiles.IsNotFixable' => $is_fixable_text,
9237
  ));
@@ -9240,7 +9395,7 @@ function sucuriscan_core_files( $send_email = false ){
9240
  }
9241
  }
9242
 
9243
- if ( $counter > 0 ) {
9244
  $template_variables['CoreFiles.ListCount'] = $counter;
9245
  $template_variables['CoreFiles.GoodVisibility'] = 'hidden';
9246
  $template_variables['CoreFiles.BadVisibility'] = 'visible';
@@ -9253,10 +9408,10 @@ function sucuriscan_core_files( $send_email = false ){
9253
  }
9254
 
9255
  // Send an email notification with the affected files.
9256
- if ( $send_email === true ) {
9257
- if ( $affected_files > 0 ) {
9258
- $content = SucuriScanTemplate::get_section( 'notification-corefiles', $template_variables );
9259
- $sent = SucuriScanEvent::notify_event( 'scan_checksums', $content );
9260
 
9261
  return $sent;
9262
  }
@@ -9264,7 +9419,7 @@ function sucuriscan_core_files( $send_email = false ){
9264
  return false;
9265
  }
9266
 
9267
- return SucuriScanTemplate::get_section( 'integrity-corefiles', $template_variables );
9268
  }
9269
 
9270
  /**
@@ -9282,13 +9437,14 @@ function sucuriscan_core_files( $send_email = false ){
9282
  * @param integer $version Valid version number of the WordPress project.
9283
  * @return array Associative array with these keys: modified, stable, removed, added.
9284
  */
9285
- function sucuriscan_check_core_integrity( $version = 0 ){
9286
- $latest_hashes = SucuriScanAPI::get_official_checksums( $version );
9287
- $base_content_dir = defined( 'WP_CONTENT_DIR' )
9288
- ? basename( rtrim( WP_CONTENT_DIR, '/' ) )
 
9289
  : '';
9290
 
9291
- if ( ! $latest_hashes ) {
9292
  return false;
9293
  }
9294
 
@@ -9300,35 +9456,34 @@ function sucuriscan_check_core_integrity( $version = 0 ){
9300
  );
9301
 
9302
  // Get current filesystem tree.
9303
- $wp_top_hashes = sucuriscan_get_integrity_tree( ABSPATH , false );
9304
- $wp_admin_hashes = sucuriscan_get_integrity_tree( ABSPATH . 'wp-admin', true );
9305
- $wp_includes_hashes = sucuriscan_get_integrity_tree( ABSPATH . 'wp-includes', true );
9306
- $wp_core_hashes = array_merge( $wp_top_hashes, $wp_admin_hashes, $wp_includes_hashes );
9307
 
9308
  // Compare remote and local checksums and search removed files.
9309
- foreach ( $latest_hashes as $file_path => $remote_checksum ) {
9310
- if ( sucuriscan_ignore_integrity_filepath( $file_path ) ) {
9311
  continue;
9312
  }
9313
 
9314
- $full_filepath = sprintf( '%s/%s', ABSPATH, $file_path );
9315
 
9316
  // Patch for custom content directory path.
9317
- if (
9318
- ! file_exists( $full_filepath )
9319
- && strpos( $file_path, 'wp-content' ) !== false
9320
- && defined( 'WP_CONTENT_DIR' )
9321
  ) {
9322
- $file_path = str_replace( 'wp-content', $base_content_dir, $file_path );
9323
- $full_filepath = ABSPATH . '/' . $file_path;
 
9324
  }
9325
 
9326
  // Check whether the official file exists or not.
9327
- if ( file_exists( $full_filepath ) ) {
9328
- $local_checksum = @md5_file( $full_filepath );
9329
 
9330
- if (
9331
- $local_checksum !== false
9332
  && $local_checksum === $remote_checksum
9333
  ) {
9334
  $output['stable'][] = array(
@@ -9337,8 +9492,8 @@ function sucuriscan_check_core_integrity( $version = 0 ){
9337
  'modified_at' => 0,
9338
  );
9339
  } else {
9340
- $modified_at = @filemtime( $full_filepath );
9341
- $is_fixable = (bool) is_writable( $full_filepath );
9342
  $output['modified'][] = array(
9343
  'filepath' => $file_path,
9344
  'is_fixable' => $is_fixable,
@@ -9346,7 +9501,7 @@ function sucuriscan_check_core_integrity( $version = 0 ){
9346
  );
9347
  }
9348
  } else {
9349
- $is_fixable = is_writable( dirname( $full_filepath ) );
9350
  $output['removed'][] = array(
9351
  'filepath' => $file_path,
9352
  'is_fixable' => $is_fixable,
@@ -9356,18 +9511,18 @@ function sucuriscan_check_core_integrity( $version = 0 ){
9356
  }
9357
 
9358
  // Search added files (files not common in a normal wordpress installation).
9359
- foreach ( $wp_core_hashes as $file_path => $extra_info ) {
9360
- $file_path = str_replace( DIRECTORY_SEPARATOR, '/', $file_path );
9361
- $file_path = preg_replace( '/^\.\/(.*)/', '$1', $file_path );
9362
 
9363
- if ( sucuriscan_ignore_integrity_filepath( $file_path ) ) {
9364
  continue;
9365
  }
9366
 
9367
- if ( ! array_key_exists( $file_path, $latest_hashes ) ) {
9368
  $full_filepath = ABSPATH . '/' . $file_path;
9369
- $modified_at = @filemtime( $full_filepath );
9370
- $is_fixable = (bool) is_writable( $full_filepath );
9371
  $output['added'][] = array(
9372
  'filepath' => $file_path,
9373
  'is_fixable' => $is_fixable,
@@ -9385,7 +9540,8 @@ function sucuriscan_check_core_integrity( $version = 0 ){
9385
  * @param string $file_path File path that will be compared.
9386
  * @return boolean TRUE if the file should be ignored, FALSE otherwise.
9387
  */
9388
- function sucuriscan_ignore_integrity_filepath( $file_path = '' ){
 
9389
  global $wp_local_package;
9390
 
9391
  // List of files that will be ignored from the integrity checking.
@@ -9416,8 +9572,7 @@ function sucuriscan_ignore_integrity_filepath( $file_path = '' ){
9416
  * of the project, basically they have files with new variables specifying the
9417
  * language that will be used in the admin panel, site options, and emails.
9418
  */
9419
- if (
9420
- isset($wp_local_package)
9421
  && $wp_local_package != 'en_US'
9422
  ) {
9423
  $ignore_files[] = 'wp-includes\/version\.php';
@@ -9425,8 +9580,8 @@ function sucuriscan_ignore_integrity_filepath( $file_path = '' ){
9425
  }
9426
 
9427
  // Determine whether a file must be ignored from the integrity checks or not.
9428
- foreach ( $ignore_files as $ignore_pattern ) {
9429
- if ( preg_match( '/'.$ignore_pattern.'/', $file_path ) ) {
9430
  return true;
9431
  }
9432
  }
@@ -9439,7 +9594,8 @@ function sucuriscan_ignore_integrity_filepath( $file_path = '' ){
9439
  *
9440
  * @return void
9441
  */
9442
- function sucuriscan_modified_files(){
 
9443
  $valid_day_ranges = array( 1, 3, 7, 30, 60 );
9444
  $template_variables = array(
9445
  'ModifiedFiles.List' => '',
@@ -9450,12 +9606,12 @@ function sucuriscan_modified_files(){
9450
  );
9451
 
9452
  // Find files modified in the last days.
9453
- $back_days = SucuriScanRequest::post( ':last_days', '[0-9]+' );
9454
 
9455
- if ( $back_days !== false ) {
9456
- if ( $back_days <= 0 ) {
9457
  $back_days = 1;
9458
- } elseif ( $back_days >= 60 ) {
9459
  $back_days = 60;
9460
  }
9461
  } else {
@@ -9463,34 +9619,35 @@ function sucuriscan_modified_files(){
9463
  }
9464
 
9465
  // Fix data type for the back days variable.
9466
- $back_days = intval( $back_days );
9467
  $template_variables['ModifiedFiles.Days'] = $back_days;
9468
 
9469
  // Generate the options for the select field of the page form.
9470
- foreach ( $valid_day_ranges as $day ) {
9471
  $selected_option = ($back_days == $day) ? 'selected="selected"' : '';
9472
  $template_variables['ModifiedFiles.SelectOptions'] .= sprintf(
9473
  '<option value="%d" %s>%d</option>',
9474
- $day, $selected_option, $day
 
 
9475
  );
9476
  }
9477
 
9478
  // The scanner for modified files can be disabled from the settings page.
9479
- if ( SucuriScanOption::get_option( ':scan_modfiles' ) == 'enabled' ) {
9480
  // Search modified files among the project's files.
9481
- $content_hashes = sucuriscan_get_integrity_tree( WP_CONTENT_DIR, true );
9482
 
9483
- if ( ! empty($content_hashes) ) {
9484
- $back_days = current_time( 'timestamp' ) - ( $back_days * 86400);
9485
  $counter = 0;
9486
 
9487
- foreach ( $content_hashes as $file_path => $file_info ) {
9488
- if (
9489
- isset($file_info['modified_at'])
9490
  && $file_info['modified_at'] >= $back_days
9491
  ) {
9492
  $css_class = ( $counter % 2 == 0 ) ? '' : 'alternate';
9493
- $mod_date = SucuriScan::datetime( $file_info['modified_at'] );
9494
 
9495
  $template_variables['ModifiedFiles.List'] .= SucuriScanTemplate::get_snippet('integrity-modifiedfiles', array(
9496
  'ModifiedFiles.CssClass' => $css_class,
@@ -9498,14 +9655,14 @@ function sucuriscan_modified_files(){
9498
  'ModifiedFiles.FilePath' => $file_path,
9499
  'ModifiedFiles.DateTime' => $mod_date,
9500
  'ModifiedFiles.FileSize' => $file_info['filesize'],
9501
- 'ModifiedFiles.FileSizeHuman' => SucuriScan::human_filesize( $file_info['filesize'] ),
9502
- 'ModifiedFiles.FileSizeNumber' => number_format( $file_info['filesize'] ),
9503
  ));
9504
  $counter += 1;
9505
  }
9506
  }
9507
 
9508
- if ( $counter > 0 ) {
9509
  $template_variables['ModifiedFiles.NoFilesVisibility'] = 'hidden';
9510
  }
9511
  }
@@ -9513,7 +9670,7 @@ function sucuriscan_modified_files(){
9513
  $template_variables['ModifiedFiles.DisabledVisibility'] = 'visible';
9514
  }
9515
 
9516
- return SucuriScanTemplate::get_section( 'integrity-modifiedfiles', $template_variables );
9517
  }
9518
 
9519
  /**
@@ -9744,6 +9901,8 @@ function sucuriscan_reset_user_password( $process_form = false ){
9744
  arsort( $user_identifiers );
9745
 
9746
  foreach ( $user_identifiers as $user_id ) {
 
 
9747
  if ( SucuriScanEvent::set_new_password( $user_id ) ) {
9748
  $pwd_changed[] = $user_id;
9749
  } else {
@@ -9752,14 +9911,14 @@ function sucuriscan_reset_user_password( $process_form = false ){
9752
  }
9753
 
9754
  if ( ! empty($pwd_changed) ) {
9755
- $message = 'Password changed for user identifiers <code>' . @implode( ', ',$pwd_changed ) . '</code>';
9756
 
9757
  SucuriScanEvent::report_notice_event( $message );
9758
  SucuriScanInterface::info( $message );
9759
  }
9760
 
9761
  if ( ! empty($pwd_not_changed) ) {
9762
- SucuriScanInterface::error( 'Password change failed for users: ' . implode( ', ',$pwd_not_changed ) );
9763
  }
9764
  } else {
9765
  SucuriScanInterface::error( 'You did not select a user from the list.' );
@@ -10069,15 +10228,17 @@ function sucuriscan_lastlogins_datastore_filepath(){
10069
  * @return string Absolute filepath where the user's last login information is stored.
10070
  */
10071
  function sucuriscan_lastlogins_datastore_exists(){
10072
- $datastore_filepath = sucuriscan_lastlogins_datastore_filepath();
10073
 
10074
- if ( ! file_exists( $datastore_filepath ) ) {
10075
- if ( @file_put_contents( $datastore_filepath, "<?php exit(0); ?>\n", LOCK_EX ) ) {
10076
- @chmod( $datastore_filepath, 0644 );
10077
- }
 
 
10078
  }
10079
 
10080
- return file_exists( $datastore_filepath ) ? $datastore_filepath : false;
10081
  }
10082
 
10083
  /**
@@ -10267,7 +10428,7 @@ if ( ! function_exists( 'sucuri_login_redirect' ) ) {
10267
  if (
10268
  $user instanceof WP_User
10269
  && in_array( 'administrator', $user->roles )
10270
- && SucuriScanOption::get_option( ':lastlogin_redirection' ) === 'enabled'
10271
  ) {
10272
  $login_url = add_query_arg( 'sucuriscan_lastlogin', 1, $login_url );
10273
  }
@@ -10275,7 +10436,7 @@ if ( ! function_exists( 'sucuri_login_redirect' ) ) {
10275
  return $login_url;
10276
  }
10277
 
10278
- if ( SucuriScanOption::get_option( ':lastlogin_redirection' ) == 'enabled' ) {
10279
  add_filter( 'login_redirect', 'sucuriscan_login_redirect', 10, 3 );
10280
  }
10281
  }
@@ -10624,7 +10785,7 @@ function sucuriscan_failed_logins_panel(){
10624
  * @return boolean TRUE if the password must be collected, FALSE otherwise.
10625
  */
10626
  function sucuriscan_collect_wrong_passwords(){
10627
- return (bool) ( SucuriScanOption::get_option( ':collect_wrong_passwords' ) === 'enabled' );
10628
  }
10629
 
10630
  /**
@@ -10890,8 +11051,7 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
10890
  $sucuriscan_notify_options,
10891
  $sucuriscan_emails_per_hour,
10892
  $sucuriscan_maximum_failed_logins,
10893
- $sucuriscan_email_subjects,
10894
- $sucuriscan_verify_ssl_cert;
10895
 
10896
  // Use this conditional to avoid double checking.
10897
  if ( is_null( $page_nonce ) ) {
@@ -10899,12 +11059,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
10899
  }
10900
 
10901
  if ( $page_nonce ) {
10902
- // Recover API key through the email registered previously.
10903
- if ( SucuriScanRequest::post( ':recover_key' ) !== false ) {
10904
- SucuriScanAPI::recover_key();
10905
- SucuriScanEvent::report_info_event( 'Recovery of the Sucuri API key was requested.' );
10906
- }
10907
-
10908
  // Save API key after it was recovered by the administrator.
10909
  if ( $api_key = SucuriScanRequest::post( ':manual_api_key' ) ) {
10910
  SucuriScanAPI::set_plugin_key( $api_key, true );
@@ -10920,17 +11074,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
10920
  SucuriScanEvent::notify_event( 'plugin_change', 'Sucuri API key removed' );
10921
  }
10922
 
10923
- // Configure the DNS lookups option for reverse proxy detection.
10924
- if ( $dns_lookups = SucuriScanRequest::post(':dns_lookups', '(en|dis)able') ) {
10925
- $action_d = $dns_lookups . 'd';
10926
- $message = 'DNS lookups for reverse proxy detection <code>' . $action_d . '</code>';
10927
-
10928
- SucuriScanOption::update_option( ':dns_lookups', $action_d );
10929
- SucuriScanEvent::report_info_event( $message );
10930
- SucuriScanEvent::notify_event( 'plugin_change', $message );
10931
- SucuriScanInterface::info( $message );
10932
- }
10933
-
10934
  // Enable or disable the filesystem scanner.
10935
  if ( $fs_scanner = SucuriScanRequest::post( ':fs_scanner', '(en|dis)able' ) ) {
10936
  $action_d = $fs_scanner . 'd';
@@ -11121,20 +11264,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
11121
  }
11122
  }
11123
 
11124
- // Update the configuration for the SSL certificate verification.
11125
- if ( $verify_ssl_cert = SucuriScanRequest::post( ':verify_ssl_cert' ) ) {
11126
- if ( array_key_exists( $verify_ssl_cert, $sucuriscan_verify_ssl_cert ) ) {
11127
- $message = 'SSL certificate verification for API calls set to <code>' . $verify_ssl_cert . '</code>';
11128
-
11129
- SucuriScanOption::update_option( ':verify_ssl_cert', $verify_ssl_cert );
11130
- SucuriScanEvent::report_warning_event( $message );
11131
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11132
- SucuriScanInterface::info( $message );
11133
- } else {
11134
- SucuriScanInterface::error( 'Invalid value for the SSL certificate verification.' );
11135
- }
11136
- }
11137
-
11138
  // Enable or disable the audit logs report.
11139
  if ( $audit_report = SucuriScanRequest::post( ':audit_report', '(en|dis)able' ) ) {
11140
  $action_d = $audit_report . 'd';
@@ -11146,39 +11275,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
11146
  SucuriScanInterface::info( $message );
11147
  }
11148
 
11149
- // Enable or disable the reverse proxy support.
11150
- if ( $revproxy = SucuriScanRequest::post( ':revproxy', '(en|dis)able' ) ) {
11151
- $action_d = $revproxy . 'd';
11152
- $message = 'Reverse proxy support was <code>' . $action_d . '</code>';
11153
-
11154
- SucuriScanOption::update_option( ':revproxy', $action_d );
11155
- SucuriScanEvent::report_info_event( $message );
11156
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11157
- SucuriScanInterface::info( $message );
11158
- }
11159
-
11160
- // Configure the comment monitor option.
11161
- if ( $comment_monitor = SucuriScanRequest::post(':comment_monitor', '(en|dis)able') ) {
11162
- $action_d = $comment_monitor . 'd';
11163
- $message = 'Comment monitor was <code>' . $action_d . '</code>';
11164
-
11165
- SucuriScanOption::update_option( ':comment_monitor', $action_d );
11166
- SucuriScanEvent::report_info_event( $message );
11167
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11168
- SucuriScanInterface::info( $message );
11169
- }
11170
-
11171
- // Configure the XHR monitor option.
11172
- if ( $xhr_monitor = SucuriScanRequest::post(':xhr_monitor', '(en|dis)able') ) {
11173
- $action_d = $xhr_monitor . 'd';
11174
- $message = 'XHR (XML HTTP Request) monitor was <code>' . $action_d . '</code>';
11175
-
11176
- SucuriScanOption::update_option( ':xhr_monitor', $action_d );
11177
- SucuriScanEvent::report_info_event( $message );
11178
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11179
- SucuriScanInterface::info( $message );
11180
- }
11181
-
11182
  // Update the limit for audit logs report.
11183
  if ( $logs4report = SucuriScanRequest::post( ':logs4report', '[0-9]{1,4}' ) ) {
11184
  $message = 'Limit for audit logs report set to <code>' . $logs4report . '</code>';
@@ -11189,82 +11285,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
11189
  SucuriScanInterface::info( $message );
11190
  }
11191
 
11192
- // Update the API request timeout.
11193
- if ( $request_timeout = SucuriScanRequest::post( ':request_timeout', '[0-9]+' ) ) {
11194
- $message = 'API request timeout set to <code>' . $request_timeout . '</code> seconds.';
11195
-
11196
- SucuriScanOption::update_option( ':request_timeout', $request_timeout );
11197
- SucuriScanEvent::report_info_event( $message );
11198
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11199
- SucuriScanInterface::info( $message );
11200
- }
11201
-
11202
- // Update the collection of failed passwords settings.
11203
- if ( $collect_wrong_passwords = SucuriScanRequest::post( ':collect_wrong_passwords' ) ) {
11204
- $collect_wrong_passwords = strtolower( $collect_wrong_passwords );
11205
- $message = 'Collect failed login passwords set to <code>%s</code>';
11206
-
11207
- if ( $collect_wrong_passwords == 'yes' ) {
11208
- $collect_action = 'enabled';
11209
- $message = sprintf( $message, $collect_action );
11210
- SucuriScanEvent::report_critical_event( $message );
11211
- } else {
11212
- $collect_action = 'disabled';
11213
- $message = sprintf( $message, $collect_action );
11214
- SucuriScanEvent::report_info_event( $message );
11215
- }
11216
-
11217
- SucuriScanOption::update_option( ':collect_wrong_passwords', $collect_action );
11218
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11219
- SucuriScanInterface::info( $message );
11220
- }
11221
-
11222
- // Update the datastore path (if the new directory exists).
11223
- if ( $datastore_path = SucuriScanRequest::post( ':datastore_path' ) ) {
11224
- $current_datastore_path = SucuriScanOption::datastore_folder_path();
11225
-
11226
- // Try to create the new directory (if possible).
11227
- if ( ! file_exists( $datastore_path ) ) {
11228
- @mkdir( $datastore_path, 0755, true );
11229
- }
11230
-
11231
- // Check if the directory is writable and move all the logs.
11232
- if ( file_exists( $datastore_path ) ) {
11233
- if ( is_writable( $datastore_path ) ) {
11234
- $message = 'Datastore path set to <code>' . $datastore_path . '</code>';
11235
-
11236
- SucuriScanOption::update_option( ':datastore_path', $datastore_path );
11237
- SucuriScanEvent::report_info_event( $message );
11238
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11239
- SucuriScanInterface::info( $message );
11240
-
11241
- if ( file_exists( $current_datastore_path ) ) {
11242
- $new_datastore_path = SucuriScanOption::datastore_folder_path();
11243
-
11244
- // Some file systems do not work correctly with trailing separators.
11245
- $current_datastore_path = rtrim( $current_datastore_path, '/' );
11246
- $new_datastore_path = rtrim( $new_datastore_path, '/' );
11247
- @rename( $current_datastore_path, $new_datastore_path );
11248
- }
11249
- } else {
11250
- SucuriScanInterface::error( 'The new directory path is not writable.' );
11251
- }
11252
- } else {
11253
- SucuriScanInterface::error( 'The directory path specified does not exists.' );
11254
- }
11255
- }
11256
-
11257
- // Update the advertisement visibility settings.
11258
- if ( $ads_visibility = SucuriScanRequest::post( ':ads_visibility' ) ) {
11259
- $ads_visibility = strtolower( $ads_visibility );
11260
- $option_value = ( $ads_visibility == 'hide' ) ? 'disabled' : 'enabled';
11261
- $message = sprintf( 'Plugin advertisement set to <code>%s</code>', $option_value );
11262
-
11263
- SucuriScanOption::update_option( ':ads_visibility', $option_value );
11264
- SucuriScanEvent::report_info_event( $message );
11265
- SucuriScanInterface::info( $message );
11266
- }
11267
-
11268
  // Update the notification settings.
11269
  if ( SucuriScanRequest::post( ':save_notification_settings' ) !== false ) {
11270
  $options_updated_counter = 0;
@@ -11343,22 +11363,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
11343
  }
11344
  }
11345
 
11346
- // Reset all the plugin's options.
11347
- if ( SucuriScanRequest::post( ':reset_options' ) !== false ) {
11348
- // Notify the event before the API key is removed.
11349
- $message = 'Sucuri plugin options were reset';
11350
- SucuriScanEvent::report_critical_event( $message );
11351
- SucuriScanEvent::notify_event( 'plugin_change', $message );
11352
-
11353
- // Remove all plugin options from the database.
11354
- SucuriScanOption::delete_plugin_options();
11355
-
11356
- // Remove the scheduled tasks.
11357
- wp_clear_scheduled_hook( 'sucuriscan_scheduled_scan' );
11358
-
11359
- SucuriScanInterface::info( 'All plugin options were reset successfully' );
11360
- }
11361
-
11362
  // Ignore a new event for email notifications.
11363
  if ( $action = SucuriScanRequest::post( ':ignorerule_action', '(add|remove)' ) ) {
11364
  $ignore_rule = SucuriScanRequest::post( ':ignorerule' );
@@ -11512,16 +11516,6 @@ function sucuriscan_settings_form_submissions( $page_nonce = null ){
11512
  SucuriScanInterface::info( $message );
11513
  }
11514
 
11515
- // Debug ability of the plugin to send HTTP requests correctly.
11516
- if ( SucuriScanRequest::post( ':debug_request' ) ) {
11517
- SucuriScanInterface::info(
11518
- sprintf(
11519
- '<pre>%s</pre>',
11520
- SucuriScanAPI::test_api_call()
11521
- )
11522
- );
11523
- }
11524
-
11525
  // Debug ability of the plugin to send email alerts correctly.
11526
  if ( SucuriScanRequest::post( ':debug_email' ) ) {
11527
  $recipient = SucuriScanOption::get_option( ':notify_to' );
@@ -11566,8 +11560,7 @@ function sucuriscan_settings_page(){
11566
  function sucuriscan_settings_general(){
11567
 
11568
  global $sucuriscan_emails_per_hour,
11569
- $sucuriscan_maximum_failed_logins,
11570
- $sucuriscan_verify_ssl_cert;
11571
 
11572
  // Check the nonce here to populate the value through other functions.
11573
  $page_nonce = SucuriScanInterface::check_nonce();
@@ -11575,112 +11568,50 @@ function sucuriscan_settings_general(){
11575
  // Process all form submissions.
11576
  sucuriscan_settings_form_submissions( $page_nonce );
11577
 
11578
- // Register the site, get its API key, and store it locally for future usage.
11579
- $api_registered_modal = '';
11580
-
11581
- // Whether the form to manually add the API key should be shown or not.
11582
- $display_manual_key_form = (bool) ( SucuriScanRequest::post( ':recover_key' ) !== false );
11583
-
11584
- if ( $page_nonce && SucuriScanRequest::post( ':plugin_api_key' ) !== false ) {
11585
- $user_id = SucuriScanRequest::post(':setup_user');
11586
- $user_obj = SucuriScan::get_user_by_id( $user_id );
11587
-
11588
- if (
11589
- $user_obj !== false
11590
- && user_can( $user_obj, 'administrator' )
11591
- ) {
11592
- // Send request to generate new API key or display form to set manually.
11593
- if ( SucuriScanAPI::register_site( $user_obj->user_email ) ) {
11594
- $api_registered_modal = SucuriScanTemplate::get_modal(
11595
- 'settings-apiregistered',
11596
- array(
11597
- 'Title' => 'Site registered successfully',
11598
- 'CssClass' => 'sucuriscan-apikey-registered',
11599
- )
11600
- );
11601
- } else {
11602
- $display_manual_key_form = true;
11603
- }
11604
- }
11605
- }
11606
-
11607
  // Get initial variables to decide some things bellow.
11608
- $api_key = SucuriScanAPI::get_plugin_key();
11609
  $emails_per_hour = SucuriScanOption::get_option( ':emails_per_hour' );
11610
  $maximum_failed_logins = SucuriScanOption::get_option( ':maximum_failed_logins' );
11611
- $verify_ssl_cert = SucuriScanOption::get_option( ':verify_ssl_cert' );
11612
  $audit_report = SucuriScanOption::get_option( ':audit_report' );
11613
  $logs4report = SucuriScanOption::get_option( ':logs4report' );
11614
- $revproxy = SucuriScanOption::get_option( ':revproxy' );
11615
- $dns_lookups = SucuriScanOption::get_option( ':dns_lookups' );
11616
- $comment_monitor = SucuriScanOption::get_option( ':comment_monitor' );
11617
- $xhr_monitor = SucuriScanOption::get_option( ':xhr_monitor' );
11618
- $invalid_domain = false;
11619
-
11620
- // Check whether the domain name is valid or not.
11621
- if ( ! $api_key ) {
11622
- $clean_domain = SucuriScan::get_top_level_domain();
11623
- $domain_address = @gethostbyname( $clean_domain );
11624
- $invalid_domain = ( $domain_address == $clean_domain ) ? true : false;
11625
- }
11626
 
11627
  // Generate the HTML code for the option list in the form select fields.
11628
  $emails_per_hour_options = SucuriScanTemplate::get_select_options( $sucuriscan_emails_per_hour, $emails_per_hour );
11629
  $maximum_failed_logins_options = SucuriScanTemplate::get_select_options( $sucuriscan_maximum_failed_logins, $maximum_failed_logins );
11630
- $verify_ssl_cert_options = SucuriScanTemplate::get_select_options( $sucuriscan_verify_ssl_cert, $verify_ssl_cert );
11631
 
11632
  $template_variables = array(
11633
- 'APIKey' => ( ! $api_key ? '<em>(not set)</em>' : $api_key ),
11634
- 'APIKey.RecoverVisibility' => SucuriScanTemplate::visibility( ! $api_key && ! $display_manual_key_form ),
11635
- 'APIKey.ManualKeyFormVisibility' => SucuriScanTemplate::visibility( $display_manual_key_form ),
11636
- 'APIKey.RemoveVisibility' => SucuriScanTemplate::visibility( (bool) $api_key ),
11637
- 'InvalidDomainVisibility' => SucuriScanTemplate::visibility( $invalid_domain ),
11638
  'NotifyTo' => SucuriScanOption::get_option( ':notify_to' ),
11639
  'EmailsPerHour' => 'Undefined',
11640
  'EmailsPerHourOptions' => $emails_per_hour_options,
11641
  'MaximumFailedLogins' => 'Undefined',
11642
  'MaximumFailedLoginsOptions' => $maximum_failed_logins_options,
11643
- 'VerifySSLCert' => 'Undefined',
11644
- 'VerifySSLCertOptions' => $verify_ssl_cert_options,
11645
- 'RequestTimeout' => SucuriScanOption::get_option( ':request_timeout' ) . ' seconds',
11646
- 'DatastorePath' => SucuriScanOption::get_option( ':datastore_path' ),
11647
- 'CollectWrongPasswords' => 'No collect passwords',
11648
- 'ModalWhenAPIRegistered' => $api_registered_modal,
11649
  /* Audit Logs Report */
11650
  'AuditReportStatus' => 'Enabled',
11651
  'AuditReportSwitchText' => 'Disable',
11652
  'AuditReportSwitchValue' => 'disable',
11653
  'AuditReportSwitchCssClass' => 'button-danger',
11654
  'AuditReportLimit' => $logs4report,
11655
- /* Support Reverse Proxy */
11656
- 'ReverseProxyStatus' => 'Enabled',
11657
- 'ReverseProxySwitchText' => 'Disable',
11658
- 'ReverseProxySwitchValue' => 'disable',
11659
- 'ReverseProxySwitchCssClass' => 'button-danger',
11660
- /* Execute DNS Lookups */
11661
- 'DnsLookupsStatus' => 'Enabled',
11662
- 'DnsLookupsSwitchText' => 'Disable',
11663
- 'DnsLookupsSwitchValue' => 'disable',
11664
- 'DnsLookupsSwitchCssClass' => 'button-danger',
11665
- /* Comment Monitoring */
11666
- 'CommentMonitorStatus' => 'Enabled',
11667
- 'CommentMonitorSwitchText' => 'Disable',
11668
- 'CommentMonitorSwitchValue' => 'disable',
11669
- 'CommentMonitorSwitchCssClass' => 'button-danger',
11670
- /* XHR Monitoring */
11671
- 'XhrMonitorStatus' => 'Enabled',
11672
- 'XhrMonitorSwitchText' => 'Disable',
11673
- 'XhrMonitorSwitchValue' => 'disable',
11674
- 'XhrMonitorSwitchCssClass' => 'button-danger',
11675
- /* API Proxy Settings */
11676
- 'APIProxy.Host' => 'no_proxy_host',
11677
- 'APIProxy.Port' => 'no_proxy_port',
11678
- 'APIProxy.Username' => 'no_proxy_username',
11679
- 'APIProxy.Password' => 'no_proxy_password',
11680
- 'APIProxy.PasswordType' => 'default',
11681
- 'APIProxy.PasswordText' => 'empty',
11682
  );
11683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11684
  if ( array_key_exists( $emails_per_hour, $sucuriscan_emails_per_hour ) ) {
11685
  $template_variables['EmailsPerHour'] = $sucuriscan_emails_per_hour[ $emails_per_hour ];
11686
  }
@@ -11689,10 +11620,6 @@ function sucuriscan_settings_general(){
11689
  $template_variables['MaximumFailedLogins'] = $sucuriscan_maximum_failed_logins[ $maximum_failed_logins ];
11690
  }
11691
 
11692
- if ( array_key_exists( $verify_ssl_cert, $sucuriscan_verify_ssl_cert ) ) {
11693
- $template_variables['VerifySSLCert'] = $sucuriscan_verify_ssl_cert[ $verify_ssl_cert ];
11694
- }
11695
-
11696
  if ( $audit_report == 'disabled' ) {
11697
  $template_variables['AuditReportStatus'] = 'Disabled';
11698
  $template_variables['AuditReportSwitchText'] = 'Enable';
@@ -11700,47 +11627,100 @@ function sucuriscan_settings_general(){
11700
  $template_variables['AuditReportSwitchCssClass'] = 'button-success';
11701
  }
11702
 
11703
- if ( $revproxy == 'disabled' ) {
11704
- $template_variables['ReverseProxyStatus'] = 'Disabled';
11705
- $template_variables['ReverseProxySwitchText'] = 'Enable';
11706
- $template_variables['ReverseProxySwitchValue'] = 'enable';
11707
- $template_variables['ReverseProxySwitchCssClass'] = 'button-success';
11708
  }
11709
 
11710
- if ( $dns_lookups == 'disabled' ) {
11711
- $template_variables['DnsLookupsStatus'] = 'Disabled';
11712
- $template_variables['DnsLookupsSwitchText'] = 'Enable';
11713
- $template_variables['DnsLookupsSwitchValue'] = 'enable';
11714
- $template_variables['DnsLookupsSwitchCssClass'] = 'button-success';
11715
- }
11716
 
11717
- if ( $comment_monitor == 'disabled' ) {
11718
- $template_variables['CommentMonitorStatus'] = 'Disabled';
11719
- $template_variables['CommentMonitorSwitchText'] = 'Enable';
11720
- $template_variables['CommentMonitorSwitchValue'] = 'enable';
11721
- $template_variables['CommentMonitorSwitchCssClass'] = 'button-success';
11722
- }
11723
 
11724
- if ( $xhr_monitor == 'disabled' ) {
11725
- $template_variables['XhrMonitorStatus'] = 'Disabled';
11726
- $template_variables['XhrMonitorSwitchText'] = 'Enable';
11727
- $template_variables['XhrMonitorSwitchValue'] = 'enable';
11728
- $template_variables['XhrMonitorSwitchCssClass'] = 'button-success';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11729
  }
11730
 
11731
- if ( sucuriscan_collect_wrong_passwords() === true ) {
11732
- $template_variables['CollectWrongPasswords'] = '<span class="sucuriscan-label-error">Yes, collect passwords</span>';
 
 
 
 
 
11733
  }
11734
 
11735
- // Determine if the API calls with pass through a proxy or not.
11736
- if ( class_exists( 'WP_HTTP_Proxy' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11737
  $wp_http_proxy = new WP_HTTP_Proxy();
11738
 
11739
- if ( $wp_http_proxy->is_enabled() ) {
11740
- $proxy_host = SucuriScan::escape( $wp_http_proxy->host() );
11741
- $proxy_port = SucuriScan::escape( $wp_http_proxy->port() );
11742
- $proxy_username = SucuriScan::escape( $wp_http_proxy->username() );
11743
- $proxy_password = SucuriScan::escape( $wp_http_proxy->password() );
11744
 
11745
  $template_variables['APIProxy.Host'] = $proxy_host;
11746
  $template_variables['APIProxy.Port'] = $proxy_port;
@@ -11752,7 +11732,388 @@ function sucuriscan_settings_general(){
11752
  }
11753
  }
11754
 
11755
- return SucuriScanTemplate::get_section( 'settings-general', $template_variables );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11756
  }
11757
 
11758
  /**
@@ -12570,7 +12931,7 @@ function sucuriscan_infosys_errorlogs(){
12570
  $error_log_path = @realpath( ABSPATH . '/' . $log_filename );
12571
  }
12572
 
12573
- if ( SucuriScanOption::get_option( ':parse_errorlogs' ) === 'disabled' ) {
12574
  $template_variables['ErrorLog.DisabledVisibility'] = 'visible';
12575
  }
12576
 
@@ -12625,15 +12986,7 @@ function sucuriscan_server_info(){
12625
  'Plugin_version' => SUCURISCAN_VERSION,
12626
  'Plugin_checksum' => SUCURISCAN_PLUGIN_CHECKSUM,
12627
  'Last_filesystem_scan' => SucuriScanFSScanner::get_filesystem_runtime( true ),
12628
- 'Using_CloudProxy' => 'Unknown',
12629
- 'Support_Reverse_Proxy' => 'Unknown',
12630
- 'Host_Address' => 'Unknown',
12631
- 'HTTP_Host' => 'Unknown',
12632
- 'Host_Name' => 'Unknown',
12633
- 'Site_URL' => 'Unknown',
12634
- 'Top_Level_Domain' => 'Unknown',
12635
- 'Remote_Address' => SucuriScan::get_remote_addr(),
12636
- 'Remote_Address_Header' => SucuriScan::get_remote_addr_header(),
12637
  'Operating_system' => sprintf( '%s (%d Bit)', PHP_OS, PHP_INT_SIZE * 8 ),
12638
  'Server' => 'Unknown',
12639
  'Developer_mode' => 'OFF',
@@ -12643,16 +12996,11 @@ function sucuriscan_server_info(){
12643
  'PHP_version' => PHP_VERSION,
12644
  );
12645
 
12646
- $proxy_info = SucuriScan::is_behind_cloudproxy( true );
12647
- $reverse_proxy = SucuriScan::support_reverse_proxy();
12648
-
12649
- $info_vars['HTTP_Host'] = $proxy_info['http_host'];
12650
- $info_vars['Host_Name'] = $proxy_info['host_name'];
12651
- $info_vars['Host_Address'] = $proxy_info['host_addr'];
12652
- $info_vars['Site_URL'] = SucuriScan::get_domain();
12653
- $info_vars['Top_Level_Domain'] = SucuriScan::get_domain( true );
12654
- $info_vars['Using_CloudProxy'] = $proxy_info['status'] ? 'Yes' : 'No';
12655
- $info_vars['Support_Reverse_Proxy'] = $reverse_proxy ? 'Yes' : 'No';
12656
 
12657
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
12658
  $info_vars['Developer_mode'] = 'ON';
4
  Plugin URI: http://wordpress.sucuri.net/
5
  Description: The <a href="http://sucuri.net/" target="_blank">Sucuri</a> plugin provides the website owner the best Activity Auditing, SiteCheck Remote Malware Scanning, Effective Security Hardening and Post-Hack features. SiteCheck will check for malware, spam, blacklisting and other security issues like .htaccess redirects, hidden eval code, etc. The best thing about it is it's completely free.
6
  Author: Sucuri, INC
7
+ Version: 1.7.14
8
  Author URI: http://sucuri.net
9
  */
10
 
66
  /**
67
  * Current version of the plugin's code.
68
  */
69
+ define( 'SUCURISCAN_VERSION', '1.7.14' );
70
 
71
  /**
72
  * The name of the Sucuri plugin main file.
157
  * considering the total number of lines that this file will have.
158
  */
159
  if ( defined( 'SUCURISCAN' ) ) {
160
+ /**
161
+ * Define the prefix for some actions and filters that rely in the
162
+ * differentiation of the type of site where the extension is being used. There
163
+ * are a few differences between a single site installation that must be
164
+ * correctly defined when the extension is in a different environment, for
165
+ * example, in a multisite installation.
166
+ *
167
+ * @var string
168
+ */
169
+ $sucuriscan_action_prefix = SucuriScan::is_multisite() ? 'network_' : '';
170
+
171
  /**
172
  * List an associative array with the sub-pages of this plugin.
173
  *
199
  $sucuriscan_notify_options = array(
200
  'sucuriscan_notify_plugin_change' => 'Receive email alerts for <strong>Sucuri</strong> plugin changes',
201
  'sucuriscan_prettify_mails' => 'Receive email alerts in HTML <em>(there may be issues with some mail services)</em>',
202
+ 'sucuriscan_use_wpmail' => 'Use WordPress functions to send mails <em>(uncheck to use native PHP functions)</em>',
203
  'sucuriscan_lastlogin_redirection' => 'Allow redirection after login to report the last-login information',
204
  'sucuriscan_notify_scan_checksums' => 'Receive email alerts for core integrity checks',
205
  'sucuriscan_notify_user_registration' => 'user:Receive email alerts for new user registration',
206
  'sucuriscan_notify_success_login' => 'user:Receive email alerts for successful login attempts',
207
  'sucuriscan_notify_failed_login' => 'user:Receive email alerts for failed login attempts',
208
  'sucuriscan_notify_bruteforce_attack' => 'user:Receive email alerts for password guessing brute force attacks',
209
+ 'sucuriscan_notify_post_publication' => 'Receive email alerts for Post-Type changes <em>(configure from Ignore Alerts)</em>',
210
  'sucuriscan_notify_website_updated' => 'Receive email alerts when the WordPress version is updated',
211
  'sucuriscan_notify_settings_updated' => 'Receive email alerts when your website settings are updated',
212
  'sucuriscan_notify_theme_editor' => 'Receive email alerts when a file is modified with theme/plugin editor',
295
  add_action( 'admin_init', 'SucuriScanInterface::create_datastore_folder' );
296
  add_action( 'admin_init', 'SucuriScanInterface::handle_old_plugins' );
297
  add_action( 'admin_enqueue_scripts', 'SucuriScanInterface::enqueue_scripts', 1 );
298
+
299
+ /**
300
+ * Display extension menu and submenu items in the correct interface. For single
301
+ * site installations the menu items can be displayed normally as always but for
302
+ * multisite installations the menu items must be available only in the network
303
+ * panel and hidden in the administration panel of the subsites.
304
+ */
305
+ add_action( $sucuriscan_action_prefix . 'admin_menu', 'SucuriScanInterface::add_interface_menu' );
306
 
307
  /**
308
  * Attach Ajax requests to a custom page handler.
347
  'xmlrpc_publish_post',
348
  );
349
 
350
+ if ( SucuriScanOption::is_enabled( ':xhr_monitor' ) ) {
351
  $sucuriscan_hooks[] = 'all';
352
  }
353
 
371
  * the plugin to execute the filesystem scans, the project integrity, and the
372
  * email notifications.
373
  */
374
+ add_action( $sucuriscan_action_prefix . 'admin_notices', 'SucuriScanInterface::setup_notice' );
375
 
376
  /**
377
  * Heartbeat API
433
  public static function ini_get( $property = '' ){
434
  $ini_value = ini_get( $property );
435
 
436
+ if ( $ini_value === false ) {
437
+ $ini_value = 'Undefined';
438
+ } elseif ( empty($ini_value) ) {
439
+ $ini_value = 'Off';
440
+ } elseif ( is_null( $ini_value ) ) {
441
  switch ( $property ) {
442
  case 'error_log': $ini_value = 'error_log'; break;
443
  case 'safe_mode': $ini_value = 'Off'; break;
 
444
  case 'memory_limit': $ini_value = '128M'; break;
445
  case 'upload_max_filesize': $ini_value = '2M'; break;
446
  case 'post_max_size': $ini_value = '8M'; break;
764
  * @return boolean TRUE if reverse proxies must be supported, FALSE otherwise.
765
  */
766
  public static function support_reverse_proxy(){
767
+ return SucuriScanOption::is_enabled( ':revproxy' );
768
  }
769
 
770
  /**
781
  public static function execute_dns_lookups(){
782
  if (
783
  ( defined( 'NOT_USING_CLOUDPROXY' ) && NOT_USING_CLOUDPROXY === true )
784
+ || SucuriScanOption::is_disabled( ':dns_lookups' )
785
  ) {
786
  return false;
787
  }
934
  * @param integer $timestamp Unix timestamp.
935
  * @return string The date, translated if locale specifies it.
936
  */
937
+ public static function datetime($timestamp = null){
938
+ $date_format = get_option('date_format');
939
+ $time_format = get_option('time_format');
940
+ $tz_format = sprintf('%s %s', $date_format, $time_format);
 
 
941
 
942
+ if (is_numeric($timestamp) && $timestamp > 0) {
943
+ return date_i18n($tz_format, $timestamp);
 
 
 
944
  }
945
 
946
+ return date_i18n($tz_format);
947
  }
948
 
949
  /**
952
  * @return string The date, translated if locale specifies it.
953
  */
954
  public static function current_datetime(){
955
+ return self::datetime();
 
 
956
  }
957
 
958
  /**
2571
  'sucuriscan_collect_wrong_passwords' => 'disabled',
2572
  'sucuriscan_comment_monitor' => 'disabled',
2573
  'sucuriscan_datastore_path' => '',
2574
+ 'sucuriscan_dismiss_setup' => 'disabled',
2575
  'sucuriscan_dns_lookups' => 'enabled',
2576
  'sucuriscan_email_subject' => 'Sucuri Alert, :domain, :event',
2577
  'sucuriscan_emails_per_hour' => 5,
2623
  'sucuriscan_site_version' => '0.0',
2624
  'sucuriscan_sitecheck_counter' => 0,
2625
  'sucuriscan_sitecheck_scanner' => 'enabled',
2626
+ 'sucuriscan_use_wpmail' => 'enabled',
2627
  'sucuriscan_verify_ssl_cert' => 'false',
2628
  'sucuriscan_xhr_monitor' => 'disabled',
2629
  );
2769
  return false;
2770
  }
2771
 
2772
+ /**
2773
+ * Check whether a setting is enabled or not.
2774
+ *
2775
+ * @param string $option Name of the option to be deleted.
2776
+ * @return boolean True if the option is enabled, false otherwise.
2777
+ */
2778
+ public static function is_enabled( $option = '' ){
2779
+ return (bool) ( self::get_option( $option ) === 'enabled' );
2780
+ }
2781
+
2782
+ /**
2783
+ * Check whether a setting is disabled or not.
2784
+ *
2785
+ * @param string $option Name of the option to be deleted.
2786
+ * @return boolean True if the option is disabled, false otherwise.
2787
+ */
2788
+ public static function is_disabled( $option = '' ){
2789
+ return (bool) ( self::get_option( $option ) === 'disabled' );
2790
+ }
2791
+
2792
  /**
2793
  * Delete all the plugin options from the database.
2794
  *
3088
 
3089
  // The filesystem scanner can be disabled from the settings page.
3090
  if (
3091
+ SucuriScanOption::is_disabled( ':fs_scanner' )
3092
  && $force_scan === false
3093
  ) {
3094
  return false;
3948
  && property_exists( $comment, 'comment_ID' )
3949
  && property_exists( $comment, 'comment_agent' )
3950
  && property_exists( $comment, 'comment_author_IP' )
3951
+ && SucuriScanOption::is_enabled( ':comment_monitor' )
3952
  ) {
3953
  $data_set = array(
3954
  'id' => $comment->comment_ID,
4517
  return self::process_response( $response, $params, $args );
4518
  }
4519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4520
  /**
4521
  * Check whether the plugin API key is valid or not.
4522
  *
5643
  * @return boolean Whether the emails will be in HTML or Plain/Text.
5644
  */
5645
  public static function prettify_mails(){
5646
+ return self::is_enabled( ':prettify_mails' );
5647
  }
5648
 
5649
  /**
5695
  }
5696
 
5697
  $subject = self::get_email_subject( $subject );
5698
+
5699
+ /**
5700
+ * WordPress uses a library named PHPMailer [1] to send emails through the
5701
+ * provided function wp_mail [2], unfortunately the debug information is
5702
+ * completely removed and this makes it difficult to troubleshoots issues
5703
+ * reported by users when the SMTP server in their sites is misconfigured. To
5704
+ * reduce the number of tickets related with this issue we will provide an
5705
+ * option to allow the users to choose which technique will be used to send the
5706
+ * notifications.
5707
+ *
5708
+ * [1] https://github.com/PHPMailer/PHPMailer
5709
+ * [2] https://developer.wordpress.org/reference/functions/wp_mail/
5710
+ *
5711
+ * @var boolean
5712
+ */
5713
+ if ( SucuriScanOption::is_enabled( ':use_wpmail' ) ) {
5714
+ $mail_sent = wp_mail( $email, $subject, $message, $headers );
5715
+ } else {
5716
+ $headers = implode( "\r\n", $headers );
5717
+ $mail_sent = @mail( $email, $subject, $message, $headers );
5718
+ }
5719
 
5720
  if ( $mail_sent ) {
5721
  $emails_sent_num = (int) self::get_option( ':emails_sent' );
5935
  }
5936
 
5937
  // Hide the advertisements from the layout.
5938
+ if (SucuriScanOption::is_disabled(':ads_visibility')) {
 
 
5939
  $params['LayoutType'] = 'onecolumn';
5940
  $params['AdsVisibility'] = 'hidden';
5941
  $params['ReviewNavbarButton'] = 'visible';
5942
+ $params['PageSidebarContent'] = '';
5943
  } else {
5944
  $params['LayoutType'] = 'twocolumns';
5945
  $params['AdsVisibility'] = 'visible';
5946
  $params['ReviewNavbarButton'] = 'hidden';
5947
+ $params['PageSidebarContent'] = self::get_template('bsidebar', $params, 'section');
5948
  }
5949
 
5950
  return $params;
6018
  foreach ( $sub_pages as $sub_page_func => $sub_page_title ) {
6019
  if (
6020
  $sub_page_func == 'sucuriscan_scanner'
6021
+ && SucuriScanOption::is_disabled( ':sitecheck_scanner' )
6022
  ) {
6023
  continue;
6024
  }
6275
  return $html_links;
6276
  }
6277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6278
  }
6279
 
6280
  /**
6321
  * @return boolean Whether the feature to ignore files is enabled or not.
6322
  */
6323
  public static function will_ignore_scanning(){
6324
+ return SucuriScanOption::is_enabled( ':ignore_scanning' );
6325
  }
6326
 
6327
  /**
6722
  $asset_version = substr( SUCURISCAN_PLUGIN_CHECKSUM, 0, 7 );
6723
  }
6724
 
6725
+ wp_register_style( 'sucuriscan', SUCURISCAN_URL . '/inc/css/sucuri-scanner.min.css', array(), $asset_version );
6726
+ wp_register_script( 'sucuriscan', SUCURISCAN_URL . '/inc/js/sucuri-scanner.min.js', array(), $asset_version );
6727
  wp_enqueue_style( 'sucuriscan' );
6728
  wp_enqueue_script( 'sucuriscan' );
6729
 
6730
  if ( SucuriScanRequest::get( 'page', 'sucuriscan' ) !== false ) {
6731
+ wp_register_script( 'sucuriscan2', SUCURISCAN_URL . '/inc/js/d3.min.js', array(), $asset_version );
6732
  wp_register_script( 'sucuriscan3', SUCURISCAN_URL . '/inc/js/c3.min.js', array(), $asset_version );
6733
  wp_enqueue_script( 'sucuriscan2' );
6734
  wp_enqueue_script( 'sucuriscan3' );
6762
  foreach ( $sucuriscan_pages as $sub_page_func => $sub_page_title ) {
6763
  if (
6764
  $sub_page_func == 'sucuriscan_scanner'
6765
+ && SucuriScanOption::is_disabled( ':sitecheck_scanner' )
6766
  ) {
6767
  continue;
6768
  }
6821
  * @return void
6822
  */
6823
  public static function create_datastore_folder(){
6824
+ $directory = SucuriScan::datastore_folder_path();
6825
 
6826
+ if (!file_exists($directory)) {
6827
+ @mkdir($directory, 0755, true);
6828
+ }
6829
 
6830
+ if (file_exists($directory)) {
6831
+ // Create last-logins datastore file.
6832
+ sucuriscan_lastlogins_datastore_exists();
6833
 
6834
+ // Create a htaccess file to deny access from all.
6835
+ @file_put_contents(
6836
+ $directory . '/.htaccess',
6837
+ "Order Deny,Allow\nDeny from all\n",
6838
+ LOCK_EX
6839
+ );
6840
 
6841
+ // Create an index.html to avoid directory listing.
6842
+ @file_put_contents(
6843
+ $directory . '/index.html',
6844
+ '<!-- Prevent the directory listing. -->',
6845
+ LOCK_EX
6846
+ );
6847
+ } else {
6848
+ SucuriScanOption::delete_option(':datastore_path');
6849
+ SucuriScanInterface::error(
6850
+ 'Data folder does not exists and could not be created. Try to <a href="' .
6851
+ SucuriScanTemplate::get_url('settings') . '">click this link</a> to see
6852
+ if the plugin is able to fix this error automatically, if this message
6853
+ reappears you will need to either change the location of the directory from
6854
+ the plugin general settings page or create this directory manually and give
6855
+ it write permissions: <code>' . $directory . '</code>'
6856
+ );
 
6857
  }
6858
  }
6859
 
6970
  && SucuriScanRequest::post( ':recover_key' ) === false
6971
  && ! SucuriScanRequest::post( ':manual_api_key' )
6972
  ) {
6973
+ if (SucuriScanRequest::get(':dismiss_setup') !== false) {
6974
+ SucuriScanOption::update_option(':dismiss_setup', 'enabled');
6975
+ } elseif (SucuriScanOption::is_enabled(':dismiss_setup')) {
6976
+ /* Do not display API key generation form. */
6977
+ } else {
6978
+ echo SucuriScanTemplate::get_section('setup-notice');
6979
+ echo SucuriScanTemplate::get_modal('setup-form', array(
6980
+ 'Visibility' => 'hidden',
6981
+ 'Title' => 'Sucuri API key generation',
6982
+ 'CssClass' => 'sucuriscan-setup-instructions',
6983
+ ));
6984
+ }
6985
  }
6986
  }
6987
 
7101
  */
7102
  function sucuriscan_sitecheck_scanner_results( $scan_results = false, $template_variables = array() ){
7103
  $secvars = array(
7104
+ 'CacheLifeTime' => SUCURISCAN_SITECHECK_LIFETIME,
7105
  'WebsiteStatus' => 'Site status unknown',
7106
  'NoMalwareRowVisibility' => 'visible',
7107
  'FixButtonVisibility' => 'hidden',
7964
  * Currently supports Apache 2.2 and 2.4 and denies access to all PHP files with
7965
  * any mixed extension case.
7966
  *
7967
+ * @return array List of access control rules.
 
7968
  */
7969
+ private static function get_rules()
7970
+ {
7971
+ return array(
7972
  '<FilesMatch "\.(?i:php)$">',
7973
  ' <IfModule !mod_authz_core.c>',
7974
  ' Order allow,deny',
7979
  ' </IfModule>',
7980
  '</FilesMatch>',
7981
  );
 
 
 
 
 
 
 
 
 
 
 
7982
  }
7983
 
7984
  /**
7990
  * @param string $directory Valid directory path where to place the access rules.
7991
  * @return boolean True if the rules are successfully added, false otherwise.
7992
  */
7993
+ public static function harden_directory($directory = '')
7994
+ {
7995
+ if (file_exists($directory)
7996
+ && is_writable($directory)
7997
+ && is_dir($directory)
7998
  ) {
7999
  $fhandle = false;
8000
+ $target = self::htaccess($directory);
8001
+ $deny_rules = self::get_rules();
8002
 
8003
+ if (file_exists($target)) {
8004
+ self::fix_previous_hardening($directory);
8005
+ $fhandle = @fopen($target, 'a');
8006
  } else {
8007
+ $fhandle = @fopen($target, 'w');
8008
  }
8009
 
8010
+ if ($fhandle) {
8011
+ $rules_str = implode("\n", $deny_rules) . "\n";
8012
+ $written = @fwrite($fhandle, $rules_str);
8013
+ @fclose($fhandle);
8014
 
8015
+ return (bool) ($written !== false);
8016
  }
8017
  }
8018
 
8027
  * @param string $directory Valid directory path where to access rules are.
8028
  * @return boolean True if the rules are successfully deleted, false otherwise.
8029
  */
8030
+ public static function unharden_directory($directory = '')
8031
+ {
8032
+ if (self::is_hardened($directory)) {
8033
+ $deny_rules = self::get_rules();
8034
+ $fpath = self::htaccess($directory);
8035
+ $content = @file_get_contents($fpath);
8036
 
8037
+ if ($content) {
8038
+ $rules_str = implode("\n", $deny_rules);
8039
+ $content = str_replace($rules_str, '', $content);
8040
+ $written = @file_put_contents($fpath, $content);
8041
 
8042
+ if (filesize($fpath) === 0) {
8043
+ @unlink($fpath);
8044
  }
8045
 
8046
+ return (bool) ($written !== false);
8047
  }
8048
  }
8049
 
8056
  * @param string $directory Valid directory path.
8057
  * @return boolean True if the access control file was fixed.
8058
  */
8059
+ private static function fix_previous_hardening($directory = '')
8060
+ {
8061
+ $fpath = self::htaccess($directory);
8062
+ $content = @file_get_contents($fpath);
8063
  $rules = "<Files *.php>\ndeny from all\n</Files>";
8064
 
8065
+ if ($content) {
8066
+ if (strpos($content, $rules) !== false) {
8067
+ $content = str_replace($rules, '', $content);
8068
+ $written = @file_put_contents($fpath, $content);
8069
 
8070
+ return (bool) ($written !== false);
8071
  }
8072
  }
8073
 
8080
  * @param string $directory Valid directory path.
8081
  * @return boolean True if the directory is hardened, false otherwise.
8082
  */
8083
+ public static function is_hardened($directory = '')
8084
+ {
8085
+ if (file_exists($directory) && is_dir($directory)) {
8086
+ $fpath = self::htaccess($directory);
 
 
8087
 
8088
+ if (file_exists($fpath) && is_readable($fpath)) {
8089
+ $rules = self::get_rules();
8090
+ $rules_str = implode("\n", $rules);
8091
+ $content = @file_get_contents($fpath);
 
 
 
8092
 
8093
+ if (strpos($content, $rules_str) !== false) {
8094
  return true;
8095
  }
8096
  }
8099
  return false;
8100
  }
8101
 
8102
+ private static function htaccess($folder = '')
8103
+ {
8104
+ $folder = str_replace(ABSPATH, '', $folder);
8105
+ $bpath = rtrim(ABSPATH, DIRECTORY_SEPARATOR);
8106
+ $folder_path = $bpath . '/' . $folder;
8107
+ $htaccess = $folder_path . '/.htaccess';
8108
+
8109
+ return $htaccess;
8110
+ }
8111
+
8112
+ private static function whitelist_rule($file = '')
8113
+ {
8114
+ $file = str_replace('/', '', $file);
8115
+ $file = str_replace('<', '', $file);
8116
+ $file = str_replace('>', '', $file);
8117
+
8118
+ return sprintf("<Files %s>\n\x20\x20Allow from all\n</Files>\n", $file);
8119
+ }
8120
+
8121
+ public static function whitelist($file = '', $folder = '')
8122
+ {
8123
+ $htaccess = self::htaccess($folder);
8124
+
8125
+ if (file_exists($htaccess)) {
8126
+ if (is_writable($htaccess)) {
8127
+ $rules = self::whitelist_rule($file);
8128
+ @file_put_contents($htaccess, $rules, FILE_APPEND);
8129
+ } else {
8130
+ throw new Exception('Access control file is not writable');
8131
+ }
8132
+ } else {
8133
+ throw new Exception('Access control file does not exists');
8134
+ }
8135
+ }
8136
+
8137
+ public static function dewhitelist($file = '', $folder = '')
8138
+ {
8139
+ $htaccess = self::htaccess($folder);
8140
+
8141
+ if (file_exists($htaccess)
8142
+ && is_readable($htaccess)
8143
+ && is_writable($htaccess)
8144
+ ) {
8145
+ $content = @file_get_contents($htaccess);
8146
+ $rules = self::whitelist_rule($file);
8147
+ $content = str_replace($rules, '', $content);
8148
+ @file_put_contents($htaccess, $content);
8149
+ }
8150
+ }
8151
+
8152
+ public static function get_whitelisted($folder = '')
8153
+ {
8154
+ $htaccess = self::htaccess($folder);
8155
+ $content = @file_get_contents($htaccess);
8156
+
8157
+ if (@preg_match_all('/<Files (\S+)>/', $content, $matches)) {
8158
+ return $matches[1];
8159
+ }
8160
+
8161
+ return false;
8162
+ }
8163
  }
8164
 
8165
  /**
8173
  function sucuriscan_hardening_page(){
8174
  SucuriScanInterface::check_permissions();
8175
 
8176
+ $template_variables = array(
8177
+ 'Hardening.Panel' => sucuriscan_hardening_panel(),
8178
+ 'Hardening.Whitelist' => sucuriscan_hardening_whitelist(),
8179
+ );
8180
+
8181
+ echo SucuriScanTemplate::get_template('hardening', $template_variables);
8182
+ }
8183
+
8184
+ function sucuriscan_hardening_panel(){
8185
+ if (SucuriScanRequest::post(':run_hardening')
8186
  && ! SucuriScanInterface::check_nonce()
8187
  ) {
8188
  unset($_POST['sucuriscan_run_hardening']);
8206
  'Hardening.ErrorLog' => sucuriscan_harden_errorlog(),
8207
  );
8208
 
8209
+ if (SucuriScan::is_nginx_server() === true) {
8210
  $template_variables['Hardening.NginxPhpFpm'] = sucuriscan_harden_nginx_phpfpm();
8211
+ } elseif (SucuriScan::is_iis_server() === true) {
8212
  /* TODO: Include IIS (Internet Information Services) hardening options. */
8213
  } else {
8214
  $template_variables['Hardening.Upload'] = sucuriscan_harden_upload();
8216
  $template_variables['Hardening.WpIncludes'] = sucuriscan_harden_wpincludes();
8217
  }
8218
 
8219
+ return SucuriScanTemplate::get_section('hardening-panel', $template_variables);
8220
+ }
8221
+
8222
+ function sucuriscan_hardening_whitelist(){
8223
+ $template_variables = array(
8224
+ 'HardeningWhitelist.List' => '',
8225
+ 'HardeningWhitelist.NoItemsVisibility' => 'visible',
8226
+ );
8227
+ $allowed_folders = array(
8228
+ 'wp-includes',
8229
+ 'wp-content',
8230
+ 'wp-content/uploads',
8231
+ );
8232
+
8233
+ // Add a new file to the hardening whitelist.
8234
+ if ($fwhite = SucuriScanRequest::post(':hardening_whitelist')) {
8235
+ $folder = SucuriScanRequest::post(':hardening_folder');
8236
+
8237
+ if (in_array($folder, $allowed_folders)) {
8238
+ try {
8239
+ SucuriScanHardening::whitelist($fwhite, $folder);
8240
+ SucuriScanInterface::info('File was whitelisted from the hardening');
8241
+ } catch (Exception $e) {
8242
+ SucuriScanInterface::error($e->getMessage());
8243
+ }
8244
+ } else {
8245
+ SucuriScanInterface::error('Specified folder is not hardened by this plugin');
8246
+ }
8247
+ }
8248
+
8249
+ // Remove a file from the hardening whitelist.
8250
+ if ($rmfwhite = SucuriScanRequest::post(':hardening_rmfwhite', '_array')) {
8251
+ foreach ($rmfwhite as $fpath) {
8252
+ $fpath = str_replace('/.*/', '|', $fpath);
8253
+ $parts = explode('|', $fpath, 2);
8254
+ SucuriScanHardening::dewhitelist($parts[1], $parts[0]);
8255
+ }
8256
+
8257
+ SucuriScanInterface::info('Selected files were processed successfully');
8258
+ }
8259
+
8260
+ // Read the access control file and retrieve the whitelisted files.
8261
+ $counter = 0;
8262
+ foreach ($allowed_folders as $folder) {
8263
+ $files = SucuriScanHardening::get_whitelisted($folder);
8264
+
8265
+ if ($files !== false) {
8266
+ $template_variables['HardeningWhitelist.NoItemsVisibility'] = 'hidden';
8267
+
8268
+ foreach ($files as $file) {
8269
+ $css_class = ($counter % 2 === 0) ? '' : 'alternate';
8270
+ $fregexp = sprintf('%s/.*/%s', $folder, $file);
8271
+ $html = SucuriScanTemplate::get_snippet('hardening-whitelist', array(
8272
+ 'HardeningWhitelist.CssClass' => $css_class,
8273
+ 'HardeningWhitelist.File' => SucuriScan::escape($file),
8274
+ 'HardeningWhitelist.Folder' => SucuriScan::escape($folder),
8275
+ 'HardeningWhitelist.Regexp' => SucuriScan::escape($fregexp),
8276
+ ));
8277
+ $template_variables['HardeningWhitelist.List'] .= $html;
8278
+ $counter++;
8279
+ }
8280
+ }
8281
+ }
8282
+
8283
+ return SucuriScanTemplate::get_section('hardening-whitelist', $template_variables);
8284
  }
8285
 
8286
  /**
8567
 
8568
  if ( $result === true ) {
8569
  $message = 'Hardening applied to the library directory';
8570
+ SucuriScanHardening::whitelist('wp-tinymce.php', 'wp-includes');
8571
+ SucuriScanHardening::whitelist('ms-files.php', 'wp-includes');
8572
  SucuriScanEvent::report_notice_event( $message );
8573
  SucuriScanInterface::info( $message );
8574
  } else {
8579
 
8580
  if ( $result === true ) {
8581
  $message = 'Hardening reverted in the library directory';
8582
+ SucuriScanHardening::dewhitelist('wp-tinymce.php', 'wp-includes');
8583
+ SucuriScanHardening::dewhitelist('ms-files.php', 'wp-includes');
8584
  SucuriScanEvent::report_error_event( $message );
8585
  SucuriScanInterface::info( $message );
8586
  } else {
8955
  *
8956
  * @return void
8957
  */
8958
+ function sucuriscan_page()
8959
+ {
8960
  SucuriScanInterface::check_permissions();
8961
 
8962
  // Process all form submissions.
8969
  'AuditLogs' => sucuriscan_auditlogs(),
8970
  );
8971
 
8972
+ echo SucuriScanTemplate::get_template('integrity', $template_variables);
8973
  }
8974
 
8975
  /**
8979
  *
8980
  * @return void
8981
  */
8982
+ function sucuriscan_integrity_form_submissions()
8983
+ {
8984
+ if (SucuriScanInterface::check_nonce()) {
8985
  // Force the execution of the filesystem scanner.
8986
+ if (SucuriScanRequest::post(':force_scan') !== false) {
8987
+ SucuriScanEvent::notify_event('plugin_change', 'Filesystem scan forced at: ' . date('r'));
8988
+ SucuriScanEvent::filesystem_scan(true);
8989
  }
8990
 
8991
  // Restore, Remove, Mark as fixed the core files.
8992
  $allowed_actions = '(restore|delete|fixed)';
8993
+ $integrity_action = SucuriScanRequest::post(':integrity_action', $allowed_actions);
8994
 
8995
+ if ($integrity_action !== false) {
8996
+ $cache = new SucuriScanCache('integrity');
8997
+ $integrity_files = SucuriScanRequest::post(':integrity_files', '_array');
8998
+ $integrity_types = SucuriScanRequest::post(':integrity_types', '_array');
8999
+ $files_selected = count($integrity_files);
9000
  $files_affected = array();
9001
  $files_processed = 0;
9002
  $action_titles = array(
9005
  'fixed' => 'Core file marked as fixed',
9006
  );
9007
 
9008
+ if ($integrity_files) {
9009
+ foreach ((array) $integrity_files as $i => $file_path) {
9010
  $full_path = ABSPATH . $file_path;
9011
  $status_type = $integrity_types[ $i ];
9012
 
9013
+ switch ($integrity_action) {
9014
  case 'restore':
9015
+ $file_content = SucuriScanAPI::get_original_core_file($file_path);
9016
+ if ($file_content) {
9017
+ $restored = @file_put_contents($full_path, $file_content, LOCK_EX);
9018
  $files_processed += ( $restored ? 1 : 0 );
9019
  $files_affected[] = $full_path;
9020
  }
9021
  break;
9022
  case 'delete':
9023
+ if (@unlink($full_path)) {
9024
  $files_processed += 1;
9025
  $files_affected[] = $full_path;
9026
  }
9027
  break;
9028
  case 'fixed':
9029
+ $cache_key = md5($file_path);
9030
  $cache_value = array(
9031
  'file_path' => $file_path,
9032
  'file_status' => $status_type,
9033
  'ignored_at' => time(),
9034
  );
9035
+ $cached = $cache->add($cache_key, $cache_value);
9036
  $files_processed += ( $cached ? 1 : 0 );
9037
  $files_affected[] = $full_path;
9038
  break;
9040
  }
9041
 
9042
  // Report files affected as a single event.
9043
+ if (! empty($files_affected)) {
9044
+ $message_tpl = ( count($files_affected) > 1 )
9045
  ? '%s: (multiple entries): %s'
9046
  : '%s: %s';
9047
  $message = sprintf(
9048
  $message_tpl,
9049
  $action_titles[ $integrity_action ],
9050
+ @implode(',', $files_affected)
9051
  );
9052
 
9053
+ switch ($integrity_action) {
9054
+ case 'restore':
9055
+ SucuriScanEvent::report_info_event($message);
9056
+ break;
9057
+ case 'delete':
9058
+ SucuriScanEvent::report_notice_event($message);
9059
+ break;
9060
+ case 'fixed':
9061
+ SucuriScanEvent::report_warning_event($message);
9062
+ break;
9063
  }
9064
  }
9065
 
9081
  * @param boolean $recursive Either TRUE or FALSE if the scan should be performed recursively.
9082
  * @return array List of arrays containing the md5sum and last modification time of the files found.
9083
  */
9084
+ function sucuriscan_get_integrity_tree($dir = './', $recursive = false)
9085
+ {
9086
+ $abs_path = rtrim(ABSPATH, '/');
9087
 
9088
  $file_info = new SucuriScanFileInfo();
9089
  $file_info->ignore_files = false;
9090
  $file_info->ignore_directories = false;
9091
  $file_info->run_recursively = $recursive;
9092
+ $file_info->scan_interface = SucuriScanOption::get_option(':scan_interface');
9093
+ $integrity_tree = $file_info->get_directory_tree_md5($dir, true);
9094
 
9095
+ if (! $integrity_tree) {
9096
  $integrity_tree = array();
9097
  }
9098
 
9105
  *
9106
  * @return void
9107
  */
9108
+ function sucuriscan_auditlogs()
9109
+ {
9110
  // Initialize the values for the pagination.
9111
  $max_per_page = SUCURISCAN_AUDITLOGS_PER_PAGE;
9112
  $page_number = SucuriScanTemplate::get_page_number();
9113
  $logs_limit = $page_number * $max_per_page;
9114
+ $audit_logs = SucuriScanAPI::get_logs($logs_limit);
9115
 
9116
  $template_variables = array(
9117
  'PageTitle' => 'Audit Logs',
9124
  'AuditLogs.EnableAuditReportVisibility' => 'hidden',
9125
  );
9126
 
9127
+ if ($audit_logs) {
9128
  $counter_i = 0;
9129
+ $total_items = count($audit_logs->output_data);
9130
  $iterator_start = ($page_number - 1) * $max_per_page;
9131
  $iterator_end = $total_items;
9132
 
9133
+ if ($audit_logs->total_entries >= $max_per_page
9134
+ && SucuriScanOption::is_disabled(':audit_report')
 
9135
  ) {
9136
  $template_variables['AuditLogs.EnableAuditReportVisibility'] = 'visible';
9137
  }
9138
 
9139
+ for ($i = $iterator_start; $i < $total_items; $i++) {
9140
+ if ($counter_i > $max_per_page) {
9141
  break;
9142
  }
9143
 
9144
+ if (isset($audit_logs->output_data[ $i ])) {
9145
  $audit_log = $audit_logs->output_data[ $i ];
9146
 
9147
  $css_class = ( $counter_i % 2 == 0 ) ? '' : 'alternate';
9148
  $snippet_data = array(
9149
  'AuditLog.CssClass' => $css_class,
9150
+ 'AuditLog.Event' => SucuriScan::escape($audit_log['event']),
9151
+ 'AuditLog.EventTitle' => SucuriScan::escape(ucfirst($audit_log['event'])),
9152
+ 'AuditLog.DateTime' => SucuriScan::datetime($audit_log['timestamp']),
9153
+ 'AuditLog.Account' => SucuriScan::escape($audit_log['account']),
9154
+ 'AuditLog.Username' => SucuriScan::escape($audit_log['username']),
9155
+ 'AuditLog.RemoteAddress' => SucuriScan::escape($audit_log['remote_addr']),
9156
+ 'AuditLog.Message' => SucuriScan::escape($audit_log['message']),
9157
  'AuditLog.Extra' => '',
9158
  );
9159
 
9160
  // Print every file_list information item in a separate table.
9161
+ if ($audit_log['file_list']) {
9162
  $css_scrollable = $audit_log['file_list_count'] > 10 ? 'sucuriscan-list-as-table-scrollable' : '';
9163
  $snippet_data['AuditLog.Extra'] .= '<ul class="sucuriscan-list-as-table ' . $css_scrollable . '">';
9164
+ foreach ($audit_log['file_list'] as $log_extra) {
9165
+ $snippet_data['AuditLog.Extra'] .= '<li>' . SucuriScan::escape($log_extra) . '</li>';
9166
  }
9167
  $snippet_data['AuditLog.Extra'] .= '</ul>';
9168
  }
9169
 
9170
+ $template_variables['AuditLogs.List'] .= SucuriScanTemplate::get_snippet('integrity-auditlogs', $snippet_data);
9171
  $counter_i += 1;
9172
  }
9173
  }
9175
  $template_variables['AuditLogs.Count'] = $counter_i;
9176
  $template_variables['AuditLogs.NoItemsVisibility'] = 'hidden';
9177
 
9178
+ if ($total_items > 1) {
9179
+ $max_pages = ceil($audit_logs->total_entries / $max_per_page);
9180
 
9181
+ if ($max_pages > SUCURISCAN_MAX_PAGINATION_BUTTONS) {
9182
  $max_pages = SUCURISCAN_MAX_PAGINATION_BUTTONS;
9183
  }
9184
 
9185
+ if ($max_pages > 1) {
9186
  $template_variables['AuditLogs.PaginationVisibility'] = 'visible';
9187
  $template_variables['AuditLogs.PaginationLinks'] = SucuriScanTemplate::get_pagination(
9188
  '%%SUCURI.URL.Home%%',
9193
  }
9194
  }
9195
 
9196
+ return SucuriScanTemplate::get_section('integrity-auditlogs', $template_variables);
9197
  }
9198
  /**
9199
  * Print a HTML code with the content of the logs audited by the remote Sucuri
9201
  *
9202
  * @return void
9203
  */
9204
+ function sucuriscan_auditreport()
9205
+ {
9206
  $audit_report = false;
9207
+ $logs4report = SucuriScanOption::get_option(':logs4report');
9208
 
9209
+ if (SucuriScanOption::is_enabled(':audit_report')) {
9210
+ $audit_report = SucuriScanAPI::get_audit_report($logs4report);
9211
  }
9212
 
9213
  $template_variables = array(
9222
  'AuditReport.Logs4Report' => $logs4report,
9223
  );
9224
 
9225
+ if ($audit_report) {
9226
+ $template_variables['AuditReport.EventColors'] = @implode(',', $audit_report['event_colors']);
9227
 
9228
  // Generate report chart data for the events per type.
9229
+ foreach ($audit_report['events_per_type'] as $event => $times) {
9230
  $template_variables['AuditReport.EventsPerType'] .= sprintf(
9231
  "[ '%s', %d ],\n",
9232
+ ucwords($event . "\x20events"),
9233
  $times
9234
  );
9235
  }
9236
 
9237
  // Generate report chart data for the events per login.
9238
+ foreach ($audit_report['events_per_login'] as $event => $times) {
9239
  $template_variables['AuditReport.EventsPerLogin'] .= sprintf(
9240
  "[ '%s', %d ],\n",
9241
+ ucwords($event . "\x20logins"),
9242
  $times
9243
  );
9244
  }
9245
 
9246
  // Generate report chart data for the events per user.
9247
+ foreach ($audit_report['events_per_user'] as $event => $times) {
9248
+ $template_variables['AuditReport.EventsPerUserCategories'] .= sprintf('"%s",', $event);
9249
+ $template_variables['AuditReport.EventsPerUserSeries'] .= sprintf('%d,', $times);
9250
  }
9251
 
9252
  // Generate report chart data for the events per remote address.
9253
+ foreach ($audit_report['events_per_ipaddress'] as $event => $times) {
9254
+ $template_variables['AuditReport.EventsPerIPAddressCategories'] .= sprintf('"%s",', $event);
9255
+ $template_variables['AuditReport.EventsPerIPAddressSeries'] .= sprintf('%d,', $times);
9256
  }
9257
 
9258
+ return SucuriScanTemplate::get_section('integrity-auditreport', $template_variables);
9259
  }
9260
 
9261
  return '';
9266
  *
9267
  * @return string Panel with a warning advising that WordPress is outdated.
9268
  */
9269
+ function sucuriscan_wordpress_outdated()
9270
+ {
9271
  $site_version = SucuriScan::site_version();
9272
  $updates = get_core_updates();
9273
+ $cp = ( ! is_array($updates) || empty($updates) ? 1 : 0 );
9274
 
9275
  $template_variables = array(
9276
  'WordPress.Version' => $site_version,
9277
  'WordPress.NewVersion' => '0.0.0',
9278
  'WordPress.NewLocale' => 'default',
9279
+ 'WordPress.UpdateURL' => admin_url('update-core.php'),
9280
  'WordPress.DownloadURL' => '#',
9281
  'WordPress.UpdateVisibility' => 'hidden',
9282
  );
9283
 
9284
+ if (isset($updates[0])
 
9285
  && $updates[0] instanceof stdClass
9286
+ && property_exists($updates[0], 'version')
9287
+ && property_exists($updates[0], 'download')
9288
  ) {
9289
  $template_variables['WordPress.NewVersion'] = $updates[0]->version;
9290
  $template_variables['WordPress.DownloadURL'] = $updates[0]->download;
9291
 
9292
+ if (property_exists($updates[0], 'locale')) {
9293
  $template_variables['WordPress.NewLocale'] = $updates[0]->locale;
9294
  }
9295
 
9296
+ if ($updates[0]->response == 'latest'
 
9297
  || $updates[0]->response == 'development'
9298
+ || $updates[0]->version == $site_version
9299
  ) {
9300
  $cp = 1;
9301
  }
9302
  }
9303
 
9304
+ if ($cp == 0) {
9305
  $template_variables['WordPress.UpdateVisibility'] = 'visible';
9306
  }
9307
 
9308
+ return SucuriScanTemplate::get_section('integrity-wpoutdate', $template_variables);
9309
  }
9310
 
9311
  /**
9318
  * @param boolean $send_email If the HTML code returned will be sent via email.
9319
  * @return string HTML code with a list of files that were affected.
9320
  */
9321
+ function sucuriscan_core_files($send_email = false)
9322
+ {
9323
  $site_version = SucuriScan::site_version();
9324
  $affected_files = 0;
9325
 
9329
  'CoreFiles.GoodVisibility' => 'visible',
9330
  'CoreFiles.BadVisibility' => 'hidden',
9331
  'CoreFiles.FailureVisibility' => 'hidden',
9332
+ 'CoreFiles.RemoteChecksumsURL' => '',
9333
  );
9334
 
9335
+ if ($site_version && SucuriScanOption::is_enabled(':scan_checksums')) {
9336
  // Check if there are added, removed, or modified files.
9337
+ $latest_hashes = sucuriscan_check_core_integrity($site_version);
9338
+ $template_variables['CoreFiles.RemoteChecksumsURL'] =
9339
+ 'http://api.wordpress.org/core/checksums/1.0/'
9340
+ . '?version=' . $site_version . '&locale=en_US';
9341
 
9342
+ if ($latest_hashes) {
9343
+ $cache = new SucuriScanCache('integrity');
9344
  $ignored_files = $cache->get_all();
9345
  $counter = 0;
9346
 
9347
+ foreach ($latest_hashes as $list_type => $file_list) {
9348
+ if ($list_type == 'stable'
 
9349
  || empty($file_list)
9350
  ) {
9351
  continue;
9352
  }
9353
 
9354
+ foreach ($file_list as $file_info) {
9355
  $file_path = $file_info['filepath'];
9356
+ $full_filepath = sprintf('%s/%s', rtrim(ABSPATH, '/'), $file_path);
9357
 
9358
  // Skip files that were marked as fixed.
9359
+ if ($ignored_files) {
9360
  // Get the checksum of the base file name.
9361
+ $file_path_checksum = md5($file_path);
9362
 
9363
+ if (array_key_exists($file_path_checksum, $ignored_files)) {
9364
  continue;
9365
  }
9366
  }
9367
 
9368
  // Add extra information to the file list.
9369
  $css_class = ( $counter % 2 == 0 ) ? '' : 'alternate';
9370
+ $file_size = @filesize($full_filepath);
9371
  $is_fixable_html = '';
9372
  $is_fixable_text = '';
9373
 
9374
  // Check whether the file can be fixed automatically or not.
9375
+ if ($file_info['is_fixable'] !== true) {
9376
  $css_class .= ' sucuriscan-opacity';
9377
  $is_fixable_html = 'disabled="disbled"';
9378
  $is_fixable_text = '(must be fixed manually)';
9384
  'CoreFiles.StatusType' => $list_type,
9385
  'CoreFiles.FilePath' => $file_path,
9386
  'CoreFiles.FileSize' => $file_size,
9387
+ 'CoreFiles.FileSizeHuman' => SucuriScan::human_filesize($file_size),
9388
+ 'CoreFiles.FileSizeNumber' => number_format($file_size),
9389
+ 'CoreFiles.ModifiedAt' => SucuriScan::datetime($file_info['modified_at']),
9390
  'CoreFiles.IsFixtableFile' => $is_fixable_html,
9391
  'CoreFiles.IsNotFixable' => $is_fixable_text,
9392
  ));
9395
  }
9396
  }
9397
 
9398
+ if ($counter > 0) {
9399
  $template_variables['CoreFiles.ListCount'] = $counter;
9400
  $template_variables['CoreFiles.GoodVisibility'] = 'hidden';
9401
  $template_variables['CoreFiles.BadVisibility'] = 'visible';
9408
  }
9409
 
9410
  // Send an email notification with the affected files.
9411
+ if ($send_email === true) {
9412
+ if ($affected_files > 0) {
9413
+ $content = SucuriScanTemplate::get_section('notification-corefiles', $template_variables);
9414
+ $sent = SucuriScanEvent::notify_event('scan_checksums', $content);
9415
 
9416
  return $sent;
9417
  }
9419
  return false;
9420
  }
9421
 
9422
+ return SucuriScanTemplate::get_section('integrity-corefiles', $template_variables);
9423
  }
9424
 
9425
  /**
9437
  * @param integer $version Valid version number of the WordPress project.
9438
  * @return array Associative array with these keys: modified, stable, removed, added.
9439
  */
9440
+ function sucuriscan_check_core_integrity($version = 0)
9441
+ {
9442
+ $latest_hashes = SucuriScanAPI::get_official_checksums($version);
9443
+ $base_content_dir = defined('WP_CONTENT_DIR')
9444
+ ? basename(rtrim(WP_CONTENT_DIR, '/'))
9445
  : '';
9446
 
9447
+ if (! $latest_hashes) {
9448
  return false;
9449
  }
9450
 
9456
  );
9457
 
9458
  // Get current filesystem tree.
9459
+ $wp_top_hashes = sucuriscan_get_integrity_tree(ABSPATH, false);
9460
+ $wp_admin_hashes = sucuriscan_get_integrity_tree(ABSPATH . 'wp-admin', true);
9461
+ $wp_includes_hashes = sucuriscan_get_integrity_tree(ABSPATH . 'wp-includes', true);
9462
+ $wp_core_hashes = array_merge($wp_top_hashes, $wp_admin_hashes, $wp_includes_hashes);
9463
 
9464
  // Compare remote and local checksums and search removed files.
9465
+ foreach ($latest_hashes as $file_path => $remote_checksum) {
9466
+ if (sucuriscan_ignore_integrity_filepath($file_path)) {
9467
  continue;
9468
  }
9469
 
9470
+ $full_filepath = sprintf('%s/%s', ABSPATH, $file_path);
9471
 
9472
  // Patch for custom content directory path.
9473
+ if (! file_exists($full_filepath)
9474
+ && strpos($file_path, 'wp-content') !== false
9475
+ && defined('WP_CONTENT_DIR')
 
9476
  ) {
9477
+ $file_path = str_replace('wp-content', $base_content_dir, $file_path);
9478
+ $dir_content_dir = dirname(rtrim(WP_CONTENT_DIR, '/'));
9479
+ $full_filepath = sprintf('%s/%s', $dir_content_dir, $file_path);
9480
  }
9481
 
9482
  // Check whether the official file exists or not.
9483
+ if (file_exists($full_filepath)) {
9484
+ $local_checksum = @md5_file($full_filepath);
9485
 
9486
+ if ($local_checksum !== false
 
9487
  && $local_checksum === $remote_checksum
9488
  ) {
9489
  $output['stable'][] = array(
9492
  'modified_at' => 0,
9493
  );
9494
  } else {
9495
+ $modified_at = @filemtime($full_filepath);
9496
+ $is_fixable = (bool) is_writable($full_filepath);
9497
  $output['modified'][] = array(
9498
  'filepath' => $file_path,
9499
  'is_fixable' => $is_fixable,
9501
  );
9502
  }
9503
  } else {
9504
+ $is_fixable = is_writable(dirname($full_filepath));
9505
  $output['removed'][] = array(
9506
  'filepath' => $file_path,
9507
  'is_fixable' => $is_fixable,
9511
  }
9512
 
9513
  // Search added files (files not common in a normal wordpress installation).
9514
+ foreach ($wp_core_hashes as $file_path => $extra_info) {
9515
+ $file_path = str_replace(DIRECTORY_SEPARATOR, '/', $file_path);
9516
+ $file_path = preg_replace('/^\.\/(.*)/', '$1', $file_path);
9517
 
9518
+ if (sucuriscan_ignore_integrity_filepath($file_path)) {
9519
  continue;
9520
  }
9521
 
9522
+ if (! array_key_exists($file_path, $latest_hashes)) {
9523
  $full_filepath = ABSPATH . '/' . $file_path;
9524
+ $modified_at = @filemtime($full_filepath);
9525
+ $is_fixable = (bool) is_writable($full_filepath);
9526
  $output['added'][] = array(
9527
  'filepath' => $file_path,
9528
  'is_fixable' => $is_fixable,
9540
  * @param string $file_path File path that will be compared.
9541
  * @return boolean TRUE if the file should be ignored, FALSE otherwise.
9542
  */
9543
+ function sucuriscan_ignore_integrity_filepath($file_path = '')
9544
+ {
9545
  global $wp_local_package;
9546
 
9547
  // List of files that will be ignored from the integrity checking.
9572
  * of the project, basically they have files with new variables specifying the
9573
  * language that will be used in the admin panel, site options, and emails.
9574
  */
9575
+ if (isset($wp_local_package)
 
9576
  && $wp_local_package != 'en_US'
9577
  ) {
9578
  $ignore_files[] = 'wp-includes\/version\.php';
9580
  }
9581
 
9582
  // Determine whether a file must be ignored from the integrity checks or not.
9583
+ foreach ($ignore_files as $ignore_pattern) {
9584
+ if (preg_match('/'.$ignore_pattern.'/', $file_path)) {
9585
  return true;
9586
  }
9587
  }
9594
  *
9595
  * @return void
9596
  */
9597
+ function sucuriscan_modified_files()
9598
+ {
9599
  $valid_day_ranges = array( 1, 3, 7, 30, 60 );
9600
  $template_variables = array(
9601
  'ModifiedFiles.List' => '',
9606
  );
9607
 
9608
  // Find files modified in the last days.
9609
+ $back_days = SucuriScanRequest::post(':last_days', '[0-9]+');
9610
 
9611
+ if ($back_days !== false) {
9612
+ if ($back_days <= 0) {
9613
  $back_days = 1;
9614
+ } elseif ($back_days >= 60) {
9615
  $back_days = 60;
9616
  }
9617
  } else {
9619
  }
9620
 
9621
  // Fix data type for the back days variable.
9622
+ $back_days = intval($back_days);
9623
  $template_variables['ModifiedFiles.Days'] = $back_days;
9624
 
9625
  // Generate the options for the select field of the page form.
9626
+ foreach ($valid_day_ranges as $day) {
9627
  $selected_option = ($back_days == $day) ? 'selected="selected"' : '';
9628
  $template_variables['ModifiedFiles.SelectOptions'] .= sprintf(
9629
  '<option value="%d" %s>%d</option>',
9630
+ $day,
9631
+ $selected_option,
9632
+ $day
9633
  );
9634
  }
9635
 
9636
  // The scanner for modified files can be disabled from the settings page.
9637
+ if (SucuriScanOption::is_enabled(':scan_modfiles')) {
9638
  // Search modified files among the project's files.
9639
+ $content_hashes = sucuriscan_get_integrity_tree(WP_CONTENT_DIR, true);
9640
 
9641
+ if (! empty($content_hashes)) {
9642
+ $back_days = current_time('timestamp') - ( $back_days * 86400);
9643
  $counter = 0;
9644
 
9645
+ foreach ($content_hashes as $file_path => $file_info) {
9646
+ if (isset($file_info['modified_at'])
 
9647
  && $file_info['modified_at'] >= $back_days
9648
  ) {
9649
  $css_class = ( $counter % 2 == 0 ) ? '' : 'alternate';
9650
+ $mod_date = SucuriScan::datetime($file_info['modified_at']);
9651
 
9652
  $template_variables['ModifiedFiles.List'] .= SucuriScanTemplate::get_snippet('integrity-modifiedfiles', array(
9653
  'ModifiedFiles.CssClass' => $css_class,
9655
  'ModifiedFiles.FilePath' => $file_path,
9656
  'ModifiedFiles.DateTime' => $mod_date,
9657
  'ModifiedFiles.FileSize' => $file_info['filesize'],
9658
+ 'ModifiedFiles.FileSizeHuman' => SucuriScan::human_filesize($file_info['filesize']),
9659
+ 'ModifiedFiles.FileSizeNumber' => number_format($file_info['filesize']),
9660
  ));
9661
  $counter += 1;
9662
  }
9663
  }
9664
 
9665
+ if ($counter > 0) {
9666
  $template_variables['ModifiedFiles.NoFilesVisibility'] = 'hidden';
9667
  }
9668
  }
9670
  $template_variables['ModifiedFiles.DisabledVisibility'] = 'visible';
9671
  }
9672
 
9673
+ return SucuriScanTemplate::get_section('integrity-modifiedfiles', $template_variables);
9674
  }
9675
 
9676
  /**
9901
  arsort( $user_identifiers );
9902
 
9903
  foreach ( $user_identifiers as $user_id ) {
9904
+ $user_id = intval( $user_id );
9905
+
9906
  if ( SucuriScanEvent::set_new_password( $user_id ) ) {
9907
  $pwd_changed[] = $user_id;
9908
  } else {
9911
  }
9912
 
9913
  if ( ! empty($pwd_changed) ) {
9914
+ $message = 'Password changed for user identifiers <code>' . @implode( ', ', $pwd_changed ) . '</code>';
9915
 
9916
  SucuriScanEvent::report_notice_event( $message );
9917
  SucuriScanInterface::info( $message );
9918
  }
9919
 
9920
  if ( ! empty($pwd_not_changed) ) {
9921
+ SucuriScanInterface::error( 'Password change failed for users: ' . implode( ', ', $pwd_not_changed ) );
9922
  }
9923
  } else {
9924
  SucuriScanInterface::error( 'You did not select a user from the list.' );
10228
  * @return string Absolute filepath where the user's last login information is stored.
10229
  */
10230
  function sucuriscan_lastlogins_datastore_exists(){
10231
+ $fpath = sucuriscan_lastlogins_datastore_filepath();
10232
 
10233
+ if (!file_exists($fpath)) {
10234
+ @file_put_contents($fpath, "<?php exit(0); ?>\n", LOCK_EX);
10235
+ }
10236
+
10237
+ if (file_exists($fpath)) {
10238
+ return $fpath;
10239
  }
10240
 
10241
+ return false;
10242
  }
10243
 
10244
  /**
10428
  if (
10429
  $user instanceof WP_User
10430
  && in_array( 'administrator', $user->roles )
10431
+ && SucuriScanOption::is_enabled( ':lastlogin_redirection' )
10432
  ) {
10433
  $login_url = add_query_arg( 'sucuriscan_lastlogin', 1, $login_url );
10434
  }
10436
  return $login_url;
10437
  }
10438
 
10439
+ if ( SucuriScanOption::is_enabled( ':lastlogin_redirection' ) ) {
10440
  add_filter( 'login_redirect', 'sucuriscan_login_redirect', 10, 3 );
10441
  }
10442
  }
10785
  * @return boolean TRUE if the password must be collected, FALSE otherwise.
10786
  */
10787
  function sucuriscan_collect_wrong_passwords(){
10788
+ return SucuriScanOption::is_enabled( ':collect_wrong_passwords' );
10789
  }
10790
 
10791
  /**
11051
  $sucuriscan_notify_options,
11052
  $sucuriscan_emails_per_hour,
11053
  $sucuriscan_maximum_failed_logins,
11054
+ $sucuriscan_email_subjects;
 
11055
 
11056
  // Use this conditional to avoid double checking.
11057
  if ( is_null( $page_nonce ) ) {
11059
  }
11060
 
11061
  if ( $page_nonce ) {
 
 
 
 
 
 
11062
  // Save API key after it was recovered by the administrator.
11063
  if ( $api_key = SucuriScanRequest::post( ':manual_api_key' ) ) {
11064
  SucuriScanAPI::set_plugin_key( $api_key, true );
11074
  SucuriScanEvent::notify_event( 'plugin_change', 'Sucuri API key removed' );
11075
  }
11076
 
 
 
 
 
 
 
 
 
 
 
 
11077
  // Enable or disable the filesystem scanner.
11078
  if ( $fs_scanner = SucuriScanRequest::post( ':fs_scanner', '(en|dis)able' ) ) {
11079
  $action_d = $fs_scanner . 'd';
11264
  }
11265
  }
11266
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11267
  // Enable or disable the audit logs report.
11268
  if ( $audit_report = SucuriScanRequest::post( ':audit_report', '(en|dis)able' ) ) {
11269
  $action_d = $audit_report . 'd';
11275
  SucuriScanInterface::info( $message );
11276
  }
11277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11278
  // Update the limit for audit logs report.
11279
  if ( $logs4report = SucuriScanRequest::post( ':logs4report', '[0-9]{1,4}' ) ) {
11280
  $message = 'Limit for audit logs report set to <code>' . $logs4report . '</code>';
11285
  SucuriScanInterface::info( $message );
11286
  }
11287
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11288
  // Update the notification settings.
11289
  if ( SucuriScanRequest::post( ':save_notification_settings' ) !== false ) {
11290
  $options_updated_counter = 0;
11363
  }
11364
  }
11365
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11366
  // Ignore a new event for email notifications.
11367
  if ( $action = SucuriScanRequest::post( ':ignorerule_action', '(add|remove)' ) ) {
11368
  $ignore_rule = SucuriScanRequest::post( ':ignorerule' );
11516
  SucuriScanInterface::info( $message );
11517
  }
11518
 
 
 
 
 
 
 
 
 
 
 
11519
  // Debug ability of the plugin to send email alerts correctly.
11520
  if ( SucuriScanRequest::post( ':debug_email' ) ) {
11521
  $recipient = SucuriScanOption::get_option( ':notify_to' );
11560
  function sucuriscan_settings_general(){
11561
 
11562
  global $sucuriscan_emails_per_hour,
11563
+ $sucuriscan_maximum_failed_logins;
 
11564
 
11565
  // Check the nonce here to populate the value through other functions.
11566
  $page_nonce = SucuriScanInterface::check_nonce();
11568
  // Process all form submissions.
11569
  sucuriscan_settings_form_submissions( $page_nonce );
11570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11571
  // Get initial variables to decide some things bellow.
 
11572
  $emails_per_hour = SucuriScanOption::get_option( ':emails_per_hour' );
11573
  $maximum_failed_logins = SucuriScanOption::get_option( ':maximum_failed_logins' );
 
11574
  $audit_report = SucuriScanOption::get_option( ':audit_report' );
11575
  $logs4report = SucuriScanOption::get_option( ':logs4report' );
 
 
 
 
 
 
 
 
 
 
 
 
11576
 
11577
  // Generate the HTML code for the option list in the form select fields.
11578
  $emails_per_hour_options = SucuriScanTemplate::get_select_options( $sucuriscan_emails_per_hour, $emails_per_hour );
11579
  $maximum_failed_logins_options = SucuriScanTemplate::get_select_options( $sucuriscan_maximum_failed_logins, $maximum_failed_logins );
 
11580
 
11581
  $template_variables = array(
 
 
 
 
 
11582
  'NotifyTo' => SucuriScanOption::get_option( ':notify_to' ),
11583
  'EmailsPerHour' => 'Undefined',
11584
  'EmailsPerHourOptions' => $emails_per_hour_options,
11585
  'MaximumFailedLogins' => 'Undefined',
11586
  'MaximumFailedLoginsOptions' => $maximum_failed_logins_options,
 
 
 
 
 
 
11587
  /* Audit Logs Report */
11588
  'AuditReportStatus' => 'Enabled',
11589
  'AuditReportSwitchText' => 'Disable',
11590
  'AuditReportSwitchValue' => 'disable',
11591
  'AuditReportSwitchCssClass' => 'button-danger',
11592
  'AuditReportLimit' => $logs4report,
11593
+ /* Timezone Settings */
11594
+ 'CustomTimezone' => '',
11595
+ 'CurrentDatetime' => '',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11596
  );
11597
 
11598
+ // Keep the reset options panel and form submission processor before anything else.
11599
+ $template_variables['SettingsSection.ResetOptions'] = sucuriscan_settings_general_resetoptions($page_nonce);
11600
+
11601
+ // Build HTML code for the additional general settings panels.
11602
+ $template_variables['SettingsSection.ApiKey'] = sucuriscan_settings_general_apikey($page_nonce);
11603
+ $template_variables['SettingsSection.DataStorage'] = sucuriscan_settings_general_datastorage($page_nonce);
11604
+ $template_variables['SettingsSection.ApiProxy'] = sucuriscan_settings_general_apiproxy();
11605
+ $template_variables['SettingsSection.ApiSSL'] = sucuriscan_settings_general_apissl($page_nonce);
11606
+ $template_variables['SettingsSection.ApiTimeout'] = sucuriscan_settings_general_apitimeout($page_nonce);
11607
+ $template_variables['SettingsSection.ReverseProxy'] = sucuriscan_settings_general_reverseproxy($page_nonce);
11608
+ $template_variables['SettingsSection.PasswordCollector'] = sucuriscan_settings_general_pwdcollector($page_nonce);
11609
+ $template_variables['SettingsSection.IPDiscoverer'] = sucuriscan_settings_general_ipdiscoverer($page_nonce);
11610
+ $template_variables['SettingsSection.CommentMonitor'] = sucuriscan_settings_general_commentmonitor($page_nonce);
11611
+ $template_variables['SettingsSection.XhrMonitor'] = sucuriscan_settings_general_xhrmonitor($page_nonce);
11612
+
11613
+ sucuriscan_settings_general_adsvisibility($page_nonce);
11614
+
11615
  if ( array_key_exists( $emails_per_hour, $sucuriscan_emails_per_hour ) ) {
11616
  $template_variables['EmailsPerHour'] = $sucuriscan_emails_per_hour[ $emails_per_hour ];
11617
  }
11620
  $template_variables['MaximumFailedLogins'] = $sucuriscan_maximum_failed_logins[ $maximum_failed_logins ];
11621
  }
11622
 
 
 
 
 
11623
  if ( $audit_report == 'disabled' ) {
11624
  $template_variables['AuditReportStatus'] = 'Disabled';
11625
  $template_variables['AuditReportSwitchText'] = 'Enable';
11627
  $template_variables['AuditReportSwitchCssClass'] = 'button-success';
11628
  }
11629
 
11630
+ if ( function_exists( 'wp_timezone_choice' ) ) {
11631
+ $gmt_offset = SucuriScanOption::get_option( 'gmt_offset' );
11632
+ $tzstring = SucuriScanOption::get_option( 'timezone_string' );
11633
+ $template_variables['CurrentDatetime'] = SucuriScan::current_datetime();
11634
+ $template_variables['CustomTimezone'] = empty( $tzstring ) ? 'UTC' . $gmt_offset : $tzstring;
11635
  }
11636
 
11637
+ return SucuriScanTemplate::get_section('settings-general', $template_variables);
11638
+ }
 
 
 
 
11639
 
11640
+ function sucuriscan_settings_general_apikey($nonce)
11641
+ {
11642
+ $params = array();
11643
+ $invalid_domain = false;
11644
+ $api_recovery_modal = '';
11645
+ $api_registered_modal = '';
11646
 
11647
+ // Whether the form to manually add the API key should be shown or not.
11648
+ $display_manual_key_form = (bool) (SucuriScanRequest::post(':recover_key') !== false);
11649
+
11650
+ if ($nonce) {
11651
+ if (SucuriScanRequest::post(':plugin_api_key') !== false) {
11652
+ $user_id = SucuriScanRequest::post(':setup_user');
11653
+ $user_obj = SucuriScan::get_user_by_id($user_id);
11654
+
11655
+ if ($user_obj !== false && user_can($user_obj, 'administrator')) {
11656
+ // Send request to generate new API key or display form to set manually.
11657
+ if (SucuriScanAPI::register_site($user_obj->user_email)) {
11658
+ $api_registered_modal = SucuriScanTemplate::get_modal(
11659
+ 'settings-apiregistered',
11660
+ array(
11661
+ 'Title' => 'Site registered successfully',
11662
+ 'CssClass' => 'sucuriscan-apikey-registered',
11663
+ )
11664
+ );
11665
+ } else {
11666
+ $display_manual_key_form = true;
11667
+ }
11668
+ }
11669
+ }
11670
+
11671
+ // Recover API key through the email registered previously.
11672
+ if (SucuriScanRequest::post(':recover_key') !== false) {
11673
+ SucuriScanAPI::recover_key();
11674
+ SucuriScanEvent::report_info_event('Recovery of the Sucuri API key was requested.');
11675
+ $api_recovery_modal = SucuriScanTemplate::get_modal(
11676
+ 'settings-apirecovery',
11677
+ array(
11678
+ 'Title' => 'Plugin API Key Recovery',
11679
+ 'CssClass' => 'sucuriscan-apirecovery',
11680
+ )
11681
+ );
11682
+ }
11683
  }
11684
 
11685
+ $api_key = SucuriScanAPI::get_plugin_key();
11686
+
11687
+ // Check whether the domain name is valid or not.
11688
+ if (!$api_key) {
11689
+ $clean_domain = SucuriScan::get_top_level_domain();
11690
+ $domain_address = @gethostbyname($clean_domain);
11691
+ $invalid_domain = (bool) ($domain_address === $clean_domain);
11692
  }
11693
 
11694
+ $params['APIKey'] = (!$api_key ? '<em>(not set)</em>' : $api_key);
11695
+ $params['APIKey.RecoverVisibility'] = SucuriScanTemplate::visibility(!$api_key && !$display_manual_key_form);
11696
+ $params['APIKey.ManualKeyFormVisibility'] = SucuriScanTemplate::visibility($display_manual_key_form);
11697
+ $params['APIKey.RemoveVisibility'] = SucuriScanTemplate::visibility((bool) $api_key);
11698
+ $params['InvalidDomainVisibility'] = SucuriScanTemplate::visibility($invalid_domain);
11699
+ $params['ModalWhenAPIRegistered'] = $api_registered_modal;
11700
+ $params['ModalForApiKeyRecovery'] = $api_recovery_modal;
11701
+
11702
+ return SucuriScanTemplate::get_section('settings-general-apikey', $params);
11703
+ }
11704
+
11705
+ function sucuriscan_settings_general_apiproxy()
11706
+ {
11707
+ $params = array(
11708
+ 'APIProxy.Host' => 'no_proxy_host',
11709
+ 'APIProxy.Port' => 'no_proxy_port',
11710
+ 'APIProxy.Username' => 'no_proxy_username',
11711
+ 'APIProxy.Password' => 'no_proxy_password',
11712
+ 'APIProxy.PasswordType' => 'default',
11713
+ 'APIProxy.PasswordText' => 'empty',
11714
+ );
11715
+
11716
+ if (class_exists('WP_HTTP_Proxy')) {
11717
  $wp_http_proxy = new WP_HTTP_Proxy();
11718
 
11719
+ if ($wp_http_proxy->is_enabled()) {
11720
+ $proxy_host = SucuriScan::escape($wp_http_proxy->host());
11721
+ $proxy_port = SucuriScan::escape($wp_http_proxy->port());
11722
+ $proxy_username = SucuriScan::escape($wp_http_proxy->username());
11723
+ $proxy_password = SucuriScan::escape($wp_http_proxy->password());
11724
 
11725
  $template_variables['APIProxy.Host'] = $proxy_host;
11726
  $template_variables['APIProxy.Port'] = $proxy_port;
11732
  }
11733
  }
11734
 
11735
+ return SucuriScanTemplate::get_section('settings-general-apiproxy', $params);
11736
+ }
11737
+
11738
+ function sucuriscan_settings_general_datastorage($nonce)
11739
+ {
11740
+ $params = array();
11741
+
11742
+ // Update the datastore path (if the new directory exists).
11743
+ if ($nonce) {
11744
+ $directory = SucuriScanRequest::post(':datastore_path');
11745
+
11746
+ if ($directory) {
11747
+ $current = SucuriScanOption::datastore_folder_path();
11748
+
11749
+ // Try to create the new directory (if possible).
11750
+ if (!file_exists($directory)) {
11751
+ @mkdir($directory, 0755, true);
11752
+ }
11753
+
11754
+ // Check if the directory is writable and move all the logs.
11755
+ if (file_exists($directory)) {
11756
+ if (is_writable($directory)) {
11757
+ $message = 'Datastore path set to <code>' . $directory . '</code>';
11758
+
11759
+ SucuriScanOption::update_option(':datastore_path', $directory);
11760
+ SucuriScanEvent::report_info_event($message);
11761
+ SucuriScanEvent::notify_event('plugin_change', $message);
11762
+ SucuriScanInterface::info($message);
11763
+
11764
+ if (file_exists($current)) {
11765
+ $newpath = SucuriScanOption::datastore_folder_path();
11766
+
11767
+ // Some file systems do not work correctly with trailing separators.
11768
+ $current = rtrim($current, '/');
11769
+ $newpath = rtrim($newpath, '/');
11770
+ @rename($current, $newpath);
11771
+ }
11772
+ } else {
11773
+ SucuriScanInterface::error('The new directory path is not writable.');
11774
+ }
11775
+ } else {
11776
+ SucuriScanInterface::error('The directory path specified does not exists.');
11777
+ }
11778
+ }
11779
+ }
11780
+
11781
+ $params['DatastorePath'] = SucuriScanOption::get_option(':datastore_path');
11782
+
11783
+ return SucuriScanTemplate::get_section('settings-general-datastorage', $params);
11784
+ }
11785
+
11786
+ function sucuriscan_settings_general_apissl($nonce)
11787
+ {
11788
+ global $sucuriscan_verify_ssl_cert;
11789
+
11790
+ $params = array(
11791
+ 'VerifySSLCert' => 'Undefined',
11792
+ 'VerifySSLCertCssClass' => 0,
11793
+ 'VerifySSLCertOptions' => '',
11794
+ );
11795
+
11796
+ // Update the configuration for the SSL certificate verification.
11797
+ if ($nonce) {
11798
+ $verify_ssl_cert = SucuriScanRequest::post(':verify_ssl_cert');
11799
+
11800
+ if ($verify_ssl_cert) {
11801
+ if (array_key_exists($verify_ssl_cert, $sucuriscan_verify_ssl_cert)) {
11802
+ $message = 'SSL certificate verification for API calls set to <code>' . $verify_ssl_cert . '</code>';
11803
+
11804
+ SucuriScanOption::update_option(':verify_ssl_cert', $verify_ssl_cert);
11805
+ SucuriScanEvent::report_warning_event($message);
11806
+ SucuriScanEvent::notify_event('plugin_change', $message);
11807
+ SucuriScanInterface::info($message);
11808
+ } else {
11809
+ SucuriScanInterface::error('Invalid value for the SSL certificate verification.');
11810
+ }
11811
+ }
11812
+ }
11813
+
11814
+ $verify_ssl_cert = SucuriScanOption::get_option(':verify_ssl_cert');
11815
+ $params['VerifySSLCertOptions'] = SucuriScanTemplate::get_select_options(
11816
+ $sucuriscan_verify_ssl_cert,
11817
+ $verify_ssl_cert
11818
+ );
11819
+
11820
+ if (array_key_exists($verify_ssl_cert, $sucuriscan_verify_ssl_cert)) {
11821
+ $params['VerifySSLCert'] = $sucuriscan_verify_ssl_cert[$verify_ssl_cert];
11822
+
11823
+ if ($verify_ssl_cert === 'true') {
11824
+ $params['VerifySSLCertCssClass'] = 1;
11825
+ }
11826
+ }
11827
+
11828
+ return SucuriScanTemplate::get_section('settings-general-apissl', $params);
11829
+ }
11830
+
11831
+ function sucuriscan_settings_general_apitimeout($nonce)
11832
+ {
11833
+ $params = array();
11834
+
11835
+ // Update the API request timeout.
11836
+ if ($nonce) {
11837
+ $timeout = SucuriScanRequest::post(':request_timeout', '[0-9]+');
11838
+
11839
+ if ($timeout !== false) {
11840
+ $message = 'API request timeout set to <code>' . $timeout . '</code> seconds.';
11841
+
11842
+ SucuriScanOption::update_option(':request_timeout', $timeout);
11843
+ SucuriScanEvent::report_info_event($message);
11844
+ SucuriScanEvent::notify_event('plugin_change', $message);
11845
+ SucuriScanInterface::info($message);
11846
+ }
11847
+ }
11848
+
11849
+ $params['RequestTimeout'] = SucuriScanOption::get_option(':request_timeout') . ' seconds';
11850
+
11851
+ return SucuriScanTemplate::get_section('settings-general-apitimeout', $params);
11852
+ }
11853
+
11854
+ function sucuriscan_settings_general_reverseproxy($nonce)
11855
+ {
11856
+ $params = array(
11857
+ 'ReverseProxyStatus' => 'Enabled',
11858
+ 'ReverseProxySwitchText' => 'Disable',
11859
+ 'ReverseProxySwitchValue' => 'disable',
11860
+ 'ReverseProxySwitchCssClass' => 'button-danger',
11861
+ );
11862
+
11863
+ // Enable or disable the reverse proxy support.
11864
+ if ($nonce) {
11865
+ $revproxy = SucuriScanRequest::post(':revproxy', '(en|dis)able');
11866
+
11867
+ if ($revproxy) {
11868
+ $action_d = $revproxy . 'd';
11869
+ $message = 'Reverse proxy support was <code>' . $action_d . '</code>';
11870
+
11871
+ SucuriScanOption::update_option(':revproxy', $action_d);
11872
+ SucuriScanEvent::report_info_event($message);
11873
+ SucuriScanEvent::notify_event('plugin_change', $message);
11874
+ SucuriScanInterface::info($message);
11875
+ }
11876
+ }
11877
+
11878
+ if (SucuriScanOption::is_disabled(':revproxy')) {
11879
+ $params['ReverseProxyStatus'] = 'Disabled';
11880
+ $params['ReverseProxySwitchText'] = 'Enable';
11881
+ $params['ReverseProxySwitchValue'] = 'enable';
11882
+ $params['ReverseProxySwitchCssClass'] = 'button-success';
11883
+ }
11884
+
11885
+ return SucuriScanTemplate::get_section('settings-general-reverseproxy', $params);
11886
+ }
11887
+
11888
+ function sucuriscan_settings_general_pwdcollector($nonce)
11889
+ {
11890
+ $params = array(
11891
+ 'PwdCollectorStatus' => 'Disabled',
11892
+ 'PwdCollectorSwitchText' => 'Enable',
11893
+ 'PwdCollectorSwitchValue' => 'enable',
11894
+ 'PwdCollectorSwitchCssClass' => 'button-success',
11895
+ );
11896
+
11897
+ // Update the collection of failed passwords settings.
11898
+ if ($nonce) {
11899
+ $collector = SucuriScanRequest::post(':collect_wrong_passwords');
11900
+
11901
+ if ($collector) {
11902
+ $collector = strtolower($collector);
11903
+ $message = 'Collect failed login passwords set to <code>%s</code>';
11904
+
11905
+ if ($collector == 'enable') {
11906
+ $collect_action = 'enabled';
11907
+ $message = sprintf($message, $collect_action);
11908
+ SucuriScanEvent::report_critical_event($message);
11909
+ } else {
11910
+ $collect_action = 'disabled';
11911
+ $message = sprintf($message, $collect_action);
11912
+ SucuriScanEvent::report_info_event($message);
11913
+ }
11914
+
11915
+ SucuriScanOption::update_option(':collect_wrong_passwords', $collect_action);
11916
+ SucuriScanEvent::notify_event('plugin_change', $message);
11917
+ SucuriScanInterface::info($message);
11918
+ }
11919
+ }
11920
+
11921
+ if (sucuriscan_collect_wrong_passwords() === true) {
11922
+ $params['PwdCollectorStatus'] = 'Enabled';
11923
+ $params['PwdCollectorSwitchText'] = 'Disable';
11924
+ $params['PwdCollectorSwitchValue'] = 'disable';
11925
+ $params['PwdCollectorSwitchCssClass'] = 'button-danger';
11926
+ }
11927
+
11928
+ return SucuriScanTemplate::get_section('settings-general-pwdcollector', $params);
11929
+ }
11930
+
11931
+ function sucuriscan_settings_general_ipdiscoverer($nonce)
11932
+ {
11933
+ $params = array(
11934
+ 'TopLevelDomain' => 'Unknown',
11935
+ 'WebsiteHostName' => 'Unknown',
11936
+ 'WebsiteHostAddress' => 'Unknown',
11937
+ 'IsUsingCloudProxy' => 'Unknown',
11938
+ 'WebsiteURL' => 'Unknown',
11939
+ 'RemoteAddress' => '127.0.0.1',
11940
+ 'RemoteAddressHeader' => 'INVALID',
11941
+ /* Switch form information. */
11942
+ 'DnsLookupsStatus' => 'Enabled',
11943
+ 'DnsLookupsSwitchText' => 'Disable',
11944
+ 'DnsLookupsSwitchValue' => 'disable',
11945
+ 'DnsLookupsSwitchCssClass' => 'button-danger',
11946
+ );
11947
+
11948
+ // Configure the DNS lookups option for reverse proxy detection.
11949
+ if ($nonce) {
11950
+ $dns_lookups = SucuriScanRequest::post(':dns_lookups', '(en|dis)able');
11951
+
11952
+ if ($dns_lookups) {
11953
+ $action_d = $dns_lookups . 'd';
11954
+ $message = 'DNS lookups for reverse proxy detection <code>' . $action_d . '</code>';
11955
+
11956
+ SucuriScanOption::update_option(':dns_lookups', $action_d);
11957
+ SucuriScanEvent::report_info_event($message);
11958
+ SucuriScanEvent::notify_event('plugin_change', $message);
11959
+ SucuriScanInterface::info($message);
11960
+ }
11961
+ }
11962
+
11963
+ if (SucuriScanOption::is_disabled(':dns_lookups')) {
11964
+ $params['DnsLookupsStatus'] = 'Disabled';
11965
+ $params['DnsLookupsSwitchText'] = 'Enable';
11966
+ $params['DnsLookupsSwitchValue'] = 'enable';
11967
+ $params['DnsLookupsSwitchCssClass'] = 'button-success';
11968
+ }
11969
+
11970
+ $proxy_info = SucuriScan::is_behind_cloudproxy(true);
11971
+ $base_domain = SucuriScan::get_domain(true);
11972
+
11973
+ $params['TopLevelDomain'] = $proxy_info['http_host'];
11974
+ $params['WebsiteHostName'] = $proxy_info['host_name'];
11975
+ $params['WebsiteHostAddress'] = $proxy_info['host_addr'];
11976
+ $params['IsUsingCloudProxy'] = ($proxy_info['status'] ? 'Active' : 'Not Active');
11977
+ $params['RemoteAddressHeader'] = SucuriScan::get_remote_addr_header();
11978
+ $params['RemoteAddress'] = SucuriScan::get_remote_addr();
11979
+ $params['WebsiteURL'] = SucuriScan::get_domain();
11980
+
11981
+ if ($base_domain !== $proxy_info['http_host']) {
11982
+ $params['TopLevelDomain'] = sprintf('%s (%s)', $params['TopLevelDomain'], $base_domain);
11983
+ }
11984
+
11985
+ return SucuriScanTemplate::get_section('settings-general-ipdiscoverer', $params);
11986
+ }
11987
+
11988
+ function sucuriscan_settings_general_commentmonitor($nonce)
11989
+ {
11990
+ $params = array(
11991
+ 'CommentMonitorStatus' => 'Enabled',
11992
+ 'CommentMonitorSwitchText' => 'Disable',
11993
+ 'CommentMonitorSwitchValue' => 'disable',
11994
+ 'CommentMonitorSwitchCssClass' => 'button-danger',
11995
+ );
11996
+
11997
+ // Configure the comment monitor option.
11998
+ if ($nonce) {
11999
+ $monitor = SucuriScanRequest::post(':comment_monitor', '(en|dis)able');
12000
+
12001
+ if ($monitor) {
12002
+ $action_d = $monitor . 'd';
12003
+ $message = 'Comment monitor was <code>' . $action_d . '</code>';
12004
+
12005
+ SucuriScanOption::update_option(':comment_monitor', $action_d);
12006
+ SucuriScanEvent::report_info_event($message);
12007
+ SucuriScanEvent::notify_event('plugin_change', $message);
12008
+ SucuriScanInterface::info($message);
12009
+ }
12010
+ }
12011
+
12012
+ if (SucuriScanOption::is_disabled(':comment_monitor')) {
12013
+ $params['CommentMonitorStatus'] = 'Disabled';
12014
+ $params['CommentMonitorSwitchText'] = 'Enable';
12015
+ $params['CommentMonitorSwitchValue'] = 'enable';
12016
+ $params['CommentMonitorSwitchCssClass'] = 'button-success';
12017
+ }
12018
+
12019
+ return SucuriScanTemplate::get_section('settings-general-commentmonitor', $params);
12020
+ }
12021
+
12022
+ function sucuriscan_settings_general_xhrmonitor($nonce)
12023
+ {
12024
+ $params = array(
12025
+ 'XhrMonitorStatus' => 'Enabled',
12026
+ 'XhrMonitorSwitchText' => 'Disable',
12027
+ 'XhrMonitorSwitchValue' => 'disable',
12028
+ 'XhrMonitorSwitchCssClass' => 'button-danger',
12029
+ );
12030
+
12031
+ // Configure the XHR monitor option.
12032
+ if ($nonce) {
12033
+ $monitor = SucuriScanRequest::post(':xhr_monitor', '(en|dis)able');
12034
+
12035
+ if ($monitor) {
12036
+ $action_d = $monitor . 'd';
12037
+ $message = 'XHR (XML HTTP Request) monitor was <code>' . $action_d . '</code>';
12038
+
12039
+ SucuriScanOption::update_option(':xhr_monitor', $action_d);
12040
+ SucuriScanEvent::report_info_event($message);
12041
+ SucuriScanEvent::notify_event('plugin_change', $message);
12042
+ SucuriScanInterface::info($message);
12043
+ }
12044
+ }
12045
+
12046
+ if (SucuriScanOption::is_disabled(':xhr_monitor')) {
12047
+ $params['XhrMonitorStatus'] = 'Disabled';
12048
+ $params['XhrMonitorSwitchText'] = 'Enable';
12049
+ $params['XhrMonitorSwitchValue'] = 'enable';
12050
+ $params['XhrMonitorSwitchCssClass'] = 'button-success';
12051
+ }
12052
+
12053
+ return SucuriScanTemplate::get_section('settings-general-xhrmonitor', $params);
12054
+ }
12055
+
12056
+ function sucuriscan_settings_general_adsvisibility($nonce)
12057
+ {
12058
+ // Update the advertisement visibility settings.
12059
+ if ($nonce) {
12060
+ $ads_visibility = SucuriScanRequest::post(':ads_visibility');
12061
+
12062
+ if ($ads_visibility === 'disable') {
12063
+ $option_value = $ads_visibility . 'd';
12064
+ $message = sprintf('Plugin advertisement set to <code>%s</code>', $option_value);
12065
+
12066
+ SucuriScanOption::update_option(':ads_visibility', $option_value);
12067
+ SucuriScanEvent::report_info_event($message);
12068
+ SucuriScanInterface::info($message);
12069
+ }
12070
+ }
12071
+ }
12072
+
12073
+ function sucuriscan_settings_general_resetoptions($nonce)
12074
+ {
12075
+ // Reset all the plugin's options.
12076
+ if ($nonce && SucuriScanRequest::post(':reset_options') !== false) {
12077
+ $process = SucuriScanRequest::post(':process_form');
12078
+
12079
+ if (intval($process) === 1) {
12080
+ // Notify the event before the API key is removed.
12081
+ $message = 'Sucuri plugin options were reset';
12082
+ SucuriScanEvent::report_critical_event($message);
12083
+ SucuriScanEvent::notify_event('plugin_change', $message);
12084
+
12085
+ // Remove all plugin options from the database.
12086
+ SucuriScanOption::delete_plugin_options();
12087
+
12088
+ // Remove the scheduled tasks.
12089
+ wp_clear_scheduled_hook('sucuriscan_scheduled_scan');
12090
+
12091
+ // Remove all the local security logs.
12092
+ @unlink(SucuriScan::datastore_folder_path('.htaccess'));
12093
+ @unlink(SucuriScan::datastore_folder_path('index.html'));
12094
+ @unlink(SucuriScan::datastore_folder_path('sucuri-failedlogins.php'));
12095
+ @unlink(SucuriScan::datastore_folder_path('sucuri-integrity.php'));
12096
+ @unlink(SucuriScan::datastore_folder_path('sucuri-lastlogins.php'));
12097
+ @unlink(SucuriScan::datastore_folder_path('sucuri-oldfailedlogins.php'));
12098
+ @unlink(SucuriScan::datastore_folder_path('sucuri-plugindata.php'));
12099
+ @unlink(SucuriScan::datastore_folder_path('sucuri-sitecheck.php'));
12100
+ @unlink(SucuriScan::datastore_folder_path('sucuri-trustip.php'));
12101
+ @rmdir(SucuriScan::datastore_folder_path());
12102
+
12103
+ // Revert hardening of core directories (includes, content, uploads).
12104
+ SucuriScanHardening::dewhitelist('ms-files.php', 'wp-includes');
12105
+ SucuriScanHardening::dewhitelist('wp-tinymce.php', 'wp-includes');
12106
+ SucuriScanHardening::unharden_directory(ABSPATH . '/wp-includes');
12107
+ SucuriScanHardening::unharden_directory(WP_CONTENT_DIR . '/uploads');
12108
+ SucuriScanHardening::unharden_directory(WP_CONTENT_DIR);
12109
+
12110
+ SucuriScanInterface::info('Plugin options, core directory hardening, and security logs were reset');
12111
+ } else {
12112
+ SucuriScanInterface::error('You need to confirm that you understand the risk of this operation.');
12113
+ }
12114
+ }
12115
+
12116
+ return SucuriScanTemplate::get_section('settings-general-resetoptions');
12117
  }
12118
 
12119
  /**
12931
  $error_log_path = @realpath( ABSPATH . '/' . $log_filename );
12932
  }
12933
 
12934
+ if ( SucuriScanOption::is_disabled( ':parse_errorlogs' ) ) {
12935
  $template_variables['ErrorLog.DisabledVisibility'] = 'visible';
12936
  }
12937
 
12986
  'Plugin_version' => SUCURISCAN_VERSION,
12987
  'Plugin_checksum' => SUCURISCAN_PLUGIN_CHECKSUM,
12988
  'Last_filesystem_scan' => SucuriScanFSScanner::get_filesystem_runtime( true ),
12989
+ 'Datetime_and_Timezone' => '',
 
 
 
 
 
 
 
 
12990
  'Operating_system' => sprintf( '%s (%d Bit)', PHP_OS, PHP_INT_SIZE * 8 ),
12991
  'Server' => 'Unknown',
12992
  'Developer_mode' => 'OFF',
12996
  'PHP_version' => PHP_VERSION,
12997
  );
12998
 
12999
+ $info_vars['Datetime_and_Timezone'] = sprintf(
13000
+ '%s (GMT %s)',
13001
+ SucuriScan::current_datetime(),
13002
+ get_option( 'gmt_offset' )
13003
+ );
 
 
 
 
 
13004
 
13005
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
13006
  $info_vars['Developer_mode'] = 'ON';
uninstall.php CHANGED
@@ -25,7 +25,10 @@ $sucuriscan_option_names = array(
25
  'audit_report',
26
  'cloudproxy_apikey',
27
  'collect_wrong_passwords',
 
28
  'datastore_path',
 
 
29
  'email_subject',
30
  'emails_per_hour',
31
  'emails_sent',
@@ -50,6 +53,7 @@ $sucuriscan_option_names = array(
50
  'notify_plugin_installed',
51
  'notify_plugin_updated',
52
  'notify_post_publication',
 
53
  'notify_settings_updated',
54
  'notify_success_login',
55
  'notify_theme_activated',
@@ -75,7 +79,9 @@ $sucuriscan_option_names = array(
75
  'site_version',
76
  'sitecheck_counter',
77
  'sitecheck_scanner',
 
78
  'verify_ssl_cert',
 
79
  );
80
 
81
  $sucuriscan_storage_path = get_option( 'sucuriscan_datastore_path' );
25
  'audit_report',
26
  'cloudproxy_apikey',
27
  'collect_wrong_passwords',
28
+ 'comment_monitor',
29
  'datastore_path',
30
+ 'dismiss_setup',
31
+ 'dns_lookups',
32
  'email_subject',
33
  'emails_per_hour',
34
  'emails_sent',
53
  'notify_plugin_installed',
54
  'notify_plugin_updated',
55
  'notify_post_publication',
56
+ 'notify_scan_checksums',
57
  'notify_settings_updated',
58
  'notify_success_login',
59
  'notify_theme_activated',
79
  'site_version',
80
  'sitecheck_counter',
81
  'sitecheck_scanner',
82
+ 'use_wpmail',
83
  'verify_ssl_cert',
84
+ 'xhr_monitor',
85
  );
86
 
87
  $sucuriscan_storage_path = get_option( 'sucuriscan_datastore_path' );