Top 10 – Popular posts plugin for WordPress - Version 3.1.0

Version Description

Release post: https://webberzone.com/blog/top-10-v3-1-0/

  • Features:

    • New filter tptn_show_meta_box that can be set to false to disable the Top 10 meta box on Edit screens
    • New option to exclude the current post from the list
    • New option "Exclude on Categories" to disable the display of the popular posts on selected categories
  • Enhancements/Modifications:

    • Optimised import of tables particularly for larger imports
    • Added wpml-config.xml file that will allow settings to be translated with WPML and PolyLang
    • Upgraded block to the latest API
    • Upgraded thumbnail display. If default image is disabled, then the site icon will be displayed if available
    • Admin dashboard counts match with the Popular posts listings
    • Updated chartjs to the latest version
  • Bug fixes:

    • Fixed PHP notice on widgets.php page due to the block
    • Widget checkboxes are not saved in WordPress 5.8
    • post__in argument will now remove any false/0 values
    • Disabling/enabling author tracking didn't always work
    • WP Multisite: Creating a new blog with automatically configure the plugin
    • Widget incorrectly included all post types when no post types were selected instead of using the global settings
    • Current post was incorrectly excluded when translation functions were run
Download this release

Release Info

Developer Ajay
Plugin Icon 128x128 Top 10 – Popular posts plugin for WordPress
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.0 to 3.1.0

Files changed (43) hide show
  1. README.md +23 -18
  2. css/left-thumbs.css +7 -8
  3. css/left-thumbs.min.css +1 -1
  4. includes/activate-deactivate.php +13 -6
  5. includes/admin/admin-dashboard.php +13 -11
  6. includes/admin/admin-metabox.php +14 -1
  7. includes/admin/admin.php +26 -11
  8. includes/admin/class-top-ten-statistics-table.php +16 -9
  9. includes/admin/default-settings.php +24 -2
  10. includes/admin/import-export.php +38 -14
  11. includes/admin/js/chart-data.js +1 -1
  12. includes/admin/js/chart.min.js +4 -4
  13. includes/admin/js/chartjs-plugin-datalabels.min.js +2 -2
  14. includes/admin/save-settings.php +18 -0
  15. includes/admin/settings-page.php +15 -6
  16. includes/admin/sidebar.php +1 -1
  17. includes/blocks/popular-posts.php +0 -157
  18. includes/blocks/popular-posts/block.json +70 -0
  19. includes/blocks/popular-posts/build/index.asset.php +1 -0
  20. includes/blocks/popular-posts/build/index.js +1 -0
  21. includes/blocks/popular-posts/index.js +0 -250
  22. includes/blocks/popular-posts/index.min.js +0 -1
  23. includes/blocks/popular-posts/index.php +0 -1
  24. includes/blocks/popular-posts/src/edit.js +282 -0
  25. includes/blocks/popular-posts/src/index.js +27 -0
  26. includes/blocks/register-blocks.php +90 -0
  27. includes/class-top-ten-query.php +15 -11
  28. includes/l10n.php +62 -23
  29. includes/modules/class-top-ten-widget.php +110 -126
  30. includes/modules/exclusions.php +63 -0
  31. includes/public/display-posts.php +17 -55
  32. includes/public/media.php +127 -123
  33. includes/public/output-generator.php +3 -6
  34. includes/public/styles.php +12 -6
  35. includes/tracker.php +1 -1
  36. languages/top-10-en_US.mo +0 -0
  37. languages/top-10-en_US.po +322 -271
  38. languages/top-10-en_US.pot +322 -271
  39. phpcs.ruleset.xml +0 -17
  40. phpcs.xml.dist +38 -0
  41. readme.txt +29 -3
  42. top-10.php +49 -38
  43. wpml-config.xml +11 -0
README.md CHANGED
@@ -1,14 +1,19 @@
1
  # Top 10 - Popular posts plugin for WordPress
2
 
 
 
3
  [![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/top-10.svg?style=flat-square)](https://wordpress.org/plugins/top-10/)
4
- [![License](https://img.shields.io/badge/license-GPL_v2%2B-orange.svg?style=flat-square)](http://opensource.org/licenses/GPL-2.0)
5
  [![WordPress Tested](https://img.shields.io/wordpress/v/top-10.svg?style=flat-square)](https://wordpress.org/plugins/top-10/)
6
- [![Build Status](https://travis-ci.org/WebberZone/top-10.svg?branch=master)](https://travis-ci.org/WebberZone/top-10)
 
7
 
8
- __Requires:__ 5.3
9
 
10
  __Tested up to:__ 5.9
11
 
 
 
12
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
13
 
14
  __Plugin page:__ [Top 10](https://webberzone.com/plugins/top-10/) | [WordPress.org plugin page](https://wordpress.org/plugins/top-10/)
@@ -27,20 +32,20 @@ Top 10 also has powerful API and is fully extendable with WordPress actions and
27
 
28
  ### Features
29
 
30
- * **Page counter**: Counts page views on single posts, pages and *custom post types* on an hourly basis which can then be easily displayed automatically, using shortcodes or functions
31
- * **Popular posts**: Display a list of popular posts either for total counts or for a custom period. You can choose how many posts are to be displayed along with loads of other customisation options
32
- * **Widget ready**: Sidebar widgets available for daily popular and overall popular posts. Highly customizable widgets to control what you want to display in the list of posts
33
- * **Shortcodes**: The plugin includes two shortcodes `[tptn_list]` and `[tptn_views]` to display the posts list and the number of views respectively
34
- * **Thumbnail support**
35
  * Support for WordPress post thumbnails. Top 10 will create a custom image size (`tptn_thumbnail`) with the dimensions specified in the Settings page
36
  * Auto-extract the first image in your post to be displayed as a thumbnail
37
  * Manually enter the URL of the thumbnail via [WordPress meta fields](http://codex.wordpress.org/Custom_Fields). Specify this using the meta box in your Edit screens.
38
- * **Exclusions**: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
39
- * **Styles**: The output is wrapped in CSS classes which allows you to easily style the list. You can enter your custom CSS styles from within WordPress Admin area or use the style included.
40
- * **Admin interface**: View list of daily and/or overall popular posts from within the dashboard. Top 10 also adds two sortable columns to your All Posts and All Pages pages in your WordPress Admin area
41
- * **Export/Import interface**: Export the count tables and settings to restore in the same site or on other installs
42
- * **Works with caching plugins** like WP-Super-Cache, W3 Total Cache or Quick Cache
43
- * **Extendable code**: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
44
 
45
  ### GDPR
46
 
@@ -59,7 +64,7 @@ Top 10 is available for [translation directly on WordPress.org](https://translat
59
  ## Screenshots
60
 
61
  ![Style Options](https://raw.github.com/WebberZone/top-10/master/wporg-assets/screenshot-5.png)
62
- _Top 10 settings page - Styles Options_
63
 
64
  For more screenshots visit the [WordPress plugin page](http://wordpress.org/plugins/top-10/screenshots/).
65
 
@@ -81,11 +86,11 @@ For more screenshots visit the [WordPress plugin page](http://wordpress.org/plug
81
 
82
  3. Activate the Plugin in WP-Admin.
83
 
84
- 4. Go to **Top 10 » Settings** to configure
85
 
86
- 5. Go to **Appearance » Widgets** to add the Popular Posts sidebar widget to your theme
87
 
88
- 6. Go to **Top 10 » View Popular Posts** to view the list of popular posts
89
 
90
  ## Frequently Asked Questions
91
 
1
  # Top 10 - Popular posts plugin for WordPress
2
 
3
+ ![Top 10](https://raw.githubusercontent.com/WebberZone/top-10/master/wporg-assets/banner-1544x500.png)
4
+
5
  [![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/top-10.svg?style=flat-square)](https://wordpress.org/plugins/top-10/)
6
+ [![License](https://img.shields.io/badge/license-GPL_v2%2B-orange.svg?style=flat-square)](https://opensource.org/licenses/GPL-2.0)
7
  [![WordPress Tested](https://img.shields.io/wordpress/v/top-10.svg?style=flat-square)](https://wordpress.org/plugins/top-10/)
8
+ [![Required PHP](https://img.shields.io/wordpress/plugin/required-php/top-10?style=flat-square)](https://wordpress.org/plugins/top-10/)
9
+ [![Active installs](https://img.shields.io/wordpress/plugin/installs/top-10?style=flat-square)](https://wordpress.org/plugins/top-10/)
10
 
11
+ __Requires:__ 5.6
12
 
13
  __Tested up to:__ 5.9
14
 
15
+ __Requires PHP:__ 7.1
16
+
17
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
18
 
19
  __Plugin page:__ [Top 10](https://webberzone.com/plugins/top-10/) | [WordPress.org plugin page](https://wordpress.org/plugins/top-10/)
32
 
33
  ### Features
34
 
35
+ * __Page counter__: Counts page views on single posts, pages and *custom post types* on an hourly basis which can then be easily displayed automatically, using shortcodes or functions
36
+ * __Popular posts__: Display a list of popular posts either for total counts or for a custom period. You can choose how many posts are to be displayed along with loads of other customisation options
37
+ * __Widget ready__: Sidebar widgets available for daily popular and overall popular posts. Highly customizable widgets to control what you want to display in the list of posts
38
+ * __Shortcodes__: The plugin includes two shortcodes `[tptn_list]` and `[tptn_views]` to display the posts list and the number of views respectively
39
+ * __Thumbnail support__
40
  * Support for WordPress post thumbnails. Top 10 will create a custom image size (`tptn_thumbnail`) with the dimensions specified in the Settings page
41
  * Auto-extract the first image in your post to be displayed as a thumbnail
42
  * Manually enter the URL of the thumbnail via [WordPress meta fields](http://codex.wordpress.org/Custom_Fields). Specify this using the meta box in your Edit screens.
43
+ * __Exclusions__: Exclude posts from select categories from appearing in the top posts list. Also exclude posts by ID from appearing in the list
44
+ * __Styles__: The output is wrapped in CSS classes which allows you to easily style the list. You can enter your custom CSS styles from within WordPress Admin area or use the style included.
45
+ * __Admin interface__: View list of daily and/or overall popular posts from within the dashboard. Top 10 also adds two sortable columns to your All Posts and All Pages pages in your WordPress Admin area
46
+ * __Export/Import interface__: Export the count tables and settings to restore in the same site or on other installs
47
+ * __Works with caching plugins__ like WP-Super-Cache, W3 Total Cache or Quick Cache
48
+ * __Extendable code__: Top 10 has tonnes of filters and actions that allow any developer to easily add features, edit outputs, etc.
49
 
50
  ### GDPR
51
 
64
  ## Screenshots
65
 
66
  ![Style Options](https://raw.github.com/WebberZone/top-10/master/wporg-assets/screenshot-5.png)
67
+ *Top 10 settings page - Styles Options*
68
 
69
  For more screenshots visit the [WordPress plugin page](http://wordpress.org/plugins/top-10/screenshots/).
70
 
86
 
87
  3. Activate the Plugin in WP-Admin.
88
 
89
+ 4. Go to __Top 10 » Settings__ to configure
90
 
91
+ 5. Go to __Appearance » Widgets__ to add the Popular Posts sidebar widget to your theme
92
 
93
+ 6. Go to __Top 10 » View Popular Posts__ to view the list of popular posts
94
 
95
  ## Frequently Asked Questions
96
 
css/left-thumbs.css CHANGED
@@ -1,9 +1,9 @@
1
- .tptn_posts_daily ul, .tptn_posts ul {
2
  margin:0 !important;
3
  padding:0 !important;
4
  }
5
 
6
- .tptn_posts_daily ul li, .tptn_posts ul li {
7
  clear:both;
8
  list-style:none;
9
  margin-bottom:15px;
@@ -12,13 +12,13 @@
12
  padding:0 !important;
13
  }
14
 
15
- .tptn_posts_daily ul:after, .tptn_posts ul:after, .tptn_posts_daily ul li:after, .tptn_posts ul li:after {
16
  content:'';
17
  display:table;
18
  clear: both;
19
  }
20
 
21
- .tptn_posts_daily .tptn_title, .tptn_posts .tptn_title {
22
  font-weight:bold;
23
  display:block;
24
  padding-bottom:5px;
@@ -26,14 +26,13 @@
26
  line-height: 1.1em;
27
  }
28
 
29
- img.tptn_thumb {
30
  display:block;
31
  float:left;
32
  clear:left;
33
  margin-right:10px !important;
34
  padding:3px !important;
35
  border:1px #CCCCCC solid;
36
- vertical-align: bottom;
37
  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.4);
38
  -moz-box-shadow: 0 1px 2px rgba(0,0,0,.4);
39
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
@@ -42,7 +41,7 @@ img.tptn_thumb {
42
  border-radius: 7px;
43
  }
44
 
45
- img.tptn_thumb:after {
46
  content: ' ';
47
  width: 100%;
48
  height: 100%;
@@ -58,6 +57,6 @@ img.tptn_thumb:after {
58
  border-radius: 7px;
59
  }
60
 
61
- .tptn_excerpt {
62
  display: block;
63
  }
1
+ .tptn-left-thumbs ul {
2
  margin:0 !important;
3
  padding:0 !important;
4
  }
5
 
6
+ .tptn-left-thumbs ul li {
7
  clear:both;
8
  list-style:none;
9
  margin-bottom:15px;
12
  padding:0 !important;
13
  }
14
 
15
+ .tptn-left-thumbs ul:after, .tptn-left-thumbs ul li:after {
16
  content:'';
17
  display:table;
18
  clear: both;
19
  }
20
 
21
+ .tptn-left-thumbs .tptn_title {
22
  font-weight:bold;
23
  display:block;
24
  padding-bottom:5px;
26
  line-height: 1.1em;
27
  }
28
 
29
+ .tptn-left-thumbs img.tptn_thumb {
30
  display:block;
31
  float:left;
32
  clear:left;
33
  margin-right:10px !important;
34
  padding:3px !important;
35
  border:1px #CCCCCC solid;
 
36
  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.4);
37
  -moz-box-shadow: 0 1px 2px rgba(0,0,0,.4);
38
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
41
  border-radius: 7px;
42
  }
43
 
44
+ .tptn-left-thumbs img.tptn_thumb:after {
45
  content: ' ';
46
  width: 100%;
47
  height: 100%;
57
  border-radius: 7px;
58
  }
59
 
60
+ .tptn-left-thumbs .tptn_excerpt {
61
  display: block;
62
  }
css/left-thumbs.min.css CHANGED
@@ -1 +1 @@
1
- .tptn_posts ul,.tptn_posts_daily ul{margin:0!important;padding:0!important}.tptn_posts ul li,.tptn_posts_daily ul li{clear:both;list-style:none;margin-bottom:15px;display:block;background:0 0;padding:0!important}.tptn_posts ul li:after,.tptn_posts ul:after,.tptn_posts_daily ul li:after,.tptn_posts_daily ul:after{content:'';display:table;clear:both}.tptn_posts .tptn_title,.tptn_posts_daily .tptn_title{font-weight:700;display:block;padding-bottom:5px;text-decoration:none;line-height:1.1em}img.tptn_thumb{display:block;float:left;clear:left;margin-right:10px!important;padding:3px!important;border:1px #ccc solid;vertical-align:bottom;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.4);-moz-box-shadow:0 1px 2px rgba(0,0,0,.4);box-shadow:0 1px 2px rgba(0,0,0,.4);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}img.tptn_thumb:after{content:' ';width:100%;height:100%;position:absolute;top:-1px;left:-1px;border:solid 1px #222;-webkit-box-shadow:inset 0 0 1px rgba(255,255,255,.4),inset 0 1px 0 rgba(255,255,255,.4),0 1px 2px rgba(0,0,0,.3);-moz-box-shadow:inset 0 0 1px rgba(255,255,255,.4),inset 0 1px 0 rgba(255,255,255,.4),0 1px 2px rgba(0,0,0,.3);box-shadow:inset 0 0 1px rgba(255,255,255,.4),inset 0 1px 0 rgba(255,255,255,.4),0 1px 2px rgba(0,0,0,.3);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.tptn_excerpt{display:block}
1
+ .tptn-left-thumbs ul{margin:0!important;padding:0!important}.tptn-left-thumbs ul li{clear:both;list-style:none;margin-bottom:15px;display:block;background:0 0;padding:0!important}.tptn-left-thumbs ul li:after,.tptn-left-thumbs ul:after{content:'';display:table;clear:both}.tptn-left-thumbs .tptn_title{font-weight:700;display:block;padding-bottom:5px;text-decoration:none;line-height:1.1em}.tptn-left-thumbs img.tptn_thumb{display:block;float:left;clear:left;margin-right:10px!important;padding:3px!important;border:1px #ccc solid;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.4);-moz-box-shadow:0 1px 2px rgba(0,0,0,.4);box-shadow:0 1px 2px rgba(0,0,0,.4);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.tptn-left-thumbs img.tptn_thumb:after{content:' ';width:100%;height:100%;position:absolute;top:-1px;left:-1px;border:solid 1px #222;-webkit-box-shadow:inset 0 0 1px rgba(255,255,255,.4),inset 0 1px 0 rgba(255,255,255,.4),0 1px 2px rgba(0,0,0,.3);-moz-box-shadow:inset 0 0 1px rgba(255,255,255,.4),inset 0 1px 0 rgba(255,255,255,.4),0 1px 2px rgba(0,0,0,.3);box-shadow:inset 0 0 1px rgba(255,255,255,.4),inset 0 1px 0 rgba(255,255,255,.4),0 1px 2px rgba(0,0,0,.3);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.tptn-left-thumbs .tptn_excerpt{display:block}
includes/activate-deactivate.php CHANGED
@@ -126,20 +126,27 @@ function tptn_single_activate() {
126
  *
127
  * @since 2.0.0
128
  *
129
- * @param int $blog_id ID of the new blog.
130
  */
131
- function tptn_activate_new_site( $blog_id ) {
132
 
133
- if ( 1 !== did_action( 'wpmu_new_blog' ) ) {
134
  return;
135
  }
136
 
137
- switch_to_blog( $blog_id );
 
 
 
 
138
  tptn_single_activate();
139
  restore_current_blog();
140
-
141
  }
142
- add_action( 'wpmu_new_blog', 'tptn_activate_new_site' );
 
 
 
 
143
 
144
 
145
  /**
126
  *
127
  * @since 2.0.0
128
  *
129
+ * @param int|WP_Site $blog WordPress 5.1 passes a WP_Site object.
130
  */
131
+ function tptn_activate_new_site( $blog ) {
132
 
133
+ if ( ! is_plugin_active_for_network( plugin_basename( TOP_TEN_PLUGIN_FILE ) ) ) {
134
  return;
135
  }
136
 
137
+ if ( ! is_int( $blog ) ) {
138
+ $blog = $blog->id;
139
+ }
140
+
141
+ switch_to_blog( $blog );
142
  tptn_single_activate();
143
  restore_current_blog();
 
144
  }
145
+ if ( version_compare( get_bloginfo( 'version' ), '5.1', '>=' ) ) {
146
+ add_action( 'wp_initialize_site', 'tptn_activate_new_site' );
147
+ } else {
148
+ add_action( 'wpmu_new_blog', 'tptn_activate_new_site' );
149
+ }
150
 
151
 
152
  /**
includes/admin/admin-dashboard.php CHANGED
@@ -35,22 +35,25 @@ function tptn_pop_display( $daily = false, $page = 0, $limit = false, $widget =
35
  $limit = tptn_get_option( 'limit' );
36
  }
37
 
38
- $results = get_tptn_posts(
39
- array(
40
- 'is_widget' => 1,
41
- 'daily' => $daily,
42
- 'limit' => $limit,
43
- 'post_types' => 'all',
44
- )
45
- );
46
 
47
  $output = '<div id="tptn_popular_posts' . ( $daily ? '_daily' : '' ) . '">';
48
 
49
  if ( $results ) {
50
  $output .= '<ul>';
51
  foreach ( $results as $result ) {
52
- $output .= '<li><a href="' . get_permalink( $result->ID ) . '">' . get_the_title( $result->ID ) . '</a>';
53
- $output .= ' (' . tptn_number_format_i18n( $result->visits ) . ')';
 
 
 
54
  $output .= '</li>';
55
  }
56
  $output .= '</ul>';
@@ -129,4 +132,3 @@ function tptn_pop_dashboard_setup() {
129
  }
130
  }
131
  add_action( 'wp_dashboard_setup', 'tptn_pop_dashboard_setup' );
132
-
35
  $limit = tptn_get_option( 'limit' );
36
  }
37
 
38
+ $args = array();
39
+ $visits = 'total_count';
40
+ if ( $daily ) {
41
+ $args['orderby'] = 'daily_count';
42
+ $visits = 'daily_count';
43
+ }
44
+ $pop_posts_obj = new Top_Ten_Statistics_Table();
45
+ $results = $pop_posts_obj->get_popular_posts( $limit, $page + 1, $args );
46
 
47
  $output = '<div id="tptn_popular_posts' . ( $daily ? '_daily' : '' ) . '">';
48
 
49
  if ( $results ) {
50
  $output .= '<ul>';
51
  foreach ( $results as $result ) {
52
+ if ( ! absint( $result[ $visits ] ) ) {
53
+ continue;
54
+ }
55
+ $output .= '<li><a href="' . get_permalink( $result['ID'] ) . '">' . get_the_title( $result['ID'] ) . '</a>';
56
+ $output .= ' (' . tptn_number_format_i18n( $result[ $visits ] ) . ')';
57
  $output .= '</li>';
58
  }
59
  $output .= '</ul>';
132
  }
133
  }
134
  add_action( 'wp_dashboard_setup', 'tptn_pop_dashboard_setup' );
 
includes/admin/admin-metabox.php CHANGED
@@ -31,6 +31,19 @@ function tptn_add_meta_box( $post_type ) {
31
  return;
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  $args = array(
35
  'public' => true,
36
  );
@@ -134,7 +147,7 @@ function tptn_call_meta_box() {
134
  </p>
135
 
136
  <p>
137
- <?php if ( function_exists( 'crp_read_options' ) ) { ?>
138
  <em style="color:red">
139
  <?php
140
  /* translators: 1: Plugin name */
31
  return;
32
  }
33
 
34
+ /**
35
+ * Filters whether to show the Top 10 meta box.
36
+ *
37
+ * @since 3.1.0
38
+ *
39
+ * @param bool $show_meta_box Whether the Top 10 meta box should be shown. Default true.
40
+ */
41
+ $show_meta_box = apply_filters( 'tptn_show_meta_box', true );
42
+
43
+ if ( ! $show_meta_box ) {
44
+ return;
45
+ }
46
+
47
  $args = array(
48
  'public' => true,
49
  );
147
  </p>
148
 
149
  <p>
150
+ <?php if ( function_exists( 'crp_get_settings' ) ) { ?>
151
  <em style="color:red">
152
  <?php
153
  /* translators: 1: Plugin name */
includes/admin/admin.php CHANGED
@@ -26,7 +26,6 @@ if ( ! defined( 'WPINC' ) ) {
26
  * @global string $tptn_settings_popular_posts_daily Daily popular page hook.
27
  * @global string $tptn_settings_tools_help Tools page hook.
28
  * @global string $tptn_settings_exim_help Export/Import page hook.
29
- * @return void
30
  */
31
  function tptn_add_admin_pages_links() {
32
  global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help;
@@ -196,7 +195,14 @@ function tptn_network_admin_menu_links() {
196
  // Initialise Top 10 Statistics pages.
197
  $tptn_stats_screen = new Top_Ten_Network_Statistics();
198
 
199
- $tptn_network_pop_posts_page = add_menu_page( esc_html__( 'Top 10 - Network Popular Posts', 'top-10' ), esc_html__( 'Top 10', 'top-10' ), 'manage_network_options', 'tptn_network_pop_posts_page', array( $tptn_stats_screen, 'plugin_settings_page' ), 'dashicons-editor-ol' );
 
 
 
 
 
 
 
200
  add_action( "load-$tptn_network_pop_posts_page", array( $tptn_stats_screen, 'screen_option' ) );
201
 
202
  }
@@ -213,14 +219,25 @@ function tptn_load_admin_scripts( $hook ) {
213
 
214
  global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help, $tptn_network_pop_posts_page;
215
 
216
- wp_register_script( 'top-ten-admin-js', TOP_TEN_PLUGIN_URL . 'includes/admin/js/admin-scripts.min.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-datepicker' ), '1.0', true );
217
- wp_register_script( 'top-ten-suggest-js', TOP_TEN_PLUGIN_URL . 'includes/admin/js/top-10-suggest.min.js', array( 'jquery', 'jquery-ui-autocomplete' ), '1.0', true );
 
 
 
 
 
 
 
 
 
 
 
 
218
  wp_register_style(
219
  'tptn-admin-customizer-css',
220
  TOP_TEN_PLUGIN_URL . 'includes/admin/css/top-10-customizer.min.css',
221
- false,
222
- '1.0',
223
- false
224
  );
225
 
226
  if ( in_array( $hook, array( $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help, $tptn_network_pop_posts_page . '-network' ), true ) ) {
@@ -247,9 +264,8 @@ function tptn_load_admin_scripts( $hook ) {
247
  wp_enqueue_style(
248
  'tptn-admin-ui-css',
249
  TOP_TEN_PLUGIN_URL . 'includes/admin/css/top-10-admin.min.css',
250
- false,
251
- '1.0',
252
- false
253
  );
254
  }
255
  }
@@ -286,4 +302,3 @@ function tptn_enqueue_scripts_widgets( $hook ) {
286
  wp_enqueue_style( 'tptn-admin-customizer-css' );
287
  }
288
  add_action( 'admin_enqueue_scripts', 'tptn_enqueue_scripts_widgets', 99 );
289
-
26
  * @global string $tptn_settings_popular_posts_daily Daily popular page hook.
27
  * @global string $tptn_settings_tools_help Tools page hook.
28
  * @global string $tptn_settings_exim_help Export/Import page hook.
 
29
  */
30
  function tptn_add_admin_pages_links() {
31
  global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help;
195
  // Initialise Top 10 Statistics pages.
196
  $tptn_stats_screen = new Top_Ten_Network_Statistics();
197
 
198
+ $tptn_network_pop_posts_page = add_menu_page(
199
+ esc_html__( 'Top 10 - Network Popular Posts', 'top-10' ),
200
+ esc_html__( 'Top 10', 'top-10' ),
201
+ 'manage_network_options',
202
+ 'tptn_network_pop_posts_page',
203
+ array( $tptn_stats_screen, 'plugin_settings_page' ),
204
+ 'dashicons-editor-ol'
205
+ );
206
  add_action( "load-$tptn_network_pop_posts_page", array( $tptn_stats_screen, 'screen_option' ) );
207
 
208
  }
219
 
220
  global $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help, $tptn_network_pop_posts_page;
221
 
222
+ wp_register_script(
223
+ 'top-ten-admin-js',
224
+ TOP_TEN_PLUGIN_URL . 'includes/admin/js/admin-scripts.min.js',
225
+ array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-datepicker' ),
226
+ TOP_TEN_VERSION,
227
+ true
228
+ );
229
+ wp_register_script(
230
+ 'top-ten-suggest-js',
231
+ TOP_TEN_PLUGIN_URL . 'includes/admin/js/top-10-suggest.min.js',
232
+ array( 'jquery', 'jquery-ui-autocomplete', 'top-ten-admin-js' ),
233
+ TOP_TEN_VERSION,
234
+ true
235
+ );
236
  wp_register_style(
237
  'tptn-admin-customizer-css',
238
  TOP_TEN_PLUGIN_URL . 'includes/admin/css/top-10-customizer.min.css',
239
+ array(),
240
+ TOP_TEN_VERSION,
 
241
  );
242
 
243
  if ( in_array( $hook, array( $tptn_settings_page, $tptn_settings_tools_help, $tptn_settings_popular_posts, $tptn_settings_popular_posts_daily, $tptn_settings_exim_help, $tptn_network_pop_posts_page . '-network' ), true ) ) {
264
  wp_enqueue_style(
265
  'tptn-admin-ui-css',
266
  TOP_TEN_PLUGIN_URL . 'includes/admin/css/top-10-admin.min.css',
267
+ array(),
268
+ 'top-ten-admin-js',
 
269
  );
270
  }
271
  }
302
  wp_enqueue_style( 'tptn-admin-customizer-css' );
303
  }
304
  add_action( 'admin_enqueue_scripts', 'tptn_enqueue_scripts_widgets', 99 );
 
includes/admin/class-top-ten-statistics-table.php CHANGED
@@ -111,25 +111,33 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
111
  // Create the base GROUP BY clause.
112
  $groupby = ' ID ';
113
 
114
- // Create the base ORDER BY clause.
115
- $orderby = ' total_count DESC ';
116
-
117
  if ( ! empty( $_REQUEST['orderby'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
118
  $orderby = sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
 
 
119
 
 
120
  if ( ! in_array( $orderby, array( 'title', 'daily_count', 'total_count' ) ) ) { //phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
121
  $orderby = ' total_count ';
122
  }
123
 
 
124
  if ( ! empty( $_REQUEST['order'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
125
  $order = sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
 
 
126
 
127
- if ( in_array( $order, array( 'asc', 'ASC', 'desc', 'DESC' ) ) ) { //phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
128
- $orderby .= ' ' . $order;
129
- } else {
130
- $orderby .= ' DESC';
131
- }
132
  }
 
 
133
  }
134
 
135
  // Create the base LIMITS clause.
@@ -509,4 +517,3 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
509
  <?php
510
  }
511
  }
512
-
111
  // Create the base GROUP BY clause.
112
  $groupby = ' ID ';
113
 
114
+ // Create the ORDER BY clause.
115
+ $orderby = '';
 
116
  if ( ! empty( $_REQUEST['orderby'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
117
  $orderby = sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
118
+ } elseif ( ! empty( $args['orderby'] ) ) {
119
+ $orderby = $args['orderby'];
120
+ }
121
 
122
+ if ( $orderby ) {
123
  if ( ! in_array( $orderby, array( 'title', 'daily_count', 'total_count' ) ) ) { //phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
124
  $orderby = ' total_count ';
125
  }
126
 
127
+ $order = '';
128
  if ( ! empty( $_REQUEST['order'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
129
  $order = sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
130
+ } elseif ( ! empty( $args['order'] ) ) {
131
+ $order = $args['order'];
132
+ }
133
 
134
+ if ( $order && in_array( $order, array( 'asc', 'ASC', 'desc', 'DESC' ), true ) ) {
135
+ $orderby .= " {$order}";
136
+ } else {
137
+ $orderby .= ' DESC';
 
138
  }
139
+ } else {
140
+ $orderby = ' total_count DESC ';
141
  }
142
 
143
  // Create the base LIMITS clause.
517
  <?php
518
  }
519
  }
 
includes/admin/default-settings.php CHANGED
@@ -344,6 +344,13 @@ function tptn_settings_list() {
344
  'type' => 'checkbox',
345
  'options' => false,
346
  ),
 
 
 
 
 
 
 
347
  'exclude_post_ids' => array(
348
  'id' => 'exclude_post_ids',
349
  'name' => esc_html__( 'Post/page IDs to exclude', 'top-10' ),
@@ -371,6 +378,18 @@ function tptn_settings_list() {
371
  'options' => '',
372
  'readonly' => true,
373
  ),
 
 
 
 
 
 
 
 
 
 
 
 
374
  'customize_output_header' => array(
375
  'id' => 'customize_output_header',
376
  'name' => '<h3>' . esc_html__( 'Customize the output', 'top-10' ) . '</h3>',
@@ -543,8 +562,11 @@ function tptn_settings_thumbnail() {
543
  'thumb_size' => array(
544
  'id' => 'thumb_size',
545
  'name' => esc_html__( 'Thumbnail size', 'top-10' ),
546
- /* translators: 1: OTF Regenerate plugin link, 2: Force regenerate plugin link. */
547
- 'desc' => esc_html__( 'You can choose from existing image sizes above or create a custom size. If you have chosen Custom size above, then enter the width, height and crop settings below. For best results, use a cropped image. If you change the width and/or height below, existing images will not be automatically resized.' ) . '<br />' . sprintf( esc_html__( 'I recommend using %1$s or %2$s to regenerate all image sizes.', 'top-10' ), '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=otf-regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">OTF Regenerate Thumbnails</a>', '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">Regenerate Thumbnails</a>' ),
 
 
 
548
  'type' => 'thumbsizes',
549
  'default' => 'tptn_thumbnail',
550
  'options' => tptn_get_all_image_sizes(),
344
  'type' => 'checkbox',
345
  'options' => false,
346
  ),
347
+ 'exclude_current_post' => array(
348
+ 'id' => 'exclude_current_post',
349
+ 'name' => esc_html__( 'Exclude current post', 'top-10' ),
350
+ 'desc' => esc_html__( 'Enabling this will exclude the current post being browsed from being displayed in the popular posts list.', 'top-10' ),
351
+ 'type' => 'checkbox',
352
+ 'options' => false,
353
+ ),
354
  'exclude_post_ids' => array(
355
  'id' => 'exclude_post_ids',
356
  'name' => esc_html__( 'Post/page IDs to exclude', 'top-10' ),
378
  'options' => '',
379
  'readonly' => true,
380
  ),
381
+ 'exclude_on_cat_slugs' => array(
382
+ 'id' => 'exclude_on_cat_slugs',
383
+ 'name' => esc_html__( 'Exclude on Categories', 'top-10' ),
384
+ 'desc' => esc_html__( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options. Does not support custom taxonomies.', 'top-10' ),
385
+ 'type' => 'csv',
386
+ 'options' => '',
387
+ 'size' => 'large',
388
+ 'field_class' => 'category_autocomplete',
389
+ 'field_attributes' => array(
390
+ 'data-wp-taxonomy' => 'category',
391
+ ),
392
+ ),
393
  'customize_output_header' => array(
394
  'id' => 'customize_output_header',
395
  'name' => '<h3>' . esc_html__( 'Customize the output', 'top-10' ) . '</h3>',
562
  'thumb_size' => array(
563
  'id' => 'thumb_size',
564
  'name' => esc_html__( 'Thumbnail size', 'top-10' ),
565
+ 'desc' => esc_html__( 'You can choose from existing image sizes above or create a custom size. If you have chosen Custom size above, then enter the width, height and crop settings below. For best results, use a cropped image. If you change the width and/or height below, existing images will not be automatically resized.' ) . '<br />' . sprintf(
566
+ /* translators: 1: Force regenerate plugin link. */
567
+ esc_html__( 'I recommend using %1$s to regenerate all image sizes.', 'top-10' ),
568
+ '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=regenerate-thumbnails&amp;TB_iframe=true&amp;width=600&amp;height=550' ) ) . '" class="thickbox">Regenerate Thumbnails</a>'
569
+ ),
570
  'type' => 'thumbsizes',
571
  'default' => 'tptn_thumbnail',
572
  'options' => tptn_get_all_image_sizes(),
includes/admin/import-export.php CHANGED
@@ -25,13 +25,17 @@ if ( ! defined( 'WPINC' ) ) {
25
  function tptn_exim_page() {
26
 
27
  /* Message for successful file import */
28
- if ( isset( $_GET['file_import'] ) && 'success' === $_GET['file_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
29
- add_settings_error( 'tptn-notices', '', esc_html__( 'Data has been imported into the table', 'top-10' ), 'updated' );
 
 
 
 
30
  }
31
 
32
  /* Message for successful file import */
33
  if ( isset( $_GET['settings_import'] ) && 'success' === $_GET['settings_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
34
- add_settings_error( 'tptn-notices', '', esc_html__( 'Settings have been imported successfully', 'top-10' ), 'updated' );
35
  }
36
 
37
  ob_start();
@@ -62,7 +66,7 @@ function tptn_exim_page() {
62
  <form method="post" enctype="multipart/form-data">
63
 
64
  <p class="description">
65
- <?php esc_html_e( 'Import the plugin settings from a .json file. This file can be obtained by exporting the settings on another site using the form above.', 'top-10' ); ?>
66
  </p>
67
  <p>
68
  <input type="file" name="import_settings_file" />
@@ -95,7 +99,9 @@ function tptn_exim_page() {
95
 
96
  <h2 style="padding-left:0px"><?php esc_html_e( 'Import tables', 'top-10' ); ?></h2>
97
  <p class="description">
98
- <?php esc_html_e( 'This action will replace the data in your tables, so I suggest that you export the existing data using the buttons above, amend it and then import it. It is important to maintain the export format of the data to avoid corruption.', 'top-10' ); ?>
 
 
99
  </p>
100
  <p class="description">
101
  <strong><?php esc_html_e( 'Backup your database before proceeding so you will be able to restore it in case anything goes wrong.', 'top-10' ); ?></strong>
@@ -244,9 +250,11 @@ function tptn_import_tables() {
244
  }
245
 
246
  if ( isset( $_POST['tptn_import_total'] ) ) {
247
- $daily = false;
 
248
  } elseif ( isset( $_POST['tptn_import_daily'] ) ) {
249
- $daily = true;
 
250
  } else {
251
  return;
252
  }
@@ -270,8 +278,8 @@ function tptn_import_tables() {
270
  wp_die( esc_html__( 'Please upload a file to import', 'top-10' ) );
271
  }
272
 
273
- // Truncate the table before import.
274
- tptn_trunc_count( $daily );
275
 
276
  // Open uploaded CSV file with read-only mode.
277
  $csv_file = fopen( $import_file, 'r' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
@@ -281,24 +289,40 @@ function tptn_import_tables() {
281
 
282
  while ( ( $line = fgetcsv( $csv_file, 100, ',' ) ) !== false ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
283
 
 
 
 
 
 
284
  if ( $daily ) {
285
- $dp_date = str_replace( '/', '-', $line[2] );
286
- $dp_date = gmdate( 'Y-m-d H', strtotime( $dp_date ) );
287
 
288
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, dp_date, blog_id) VALUES( %d, %d, %s, %d ) ", $line[0], $line[1], $dp_date, $line[3] ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
289
  } else {
290
- $wpdb->query( $wpdb->prepare( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES( %d, %d, %d ) ", $line[0], $line[1], $line[2] ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
291
  }
292
  }
293
 
294
  // Close file.
295
  fclose( $csv_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
296
 
 
 
 
 
 
 
 
 
 
 
 
297
  wp_safe_redirect(
298
  add_query_arg(
299
  array(
300
  'page' => 'tptn_exim_page',
301
- 'file_import' => 'success',
302
  ),
303
  admin_url( 'admin.php' )
304
  )
25
  function tptn_exim_page() {
26
 
27
  /* Message for successful file import */
28
+ if ( isset( $_GET['file_import'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
29
+ if ( 'success' === $_GET['file_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
30
+ add_settings_error( 'tptn-notices', '', esc_html__( 'Data has been imported into the table', 'top-10' ), 'success' );
31
+ } elseif ( 'fail' === $_GET['file_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
32
+ add_settings_error( 'tptn-notices', '', esc_html__( 'Data import failure. Check the number of columns for the file being imported and if you are uploading it in the right section below', 'top-10' ), 'error' );
33
+ }
34
  }
35
 
36
  /* Message for successful file import */
37
  if ( isset( $_GET['settings_import'] ) && 'success' === $_GET['settings_import'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
38
+ add_settings_error( 'tptn-notices', '', esc_html__( 'Settings have been imported successfully', 'top-10' ), 'success' );
39
  }
40
 
41
  ob_start();
66
  <form method="post" enctype="multipart/form-data">
67
 
68
  <p class="description">
69
+ <?php esc_html_e( 'Import the plugin settings from a .json file. This file can be obtained by exporting the settings on this/another site using the form above.', 'top-10' ); ?>
70
  </p>
71
  <p>
72
  <input type="file" name="import_settings_file" />
99
 
100
  <h2 style="padding-left:0px"><?php esc_html_e( 'Import tables', 'top-10' ); ?></h2>
101
  <p class="description">
102
+ <?php esc_html_e( 'This action will replace the data in the table being import. Best practice would be to first export the data using the buttons above. Following this, update the file with the new data and then import it. It is important to maintain the export format of the data to avoid corruption.', 'top-10' ); ?>
103
+ <br />
104
+ <?php esc_html_e( 'Be careful when opening the file in Excel as it tends to change the date format. Recommended date-time format is YYYY-MM-DD H.', 'top-10' ); ?>
105
  </p>
106
  <p class="description">
107
  <strong><?php esc_html_e( 'Backup your database before proceeding so you will be able to restore it in case anything goes wrong.', 'top-10' ); ?></strong>
250
  }
251
 
252
  if ( isset( $_POST['tptn_import_total'] ) ) {
253
+ $daily = false;
254
+ $column_count = 3;
255
  } elseif ( isset( $_POST['tptn_import_daily'] ) ) {
256
+ $daily = true;
257
+ $column_count = 4;
258
  } else {
259
  return;
260
  }
278
  wp_die( esc_html__( 'Please upload a file to import', 'top-10' ) );
279
  }
280
 
281
+ $data = array();
282
+ $file_import = 'success';
283
 
284
  // Open uploaded CSV file with read-only mode.
285
  $csv_file = fopen( $import_file, 'r' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fopen
289
 
290
  while ( ( $line = fgetcsv( $csv_file, 100, ',' ) ) !== false ) { // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
291
 
292
+ if ( count( $line ) !== $column_count ) {
293
+ $file_import = 'fail';
294
+ break;
295
+ }
296
+
297
  if ( $daily ) {
298
+ $dp_date = new DateTime( $line[2] );
299
+ $dp_date = $dp_date->format( 'Y-m-d H' );
300
 
301
+ $data[] = $wpdb->prepare( '( %d, %d, %s, %d )', $line[0], $line[1], $dp_date, $line[3] );
302
  } else {
303
+ $data[] = $wpdb->prepare( '( %d, %d, %d )', $line[0], $line[1], $line[2] );
304
  }
305
  }
306
 
307
  // Close file.
308
  fclose( $csv_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
309
 
310
+ if ( ! empty( $data ) ) {
311
+ // Truncate the table before import.
312
+ tptn_trunc_count( $daily );
313
+
314
+ if ( $daily ) {
315
+ $wpdb->query( "INSERT INTO {$table_name} (postnumber, cntaccess, dp_date, blog_id) VALUES " . implode( ',', $data ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQL.NotPrepared
316
+ } else {
317
+ $wpdb->query( "INSERT INTO {$table_name} (postnumber, cntaccess, blog_id) VALUES " . implode( ',', $data ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQL.NotPrepared
318
+ }
319
+ }
320
+
321
  wp_safe_redirect(
322
  add_query_arg(
323
  array(
324
  'page' => 'tptn_exim_page',
325
+ 'file_import' => $file_import,
326
  ),
327
  admin_url( 'admin.php' )
328
  )
includes/admin/js/chart-data.js CHANGED
@@ -1,4 +1,4 @@
1
- // Function to clear the cache.
2
  function updateChart() {
3
  jQuery.post(ajaxurl, {
4
  action: 'tptn_chart_data',
1
+ // Function to update the chart.
2
  function updateChart() {
3
  jQuery.post(ajaxurl, {
4
  action: 'tptn_chart_data',
includes/admin/js/chart.min.js CHANGED
@@ -1,13 +1,13 @@
1
  /*!
2
- * Chart.js v3.1.0
3
  * https://www.chartjs.org
4
- * (c) 2021 Chart.js Contributors
5
  * Released under the MIT License
6
  */
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";const t="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function e(e,i,n){const o=n||(t=>Array.prototype.slice.call(t));let s=!1,a=[];return function(...n){a=o(n),s||(s=!0,t.call(window,(()=>{s=!1,e.apply(i,a)})))}}function i(t,e){let i;return function(){return e?(clearTimeout(i),i=setTimeout(t,e)):t(),e}}const n=t=>"start"===t?"left":"end"===t?"right":"center",o=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,s=(t,e,i)=>"right"===t?i:"center"===t?(e+i)/2:e;var a=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){const e=this;e._request||(e._running=!0,e._request=t.call(window,(()=>{e._update(),e._request=null,e._running&&e._refresh()})))}_update(t=Date.now()){const e=this;let i=0;e._charts.forEach(((n,o)=>{if(!n.running||!n.items.length)return;const s=n.items;let a,r=s.length-1,l=!1;for(;r>=0;--r)a=s[r],a._active?(a._total>n.duration&&(n.duration=a._total),a.tick(t),l=!0):(s[r]=s[s.length-1],s.pop());l&&(o.draw(),e._notify(o,n,t,"progress")),s.length||(n.running=!1,e._notify(o,n,t,"complete")),i+=s.length})),e._lastDate=t,0===i&&(e._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};
8
  /*!
9
  * @kurkle/color v0.1.9
10
  * https://github.com/kurkle/color#readme
11
  * (c) 2020 Jukka Kurkela
12
  * Released under the MIT License
13
- */const r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},l="0123456789ABCDEF",c=t=>l[15&t],h=t=>l[(240&t)>>4]+l[15&t],d=t=>(240&t)>>4==(15&t);function u(t){var e=function(t){return d(t.r)&&d(t.g)&&d(t.b)&&d(t.a)}(t)?c:h;return t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t}function f(t){return t+.5|0}const g=(t,e,i)=>Math.max(Math.min(t,i),e);function p(t){return g(f(2.55*t),0,255)}function m(t){return g(f(255*t),0,255)}function x(t){return g(f(t/2.55)/100,0,1)}function b(t){return g(f(100*t),0,100)}const _=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const y=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function v(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function w(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function M(t,e,i){const n=v(t,1,.5);let o;for(e+i>1&&(o=1/(e+i),e*=o,i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function k(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),a=(o+s)/2;let r,l,c;return o!==s&&(c=o-s,l=a>.5?c/(2-o-s):c/(o+s),r=o===e?(i-n)/c+(i<n?6:0):o===i?(n-e)/c+2:(e-i)/c+4,r=60*r+.5),[0|r,l||0,a]}function S(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(m)}function P(t,e,i){return S(v,t,e,i)}function D(t){return(t%360+360)%360}function C(t){const e=y.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?p(+e[5]):m(+e[5]));const o=D(+e[2]),s=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return S(M,t,e,i)}(o,s,a):"hsv"===e[1]?function(t,e,i){return S(w,t,e,i)}(o,s,a):P(o,s,a),{r:i[0],g:i[1],b:i[2],a:n}}const O={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},A={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let T;function R(t){T||(T=function(){const t={},e=Object.keys(A),i=Object.keys(O);let n,o,s,a,r;for(n=0;n<e.length;n++){for(a=r=e[n],o=0;o<i.length;o++)s=i[o],r=r.replace(s,O[s]);s=parseInt(A[a],16),t[r]=[s>>16&255,s>>8&255,255&s]}return t}(),T.transparent=[0,0,0,0]);const e=T[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}function L(t,e,i){if(t){let n=k(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=P(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function E(t,e){return t?Object.assign(e||{},t):t}function I(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=m(t[3]))):(e=E(t,{r:0,g:0,b:0,a:1})).a=m(e.a),e}function F(t){return"r"===t.charAt(0)?function(t){const e=_.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=255&(e[8]?p(t):255*t)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?p(i):i),n=255&(e[4]?p(n):n),o=255&(e[6]?p(o):o),{r:i,g:n,b:o,a:s}}}(t):C(t)}class z{constructor(t){if(t instanceof z)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=I(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*r[n[1]],g:255&17*r[n[2]],b:255&17*r[n[3]],a:5===s?17*r[n[4]]:255}:7!==s&&9!==s||(o={r:r[n[1]]<<4|r[n[2]],g:r[n[3]]<<4|r[n[4]],b:r[n[5]]<<4|r[n[6]],a:9===s?r[n[7]]<<4|r[n[8]]:255})),i=o||R(t)||F(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=E(this._rgb);return t&&(t.a=x(t.a)),t}set rgb(t){this._rgb=I(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${x(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?u(this._rgb):this._rgb}hslString(){return this._valid?function(t){if(!t)return;const e=k(t),i=e[0],n=b(e[1]),o=b(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${x(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):this._rgb}mix(t,e){const i=this;if(t){const n=i.rgb,o=t.rgb;let s;const a=e===s?.5:e,r=2*a-1,l=n.a-o.a,c=((r*l==-1?r:(r+l)/(1+r*l))+1)/2;s=1-c,n.r=255&c*n.r+s*o.r+.5,n.g=255&c*n.g+s*o.g+.5,n.b=255&c*n.b+s*o.b+.5,n.a=a*n.a+(1-a)*o.a,i.rgb=n}return i}clone(){return new z(this.rgb)}alpha(t){return this._rgb.a=m(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=f(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return L(this._rgb,2,t),this}darken(t){return L(this._rgb,2,-t),this}saturate(t){return L(this._rgb,1,t),this}desaturate(t){return L(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=k(t);i[0]=D(i[0]+e),i=P(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function V(t){return new z(t)}const B=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function W(t){return B(t)?t:V(t)}function N(t){return B(t)?t:V(t).saturate(.5).darken(.1).hexString()}function H(){}const j=function(){let t=0;return function(){return t++}}();function $(t){return null==t}function Y(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.substr(0,7)&&"Array]"===e.substr(-6)}function U(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const X=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function q(t,e){return X(t)?t:e}function K(t,e){return void 0===t?e:t}const G=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,Z=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function Q(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function J(t,e,i,n){let o,s,a;if(Y(t))if(s=t.length,n)for(o=s-1;o>=0;o--)e.call(i,t[o],o);else for(o=0;o<s;o++)e.call(i,t[o],o);else if(U(t))for(a=Object.keys(t),s=a.length,o=0;o<s;o++)e.call(i,t[a[o]],a[o])}function tt(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function et(t){if(Y(t))return t.map(et);if(U(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=et(t[i[o]]);return e}return t}function it(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function nt(t,e,i,n){if(!it(t))return;const o=e[t],s=i[t];U(o)&&U(s)?ot(o,s,n):e[t]=et(s)}function ot(t,e,i){const n=Y(e)?e:[e],o=n.length;if(!U(t))return t;const s=(i=i||{}).merger||nt;for(let a=0;a<o;++a){if(!U(e=n[a]))continue;const o=Object.keys(e);for(let n=0,a=o.length;n<a;++n)s(o[n],t,e,i)}return t}function st(t,e){return ot(t,e,{merger:at})}function at(t,e,i){if(!it(t))return;const n=e[t],o=i[t];U(n)&&U(o)?st(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=et(o))}function rt(t,e){const i=t.indexOf(".",e);return-1===i?t.length:i}function lt(t,e){if(""===e)return t;let i=0,n=rt(e,i);for(;t&&n>i;)t=t[e.substr(i,n-i)],i=n+1,n=rt(e,i);return t}function ct(t){return t.charAt(0).toUpperCase()+t.slice(1)}const ht=t=>void 0!==t,dt=t=>"function"==typeof t,ut=Object.create(null),ft=Object.create(null);function gt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function pt(t,e,i){return"string"==typeof e?ot(gt(t,e),i):ot(gt(t,""),e)}var mt=new class{constructor(t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>N(e.backgroundColor),this.hoverBorderColor=(t,e)=>N(e.borderColor),this.hoverColor=(t,e)=>N(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.describe(t)}set(t,e){return pt(this,t,e)}get(t){return gt(this,t)}describe(t,e){return pt(ft,t,e)}override(t,e){return pt(ut,t,e)}route(t,e,i,n){const o=gt(this,t),s=gt(this,i),a="_"+e;Object.defineProperties(o,{[a]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=s[n];return U(t)?Object.assign({},e,t):K(t,e)},set(t){this[a]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});const xt=Math.PI,bt=2*xt,_t=bt+xt,yt=Number.POSITIVE_INFINITY,vt=xt/180,wt=xt/2,Mt=xt/4,kt=2*xt/3,St=Math.log10,Pt=Math.sign;function Dt(t){const e=Math.pow(10,Math.floor(St(t))),i=t/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Ct(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function Ot(t){return!isNaN(parseFloat(t))&&isFinite(t)}function At(t,e,i){return Math.abs(t-e)<i}function Tt(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function Rt(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function Lt(t){return t*(xt/180)}function Et(t){return t*(180/xt)}function It(t){if(!X(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Ft(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*xt&&(s+=bt),{angle:s,distance:o}}function zt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Vt(t,e){return(t-e+_t)%bt-xt}function Bt(t){return(t%bt+bt)%bt}function Wt(t,e,i){const n=Bt(t),o=Bt(e),s=Bt(i),a=Bt(o-n),r=Bt(s-n),l=Bt(n-o),c=Bt(n-s);return n===o||n===s||a>r&&l<c}function Nt(t,e,i){return Math.max(e,Math.min(i,t))}function Ht(t){return Nt(t,-32768,32767)}function jt(t){return!t||$(t.size)||$(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function $t(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function Yt(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let a=0;const r=i.length;let l,c,h,d,u;for(l=0;l<r;l++)if(d=i[l],null!=d&&!0!==Y(d))a=$t(t,o,s,a,d);else if(Y(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||Y(u)||(a=$t(t,o,s,a,u));t.restore();const f=s.length/2;if(f>i.length){for(l=0;l<f;l++)delete o[s[l]];s.splice(0,f)}return a}function Ut(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function Xt(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function qt(t,e,i,n){let o,s,a,r,l;const c=e.pointStyle,h=e.rotation,d=e.radius;let u=(h||0)*vt;if(c&&"object"==typeof c&&(o=c.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return t.save(),t.translate(i,n),t.rotate(u),t.drawImage(c,-c.width/2,-c.height/2,c.width,c.height),void t.restore();if(!(isNaN(d)||d<=0)){switch(t.beginPath(),c){default:t.arc(i,n,d,0,bt),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,n-Math.cos(u)*d),u+=kt,t.lineTo(i+Math.sin(u)*d,n-Math.cos(u)*d),u+=kt,t.lineTo(i+Math.sin(u)*d,n-Math.cos(u)*d),t.closePath();break;case"rectRounded":l=.516*d,r=d-l,s=Math.cos(u+Mt)*r,a=Math.sin(u+Mt)*r,t.arc(i-s,n-a,l,u-xt,u-wt),t.arc(i+a,n-s,l,u-wt,u),t.arc(i+s,n+a,l,u,u+wt),t.arc(i-a,n+s,l,u+wt,u+xt),t.closePath();break;case"rect":if(!h){r=Math.SQRT1_2*d,t.rect(i-r,n-r,2*r,2*r);break}u+=Mt;case"rectRot":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+a,n-s),t.lineTo(i+s,n+a),t.lineTo(i-a,n+s),t.closePath();break;case"crossRot":u+=Mt;case"cross":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a),t.moveTo(i+a,n-s),t.lineTo(i-a,n+s);break;case"star":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a),t.moveTo(i+a,n-s),t.lineTo(i-a,n+s),u+=Mt,s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a),t.moveTo(i+a,n-s),t.lineTo(i-a,n+s);break;case"line":s=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-s,n-a),t.lineTo(i+s,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(u)*d,n+Math.sin(u)*d)}t.fill(),e.borderWidth>0&&t.stroke()}}function Kt(t,e,i){return i=i||.5,t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Gt(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Zt(t){t.restore()}function Qt(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Jt(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function te(t,e,i,n,o,s={}){const a=Y(e)?e:[e],r=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),s.translation&&t.translate(s.translation[0],s.translation[1]),$(s.rotation)||t.rotate(s.rotation),t.font=o.string,s.color&&(t.fillStyle=s.color),s.textAlign&&(t.textAlign=s.textAlign),s.textBaseline&&(t.textBaseline=s.textBaseline),l=0;l<a.length;++l){if(c=a[l],r&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),$(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),s.strikethrough||s.underline){const e=t.measureText(c),o=i-e.actualBoundingBoxLeft,a=i+e.actualBoundingBoxRight,r=n-e.actualBoundingBoxAscent,l=n+e.actualBoundingBoxDescent,h=s.strikethrough?(r+l)/2:l;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=s.decorationWidth||2,t.moveTo(o,h),t.lineTo(a,h),t.stroke()}n+=o.lineHeight}t.restore()}function ee(t,e){const{x:i,y:n,w:o,h:s,radius:a}=e;t.arc(i+a.topLeft,n+a.topLeft,a.topLeft,-wt,xt,!0),t.lineTo(i,n+s-a.bottomLeft),t.arc(i+a.bottomLeft,n+s-a.bottomLeft,a.bottomLeft,xt,wt,!0),t.lineTo(i+o-a.bottomRight,n+s),t.arc(i+o-a.bottomRight,n+s-a.bottomRight,a.bottomRight,wt,0,!0),t.lineTo(i+o,n+a.topRight),t.arc(i+o-a.topRight,n+a.topRight,a.topRight,0,-wt,!0),t.lineTo(i+a.topLeft,n)}function ie(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const ne=(t,e,i)=>ie(t,i,(n=>t[n][e]<i)),oe=(t,e,i)=>ie(t,i,(n=>t[n][e]>=i));function se(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}const ae=["push","pop","shift","splice","unshift"];function re(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ae.forEach((e=>{const i="_onData"+ct(e),n=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const o=n.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),o}})})))}function le(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(ae.forEach((e=>{delete t[e]})),delete t._chartjs)}function ce(t){const e=new Set;let i,n;for(i=0,n=t.length;i<n;++i)e.add(t[i]);if(e.size===n)return t;const o=[];return e.forEach((t=>{o.push(t)})),o}function he(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function de(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const ue=t=>window.getComputedStyle(t,null);function fe(t,e){return ue(t).getPropertyValue(e)}const ge=["top","right","bottom","left"];function pe(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=ge[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function me(t,e){const{canvas:i,currentDevicePixelRatio:n}=e,o=ue(i),s="border-box"===o.boxSizing,a=pe(o,"padding"),r=pe(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.native||t,n=i.touches,o=n&&n.length?n[0]:i,{offsetX:s,offsetY:a}=o;let r,l,c=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(s,a,i.target))r=s,l=a;else{const t=e.getBoundingClientRect();r=o.clientX-t.left,l=o.clientY-t.top,c=!0}return{x:r,y:l,box:c}}(t,i),d=a.left+(h&&r.left),u=a.top+(h&&r.top);let{width:f,height:g}=e;return s&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/n),y:Math.round((c-u)/g*i.height/n)}}const xe=t=>Math.round(10*t)/10;function be(t,e,i,n){const o=ue(t),s=pe(o,"margin"),a=de(o.maxWidth,t,"clientWidth")||yt,r=de(o.maxHeight,t,"clientHeight")||yt,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=he(t);if(s){const t=s.getBoundingClientRect(),a=ue(s),r=pe(a,"border","width"),l=pe(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,n=de(a.maxWidth,s,"clientWidth"),o=de(a.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||yt,maxHeight:o||yt}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=pe(o,"border","width"),e=pe(o,"padding");c-=e.width+t.width,h-=e.height+t.height}return c=Math.max(0,c-s.width),h=Math.max(0,n?Math.floor(c/n):h-s.height),c=xe(Math.min(c,a,l.maxWidth)),h=xe(Math.min(h,r,l.maxHeight)),c&&!h&&(h=xe(c/2)),{width:c,height:h}}function _e(t,e,i){const n=t.currentDevicePixelRatio=e||1,{canvas:o,width:s,height:a}=t;o.height=a*n,o.width=s*n,t.ctx.setTransform(n,0,0,n,0,0),o.style&&(i||!o.style.height&&!o.style.width)&&(o.style.height=a+"px",o.style.width=s+"px")}const ye=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function ve(t,e){const i=fe(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function we(t,e){return"native"in t?{x:t.x,y:t.y}:me(t,e)}function Me(t,e,i,n){const{controller:o,data:s,_sorted:a}=t,r=o._cachedMeta.iScale;if(r&&e===r.axis&&a&&s.length){const t=r._reversePixels?oe:ne;if(!n)return t(s,e,i);if(o._sharedOptions){const n=s[0],o="function"==typeof n.getRange&&n.getRange(e);if(o){const n=t(s,e,i-o),a=t(s,e,i+o);return{lo:n.lo,hi:a.hi}}}}return{lo:0,hi:s.length-1}}function ke(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:r}=s[t],{lo:l,hi:c}=Me(s[t],e,a,o);for(let t=l;t<=c;++t){const e=r[t];e.skip||n(e,i,t)}}}function Se(t,e,i,n){const o=[];if(!Kt(e,t.chartArea,t._minPadding))return o;return ke(t,i,e,(function(t,i,s){t.inRange(e.x,e.y,n)&&o.push({element:t,datasetIndex:i,index:s})}),!0),o}function Pe(t,e,i,n,o){const s=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let a=Number.POSITIVE_INFINITY,r=[];if(!Kt(e,t.chartArea,t._minPadding))return r;return ke(t,i,e,(function(t,i,l){if(n&&!t.inRange(e.x,e.y,o))return;const c=t.getCenterPoint(o),h=s(e,c);h<a?(r=[{element:t,datasetIndex:i,index:l}],a=h):h===a&&r.push({element:t,datasetIndex:i,index:l})})),r}function De(t,e,i,n){const o=we(e,t),s=[],a=i.axis,r="x"===a?"inXRange":"inYRange";let l=!1;return function(t,e){const i=t.getSortedVisibleDatasetMetas();let n,o,s;for(let t=0,a=i.length;t<a;++t){({index:n,data:o}=i[t]);for(let t=0,i=o.length;t<i;++t)s=o[t],s.skip||e(s,n,t)}}(t,((t,e,i)=>{t[r](o[a],n)&&s.push({element:t,datasetIndex:e,index:i}),t.inRange(o.x,o.y,n)&&(l=!0)})),i.intersect&&!l?[]:s}var Ce={modes:{index(t,e,i,n){const o=we(e,t),s=i.axis||"x",a=i.intersect?Se(t,o,s,n):Pe(t,o,s,!1,n),r=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&r.push({element:i,datasetIndex:t.index,index:e})})),r):[]},dataset(t,e,i,n){const o=we(e,t),s=i.axis||"xy";let a=i.intersect?Se(t,o,s,n):Pe(t,o,s,!1,n);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>Se(t,we(e,t),i.axis||"xy",n),nearest:(t,e,i,n)=>Pe(t,we(e,t),i.axis||"xy",i.intersect,n),x:(t,e,i,n)=>(i.axis="x",De(t,e,i,n)),y:(t,e,i,n)=>(i.axis="y",De(t,e,i,n))}};const Oe=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),Ae=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function Te(t,e){const i=(""+t).match(Oe);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function Re(t,e){const i={},n=U(e),o=n?Object.keys(e):e,s=U(t)?n?i=>K(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=+s(t)||0;return i}function Le(t){return Re(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Ee(t){return Re(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Ie(t){const e=Le(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Fe(t,e){t=t||{},e=e||mt.font;let i=K(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=K(t.style,e.style);n&&!(""+n).match(Ae)&&(console.warn('Invalid font style specified: "'+n+'"'),n="");const o={family:K(t.family,e.family),lineHeight:Te(K(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:K(t.weight,e.weight),string:""};return o.string=jt(o),o}function ze(t,e,i,n){let o,s,a,r=!0;for(o=0,s=t.length;o<s;++o)if(a=t[o],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),r=!1),void 0!==i&&Y(a)&&(a=a[i%a.length],r=!1),void 0!==a))return n&&!r&&(n.cacheable=!1),a}function Ve(t,e){const{min:i,max:n}=t;return{min:i-Math.abs(Z(e,i)),max:n+Z(e,n)}}const Be=["left","top","right","bottom"];function We(t,e){return t.filter((t=>t.pos===e))}function Ne(t,e){return t.filter((t=>-1===Be.indexOf(t.pos)&&t.box.axis===e))}function He(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function je(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function $e(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ye(t,e,i){const n=i.box,o=t.maxPadding;U(i.pos)||(i.size&&(t[i.pos]-=i.size),i.size=i.horizontal?n.height:n.width,t[i.pos]+=i.size),n.getPadding&&$e(o,n.getPadding());const s=Math.max(0,e.outerWidth-je(o,t,"left","right")),a=Math.max(0,e.outerHeight-je(o,t,"top","bottom")),r=s!==t.w,l=a!==t.h;return t.w=s,t.h=a,i.horizontal?{same:r,other:l}:{same:l,other:r}}function Ue(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function Xe(t,e,i){const n=[];let o,s,a,r,l,c;for(o=0,s=t.length,l=0;o<s;++o){a=t[o],r=a.box,r.update(a.width||e.w,a.height||e.h,Ue(a.horizontal,e));const{same:s,other:h}=Ye(e,i,a);l|=s&&n.length,c=c||h,r.fullSize||n.push(a)}return l&&Xe(n,e,i)||c}function qe(t,e,i){const n=i.padding;let o,s,a,r,l=e.x,c=e.y;for(o=0,s=t.length;o<s;++o)a=t[o],r=a.box,a.horizontal?(r.left=r.fullSize?n.left:e.left,r.right=r.fullSize?i.outerWidth-n.right:e.left+e.w,r.top=c,r.bottom=c+r.height,r.width=r.right-r.left,c=r.bottom):(r.left=l,r.right=l+r.width,r.top=r.fullSize?n.top:e.top,r.bottom=r.fullSize?i.outerHeight-n.right:e.top+e.h,r.height=r.bottom-r.top,l=r.right);e.x=l,e.y=c}mt.set("layout",{padding:{top:0,right:0,bottom:0,left:0}});var Ke={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=Ie(t.options.layout.padding),s=e-o.width,a=i-o.height,r=function(t){const e=function(t){const e=[];let i,n,o;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],e.push({index:i,box:o,pos:o.position,horizontal:o.isHorizontal(),weight:o.weight});return e}(t),i=He(e.filter((t=>t.box.fullSize)),!0),n=He(We(e,"left"),!0),o=He(We(e,"right")),s=He(We(e,"top"),!0),a=He(We(e,"bottom")),r=Ne(e,"x"),l=Ne(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(a).concat(r),chartArea:We(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(a).concat(r)}}(t.boxes),l=r.vertical,c=r.horizontal;J(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:a,vBoxMaxWidth:s/2/h,hBoxMaxHeight:a/2}),u=Object.assign({},o);$e(u,Ie(n));const f=Object.assign({maxPadding:u,w:s,h:a,x:o.left,y:o.top},o);!function(t,e){let i,n,o;for(i=0,n=t.length;i<n;++i)o=t[i],o.horizontal?(o.width=o.box.fullSize&&e.availableWidth,o.height=e.hBoxMaxHeight):(o.width=e.vBoxMaxWidth,o.height=o.box.fullSize&&e.availableHeight)}(l.concat(c),d),Xe(r.fullSize,f,d),Xe(l,f,d),Xe(c,f,d)&&Xe(l,f,d),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(f),qe(r.leftAndTop,f,d),f.x+=f.w,f.y+=f.h,qe(r.rightAndBottom,f,d),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},J(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h)}))}};class Ge{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}}class Ze extends Ge{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}}const Qe={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Je=t=>null===t||""===t;const ti=!!ye&&{passive:!0};function ei(t,e,i){t.canvas.removeEventListener(e,i,ti)}function ii(t,e,i){const n=t.canvas,o=n&&he(n)||n,s=new MutationObserver((t=>{const e=he(o);t.forEach((t=>{for(let n=0;n<t.addedNodes.length;n++){const s=t.addedNodes[n];s!==o&&s!==e||i(t.target)}}))}));return s.observe(document,{childList:!0,subtree:!0}),s}function ni(t,e,i){const n=t.canvas,o=n&&he(n);if(!o)return;const s=new MutationObserver((t=>{t.forEach((t=>{for(let e=0;e<t.removedNodes.length;e++)if(t.removedNodes[e]===n){i();break}}))}));return s.observe(o,{childList:!0}),s}const oi=new Map;let si=0;function ai(){const t=window.devicePixelRatio;t!==si&&(si=t,oi.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ri(t,i,n){const o=t.canvas,s=o&&he(o);if(!s)return;const a=e(((t,e)=>{const i=s.clientWidth;n(t,e),i<s.clientWidth&&n()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||a(i,n)}));return r.observe(s),function(t,e){oi.size||window.addEventListener("resize",ai),oi.set(t,e)}(t,a),r}function li(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){oi.delete(t),oi.size||window.removeEventListener("resize",ai)}(t)}function ci(t,i,n){const o=t.canvas,s=e((e=>{null!==t.ctx&&n(function(t,e){const i=Qe[t.type]||t.type,{x:n,y:o}=me(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,ti)}(o,i,s),s}class hi extends Ge{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t.$chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Je(o)){const e=ve(t,"width");void 0!==e&&(t.width=e)}if(Je(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=ve(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const i=e.$chartjs.initial;["height","width"].forEach((t=>{const n=i[t];$(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:ii,detach:ni,resize:ri}[e]||ci;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:li,detach:li,resize:li}[e]||ei)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return be(t,e,i,n)}isAttached(t){const e=he(t);return!(!e||!he(e))}}var di=Object.freeze({__proto__:null,BasePlatform:Ge,BasicPlatform:Ze,DomPlatform:hi});const ui=t=>0===t||1===t,fi=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*bt/i),gi=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*bt/i)+1,pi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*wt),easeOutSine:t=>Math.sin(t*wt),easeInOutSine:t=>-.5*(Math.cos(xt*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ui(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ui(t)?t:fi(t,.075,.3),easeOutElastic:t=>ui(t)?t:gi(t,.075,.3),easeInOutElastic(t){const e=.1125;return ui(t)?t:t<.5?.5*fi(2*t,e,.45):.5+.5*gi(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-pi.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*pi.easeInBounce(2*t):.5*pi.easeOutBounce(2*t-1)+.5},mi="transparent",xi={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=W(t||mi),o=n.valid&&W(e||mi);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class bi{constructor(t,e,i,n){const o=e[i];n=ze([t.to,n,o,t.from]);const s=ze([t.from,o,n]);this._active=!0,this._fn=t.fn||xi[t.type||typeof s],this._easing=pi[t.easing]||pi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){const n=this;if(n._active){n._notify(!1);const o=n._target[n._prop],s=i-n._start,a=n._duration-s;n._start=i,n._duration=Math.floor(Math.max(a,t.duration)),n._total+=s,n._loop=!!t.loop,n._to=ze([t.to,e,o,t.from]),n._from=ze([t.from,o,e])}}cancel(){const t=this;t._active&&(t.tick(Date.now()),t._active=!1,t._notify(!1))}tick(t){const e=this,i=t-e._start,n=e._duration,o=e._prop,s=e._from,a=e._loop,r=e._to;let l;if(e._active=s!==r&&(a||i<n),!e._active)return e._target[o]=r,void e._notify(!0);i<0?e._target[o]=s:(l=i/n%2,l=a&&l>1?2-l:l,l=e._easing(Math.min(1,Math.max(0,l))),e._target[o]=e._fn(s,r,l))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}mt.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const _i=Object.keys(mt.animation);mt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),mt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),mt.describe("animations",{_fallback:"animation"}),mt.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class yi{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!U(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const n=t[i];if(!U(n))return;const o={};for(const t of _i)o[t]=n[t];(Y(n.properties)&&n.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,o)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),a=Date.now();let r;for(r=s.length-1;r>=0;--r){const l=s[r];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,a);continue}h.cancel()}d&&d.duration?(o[l]=h=new bi(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(a.add(this._chart,i),!0):void 0}}function vi(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function wi(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function Mi(t,e,i,n){const o=t.keys,s="single"===n.mode;let a,r,l,c;if(null!==e){for(a=0,r=o.length;a<r;++a){if(l=+o[a],l===i){if(n.all)continue;break}c=t.values[l],X(c)&&(s||0===e||Pt(e)===Pt(c))&&(e+=c)}return e}}function ki(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Si(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Pi(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:a,index:r}=n,l=s.axis,c=a.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,a,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:n,[c]:s}=i;u=(i._stacks||(i._stacks={}))[c]=Si(o,h,n),u[r]=s}}function Di(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Ci(t,e){e=e||t._parsed;for(const i of e){const e=i._stacks;if(!e||void 0===e[t.vScale.id]||void 0===e[t.vScale.id][t.index])return;delete e[t.vScale.id][t.index]}}const Oi=t=>"reset"===t||"none"===t,Ai=(t,e)=>e?t:Object.assign({},t);class Ti{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.$context=void 0,this.initialize()}initialize(){const t=this,e=t._cachedMeta;t.configure(),t.linkScales(),e._stacked=ki(e.vScale,e),t.addElements()}updateIndex(t){this.index=t}linkScales(){const t=this,e=t.chart,i=t._cachedMeta,n=t.getDataset(),o=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,s=i.xAxisID=K(n.xAxisID,Di(e,"x")),a=i.yAxisID=K(n.yAxisID,Di(e,"y")),r=i.rAxisID=K(n.rAxisID,Di(e,"r")),l=i.indexAxis,c=i.iAxisID=o(l,s,a,r),h=i.vAxisID=o(l,a,s,r);i.xScale=t.getScaleForId(s),i.yScale=t.getScaleForId(a),i.rScale=t.getScaleForId(r),i.iScale=t.getScaleForId(c),i.vScale=t.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&le(this._data,this),t._stacked&&Ci(t)}_dataCheck(){const t=this,e=t.getDataset(),i=e.data||(e.data=[]);U(i)?t._data=function(t){const e=Object.keys(t),i=new Array(e.length);let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n],i[n]={x:s,y:t[s]};return i}(i):t._data!==i&&(t._data&&(le(t._data,t),Ci(t._cachedMeta)),i&&Object.isExtensible(i)&&re(i,t),t._data=i)}addElements(){const t=this,e=t._cachedMeta;t._dataCheck(),t.datasetElementType&&(e.dataset=new t.datasetElementType)}buildOrUpdateElements(t){const e=this,i=e._cachedMeta,n=e.getDataset();let o=!1;e._dataCheck(),i._stacked=ki(i.vScale,i),i.stack!==n.stack&&(o=!0,Ci(i),i.stack=n.stack),e._resyncElements(t),o&&Pi(e,i._parsed)}configure(){const t=this,e=t.chart.config,i=e.datasetScopeKeys(t._type),n=e.getOptionScopes(t.getDataset(),i,!0);t.options=e.createResolver(n,t.getContext()),t._parsing=t.options.parsing}parse(t,e){const i=this,{_cachedMeta:n,_data:o}=i,{iScale:s,_stacked:a}=n,r=s.axis;let l,c,h,d=0===t&&e===o.length||n._sorted,u=t>0&&n._parsed[t-1];if(!1===i._parsing)n._parsed=o,n._sorted=!0;else{h=Y(o[t])?i.parseArrayData(n,o,t,e):U(o[t])?i.parseObjectData(n,o,t,e):i.parsePrimitiveData(n,o,t,e);const s=()=>null===c[r]||u&&c[r]<u[r];for(l=0;l<e;++l)n._parsed[l+t]=c=h[l],d&&(s()&&(d=!1),u=c);n._sorted=d}a&&Pi(i,h)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,a=o.axis,r=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,f;for(d=0,u=n;d<u;++d)f=d+i,h[d]={[a]:c||o.parse(l[f],f),[r]:s.parse(e[f],f)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,a=new Array(n);let r,l,c,h;for(r=0,l=n;r<l;++r)c=r+i,h=e[c],a[r]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return a}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(lt(u,a),d),y:s.parse(lt(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return Mi({keys:wi(n,!0),values:e._stacks[t.axis]},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const a=n&&i._stacks[e.axis];n&&a&&(n.values=a,t.min=Math.min(t.min,s),t.max=Math.max(t.max,s),s=Mi(n,o,this._cachedMeta.index,{all:!0})),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this,n=i._cachedMeta,o=n._parsed,s=n._sorted&&t===n.iScale,a=o.length,r=i._getOtherScale(t),l=e&&n._stacked&&{keys:wi(i.chart,!0),values:null},c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:d}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let u,f,g,p;function m(){return g=o[u],f=g[t.axis],p=g[r.axis],!X(f)||h>p||d<p}for(u=0;u<a&&(m()||(i.updateRangeFromParsed(c,t,g,l),!s));++u);if(s)for(u=a-1;u>=0;--u)if(!m()){i.updateRangeFromParsed(c,t,g,l);break}return c}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],X(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this,i=e._cachedMeta;e.configure(),e._cachedDataOpts={},e.update(t||"default"),i._clip=function(t){let e,i,n,o;return U(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o}}(K(e.options.clip,function(t,e,i){if(!1===i)return!1;const n=vi(t,i),o=vi(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(i.xScale,i.yScale,e.getMaxOverflow())))}update(t){}draw(){const t=this,e=t._ctx,i=t.chart,n=t._cachedMeta,o=n.data||[],s=i.chartArea,a=[],r=t._drawStart||0,l=t._drawCount||o.length-r;let c;for(n.dataset&&n.dataset.draw(e,s,r,l),c=r;c<r+l;++c){const t=o[c];t.active?a.push(t):t.draw(e,s)}for(c=0;c<a.length;++c)a[c].draw(e,s)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this,o=n.getDataset();let s;if(t>=0&&t<n._cachedMeta.data.length){const e=n._cachedMeta.data[t];s=e.$context||(e.$context=function(t,e,i){return Object.assign(Object.create(t),{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(n.getContext(),t,e)),s.parsed=n.getParsed(t),s.raw=o.data[t]}else s=n.$context||(n.$context=function(t,e){return Object.assign(Object.create(t),{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(n.chart.getContext(),n.index)),s.dataset=o;return s.active=!!e,s.mode=i,s}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n=this,o="active"===e,s=n._cachedDataOpts,a=t+"-"+e,r=s[a],l=n.enableOptionSharing&&ht(i);if(r)return Ai(r,l);const c=n.chart.config,h=c.datasetElementScopeKeys(n._type,t),d=o?[t+"Hover","hover",t,""]:[t,""],u=c.getOptionScopes(n.getDataset(),h),f=Object.keys(mt.elements[t]),g=c.resolveNamedOptions(u,f,(()=>n.getContext(i,o)),d);return g.$shared&&(g.$shared=l,s[a]=Object.freeze(Ai(g,l))),g}_resolveAnimations(t,e,i){const n=this,o=n.chart,s=n._cachedDataOpts,a="animation-"+e,r=s[a];if(r)return r;let l;if(!1!==o.options.animation){const o=n.chart.config,s=o.datasetAnimationScopeKeys(n._type,e),a=o.getOptionScopes(n.getDataset(),s);l=o.createResolver(a,n.getContext(t,i,e))}const c=new yi(o,l&&l.animations);return l&&l._cacheable&&(s[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Oi(t)||this.chart._animationsDisabled}updateElement(t,e,i,n){Oi(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Oi(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this,i=e._cachedMeta.data.length,n=e._data.length;n>i?e._insertElements(i,n-i,t):n<i&&e._removeElements(n,i-n);const o=Math.min(n,i);o&&e.parse(0,o)}_insertElements(t,e,i=!0){const n=this,o=n._cachedMeta,s=o.data,a=t+e;let r;const l=t=>{for(t.length+=e,r=t.length-1;r>=a;r--)t[r]=t[r-e]};for(l(s),r=t;r<a;++r)s[r]=new n.dataElementType;n._parsing&&l(o._parsed),n.parse(t,e),i&&n.updateElements(s,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&Ci(i,n)}i.data.splice(t,e)}_onDataPush(){const t=arguments.length;this._insertElements(this.getDataset().data.length-t,t)}_onDataPop(){this._removeElements(this._cachedMeta.data.length-1,1)}_onDataShift(){this._removeElements(0,1)}_onDataSplice(t,e){this._removeElements(t,e),this._insertElements(t,arguments.length-2)}_onDataUnshift(){this._insertElements(0,arguments.length)}}Ti.defaults={},Ti.prototype.datasetElementType=null,Ti.prototype.dataElementType=null;class Ri{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Ot(this.x)&&Ot(this.y)}getProps(t,e){const i=this,n=this.$animations;if(!e||!n)return i;const o={};return t.forEach((t=>{o[t]=n[t]&&n[t].active()?n[t]._to:i[t]})),o}}Ri.defaults={},Ri.defaultRoutes=void 0;const Li=new Map;function Ei(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=Li.get(i);return n||(n=new Intl.NumberFormat(t,e),Li.set(i,n)),n}(e,i).format(t)}const Ii={values:t=>Y(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=St(Math.abs(s)),r=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:o,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ei(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=t/Math.pow(10,Math.floor(St(t)));return 1===n||2===n||5===n?Ii.numeric.call(this,t,e,i):""}};var Fi={formatters:Ii};function zi(t,e){const i=t.options.ticks,n=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],s=o.length,a=o[0],r=o[s-1],l=[];if(s>n)return function(t,e,i,n){let o,s=0,a=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===a&&(e.push(t[o]),s++,a=i[s*n])}(e,l,o,s/n),l;const c=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=Ct(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(o,e,n);if(s>0){let t,i;const n=s>1?Math.round((r-a)/(s-1)):null;for(Vi(e,l,c,$(n)?0:a-n,a),t=0,i=s-1;t<i;t++)Vi(e,l,c,o[t],o[t+1]);return Vi(e,l,c,r,$(n)?e.length:r+n),l}return Vi(e,l,c),l}function Vi(t,e,i,n,o){const s=K(n,0),a=Math.min(K(o,t.length),t.length);let r,l,c,h=0;for(i=Math.ceil(i),o&&(r=o-n,i=r/Math.floor(r/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<a;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}mt.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Fi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near"}}),mt.route("scale.ticks","color","","color"),mt.route("scale.grid","color","","borderColor"),mt.route("scale.grid","borderColor","","borderColor"),mt.route("scale.title","color","","color"),mt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),mt.describe("scales",{_fallback:"scale"});const Bi=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Wi(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function Ni(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,a=t._endPixel,r=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,a-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-r||c>a+r)))return c}function Hi(t){return t.drawTicks?t.tickLength:0}function ji(t,e){if(!t.display)return 0;const i=Fe(t.font,e),n=Ie(t.padding);return(Y(t.text)?t.text.length:1)*i.lineHeight+n.height}function $i(t,e,i){let o=n(t);return(i&&"right"!==e||!i&&"right"===e)&&(o=(t=>"left"===t?"right":"right"===t?"left":t)(o)),o}class Yi extends Ri{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){const e=this;e.options=t.setContext(e.getContext()),e.axis=t.axis,e._userMin=e.parse(t.min),e._userMax=e.parse(t.max),e._suggestedMin=e.parse(t.suggestedMin),e._suggestedMax=e.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=q(t,Number.POSITIVE_INFINITY),e=q(e,Number.NEGATIVE_INFINITY),i=q(i,Number.POSITIVE_INFINITY),n=q(n,Number.NEGATIVE_INFINITY),{min:q(t,i),max:q(e,n),minDefined:X(t),maxDefined:X(e)}}getMinMax(t){const e=this;let i,{min:n,max:o,minDefined:s,maxDefined:a}=e.getUserBounds();if(s&&a)return{min:n,max:o};const r=e.getMatchingVisibleMetas();for(let l=0,c=r.length;l<c;++l)i=r[l].controller.getMinMax(e,t),s||(n=Math.min(n,i.min)),a||(o=Math.max(o,i.max));return{min:q(n,q(o,n)),max:q(o,q(n,o))}}getPadding(){const t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){Q(this.options.beforeUpdate,[this])}update(t,e,i){const n=this,o=n.options.ticks,s=o.sampleSize;n.beforeUpdate(),n.maxWidth=t,n.maxHeight=e,n._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),n.ticks=null,n._labelSizes=null,n._gridLineItems=null,n._labelItems=null,n.beforeSetDimensions(),n.setDimensions(),n.afterSetDimensions(),n._maxLength=n.isHorizontal()?n.width+i.left+i.right:n.height+i.top+i.bottom,n._dataLimitsCached||(n.beforeDataLimits(),n.determineDataLimits(),n.afterDataLimits(),n._dataLimitsCached=!0),n.beforeBuildTicks(),n.ticks=n.buildTicks()||[],n.afterBuildTicks();const a=s<n.ticks.length;n._convertTicksToLabels(a?Wi(n.ticks,s):n.ticks),n.configure(),n.beforeCalculateLabelRotation(),n.calculateLabelRotation(),n.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(n.ticks=zi(n,n.ticks),n._labelSizes=null),a&&n._convertTicksToLabels(n.ticks),n.beforeFit(),n.fit(),n.afterFit(),n.afterUpdate()}configure(){const t=this;let e,i,n=t.options.reverse;t.isHorizontal()?(e=t.left,i=t.right):(e=t.top,i=t.bottom,n=!n),t._startPixel=e,t._endPixel=i,t._reversePixels=n,t._length=i-e,t._alignToPixels=t.options.alignToPixels}afterUpdate(){Q(this.options.afterUpdate,[this])}beforeSetDimensions(){Q(this.options.beforeSetDimensions,[this])}setDimensions(){const t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0}afterSetDimensions(){Q(this.options.afterSetDimensions,[this])}_callHooks(t){const e=this;e.chart.notifyPlugins(t,e.getContext()),Q(e.options[t],[e])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Q(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this,i=e.options.ticks;let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n],s.label=Q(i.callback,[s.value,n,t],e)}afterTickToLabelConversion(){Q(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Q(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this,e=t.options,i=e.ticks,n=t.ticks.length,o=i.minRotation||0,s=i.maxRotation;let a,r,l,c=o;if(!t._isVisible()||!i.display||o>=s||n<=1||!t.isHorizontal())return void(t.labelRotation=o);const h=t._getLabelSizes(),d=h.widest.width,u=h.highest.height,f=Nt(t.chart.width-d,0,t.maxWidth);a=e.offset?t.maxWidth/n:f/(n-1),d+6>a&&(a=f/(n-(e.offset?.5:1)),r=t.maxHeight-Hi(e.grid)-i.padding-ji(e.title,t.chart.options.font),l=Math.sqrt(d*d+u*u),c=Et(Math.min(Math.asin(Math.min((h.highest.height+6)/a,1)),Math.asin(Math.min(r/l,1))-Math.asin(u/l))),c=Math.max(o,Math.min(s,c))),t.labelRotation=c}afterCalculateLabelRotation(){Q(this.options.afterCalculateLabelRotation,[this])}beforeFit(){Q(this.options.beforeFit,[this])}fit(){const t=this,e={width:0,height:0},{chart:i,options:{ticks:n,title:o,grid:s}}=t,a=t._isVisible(),r=t.isHorizontal();if(a){const a=ji(o,i.options.font);if(r?(e.width=t.maxWidth,e.height=Hi(s)+a):(e.height=t.maxHeight,e.width=Hi(s)+a),n.display&&t.ticks.length){const{first:i,last:o,widest:s,highest:a}=t._getLabelSizes(),l=2*n.padding,c=Lt(t.labelRotation),h=Math.cos(c),d=Math.sin(c);if(r){const i=n.mirror?0:d*s.width+h*a.height;e.height=Math.min(t.maxHeight,e.height+i+l)}else{const i=n.mirror?0:h*s.width+d*a.height;e.width=Math.min(t.maxWidth,e.width+i+l)}t._calculatePadding(i,o,d,h)}}t._handleMargins(),r?(t.width=t._length=i.width-t._margins.left-t._margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=i.height-t._margins.top-t._margins.bottom)}_calculatePadding(t,e,i,n){const o=this,{ticks:{align:s,padding:a},position:r}=o.options,l=0!==o.labelRotation,c="top"!==r&&"x"===o.axis;if(o.isHorizontal()){const r=o.getPixelForTick(0)-o.left,h=o.right-o.getPixelForTick(o.ticks.length-1);let d=0,u=0;l?c?(d=n*t.width,u=i*e.height):(d=i*t.height,u=n*e.width):"start"===s?u=e.width:"end"===s?d=t.width:(d=t.width/2,u=e.width/2),o.paddingLeft=Math.max((d-r+a)*o.width/(o.width-r),0),o.paddingRight=Math.max((u-h+a)*o.width/(o.width-h),0)}else{let i=e.height/2,n=t.height/2;"start"===s?(i=0,n=t.height):"end"===s&&(i=e.height,n=0),o.paddingTop=i+a,o.paddingBottom=n+a}}_handleMargins(){const t=this;t._margins&&(t._margins.left=Math.max(t.paddingLeft,t._margins.left),t._margins.top=Math.max(t.paddingTop,t._margins.top),t._margins.right=Math.max(t.paddingRight,t._margins.right),t._margins.bottom=Math.max(t.paddingBottom,t._margins.bottom))}afterFit(){Q(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){const e=this;e.beforeTickToLabelConversion(),e.generateTickLabels(t),e.afterTickToLabelConversion()}_getLabelSizes(){const t=this;let e=t._labelSizes;if(!e){const i=t.options.ticks.sampleSize;let n=t.ticks;i<n.length&&(n=Wi(n,i)),t._labelSizes=e=t._computeLabelSizes(n,n.length)}return e}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:n}=this,o=[],s=[];let a,r,l,c,h,d,u,f,g,p,m,x=0,b=0;for(a=0;a<e;++a){if(c=t[a].label,h=this._resolveTickFontOptions(a),i.font=d=h.string,u=n[d]=n[d]||{data:{},gc:[]},f=h.lineHeight,g=p=0,$(c)||Y(c)){if(Y(c))for(r=0,l=c.length;r<l;++r)m=c[r],$(m)||Y(m)||(g=$t(i,u.data,u.gc,g,m),p+=f)}else g=$t(i,u.data,u.gc,g,c),p=f;o.push(g),s.push(p),x=Math.max(g,x),b=Math.max(p,b)}!function(t,e){J(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(n,e);const _=o.indexOf(x),y=s.indexOf(b),v=t=>({width:o[t]||0,height:s[t]||0});return{first:v(0),last:v(e-1),widest:v(_),highest:v(y)}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){const e=this;e._reversePixels&&(t=1-t);const i=e._startPixel+t*e._length;return Ht(e._alignToPixels?Ut(e.chart,i,0):i)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this,i=e.ticks||[];if(t>=0&&t<i.length){const n=i[t];return n.$context||(n.$context=function(t,e,i){return Object.assign(Object.create(t),{tick:i,index:e,type:"tick"})}(e.getContext(),t,n))}return e.$context||(e.$context=(n=e.chart.getContext(),o=e,Object.assign(Object.create(n),{scale:o,type:"scale"})));var n,o}_tickSize(){const t=this,e=t.options.ticks,i=Lt(t.labelRotation),n=Math.abs(Math.cos(i)),o=Math.abs(Math.sin(i)),s=t._getLabelSizes(),a=e.autoSkipPadding||0,r=s?s.widest.width+a:0,l=s?s.highest.height+a:0;return t.isHorizontal()?l*n>r*o?r/n:l/o:l*o<r*n?l/n:r/o}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this,i=e.axis,n=e.chart,o=e.options,{grid:s,position:a}=o,r=s.offset,l=e.isHorizontal(),c=e.ticks.length+(r?1:0),h=Hi(s),d=[],u=s.setContext(e.getContext(0)),f=u.drawBorder?u.borderWidth:0,g=f/2,p=function(t){return Ut(n,t,f)};let m,x,b,_,y,v,w,M,k,S,P,D;if("top"===a)m=p(e.bottom),v=e.bottom-h,M=m-g,S=p(t.top)+g,D=t.bottom;else if("bottom"===a)m=p(e.top),S=t.top,D=p(t.bottom)-g,v=m+g,M=e.top+h;else if("left"===a)m=p(e.right),y=e.right-h,w=m-g,k=p(t.left)+g,P=t.right;else if("right"===a)m=p(e.left),k=t.left,P=p(t.right)-g,y=m+g,w=e.left+h;else if("x"===i){if("center"===a)m=p((t.top+t.bottom)/2+.5);else if(U(a)){const t=Object.keys(a)[0],i=a[t];m=p(e.chart.scales[t].getPixelForValue(i))}S=t.top,D=t.bottom,v=m+g,M=v+h}else if("y"===i){if("center"===a)m=p((t.left+t.right)/2);else if(U(a)){const t=Object.keys(a)[0],i=a[t];m=p(e.chart.scales[t].getPixelForValue(i))}y=m-g,w=y-h,k=t.left,P=t.right}for(x=0;x<c;++x){const t=s.setContext(e.getContext(x)),i=t.lineWidth,o=t.color,a=s.borderDash||[],c=t.borderDashOffset,h=t.tickWidth,u=t.tickColor,f=t.tickBorderDash||[],g=t.tickBorderDashOffset;b=Ni(e,x,r),void 0!==b&&(_=Ut(n,b,i),l?y=w=k=P=_:v=M=S=D=_,d.push({tx1:y,ty1:v,tx2:w,ty2:M,x1:k,y1:S,x2:P,y2:D,width:i,color:o,borderDash:a,borderDashOffset:c,tickWidth:h,tickColor:u,tickBorderDash:f,tickBorderDashOffset:g}))}return e._ticksLength=c,e._borderValue=m,d}_computeLabelItems(t){const e=this,i=e.axis,n=e.options,{position:o,ticks:s}=n,a=e.isHorizontal(),r=e.ticks,{align:l,crossAlign:c,padding:h,mirror:d}=s,u=Hi(n.grid),f=u+h,g=d?-h:f,p=-Lt(e.labelRotation),m=[];let x,b,_,y,v,w,M,k,S,P,D,C,O="middle";if("top"===o)w=e.bottom-g,M=e._getXAxisLabelAlignment();else if("bottom"===o)w=e.top+g,M=e._getXAxisLabelAlignment();else if("left"===o){const t=e._getYAxisLabelAlignment(u);M=t.textAlign,v=t.x}else if("right"===o){const t=e._getYAxisLabelAlignment(u);M=t.textAlign,v=t.x}else if("x"===i){if("center"===o)w=(t.top+t.bottom)/2+f;else if(U(o)){const t=Object.keys(o)[0],i=o[t];w=e.chart.scales[t].getPixelForValue(i)+f}M=e._getXAxisLabelAlignment()}else if("y"===i){if("center"===o)v=(t.left+t.right)/2-f;else if(U(o)){const t=Object.keys(o)[0],i=o[t];v=e.chart.scales[t].getPixelForValue(i)}M=e._getYAxisLabelAlignment(u).textAlign}"y"===i&&("start"===l?O="top":"end"===l&&(O="bottom"));const A=e._getLabelSizes();for(x=0,b=r.length;x<b;++x){_=r[x],y=_.label;const t=s.setContext(e.getContext(x));k=e.getPixelForTick(x)+s.labelOffset,S=e._resolveTickFontOptions(x),P=S.lineHeight,D=Y(y)?y.length:1;const i=D/2,n=t.color,l=t.textStrokeColor,h=t.textStrokeWidth;a?(v=k,C="top"===o?"near"===c||0!==p?-D*P+P/2:"center"===c?-A.highest.height/2-i*P+P:-A.highest.height+P/2:"near"===c||0!==p?P/2:"center"===c?A.highest.height/2-i*P:A.highest.height-D*P,d&&(C*=-1)):(w=k,C=(1-D)*P/2),m.push({rotation:p,label:y,font:S,color:n,strokeColor:l,strokeWidth:h,textOffset:C,textAlign:M,textBaseline:O,translation:[v,w]})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Lt(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align&&(i="right"),i}_getYAxisLabelAlignment(t){const e=this,{position:i,ticks:{crossAlign:n,mirror:o,padding:s}}=e.options,a=t+s,r=e._getLabelSizes().widest.width;let l,c;return"left"===i?o?(l="left",c=e.right+s):(c=e.right-a,"near"===n?l="right":"center"===n?(l="center",c-=r/2):(l="left",c=e.left)):"right"===i?o?(l="right",c=e.left+s):(c=e.left+a,"near"===n?l="left":"center"===n?(l="center",c+=r/2):(l="right",c=e.right)):l="right",{textAlign:l,x:c}}_computeLabelArea(){const t=this;if(t.options.ticks.mirror)return;const e=t.chart,i=t.options.position;return"left"===i||"right"===i?{top:0,left:t.left,bottom:e.height,right:t.right}:"top"===i||"bottom"===i?{top:t.top,left:0,bottom:t.bottom,right:e.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this,i=e.options.grid;if(!e._isVisible()||!i.display)return 0;const n=e.ticks.findIndex((e=>e.value===t));if(n>=0){return i.setContext(e.getContext(n)).lineWidth}return 0}drawGrid(t){const e=this,i=e.options.grid,n=e.ctx,o=e.chart,s=i.setContext(e.getContext()),a=i.drawBorder?s.borderWidth:0,r=e._gridLineItems||(e._gridLineItems=e._computeGridLineItems(t));let l,c;const h=(t,e,i)=>{i.width&&i.color&&(n.save(),n.lineWidth=i.width,n.strokeStyle=i.color,n.setLineDash(i.borderDash||[]),n.lineDashOffset=i.borderDashOffset,n.beginPath(),n.moveTo(t.x,t.y),n.lineTo(e.x,e.y),n.stroke(),n.restore())};if(i.display)for(l=0,c=r.length;l<c;++l){const t=r[l];i.drawOnChartArea&&h({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),i.drawTicks&&h({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}if(a){const t=s.lineWidth,i=e._borderValue;let n,r,l,c;e.isHorizontal()?(n=Ut(o,e.left,a)-a/2,r=Ut(o,e.right,t)+t/2,l=c=i):(l=Ut(o,e.top,a)-a/2,c=Ut(o,e.bottom,t)+t/2,n=r=i),h({x:n,y:l},{x:r,y:c},{width:a,color:s.borderColor})}}drawLabels(t){const e=this;if(!e.options.ticks.display)return;const i=e.ctx,n=e._computeLabelArea();n&&Gt(i,n);const o=e._labelItems||(e._labelItems=e._computeLabelItems(t));let s,a;for(s=0,a=o.length;s<a;++s){const t=o[s],e=t.font;te(i,t.label,0,t.textOffset,e,t)}n&&Zt(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const s=Fe(i.font),a=Ie(i.padding),r=i.align;let l=s.lineHeight/2;"bottom"===e?(l+=a.bottom,Y(i.text)&&(l+=s.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:c,titleY:h,maxWidth:d,rotation:u}=function(t,e,i,n){const{top:s,left:a,bottom:r,right:l}=t;let c,h,d,u=0;return t.isHorizontal()?(h=o(n,a,l),d=Bi(t,i,e),c=l-a):(h=Bi(t,i,e),d=o(n,r,s),u="left"===i?-wt:wt),{titleX:h,titleY:d,maxWidth:c,rotation:u}}(this,l,e,r);te(t,i.text,0,0,s,{color:i.color,maxWidth:d,rotation:u,textAlign:$i(r,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){const e=this;e._isVisible()&&(e.drawBackground(),e.drawGrid(t),e.drawTitle(),e.drawLabels(t))}_layers(){const t=this,e=t.options,i=e.ticks&&e.ticks.z||0,n=e.grid&&e.grid.z||0;return t._isVisible()&&i!==n&&t.draw===Yi.prototype.draw?[{z:n,draw(e){t.drawBackground(),t.drawGrid(e),t.drawTitle()}},{z:i,draw(e){t.drawLabels(e)}}]:[{z:i,draw(e){t.draw(e)}}]}getMatchingVisibleMetas(t){const e=this,i=e.chart.getSortedVisibleDatasetMetas(),n=e.axis+"AxisID",o=[];let s,a;for(s=0,a=i.length;s<a;++s){const a=i[s];a[n]!==e.id||t&&a.type!==t||o.push(a)}return o}_resolveTickFontOptions(t){return Fe(this.options.ticks.setContext(this.getContext(t)).font)}}function Ui(t,e=[""],i=t,n,o=(()=>t[0])){ht(n)||(n=on("_fallback",t));const s={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:n,_getTarget:o,override:o=>Ui([o,...t],e,i,n)};return new Proxy(s,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>Zi(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=on(Ki(s,t),i),ht(o))return Gi(t,o)?en(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>sn(t).includes(e),ownKeys:t=>sn(t),set:(t,e,i)=>((t._storage||(t._storage=o()))[e]=i,delete t[e],delete t._keys,!0)})}function Xi(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:qi(t,n),setContext:e=>Xi(t,e,i,n),override:o=>Xi(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Zi(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:a}=t;let r=n[e];dt(r)&&a.isScriptable(e)&&(r=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+[...r].join("->")+"->"+t);r.add(t),e=e(s,a||n),r.delete(t),U(e)&&(e=en(o._scopes,o,t,e));return e}(e,r,t,i));Y(r)&&r.length&&(r=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:a,_descriptors:r}=i;if(ht(s.index)&&n(t))e=e[s.index%e.length];else if(U(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=en(n,o,t,l);e.push(Xi(i,s,a&&a[t],r))}}return e}(e,r,t,a.isIndexable));Gi(e,r)&&(r=Xi(r,o,s&&s[e],a));return r}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function qi(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:dt(i)?i:()=>i,isIndexable:dt(n)?n:()=>n}}const Ki=(t,e)=>t?t+ct(e):e,Gi=(t,e)=>U(e)&&"adapters"!==t;function Zi(t,e,i){let n=t[e];return ht(n)||(n=i(),ht(n)&&(t[e]=n)),n}function Qi(t,e,i){return dt(t)?t(e,i):t}const Ji=(t,e)=>!0===t?e:"string"==typeof t?lt(e,t):void 0;function tn(t,e,i,n){for(const o of e){const e=Ji(i,o);if(e){t.add(e);const o=Qi(e._fallback,i,e);if(ht(o)&&o!==i&&o!==n)return o}else if(!1===e&&ht(n)&&i!==n)return null}return!1}function en(t,e,i,n){const o=e._rootScopes,s=Qi(e._fallback,i,n),a=[...t,...o],r=new Set;r.add(n);let l=nn(r,a,i,s||i);return null!==l&&((!ht(s)||s===i||(l=nn(r,a,s,l),null!==l))&&Ui([...r],[""],o,s,(()=>{const t=e._getTarget();return i in t||(t[i]={}),t[i]})))}function nn(t,e,i,n){for(;i;)i=tn(t,e,i,n);return i}function on(t,e){for(const i of e){if(!i)continue;const e=i[t];if(ht(e))return e}}function sn(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return[...e]}(t._scopes)),e}const an=Number.EPSILON||1e-14,rn=(t,e)=>e<t.length&&!t[e].skip&&t[e];function ln(t,e,i,n){const o=t.skip?e:t,s=e,a=i.skip?e:i,r=zt(s,o),l=zt(a,s);let c=r/(r+l),h=l/(r+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(a.x-o.x),y:s.y-d*(a.y-o.y)},next:{x:s.x+u*(a.x-o.x),y:s.y+u*(a.y-o.y)}}}function cn(t){const e=t.length,i=Array(e).fill(0),n=Array(e);let o,s,a,r=rn(t,0);for(o=0;o<e;++o)if(s=a,a=r,r=rn(t,o+1),a){if(r){const t=r.x-a.x;i[o]=0!==t?(r.y-a.y)/t:0}n[o]=s?r?Pt(i[o-1])!==Pt(i[o])?0:(i[o-1]+i[o])/2:i[o-1]:i[o]}!function(t,e,i){const n=t.length;let o,s,a,r,l,c=rn(t,0);for(let h=0;h<n-1;++h)l=c,c=rn(t,h+1),l&&c&&(At(e[h],0,an)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],r=Math.pow(o,2)+Math.pow(s,2),r<=9||(a=3/Math.sqrt(r),i[h]=o*a*e[h],i[h+1]=s*a*e[h])))}(t,i,n),function(t,e){const i=t.length;let n,o,s,a=rn(t,0);for(let r=0;r<i;++r){if(o=s,s=a,a=rn(t,r+1),!s)continue;const{x:i,y:l}=s;o&&(n=(i-o.x)/3,s.cp1x=i-n,s.cp1y=l-n*e[r]),a&&(n=(a.x-i)/3,s.cp2x=i+n,s.cp2y=l+n*e[r])}}(t,n)}function hn(t,e,i){return Math.max(Math.min(t,i),e)}function dn(t,e,i,n){let o,s,a,r;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)cn(t);else{let i=n?t[t.length-1]:t[0];for(o=0,s=t.length;o<s;++o)a=t[o],r=ln(i,a,t[Math.min(o+1,s-(n?0:1))%s],e.tension),a.cp1x=r.previous.x,a.cp1y=r.previous.y,a.cp2x=r.next.x,a.cp2y=r.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,a,r=Kt(t[0],e);for(i=0,n=t.length;i<n;++i)a=s,s=r,r=i<n-1&&Kt(t[i+1],e),s&&(o=t[i],a&&(o.cp1x=hn(o.cp1x,e.left,e.right),o.cp1y=hn(o.cp1y,e.top,e.bottom)),r&&(o.cp2x=hn(o.cp2x,e.left,e.right),o.cp2y=hn(o.cp2y,e.top,e.bottom)))}(t,i)}function un(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function fn(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function gn(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},a=un(t,o,i),r=un(o,s,i),l=un(s,e,i),c=un(a,r,i),h=un(r,l,i);return un(c,h,i)}function pn(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function mn(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function xn(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function bn(t){return"angle"===t?{between:Wt,compare:Vt,normalize:Bt}:{between:(t,e,i)=>t>=Math.min(e,i)&&t<=Math.max(i,e),compare:(t,e)=>t-e,normalize:t=>t}}function _n({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function yn(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,a=e.length,{compare:r,between:l,normalize:c}=bn(n),{start:h,end:d,loop:u,style:f}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:a,normalize:r}=bn(n),l=e.length;let c,h,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,c=0,h=l;c<h&&a(r(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,x,b=!1,_=null;const y=()=>b||l(o,x,p)&&0!==r(o,x),v=()=>!b||0===r(s,p)||l(s,x,p);for(let t=h,i=h;t<=d;++t)m=e[t%a],m.skip||(p=c(m[n]),b=l(p,o,s),null===_&&y()&&(_=0===r(p,o)?t:i),null!==_&&v()&&(g.push(_n({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p);return null!==_&&g.push(_n({start:_,end:d,loop:u,count:a,style:f})),g}function vn(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=yn(n[o],t.points,e);s.length&&i.push(...s)}return i}function wn(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:a,end:r}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);if(!0===n)return Mn([{start:a,end:r,loop:s}],i,e);return Mn(function(t,e,i,n){const o=t.length,s=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(a-1)%o,loop:n}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&s.push({start:e%o,end:r%o,loop:n}),s}(i,a,r<a?r+o:r,!!t._fullLoop&&0===a&&r===o-1),i,e)}function Mn(t,e,i){return i&&i.setContext&&e?function(t,e,i){const n=e.length,o=[];let s=t[0].start,a=s;for(const r of t){let t,l,c=e[s%n];for(a=s+1;a<=r.end;a++){const h=e[a%n];l=kn(i.setContext({type:"segment",p0:c,p1:h})),Sn(l,t)&&(o.push({start:s,end:a-1,loop:r.loop,style:t}),t=l,s=a-1),c=h,t=l}s<a-1&&(o.push({start:s,end:a-1,loop:r.loop,style:l}),s=a-1)}return o}(t,e,i):t}function kn(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Sn(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var Pn=Object.freeze({__proto__:null,easingEffects:pi,color:W,getHoverColor:N,noop:H,uid:j,isNullOrUndef:$,isArray:Y,isObject:U,isFinite:X,finiteOrDefault:q,valueOrDefault:K,toPercentage:G,toDimension:Z,callback:Q,each:J,_elementsEqual:tt,clone:et,_merger:nt,merge:ot,mergeIf:st,_mergerIf:at,_deprecated:function(t,e,i,n){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+n+'" instead')},resolveObjectKey:lt,_capitalize:ct,defined:ht,isFunction:dt,toFontString:jt,_measureText:$t,_longestText:Yt,_alignPixel:Ut,clearCanvas:Xt,drawPoint:qt,_isPointInArea:Kt,clipArea:Gt,unclipArea:Zt,_steppedLineTo:Qt,_bezierCurveTo:Jt,renderText:te,addRoundedRectPath:ee,_lookup:ie,_lookupByKey:ne,_rlookupByKey:oe,_filterBetween:se,listenArrayEvents:re,unlistenArrayEvents:le,_arrayUnique:ce,_createResolver:Ui,_attachContext:Xi,_descriptors:qi,splineCurve:ln,splineCurveMonotone:cn,_updateBezierControlPoints:dn,_getParentNode:he,getStyle:fe,getRelativePosition:me,getMaximumSize:be,retinaScale:_e,supportsEventListenerOptions:ye,readUsedSize:ve,fontString:function(t,e,i){return e+" "+t+"px "+i},requestAnimFrame:t,throttled:e,debounce:i,_toLeftRightCenter:n,_alignStartEnd:o,_textX:s,_pointInLine:un,_steppedInterpolation:fn,_bezierInterpolation:gn,formatNumber:Ei,toLineHeight:Te,_readValueToProps:Re,toTRBL:Le,toTRBLCorners:Ee,toPadding:Ie,toFont:Fe,resolve:ze,_addGrace:Ve,PI:xt,TAU:bt,PITAU:_t,INFINITY:yt,RAD_PER_DEG:vt,HALF_PI:wt,QUARTER_PI:Mt,TWO_THIRDS_PI:kt,log10:St,sign:Pt,niceNum:Dt,_factorize:Ct,isNumber:Ot,almostEquals:At,almostWhole:Tt,_setMinAndMaxByKey:Rt,toRadians:Lt,toDegrees:Et,_decimalPlaces:It,getAngleFromPoint:Ft,distanceBetweenPoints:zt,_angleDiff:Vt,_normalizeAngle:Bt,_angleBetween:Wt,_limitValue:Nt,_int16Range:Ht,getRtlAdapter:pn,overrideTextDirection:mn,restoreTextDirection:xn,_boundSegment:yn,_boundSegments:vn,_computeSegments:wn});class Dn{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=this,i=Object.getPrototypeOf(t);let n;(function(t){return"id"in t&&"defaults"in t})(i)&&(n=e.register(i));const o=e.items,s=t.id,a=e.scope+"."+s;if(!s)throw new Error("class does not have id: "+t);return s in o||(o[s]=t,function(t,e,i){const n=ot(Object.create(null),[i?mt.get(i):{},mt.get(e),t.defaults]);mt.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");mt.route(s,o,l,r)}))}(e,t.defaultRoutes);t.descriptors&&mt.describe(e,t.descriptors)}(t,a,n),e.override&&mt.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in mt[n]&&(delete mt[n][i],this.override&&delete ut[i])}}var Cn=new class{constructor(){this.controllers=new Dn(Ti,"datasets",!0),this.elements=new Dn(Ri,"elements"),this.plugins=new Dn(Object,"plugins"),this.scales=new Dn(Yi,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){const n=this;[...e].forEach((e=>{const o=i||n._getRegistryForType(e);i||o.isForType(e)||o===n.plugins&&e.id?n._exec(t,o,e):J(e,(e=>{const o=i||n._getRegistryForType(e);n._exec(t,o,e)}))}))}_exec(t,e,i){const n=ct(t);Q(i["before"+n],[],i),e[t](i),Q(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}};class On{constructor(){this._init=[]}notify(t,e,i,n){const o=this;"beforeInit"===e&&(o._init=o._createDescriptors(t,!0),o._notify(o._init,t,"install"));const s=n?o._descriptors(t).filter(n):o._descriptors(t),a=o._notify(s,t,e,i);return"destroy"===e&&(o._notify(s,t,"stop"),o._notify(o._init,t,"uninstall")),a}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===Q(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){$(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=K(i.options&&i.options.plugins,{}),o=function(t){const e=[],i=Object.keys(Cn.plugins.items);for(let t=0;t<i.length;t++)e.push(Cn.getPlugin(i[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const i=n[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==n||e?function(t,e,i,n){const o=[],s=t.getContext();for(let a=0;a<e.length;a++){const r=e[a],l=An(i[r.id],n);null!==l&&o.push({plugin:r,options:Tn(t.config,r,l,s)})}return o}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function An(t,e){return e||!1!==t?!0===t?{}:t:null}function Tn(t,e,i,n){const o=t.pluginScopeKeys(e),s=t.getOptionScopes(i,o);return t.createResolver(s,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function Rn(t,e){const i=mt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Ln(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function En(t){const e=t.options||(t.options={});e.plugins=K(e.plugins,{}),e.scales=function(t,e){const i=ut[t.type]||{scales:{}},n=e.scales||{},o=Rn(t.type,e),s=Object.create(null),a=Object.create(null);return Object.keys(n).forEach((t=>{const e=n[t],r=Ln(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,o),c=i.scales||{};s[r]=s[r]||t,a[t]=st(Object.create(null),[{axis:r},e,c[r],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||Rn(o,e),l=(ut[o]||{}).scales||{};Object.keys(l).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||s[e]||e;a[o]=a[o]||Object.create(null),st(a[o],[{axis:e},n[o],l[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];st(e,[mt.scales[e.type],mt.scale])})),a}(t,e)}const In=new Map,Fn=new Set;function zn(t,e){let i=In.get(t);return i||(i=e(),In.set(t,i),Fn.add(i)),i}const Vn=(t,e,i)=>{const n=lt(e,i);void 0!==n&&t.add(n)};class Bn{constructor(t){this._config=function(t){const e=(t=t||{}).data=t.data||{datasets:[],labels:[]};return e.datasets=e.datasets||[],e.labels=e.labels||[],En(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=t}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),En(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return zn(t,(()=>[["datasets."+t,""]]))}datasetAnimationScopeKeys(t,e){return zn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,"transitions."+e],["datasets."+t,""]]))}datasetElementScopeKeys(t,e){return zn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,"datasets."+t,"elements."+e,""]]))}pluginScopeKeys(t){const e=t.id;return zn(`${this.type}-plugin-${e}`,(()=>[["plugins."+e,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),a=s.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>Vn(r,t,e)))),e.forEach((t=>Vn(r,n,t))),e.forEach((t=>Vn(r,ut[o]||{},t))),e.forEach((t=>Vn(r,mt,t))),e.forEach((t=>Vn(r,ft,t)))}));const l=[...r];return Fn.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,ut[e]||{},mt.datasets[e]||{},{type:e},mt,ft]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:a}=Wn(this._resolverCache,t,n);let r=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=qi(t);for(const o of e)if(i(o)&&dt(t[o])||n(o)&&Y(t[o]))return!0;return!1}(s,e)){o.$shared=!1;r=Xi(s,i=dt(i)?i():i,this.createResolver(t,i,a))}for(const t of e)o[t]=r[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=Wn(this._resolverCache,t,i);return U(e)?Xi(o,e,void 0,n):o}}function Wn(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:Ui(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const Nn=["top","bottom","left","right","chartArea"];function Hn(t,e){return"top"===t||"bottom"===t||-1===Nn.indexOf(t)&&"x"===e}function jn(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function $n(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),Q(i&&i.onComplete,[t],e)}function Yn(t){const e=t.chart,i=e.options.animation;Q(i&&i.onProgress,[t],e)}function Un(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Xn(t){return Un()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const qn={},Kn=t=>{const e=Xn(t);return Object.values(qn).filter((t=>t.canvas===e)).pop()};class Gn{constructor(t,e){const n=this;this.config=e=new Bn(e);const o=Xn(t),s=Kn(o);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas can be reused.");const r=e.createResolver(e.chartOptionScopes(),n.getContext());this.platform=n._initializePlatform(o,e);const l=n.platform.acquireContext(o,r.aspectRatio),c=l&&l.canvas,h=c&&c.height,d=c&&c.width;this.id=j(),this.ctx=l,this.canvas=c,this.width=d,this.height=h,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._sortedMetasets=[],this.scales={},this.scale=void 0,this._plugins=new On,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=i((()=>this.update("resize")),r.resizeDelay||0),qn[n.id]=n,l&&c?(a.listen(n,"complete",$n),a.listen(n,"progress",Yn),n._initialize(),n.attached&&n.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return $(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){const t=this;return t.notifyPlugins("beforeInit"),t.options.responsive?t.resize():_e(t,t.options.devicePixelRatio),t.bindEvents(),t.notifyPlugins("afterInit"),t}_initializePlatform(t,e){return e.platform?new e.platform:!Un()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?new Ze:new hi}clear(){return Xt(this.canvas,this.ctx),this}stop(){return a.stop(this),this}resize(t,e){a.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this,n=i.options,o=i.canvas,s=n.maintainAspectRatio&&i.aspectRatio,a=i.platform.getMaximumSize(o,t,e,s),r=i.currentDevicePixelRatio,l=n.devicePixelRatio||i.platform.getDevicePixelRatio();i.width===a.width&&i.height===a.height&&r===l||(i.width=a.width,i.height=a.height,i._aspectRatio=i.aspectRatio,_e(i,l,!0),i.notifyPlugins("resize",{size:a}),Q(n.onResize,[i,a],i),i.attached&&i._doResize()&&i.render())}ensureScalesHaveIDs(){J(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this,e=t.options,i=e.scales,n=t.scales,o=Object.keys(n).reduce(((t,e)=>(t[e]=!1,t)),{});let s=[];i&&(s=s.concat(Object.keys(i).map((t=>{const e=i[t],n=Ln(t,e),o="r"===n,s="x"===n;return{options:e,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),J(s,(i=>{const s=i.options,a=s.id,r=Ln(a,s),l=K(s.type,i.dtype);void 0!==s.position&&Hn(s.position,r)===Hn(i.dposition)||(s.position=i.dposition),o[a]=!0;let c=null;if(a in n&&n[a].type===l)c=n[a];else{c=new(Cn.getScale(l))({id:a,type:l,ctx:t.ctx,chart:t}),n[c.id]=c}c.init(s,e)})),J(o,((t,e)=>{t||delete n[e]})),J(n,(e=>{Ke.configure(t,e,e.options),Ke.addBox(t,e)}))}_updateMetasetIndex(t,e){const i=this._metasets,n=t.index;n!==e&&(i[n]=i[e],i[e]=t,t.index=e)}_updateMetasets(){const t=this,e=t._metasets,i=t.data.datasets.length,n=e.length;if(n>i){for(let e=i;e<n;++e)t._destroyDatasetMeta(e);e.splice(i,n-i)}t._sortedMetasets=e.slice(0).sort(jn("order","index"))}_removeUnreferencedMetasets(){const t=this,{_metasets:e,data:{datasets:i}}=t;e.length>i.length&&delete t._stacks,e.forEach(((e,n)=>{0===i.filter((t=>t===e._dataset)).length&&t._destroyDatasetMeta(n)}))}buildOrUpdateControllers(){const t=this,e=[],i=t.data.datasets;let n,o;for(t._removeUnreferencedMetasets(),n=0,o=i.length;n<o;n++){const o=i[n];let s=t.getDatasetMeta(n);const a=o.type||t.config.type;if(s.type&&s.type!==a&&(t._destroyDatasetMeta(n),s=t.getDatasetMeta(n)),s.type=a,s.indexAxis=o.indexAxis||Rn(a,t.options),s.order=o.order||0,t._updateMetasetIndex(s,n),s.label=""+o.label,s.visible=t.isDatasetVisible(n),s.controller)s.controller.updateIndex(n),s.controller.linkScales();else{const i=Cn.getController(a),{datasetElementType:o,dataElementType:r}=mt.datasets[a];Object.assign(i.prototype,{dataElementType:Cn.getElement(r),datasetElementType:o&&Cn.getElement(o)}),s.controller=new i(t,n),e.push(s.controller)}}return t._updateMetasets(),e}_resetElements(){const t=this;J(t.data.datasets,((e,i)=>{t.getDatasetMeta(i).controller.reset()}),t)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this,i=e.config;i.update(),e._options=i.createResolver(i.chartOptionScopes(),e.getContext()),J(e.scales,(t=>{Ke.removeBox(e,t)}));const n=e._animationsDisabled=!e.options.animation;if(e.ensureScalesHaveIDs(),e.buildOrUpdateScales(),e._plugins.invalidate(),!1===e.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=e.buildOrUpdateControllers();e.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,i=e.data.datasets.length;t<i;t++){const{controller:i}=e.getDatasetMeta(t),a=!n&&-1===o.indexOf(i);i.buildOrUpdateElements(a),s=Math.max(+i.getMaxOverflow(),s)}e._minPadding=s,e._updateLayout(s),n||J(o,(t=>{t.reset()})),e._updateDatasets(t),e.notifyPlugins("afterUpdate",{mode:t}),e._layers.sort(jn("z","_idx")),e._lastEvent&&e._eventHandler(e._lastEvent,!0),e.render()}_updateLayout(t){const e=this;if(!1===e.notifyPlugins("beforeLayout",{cancelable:!0}))return;Ke.update(e,e.width,e.height,t);const i=e.chartArea,n=i.width<=0||i.height<=0;e._layers=[],J(e.boxes,(t=>{n&&"chartArea"===t.position||(t.configure&&t.configure(),e._layers.push(...t._layers()))}),e),e._layers.forEach(((t,e)=>{t._idx=e})),e.notifyPlugins("afterLayout")}_updateDatasets(t){const e=this,i="function"==typeof t;if(!1!==e.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let n=0,o=e.data.datasets.length;n<o;++n)e._updateDataset(n,i?t({datasetIndex:n}):t);e.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this,n=i.getDatasetMeta(t),o={meta:n,index:t,mode:e,cancelable:!0};!1!==i.notifyPlugins("beforeDatasetUpdate",o)&&(n.controller._update(e),o.cancelable=!1,i.notifyPlugins("afterDatasetUpdate",o))}render(){const t=this;!1!==t.notifyPlugins("beforeRender",{cancelable:!0})&&(a.has(t)?t.attached&&!a.running(t)&&a.start(t):(t.draw(),$n({chart:t})))}draw(){const t=this;let e;if(t._resizeBeforeDraw){const{width:e,height:i}=t._resizeBeforeDraw;t._resize(e,i),t._resizeBeforeDraw=null}if(t.clear(),t.width<=0||t.height<=0)return;if(!1===t.notifyPlugins("beforeDraw",{cancelable:!0}))return;const i=t._layers;for(e=0;e<i.length&&i[e].z<=0;++e)i[e].draw(t.chartArea);for(t._drawDatasets();e<i.length;++e)i[e].draw(t.chartArea);t.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){const t=this;if(!1===t.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const e=t.getSortedVisibleDatasetMetas();for(let i=e.length-1;i>=0;--i)t._drawDataset(e[i]);t.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this,i=e.ctx,n=t._clip,o=e.chartArea,s={meta:t,index:t.index,cancelable:!0};!1!==e.notifyPlugins("beforeDatasetDraw",s)&&(Gt(i,{left:!1===n.left?0:o.left-n.left,right:!1===n.right?e.width:o.right+n.right,top:!1===n.top?0:o.top-n.top,bottom:!1===n.bottom?e.height:o.bottom+n.bottom}),t.controller.draw(),Zt(i),s.cancelable=!1,e.notifyPlugins("afterDatasetDraw",s))}getElementsAtEventForMode(t,e,i,n){const o=Ce.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n=i[t]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1}),n}getContext(){return this.$context||(this.$context={chart:this,type:"chart"})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateDatasetVisibility(t,e){const i=this,n=e?"show":"hide",o=i.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);i.setDatasetVisibility(t,e),s.update(o,{visible:e}),i.update((e=>e.datasetIndex===t?n:void 0))}hide(t){this._updateDatasetVisibility(t,!1)}show(t){this._updateDatasetVisibility(t,!0)}_destroyDatasetMeta(t){const e=this,i=e._metasets&&e._metasets[t];i&&i.controller&&(i.controller._destroy(),delete e._metasets[t])}destroy(){const t=this,{canvas:e,ctx:i}=t;let n,o;for(t.stop(),a.remove(t),n=0,o=t.data.datasets.length;n<o;++n)t._destroyDatasetMeta(n);t.config.clearCache(),e&&(t.unbindEvents(),Xt(e,i),t.platform.releaseContext(i),t.canvas=null,t.ctx=null),t.notifyPlugins("destroy"),delete qn[t.id]}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){const t=this,e=t._listeners,i=t.platform,n=(n,o)=>{i.addEventListener(t,n,o),e[n]=o},o=(n,o)=>{e[n]&&(i.removeEventListener(t,n,o),delete e[n])};let s=function(e,i,n){e.offsetX=i,e.offsetY=n,t._eventHandler(e)};if(J(t.options.events,(t=>n(t,s))),t.options.responsive){let e;s=(e,i)=>{t.canvas&&t.resize(e,i)};const a=()=>{o("attach",a),t.attached=!0,t.resize(),n("resize",s),n("detach",e)};e=()=>{t.attached=!1,o("resize",s),n("attach",a)},i.isAttached(t.canvas)?a():e()}else t.attached=!0}unbindEvents(){const t=this,e=t._listeners;e&&(delete t._listeners,J(e,((e,i)=>{t.platform.removeEventListener(t,i,e)})))}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,a,r;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){s=t[a];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this,i=e._active||[],n=t.map((({datasetIndex:t,index:i})=>{const n=e.getDatasetMeta(t);if(!n)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:n.data[i],index:i}}));!tt(n,i)&&(e._active=n,e._updateHoverStyles(n,i))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const n=this,o=n.options.hover,s=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),a=s(e,t),r=i?t:s(t,e);a.length&&n.updateHoverStyle(a,o.mode,!1),r.length&&o.mode&&n.updateHoverStyle(r,o.mode,!0)}_eventHandler(t,e){const i=this,n={event:t,replay:e,cancelable:!0},o=e=>(e.options.events||this.options.events).includes(t.type);if(!1===i.notifyPlugins("beforeEvent",n,o))return;const s=i._handleEvent(t,e);return n.cancelable=!1,i.notifyPlugins("afterEvent",n,o),(s||n.changed)&&i.render(),i}_handleEvent(t,e){const i=this,{_active:n=[],options:o}=i,s=o.hover,a=e;let r=[],l=!1,c=null;return"mouseout"!==t.type&&(r=i.getElementsAtEventForMode(t,s.mode,s,a),c="click"===t.type?i._lastEvent:t),i._lastEvent=null,Kt(t,i.chartArea,i._minPadding)&&(Q(o.onHover,[t,r,i],i),"mouseup"!==t.type&&"click"!==t.type&&"contextmenu"!==t.type||Q(o.onClick,[t,r,i],i)),l=!tt(r,n),(l||e)&&(i._active=r,i._updateHoverStyles(r,n,e)),i._lastEvent=c,l}}const Zn=()=>J(Gn.instances,(t=>t._plugins.invalidate())),Qn=!0;function Jn(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}Object.defineProperties(Gn,{defaults:{enumerable:Qn,value:mt},instances:{enumerable:Qn,value:qn},overrides:{enumerable:Qn,value:ut},registry:{enumerable:Qn,value:Cn},version:{enumerable:Qn,value:"3.1.0"},getChart:{enumerable:Qn,value:Kn},register:{enumerable:Qn,value:(...t)=>{Cn.add(...t),Zn()}},unregister:{enumerable:Qn,value:(...t)=>{Cn.remove(...t),Zn()}}});class to{constructor(t){this.options=t||{}}formats(){return Jn()}parse(t,e){return Jn()}format(t,e){return Jn()}add(t,e,i){return Jn()}diff(t,e,i){return Jn()}startOf(t,e,i){return Jn()}endOf(t,e){return Jn()}}to.override=function(t){Object.assign(to.prototype,t)};var eo={_date:to};function io(t){const e=function(t){if(!t._cache.$bar){const e=t.getMatchingVisibleMetas("bar");let i=[];for(let n=0,o=e.length;n<o;n++)i=i.concat(e[n].controller.getAllParsedValues(t));t._cache.$bar=ce(i.sort(((t,e)=>t-e)))}return t._cache.$bar}(t);let i,n,o,s,a=t._length;const r=()=>{a=Math.min(a,i&&Math.abs(o-s)||a),s=o};for(i=0,n=e.length;i<n;++i)o=t.getPixelForValue(e[i]),r();for(i=0,n=t.ticks.length;i<n;++i)o=t.getPixelForTick(i),r();return a}function no(t,e,i,n){return Y(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),a=Math.min(o,s),r=Math.max(o,s);let l=a,c=r;Math.abs(a)>Math.abs(r)&&(l=r,c=a),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:a,max:r}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function oo(t,e,i,n){const o=t.iScale,s=t.vScale,a=o.getLabels(),r=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=r||o.parse(a[c],c),l.push(no(u,d,s,c));return l}function so(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}class ao extends Ti{parsePrimitiveData(t,e,i,n){return oo(t,e,i,n)}parseArrayData(t,e,i,n){return oo(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===o.axis?a:r,c="x"===s.axis?a:r,h=[];let d,u,f,g;for(d=i,u=i+n;d<u;++d)g=e[d],f={},f[o.axis]=o.parse(lt(g,l),d),h.push(no(lt(g,c),f,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,a=so(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:a}}initialize(){const t=this;t.enableOptionSharing=!0,super.initialize();t._cachedMeta.stack=t.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o=this,s="reset"===n,a=o._cachedMeta.vScale,r=a.getBasePixel(),l=a.isHorizontal(),c=o._getRuler(),h=o.resolveDataElementOptions(e,n),d=o.getSharedOptions(h),u=o.includeOptions(n,d);o.updateSharedOptions(d,n,h);for(let h=e;h<e+i;h++){const e=o.getParsed(h),i=s||$(e[a.axis])?{base:r,head:r}:o._calculateBarValuePixels(h),f=o._calculateBarIndexPixels(h,c),g={horizontal:l,base:i.base,x:l?i.head:f.center,y:l?f.center:i.head,height:l?f.size:void 0,width:l?void 0:f.size};u&&(g.options=d||o.resolveDataElementOptions(h,n)),o.updateElement(t[h],h,g,n)}}_getStacks(t,e){const i=this._cachedMeta.iScale,n=i.getMatchingVisibleMetas(this._type),o=i.options.stacked,s=n.length,a=[];let r,l;for(r=0;r<s;++r){if(l=n[r],void 0!==e){const t=l.controller.getParsed(e)[l.controller._cachedMeta.vScale.axis];if($(t)||isNaN(t))continue}if((!1===o||-1===a.indexOf(l.stack)||void 0===o&&void 0===l.stack)&&a.push(l.stack),l.index===t)break}return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e){const i=this._getStacks(t),n=void 0!==e?i.indexOf(e):-1;return-1===n?i.length-1:n}_getRuler(){const t=this,e=t.options,i=t._cachedMeta,n=i.iScale,o=[];let s,a;for(s=0,a=i.data.length;s<a;++s)o.push(n.getPixelForValue(t.getParsed(s)[n.axis],s));const r=e.barThickness;return{min:r||io(n),pixels:o,start:n._startPixel,end:n._endPixel,stackCount:t._getStackCount(),scale:n,grouped:e.grouped,ratio:r?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(t){const e=this,{vScale:i,_stacked:n}=e._cachedMeta,{base:o,minBarLength:s}=e.options,a=e.getParsed(t),r=a._custom,l=so(r);let c,h,d=a[i.axis],u=0,f=n?e.applyStack(i,a,n):d;f!==d&&(u=f-d,f=d),l&&(d=r.barStart,f=r.barEnd-r.barStart,0!==d&&Pt(d)!==Pt(r.barEnd)&&(u=0),u+=d);const g=$(o)||l?u:o;let p=i.getPixelForValue(g);c=this.chart.getDataVisibility(t)?i.getPixelForValue(u+f):p,h=c-p,void 0!==s&&Math.abs(h)<s&&(h=h<0?-s:s,0===d&&(p-=h/2),c=p+h);const m=o||0;if(p===i.getPixelForValue(m)){const t=i.getLineWidthForValue(m)/2;h>0?(p+=t,h-=t):h<0&&(p-=t,h+=t)}return{size:h,base:p,head:c,center:c+h/2}}_calculateBarIndexPixels(t,e){const i=this,n=e.scale,o=i.options,s=K(o.maxBarThickness,1/0);let a,r;if(e.grouped){const n=o.skipNull?i._getStackCount(t):e.stackCount,l="flex"===o.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let a=t>0?o[t-1]:null,r=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===a&&(a=s-(null===r?e.end-e.start:r-s)),null===r&&(r=s+s-a);const c=s-(s-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,o,n):function(t,e,i,n){const o=i.barThickness;let s,a;return $(o)?(s=e.min*i.categoryPercentage,a=i.barPercentage):(s=o*n,a=1),{chunk:s/n,ratio:a,start:e.pixels[t]-s/2}}(t,e,o,n),c=i._getStackIndex(i.index,i._cachedMeta.stack);a=l.start+l.chunk*c+l.chunk/2,r=Math.min(s,l.chunk*l.ratio)}else a=n.getPixelForValue(i.getParsed(t)[n.axis],t),r=Math.min(s,e.min*e.ratio);return{base:a-r/2,head:a+r/2,center:a,size:r}}draw(){const t=this,e=t.chart,i=t._cachedMeta,n=i.vScale,o=i.data,s=o.length;let a=0;for(Gt(e.ctx,e.chartArea);a<s;++a)null!==t.getParsed(a)[n.axis]&&o[a].draw(t._ctx);Zt(e.ctx)}}ao.id="bar",ao.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},ao.overrides={interaction:{mode:"index"},scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class ro extends Ti{initialize(){this.enableOptionSharing=!0,super.initialize()}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=[];let c,h,d;for(c=i,h=i+n;c<h;++c)d=e[c],l.push({x:o.parse(lt(d,a),c),y:s.parse(lt(d,r),c),_custom:d&&d.r&&+d.r});return l}getMaxOverflow(){const{data:t,_parsed:e}=this._cachedMeta;let i=0;for(let n=t.length-1;n>=0;--n)i=Math.max(i,t[n].size()/2,e[n]._custom);return i>0&&i}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:n}=e,o=this.getParsed(t),s=i.getLabelForValue(o.x),a=n.getLabelForValue(o.y),r=o._custom;return{label:e.label,value:"("+s+", "+a+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o=this,s="reset"===n,{xScale:a,yScale:r}=o._cachedMeta,l=o.resolveDataElementOptions(e,n),c=o.getSharedOptions(l),h=o.includeOptions(n,c);for(let l=e;l<e+i;l++){const e=t[l],i=!s&&o.getParsed(l),c=s?a.getPixelForDecimal(.5):a.getPixelForValue(i.x),d=s?r.getBasePixel():r.getPixelForValue(i.y),u={x:c,y:d,skip:isNaN(c)||isNaN(d)};h&&(u.options=o.resolveDataElementOptions(l,n),s&&(u.options.radius=0)),o.updateElement(e,l,u,n)}o.updateSharedOptions(c,n,l)}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=K(i&&i._custom,o),n}}ro.id="bubble",ro.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},ro.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class lo extends Ti{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;let o,s;for(o=t,s=t+e;o<s;++o)n._parsed[o]=+i[o]}_getRotation(){return Lt(this.options.rotation-90)}_getCircumference(){return Lt(this.options.circumference)}_getRotationExtents(){let t=bt,e=-bt;const i=this;for(let n=0;n<i.chart.data.datasets.length;++n)if(i.chart.isDatasetVisible(n)){const o=i.chart.getDatasetMeta(n).controller,s=o._getRotation(),a=o._getCircumference();t=Math.min(t,s),e=Math.max(e,s+a)}return{rotation:t,circumference:e-t}}update(t){const e=this,i=e.chart,{chartArea:n}=i,o=e._cachedMeta,s=o.data,a=e.getMaxBorderWidth()+e.getMaxOffset(s),r=Math.max((Math.min(n.width,n.height)-a)/2,0),l=Math.min(G(e.options.cutout,r),1),c=e._getRingWeight(e.index),{circumference:h,rotation:d}=e._getRotationExtents(),{ratioX:u,ratioY:f,offsetX:g,offsetY:p}=function(t,e,i){let n=1,o=1,s=0,a=0;if(e<bt){const r=t,l=r+e,c=Math.cos(r),h=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(t,e,n)=>Wt(t,r,l)?1:Math.max(e,e*i,n,n*i),g=(t,e,n)=>Wt(t,r,l)?-1:Math.min(e,e*i,n,n*i),p=f(0,c,d),m=f(wt,h,u),x=g(xt,c,d),b=g(xt+wt,h,u);n=(p-x)/2,o=(m-b)/2,s=-(p+x)/2,a=-(m+b)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:a}}(d,h,l),m=(n.width-a)/u,x=(n.height-a)/f,b=Math.max(Math.min(m,x)/2,0),_=Z(e.options.radius,b),y=(_-Math.max(_*l,0))/e._getVisibleDatasetWeightTotal();e.offsetX=g*_,e.offsetY=p*_,o.total=e.calculateTotal(),e.outerRadius=_-y*e._getRingWeightOffset(e.index),e.innerRadius=Math.max(e.outerRadius-y*c,0),e.updateElements(s,0,s.length,t)}_circumference(t,e){const i=this,n=i.options,o=i._cachedMeta,s=i._getCircumference();return e&&n.animation.animateRotate||!this.chart.getDataVisibility(t)||null===o._parsed[t]?0:i.calculateCircumference(o._parsed[t]*s/bt)}updateElements(t,e,i,n){const o=this,s="reset"===n,a=o.chart,r=a.chartArea,l=a.options.animation,c=(r.left+r.right)/2,h=(r.top+r.bottom)/2,d=s&&l.animateScale,u=d?0:o.innerRadius,f=d?0:o.outerRadius,g=o.resolveDataElementOptions(e,n),p=o.getSharedOptions(g),m=o.includeOptions(n,p);let x,b=o._getRotation();for(x=0;x<e;++x)b+=o._circumference(x,s);for(x=e;x<e+i;++x){const e=o._circumference(x,s),i=t[x],a={x:c+o.offsetX,y:h+o.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:f,innerRadius:u};m&&(a.options=p||o.resolveDataElementOptions(x,n)),b+=e,o.updateElement(i,x,a,n)}o.updateSharedOptions(p,n,g)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const e=t._parsed[i];null!==e&&!isNaN(e)&&this.chart.getDataVisibility(i)&&(n+=Math.abs(e))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?bt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=Ei(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){const e=this;let i=0;const n=e.chart;let o,s,a,r,l;if(!t)for(o=0,s=n.data.datasets.length;o<s;++o)if(n.isDatasetVisible(o)){a=n.getDatasetMeta(o),t=a.data,r=a.controller,r!==e&&r.configure();break}if(!t)return 0;for(o=0,s=t.length;o<s;++o)l=r.resolveDataElementOptions(o),"inner"!==l.borderAlign&&(i=Math.max(i,l.borderWidth||0,l.hoverBorderWidth||0));return i}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(K(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}lo.id="doughnut",lo.defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",indexAxis:"r"},lo.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(((e,i)=>{const n=t.getDatasetMeta(0).controller.getStyle(i);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,hidden:!t.getDataVisibility(i),index:i}})):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return Y(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class co extends Ti{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this,i=e._cachedMeta,{dataset:n,data:o=[],_dataset:s}=i,a=e.chart._animationsDisabled;let{start:r,count:l}=function(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:c,max:h,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(o=Nt(Math.min(ne(r,a.axis,c).lo,i?n:ne(e,l,a.getPixelForValue(c)).lo),0,n-1)),s=u?Nt(Math.max(ne(r,a.axis,h).hi+1,i?0:ne(e,l,a.getPixelForValue(h)).hi+1),o,n)-o:n-o}return{start:o,count:s}}(i,o,a);e._drawStart=r,e._drawCount=l,function(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}(i)&&(r=0,l=o.length),n._decimated=!!s._decimated,n.points=o;const c=e.resolveDatasetElementOptions(t);e.options.showLine||(c.borderWidth=0),c.segment=e.options.segment,e.updateElement(n,void 0,{animated:!a,options:c},t),e.updateElements(o,r,l,t)}updateElements(t,e,i,n){const o=this,s="reset"===n,{xScale:a,yScale:r,_stacked:l}=o._cachedMeta,c=o.resolveDataElementOptions(e,n),h=o.getSharedOptions(c),d=o.includeOptions(n,h),u=o.options.spanGaps,f=Ot(u)?u:Number.POSITIVE_INFINITY,g=o.chart._animationsDisabled||s||"none"===n;let p=e>0&&o.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=o.getParsed(c),u=g?e:{},m=$(i.y),x=u.x=a.getPixelForValue(i.x,c),b=u.y=s||m?r.getBasePixel():r.getPixelForValue(l?o.applyStack(r,i,l):i.y,c);u.skip=isNaN(x)||isNaN(b)||m,u.stop=c>0&&i.x-p.x>f,u.parsed=i,d&&(u.options=h||o.resolveDataElementOptions(c,n)),g||o.updateElement(e,c,u,n),p=i}o.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this,e=t._cachedMeta,i=e.dataset,n=i.options&&i.options.borderWidth||0,o=e.data||[];if(!o.length)return n;const s=o[0].size(t.resolveDataElementOptions(0)),a=o[o.length-1].size(t.resolveDataElementOptions(o.length-1));return Math.max(n,s,a)/2}draw(){this._cachedMeta.dataset.updateControlPoints(this.chart.chartArea),super.draw()}}co.id="line",co.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},co.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class ho extends Ti{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this,e=t.chart,i=e.chartArea,n=e.options,o=Math.min(i.right-i.left,i.bottom-i.top),s=Math.max(o/2,0),a=(s-Math.max(n.cutoutPercentage?s/100*n.cutoutPercentage:1,0))/e.getVisibleDatasetCount();t.outerRadius=s-a*t.index,t.innerRadius=t.outerRadius-a}updateElements(t,e,i,n){const o=this,s="reset"===n,a=o.chart,r=o.getDataset(),l=a.options.animation,c=o._cachedMeta.rScale,h=c.xCenter,d=c.yCenter,u=c.getIndexAngle(0)-.5*xt;let f,g=u;const p=360/o.countVisibleElements();for(f=0;f<e;++f)g+=o._computeAngle(f,n,p);for(f=e;f<e+i;f++){const e=t[f];let i=g,m=g+o._computeAngle(f,n,p),x=a.getDataVisibility(f)?c.getDistanceFromCenterForValue(r.data[f]):0;g=m,s&&(l.animateScale&&(x=0),l.animateRotate&&(i=m=u));const b={x:h,y:d,innerRadius:0,outerRadius:x,startAngle:i,endAngle:m,options:o.resolveDataElementOptions(f,n)};o.updateElement(e,f,b,n)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let i=0;return e.data.forEach(((e,n)=>{!isNaN(t.data[n])&&this.chart.getDataVisibility(n)&&i++})),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Lt(this.resolveDataElementOptions(t,e).angle||i):0}}ho.id="polarArea",ho.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},ho.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(((e,i)=>{const n=t.getDatasetMeta(0).controller.getStyle(i);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,hidden:!t.getDataVisibility(i),index:i}})):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class uo extends lo{}uo.id="pie",uo.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class fo extends Ti{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}update(t){const e=this,i=e._cachedMeta,n=i.dataset,o=i.data||[],s=i.iScale.getLabels();if(n.points=o,"resize"!==t){const i=e.resolveDatasetElementOptions(t);e.options.showLine||(i.borderWidth=0);const a={_loop:!0,_fullLoop:s.length===o.length,options:i};e.updateElement(n,void 0,a,t)}e.updateElements(o,0,o.length,t)}updateElements(t,e,i,n){const o=this,s=o.getDataset(),a=o._cachedMeta.rScale,r="reset"===n;for(let l=e;l<e+i;l++){const e=t[l],i=o.resolveDataElementOptions(l,n),c=a.getPointPositionForValue(l,s.data[l]),h=r?a.xCenter:c.x,d=r?a.yCenter:c.y,u={x:h,y:d,angle:c.angle,skip:isNaN(h)||isNaN(d),options:i};o.updateElement(e,l,u,n)}}}fo.id="radar",fo.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},fo.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class go extends co{}go.id="scatter",go.defaults={showLine:!1,fill:!1},go.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var po=Object.freeze({__proto__:null,BarController:ao,BubbleController:ro,DoughnutController:lo,LineController:co,PolarAreaController:ho,PieController:uo,RadarController:fo,ScatterController:go});function mo(t,e){const{startAngle:i,endAngle:n,pixelMargin:o,x:s,y:a,outerRadius:r,innerRadius:l}=e;let c=o/r;t.beginPath(),t.arc(s,a,r,i-c,n+c),l>o?(c=o/l,t.arc(s,a,l,n+c,i-c,!0)):t.arc(s,a,o,n+wt,i-wt),t.closePath(),t.clip()}function xo(t,e,i,n){const o=Re(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,a=Math.min(s,n*e/2),r=t=>{const e=(i-Math.min(s,t))*n/2;return Nt(t,0,Math.min(s,e))};return{outerStart:r(o.outerStart),outerEnd:r(o.outerEnd),innerStart:Nt(o.innerStart,0,a),innerEnd:Nt(o.innerEnd,0,a)}}function bo(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function _o(t,e){const{x:i,y:n,startAngle:o,endAngle:s,pixelMargin:a}=e,r=Math.max(e.outerRadius-a,0),l=e.innerRadius+a,{outerStart:c,outerEnd:h,innerStart:d,innerEnd:u}=xo(e,l,r,s-o),f=r-c,g=r-h,p=o+c/f,m=s-h/g,x=l+d,b=l+u,_=o+d/x,y=s-u/b;if(t.beginPath(),t.arc(i,n,r,p,m),h>0){const e=bo(g,m,i,n);t.arc(e.x,e.y,h,m,s+wt)}const v=bo(b,s,i,n);if(t.lineTo(v.x,v.y),u>0){const e=bo(b,y,i,n);t.arc(e.x,e.y,u,s+wt,y+Math.PI)}if(t.arc(i,n,l,s-u/l,o+d/l,!0),d>0){const e=bo(x,_,i,n);t.arc(e.x,e.y,d,_+Math.PI,o-wt)}const w=bo(f,o,i,n);if(t.lineTo(w.x,w.y),c>0){const e=bo(f,p,i,n);t.arc(e.x,e.y,c,o-wt,p)}t.closePath()}function yo(t,e){const{options:i}=e,n="inner"===i.borderAlign;i.borderWidth&&(n?(t.lineWidth=2*i.borderWidth,t.lineJoin="round"):(t.lineWidth=i.borderWidth,t.lineJoin="bevel"),e.fullCircles&&function(t,e,i){const{x:n,y:o,startAngle:s,endAngle:a,pixelMargin:r}=e,l=Math.max(e.outerRadius-r,0),c=e.innerRadius+r;let h;for(i&&(e.endAngle=e.startAngle+bt,mo(t,e),e.endAngle=a,e.endAngle===e.startAngle&&(e.endAngle+=bt,e.fullCircles--)),t.beginPath(),t.arc(n,o,c,s+bt,s,!0),h=0;h<e.fullCircles;++h)t.stroke();for(t.beginPath(),t.arc(n,o,l,s,s+bt),h=0;h<e.fullCircles;++h)t.stroke()}(t,e,n),n&&mo(t,e),_o(t,e),t.stroke())}class vo extends Ri{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=Ft(n,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i);return(h>=bt||Wt(o,a,r))&&(s>=l&&s<=c)}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),r=(n+o)/2,l=(s+a)/2;return{x:e+Math.cos(r)*l,y:i+Math.sin(r)*l}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const e=this,i=e.options,n=i.offset||0;if(e.pixelMargin="inner"===i.borderAlign?.33:0,e.fullCircles=Math.floor(e.circumference/bt),!(0===e.circumference||e.innerRadius<0||e.outerRadius<0)){if(t.save(),n&&e.circumference<bt){const i=(e.startAngle+e.endAngle)/2;t.translate(Math.cos(i)*n,Math.sin(i)*n)}t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,function(t,e){if(e.fullCircles){e.endAngle=e.startAngle+bt,_o(t,e);for(let i=0;i<e.fullCircles;++i)t.fill()}isNaN(e.circumference)||(e.endAngle=e.startAngle+e.circumference%bt),_o(t,e),t.fill()}(t,e),yo(t,e),t.restore()}}}function wo(t,e,i=e){t.lineCap=K(i.borderCapStyle,e.borderCapStyle),t.setLineDash(K(i.borderDash,e.borderDash)),t.lineDashOffset=K(i.borderDashOffset,e.borderDashOffset),t.lineJoin=K(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=K(i.borderWidth,e.borderWidth),t.strokeStyle=K(i.borderColor,e.borderColor)}function Mo(t,e,i){t.lineTo(i.x,i.y)}function ko(t,e,i){i=i||{};const n=t.length,o=Math.max(i.start||0,e.start),s=Math.min(i.end||n-1,e.end);return{count:n,start:o,loop:e.loop,ilen:s<o?n+s-o:s-o}}function So(t,e,i,n){const{points:o,options:s}=e,{count:a,start:r,loop:l,ilen:c}=ko(o,i,n),h=function(t){return t.stepped?Qt:t.tension?Jt:Mo}(s);let d,u,f,{move:g=!0,reverse:p}=n||{};for(d=0;d<=c;++d)u=o[(r+(p?c-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):h(t,f,u,p,s.stepped),f=u);return l&&(u=o[(r+(p?c:0))%a],h(t,f,u,p,s.stepped)),!!l}function Po(t,e,i,n){const o=e.points,{count:s,start:a,ilen:r}=ko(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,f,g,p,m=0,x=0;const b=t=>(a+(c?r-t:t))%s,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=o[b(0)],t.moveTo(d.x,d.y)),h=0;h<=r;++h){if(d=o[b(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<f?f=i:i>g&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=n,x=0,f=g=i),p=i}_()}function Do(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||e.stepped||i)?Po:So}vo.id="arc",vo.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,angle:void 0},vo.defaultRoutes={backgroundColor:"backgroundColor"};const Co="function"==typeof Path2D;function Oo(t,e,i,n){Co&&1===e.segments.length?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),wo(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,a=Do(e);for(const r of o)wo(t,s,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class Ao extends Ri{constructor(t){super(),this.animated=!0,this.options=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,t&&Object.assign(this,t)}updateControlPoints(t){const e=this,i=e.options;if(i.tension&&!i.stepped&&!e._pointsUpdated){const n=i.spanGaps?e._loop:e._fullLoop;dn(e._points,i,t,n),e._pointsUpdated=!0}}set points(t){const e=this;e._points=t,delete e._segments,delete e._path,e._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=wn(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this,n=i.options,o=t[e],s=i.points,a=vn(i,{property:e,start:o,end:o});if(!a.length)return;const r=[],l=function(t){return t.stepped?fn:t.tension?gn:un}(n);let c,h;for(c=0,h=a.length;c<h;++c){const{start:i,end:h}=a[c],d=s[i],u=s[h];if(d===u){r.push(d);continue}const f=l(d,u,Math.abs((o-d[e])/(u[e]-d[e])),n.stepped);f[e]=t[e],r.push(f)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return Do(this)(t,this,e,i)}path(t,e,i){const n=this,o=n.segments,s=Do(n);let a=n._loop;e=e||0,i=i||n.points.length-e;for(const r of o)a&=s(t,n,r,{start:e,end:e+i-1});return!!a}draw(t,e,i,n){const o=this,s=o.options||{};(o.points||[]).length&&s.borderWidth&&(t.save(),Oo(t,o,i,n),t.restore(),o.animated&&(o._pointsUpdated=!1,o._path=void 0))}}function To(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}Ao.id="line",Ao.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},Ao.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},Ao.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class Ro extends Ri{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return To(this,t,"x",e)}inYRange(t,e){return To(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t){const e=this,i=e.options;e.skip||i.radius<.1||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,qt(t,i,e.x,e.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Lo(t,e){const{x:i,y:n,base:o,width:s,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,c,h,d;return t.horizontal?(d=a/2,r=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,r=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:r,top:c,right:l,bottom:h}}function Eo(t){let e=t.options.borderSkipped;const i={};return e?(e=t.horizontal?Io(e,"left","right",t.base>t.x):Io(e,"bottom","top",t.base<t.y),i[e]=!0,i):i}function Io(t,e,i,n){var o,s,a;return n?(a=i,t=Fo(t=(o=t)===(s=e)?a:o===a?s:o,i,e)):t=Fo(t,e,i),t}function Fo(t,e,i){return"start"===t?e:"end"===t?i:t}function zo(t,e,i,n){return t?0:Math.max(Math.min(e,n),i)}function Vo(t){const e=Lo(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=Eo(t),s=Le(n);return{t:zo(o.top,s.top,0,i),r:zo(o.right,s.right,0,e),b:zo(o.bottom,s.bottom,0,i),l:zo(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const n=Ee(t.options.borderRadius),o=Math.min(e,i),s=Eo(t);return{topLeft:zo(s.top||s.left,n.topLeft,0,o),topRight:zo(s.top||s.right,n.topRight,0,o),bottomLeft:zo(s.bottom||s.left,n.bottomLeft,0,o),bottomRight:zo(s.bottom||s.right,n.bottomRight,0,o)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function Bo(t,e,i,n){const o=null===e,s=null===i,a=t&&!(o&&s)&&Lo(t,n);return a&&(o||e>=a.left&&e<=a.right)&&(s||i>=a.top&&i<=a.bottom)}function Wo(t,e){t.rect(e.x,e.y,e.w,e.h)}Ro.id="point",Ro.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},Ro.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class No extends Ri{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this.options,{inner:i,outer:n}=Vo(this),o=(s=n.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?ee:Wo;var s;t.save(),n.w===i.w&&n.h===i.h||(t.beginPath(),o(t,n),t.clip(),o(t,i),t.fillStyle=e.borderColor,t.fill("evenodd")),t.beginPath(),o(t,i),t.fillStyle=e.backgroundColor,t.fill(),t.restore()}inRange(t,e,i){return Bo(this,t,e,i)}inXRange(t,e){return Bo(this,t,null,e)}inYRange(t,e){return Bo(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}No.id="bar",No.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,pointStyle:void 0},No.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var Ho=Object.freeze({__proto__:null,ArcElement:vo,LineElement:Ao,PointElement:Ro,BarElement:No});function jo(t){t.data.datasets.forEach((t=>{if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}))}var $o={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void jo(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:a}=e,r=t.getDatasetMeta(o),l=s||e.data;if("y"===ze([a,t.options.indexAxis]))return;if("line"!==r.type)return;const c=t.scales[r.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let h,{start:d,count:u}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:a,max:r,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=Nt(ne(e,s.axis,a).lo,0,i-1)),n=c?Nt(ne(e,s.axis,r).hi+1,o,i)-o:i-o,{start:o,count:n}}(r,l);if(!(u<=4*n)){switch($(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":h=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,f,g,p=e;for(a[l++]=t[p],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*r)+1+e,m=Math.min(Math.floor((h+2)*r)+1,i)+e,x=m-c;for(n=c;n<m;n++)o+=t[n].x,s+=t[n].y;o/=x,s/=x;const b=Math.floor(h*r)+1+e,_=Math.floor((h+1)*r)+1+e,{x:y,y:v}=t[p];for(u=f=-1,n=b;n<_;n++)f=.5*Math.abs((y-o)*(t[n].y-v)-(y-t[n].x)*(s-v)),f>u&&(u=f,d=t[n],g=n);a[l++]=d,p=g}return a[l++]=t[c],a}(l,d,u,n,i);break;case"min-max":h=function(t,e,i,n){let o,s,a,r,l,c,h,d,u,f,g=0,p=0;const m=[],x=e+i-1,b=t[e].x,_=t[x].x-b;for(o=e;o<e+i;++o){s=t[o],a=(s.x-b)/_*n,r=s.y;const e=0|a;if(e===l)r<u?(u=r,c=o):r>f&&(f=r,h=o),g=(p*g+s.x)/++p;else{const i=o-1;if(!$(c)&&!$(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&m.push({...t[e],x:g}),n!==d&&n!==i&&m.push({...t[n],x:g})}o>0&&i!==d&&m.push(t[i]),m.push(s),l=e,p=0,u=f=r,c=h=d=o}}return m}(l,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=h}}))},destroy(t){jo(t)}};function Yo(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=K(i&&i.target,i);return void 0===n&&(n=!!e.backgroundColor),!1!==n&&null!==n&&(!0===n?"origin":n)}(t);if(U(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return X(o)&&Math.floor(o)===o?("-"!==n[0]&&"+"!==n[0]||(o=e+o),!(o===e||o<0||o>=i)&&o):["origin","start","end","stack"].indexOf(n)>=0&&n}class Uo{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:bt},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function Xo(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=[],a=n.reverse?e.max:e.min,r=n.reverse?e.min:e.max;let l,c,h;if(h="start"===i?a:"end"===i?r:U(i)?i.value:e.getBaseValue(),n.grid.circular)return c=e.getPointPositionForValue(0,a),new Uo({x:c.x,y:c.y,radius:e.getDistanceFromCenterForValue(h)});for(l=0;l<o;++l)s.push(e.getPointPositionForValue(l,h));return s}(t):function(t){const{scale:e={},fill:i}=t;let n,o=null;return"start"===i?o=e.bottom:"end"===i?o=e.top:U(i)?o=e.getPixelForValue(i.value):e.getBasePixel&&(o=e.getBasePixel()),X(o)?(n=e.isHorizontal(),{x:n?o:null,y:n?null:o}):null}(t)}function qo(t){const{chart:e,scale:i,index:n,line:o}=t,s=[],a=o.segments,r=o.points,l=function(t,e){const i=[],n=t.getSortedVisibleDatasetMetas();for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;Ko(o)&&i.unshift(o.dataset)}return i}(e,n);l.push(Qo({x:null,y:i.bottom},o));for(let t=0;t<a.length;t++){const e=a[t];for(let t=e.start;t<=e.end;t++)Go(s,r[t],l)}return new Ao({points:s,options:{}})}const Ko=t=>"line"===t.type&&!t.hidden;function Go(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:a,last:r,point:l}=Zo(s,e,"x");if(!(!l||a&&r))if(a)n.unshift(l);else if(t.push(l),!r)break}t.push(...n)}function Zo(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=a[e.start][i],c=a[e.end][i];if(o>=n&&o<=c){r=o===n,l=o===c;break}}return{first:r,last:l,point:n}}function Qo(t,e){let i=[],n=!1;return Y(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((t=>{const e=o[t.start],a=o[t.end];null!==n?(s.push({x:e.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:e.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new Ao({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function Jo(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!X(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function ts(t,e,i){t.beginPath(),e.path(t),t.lineTo(e.last().x,i),t.lineTo(e.first().x,i),t.closePath(),t.clip()}function es(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=Bt(o),s=Bt(s)),{property:t,start:o,end:s}}function is(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function ns(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:a,end:r}=i||{};"x"===s&&(t.beginPath(),t.rect(a,n,r-a,o-n),t.clip())}function os(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}function ss(t,e){const{line:i,target:n,property:o,color:s,scale:a}=e,r=function(t,e,i){const n=t.segments,o=t.points,s=e.points,a=[];for(const t of n){const n=es(i,o[t.start],o[t.end],t.loop);if(!e.segments){a.push({source:t,target:n,start:o[t.start],end:o[t.end]});continue}const r=vn(e,n);for(const e of r){const r=es(i,s[e.start],s[e.end],e.loop),l=yn(t,o,r);for(const t of l)a.push({source:t,target:e,start:{[i]:is(n,r,"start",Math.max)},end:{[i]:is(n,r,"end",Math.min)}})}}return a}(i,n,o);for(const{source:e,target:l,start:c,end:h}of r){const{style:{backgroundColor:r=s}={}}=e;t.save(),t.fillStyle=r,ns(t,a,es(o,c,h)),t.beginPath();const d=!!i.pathSegment(t,e);d?t.closePath():os(t,n,h,o);const u=!!n.pathSegment(t,l,{move:d,reverse:!0}),f=d&&u;f||os(t,n,c,o),t.closePath(),t.fill(f?"evenodd":"nonzero"),t.restore()}}function as(t,e,i){const n=function(t){const{chart:e,fill:i,line:n}=t;if(X(i))return function(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}(e,i);if("stack"===i)return qo(t);const o=Xo(t);return o instanceof Uo?o:Qo(o,n)}(e),{line:o,scale:s}=e,a=o.options,r=a.fill,l=a.backgroundColor,{above:c=l,below:h=l}=r||{};n&&o.points.length&&(Gt(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:a,scale:r}=e,l=i._loop?"angle":"x";t.save(),"x"===l&&s!==o&&(ts(t,n,a.top),ss(t,{line:i,target:n,color:o,scale:r,property:l}),t.restore(),t.save(),ts(t,n,a.bottom)),ss(t,{line:i,target:n,color:s,scale:r,property:l}),t.restore()}(t,{line:o,target:n,above:c,below:h,area:i,scale:s}),Zt(t))}var rs={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,a,r,l;for(a=0;a<n;++a)s=t.getDatasetMeta(a),r=s.dataset,l=null,r&&r.options&&r instanceof Ao&&(l={visible:t.isDatasetVisible(a),index:a,fill:Yo(r,a,n),chart:t,scale:s.vScale,line:r}),s.$filler=l,o.push(l);for(a=0;a<n;++a)l=o[a],l&&!1!==l.fill&&(l.fill=Jo(o,a,i.propagate))},beforeDatasetsDraw(t,e,i){const n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const s=n[e].$filler;s&&(s.line.updateControlPoints(o),"beforeDatasetsDraw"===i.drawTime&&as(t.ctx,s,o))}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;n&&!1!==n.fill&&"beforeDatasetDraw"===i.drawTime&&as(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const ls=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class cs extends Ri{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){const n=this;n.maxWidth=t,n.maxHeight=e,n._margins=i,n.setDimensions(),n.buildLabels(),n.fit()}setDimensions(){const t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height)}buildLabels(){const t=this,e=t.options.labels||{};let i=Q(e.generateLabels,[t.chart],t)||[];e.filter&&(i=i.filter((i=>e.filter(i,t.chart.data)))),e.sort&&(i=i.sort(((i,n)=>e.sort(i,n,t.chart.data)))),t.options.reverse&&i.reverse(),t.legendItems=i}fit(){const t=this,{options:e,ctx:i}=t;if(!e.display)return void(t.width=t.height=0);const n=e.labels,o=Fe(n.font),s=o.size,a=t._computeTitleHeight(),{boxWidth:r,itemHeight:l}=ls(n,s);let c,h;i.font=o.string,t.isHorizontal()?(c=t.maxWidth,h=t._fitRows(a,s,r,l)+10):(h=t.maxHeight,c=t._fitCols(a,s,r,l)+10),t.width=Math.min(c,e.maxWidth||t.maxWidth),t.height=Math.min(h,e.maxHeight||t.maxHeight)}_fitRows(t,e,i,n){const o=this,{ctx:s,maxWidth:a,options:{labels:{padding:r}}}=o,l=o.legendHitBoxes=[],c=o.lineWidths=[0],h=n+r;let d=t;s.textAlign="left",s.textBaseline="middle";let u=-1,f=-h;return o.legendItems.forEach(((t,o)=>{const g=i+e/2+s.measureText(t.text).width;(0===o||c[c.length-1]+g+2*r>a)&&(d+=h,c[c.length-(o>0?0:1)]=0,f+=h,u++),l[o]={left:0,top:f,row:u,width:g,height:n},c[c.length-1]+=g+r})),d}_fitCols(t,e,i,n){const o=this,{ctx:s,maxHeight:a,options:{labels:{padding:r}}}=o,l=o.legendHitBoxes=[],c=o.columnSizes=[],h=a-t;let d=r,u=0,f=0,g=0,p=0,m=0;return o.legendItems.forEach(((t,o)=>{const a=i+e/2+s.measureText(t.text).width;o>0&&f+e+2*r>h&&(d+=u+r,c.push({width:u,height:f}),g+=u+r,m++,p=0,u=f=0),u=Math.max(u,a),f+=e+r,l[o]={left:g,top:p,col:m,width:a,height:n},p+=n+r})),d+=u,c.push({width:u,height:f}),d}adjustHitBoxes(){const t=this;if(!t.options.display)return;const e=t._computeTitleHeight(),{legendHitBoxes:i,options:{align:n,labels:{padding:s}}}=t;if(this.isHorizontal()){let a=0,r=o(n,t.left+s,t.right-t.lineWidths[a]);for(const l of i)a!==l.row&&(a=l.row,r=o(n,t.left+s,t.right-t.lineWidths[a])),l.top+=t.top+e+s,l.left=r,r+=l.width+s}else{let a=0,r=o(n,t.top+e+s,t.bottom-t.columnSizes[a].height);for(const l of i)l.col!==a&&(a=l.col,r=o(n,t.top+e+s,t.bottom-t.columnSizes[a].height)),l.top=r,l.left+=t.left+s,r+=l.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){const t=this;if(t.options.display){const e=t.ctx;Gt(e,t),t._draw(),Zt(e)}}_draw(){const t=this,{options:e,columnSizes:i,lineWidths:n,ctx:a}=t,{align:r,labels:l}=e,c=mt.color,h=pn(e.rtl,t.left,t.width),d=Fe(l.font),{color:u,padding:f}=l,g=d.size,p=g/2;let m;t.drawTitle(),a.textAlign=h.textAlign("left"),a.textBaseline="middle",a.lineWidth=.5,a.font=d.string;const{boxWidth:x,boxHeight:b,itemHeight:_}=ls(l,g),y=t.isHorizontal(),v=this._computeTitleHeight();m=y?{x:o(r,t.left+f,t.right-n[0]),y:t.top+f+v,line:0}:{x:t.left+f,y:o(r,t.top+v+f,t.bottom-i[0].height),line:0},mn(t.ctx,e.textDirection);const w=_+f;t.legendItems.forEach(((e,M)=>{a.strokeStyle=e.fontColor||u,a.fillStyle=e.fontColor||u;const k=a.measureText(e.text).width,S=h.textAlign(e.textAlign||(e.textAlign=l.textAlign)),P=x+g/2+k;let D=m.x,C=m.y;h.setWidth(t.width),y?M>0&&D+P+f>t.right&&(C=m.y+=w,m.line++,D=m.x=o(r,t.left+f,t.right-n[m.line])):M>0&&C+w>t.bottom&&(D=m.x=D+i[m.line].width+f,m.line++,C=m.y=o(r,t.top+v+f,t.bottom-i[m.line].height));!function(t,e,i){if(isNaN(x)||x<=0||isNaN(b)||b<0)return;a.save();const n=K(i.lineWidth,1);if(a.fillStyle=K(i.fillStyle,c),a.lineCap=K(i.lineCap,"butt"),a.lineDashOffset=K(i.lineDashOffset,0),a.lineJoin=K(i.lineJoin,"miter"),a.lineWidth=n,a.strokeStyle=K(i.strokeStyle,c),a.setLineDash(K(i.lineDash,[])),l.usePointStyle){const o={radius:x*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},s=h.xPlus(t,x/2);qt(a,o,s,e+p)}else{const o=e+Math.max((g-b)/2,0),s=h.leftForLtr(t,x),r=Ee(i.borderRadius);a.beginPath(),Object.values(r).some((t=>0!==t))?ee(a,{x:s,y:o,w:x,h:b,radius:r}):a.rect(s,o,x,b),a.fill(),0!==n&&a.stroke()}a.restore()}(h.x(D),C,e),D=s(S,D+x+p,t.right),function(t,e,i){te(a,i.text,t,e+_/2,d,{strikethrough:i.hidden,textAlign:i.textAlign})}(h.x(D),C,e),y?m.x+=P+f:m.y+=w})),xn(t.ctx,e.textDirection)}drawTitle(){const t=this,e=t.options,i=e.title,s=Fe(i.font),a=Ie(i.padding);if(!i.display)return;const r=pn(e.rtl,t.left,t.width),l=t.ctx,c=i.position,h=s.size/2,d=a.top+h;let u,f=t.left,g=t.width;if(this.isHorizontal())g=Math.max(...t.lineWidths),u=t.top+d,f=o(e.align,f,t.right-g);else{const i=t.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);u=d+o(e.align,t.top,t.bottom-i-e.labels.padding-t._computeTitleHeight())}const p=o(c,f,f+g);l.textAlign=r.textAlign(n(c)),l.textBaseline="middle",l.strokeStyle=i.color,l.fillStyle=i.color,l.font=s.string,te(l,i.text,p,u,s)}_computeTitleHeight(){const t=this.options.title,e=Fe(t.font),i=Ie(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){const i=this;let n,o,s;if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)for(s=i.legendHitBoxes,n=0;n<s.length;++n)if(o=s[n],t>=o.left&&t<=o.left+o.width&&e>=o.top&&e<=o.top+o.height)return i.legendItems[n];return null}handleEvent(t){const e=this,i=e.options;if(!function(t,e){if("mousemove"===t&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,i))return;const n=e._getLegendItemAt(t.x,t.y);if("mousemove"===t.type){const a=e._hoveredItem,r=(s=n,null!==(o=a)&&null!==s&&o.datasetIndex===s.datasetIndex&&o.index===s.index);a&&!r&&Q(i.onLeave,[t,a,e],e),e._hoveredItem=n,n&&!r&&Q(i.onHover,[t,n,e],e)}else n&&Q(i.onClick,[t,n,e],e);var o,s}}var hs={id:"legend",_element:cs,start(t,e,i){const n=t.legend=new cs({ctx:t.ctx,options:i,chart:t});Ke.configure(t,n,i),Ke.addBox(t,n)},stop(t){Ke.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;Ke.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const a=t.controller.getStyle(i?0:void 0),r=Ie(a.borderWidth);return{text:e[t.index].label,fillStyle:a.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:(r.width+r.height)/4,strokeStyle:a.borderColor,pointStyle:n||a.pointStyle,rotation:a.rotation,textAlign:o||a.textAlign,borderRadius:0,datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class ds extends Ri{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this,n=i.options;if(i.left=0,i.top=0,!n.display)return void(i.width=i.height=i.right=i.bottom=0);i.width=i.right=t,i.height=i.bottom=e;const o=Y(n.text)?n.text.length:1;i._padding=Ie(n.padding);const s=o*Fe(n.font).lineHeight+i._padding.height;i.isHorizontal()?i.height=s:i.width=s}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:s,options:a}=this,r=a.align;let l,c,h,d=0;return this.isHorizontal()?(c=o(r,i,s),h=e+t,l=s-i):("left"===a.position?(c=i+t,h=o(r,n,e),d=-.5*xt):(c=s-t,h=o(r,e,n),d=.5*xt),l=n-e),{titleX:c,titleY:h,maxWidth:l,rotation:d}}draw(){const t=this,e=t.ctx,i=t.options;if(!i.display)return;const o=Fe(i.font),s=o.lineHeight/2+t._padding.top,{titleX:a,titleY:r,maxWidth:l,rotation:c}=t._drawArgs(s);te(e,i.text,0,0,o,{color:i.color,maxWidth:l,rotation:c,textAlign:n(i.align),textBaseline:"middle",translation:[a,r]})}}var us={id:"title",_element:ds,start(t,e,i){!function(t,e){const i=new ds({ctx:t.ctx,options:e,chart:t});Ke.configure(t,i,e),Ke.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Ke.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;Ke.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const fs={average(t){if(!t.length)return!1;let e,i,n=0,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n+=t.x,o+=t.y,++s}}return{x:n/s,y:o/s}},nearest(t,e){let i,n,o,s=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=zt(e,n.getCenterPoint());t<r&&(r=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,a=t.y}return{x:s,y:a}}};function gs(t,e){return e&&(Y(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function ps(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function ms(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:a,value:r}=s.getLabelAndValue(o);return{chart:t,label:a,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:r,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function xs(t,e){const i=t._chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:a,boxHeight:r}=e,l=Fe(e.bodyFont),c=Fe(e.titleFont),h=Fe(e.footerFont),d=s.length,u=o.length,f=n.length,g=Ie(e.padding);let p=g.height,m=0,x=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(x+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),x){p+=f*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(x-f)*l.lineHeight+(x-1)*e.bodySpacing}u&&(p+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let b=0;const _=function(t){m=Math.max(m,i.measureText(t).width+b)};return i.save(),i.font=c.string,J(t.title,_),i.font=l.string,J(t.beforeBody.concat(t.afterBody),_),b=e.displayColors?a+2:0,J(n,(t=>{J(t.before,_),J(t.lines,_),J(t.after,_)})),b=0,i.font=h.string,J(t.footer,_),i.restore(),m+=g.width,{width:m,height:p}}function bs(t,e,i,n){const{x:o,width:s}=i,{width:a,chartArea:{left:r,right:l}}=t;let c="center";return"center"===n?c=o<=(r+l)/2?"left":"right":o<=s/2?c="left":o>=a-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,a=i.caretSize+i.caretPadding;return"left"===t&&o+s+a>e.width||"right"===t&&o-s-a<0||void 0}(c,t,e,i)&&(c="center"),c}function _s(t,e,i){const n=e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:e.xAlign||bs(t,e,i,n),yAlign:n}}function ys(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,c=o+s,h=a+s;let d=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,r);const u=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===r?d+=c:"right"===r&&(d-=c):"left"===r?d-=h:"right"===r&&(d+=h),{x:Nt(d,0,n.width-e.width),y:Nt(u,0,n.height-e.height)}}function vs(t,e,i){const n=Ie(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function ws(t){return gs([],ps(t))}function Ms(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class ks extends Ri{constructor(t){super(),this.opacity=0,this._active=[],this._chart=t._chart,this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this,e=t._cachedAnimations;if(e)return e;const i=t._chart,n=t.options.setContext(t.getContext()),o=n.enabled&&i.options.animation&&n.animations,s=new yi(t._chart,o);return o._cacheable&&(t._cachedAnimations=Object.freeze(s)),s}getContext(){const t=this;return t.$context||(t.$context=(e=t._chart.getContext(),i=t,n=t._tooltipItems,Object.assign(Object.create(e),{tooltip:i,tooltipItems:n,type:"tooltip"})));var e,i,n}getTitle(t,e){const i=this,{callbacks:n}=e,o=n.beforeTitle.apply(i,[t]),s=n.title.apply(i,[t]),a=n.afterTitle.apply(i,[t]);let r=[];return r=gs(r,ps(o)),r=gs(r,ps(s)),r=gs(r,ps(a)),r}getBeforeBody(t,e){return ws(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const i=this,{callbacks:n}=e,o=[];return J(t,(t=>{const e={before:[],lines:[],after:[]},s=Ms(n,t);gs(e.before,ps(s.beforeLabel.call(i,t))),gs(e.lines,s.label.call(i,t)),gs(e.after,ps(s.afterLabel.call(i,t))),o.push(e)})),o}getAfterBody(t,e){return ws(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const i=this,{callbacks:n}=e,o=n.beforeFooter.apply(i,[t]),s=n.footer.apply(i,[t]),a=n.afterFooter.apply(i,[t]);let r=[];return r=gs(r,ps(o)),r=gs(r,ps(s)),r=gs(r,ps(a)),r}_createItems(t){const e=this,i=e._active,n=e._chart.data,o=[],s=[],a=[];let r,l,c=[];for(r=0,l=i.length;r<l;++r)c.push(ms(e._chart,i[r]));return t.filter&&(c=c.filter(((e,i,o)=>t.filter(e,i,o,n)))),t.itemSort&&(c=c.sort(((e,i)=>t.itemSort(e,i,n)))),J(c,(i=>{const n=Ms(t.callbacks,i);o.push(n.labelColor.call(e,i)),s.push(n.labelPointStyle.call(e,i)),a.push(n.labelTextColor.call(e,i))})),e.labelColors=o,e.labelPointStyles=s,e.labelTextColors=a,e.dataPoints=c,c}update(t,e){const i=this,n=i.options.setContext(i.getContext()),o=i._active;let s,a=[];if(o.length){const t=fs[n.position].call(i,o,i._eventPosition);a=i._createItems(n),i.title=i.getTitle(a,n),i.beforeBody=i.getBeforeBody(a,n),i.body=i.getBody(a,n),i.afterBody=i.getAfterBody(a,n),i.footer=i.getFooter(a,n);const e=i._size=xs(i,n),r=Object.assign({},t,e),l=_s(i._chart,n,r),c=ys(n,r,l,i._chart);i.xAlign=l.xAlign,i.yAlign=l.yAlign,s={opacity:1,x:c.x,y:c.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==i.opacity&&(s={opacity:0});i._tooltipItems=a,i.$context=void 0,s&&i._resolveAnimations().update(i,s),t&&n.external&&n.external.call(i,{chart:i._chart,tooltip:i,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{cornerRadius:s,caretSize:a}=i,{x:r,y:l}=t,{width:c,height:h}=e;let d,u,f,g,p,m;return"center"===o?(p=l+h/2,"left"===n?(d=r,u=d-a,g=p+a,m=p-a):(d=r+c,u=d+a,g=p-a,m=p+a),f=d):(u="left"===n?r+s+a:"right"===n?r+c-s-a:this.caretX,"top"===o?(g=l,p=g-a,d=u-a,f=u+a):(g=l+h,p=g+a,d=u+a,f=u-a),m=g),{x1:d,x2:u,x3:f,y1:g,y2:p,y3:m}}drawTitle(t,e,i){const n=this,o=n.title,s=o.length;let a,r,l;if(s){const c=pn(i.rtl,n.x,n.width);for(t.x=vs(n,i.titleAlign,i),e.textAlign=c.textAlign(i.titleAlign),e.textBaseline="middle",a=Fe(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=a.string,l=0;l<s;++l)e.fillText(o[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r,l+1===s&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this,a=s.labelColors[i],r=s.labelPointStyles[i],{boxHeight:l,boxWidth:c}=o,h=Fe(o.bodyFont),d=vs(s,"left",o),u=n.x(d),f=l<h.lineHeight?(h.lineHeight-l)/2:0,g=e.y+f;if(o.usePointStyle){const e={radius:Math.min(c,l)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(u,c)+c/2,s=g+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,qt(t,e,i,s),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,qt(t,e,i,s)}else{t.lineWidth=a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const e=n.leftForLtr(u,c),i=n.leftForLtr(n.xPlus(u,1),c-2),s=Ee(a.borderRadius);Object.values(s).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ee(t,{x:e,y:g,w:c,h:l,radius:s}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ee(t,{x:i,y:g+1,w:c-2,h:l-2,radius:s}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,g,c,l),t.strokeRect(e,g,c,l),t.fillStyle=a.backgroundColor,t.fillRect(i,g+1,c-2,l-2))}t.fillStyle=s.labelTextColors[i]}drawBody(t,e,i){const n=this,{body:o}=n,{bodySpacing:s,bodyAlign:a,displayColors:r,boxHeight:l,boxWidth:c}=i,h=Fe(i.bodyFont);let d=h.lineHeight,u=0;const f=pn(i.rtl,n.x,n.width),g=function(i){e.fillText(i,f.x(t.x+u),t.y+d/2),t.y+=d+s},p=f.textAlign(a);let m,x,b,_,y,v,w;for(e.textAlign=a,e.textBaseline="middle",e.font=h.string,t.x=vs(n,p,i),e.fillStyle=i.bodyColor,J(n.beforeBody,g),u=r&&"right"!==p?"center"===a?c/2+1:c+2:0,_=0,v=o.length;_<v;++_){for(m=o[_],x=n.labelTextColors[_],e.fillStyle=x,J(m.before,g),b=m.lines,r&&b.length&&(n._drawColorBox(e,t,_,f,i),d=Math.max(h.lineHeight,l)),y=0,w=b.length;y<w;++y)g(b[y]),d=h.lineHeight;J(m.after,g)}u=0,d=h.lineHeight,J(n.afterBody,g),t.y-=s}drawFooter(t,e,i){const n=this,o=n.footer,s=o.length;let a,r;if(s){const l=pn(i.rtl,n.x,n.width);for(t.x=vs(n,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=l.textAlign(i.footerAlign),e.textBaseline="middle",a=Fe(i.footerFont),e.fillStyle=i.footerColor,e.font=a.string,r=0;r<s;++r)e.fillText(o[r],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:a,y:r}=t,{width:l,height:c}=i,h=n.cornerRadius;e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(a+h,r),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(a+l-h,r),e.quadraticCurveTo(a+l,r,a+l,r+h),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(a+l,r+c-h),e.quadraticCurveTo(a+l,r+c,a+l-h,r+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(a+h,r+c),e.quadraticCurveTo(a,r+c,a,r+c-h),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(a,r+h),e.quadraticCurveTo(a,r,a+h,r),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this,i=e._chart,n=e.$animations,o=n&&n.x,s=n&&n.y;if(o||s){const n=fs[t.position].call(e,e._active,e._eventPosition);if(!n)return;const a=e._size=xs(e,t),r=Object.assign({},n,e._size),l=_s(i,t,r),c=ys(t,r,l,i);o._to===c.x&&s._to===c.y||(e.xAlign=l.xAlign,e.yAlign=l.yAlign,e.width=a.width,e.height=a.height,e.caretX=n.x,e.caretY=n.y,e._resolveAnimations().update(e,c))}}draw(t){const e=this,i=e.options.setContext(e.getContext());let n=e.opacity;if(!n)return;e._updateAnimationTarget(i);const o={width:e.width,height:e.height},s={x:e.x,y:e.y};n=Math.abs(n)<.001?0:n;const a=Ie(i.padding),r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;i.enabled&&r&&(t.save(),t.globalAlpha=n,e.drawBackground(s,t,o,i),mn(t,i.textDirection),s.y+=a.top,e.drawTitle(s,t,i),e.drawBody(s,t,i),e.drawFooter(s,t,i),xn(t,i.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this,n=i._active,o=t.map((({datasetIndex:t,index:e})=>{const n=i._chart.getDatasetMeta(t);if(!n)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:n.data[e],index:e}})),s=!tt(n,o),a=i._positionChanged(o,e);(s||a)&&(i._active=o,i._eventPosition=e,i.update(!0))}handleEvent(t,e){const i=this,n=i.options,o=i._active||[];let s=!1,a=[];"mouseout"!==t.type&&(a=i._chart.getElementsAtEventForMode(t,n.mode,n,e),n.reverse&&a.reverse());const r=i._positionChanged(a,t);return s=e||!tt(a,o)||r,s&&(i._active=a,(n.enabled||n.external)&&(i._eventPosition={x:t.x,y:t.y},i.update(!0,e))),s}_positionChanged(t,e){const i=this,n=fs[i.options.position].call(i,t,e);return i.caretX!==n.x||i.caretY!==n.y}}ks.positioners=fs;var Ss={id:"tooltip",_element:ks,positioners:fs,afterInit(t,e,i){i&&(t.tooltip=new ks({_chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip,i={tooltip:e};!1!==t.notifyPlugins("beforeTooltipDraw",i)&&(e&&e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i))},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:H,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:H,beforeBody:H,beforeLabel:H,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return $(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:H,afterBody:H,beforeFooter:H,footer:H,afterFooter:H}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Ps=Object.freeze({__proto__:null,Decimation:$o,Filler:rs,Legend:hs,Title:us,Tooltip:Ss});function Ds(t,e,i){const n=t.indexOf(e);if(-1===n)return((t,e,i)=>"string"==typeof e?t.push(e)-1:isNaN(e)?null:i)(t,e,i);return n!==t.lastIndexOf(e)?i:n}class Cs extends Yi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0}parse(t,e){if($(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Nt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:Ds(i,t,K(e,t)),i.length-1)}determineDataLimits(){const t=this,{minDefined:e,maxDefined:i}=t.getUserBounds();let{min:n,max:o}=t.getMinMax(!0);"ticks"===t.options.bounds&&(e||(n=0),i||(o=t.getLabels().length-1)),t.min=n,t.max=o}buildTicks(){const t=this,e=t.min,i=t.max,n=t.options.offset,o=[];let s=t.getLabels();s=0===e&&i===s.length-1?s:s.slice(e,i+1),t._valueRange=Math.max(s.length-(n?0:1),1),t._startValue=t.min-(n?.5:0);for(let t=e;t<=i;t++)o.push({value:t});return o}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){const t=this;super.configure(),t.isHorizontal()||(t._reversePixels=!t._reversePixels)}getPixelForValue(t){const e=this;return"number"!=typeof t&&(t=e.parse(t)),null===t?NaN:e.getPixelForDecimal((t-e._startValue)/e._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){const e=this;return Math.round(e._startValue+e.getDecimalForPixel(t)*e._valueRange)}getBasePixel(){return this.bottom}}Cs.id="category",Cs.defaults={ticks:{callback:Cs.prototype.getLabelForValue}};class Os extends Yi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return $(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const t=this,{beginAtZero:e,stacked:i}=t.options,{minDefined:n,maxDefined:o}=t.getUserBounds();let{min:s,max:a}=t;const r=t=>s=n?s:t,l=t=>a=o?a:t;if(e||i){const t=Pt(s),e=Pt(a);t<0&&e<0?l(0):t>0&&e>0&&r(0)}s===a&&(l(a+1),e||r(s-1)),t.min=s,t.max=a}getTickLimit(){const t=this,e=t.options.ticks;let i,{maxTicksLimit:n,stepSize:o}=e;return o?i=Math.ceil(t.max/o)-Math.floor(t.min/o)+1:(i=t.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this,e=t.options,i=e.ticks;let n=t.getTickLimit();n=Math.max(2,n);const o=function(t,e){const i=[],{step:n,min:o,max:s,precision:a,count:r,maxTicks:l}=t,c=n||1,h=l-1,{min:d,max:u}=e,f=!$(o),g=!$(s),p=!$(r);let m,x,b,_,y=Dt((u-d)/h/c)*c;if(y<1e-14&&!f&&!g)return[{value:d},{value:u}];_=Math.ceil(u/y)-Math.floor(d/y),_>h&&(y=Dt(_*y/h/c)*c),$(a)||(m=Math.pow(10,a),y=Math.ceil(y*m)/m),x=Math.floor(d/y)*y,b=Math.ceil(u/y)*y,f&&g&&n&&Tt((s-o)/n,y/1e3)?(_=Math.min((s-o)/y,l),y=(s-o)/_,x=o,b=s):p?(x=f?o:x,b=g?s:b,_=r-1,y=(b-x)/_):(_=(b-x)/y,_=At(_,Math.round(_),y/1e3)?Math.round(_):Math.ceil(_)),m=Math.pow(10,$(a)?It(y):a),x=Math.round(x*m)/m,b=Math.round(b*m)/m;let v=0;for(f&&(i.push({value:o}),x<=o&&v++,At(Math.round((x+v*y)*m)/m,o,y/10)&&v++);v<_;++v)i.push({value:Math.round((x+v*y)*m)/m});return g?At(i[i.length-1].value,s,y/10)?i[i.length-1].value=s:i.push({value:s}):i.push({value:b}),i}({maxTicks:n,min:e.min,max:e.max,precision:i.precision,step:i.stepSize,count:i.count},Ve(t,e.grace));return"ticks"===e.bounds&&Rt(o,t,"value"),e.reverse?(o.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),o}configure(){const t=this,e=t.ticks;let i=t.min,n=t.max;if(super.configure(),t.options.offset&&e.length){const t=(n-i)/Math.max(e.length-1,1)/2;i-=t,n+=t}t._startValue=i,t._endValue=n,t._valueRange=n-i}getLabelForValue(t){return Ei(t,this.chart.options.locale)}}class As extends Os{determineDataLimits(){const t=this,{min:e,max:i}=t.getMinMax(!0);t.min=X(e)?e:0,t.max=X(i)?i:1,t.handleTickRangeOptions()}computeTickLimit(){const t=this;if(t.isHorizontal())return Math.ceil(t.width/40);const e=t._resolveTickFontOptions(0);return Math.ceil(t.height/e.lineHeight)}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function Ts(t){return 1===t/Math.pow(10,Math.floor(St(t)))}As.id="linear",As.defaults={ticks:{callback:Fi.formatters.numeric}};class Rs extends Yi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Os.prototype.parse.apply(this,[t,e]);if(0!==i)return X(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const t=this,{min:e,max:i}=t.getMinMax(!0);t.min=X(e)?Math.max(0,e):null,t.max=X(i)?Math.max(0,i):null,t.options.beginAtZero&&(t._zero=!0),t.handleTickRangeOptions()}handleTickRangeOptions(){const t=this,{minDefined:e,maxDefined:i}=t.getUserBounds();let n=t.min,o=t.max;const s=t=>n=e?n:t,a=t=>o=i?o:t,r=(t,e)=>Math.pow(10,Math.floor(St(t))+e);n===o&&(n<=0?(s(1),a(10)):(s(r(n,-1)),a(r(o,1)))),n<=0&&s(r(o,-1)),o<=0&&a(r(n,1)),t._zero&&t.min!==t._suggestedMin&&n===r(t.min,0)&&s(r(n,-1)),t.min=n,t.max=o}buildTicks(){const t=this,e=t.options,i=function(t,e){const i=Math.floor(St(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),o=[];let s=q(t.min,Math.pow(10,Math.floor(St(e.min)))),a=Math.floor(St(s)),r=Math.floor(s/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{o.push({value:s,major:Ts(s)}),++r,10===r&&(r=1,++a,l=a>=0?1:l),s=Math.round(r*Math.pow(10,a)*l)/l}while(a<i||a===i&&r<n);const c=q(t.max,s);return o.push({value:c,major:Ts(s)}),o}({min:t._userMin,max:t._userMax},t);return"ticks"===e.bounds&&Rt(i,t,"value"),e.reverse?(i.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max),i}getLabelForValue(t){return void 0===t?"0":Ei(t,this.chart.options.locale)}configure(){const t=this,e=t.min;super.configure(),t._startValue=St(e),t._valueRange=St(t.max)-St(e)}getPixelForValue(t){const e=this;return void 0!==t&&0!==t||(t=e.min),null===t||isNaN(t)?NaN:e.getPixelForDecimal(t===e.min?0:(St(t)-e._startValue)/e._valueRange)}getValueForPixel(t){const e=this,i=e.getDecimalForPixel(t);return Math.pow(10,e._startValue+i*e._valueRange)}}function Ls(t){const e=t.ticks;if(e.display&&t.display){const t=Ie(e.backdropPadding);return K(e.font&&e.font.size,mt.font.size)+t.height}return 0}function Es(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function Is(t){return 0===t||180===t?"center":t<180?"left":"right"}function Fs(t,e,i){90===t||270===t?i.y-=e.h/2:(t>270||t<90)&&(i.y-=e.h)}function zs(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,bt);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}function Vs(t){return Ot(t)?t:0}Rs.id="logarithmic",Rs.defaults={ticks:{callback:Fi.formatters.logarithmic,major:{enabled:!0}}};class Bs extends Os{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=Ls(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2}determineDataLimits(){const t=this,{min:e,max:i}=t.getMinMax(!1);t.min=X(e)&&!isNaN(e)?e:0,t.max=X(i)&&!isNaN(i)?i:0,t.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Ls(this.options))}generateTickLabels(t){const e=this;Os.prototype.generateTickLabels.call(e,t),e._pointLabels=e.getLabels().map(((t,i)=>{const n=Q(e.options.pointLabels.callback,[t,i],e);return n||0===n?n:""}))}fit(){const t=this,e=t.options;e.display&&e.pointLabels.display?function(t){const e={l:0,r:t.width,t:0,b:t.height-t.paddingTop},i={};let n,o,s;const a=[],r=[],l=t.getLabels().length;for(n=0;n<l;n++){const l=t.options.pointLabels.setContext(t.getContext(n));r[n]=l.padding,s=t.getPointPosition(n,t.drawingArea+r[n]);const u=Fe(l.font);t.ctx.font=u.string,c=t.ctx,h=u.lineHeight,o=Y(d=t._pointLabels[n])?{w:Yt(c,c.font,d),h:d.length*h}:{w:c.measureText(d).width,h:h},a[n]=o;const f=t.getIndexAngle(n),g=Et(f),p=Es(g,s.x,o.w,0,180),m=Es(g,s.y,o.h,90,270);p.start<e.l&&(e.l=p.start,i.l=f),p.end>e.r&&(e.r=p.end,i.r=f),m.start<e.t&&(e.t=m.start,i.t=f),m.end>e.b&&(e.b=m.end,i.b=f)}var c,h,d;t._setReductions(t.drawingArea,e,i),t._pointLabelItems=[];const u=t.options,f=Ls(u),g=t.getDistanceFromCenterForValue(u.ticks.reverse?t.min:t.max);for(n=0;n<l;n++){const e=0===n?f/2:0,i=t.getPointPosition(n,g+e+r[n]),o=Et(t.getIndexAngle(n)),s=a[n];Fs(o,s,i);const l=Is(o);let c;c="left"===l?i.x:"center"===l?i.x-s.w/2:i.x-s.w;const h=c+s.w;t._pointLabelItems[n]={x:i.x,y:i.y,textAlign:l,left:c,top:i.y,right:h,bottom:i.y+s.h}}}(t):t.setCenterPoint(0,0,0,0)}_setReductions(t,e,i){const n=this;let o=e.l/Math.sin(i.l),s=Math.max(e.r-n.width,0)/Math.sin(i.r),a=-e.t/Math.cos(i.t),r=-Math.max(e.b-(n.height-n.paddingTop),0)/Math.cos(i.b);o=Vs(o),s=Vs(s),a=Vs(a),r=Vs(r),n.drawingArea=Math.max(t/2,Math.min(Math.floor(t-(o+s)/2),Math.floor(t-(a+r)/2))),n.setCenterPoint(o,s,a,r)}setCenterPoint(t,e,i,n){const o=this,s=o.width-e-o.drawingArea,a=t+o.drawingArea,r=i+o.drawingArea,l=o.height-o.paddingTop-n-o.drawingArea;o.xCenter=Math.floor((a+s)/2+o.left),o.yCenter=Math.floor((r+l)/2+o.top+o.paddingTop)}getIndexAngle(t){return Bt(t*(bt/this.getLabels().length)+Lt(this.options.startAngle||0))}getDistanceFromCenterForValue(t){const e=this;if($(t))return NaN;const i=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*i:(t-e.min)*i}getValueForDistanceFromCenter(t){if($(t))return NaN;const e=this,i=t/(e.drawingArea/(e.max-e.min));return e.options.reverse?e.max-i:e.min+i}getPointPosition(t,e){const i=this,n=i.getIndexAngle(t)-wt;return{x:Math.cos(n)*e+i.xCenter,y:Math.sin(n)*e+i.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const t=this,{backgroundColor:e,grid:{circular:i}}=t.options;if(e){const n=t.ctx;n.save(),n.beginPath(),zs(t,t.getDistanceFromCenterForValue(t._endValue),i,t.getLabels().length),n.closePath(),n.fillStyle=e,n.fill(),n.restore()}}drawGrid(){const t=this,e=t.ctx,i=t.options,{angleLines:n,grid:o}=i,s=t.getLabels().length;let a,r,l;if(i.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=n.setContext(t.getContext(o)),s=Fe(e.font),{x:a,y:r,textAlign:l,left:c,top:h,right:d,bottom:u}=t._pointLabelItems[o],{backdropColor:f}=e;if(!$(f)){const t=Ie(e.backdropPadding);i.fillStyle=f,i.fillRect(c-t.left,h-t.top,d-c+t.width,u-h+t.height)}te(i,t._pointLabels[o],a,r+s.lineHeight/2,s,{color:e.color,textAlign:l,textBaseline:"middle"})}}(t,s),o.display&&t.ticks.forEach(((e,i)=>{if(0!==i){r=t.getDistanceFromCenterForValue(e.value);const n=o.setContext(t.getContext(i-1));!function(t,e,i,n){const o=t.ctx,s=e.circular,{color:a,lineWidth:r}=e;!s&&!n||!a||!r||i<0||(o.save(),o.strokeStyle=a,o.lineWidth=r,o.setLineDash(e.borderDash),o.lineDashOffset=e.borderDashOffset,o.beginPath(),zs(t,i,s,n),o.closePath(),o.stroke(),o.restore())}(t,n,r,s)}})),n.display){for(e.save(),a=t.getLabels().length-1;a>=0;a--){const o=n.setContext(t.getContext(a)),{color:s,lineWidth:c}=o;c&&s&&(e.lineWidth=c,e.strokeStyle=s,e.setLineDash(o.borderDash),e.lineDashOffset=o.borderDashOffset,r=t.getDistanceFromCenterForValue(i.ticks.reverse?t.min:t.max),l=t.getPointPosition(a,r),e.beginPath(),e.moveTo(t.xCenter,t.yCenter),e.lineTo(l.x,l.y),e.stroke())}e.restore()}}drawLabels(){const t=this,e=t.ctx,i=t.options,n=i.ticks;if(!n.display)return;const o=t.getIndexAngle(0);let s,a;e.save(),e.translate(t.xCenter,t.yCenter),e.rotate(o),e.textAlign="center",e.textBaseline="middle",t.ticks.forEach(((o,r)=>{if(0===r&&!i.reverse)return;const l=n.setContext(t.getContext(r)),c=Fe(l.font);if(s=t.getDistanceFromCenterForValue(t.ticks[r].value),l.showLabelBackdrop){a=e.measureText(o.label).width,e.fillStyle=l.backdropColor;const t=Ie(l.backdropPadding);e.fillRect(-a/2-t.left,-s-c.size/2-t.top,a+t.width,c.size+t.height)}te(e,o.label,0,-s,c,{color:l.color})})),e.restore()}drawTitle(){}}Bs.id="radialLinear",Bs.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPadding:2,callback:Fi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5}},Bs.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},Bs.descriptors={angleLines:{_fallback:"grid"}};const Ws={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Ns=Object.keys(Ws);function Hs(t,e){return t-e}function js(t,e){if($(e))return null;const i=t._adapter,n=t.options.time,{parser:o,round:s,isoWeekday:a}=n;let r=e;return"function"==typeof o&&(r=o(r)),X(r)||(r="string"==typeof o?i.parse(r,o):i.parse(r)),null===r?null:(s&&(r="week"!==s||!Ot(a)&&!0!==a?i.startOf(r,s):i.startOf(r,"isoWeek",a)),+r)}function $s(t,e,i,n){const o=Ns.length;for(let s=Ns.indexOf(t);s<o-1;++s){const t=Ws[Ns[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return Ns[s]}return Ns[o-1]}function Ys(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=ie(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function Us(t,e,i){const n=[],o={},s=e.length;let a,r;for(a=0;a<s;++a)r=e[a],o[r]=a,n.push({value:r,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),a=e[e.length-1].value;let r,l;for(r=s;r<=a;r=+o.add(r,1,n))l=i[r],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class Xs extends Yi{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1}init(t,e){const i=t.time||(t.time={}),n=this._adapter=new eo._date(t.adapters.date);st(i.displayFormats,n.formats()),super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:js(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this,e=t.options,i=t._adapter,n=e.time.unit||"day";let{min:o,max:s,minDefined:a,maxDefined:r}=t.getUserBounds();function l(t){a||isNaN(t.min)||(o=Math.min(o,t.min)),r||isNaN(t.max)||(s=Math.max(s,t.max))}a&&r||(l(t._getLabelBounds()),"ticks"===e.bounds&&"labels"===e.ticks.source||l(t.getMinMax(!1))),o=X(o)&&!isNaN(o)?o:+i.startOf(Date.now(),n),s=X(s)&&!isNaN(s)?s:+i.endOf(Date.now(),n)+1,t.min=Math.min(o,s-1),t.max=Math.max(o+1,s)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this,e=t.options,i=e.time,n=e.ticks,o="labels"===n.source?t.getLabelTimestamps():t._generate();"ticks"===e.bounds&&o.length&&(t.min=t._userMin||o[0],t.max=t._userMax||o[o.length-1]);const s=t.min,a=se(o,s,t.max);return t._unit=i.unit||(n.autoSkip?$s(i.minUnit,t.min,t.max,t._getLabelCapacity(s)):function(t,e,i,n,o){for(let s=Ns.length-1;s>=Ns.indexOf(i);s--){const i=Ns[s];if(Ws[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return Ns[i?Ns.indexOf(i):0]}(t,a.length,i.minUnit,t.min,t.max)),t._majorUnit=n.major.enabled&&"year"!==t._unit?function(t){for(let e=Ns.indexOf(t)+1,i=Ns.length;e<i;++e)if(Ws[Ns[e]].common)return Ns[e]}(t._unit):void 0,t.initOffsets(o),e.reverse&&a.reverse(),Us(t,a,t._majorUnit)}initOffsets(t){const e=this;let i,n,o=0,s=0;e.options.offset&&t.length&&(i=e.getDecimalForValue(t[0]),o=1===t.length?1-i:(e.getDecimalForValue(t[1])-i)/2,n=e.getDecimalForValue(t[t.length-1]),s=1===t.length?n:(n-e.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;o=Nt(o,0,a),s=Nt(s,0,a),e._offsets={start:o,end:s,factor:1/(o+1+s)}}_generate(){const t=this,e=t._adapter,i=t.min,n=t.max,o=t.options,s=o.time,a=s.unit||$s(s.minUnit,i,n,t._getLabelCapacity(i)),r=K(s.stepSize,1),l="week"===a&&s.isoWeekday,c=Ot(l)||!0===l,h={};let d,u,f=i;if(c&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,c?"day":a),e.diff(n,i,a)>1e5*r)throw new Error(i+" and "+n+" are too far apart with stepSize of "+r+" "+a);const g="data"===o.ticks.source&&t.getDataTimestamps();for(d=f,u=0;d<n;d=+e.add(d,r,a),u++)Ys(h,d,g);return d!==n&&"ticks"!==o.bounds&&1!==u||Ys(h,d,g),Object.keys(h).sort(((t,e)=>t-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,n){const o=this,s=o.options,a=s.time.displayFormats,r=o._unit,l=o._majorUnit,c=r&&a[r],h=l&&a[l],d=i[e],u=l&&h&&d&&d.major,f=o._adapter.format(t,n||(u?h:c)),g=s.ticks.callback;return g?Q(g,[f,e,i],o):f}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){const e=this;return null===t?NaN:(t-e.min)/(e.max-e.min)}getPixelForValue(t){const e=this,i=e._offsets,n=e.getDecimalForValue(t);return e.getPixelForDecimal((i.start+n)*i.factor)}getValueForPixel(t){const e=this,i=e._offsets,n=e.getDecimalForPixel(t)/i.factor-i.end;return e.min+n*(e.max-e.min)}_getLabelSize(t){const e=this,i=e.options.ticks,n=e.ctx.measureText(t).width,o=Lt(e.isHorizontal()?i.maxRotation:i.minRotation),s=Math.cos(o),a=Math.sin(o),r=e._resolveTickFontOptions(0).size;return{w:n*s+r*a,h:n*a+r*s}}_getLabelCapacity(t){const e=this,i=e.options.time,n=i.displayFormats,o=n[i.unit]||n.millisecond,s=e._tickFormatFunction(t,0,Us(e,[t],e._majorUnit),o),a=e._getLabelSize(s),r=Math.floor(e.isHorizontal()?e.width/a.w:e.height/a.h)-1;return r>0?r:1}getDataTimestamps(){const t=this;let e,i,n=t._cache.data||[];if(n.length)return n;const o=t.getMatchingVisibleMetas();if(t._normalized&&o.length)return t._cache.data=o[0].controller.getAllParsedValues(t);for(e=0,i=o.length;e<i;++e)n=n.concat(o[e].controller.getAllParsedValues(t));return t._cache.data=t.normalize(n)}getLabelTimestamps(){const t=this,e=t._cache.labels||[];let i,n;if(e.length)return e;const o=t.getLabels();for(i=0,n=o.length;i<n;++i)e.push(js(t,o[i]));return t._cache.labels=t._normalized?e:t.normalize(e)}normalize(t){return ce(t.sort(Hs))}}function qs(t,e,i){let n,o,s,a;if(i)n=Math.floor(e),o=Math.ceil(e),s=t[n],a=t[o];else{const i=ie(t,e);s=i.lo,a=i.hi,n=t[s],o=t[a]}const r=o-n;return r?s+(a-s)*(e-n)/r:s}Xs.id="time",Xs.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class Ks extends Xs{constructor(t){super(t),this._table=[],this._maxIndex=void 0}initOffsets(){const t=this,e=t._getTimestampsForTable();t._table=t.buildLookupTable(e),t._maxIndex=t._table.length-1,super.initOffsets(e)}buildLookupTable(t){const{min:e,max:i}=this;if(!t.length)return[{time:e,pos:0},{time:i,pos:1}];const n=[e];let o,s,a;for(o=0,s=t.length;o<s;++o)a=t[o],a>e&&a<i&&n.push(a);return n.push(i),n}_getTimestampsForTable(){const t=this;let e=t._cache.all||[];if(e.length)return e;const i=t.getDataTimestamps(),n=t.getLabelTimestamps();return e=i.length&&n.length?t.normalize(i.concat(n)):i.length?i:n,e=t._cache.all=e,e}getPixelForValue(t,e){const i=this,n=i._offsets,o=i._normalized&&i._maxIndex>0&&!$(e)?e/i._maxIndex:i.getDecimalForValue(t);return i.getPixelForDecimal((n.start+o)*n.factor)}getDecimalForValue(t){return qs(this._table,t)/this._maxIndex}getValueForPixel(t){const e=this,i=e._offsets,n=e.getDecimalForPixel(t)/i.factor-i.end;return qs(e._table,n*this._maxIndex,!0)}}Ks.id="timeseries",Ks.defaults=Xs.defaults;var Gs=Object.freeze({__proto__:null,CategoryScale:Cs,LinearScale:As,LogarithmicScale:Rs,RadialLinearScale:Bs,TimeScale:Xs,TimeSeriesScale:Ks});return Gn.register(po,Gs,Ho,Ps),Gn.helpers={...Pn},Gn._adapters=eo,Gn.Animation=bi,Gn.Animations=yi,Gn.animator=a,Gn.controllers=Cn.controllers.items,Gn.DatasetController=Ti,Gn.Element=Ri,Gn.elements=Ho,Gn.Interaction=Ce,Gn.layouts=Ke,Gn.platforms=di,Gn.Scale=Yi,Gn.Ticks=Fi,Object.assign(Gn,po,Gs,Ho,Ps,di),Gn.Chart=Gn,"undefined"!=typeof window&&(window.Chart=Gn),Gn}));
1
  /*!
2
+ * Chart.js v3.7.1
3
  * https://www.chartjs.org
4
+ * (c) 2022 Chart.js Contributors
5
  * Released under the MIT License
6
  */
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";const t="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function e(e,i,s){const n=s||(t=>Array.prototype.slice.call(t));let o=!1,a=[];return function(...s){a=n(s),o||(o=!0,t.call(window,(()=>{o=!1,e.apply(i,a)})))}}function i(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const s=t=>"start"===t?"left":"end"===t?"right":"center",n=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,o=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;var a=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=t.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}};
8
  /*!
9
  * @kurkle/color v0.1.9
10
  * https://github.com/kurkle/color#readme
11
  * (c) 2020 Jukka Kurkela
12
  * Released under the MIT License
13
+ */const r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},l="0123456789ABCDEF",h=t=>l[15&t],c=t=>l[(240&t)>>4]+l[15&t],d=t=>(240&t)>>4==(15&t);function u(t){var e=function(t){return d(t.r)&&d(t.g)&&d(t.b)&&d(t.a)}(t)?h:c;return t?"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):""):t}function f(t){return t+.5|0}const g=(t,e,i)=>Math.max(Math.min(t,i),e);function p(t){return g(f(2.55*t),0,255)}function m(t){return g(f(255*t),0,255)}function x(t){return g(f(t/2.55)/100,0,1)}function b(t){return g(f(100*t),0,100)}const _=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const y=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function v(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function w(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function M(t,e,i){const s=v(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function k(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=n===e?(i-s)/h+(i<s?6:0):n===i?(s-e)/h+2:(e-i)/h+4,r=60*r+.5),[0|r,l||0,a]}function S(t,e,i,s){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,s)).map(m)}function P(t,e,i){return S(v,t,e,i)}function D(t){return(t%360+360)%360}function C(t){const e=y.exec(t);let i,s=255;if(!e)return;e[5]!==i&&(s=e[6]?p(+e[5]):m(+e[5]));const n=D(+e[2]),o=+e[3]/100,a=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return S(M,t,e,i)}(n,o,a):"hsv"===e[1]?function(t,e,i){return S(w,t,e,i)}(n,o,a):P(n,o,a),{r:i[0],g:i[1],b:i[2],a:s}}const O={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},A={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let T;function L(t){T||(T=function(){const t={},e=Object.keys(A),i=Object.keys(O);let s,n,o,a,r;for(s=0;s<e.length;s++){for(a=r=e[s],n=0;n<i.length;n++)o=i[n],r=r.replace(o,O[o]);o=parseInt(A[a],16),t[r]=[o>>16&255,o>>8&255,255&o]}return t}(),T.transparent=[0,0,0,0]);const e=T[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}function R(t,e,i){if(t){let s=k(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=P(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function E(t,e){return t?Object.assign(e||{},t):t}function I(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=m(t[3]))):(e=E(t,{r:0,g:0,b:0,a:1})).a=m(e.a),e}function z(t){return"r"===t.charAt(0)?function(t){const e=_.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=255&(e[8]?p(t):255*t)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?p(i):i),s=255&(e[4]?p(s):s),n=255&(e[6]?p(n):n),{r:i,g:s,b:n,a:o}}}(t):C(t)}class F{constructor(t){if(t instanceof F)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=I(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*r[s[1]],g:255&17*r[s[2]],b:255&17*r[s[3]],a:5===o?17*r[s[4]]:255}:7!==o&&9!==o||(n={r:r[s[1]]<<4|r[s[2]],g:r[s[3]]<<4|r[s[4]],b:r[s[5]]<<4|r[s[6]],a:9===o?r[s[7]]<<4|r[s[8]]:255})),i=n||L(t)||z(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=E(this._rgb);return t&&(t.a=x(t.a)),t}set rgb(t){this._rgb=I(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${x(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?u(this._rgb):this._rgb}hslString(){return this._valid?function(t){if(!t)return;const e=k(t),i=e[0],s=b(e[1]),n=b(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${x(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):this._rgb}mix(t,e){const i=this;if(t){const s=i.rgb,n=t.rgb;let o;const a=e===o?.5:e,r=2*a-1,l=s.a-n.a,h=((r*l==-1?r:(r+l)/(1+r*l))+1)/2;o=1-h,s.r=255&h*s.r+o*n.r+.5,s.g=255&h*s.g+o*n.g+.5,s.b=255&h*s.b+o*n.b+.5,s.a=a*s.a+(1-a)*n.a,i.rgb=s}return i}clone(){return new F(this.rgb)}alpha(t){return this._rgb.a=m(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=f(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return R(this._rgb,2,t),this}darken(t){return R(this._rgb,2,-t),this}saturate(t){return R(this._rgb,1,t),this}desaturate(t){return R(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=k(t);i[0]=D(i[0]+e),i=P(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function B(t){return new F(t)}const V=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function W(t){return V(t)?t:B(t)}function N(t){return V(t)?t:B(t).saturate(.5).darken(.1).hexString()}function H(){}const j=function(){let t=0;return function(){return t++}}();function $(t){return null==t}function Y(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.substr(0,7)&&"Array]"===e.substr(-6)}function U(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const X=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function q(t,e){return X(t)?t:e}function K(t,e){return void 0===t?e:t}const G=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,Z=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function J(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function Q(t,e,i,s){let n,o,a;if(Y(t))if(o=t.length,s)for(n=o-1;n>=0;n--)e.call(i,t[n],n);else for(n=0;n<o;n++)e.call(i,t[n],n);else if(U(t))for(a=Object.keys(t),o=a.length,n=0;n<o;n++)e.call(i,t[a[n]],a[n])}function tt(t,e){let i,s,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,s=t.length;i<s;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function et(t){if(Y(t))return t.map(et);if(U(t)){const e=Object.create(null),i=Object.keys(t),s=i.length;let n=0;for(;n<s;++n)e[i[n]]=et(t[i[n]]);return e}return t}function it(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function st(t,e,i,s){if(!it(t))return;const n=e[t],o=i[t];U(n)&&U(o)?nt(n,o,s):e[t]=et(o)}function nt(t,e,i){const s=Y(e)?e:[e],n=s.length;if(!U(t))return t;const o=(i=i||{}).merger||st;for(let a=0;a<n;++a){if(!U(e=s[a]))continue;const n=Object.keys(e);for(let s=0,a=n.length;s<a;++s)o(n[s],t,e,i)}return t}function ot(t,e){return nt(t,e,{merger:at})}function at(t,e,i){if(!it(t))return;const s=e[t],n=i[t];U(s)&&U(n)?ot(s,n):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=et(n))}function rt(t,e){const i=t.indexOf(".",e);return-1===i?t.length:i}function lt(t,e){if(""===e)return t;let i=0,s=rt(e,i);for(;t&&s>i;)t=t[e.substr(i,s-i)],i=s+1,s=rt(e,i);return t}function ht(t){return t.charAt(0).toUpperCase()+t.slice(1)}const ct=t=>void 0!==t,dt=t=>"function"==typeof t,ut=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function ft(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const gt=Object.create(null),pt=Object.create(null);function mt(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;e<s;++e){const s=i[e];t=t[s]||(t[s]=Object.create(null))}return t}function xt(t,e,i){return"string"==typeof e?nt(mt(t,e),i):nt(mt(t,""),e)}var bt=new class{constructor(t){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>N(e.backgroundColor),this.hoverBorderColor=(t,e)=>N(e.borderColor),this.hoverColor=(t,e)=>N(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t)}set(t,e){return xt(this,t,e)}get(t){return mt(this,t)}describe(t,e){return xt(pt,t,e)}override(t,e){return xt(gt,t,e)}route(t,e,i,s){const n=mt(this,t),o=mt(this,i),a="_"+e;Object.defineProperties(n,{[a]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[a],e=o[s];return U(t)?Object.assign({},e,t):K(t,e)},set(t){this[a]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});const _t=Math.PI,yt=2*_t,vt=yt+_t,wt=Number.POSITIVE_INFINITY,Mt=_t/180,kt=_t/2,St=_t/4,Pt=2*_t/3,Dt=Math.log10,Ct=Math.sign;function Ot(t){const e=Math.round(t);t=Lt(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(Dt(t))),s=t/i;return(s<=1?1:s<=2?2:s<=5?5:10)*i}function At(t){const e=[],i=Math.sqrt(t);let s;for(s=1;s<i;s++)t%s==0&&(e.push(s),e.push(t/s));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}function Tt(t){return!isNaN(parseFloat(t))&&isFinite(t)}function Lt(t,e,i){return Math.abs(t-e)<i}function Rt(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function Et(t,e,i){let s,n,o;for(s=0,n=t.length;s<n;s++)o=t[s][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function It(t){return t*(_t/180)}function zt(t){return t*(180/_t)}function Ft(t){if(!X(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Bt(t,e){const i=e.x-t.x,s=e.y-t.y,n=Math.sqrt(i*i+s*s);let o=Math.atan2(s,i);return o<-.5*_t&&(o+=yt),{angle:o,distance:n}}function Vt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wt(t,e){return(t-e+vt)%yt-_t}function Nt(t){return(t%yt+yt)%yt}function Ht(t,e,i,s){const n=Nt(t),o=Nt(e),a=Nt(i),r=Nt(o-n),l=Nt(a-n),h=Nt(n-o),c=Nt(n-a);return n===o||n===a||s&&o===a||r>l&&h<c}function jt(t,e,i){return Math.max(e,Math.min(i,t))}function $t(t){return jt(t,-32768,32767)}function Yt(t,e,i,s=1e-6){return t>=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function Ut(t){return!t||$(t.size)||$(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Xt(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function qt(t,e,i,s){let n=(s=s||{}).data=s.data||{},o=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(n=s.data={},o=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let a=0;const r=i.length;let l,h,c,d,u;for(l=0;l<r;l++)if(d=i[l],null!=d&&!0!==Y(d))a=Xt(t,n,o,a,d);else if(Y(d))for(h=0,c=d.length;h<c;h++)u=d[h],null==u||Y(u)||(a=Xt(t,n,o,a,u));t.restore();const f=o.length/2;if(f>i.length){for(l=0;l<f;l++)delete n[o[l]];o.splice(0,f)}return a}function Kt(t,e,i){const s=t.currentDevicePixelRatio,n=0!==i?Math.max(i/2,.5):0;return Math.round((e-n)*s)/s+n}function Gt(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Zt(t,e,i,s){let n,o,a,r,l;const h=e.pointStyle,c=e.rotation,d=e.radius;let u=(c||0)*Mt;if(h&&"object"==typeof h&&(n=h.toString(),"[object HTMLImageElement]"===n||"[object HTMLCanvasElement]"===n))return t.save(),t.translate(i,s),t.rotate(u),t.drawImage(h,-h.width/2,-h.height/2,h.width,h.height),void t.restore();if(!(isNaN(d)||d<=0)){switch(t.beginPath(),h){default:t.arc(i,s,d,0,yt),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,s-Math.cos(u)*d),u+=Pt,t.lineTo(i+Math.sin(u)*d,s-Math.cos(u)*d),u+=Pt,t.lineTo(i+Math.sin(u)*d,s-Math.cos(u)*d),t.closePath();break;case"rectRounded":l=.516*d,r=d-l,o=Math.cos(u+St)*r,a=Math.sin(u+St)*r,t.arc(i-o,s-a,l,u-_t,u-kt),t.arc(i+a,s-o,l,u-kt,u),t.arc(i+o,s+a,l,u,u+kt),t.arc(i-a,s+o,l,u+kt,u+_t),t.closePath();break;case"rect":if(!c){r=Math.SQRT1_2*d,t.rect(i-r,s-r,2*r,2*r);break}u+=St;case"rectRot":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+a,s-o),t.lineTo(i+o,s+a),t.lineTo(i-a,s+o),t.closePath();break;case"crossRot":u+=St;case"cross":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a),t.moveTo(i+a,s-o),t.lineTo(i-a,s+o);break;case"star":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a),t.moveTo(i+a,s-o),t.lineTo(i-a,s+o),u+=St,o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a),t.moveTo(i+a,s-o),t.lineTo(i-a,s+o);break;case"line":o=Math.cos(u)*d,a=Math.sin(u)*d,t.moveTo(i-o,s-a),t.lineTo(i+o,s+a);break;case"dash":t.moveTo(i,s),t.lineTo(i+Math.cos(u)*d,s+Math.sin(u)*d)}t.fill(),e.borderWidth>0&&t.stroke()}}function Jt(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function Qt(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function te(t){t.restore()}function ee(t,e,i,s,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const s=(e.x+i.x)/2;t.lineTo(s,e.y),t.lineTo(s,i.y)}else"after"===n!=!!s?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function ie(t,e,i,s){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(s?e.cp1x:e.cp2x,s?e.cp1y:e.cp2y,s?i.cp2x:i.cp1x,s?i.cp2y:i.cp1y,i.x,i.y)}function se(t,e,i,s,n,o={}){const a=Y(e)?e:[e],r=o.strokeWidth>0&&""!==o.strokeColor;let l,h;for(t.save(),t.font=n.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]);$(e.rotation)||t.rotate(e.rotation);e.color&&(t.fillStyle=e.color);e.textAlign&&(t.textAlign=e.textAlign);e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,o),l=0;l<a.length;++l)h=a[l],r&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),$(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(h,i,s,o.maxWidth)),t.fillText(h,i,s,o.maxWidth),ne(t,i,s,h,o),s+=n.lineHeight;t.restore()}function ne(t,e,i,s,n){if(n.strikethrough||n.underline){const o=t.measureText(s),a=e-o.actualBoundingBoxLeft,r=e+o.actualBoundingBoxRight,l=i-o.actualBoundingBoxAscent,h=i+o.actualBoundingBoxDescent,c=n.strikethrough?(l+h)/2:h;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=n.decorationWidth||2,t.moveTo(a,c),t.lineTo(r,c),t.stroke()}}function oe(t,e){const{x:i,y:s,w:n,h:o,radius:a}=e;t.arc(i+a.topLeft,s+a.topLeft,a.topLeft,-kt,_t,!0),t.lineTo(i,s+o-a.bottomLeft),t.arc(i+a.bottomLeft,s+o-a.bottomLeft,a.bottomLeft,_t,kt,!0),t.lineTo(i+n-a.bottomRight,s+o),t.arc(i+n-a.bottomRight,s+o-a.bottomRight,a.bottomRight,kt,0,!0),t.lineTo(i+n,s+a.topRight),t.arc(i+n-a.topRight,s+a.topRight,a.topRight,0,-kt,!0),t.lineTo(i+a.topLeft,s)}function ae(t,e,i){i=i||(i=>t[i]<e);let s,n=t.length-1,o=0;for(;n-o>1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const re=(t,e,i)=>ae(t,i,(s=>t[s][e]<i)),le=(t,e,i)=>ae(t,i,(s=>t[s][e]>=i));function he(t,e,i){let s=0,n=t.length;for(;s<n&&t[s]<e;)s++;for(;n>s&&t[n-1]>i;)n--;return s>0||n<t.length?t.slice(s,n):t}const ce=["push","pop","shift","splice","unshift"];function de(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),ce.forEach((e=>{const i="_onData"+ht(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function ue(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(ce.forEach((e=>{delete t[e]})),delete t._chartjs)}function fe(t){const e=new Set;let i,s;for(i=0,s=t.length;i<s;++i)e.add(t[i]);return e.size===s?t:Array.from(e)}function ge(){return"undefined"!=typeof window&&"undefined"!=typeof document}function pe(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function me(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const xe=t=>window.getComputedStyle(t,null);function be(t,e){return xe(t).getPropertyValue(e)}const _e=["top","right","bottom","left"];function ye(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=_e[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}function ve(t,e){const{canvas:i,currentDevicePixelRatio:s}=e,n=xe(i),o="border-box"===n.boxSizing,a=ye(n,"padding"),r=ye(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.native||t,s=i.touches,n=s&&s.length?s[0]:i,{offsetX:o,offsetY:a}=n;let r,l,h=!1;if(((t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot))(o,a,i.target))r=o,l=a;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,l=n.clientY-t.top,h=!0}return{x:r,y:l,box:h}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const we=t=>Math.round(10*t)/10;function Me(t,e,i,s){const n=xe(t),o=ye(n,"margin"),a=me(n.maxWidth,t,"clientWidth")||wt,r=me(n.maxHeight,t,"clientHeight")||wt,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=pe(t);if(o){const t=o.getBoundingClientRect(),a=xe(o),r=ye(a,"border","width"),l=ye(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=me(a.maxWidth,o,"clientWidth"),n=me(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||wt,maxHeight:n||wt}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=ye(n,"border","width"),e=ye(n,"padding");h-=e.width+t.width,c-=e.height+t.height}return h=Math.max(0,h-o.width),c=Math.max(0,s?Math.floor(h/s):c-o.height),h=we(Math.min(h,a,l.maxWidth)),c=we(Math.min(c,r,l.maxHeight)),h&&!c&&(c=we(h/2)),{width:h,height:c}}function ke(t,e,i){const s=e||1,n=Math.floor(t.height*s),o=Math.floor(t.width*s);t.height=n/s,t.width=o/s;const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const Se=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function Pe(t,e){const i=be(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function De(t,e){return"native"in t?{x:t.x,y:t.y}:ve(t,e)}function Ce(t,e,i,s){const{controller:n,data:o,_sorted:a}=t,r=n._cachedMeta.iScale;if(r&&e===r.axis&&"r"!==e&&a&&o.length){const t=r._reversePixels?le:re;if(!s)return t(o,e,i);if(n._sharedOptions){const s=o[0],n="function"==typeof s.getRange&&s.getRange(e);if(n){const s=t(o,e,i-n),a=t(o,e,i+n);return{lo:s.lo,hi:a.hi}}}}return{lo:0,hi:o.length-1}}function Oe(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t<i;++t){const{index:i,data:r}=o[t],{lo:l,hi:h}=Ce(o[t],e,a,n);for(let t=l;t<=h;++t){const e=r[t];e.skip||s(e,i,t)}}}function Ae(t,e,i,s){const n=[];if(!Jt(e,t.chartArea,t._minPadding))return n;return Oe(t,i,e,(function(t,i,o){t.inRange(e.x,e.y,s)&&n.push({element:t,datasetIndex:i,index:o})}),!0),n}function Te(t,e,i,s,n){let o=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,s){const n=e?Math.abs(t.x-s.x):0,o=i?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(o,2))}}(i);let r=Number.POSITIVE_INFINITY;return Oe(t,i,e,(function(i,l,h){const c=i.inRange(e.x,e.y,n);if(s&&!c)return;const d=i.getCenterPoint(n);if(!Jt(d,t.chartArea,t._minPadding)&&!c)return;const u=a(e,d);u<r?(o=[{element:i,datasetIndex:l,index:h}],r=u):u===r&&o.push({element:i,datasetIndex:l,index:h})})),o}function Le(t,e,i,s,n){return Jt(e,t.chartArea,t._minPadding)?"r"!==i||s?Te(t,e,i,s,n):function(t,e,i,s){let n=[];return Oe(t,i,e,(function(t,i,o){const{startAngle:a,endAngle:r}=t.getProps(["startAngle","endAngle"],s),{angle:l}=Bt(t,{x:e.x,y:e.y});Ht(l,a,r)&&n.push({element:t,datasetIndex:i,index:o})})),n}(t,e,i,n):[]}function Re(t,e,i,s){const n=De(e,t),o=[],a=i.axis,r="x"===a?"inXRange":"inYRange";let l=!1;return function(t,e){const i=t.getSortedVisibleDatasetMetas();let s,n,o;for(let t=0,a=i.length;t<a;++t){({index:s,data:n}=i[t]);for(let t=0,i=n.length;t<i;++t)o=n[t],o.skip||e(o,s,t)}}(t,((t,e,i)=>{t[r](n[a],s)&&o.push({element:t,datasetIndex:e,index:i}),t.inRange(n.x,n.y,s)&&(l=!0)})),i.intersect&&!l?[]:o}var Ee={modes:{index(t,e,i,s){const n=De(e,t),o=i.axis||"x",a=i.intersect?Ae(t,n,o,s):Le(t,n,o,!1,s),r=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&r.push({element:i,datasetIndex:t.index,index:e})})),r):[]},dataset(t,e,i,s){const n=De(e,t),o=i.axis||"xy";let a=i.intersect?Ae(t,n,o,s):Le(t,n,o,!1,s);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,s)=>Ae(t,De(e,t),i.axis||"xy",s),nearest:(t,e,i,s)=>Le(t,De(e,t),i.axis||"xy",i.intersect,s),x:(t,e,i,s)=>Re(t,e,{axis:"x",intersect:i.intersect},s),y:(t,e,i,s)=>Re(t,e,{axis:"y",intersect:i.intersect},s)}};const Ie=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),ze=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function Fe(t,e){const i=(""+t).match(Ie);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}function Be(t,e){const i={},s=U(e),n=s?Object.keys(e):e,o=U(t)?s?i=>K(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=+o(t)||0;return i}function Ve(t){return Be(t,{top:"y",right:"x",bottom:"y",left:"x"})}function We(t){return Be(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Ne(t){const e=Ve(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function He(t,e){t=t||{},e=e||bt.font;let i=K(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=K(t.style,e.style);s&&!(""+s).match(ze)&&(console.warn('Invalid font style specified: "'+s+'"'),s="");const n={family:K(t.family,e.family),lineHeight:Fe(K(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:K(t.weight,e.weight),string:""};return n.string=Ut(n),n}function je(t,e,i,s){let n,o,a,r=!0;for(n=0,o=t.length;n<o;++n)if(a=t[n],void 0!==a&&(void 0!==e&&"function"==typeof a&&(a=a(e),r=!1),void 0!==i&&Y(a)&&(a=a[i%a.length],r=!1),void 0!==a))return s&&!r&&(s.cacheable=!1),a}function $e(t,e,i){const{min:s,max:n}=t,o=Z(e,(n-s)/2),a=(t,e)=>i&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Ye(t,e){return Object.assign(Object.create(t),e)}const Ue=["left","top","right","bottom"];function Xe(t,e){return t.filter((t=>t.pos===e))}function qe(t,e){return t.filter((t=>-1===Ue.indexOf(t.pos)&&t.box.axis===e))}function Ke(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Ge(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Ue.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o<a;++o){r=t[o];const{fullSize:a}=r.box,l=i[r.stack],h=l&&r.stackWeight/l.weight;r.horizontal?(r.width=h?h*s:a&&e.availableWidth,r.height=n):(r.width=s,r.height=h?h*n:a&&e.availableHeight)}return i}function Ze(t,e,i,s){return Math.max(t[i],e[i])+Math.max(t[s],e[s])}function Je(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Qe(t,e,i,s){const{pos:n,box:o}=i,a=t.maxPadding;if(!U(n)){i.size&&(t[n]-=i.size);const e=s[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?o.height:o.width),i.size=e.size/e.count,t[n]+=i.size}o.getPadding&&Je(a,o.getPadding());const r=Math.max(0,e.outerWidth-Ze(a,t,"left","right")),l=Math.max(0,e.outerHeight-Ze(a,t,"top","bottom")),h=r!==t.w,c=l!==t.h;return t.w=r,t.h=l,i.horizontal?{same:h,other:c}:{same:c,other:h}}function ti(t,e){const i=e.maxPadding;function s(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function ei(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;o<a;++o){r=t[o],l=r.box,l.update(r.width||e.w,r.height||e.h,ti(r.horizontal,e));const{same:a,other:d}=Qe(e,i,r,s);h|=a&&n.length,c=c||d,l.fullSize||n.push(r)}return h&&ei(n,e,i,s)||c}function ii(t,e,i,s,n){t.top=i,t.left=e,t.right=e+s,t.bottom=i+n,t.width=s,t.height=n}function si(t,e,i,s){const n=i.padding;let{x:o,y:a}=e;for(const r of t){const t=r.box,l=s[r.stack]||{count:1,placed:0,weight:1},h=r.stackWeight/l.weight||1;if(r.horizontal){const s=e.w*h,o=l.size||t.height;ct(l.start)&&(a=l.start),t.fullSize?ii(t,n.left,a,i.outerWidth-n.right-n.left,o):ii(t,e.left+l.placed,a,s,o),l.start=a,l.placed+=s,a=t.bottom}else{const s=e.h*h,a=l.size||t.width;ct(l.start)&&(o=l.start),t.fullSize?ii(t,o,n.top,a,i.outerHeight-n.bottom-n.top):ii(t,o,e.top+l.placed,a,s),l.start=o,l.placed+=s,o=t.right}}e.x=o,e.y=a}bt.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}});var ni={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,s){if(!t)return;const n=Ne(t.options.layout.padding),o=Math.max(e-n.width,0),a=Math.max(i-n.height,0),r=function(t){const e=function(t){const e=[];let i,s,n,o,a,r;for(i=0,s=(t||[]).length;i<s;++i)n=t[i],({position:o,options:{stack:a,stackWeight:r=1}}=n),e.push({index:i,box:n,pos:o,horizontal:n.isHorizontal(),weight:n.weight,stack:a&&o+a,stackWeight:r});return e}(t),i=Ke(e.filter((t=>t.box.fullSize)),!0),s=Ke(Xe(e,"left"),!0),n=Ke(Xe(e,"right")),o=Ke(Xe(e,"top"),!0),a=Ke(Xe(e,"bottom")),r=qe(e,"x"),l=qe(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Xe(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;Q(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),u=Object.assign({},n);Je(u,Ne(s));const f=Object.assign({maxPadding:u,w:o,h:a,x:n.left,y:n.top},n),g=Ge(l.concat(h),d);ei(r.fullSize,f,d,g),ei(l,f,d,g),ei(h,f,d,g)&&ei(l,f,d,g),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(f),si(r.leftAndTop,f,d,g),f.x+=f.w,f.y+=f.h,si(r.rightAndBottom,f,d,g),t.chartArea={left:f.left,top:f.top,right:f.left+f.w,bottom:f.top+f.h,height:f.h,width:f.w},Q(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(f.w,f.h,{left:0,top:0,right:0,bottom:0})}))}};function oi(t,e=[""],i=t,s,n=(()=>t[0])){ct(s)||(s=mi("_fallback",t));const o={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:s,_getTarget:n,override:n=>oi([n,...t],e,i,s)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>ci(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=mi(li(o,t),i),ct(n))return hi(t,n)?gi(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>xi(t).includes(e),ownKeys:t=>xi(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function ai(t,e,i,s){const n={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:ri(t,s),setContext:e=>ai(t,e,i,s),override:n=>ai(t.override(n),e,i,s)};return new Proxy(n,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>ci(t,e,(()=>function(t,e,i){const{_proxy:s,_context:n,_subProxy:o,_descriptors:a}=t;let r=s[e];dt(r)&&a.isScriptable(e)&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t),e=e(o,a||s),r.delete(t),hi(t,e)&&(e=gi(n._scopes,n,t,e));return e}(e,r,t,i));Y(r)&&r.length&&(r=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_descriptors:r}=i;if(ct(o.index)&&s(t))e=e[o.index%e.length];else if(U(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=gi(s,n,t,l);e.push(ai(i,o,a&&a[t],r))}}return e}(e,r,t,a.isIndexable));hi(e,r)&&(r=ai(r,n,o&&o[e],a));return r}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function ri(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:dt(i)?i:()=>i,isIndexable:dt(s)?s:()=>s}}const li=(t,e)=>t?t+ht(e):e,hi=(t,e)=>U(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function ci(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e))return t[e];const s=i();return t[e]=s,s}function di(t,e,i){return dt(t)?t(e,i):t}const ui=(t,e)=>!0===t?e:"string"==typeof t?lt(e,t):void 0;function fi(t,e,i,s,n){for(const o of e){const e=ui(i,o);if(e){t.add(e);const o=di(e._fallback,i,n);if(ct(o)&&o!==i&&o!==s)return o}else if(!1===e&&ct(s)&&i!==s)return null}return!1}function gi(t,e,i,s){const n=e._rootScopes,o=di(e._fallback,i,s),a=[...t,...n],r=new Set;r.add(s);let l=pi(r,a,i,o||i,s);return null!==l&&((!ct(o)||o===i||(l=pi(r,a,o,l,s),null!==l))&&oi(Array.from(r),[""],n,o,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const n=s[e];if(Y(n)&&U(i))return i;return n}(e,i,s))))}function pi(t,e,i,s,n){for(;i;)i=fi(t,e,i,s,n);return i}function mi(t,e){for(const i of e){if(!i)continue;const e=i[t];if(ct(e))return e}}function xi(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}const bi=Number.EPSILON||1e-14,_i=(t,e)=>e<t.length&&!t[e].skip&&t[e],yi=t=>"x"===t?"y":"x";function vi(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=Vt(o,n),l=Vt(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function wi(t,e="x"){const i=yi(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=_i(t,0);for(a=0;a<s;++a)if(r=l,l=h,h=_i(t,a+1),l){if(h){const t=h[e]-l[e];n[a]=0!==t?(h[i]-l[i])/t:0}o[a]=r?h?Ct(n[a-1])!==Ct(n[a])?0:(n[a-1]+n[a])/2:n[a-1]:n[a]}!function(t,e,i){const s=t.length;let n,o,a,r,l,h=_i(t,0);for(let c=0;c<s-1;++c)l=h,h=_i(t,c+1),l&&h&&(Lt(e[c],0,bi)?i[c]=i[c+1]=0:(n=i[c]/e[c],o=i[c+1]/e[c],r=Math.pow(n,2)+Math.pow(o,2),r<=9||(a=3/Math.sqrt(r),i[c]=n*a*e[c],i[c+1]=o*a*e[c])))}(t,n,o),function(t,e,i="x"){const s=yi(i),n=t.length;let o,a,r,l=_i(t,0);for(let h=0;h<n;++h){if(a=r,r=l,l=_i(t,h+1),!r)continue;const n=r[i],c=r[s];a&&(o=(n-a[i])/3,r[`cp1${i}`]=n-o,r[`cp1${s}`]=c-o*e[h]),l&&(o=(l[i]-n)/3,r[`cp2${i}`]=n+o,r[`cp2${s}`]=c+o*e[h])}}(t,o,e)}function Mi(t,e,i){return Math.max(Math.min(t,i),e)}function ki(t,e,i,s,n){let o,a,r,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)wi(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o<a;++o)r=t[o],l=vi(i,r,t[Math.min(o+1,a-(s?0:1))%a],e.tension),r.cp1x=l.previous.x,r.cp1y=l.previous.y,r.cp2x=l.next.x,r.cp2y=l.next.y,i=r}e.capBezierPoints&&function(t,e){let i,s,n,o,a,r=Jt(t[0],e);for(i=0,s=t.length;i<s;++i)a=o,o=r,r=i<s-1&&Jt(t[i+1],e),o&&(n=t[i],a&&(n.cp1x=Mi(n.cp1x,e.left,e.right),n.cp1y=Mi(n.cp1y,e.top,e.bottom)),r&&(n.cp2x=Mi(n.cp2x,e.left,e.right),n.cp2y=Mi(n.cp2y,e.top,e.bottom)))}(t,i)}const Si=t=>0===t||1===t,Pi=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*yt/i),Di=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*yt/i)+1,Ci={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*kt),easeOutSine:t=>Math.sin(t*kt),easeInOutSine:t=>-.5*(Math.cos(_t*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>Si(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>Si(t)?t:Pi(t,.075,.3),easeOutElastic:t=>Si(t)?t:Di(t,.075,.3),easeInOutElastic(t){const e=.1125;return Si(t)?t:t<.5?.5*Pi(2*t,e,.45):.5+.5*Di(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-Ci.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*Ci.easeInBounce(2*t):.5*Ci.easeOutBounce(2*t-1)+.5};function Oi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function Ai(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function Ti(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=Oi(t,n,i),r=Oi(n,o,i),l=Oi(o,e,i),h=Oi(a,r,i),c=Oi(r,l,i);return Oi(h,c,i)}const Li=new Map;function Ri(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=Li.get(i);return s||(s=new Intl.NumberFormat(t,e),Li.set(i,s)),s}(e,i).format(t)}function Ei(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ii(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function zi(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Fi(t){return"angle"===t?{between:Ht,compare:Wt,normalize:Nt}:{between:Yt,compare:(t,e)=>t-e,normalize:t=>t}}function Bi({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function Vi(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Fi(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=Fi(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;h<c&&a(r(e[d%l][s]),n,o);++h)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:f,style:t.style}}(t,e,i),g=[];let p,m,x,b=!1,_=null;const y=()=>b||l(n,x,p)&&0!==r(n,x),v=()=>!b||0===r(o,p)||l(o,x,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==x&&(b=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(Bi({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p));return null!==_&&g.push(Bi({start:_,end:d,loop:u,count:a,style:f})),g}function Wi(t,e){const i=[],s=t.segments;for(let n=0;n<s.length;n++){const o=Vi(s[n],t.points,e);o.length&&i.push(...o)}return i}function Ni(t,e){const i=t.points,s=t.options.spanGaps,n=i.length;if(!n)return[];const o=!!t._loop,{start:a,end:r}=function(t,e,i,s){let n=0,o=e-1;if(i&&!s)for(;n<e&&!t[n].skip;)n++;for(;n<e&&t[n].skip;)n++;for(n%=e,i&&(o+=n);o>n&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return Hi(t,[{start:a,end:r,loop:o}],i,e);return Hi(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r<a?r+n:r,!!t._fullLoop&&0===a&&r===n-1),i,e)}function Hi(t,e,i,s){return s&&s.setContext&&i?function(t,e,i,s){const n=t._chart.getContext(),o=ji(t.options),{_datasetIndex:a,options:{spanGaps:r}}=t,l=i.length,h=[];let c=o,d=e[0].start,u=d;function f(t,e,s,n){const o=r?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=o;for(;i[e%l].skip;)e+=o;t%l!=e%l&&(h.push({start:t%l,end:e%l,loop:s,style:n}),c=n,d=e%l)}}for(const t of e){d=r?d:t.start;let e,o=i[d%l];for(u=d+1;u<=t.end;u++){const r=i[u%l];e=ji(s.setContext(Ye(n,{type:"segment",p0:o,p1:r,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:a}))),$i(e,c)&&f(d,u-1,t.loop,c),o=r,c=e}d<u-1&&f(d,u-1,t.loop,c)}return h}(t,e,i,s):e}function ji(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function $i(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var Yi=Object.freeze({__proto__:null,easingEffects:Ci,color:W,getHoverColor:N,noop:H,uid:j,isNullOrUndef:$,isArray:Y,isObject:U,isFinite:X,finiteOrDefault:q,valueOrDefault:K,toPercentage:G,toDimension:Z,callback:J,each:Q,_elementsEqual:tt,clone:et,_merger:st,merge:nt,mergeIf:ot,_mergerIf:at,_deprecated:function(t,e,i,s){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+s+'" instead')},resolveObjectKey:lt,_capitalize:ht,defined:ct,isFunction:dt,setsEqual:ut,_isClickEvent:ft,toFontString:Ut,_measureText:Xt,_longestText:qt,_alignPixel:Kt,clearCanvas:Gt,drawPoint:Zt,_isPointInArea:Jt,clipArea:Qt,unclipArea:te,_steppedLineTo:ee,_bezierCurveTo:ie,renderText:se,addRoundedRectPath:oe,_lookup:ae,_lookupByKey:re,_rlookupByKey:le,_filterBetween:he,listenArrayEvents:de,unlistenArrayEvents:ue,_arrayUnique:fe,_createResolver:oi,_attachContext:ai,_descriptors:ri,splineCurve:vi,splineCurveMonotone:wi,_updateBezierControlPoints:ki,_isDomSupported:ge,_getParentNode:pe,getStyle:be,getRelativePosition:ve,getMaximumSize:Me,retinaScale:ke,supportsEventListenerOptions:Se,readUsedSize:Pe,fontString:function(t,e,i){return e+" "+t+"px "+i},requestAnimFrame:t,throttled:e,debounce:i,_toLeftRightCenter:s,_alignStartEnd:n,_textX:o,_pointInLine:Oi,_steppedInterpolation:Ai,_bezierInterpolation:Ti,formatNumber:Ri,toLineHeight:Fe,_readValueToProps:Be,toTRBL:Ve,toTRBLCorners:We,toPadding:Ne,toFont:He,resolve:je,_addGrace:$e,createContext:Ye,PI:_t,TAU:yt,PITAU:vt,INFINITY:wt,RAD_PER_DEG:Mt,HALF_PI:kt,QUARTER_PI:St,TWO_THIRDS_PI:Pt,log10:Dt,sign:Ct,niceNum:Ot,_factorize:At,isNumber:Tt,almostEquals:Lt,almostWhole:Rt,_setMinAndMaxByKey:Et,toRadians:It,toDegrees:zt,_decimalPlaces:Ft,getAngleFromPoint:Bt,distanceBetweenPoints:Vt,_angleDiff:Wt,_normalizeAngle:Nt,_angleBetween:Ht,_limitValue:jt,_int16Range:$t,_isBetween:Yt,getRtlAdapter:Ei,overrideTextDirection:Ii,restoreTextDirection:zi,_boundSegment:Vi,_boundSegments:Wi,_computeSegments:Ni});class Ui{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class Xi extends Ui{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const qi={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ki=t=>null===t||""===t;const Gi=!!Se&&{passive:!0};function Zi(t,e,i){t.canvas.removeEventListener(e,i,Gi)}function Ji(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Qi(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Ji(i.addedNodes,s),e=e&&!Ji(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function ts(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Ji(i.removedNodes,s),e=e&&!Ji(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const es=new Map;let is=0;function ss(){const t=window.devicePixelRatio;t!==is&&(is=t,es.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function ns(t,i,s){const n=t.canvas,o=n&&pe(n);if(!o)return;const a=e(((t,e)=>{const i=o.clientWidth;s(t,e),i<o.clientWidth&&s()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||a(i,s)}));return r.observe(o),function(t,e){es.size||window.addEventListener("resize",ss),es.set(t,e)}(t,a),r}function os(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){es.delete(t),es.size||window.removeEventListener("resize",ss)}(t)}function as(t,i,s){const n=t.canvas,o=e((e=>{null!==t.ctx&&s(function(t,e){const i=qi[t.type]||t.type,{x:s,y:n}=ve(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t,(t=>{const e=t[0];return[e,e.offsetX,e.offsetY]}));return function(t,e,i){t.addEventListener(e,i,Gi)}(n,i,o),o}class rs extends Ui{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Ki(n)){const e=Pe(t,"width");void 0!==e&&(t.width=e)}if(Ki(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Pe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e.$chartjs)return!1;const i=e.$chartjs.initial;["height","width"].forEach((t=>{const s=i[t];$(s)?e.removeAttribute(t):e.setAttribute(t,s)}));const s=i.style||{};return Object.keys(s).forEach((t=>{e.style[t]=s[t]})),e.width=e.width,delete e.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:Qi,detach:ts,resize:ns}[e]||as;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:os,detach:os,resize:os}[e]||Zi)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return Me(t,e,i,s)}isAttached(t){const e=pe(t);return!(!e||!e.isConnected)}}function ls(t){return!ge()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Xi:rs}var hs=Object.freeze({__proto__:null,_detectPlatform:ls,BasePlatform:Ui,BasicPlatform:Xi,DomPlatform:rs});const cs="transparent",ds={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=W(t||cs),n=s.valid&&W(e||cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class us{constructor(t,e,i,s){const n=e[i];s=je([t.to,s,n,t.from]);const o=je([t.from,n,s]);this._active=!0,this._fn=t.fn||ds[t.type||typeof o],this._easing=Ci[t.easing]||Ci.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=je([t.to,e,s,t.from]),this._from=je([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e<i),!this._active)return this._target[s]=a,void this._notify(!0);e<0?this._target[s]=n:(r=e/i%2,r=o&&r>1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}bt.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0});const fs=Object.keys(bt.animation);bt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),bt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),bt.describe("animations",{_fallback:"animation"}),bt.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}});class gs{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!U(t))return;const e=this._properties;Object.getOwnPropertyNames(t).forEach((i=>{const s=t[i];if(!U(s))return;const n={};for(const t of fs)n[t]=s[t];(Y(s.properties)&&s.properties||[i]).forEach((t=>{t!==i&&e.has(t)||e.set(t,n)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e<s.length;e++){const n=t[s[e]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new us(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(a.add(this._chart,i),!0):void 0}}function ps(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function ms(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n<o;++n)i.push(s[n].index);return i}function xs(t,e,i,s={}){const n=t.keys,o="single"===s.mode;let a,r,l,h;if(null!==e){for(a=0,r=n.length;a<r;++a){if(l=+n[a],l===i){if(s.all)continue;break}h=t.values[l],X(h)&&(o||0===e||Ct(e)===Ct(h))&&(e+=h)}return e}}function bs(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function _s(t,e,i){const s=t[e]||(t[e]={});return s[i]||(s[i]={})}function ys(t,e,i,s){for(const n of e.getMatchingVisibleMetas(s).reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function vs(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:o,[h]:d}=i;u=(i._stacks||(i._stacks={}))[h]=_s(n,c,o),u[r]=d,u._top=ys(u,a,!0,s.type),u._bottom=ys(u,a,!1,s.type)}}function ws(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Ms(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i]}}}const ks=t=>"reset"===t||"none"===t,Ss=(t,e)=>e?t:Object.assign({},t);class Ps{constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.$context=void 0,this._syncList=[],this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=bs(t.vScale,t),this.addElements()}updateIndex(t){this.index!==t&&Ms(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=K(i.xAxisID,ws(t,"x")),o=e.yAxisID=K(i.yAxisID,ws(t,"y")),a=e.rAxisID=K(i.rAxisID,ws(t,"r")),r=e.indexAxis,l=e.iAxisID=s(r,n,o,a),h=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(l),e.vScale=this.getScaleForId(h)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&ue(this._data,this),t._stacked&&Ms(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(U(e))this._data=function(t){const e=Object.keys(t),i=new Array(e.length);let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s],i[s]={x:o,y:t[o]};return i}(e);else if(i!==e){if(i){ue(i,this);const t=this._cachedMeta;Ms(t),t._parsed=[]}e&&Object.isExtensible(e)&&de(e,this),this._syncList=[],this._data=e}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let s=!1;this._dataCheck();const n=e._stacked;e._stacked=bs(e.vScale,e),e.stack!==i.stack&&(s=!0,Ms(e),e.stack=i.stack),this._resyncElements(t),(s||n!==e._stacked)&&vs(this,e._parsed)}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:s}=this,{iScale:n,_stacked:o}=i,a=n.axis;let r,l,h,c=0===t&&e===s.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,h=s;else{h=Y(s[t])?this.parseArrayData(i,s,t,e):U(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const n=()=>null===l[a]||d&&l[a]<d[a];for(r=0;r<e;++r)i._parsed[r+t]=l=h[r],c&&(n()&&(c=!1),d=l);i._sorted=c}o&&vs(this,h)}parsePrimitiveData(t,e,i,s){const{iScale:n,vScale:o}=t,a=n.axis,r=o.axis,l=n.getLabels(),h=n===o,c=new Array(s);let d,u,f;for(d=0,u=s;d<u;++d)f=d+i,c[d]={[a]:h||n.parse(l[f],f),[r]:o.parse(e[f],f)};return c}parseArrayData(t,e,i,s){const{xScale:n,yScale:o}=t,a=new Array(s);let r,l,h,c;for(r=0,l=s;r<l;++r)h=r+i,c=e[h],a[r]={x:n.parse(c[0],h),y:o.parse(c[1],h)};return a}parseObjectData(t,e,i,s){const{xScale:n,yScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l=new Array(s);let h,c,d,u;for(h=0,c=s;h<c;++h)d=h+i,u=e[d],l[h]={x:n.parse(lt(u,a),d),y:o.parse(lt(u,r),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const s=this.chart,n=this._cachedMeta,o=e[t.axis];return xs({keys:ms(s,!0),values:e._stacks[t.axis]},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,s){const n=i[e.axis];let o=null===n?NaN:n;const a=s&&i._stacks[e.axis];s&&a&&(s.values=a,o=xs(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this._cachedMeta,s=i._parsed,n=i._sorted&&t===i.iScale,o=s.length,a=this._getOtherScale(t),r=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:ms(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:h,max:c}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(a);let d,u;function f(){u=s[d];const e=u[a.axis];return!X(u[t.axis])||h>e||c<e}for(d=0;d<o&&(f()||(this.updateRangeFromParsed(l,t,u,r),!n));++d);if(n)for(d=o-1;d>=0;--d)if(!f()){this.updateRangeFromParsed(l,t,u,r);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s<n;++s)o=e[s][t.axis],X(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,s=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,s,n;return U(t)?(e=t.top,i=t.right,s=t.bottom,n=t.left):e=i=s=n=t,{top:e,right:i,bottom:s,left:n,disabled:!1===t}}(K(this.options.clip,function(t,e,i){if(!1===i)return!1;const s=ps(t,i),n=ps(e,i);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,s=i.data||[],n=e.chartArea,o=[],a=this._drawStart||0,r=this._drawCount||s.length-a,l=this.options.drawActiveElementsOnTop;let h;for(i.dataset&&i.dataset.draw(t,n,a,r),h=a;h<a+r;++h){const e=s[h];e.hidden||(e.active&&l?o.push(e):e.draw(t,n))}for(h=0;h<o.length;++h)o[h].draw(t,n)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];n=e.$context||(e.$context=function(t,e,i){return Ye(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,e){return Ye(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!e,n.mode=i,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const s="active"===e,n=this._cachedDataOpts,o=t+"-"+e,a=n[o],r=this.enableOptionSharing&&ct(i);if(a)return Ss(a,r);const l=this.chart.config,h=l.datasetElementScopeKeys(this._type,t),c=s?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),h),u=Object.keys(bt.elements[t]),f=l.resolveNamedOptions(d,u,(()=>this.getContext(i,s)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Ss(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new gs(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ks(t)||this.chart._animationsDisabled}updateElement(t,e,i,s){ks(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!ks(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,e,i=!0){const s=this._cachedMeta,n=s.data,o=t+e;let a;const r=t=>{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a<o;++a)n[a]=new this.dataElementType;this._parsing&&r(s._parsed),this.parse(t,e),i&&this.updateElements(n,t,e,"reset")}updateElements(t,e,i,s){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const s=i._parsed.splice(t,e);i._stacked&&Ms(i,s)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,s]=t;this[e](i,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Ps.defaults={},Ps.prototype.datasetElementType=null,Ps.prototype.dataElementType=null;class Ds{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return Tt(this.x)&&Tt(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const s={};return t.forEach((t=>{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}Ds.defaults={},Ds.defaultRoutes=void 0;const Cs={values:t=>Y(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=Dt(Math.abs(o)),r=Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),Ri(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=t/Math.pow(10,Math.floor(Dt(t)));return 1===s||2===s||5===s?Cs.numeric.call(this,t,e,i):""}};var Os={formatters:Cs};function As(t,e){const i=t.options.ticks,s=i.maxTicksLimit||function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),n=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;i<s;i++)t[i].major&&e.push(i);return e}(e):[],o=n.length,a=n[0],r=n[o-1],l=[];if(o>s)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===a&&(e.push(t[n]),o++,a=i[o*s])}(e,l,n,o/s),l;const h=function(t,e,i){const s=function(t){const e=t.length;let i,s;if(e<2)return!1;for(s=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==s)return!1;return s}(t),n=e.length/i;if(!s)return Math.max(n,1);const o=At(s);for(let t=0,e=o.length-1;t<e;t++){const e=o[t];if(e>n)return e}return Math.max(n,1)}(n,e,s);if(o>0){let t,i;const s=o>1?Math.round((r-a)/(o-1)):null;for(Ts(e,l,h,$(s)?0:a-s,a),t=0,i=o-1;t<i;t++)Ts(e,l,h,n[t],n[t+1]);return Ts(e,l,h,r,$(s)?e.length:r+s),l}return Ts(e,l,h),l}function Ts(t,e,i,s,n){const o=K(s,0),a=Math.min(K(n,t.length),t.length);let r,l,h,c=0;for(i=Math.ceil(i),n&&(r=n-s,i=r/Math.floor(r/i)),h=o;h<0;)c++,h=Math.round(o+c*i);for(l=Math.max(o,0);l<a;l++)l===h&&(e.push(t[l]),c++,h=Math.round(o+c*i))}bt.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",grace:0,grid:{display:!0,lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1,borderDash:[],borderDashOffset:0,borderWidth:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:Os.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),bt.route("scale.ticks","color","","color"),bt.route("scale.grid","color","","borderColor"),bt.route("scale.grid","borderColor","","borderColor"),bt.route("scale.title","color","","color"),bt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),bt.describe("scales",{_fallback:"scale"}),bt.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t});const Ls=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Rs(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;o<n;o+=s)i.push(t[Math.floor(o)]);return i}function Es(t,e,i){const s=t.ticks.length,n=Math.min(e,s-1),o=t._startPixel,a=t._endPixel,r=1e-6;let l,h=t.getPixelForTick(n);if(!(i&&(l=1===s?Math.max(h-o,a-h):0===e?(t.getPixelForTick(1)-h)/2:(h-t.getPixelForTick(n-1))/2,h+=n<e?l:-l,h<o-r||h>a+r)))return h}function Is(t){return t.drawTicks?t.tickLength:0}function zs(t,e){if(!t.display)return 0;const i=He(t.font,e),s=Ne(t.padding);return(Y(t.text)?t.text.length:1)*i.lineHeight+s.height}function Fs(t,e,i){let n=s(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class Bs extends Ds{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=q(t,Number.POSITIVE_INFINITY),e=q(e,Number.NEGATIVE_INFINITY),i=q(i,Number.POSITIVE_INFINITY),s=q(s,Number.NEGATIVE_INFINITY),{min:q(t,i),max:q(e,s),minDefined:X(t),maxDefined:X(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;r<l;++r)e=a[r].controller.getMinMax(this,t),n||(i=Math.min(i,e.min)),o||(s=Math.max(s,e.max));return i=o&&i>s?s:i,s=n&&i>s?i:s,{min:q(i,q(s,i)),max:q(s,q(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){J(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=$e(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a<this.ticks.length;this._convertTicksToLabels(r?Rs(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(this.ticks=As(this,this.ticks),this._labelSizes=null),r&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){J(this.options.afterUpdate,[this])}beforeSetDimensions(){J(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){J(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),J(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){J(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,s,n;for(i=0,s=t.length;i<s;i++)n=t[i],n.label=J(e.callback,[n.value,i,t],this)}afterTickToLabelConversion(){J(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){J(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=this.ticks.length,s=e.minRotation||0,n=e.maxRotation;let o,a,r,l=s;if(!this._isVisible()||!e.display||s>=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=jt(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Is(t.grid)-e.padding-zs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=zt(Math.min(Math.asin(jt((h.highest.height+6)/o,-1,1)),Math.asin(jt(a/r,-1,1))-Math.asin(jt(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){J(this.options.afterCalculateLabelRotation,[this])}beforeFit(){J(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=zs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Is(n)+o):(t.height=this.maxHeight,t.width=Is(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=It(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){J(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)$(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=Rs(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length)}return t}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:s}=this,n=[],o=[];let a,r,l,h,c,d,u,f,g,p,m,x=0,b=0;for(a=0;a<e;++a){if(h=t[a].label,c=this._resolveTickFontOptions(a),i.font=d=c.string,u=s[d]=s[d]||{data:{},gc:[]},f=c.lineHeight,g=p=0,$(h)||Y(h)){if(Y(h))for(r=0,l=h.length;r<l;++r)m=h[r],$(m)||Y(m)||(g=Xt(i,u.data,u.gc,g,m),p+=f)}else g=Xt(i,u.data,u.gc,g,h),p=f;n.push(g),o.push(p),x=Math.max(g,x),b=Math.max(p,b)}!function(t,e){Q(t,(t=>{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n<s;++n)delete t.data[i[n]];i.splice(0,s)}}))}(s,e);const _=n.indexOf(x),y=o.indexOf(b),v=t=>({width:n[t]||0,height:o[t]||0});return{first:v(0),last:v(e-1),widest:v(_),highest:v(y),widths:n,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return $t(this._alignToPixels?Kt(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Ye(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Ye(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=It(this.labelRotation),i=Math.abs(Math.cos(e)),s=Math.abs(Math.sin(e)),n=this._getLabelSizes(),o=t.autoSkipPadding||0,a=n?n.widest.width+o:0,r=n?n.highest.height+o:0;return this.isHorizontal()?r*i>a*s?a/i:r/s:r*s<a*i?r/i:a/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:o}=s,a=n.offset,r=this.isHorizontal(),l=this.ticks.length+(a?1:0),h=Is(n),c=[],d=n.setContext(this.getContext()),u=d.drawBorder?d.borderWidth:0,f=u/2,g=function(t){return Kt(i,t,u)};let p,m,x,b,_,y,v,w,M,k,S,P;if("top"===o)p=g(this.bottom),y=this.bottom-h,w=p-f,k=g(t.top)+f,P=t.bottom;else if("bottom"===o)p=g(this.top),k=t.top,P=g(t.bottom)-f,y=p+f,w=this.top+h;else if("left"===o)p=g(this.right),_=this.right-h,v=p-f,M=g(t.left)+f,S=t.right;else if("right"===o)p=g(this.left),M=t.left,S=g(t.right)-f,_=p+f,v=this.left+h;else if("x"===e){if("center"===o)p=g((t.top+t.bottom)/2+.5);else if(U(o)){const t=Object.keys(o)[0],e=o[t];p=g(this.chart.scales[t].getPixelForValue(e))}k=t.top,P=t.bottom,y=p+f,w=y+h}else if("y"===e){if("center"===o)p=g((t.left+t.right)/2);else if(U(o)){const t=Object.keys(o)[0],e=o[t];p=g(this.chart.scales[t].getPixelForValue(e))}_=p-f,v=_-h,M=t.left,S=t.right}const D=K(s.ticks.maxTicksLimit,l),C=Math.max(1,Math.ceil(l/D));for(m=0;m<l;m+=C){const t=n.setContext(this.getContext(m)),e=t.lineWidth,s=t.color,o=n.borderDash||[],l=t.borderDashOffset,h=t.tickWidth,d=t.tickColor,u=t.tickBorderDash||[],f=t.tickBorderDashOffset;x=Es(this,m,a),void 0!==x&&(b=Kt(i,x,e),r?_=v=M=S=b:y=w=k=P=b,c.push({tx1:_,ty1:y,tx2:v,ty2:w,x1:M,y1:k,x2:S,y2:P,width:e,color:s,borderDash:o,borderDashOffset:l,tickWidth:h,tickColor:d,tickBorderDash:u,tickBorderDashOffset:f}))}return this._ticksLength=l,this._borderValue=p,c}_computeLabelItems(t){const e=this.axis,i=this.options,{position:s,ticks:n}=i,o=this.isHorizontal(),a=this.ticks,{align:r,crossAlign:l,padding:h,mirror:c}=n,d=Is(i.grid),u=d+h,f=c?-h:u,g=-It(this.labelRotation),p=[];let m,x,b,_,y,v,w,M,k,S,P,D,C="middle";if("top"===s)v=this.bottom-f,w=this._getXAxisLabelAlignment();else if("bottom"===s)v=this.top+f,w=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,y=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,y=t.x}else if("x"===e){if("center"===s)v=(t.top+t.bottom)/2+u;else if(U(s)){const t=Object.keys(s)[0],e=s[t];v=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===s)y=(t.left+t.right)/2-u;else if(U(s)){const t=Object.keys(s)[0],e=s[t];y=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===r?C="top":"end"===r&&(C="bottom"));const O=this._getLabelSizes();for(m=0,x=a.length;m<x;++m){b=a[m],_=b.label;const t=n.setContext(this.getContext(m));M=this.getPixelForTick(m)+n.labelOffset,k=this._resolveTickFontOptions(m),S=k.lineHeight,P=Y(_)?_.length:1;const e=P/2,i=t.color,r=t.textStrokeColor,h=t.textStrokeWidth;let d;if(o?(y=M,D="top"===s?"near"===l||0!==g?-P*S+S/2:"center"===l?-O.highest.height/2-e*S+S:-O.highest.height+S/2:"near"===l||0!==g?S/2:"center"===l?O.highest.height/2-e*S:O.highest.height-P*S,c&&(D*=-1)):(v=M,D=(1-P)*S/2),t.showLabelBackdrop){const e=Ne(t.backdropPadding),i=O.heights[m],s=O.widths[m];let n=v+D-e.top,o=y-e.left;switch(C){case"middle":n-=i/2;break;case"bottom":n-=i}switch(w){case"center":o-=s/2;break;case"right":o-=s}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}p.push({rotation:g,label:_,font:k,color:i,strokeColor:r,strokeWidth:h,textOffset:D,textAlign:w,textBaseline:C,translation:[y,v],backdrop:d})}return p}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-It(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align&&(i="right"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n<o;++n){const t=s[n];e.drawOnChartArea&&a({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&a({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{grid:i}}=this,s=i.setContext(this.getContext()),n=i.drawBorder?s.borderWidth:0;if(!n)return;const o=i.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let r,l,h,c;this.isHorizontal()?(r=Kt(t,this.left,n)-n/2,l=Kt(t,this.right,o)+o/2,h=c=a):(h=Kt(t,this.top,n)-n/2,c=Kt(t,this.bottom,o)+o/2,r=l=a),e.save(),e.lineWidth=s.borderWidth,e.strokeStyle=s.borderColor,e.beginPath(),e.moveTo(r,h),e.lineTo(l,c),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&Qt(e,i);const s=this._labelItems||(this._labelItems=this._computeLabelItems(t));let n,o;for(n=0,o=s.length;n<o;++n){const t=s[n],i=t.font,o=t.label;t.backdrop&&(e.fillStyle=t.backdrop.color,e.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),se(e,o,0,t.textOffset,i,t)}i&&te(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:s}}=this;if(!i.display)return;const o=He(i.font),a=Ne(i.padding),r=i.align;let l=o.lineHeight/2;"bottom"===e||"center"===e||U(e)?(l+=a.bottom,Y(i.text)&&(l+=o.lineHeight*(i.text.length-1))):l+=a.top;const{titleX:h,titleY:c,maxWidth:d,rotation:u}=function(t,e,i,s){const{top:o,left:a,bottom:r,right:l,chart:h}=t,{chartArea:c,scales:d}=h;let u,f,g,p=0;const m=r-o,x=l-a;if(t.isHorizontal()){if(f=n(s,a,l),U(i)){const t=Object.keys(i)[0],s=i[t];g=d[t].getPixelForValue(s)+m-e}else g="center"===i?(c.bottom+c.top)/2+m-e:Ls(t,i,e);u=l-a}else{if(U(i)){const t=Object.keys(i)[0],s=i[t];f=d[t].getPixelForValue(s)-x+e}else f="center"===i?(c.left+c.right)/2-x+e:Ls(t,i,e);g=n(s,r,o),p="left"===i?-kt:kt}return{titleX:f,titleY:g,maxWidth:u,rotation:p}}(this,l,e,r);se(t,i.text,0,0,o,{color:i.color,maxWidth:d,rotation:u,textAlign:Fs(r,e,s),textBaseline:"middle",translation:[h,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=K(t.grid&&t.grid.z,-1);return this._isVisible()&&this.draw===Bs.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:i+1,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||s.push(o)}return s}_resolveTickFontOptions(t){return He(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Vs{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const s=this.items,n=t.id,o=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,e,i){const s=nt(Object.create(null),[i?bt.get(i):{},bt.get(e),t.defaults]);bt.set(e,s),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");bt.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&bt.describe(e,t.descriptors)}(t,o,i),this.override&&bt.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in bt[s]&&(delete bt[s][i],this.override&&delete gt[i])}}var Ws=new class{constructor(){this.controllers=new Vs(Ps,"datasets",!0),this.elements=new Vs(Ds,"elements"),this.plugins=new Vs(Object,"plugins"),this.scales=new Vs(Bs,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):Q(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=ht(t);J(i["before"+s],[],i),e[t](i),J(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const s=e.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+i+".");return s}};class Ns{constructor(){this._init=[]}notify(t,e,i,s){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const n=s?this._descriptors(t).filter(s):this._descriptors(t),o=this._notify(n,t,e,i);return"afterDestroy"===e&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall")),o}_notify(t,e,i,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===J(t[i],[e,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){$(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,s=K(i.options&&i.options.plugins,{}),n=function(t){const e=[],i=Object.keys(Ws.plugins.items);for(let t=0;t<i.length;t++)e.push(Ws.getPlugin(i[t]));const s=t.plugins||[];for(let t=0;t<s.length;t++){const i=s[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==s||e?function(t,e,i,s){const n=[],o=t.getContext();for(let a=0;a<e.length;a++){const r=e[a],l=Hs(i[r.id],s);null!==l&&n.push({plugin:r,options:js(t.config,r,l,o)})}return n}(t,n,s,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,s=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function Hs(t,e){return e||!1!==t?!0===t?{}:t:null}function js(t,e,i,s){const n=t.pluginScopeKeys(e),o=t.getOptionScopes(i,n);return t.createResolver(o,s,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function $s(t,e){const i=bt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function Ys(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(i=e.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.charAt(0).toLowerCase();var i}function Us(t){const e=t.options||(t.options={});e.plugins=K(e.plugins,{}),e.scales=function(t,e){const i=gt[t.type]||{scales:{}},s=e.scales||{},n=$s(t.type,e),o=Object.create(null),a=Object.create(null);return Object.keys(s).forEach((t=>{const e=s[t];if(!U(e))return console.error(`Invalid scale configuration for scale: ${t}`);if(e._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${t}`);const r=Ys(t,e),l=function(t,e){return t===e?"_index_":"_value_"}(r,n),h=i.scales||{};o[r]=o[r]||t,a[t]=ot(Object.create(null),[{axis:r},e,h[r],h[l]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,r=i.indexAxis||$s(n,e),l=(gt[n]||{}).scales||{};Object.keys(l).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),n=i[e+"AxisID"]||o[e]||e;a[n]=a[n]||Object.create(null),ot(a[n],[{axis:e},s[n],l[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];ot(e,[bt.scales[e.type],bt.scale])})),a}(t,e)}function Xs(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const qs=new Map,Ks=new Set;function Gs(t,e){let i=qs.get(t);return i||(i=e(),qs.set(t,i),Ks.add(i)),i}const Zs=(t,e,i)=>{const s=lt(e,i);void 0!==s&&t.add(s)};class Js{constructor(t){this._config=function(t){return(t=t||{}).data=Xs(t.data),Us(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Xs(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),Us(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Gs(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return Gs(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return Gs(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return Gs(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>Zs(r,t,e)))),e.forEach((t=>Zs(r,s,t))),e.forEach((t=>Zs(r,gt[n]||{},t))),e.forEach((t=>Zs(r,bt,t))),e.forEach((t=>Zs(r,pt,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),Ks.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,gt[e]||{},bt.datasets[e]||{},{type:e},bt,pt]}resolveNamedOptions(t,e,i,s=[""]){const n={$shared:!0},{resolver:o,subPrefixes:a}=Qs(this._resolverCache,t,s);let r=o;if(function(t,e){const{isScriptable:i,isIndexable:s}=ri(t);for(const n of e){const e=i(n),o=s(n),a=(o||e)&&t[n];if(e&&(dt(a)||tn(a))||o&&Y(a))return!0}return!1}(o,e)){n.$shared=!1;r=ai(o,i=dt(i)?i():i,this.createResolver(t,i,a))}for(const t of e)n[t]=r[t];return n}createResolver(t,e,i=[""],s){const{resolver:n}=Qs(this._resolverCache,t,i);return U(e)?ai(n,e,void 0,s):n}}function Qs(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:oi(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const tn=t=>U(t)&&Object.getOwnPropertyNames(t).reduce(((e,i)=>e||dt(t[i])),!1);const en=["top","bottom","left","right","chartArea"];function sn(t,e){return"top"===t||"bottom"===t||-1===en.indexOf(t)&&"x"===e}function nn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function on(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),J(i&&i.onComplete,[t],e)}function an(t){const e=t.chart,i=e.options.animation;J(i&&i.onProgress,[t],e)}function rn(t){return ge()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const ln={},hn=t=>{const e=rn(t);return Object.values(ln).filter((t=>t.canvas===e)).pop()};function cn(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class dn{constructor(t,e){const s=this.config=new Js(e),n=rn(t),o=hn(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas can be reused.");const r=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||ls(n)),this.platform.updateConfig(s);const l=this.platform.acquireContext(n,r.aspectRatio),h=l&&l.canvas,c=h&&h.height,d=h&&h.width;this.id=j(),this.ctx=l,this.canvas=h,this.width=d,this.height=c,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Ns,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=i((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],ln[this.id]=this,l&&h?(a.listen(this,"complete",on),a.listen(this,"progress",an),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:s,_aspectRatio:n}=this;return $(t)?e&&n?n:s?i/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ke(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Gt(this.canvas,this.ctx),this}stop(){return a.stop(this),this}resize(t,e){a.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ke(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),J(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){Q(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=Ys(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),Q(n,(e=>{const n=e.options,o=n.id,a=Ys(o,n),r=K(n.type,e.dtype);void 0!==n.position&&sn(n.position,a)===sn(e.dposition)||(n.position=e.dposition),s[o]=!0;let l=null;if(o in i&&i[o].type===r)l=i[o];else{l=new(Ws.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(n,t)})),Q(s,((t,e)=>{t||delete i[e]})),Q(i,(t=>{ni.configure(this,t,t.options),ni.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(nn("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i<s;i++){const s=e[i];let n=this.getDatasetMeta(i);const o=s.type||this.config.type;if(n.type&&n.type!==o&&(this._destroyDatasetMeta(i),n=this.getDatasetMeta(i)),n.type=o,n.indexAxis=s.indexAxis||$s(o,this.options),n.order=s.order||0,n.index=i,n.label=""+s.label,n.visible=this.isDatasetVisible(i),n.controller)n.controller.updateIndex(i),n.controller.linkScales();else{const e=Ws.getController(o),{datasetElementType:s,dataElementType:a}=bt.datasets[o];Object.assign(e.prototype,{dataElementType:Ws.getElement(a),datasetElementType:s&&Ws.getElement(s)}),n.controller=new e(this,i),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){Q(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!s&&-1===n.indexOf(e);e.buildOrUpdateElements(i),o=Math.max(+e.getMaxOverflow(),o)}o=this._minPadding=i.layout.autoPadding?o:0,this._updateLayout(o),s||Q(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(nn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){Q(this.scales,(t=>{ni.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);ut(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){cn(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;t<e;t++)if(!ut(s,i(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ni.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],Q(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,dt(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),s={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(i.controller._update(e),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(a.has(this)?this.attached&&!a.running(this)&&a.start(this):(this.draw(),on({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resize(t,e),this._resizeBeforeDraw=null}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let s,n;for(s=0,n=e.length;s<n;++s){const n=e[s];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,s=!i.disabled,n=this.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",o)&&(s&&Qt(e,{left:!1===i.left?0:n.left-i.left,right:!1===i.right?this.width:n.right+i.right,top:!1===i.top?0:n.top-i.top,bottom:!1===i.bottom?this.height:n.bottom+i.bottom}),t.controller.draw(),s&&te(e),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}getElementsAtEventForMode(t,e,i,s){const n=Ee.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ye(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);ct(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),a.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),Gt(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),this.notifyPlugins("destroy"),delete ln[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};Q(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){Q(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},Q(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a<r;++a){o=t[a];const e=o&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[s+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!tt(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:Jt(t,this.chartArea,this._minPadding)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=ft(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,J(n.onHover,[t,a,this],this),r&&J(n.onClick,[t,a,this],this));const h=!tt(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}const un=()=>Q(dn.instances,(t=>t._plugins.invalidate())),fn=!0;function gn(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}Object.defineProperties(dn,{defaults:{enumerable:fn,value:bt},instances:{enumerable:fn,value:ln},overrides:{enumerable:fn,value:gt},registry:{enumerable:fn,value:Ws},version:{enumerable:fn,value:"3.7.1"},getChart:{enumerable:fn,value:hn},register:{enumerable:fn,value:(...t)=>{Ws.add(...t),un()}},unregister:{enumerable:fn,value:(...t)=>{Ws.remove(...t),un()}}});class pn{constructor(t){this.options=t||{}}formats(){return gn()}parse(t,e){return gn()}format(t,e){return gn()}add(t,e,i){return gn()}diff(t,e,i){return gn()}startOf(t,e,i){return gn()}endOf(t,e){return gn()}}pn.override=function(t){Object.assign(pn.prototype,t)};var mn={_date:pn};function xn(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;e<n;e++)s=s.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=fe(s.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(ct(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;s<n;++s)o=e.getPixelForValue(i[s]),l();for(a=void 0,s=0,n=e.ticks.length;s<n;++s)o=e.getPixelForTick(s),l();return r}function bn(t,e,i,s){return Y(t)?function(t,e,i,s){const n=i.parse(t[0],s),o=i.parse(t[1],s),a=Math.min(n,o),r=Math.max(n,o);let l=a,h=r;Math.abs(a)>Math.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function _n(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;h<c;++h)u=e[h],d={},d[n.axis]=r||n.parse(a[h],h),l.push(bn(u,d,o,h));return l}function yn(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function vn(t,e,i,s){let n=e.borderSkipped;const o={};if(!n)return void(t.borderSkipped=o);const{start:a,end:r,reverse:l,top:h,bottom:c}=function(t){let e,i,s,n,o;return t.horizontal?(e=t.base>t.x,i="left",s="right"):(e=t.base<t.y,i="bottom",s="top"),e?(n="end",o="start"):(n="start",o="end"),{start:i,end:s,reverse:e,top:n,bottom:o}}(t);"middle"===n&&i&&(t.enableBorderRadius=!0,(i._top||0)===s?n=h:(i._bottom||0)===s?n=c:(o[wn(c,a,r,l)]=!0,n=h)),o[wn(n,a,r,l)]=!0,t.borderSkipped=o}function wn(t,e,i,s){var n,o,a;return s?(a=i,t=Mn(t=(n=t)===(o=e)?a:n===a?o:n,i,e)):t=Mn(t,e,i),t}function Mn(t,e,i){return"start"===t?e:"end"===t?i:t}function kn(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class Sn extends Ps{parsePrimitiveData(t,e,i,s){return _n(t,e,i,s)}parseArrayData(t,e,i,s){return _n(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;d<u;++d)g=e[d],f={},f[n.axis]=n.parse(lt(g,l),d),c.push(bn(lt(g,h),f,o,d));return c}updateRangeFromParsed(t,e,i,s){super.updateRangeFromParsed(t,e,i,s);const n=i._custom;n&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:s}=e,n=this.getParsed(t),o=n._custom,a=yn(o)?"["+o.start+", "+o.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,s){const n="reset"===s,{index:o,_cachedMeta:{vScale:a}}=this,r=a.getBasePixel(),l=a.isHorizontal(),h=this._getRuler(),c=this.resolveDataElementOptions(e,s),d=this.getSharedOptions(c),u=this.includeOptions(s,d);this.updateSharedOptions(d,s,c);for(let c=e;c<e+i;c++){const e=this.getParsed(c),i=n||$(e[a.axis])?{base:r,head:r}:this._calculateBarValuePixels(c),f=this._calculateBarIndexPixels(c,h),g=(e._stacks||{})[a.axis],p={horizontal:l,base:i.base,enableBorderRadius:!g||yn(e._custom)||o===g._top||o===g._bottom,x:l?i.head:f.center,y:l?f.center:i.head,height:l?f.size:Math.abs(i.size),width:l?Math.abs(i.size):f.size};u&&(p.options=d||this.resolveDataElementOptions(c,t[c].active?"active":s));const m=p.options||t[c].options;vn(p,m,g,o),kn(p,m,h.ratio),this.updateElement(t[c],c,p,s)}}_getStacks(t,e){const i=this._cachedMeta.iScale,s=i.getMatchingVisibleMetas(this._type),n=i.options.stacked,o=s.length,a=[];let r,l;for(r=0;r<o;++r)if(l=s[r],l.controller.options.grouped){if(void 0!==e){const t=l.controller.getParsed(e)[l.controller._cachedMeta.vScale.axis];if($(t)||isNaN(t))continue}if((!1===n||-1===a.indexOf(l.stack)||void 0===n&&void 0===l.stack)&&a.push(l.stack),l.index===t)break}return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n<o;++n)s.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));const a=t.barThickness;return{min:a||xn(e),pixels:s,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:a?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i},options:{base:s,minBarLength:n}}=this,o=s||0,a=this.getParsed(t),r=a._custom,l=yn(r);let h,c,d=a[e.axis],u=0,f=i?this.applyStack(e,a,i):d;f!==d&&(u=f-d,f=d),l&&(d=r.barStart,f=r.barEnd-r.barStart,0!==d&&Ct(d)!==Ct(r.barEnd)&&(u=0),u+=d);const g=$(s)||l?u:s;let p=e.getPixelForValue(g);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(u+f):p,c=h-p,Math.abs(c)<n&&(c=function(t,e,i){return 0!==t?Ct(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(c,e,o)*n,d===o&&(p-=c/2),h=p+c),p===e.getPixelForValue(o)){const t=Ct(c)*e.getLineWidthForValue(o)/2;p+=t,c-=t}return{size:c,base:p,head:h,center:h+c/2}}_calculateBarIndexPixels(t,e){const i=e.scale,s=this.options,n=s.skipNull,o=K(s.maxBarThickness,1/0);let a,r;if(e.grouped){const i=n?this._getStackCount(t):e.stackCount,l="flex"===s.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t<n.length-1?n[t+1]:null;const l=i.categoryPercentage;null===a&&(a=o-(null===r?e.end-e.start:r-o)),null===r&&(r=o+o-a);const h=o-(o-Math.min(a,r))/2*l;return{chunk:Math.abs(r-a)/2*l/s,ratio:i.barPercentage,start:h}}(t,e,s,i):function(t,e,i,s){const n=i.barThickness;let o,a;return $(n)?(o=e.min*i.categoryPercentage,a=i.barPercentage):(o=n*s,a=1),{chunk:o/s,ratio:a,start:e.pixels[t]-o/2}}(t,e,s,i),h=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0);a=l.start+l.chunk*h+l.chunk/2,r=Math.min(o,l.chunk*l.ratio)}else a=i.getPixelForValue(this.getParsed(t)[i.axis],t),r=Math.min(o,e.min*e.ratio);return{base:a-r/2,head:a+r/2,center:a,size:r}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,s=i.length;let n=0;for(;n<s;++n)null!==this.getParsed(n)[e.axis]&&i[n].draw(this._ctx)}}Sn.id="bar",Sn.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},Sn.overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class Pn extends Ps{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,s){const n=super.parsePrimitiveData(t,e,i,s);for(let t=0;t<n.length;t++)n[t]._custom=this.resolveDataElementOptions(t+i).radius;return n}parseArrayData(t,e,i,s){const n=super.parseArrayData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=K(s[2],this.resolveDataElementOptions(t+i).radius)}return n}parseObjectData(t,e,i,s){const n=super.parseObjectData(t,e,i,s);for(let t=0;t<n.length;t++){const s=e[i+t];n[t]._custom=K(s&&s.r&&+s.r,this.resolveDataElementOptions(t+i).radius)}return n}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:s}=e,n=this.getParsed(t),o=i.getLabelForValue(n.x),a=s.getLabelForValue(n.y),r=n._custom;return{label:e.label,value:"("+o+", "+a+(r?", "+r:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,r=this.resolveDataElementOptions(e,s),l=this.getSharedOptions(r),h=this.includeOptions(s,l),c=o.axis,d=a.axis;for(let r=e;r<e+i;r++){const e=t[r],i=!n&&this.getParsed(r),l={},u=l[c]=n?o.getPixelForDecimal(.5):o.getPixelForValue(i[c]),f=l[d]=n?a.getBasePixel():a.getPixelForValue(i[d]);l.skip=isNaN(u)||isNaN(f),h&&(l.options=this.resolveDataElementOptions(r,e.active?"active":s),n&&(l.options.radius=0)),this.updateElement(e,r,l,s)}this.updateSharedOptions(l,s,r)}resolveDataElementOptions(t,e){const i=this.getParsed(t);let s=super.resolveDataElementOptions(t,e);s.$shared&&(s=Object.assign({},s,{$shared:!1}));const n=s.radius;return"active"!==e&&(s.radius=0),s.radius+=K(i&&i._custom,n),s}}Pn.id="bubble",Pn.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},Pn.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class Dn extends Ps{constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,o,a=t=>+i[t];if(U(i[t])){const{key:t="value"}=this._parsing;a=e=>+lt(i[e],t)}for(n=t,o=t+e;n<o;++n)s._parsed[n]=a(n)}}_getRotation(){return It(this.options.rotation-90)}_getCircumference(){return It(this.options.circumference)}_getRotationExtents(){let t=yt,e=-yt;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)){const s=this.chart.getDatasetMeta(i).controller,n=s._getRotation(),o=s._getCircumference();t=Math.min(t,n),e=Math.max(e,n+o)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,s=this._cachedMeta,n=s.data,o=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,a=Math.max((Math.min(i.width,i.height)-o)/2,0),r=Math.min(G(this.options.cutout,a),1),l=this._getRingWeight(this.index),{circumference:h,rotation:c}=this._getRotationExtents(),{ratioX:d,ratioY:u,offsetX:f,offsetY:g}=function(t,e,i){let s=1,n=1,o=0,a=0;if(e<yt){const r=t,l=r+e,h=Math.cos(r),c=Math.sin(r),d=Math.cos(l),u=Math.sin(l),f=(t,e,s)=>Ht(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>Ht(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(kt,c,u),x=g(_t,h,d),b=g(_t+kt,c,u);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,a=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(c,h,r),p=(i.width-o)/d,m=(i.height-o)/u,x=Math.max(Math.min(p,m)/2,0),b=Z(this.options.radius,x),_=(b-Math.max(b*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*b,this.offsetY=g*b,s.total=this.calculateTotal(),this.outerRadius=b-_*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-_*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/yt)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,f=this.resolveDataElementOptions(e,s),g=this.getSharedOptions(f),p=this.includeOptions(s,g);let m,x=this._getRotation();for(m=0;m<e;++m)x+=this._circumference(m,n);for(m=e;m<e+i;++m){const e=this._circumference(m,n),i=t[m],o={x:l+this.offsetX,y:h+this.offsetY,startAngle:x,endAngle:x+e,circumference:e,outerRadius:u,innerRadius:d};p&&(o.options=g||this.resolveDataElementOptions(m,i.active?"active":s)),x+=e,this.updateElement(i,m,o,s)}this.updateSharedOptions(g,s,f)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,s=0;for(i=0;i<e.length;i++){const n=t._parsed[i];null===n||isNaN(n)||!this.chart.getDataVisibility(i)||e[i].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?yt*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=Ri(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s<n;++s)if(i.isDatasetVisible(s)){o=i.getDatasetMeta(s),t=o.data,a=o.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)r=a.resolveDataElementOptions(s),"inner"!==r.borderAlign&&(e=Math.max(e,r.borderWidth||0,r.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,s=t.length;i<s;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(K(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Dn.id="doughnut",Dn.defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"},Dn.descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t},Dn.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;const i=": "+t.formattedValue;return Y(e)?(e=e.slice(),e[0]+=i):e+=i,e}}}}};class Cn extends Ps{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:s=[],_dataset:n}=e,o=this.chart._animationsDisabled;let{start:a,count:r}=function(t,e,i){const s=e.length;let n=0,o=s;if(t._sorted){const{iScale:a,_parsed:r}=t,l=a.axis,{min:h,max:c,minDefined:d,maxDefined:u}=a.getUserBounds();d&&(n=jt(Math.min(re(r,a.axis,h).lo,i?s:re(e,l,a.getPixelForValue(h)).lo),0,s-1)),o=u?jt(Math.max(re(r,a.axis,c).hi+1,i?0:re(e,l,a.getPixelForValue(c)).hi+1),n,s)-n:s-n}return{start:n,count:o}}(e,s,o);this._drawStart=a,this._drawCount=r,function(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}(e)&&(a=0,r=s.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!n._decimated,i.points=s;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!o,options:l},t),this.updateElements(s,a,r,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a,_stacked:r,_dataset:l}=this._cachedMeta,h=this.resolveDataElementOptions(e,s),c=this.getSharedOptions(h),d=this.includeOptions(s,c),u=o.axis,f=a.axis,{spanGaps:g,segment:p}=this.options,m=Tt(g)?g:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||n||"none"===s;let b=e>0&&this.getParsed(e-1);for(let h=e;h<e+i;++h){const e=t[h],i=this.getParsed(h),g=x?e:{},_=$(i[f]),y=g[u]=o.getPixelForValue(i[u],h),v=g[f]=n||_?a.getBasePixel():a.getPixelForValue(r?this.applyStack(a,i,r):i[f],h);g.skip=isNaN(y)||isNaN(v)||_,g.stop=h>0&&i[u]-b[u]>m,p&&(g.parsed=i,g.raw=l.data[h]),d&&(g.options=c||this.resolveDataElementOptions(h,e.active?"active":s)),x||this.updateElement(e,h,g,s),b=i}this.updateSharedOptions(c,s,h)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}Cn.id="line",Cn.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Cn.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class On extends Ps{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=Ri(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=this.getDataset(),r=o.options.animation,l=this._cachedMeta.rScale,h=l.xCenter,c=l.yCenter,d=l.getIndexAngle(0)-.5*_t;let u,f=d;const g=360/this.countVisibleElements();for(u=0;u<e;++u)f+=this._computeAngle(u,s,g);for(u=e;u<e+i;u++){const e=t[u];let i=f,p=f+this._computeAngle(u,s,g),m=o.getDataVisibility(u)?l.getDistanceFromCenterForValue(a.data[u]):0;f=p,n&&(r.animateScale&&(m=0),r.animateRotate&&(i=p=d));const x={x:h,y:c,innerRadius:0,outerRadius:m,startAngle:i,endAngle:p,options:this.resolveDataElementOptions(u,e.active?"active":s)};this.updateElement(e,u,x,s)}}countVisibleElements(){const t=this.getDataset(),e=this._cachedMeta;let i=0;return e.data.forEach(((e,s)=>{!isNaN(t.data[s])&&this.chart.getDataVisibility(s)&&i++})),i}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?It(this.resolveDataElementOptions(t,e).angle||i):0}}On.id="polarArea",On.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},On.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i}}=t.legend.options;return e.labels.map(((e,s)=>{const n=t.getDatasetMeta(0).controller.getStyle(s);return{text:e,fillStyle:n.backgroundColor,strokeStyle:n.borderColor,lineWidth:n.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(s),index:s}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label:t=>t.chart.data.labels[t.dataIndex]+": "+t.formattedValue}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};class An extends Dn{}An.id="pie",An.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Tn extends Ps{getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this.getDataset(),o=this._cachedMeta.rScale,a="reset"===s;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":s),l=o.getPointPositionForValue(r,n.data[r]),h=a?o.xCenter:l.x,c=a?o.yCenter:l.y,d={x:h,y:c,angle:l.angle,skip:isNaN(h)||isNaN(c),options:i};this.updateElement(e,r,d,s)}}}Tn.id="radar",Tn.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},Tn.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class Ln extends Cn{}Ln.id="scatter",Ln.defaults={showLine:!1,fill:!1},Ln.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var Rn=Object.freeze({__proto__:null,BarController:Sn,BubbleController:Pn,DoughnutController:Dn,LineController:Cn,PolarAreaController:On,PieController:An,RadarController:Tn,ScatterController:Ln});function En(t,e,i){const{startAngle:s,pixelMargin:n,x:o,y:a,outerRadius:r,innerRadius:l}=e;let h=n/r;t.beginPath(),t.arc(o,a,r,s-h,i+h),l>n?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+kt,s-kt),t.closePath(),t.clip()}function In(t,e,i,s){const n=Be(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return jt(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:jt(n.innerStart,0,a),innerEnd:jt(n.innerEnd,0,a)}}function zn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Fn(t,e,i,s,n){const{x:o,y:a,startAngle:r,pixelMargin:l,innerRadius:h}=e,c=Math.max(e.outerRadius+s+i-l,0),d=h>0?h+s+i+l:0;let u=0;const f=n-r;if(s){const t=((h>0?h-s:0)+(c>0?c-s:0))/2;u=(f-(0!==t?f*t/(t+s):f))/2}const g=(f-Math.max(.001,f*c-i/_t)/c)/2,p=r+g+u,m=n-g-u,{outerStart:x,outerEnd:b,innerStart:_,innerEnd:y}=In(e,d,c,m-p),v=c-x,w=c-b,M=p+x/v,k=m-b/w,S=d+_,P=d+y,D=p+_/S,C=m-y/P;if(t.beginPath(),t.arc(o,a,c,M,k),b>0){const e=zn(w,k,o,a);t.arc(e.x,e.y,b,k,m+kt)}const O=zn(P,m,o,a);if(t.lineTo(O.x,O.y),y>0){const e=zn(P,C,o,a);t.arc(e.x,e.y,y,m+kt,C+Math.PI)}if(t.arc(o,a,d,m-y/d,p+_/d,!0),_>0){const e=zn(S,D,o,a);t.arc(e.x,e.y,_,D+Math.PI,p-kt)}const A=zn(v,p,o,a);if(t.lineTo(A.x,A.y),x>0){const e=zn(v,M,o,a);t.arc(e.x,e.y,x,p-kt,M)}t.closePath()}function Bn(t,e,i,s,n){const{options:o}=e,{borderWidth:a,borderJoinStyle:r}=o,l="inner"===o.borderAlign;a&&(l?(t.lineWidth=2*a,t.lineJoin=r||"round"):(t.lineWidth=a,t.lineJoin=r||"bevel"),e.fullCircles&&function(t,e,i){const{x:s,y:n,startAngle:o,pixelMargin:a,fullCircles:r}=e,l=Math.max(e.outerRadius-a,0),h=e.innerRadius+a;let c;for(i&&En(t,e,o+yt),t.beginPath(),t.arc(s,n,h,o+yt,o,!0),c=0;c<r;++c)t.stroke();for(t.beginPath(),t.arc(s,n,l,o,o+yt),c=0;c<r;++c)t.stroke()}(t,e,l),l&&En(t,e,n),Fn(t,e,i,s,n),t.stroke())}class Vn extends Ds{constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=Bt(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:l,outerRadius:h,circumference:c}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=this.options.spacing/2,u=K(c,r-a)>=yt||Ht(n,a,r),f=Yt(o,l+d,h+d);return u&&f}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/2,n=(e.spacing||0)/2;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>yt?Math.floor(i/yt):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();let o=0;if(s){o=s/2;const e=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(e)*o,Math.sin(e)*o),this.circumference>=_t&&(o=s)}t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor;const a=function(t,e,i,s){const{fullCircles:n,startAngle:o,circumference:a}=e;let r=e.endAngle;if(n){Fn(t,e,i,s,o+yt);for(let e=0;e<n;++e)t.fill();isNaN(a)||(r=o+a%yt,a%yt==0&&(r+=yt))}return Fn(t,e,i,s,r),t.fill(),r}(t,this,o,n);Bn(t,this,o,n,a),t.restore()}}function Wn(t,e,i=e){t.lineCap=K(i.borderCapStyle,e.borderCapStyle),t.setLineDash(K(i.borderDash,e.borderDash)),t.lineDashOffset=K(i.borderDashOffset,e.borderDashOffset),t.lineJoin=K(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=K(i.borderWidth,e.borderWidth),t.strokeStyle=K(i.borderColor,e.borderColor)}function Nn(t,e,i){t.lineTo(i.x,i.y)}function Hn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=n<a&&o<a||n>r&&o>r;return{count:s,start:l,loop:e.loop,ilen:h<l&&!c?s+h-l:h-l}}function jn(t,e,i,s){const{points:n,options:o}=e,{count:a,start:r,loop:l,ilen:h}=Hn(n,i,s),c=function(t){return t.stepped?ee:t.tension||"monotone"===t.cubicInterpolationMode?ie:Nn}(o);let d,u,f,{move:g=!0,reverse:p}=s||{};for(d=0;d<=h;++d)u=n[(r+(p?h-d:d))%a],u.skip||(g?(t.moveTo(u.x,u.y),g=!1):c(t,f,u,p,o.stepped),f=u);return l&&(u=n[(r+(p?h:0))%a],c(t,f,u,p,o.stepped)),!!l}function $n(t,e,i,s){const n=e.points,{count:o,start:a,ilen:r}=Hn(n,i,s),{move:l=!0,reverse:h}=s||{};let c,d,u,f,g,p,m=0,x=0;const b=t=>(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(i<f?f=i:i>g&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,f=g=i),p=i}_()}function Yn(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?$n:jn}Vn.id="arc",Vn.defaults={borderAlign:"center",borderColor:"#fff",borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0},Vn.defaultRoutes={backgroundColor:"backgroundColor"};const Un="function"==typeof Path2D;function Xn(t,e,i,s){Un&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Wn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=Yn(e);for(const r of n)Wn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class qn extends Ds{constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;ki(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=Ni(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Wi(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?Ai:t.tension||"monotone"===t.cubicInterpolationMode?Ti:Oi}(i);let l,h;for(l=0,h=o.length;l<h;++l){const{start:h,end:c}=o[l],d=n[h],u=n[c];if(d===u){a.push(d);continue}const f=r(d,u,Math.abs((s-d[e])/(u[e]-d[e])),i.stepped);f[e]=t[e],a.push(f)}return 1===a.length?a[0]:a}pathSegment(t,e,i){return Yn(this)(t,this,e,i)}path(t,e,i){const s=this.segments,n=Yn(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const a of s)o&=n(t,this,a,{start:e,end:e+i-1});return!!o}draw(t,e,i,s){const n=this.options||{};(this.points||[]).length&&n.borderWidth&&(t.save(),Xn(t,this,i,s),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function Kn(t,e,i,s){const n=t.options,{[i]:o}=t.getProps([i],s);return Math.abs(e-o)<n.radius+n.hitRadius}qn.id="line",qn.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},qn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},qn.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class Gn extends Ds{constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.options,{x:n,y:o}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-o,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(t,e){return Kn(this,t,"x",e)}inYRange(t,e){return Kn(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!Jt(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,Zt(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function Zn(t,e){const{x:i,y:s,base:n,width:o,height:a}=t.getProps(["x","y","base","width","height"],e);let r,l,h,c,d;return t.horizontal?(d=a/2,r=Math.min(i,n),l=Math.max(i,n),h=s-d,c=s+d):(d=o/2,r=i-d,l=i+d,h=Math.min(s,n),c=Math.max(s,n)),{left:r,top:h,right:l,bottom:c}}function Jn(t,e,i,s){return t?0:jt(e,i,s)}function Qn(t){const e=Zn(t),i=e.right-e.left,s=e.bottom-e.top,n=function(t,e,i){const s=t.options.borderWidth,n=t.borderSkipped,o=Ve(s);return{t:Jn(n.top,o.top,0,i),r:Jn(n.right,o.right,0,e),b:Jn(n.bottom,o.bottom,0,i),l:Jn(n.left,o.left,0,e)}}(t,i/2,s/2),o=function(t,e,i){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,o=We(n),a=Math.min(e,i),r=t.borderSkipped,l=s||U(n);return{topLeft:Jn(!l||r.top||r.left,o.topLeft,0,a),topRight:Jn(!l||r.top||r.right,o.topRight,0,a),bottomLeft:Jn(!l||r.bottom||r.left,o.bottomLeft,0,a),bottomRight:Jn(!l||r.bottom||r.right,o.bottomRight,0,a)}}(t,i/2,s/2);return{outer:{x:e.left,y:e.top,w:i,h:s,radius:o},inner:{x:e.left+n.l,y:e.top+n.t,w:i-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,o.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(n.b,n.r))}}}}function to(t,e,i,s){const n=null===e,o=null===i,a=t&&!(n&&o)&&Zn(t,s);return a&&(n||Yt(e,a.left,a.right))&&(o||Yt(i,a.top,a.bottom))}function eo(t,e){t.rect(e.x,e.y,e.w,e.h)}function io(t,e,i={}){const s=t.x!==i.x?-e:0,n=t.y!==i.y?-e:0,o=(t.x+t.w!==i.x+i.w?e:0)-s,a=(t.y+t.h!==i.y+i.h?e:0)-n;return{x:t.x+s,y:t.y+n,w:t.w+o,h:t.h+a,radius:t.radius}}Gn.id="point",Gn.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},Gn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class so extends Ds{constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:e,options:{borderColor:i,backgroundColor:s}}=this,{inner:n,outer:o}=Qn(this),a=(r=o.radius).topLeft||r.topRight||r.bottomLeft||r.bottomRight?oe:eo;var r;t.save(),o.w===n.w&&o.h===n.h||(t.beginPath(),a(t,io(o,e,n)),t.clip(),a(t,io(n,-e,o)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),a(t,io(n,e)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,e,i){return to(this,t,e,i)}inXRange(t,e){return to(this,t,null,e)}inYRange(t,e){return to(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(e+s)/2:e,y:n?i:(i+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}so.id="bar",so.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0},so.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var no=Object.freeze({__proto__:null,ArcElement:Vn,LineElement:qn,PointElement:Gn,BarElement:so});function oo(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}function ao(t){t.data.datasets.forEach((t=>{oo(t)}))}var ro={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void ao(t);const s=t.width;t.data.datasets.forEach(((e,n)=>{const{_data:o,indexAxis:a}=e,r=t.getDatasetMeta(n),l=o||e.data;if("y"===je([a,t.options.indexAxis]))return;if("line"!==r.type)return;const h=t.scales[r.xAxisID];if("linear"!==h.type&&"time"!==h.type)return;if(t.options.parsing)return;let{start:c,count:d}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=jt(re(e,o.axis,a).lo,0,i-1)),s=h?jt(re(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(r,l);if(d<=(i.threshold||4*s))return void oo(e);let u;switch($(o)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;c<o-2;c++){let s,n=0,o=0;const h=Math.floor((c+1)*r)+1+e,m=Math.min(Math.floor((c+2)*r)+1,i)+e,x=m-h;for(s=h;s<m;s++)n+=t[s].x,o+=t[s].y;n/=x,o/=x;const b=Math.floor(c*r)+1+e,_=Math.min(Math.floor((c+1)*r)+1,i)+e,{x:y,y:v}=t[p];for(u=f=-1,s=b;s<_;s++)f=.5*Math.abs((y-n)*(t[s].y-v)-(y-t[s].x)*(o-v)),f>u&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(l,c,d,s,i);break;case"min-max":u=function(t,e,i,s){let n,o,a,r,l,h,c,d,u,f,g=0,p=0;const m=[],x=e+i-1,b=t[e].x,_=t[x].x-b;for(n=e;n<e+i;++n){o=t[n],a=(o.x-b)/_*s,r=o.y;const e=0|a;if(e===l)r<u?(u=r,h=n):r>f&&(f=r,c=n),g=(p*g+o.x)/++p;else{const i=n-1;if(!$(h)&&!$(c)){const e=Math.min(h,c),s=Math.max(h,c);e!==d&&e!==i&&m.push({...t[e],x:g}),s!==d&&s!==i&&m.push({...t[s],x:g})}n>0&&i!==d&&m.push(t[i]),m.push(o),l=e,p=0,u=f=r,h=c=d=n}}return m}(l,c,d,s);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){ao(t)}};function lo(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=K(i&&i.target,i);return void 0===s&&(s=!!e.backgroundColor),!1!==s&&null!==s&&(!0===s?"origin":s)}(t);if(U(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return X(n)&&Math.floor(n)===n?("-"!==s[0]&&"+"!==s[0]||(n=e+n),!(n===e||n<0||n>=i)&&n):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}class ho{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:s,y:n,radius:o}=this;return e=e||{start:0,end:yt},t.arc(s,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:s}=this,n=t.angle;return{x:e+Math.cos(n)*s,y:i+Math.sin(n)*s,angle:n}}}function co(t){return(t.scale||{}).getPointPositionForValue?function(t){const{scale:e,fill:i}=t,s=e.options,n=e.getLabels().length,o=[],a=s.reverse?e.max:e.min,r=s.reverse?e.min:e.max;let l,h,c;if(c="start"===i?a:"end"===i?r:U(i)?i.value:e.getBaseValue(),s.grid.circular)return h=e.getPointPositionForValue(0,a),new ho({x:h.x,y:h.y,radius:e.getDistanceFromCenterForValue(c)});for(l=0;l<n;++l)o.push(e.getPointPositionForValue(l,c));return o}(t):function(t){const{scale:e={},fill:i}=t;let s,n=null;return"start"===i?n=e.bottom:"end"===i?n=e.top:U(i)?n=e.getPixelForValue(i.value):e.getBasePixel&&(n=e.getBasePixel()),X(n)?(s=e.isHorizontal(),{x:s?n:null,y:s?null:n}):null}(t)}function uo(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function fo(t,e,i){const s=[];for(let n=0;n<i.length;n++){const o=i[n],{first:a,last:r,point:l}=go(o,e,"x");if(!(!l||a&&r))if(a)s.unshift(l);else if(t.push(l),!r)break}t.push(...s)}function go(t,e,i){const s=t.interpolate(e,i);if(!s)return{};const n=s[i],o=t.segments,a=t.points;let r=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],s=a[e.start][i],h=a[e.end][i];if(Yt(n,s,h)){r=n===s,l=n===h;break}}return{first:r,last:l,point:s}}function po(t){const{chart:e,fill:i,line:s}=t;if(X(i))return function(t,e){const i=t.getDatasetMeta(e);return i&&t.isDatasetVisible(e)?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:s}=t,n=[],o=s.segments,a=s.points,r=function(t,e){const i=[],s=t.getMatchingVisibleMetas("line");for(let t=0;t<s.length;t++){const n=s[t];if(n.index===e)break;n.hidden||i.unshift(n.dataset)}return i}(e,i);r.push(mo({x:null,y:e.bottom},s));for(let t=0;t<o.length;t++){const e=o[t];for(let t=e.start;t<=e.end;t++)fo(n,a[t],r)}return new qn({points:n,options:{}})}(t);if("shape"===i)return!0;const n=co(t);return n instanceof ho?n:mo(n,s)}function mo(t,e){let i=[],s=!1;return Y(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=uo(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new qn({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function xo(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!X(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function bo(t,e,i){const{segments:s,points:n}=e;let o=!0,a=!1;t.beginPath();for(const r of s){const{start:s,end:l}=r,h=n[s],c=n[uo(s,l,n)];o?(t.moveTo(h.x,h.y),o=!1):(t.lineTo(h.x,i),t.lineTo(h.x,h.y)),a=!!e.pathSegment(t,r,{move:a}),a?t.closePath():t.lineTo(c.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function _o(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=Nt(n),o=Nt(o)),{property:t,start:n,end:o}}function yo(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function vo(t,e,i){const{top:s,bottom:n}=e.chart.chartArea,{property:o,start:a,end:r}=i||{};"x"===o&&(t.beginPath(),t.rect(a,s,r-a,n-s),t.clip())}function wo(t,e,i,s){const n=e.interpolate(i,s);n&&t.lineTo(n.x,n.y)}function Mo(t,e){const{line:i,target:s,property:n,color:o,scale:a}=e,r=function(t,e,i){const s=t.segments,n=t.points,o=e.points,a=[];for(const t of s){let{start:s,end:r}=t;r=uo(s,r,n);const l=_o(i,n[s],n[r],t.loop);if(!e.segments){a.push({source:t,target:l,start:n[s],end:n[r]});continue}const h=Wi(e,l);for(const e of h){const s=_o(i,o[e.start],o[e.end],e.loop),r=Vi(t,n,s);for(const t of r)a.push({source:t,target:e,start:{[i]:yo(l,s,"start",Math.max)},end:{[i]:yo(l,s,"end",Math.min)}})}}return a}(i,s,n);for(const{source:e,target:l,start:h,end:c}of r){const{style:{backgroundColor:r=o}={}}=e,d=!0!==s;t.save(),t.fillStyle=r,vo(t,a,d&&_o(n,h,c)),t.beginPath();const u=!!i.pathSegment(t,e);let f;if(d){u?t.closePath():wo(t,s,c,n);const e=!!s.pathSegment(t,l,{move:u,reverse:!0});f=u&&e,f||wo(t,s,h,n)}t.closePath(),t.fill(f?"evenodd":"nonzero"),t.restore()}}function ko(t,e,i){const s=po(e),{line:n,scale:o,axis:a}=e,r=n.options,l=r.fill,h=r.backgroundColor,{above:c=h,below:d=h}=l||{};s&&n.points.length&&(Qt(t,i),function(t,e){const{line:i,target:s,above:n,below:o,area:a,scale:r}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&o!==n&&(bo(t,s,a.top),Mo(t,{line:i,target:s,color:n,scale:r,property:l}),t.restore(),t.save(),bo(t,s,a.bottom)),Mo(t,{line:i,target:s,color:o,scale:r,property:l}),t.restore()}(t,{line:n,target:s,above:c,below:d,area:i,scale:o,axis:a}),te(t))}var So={id:"filler",afterDatasetsUpdate(t,e,i){const s=(t.data.datasets||[]).length,n=[];let o,a,r,l;for(a=0;a<s;++a)o=t.getDatasetMeta(a),r=o.dataset,l=null,r&&r.options&&r instanceof qn&&(l={visible:t.isDatasetVisible(a),index:a,fill:lo(r,a,s),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:r}),o.$filler=l,n.push(l);for(a=0;a<s;++a)l=n[a],l&&!1!==l.fill&&(l.fill=xo(n,a,i.propagate))},beforeDraw(t,e,i){const s="beforeDraw"===i.drawTime,n=t.getSortedVisibleDatasetMetas(),o=t.chartArea;for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&ko(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;i&&ko(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;s&&!1!==s.fill&&"beforeDatasetDraw"===i.drawTime&&ko(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Po=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class Do extends Ds{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=J(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=He(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=Po(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,n,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const p=i+e/2+n.measureText(t.text).width;o>0&&u+s+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:s},d=Math.max(d,p),u+=s+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:o}}=this,a=Ei(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=n(i,this.left+s,this.right-this.lineWidths[o]);for(const l of e)o!==l.row&&(o=l.row,r=n(i,this.left+s,this.right-this.lineWidths[o])),l.top+=this.top+t+s,l.left=a.leftForLtr(a.x(r),l.width),r+=l.width+s}else{let o=0,r=n(i,this.top+t+s,this.bottom-this.columnSizes[o].height);for(const l of e)l.col!==o&&(o=l.col,r=n(i,this.top+t+s,this.bottom-this.columnSizes[o].height)),l.top=r,l.left+=this.left+s,l.left=a.leftForLtr(a.x(l.left),l.width),r+=l.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Qt(t,this),this._draw(),te(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:a,labels:r}=t,l=bt.color,h=Ei(t.rtl,this.left,this.width),c=He(r.font),{color:d,padding:u}=r,f=c.size,g=f/2;let p;this.drawTitle(),s.textAlign=h.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=c.string;const{boxWidth:m,boxHeight:x,itemHeight:b}=Po(r,f),_=this.isHorizontal(),y=this._computeTitleHeight();p=_?{x:n(a,this.left+u,this.right-i[0]),y:this.top+u+y,line:0}:{x:this.left+u,y:n(a,this.top+y+u,this.bottom-e[0].height),line:0},Ii(this.ctx,t.textDirection);const v=b+u;this.legendItems.forEach(((w,M)=>{s.strokeStyle=w.fontColor||d,s.fillStyle=w.fontColor||d;const k=s.measureText(w.text).width,S=h.textAlign(w.textAlign||(w.textAlign=r.textAlign)),P=m+g+k;let D=p.x,C=p.y;h.setWidth(this.width),_?M>0&&D+P+u>this.right&&(C=p.y+=v,p.line++,D=p.x=n(a,this.left+u,this.right-i[p.line])):M>0&&C+v>this.bottom&&(D=p.x=D+e[p.line].width+u,p.line++,C=p.y=n(a,this.top+y+u,this.bottom-e[p.line].height));!function(t,e,i){if(isNaN(m)||m<=0||isNaN(x)||x<0)return;s.save();const n=K(i.lineWidth,1);if(s.fillStyle=K(i.fillStyle,l),s.lineCap=K(i.lineCap,"butt"),s.lineDashOffset=K(i.lineDashOffset,0),s.lineJoin=K(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=K(i.strokeStyle,l),s.setLineDash(K(i.lineDash,[])),r.usePointStyle){const o={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},a=h.xPlus(t,m/2);Zt(s,o,a,e+g)}else{const o=e+Math.max((f-x)/2,0),a=h.leftForLtr(t,m),r=We(i.borderRadius);s.beginPath(),Object.values(r).some((t=>0!==t))?oe(s,{x:a,y:o,w:m,h:x,radius:r}):s.rect(a,o,m,x),s.fill(),0!==n&&s.stroke()}s.restore()}(h.x(D),C,w),D=o(S,D+m+g,_?D+P:this.right,t.rtl),function(t,e,i){se(s,i.text,t,e+b/2,c,{strikethrough:i.hidden,textAlign:h.textAlign(i.textAlign)})}(h.x(D),C,w),_?p.x+=P+u:p.y+=v})),zi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=He(e.font),o=Ne(e.padding);if(!e.display)return;const a=Ei(t.rtl,this.left,this.width),r=this.ctx,l=e.position,h=i.size/2,c=o.top+h;let d,u=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),d=this.top+c,u=n(t.align,u,this.right-f);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);d=c+n(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const g=n(l,u,u+f);r.textAlign=a.textAlign(s(l)),r.textBaseline="middle",r.strokeStyle=e.color,r.fillStyle=e.color,r.font=i.string,se(r,e.text,g,d,i)}_computeTitleHeight(){const t=this.options.title,e=He(t.font),i=Ne(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(Yt(t,this.left,this.right)&&Yt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(s=n[i],Yt(t,s.left,s.left+s.width)&&Yt(e,s.top,s.top+s.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if("mousemove"===t&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type){const o=this._hoveredItem,a=(n=i,null!==(s=o)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);o&&!a&&J(e.onLeave,[t,o,this],this),this._hoveredItem=i,i&&!a&&J(e.onHover,[t,i,this],this)}else i&&J(e.onClick,[t,i,this],this);var s,n}}var Co={id:"legend",_element:Do,start(t,e,i){const s=t.legend=new Do({ctx:t.ctx,options:i,chart:t});ni.configure(t,s,i),ni.addBox(t,s)},stop(t){ni.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const s=t.legend;ni.configure(t,s,i),s.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const s=e.datasetIndex,n=i.chart;n.isDatasetVisible(s)?(n.hide(s),e.hidden=!0):(n.show(s),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const a=t.controller.getStyle(i?0:void 0),r=Ne(a.borderWidth);return{text:e[t.index].label,fillStyle:a.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:(r.width+r.height)/4,strokeStyle:a.borderColor,pointStyle:s||a.pointStyle,rotation:a.rotation,textAlign:n||a.textAlign,borderRadius:0,datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class Oo extends Ds{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=Y(i.text)?i.text.length:1;this._padding=Ne(i.padding);const n=s*He(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:o,options:a}=this,r=a.align;let l,h,c,d=0;return this.isHorizontal()?(h=n(r,i,o),c=e+t,l=o-i):("left"===a.position?(h=i+t,c=n(r,s,e),d=-.5*_t):(h=o-t,c=n(r,e,s),d=.5*_t),l=s-e),{titleX:h,titleY:c,maxWidth:l,rotation:d}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=He(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:r,rotation:l}=this._drawArgs(n);se(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:l,textAlign:s(e.align),textBaseline:"middle",translation:[o,a]})}}var Ao={id:"title",_element:Oo,start(t,e,i){!function(t,e){const i=new Oo({ctx:t.ctx,options:e,chart:t});ni.configure(t,i,e),ni.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ni.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ni.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const To=new WeakMap;var Lo={id:"subtitle",start(t,e,i){const s=new Oo({ctx:t.ctx,options:i,chart:t});ni.configure(t,s,i),ni.addBox(t,s),To.set(t,s)},stop(t){ni.removeBox(t,To.get(t)),To.delete(t)},beforeUpdate(t,e,i){const s=To.get(t);ni.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ro={average(t){if(!t.length)return!1;let e,i,s=0,n=0,o=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();s+=t.x,n+=t.y,++o}}return{x:s/o,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i<s;++i){const s=t[i].element;if(s&&s.hasValue()){const t=Vt(e,s.getCenterPoint());t<r&&(r=t,n=s)}}if(n){const t=n.tooltipPosition();o=t.x,a=t.y}return{x:o,y:a}}};function Eo(t,e){return e&&(Y(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Io(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function zo(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Fo(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=He(e.bodyFont),h=He(e.titleFont),c=He(e.footerFont),d=o.length,u=n.length,f=s.length,g=Ne(e.padding);let p=g.height,m=0,x=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(x+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),x){p+=f*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(x-f)*l.lineHeight+(x-1)*e.bodySpacing}u&&(p+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let b=0;const _=function(t){m=Math.max(m,i.measureText(t).width+b)};return i.save(),i.font=h.string,Q(t.title,_),i.font=l.string,Q(t.beforeBody.concat(t.afterBody),_),b=e.displayColors?a+2+e.boxPadding:0,Q(s,(t=>{Q(t.before,_),Q(t.lines,_),Q(t.after,_)})),b=0,i.font=c.string,Q(t.footer,_),i.restore(),m+=g.width,{width:m,height:p}}function Bo(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function Vo(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return i<s/2?"top":i>t.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||Bo(t,e,i,s),yAlign:s}}function Wo(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=We(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:jt(g,0,s.width-e.width),y:jt(p,0,s.height-e.height)}}function No(t,e,i){const s=Ne(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function Ho(t){return Eo([],Io(t))}function jo(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class $o extends Ds{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const e=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&e.options.animation&&i.animations,n=new gs(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Ye(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,s=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);let a=[];return a=Eo(a,Io(s)),a=Eo(a,Io(n)),a=Eo(a,Io(o)),a}getBeforeBody(t,e){return Ho(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const{callbacks:i}=e,s=[];return Q(t,(t=>{const e={before:[],lines:[],after:[]},n=jo(i,t);Eo(e.before,Io(n.beforeLabel.call(this,t))),Eo(e.lines,n.label.call(this,t)),Eo(e.after,Io(n.afterLabel.call(this,t))),s.push(e)})),s}getAfterBody(t,e){return Ho(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,s=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);let a=[];return a=Eo(a,Io(s)),a=Eo(a,Io(n)),a=Eo(a,Io(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;a<r;++a)l.push(zo(this.chart,e[a]));return t.filter&&(l=l.filter(((e,s,n)=>t.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),Q(l,(e=>{const i=jo(t.callbacks,e);s.push(i.labelColor.call(this,e)),n.push(i.labelPointStyle.call(this,e)),o.push(i.labelTextColor.call(this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Ro[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Fo(this,i),a=Object.assign({},t,e),r=Vo(this.chart,i,a),l=Wo(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=We(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,x,b,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,b=_+o,y=_-o):(p=d+f,m=p+o,b=_-o,y=_+o),x=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(b=u,_=b-o,p=m-o,x=m+o):(b=u+g,_=b+o,p=m+o,x=m-o),y=b),{x1:p,x2:m,x3:x,y1:b,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=Ei(i.rtl,this.x,this.width);for(t.x=No(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=He(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r<n;++r)e.fillText(s[r],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+a,r+1===n&&(t.y+=i.titleMarginBottom-a)}}_drawColorBox(t,e,i,s,n){const o=this.labelColors[i],a=this.labelPointStyles[i],{boxHeight:r,boxWidth:l,boxPadding:h}=n,c=He(n.bodyFont),d=No(this,"left",n),u=s.x(d),f=r<c.lineHeight?(c.lineHeight-r)/2:0,g=e.y+f;if(n.usePointStyle){const e={radius:Math.min(l,r)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},i=s.leftForLtr(u,l)+l/2,h=g+r/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Zt(t,e,i,h),t.strokeStyle=o.borderColor,t.fillStyle=o.backgroundColor,Zt(t,e,i,h)}else{t.lineWidth=o.borderWidth||1,t.strokeStyle=o.borderColor,t.setLineDash(o.borderDash||[]),t.lineDashOffset=o.borderDashOffset||0;const e=s.leftForLtr(u,l-h),i=s.leftForLtr(s.xPlus(u,1),l-h-2),a=We(o.borderRadius);Object.values(a).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,oe(t,{x:e,y:g,w:l,h:r,radius:a}),t.fill(),t.stroke(),t.fillStyle=o.backgroundColor,t.beginPath(),oe(t,{x:i,y:g+1,w:l-2,h:r-2,radius:a}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,l,r),t.strokeRect(e,g,l,r),t.fillStyle=o.backgroundColor,t.fillRect(i,g+1,l-2,r-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=He(i.bodyFont);let d=c.lineHeight,u=0;const f=Ei(i.rtl,this.x,this.width),g=function(i){e.fillText(i,f.x(t.x+u),t.y+d/2),t.y+=d+n},p=f.textAlign(o);let m,x,b,_,y,v,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=No(this,p,i),e.fillStyle=i.bodyColor,Q(this.beforeBody,g),u=a&&"right"!==p?"center"===o?l/2+h:l+2+h:0,_=0,v=s.length;_<v;++_){for(m=s[_],x=this.labelTextColors[_],e.fillStyle=x,Q(m.before,g),b=m.lines,a&&b.length&&(this._drawColorBox(e,t,_,f,i),d=Math.max(c.lineHeight,r)),y=0,w=b.length;y<w;++y)g(b[y]),d=c.lineHeight;Q(m.after,g)}u=0,d=c.lineHeight,Q(this.afterBody,g),t.y-=n}drawFooter(t,e,i){const s=this.footer,n=s.length;let o,a;if(n){const r=Ei(i.rtl,this.x,this.width);for(t.x=No(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=r.textAlign(i.footerAlign),e.textBaseline="middle",o=He(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,a=0;a<n;++a)e.fillText(s[a],r.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,s){const{xAlign:n,yAlign:o}=this,{x:a,y:r}=t,{width:l,height:h}=i,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=We(s.cornerRadius);e.fillStyle=s.backgroundColor,e.strokeStyle=s.borderColor,e.lineWidth=s.borderWidth,e.beginPath(),e.moveTo(a+c,r),"top"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+l-d,r),e.quadraticCurveTo(a+l,r,a+l,r+d),"center"===o&&"right"===n&&this.drawCaret(t,e,i,s),e.lineTo(a+l,r+h-f),e.quadraticCurveTo(a+l,r+h,a+l-f,r+h),"bottom"===o&&this.drawCaret(t,e,i,s),e.lineTo(a+u,r+h),e.quadraticCurveTo(a,r+h,a,r+h-u),"center"===o&&"left"===n&&this.drawCaret(t,e,i,s),e.lineTo(a,r+c),e.quadraticCurveTo(a,r,a+c,r),e.closePath(),e.fill(),s.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Ro[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Fo(this,t),a=Object.assign({},i,this._size),r=Vo(e,t,a),l=Wo(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=Ne(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Ii(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),zi(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!tt(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!tt(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e;const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Ro[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}$o.positioners=Ro;var Yo={id:"tooltip",_element:$o,positioners:Ro,afterInit(t,e,i){i&&(t.tooltip=new $o({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip,i={tooltip:e};!1!==t.notifyPlugins("beforeTooltipDraw",i)&&(e&&e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i))},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:{beforeTitle:H,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex<s)return i[e.dataIndex]}return""},afterTitle:H,beforeBody:H,beforeLabel:H,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return $(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:H,afterBody:H,beforeFooter:H,footer:H,afterFooter:H}},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Uo=Object.freeze({__proto__:null,Decimation:ro,Filler:So,Legend:Co,SubTitle:Lo,Title:Ao,Tooltip:Yo});function Xo(t,e,i,s){const n=t.indexOf(e);if(-1===n)return((t,e,i,s)=>("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}class qo extends Bs{constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if($(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:jt(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:Xo(i,t,K(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Ko(t,e,{horizontal:i,minRotation:s}){const n=It(s),o=(i?Math.sin(n):Math.cos(n))||.001,a=.75*e*(""+t).length;return Math.min(e/o,a)}qo.id="category",qo.defaults={ticks:{callback:qo.prototype.getLabelForValue}};class Go extends Bs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return $(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:s,max:n}=this;const o=t=>s=e?s:t,a=t=>n=i?n:t;if(t){const t=Ct(s),e=Ct(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=1;(n>=Number.MAX_SAFE_INTEGER||s<=Number.MIN_SAFE_INTEGER)&&(e=Math.abs(.05*n)),a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const s=function(t,e){const i=[],{bounds:s,step:n,min:o,max:a,precision:r,count:l,maxTicks:h,maxDigits:c,includeBounds:d}=t,u=n||1,f=h-1,{min:g,max:p}=e,m=!$(o),x=!$(a),b=!$(l),_=(p-g)/(c+1);let y,v,w,M,k=Ot((p-g)/f/u)*u;if(k<1e-14&&!m&&!x)return[{value:g},{value:p}];M=Math.ceil(p/k)-Math.floor(g/k),M>f&&(k=Ot(M*k/f/u)*u),$(r)||(y=Math.pow(10,r),k=Math.ceil(k*y)/y),"ticks"===s?(v=Math.floor(g/k)*k,w=Math.ceil(p/k)*k):(v=g,w=p),m&&x&&n&&Rt((a-o)/n,k/1e3)?(M=Math.round(Math.min((a-o)/k,h)),k=(a-o)/M,v=o,w=a):b?(v=m?o:v,w=x?a:w,M=l-1,k=(w-v)/M):(M=(w-v)/k,M=Lt(M,Math.round(M),k/1e3)?Math.round(M):Math.ceil(M));const S=Math.max(Ft(k),Ft(v));y=Math.pow(10,$(r)?S:r),v=Math.round(v*y)/y,w=Math.round(w*y)/y;let P=0;for(m&&(d&&v!==o?(i.push({value:o}),v<o&&P++,Lt(Math.round((v+P*k)*y)/y,o,Ko(o,_,t))&&P++):v<o&&P++);P<M;++P)i.push({value:Math.round((v+P*k)*y)/y});return x&&d&&w!==a?i.length&&Lt(i[i.length-1].value,a,Ko(a,_,t))?i[i.length-1].value=a:i.push({value:a}):x&&w!==a||i.push({value:w}),i}({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&Et(s,this,"value"),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return Ri(t,this.chart.options.locale,this.options.ticks.format)}}class Zo extends Go{determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?t:0,this.max=X(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=It(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}function Jo(t){return 1===t/Math.pow(10,Math.floor(Dt(t)))}Zo.id="linear",Zo.defaults={ticks:{callback:Os.formatters.numeric}};class Qo extends Bs{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Go.prototype.parse.apply(this,[t,e]);if(0!==i)return X(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=X(t)?Math.max(0,t):null,this.max=X(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t,a=(t,e)=>Math.pow(10,Math.floor(Dt(t))+e);i===s&&(i<=0?(n(1),o(10)):(n(a(i,-1)),o(a(s,1)))),i<=0&&n(a(s,-1)),s<=0&&o(a(i,1)),this._zero&&this.min!==this._suggestedMin&&i===a(this.min,0)&&n(a(i,-1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=function(t,e){const i=Math.floor(Dt(e.max)),s=Math.ceil(e.max/Math.pow(10,i)),n=[];let o=q(t.min,Math.pow(10,Math.floor(Dt(e.min)))),a=Math.floor(Dt(o)),r=Math.floor(o/Math.pow(10,a)),l=a<0?Math.pow(10,Math.abs(a)):1;do{n.push({value:o,major:Jo(o)}),++r,10===r&&(r=1,++a,l=a>=0?1:l),o=Math.round(r*Math.pow(10,a)*l)/l}while(a<i||a===i&&r<s);const h=q(t.max,o);return n.push({value:h,major:Jo(o)}),n}({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&Et(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":Ri(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=Dt(t),this._valueRange=Dt(this.max)-Dt(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Dt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function ta(t){const e=t.ticks;if(e.display&&t.display){const t=Ne(e.backdropPadding);return K(e.font&&e.font.size,bt.font.size)+t.height}return 0}function ea(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:t<s||t>n?{start:e-i,end:e}:{start:e,end:e+i}}function ia(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],n=[],o=t._pointLabels.length,a=t.options.pointLabels,r=a.centerPointLabels?_t/o:0;for(let d=0;d<o;d++){const o=a.setContext(t.getPointLabelContext(d));n[d]=o.padding;const u=t.getPointPosition(d,t.drawingArea+n[d],r),f=He(o.font),g=(l=t.ctx,h=f,c=Y(c=t._pointLabels[d])?c:[c],{w:qt(l,h.string,c),h:c.length*h.lineHeight});s[d]=g;const p=Nt(t.getIndexAngle(d)+r),m=Math.round(zt(p));sa(i,e,p,ea(m,u.x,g.w,0,180),ea(m,u.y,g.h,90,270))}var l,h,c;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const s=[],n=t._pointLabels.length,o=t.options,a=ta(o)/2,r=t.drawingArea,l=o.pointLabels.centerPointLabels?_t/n:0;for(let o=0;o<n;o++){const n=t.getPointPosition(o,r+a+i[o],l),h=Math.round(zt(Nt(n.angle+kt))),c=e[o],d=aa(n.y,c.h,h),u=na(h),f=oa(n.x,c.w,u);s.push({x:n.x,y:d,textAlign:u,left:f,top:d,right:f+c.w,bottom:d+c.h})}return s}(t,s,n)}function sa(t,e,i,s,n){const o=Math.abs(Math.sin(i)),a=Math.abs(Math.cos(i));let r=0,l=0;s.start<e.l?(r=(e.l-s.start)/o,t.l=Math.min(t.l,e.l-r)):s.end>e.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.start<e.t?(l=(e.t-n.start)/a,t.t=Math.min(t.t,e.t-l)):n.end>e.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function na(t){return 0===t||180===t?"center":t<180?"left":"right"}function oa(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function aa(t,e,i){return 90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e),t}function ra(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,yt);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;o<s;o++)i=t.getPointPosition(o,e),n.lineTo(i.x,i.y)}}Qo.id="logarithmic",Qo.defaults={ticks:{callback:Os.formatters.logarithmic,major:{enabled:!0}}};class la extends Go{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Ne(ta(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=X(t)&&!isNaN(t)?t:0,this.max=X(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ta(this.options))}generateTickLabels(t){Go.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=J(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?ia(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return Nt(t*(yt/(this._pointLabels.length||1))+It(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if($(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if($(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Ye(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const s=this.getIndexAngle(t)-kt+i;return{x:Math.cos(s)*e+this.xCenter,y:Math.sin(s)*e+this.yCenter,angle:s}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:s,bottom:n}=this._pointLabelItems[t];return{left:e,top:i,right:s,bottom:n}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),ra(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:s}=e,n=this._pointLabels.length;let o,a,r;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:s}}=t;for(let n=e-1;n>=0;n--){const e=s.setContext(t.getPointLabelContext(n)),o=He(e.font),{x:a,y:r,textAlign:l,left:h,top:c,right:d,bottom:u}=t._pointLabelItems[n],{backdropColor:f}=e;if(!$(f)){const t=Ne(e.backdropPadding);i.fillStyle=f,i.fillRect(h-t.left,c-t.top,d-h+t.width,u-c+t.height)}se(i,t._pointLabels[n],a,r+o.lineHeight/2,o,{color:e.color,textAlign:l,textBaseline:"middle"})}}(this,n),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e){a=this.getDistanceFromCenterForValue(t.value);!function(t,e,i,s){const n=t.ctx,o=e.circular,{color:a,lineWidth:r}=e;!o&&!s||!a||!r||i<0||(n.save(),n.strokeStyle=a,n.lineWidth=r,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),ra(t,i,o,s),n.closePath(),n.stroke(),n.restore())}(this,s.setContext(this.getContext(e-1)),a,n)}})),i.display){for(t.save(),o=n-1;o>=0;o--){const s=i.setContext(this.getPointLabelContext(o)),{color:n,lineWidth:l}=s;l&&n&&(t.lineWidth=l,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,a=this.getDistanceFromCenterForValue(e.ticks.reverse?this.min:this.max),r=this.getPointPosition(o,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(r.x,r.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=He(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=Ne(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}se(t,s.label,0,-n,l,{color:r.color})})),t.restore()}drawTitle(){}}la.id="radialLinear",la.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Os.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}},la.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},la.descriptors={angleLines:{_fallback:"grid"}};const ha={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ca=Object.keys(ha);function da(t,e){return t-e}function ua(t,e){if($(e))return null;const i=t._adapter,{parser:s,round:n,isoWeekday:o}=t._parseOpts;let a=e;return"function"==typeof s&&(a=s(a)),X(a)||(a="string"==typeof s?i.parse(a,s):i.parse(a)),null===a?null:(n&&(a="week"!==n||!Tt(o)&&!0!==o?i.startOf(a,n):i.startOf(a,"isoWeek",o)),+a)}function fa(t,e,i,s){const n=ca.length;for(let o=ca.indexOf(t);o<n-1;++o){const t=ha[ca[o]],n=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(n*t.size))<=s)return ca[o]}return ca[n-1]}function ga(t,e,i){if(i){if(i.length){const{lo:s,hi:n}=ae(i,e);t[i[s]>=e?i[s]:i[n]]=!0}}else t[e]=!0}function pa(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a<o;++a)r=e[a],n[r]=a,s.push({value:r,major:!1});return 0!==o&&i?function(t,e,i,s){const n=t._adapter,o=+n.startOf(e[0].value,s),a=e[e.length-1].value;let r,l;for(r=o;r<=a;r=+n.add(r,1,s))l=i[r],l>=0&&(e[l].major=!0);return e}(t,s,n,i):s}class ma extends Bs{constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e){const i=t.time||(t.time={}),s=this._adapter=new mn._date(t.adapters.date);ot(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:ua(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:a}=this.getUserBounds();function r(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),a||isNaN(t.max)||(n=Math.max(n,t.max))}o&&a||(r(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||r(this.getMinMax(!1))),s=X(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=X(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=he(s,n,this.max);return this._unit=e.unit||(i.autoSkip?fa(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=ca.length-1;o>=ca.indexOf(i);o--){const i=ca[o];if(ha[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return ca[i?ca.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=ca.indexOf(t)+1,i=ca.length;e<i;++e)if(ha[ca[e]].common)return ca[e]}(this._unit):void 0,this.initOffsets(s),t.reverse&&o.reverse(),pa(this,o,this._majorUnit)}initOffsets(t){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=jt(s,0,o),n=jt(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||fa(n.minUnit,e,i,this._getLabelCapacity(e)),a=K(n.stepSize,1),r="week"===o&&n.isoWeekday,l=Tt(r)||!0===r,h={};let c,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",r)),u=+t.startOf(u,l?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const f="data"===s.ticks.source&&this.getDataTimestamps();for(c=u,d=0;c<i;c=+t.add(c,a,o),d++)ga(h,c,f);return c!==i&&"ticks"!==s.bounds&&1!==d||ga(h,c,f),Object.keys(h).sort(((t,e)=>t-e)).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.time.displayFormats,a=this._unit,r=this._majorUnit,l=a&&o[a],h=r&&o[r],c=i[e],d=r&&h&&c&&c.major,u=this._adapter.format(t,s||(d?h:l)),f=n.ticks.callback;return f?J(f,[u,e,i],this):u}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e<i;++e)s=t[e],s.label=this._tickFormatFunction(s.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,s=It(this.isHorizontal()?e.maxRotation:e.minRotation),n=Math.cos(s),o=Math.sin(s),a=this._resolveTickFontOptions(0).size;return{w:i*n+a*o,h:i*o+a*n}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,s=i[e.unit]||i.millisecond,n=this._tickFormatFunction(t,0,pa(this,[t],this._majorUnit),s),o=this._getLabelSize(n),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t<e;++t)i=i.concat(s[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const s=this.getLabels();for(e=0,i=s.length;e<i;++e)t.push(ua(this,s[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return fe(t.sort(da))}}function xa(t,e,i){let s,n,o,a,r=0,l=t.length-1;i?(e>=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=re(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=re(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}ma.id="time",ma.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class ba extends ma{constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=xa(e,this.min),this._tableRange=xa(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o<a;++o)l=t[o],l>=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;o<a;++o)h=s[o+1],r=s[o-1],l=s[o],Math.round((h+r)/2)!==l&&n.push({time:l,pos:o/(a-1)});return n}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(xa(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return xa(this._table,i*this._tableRange+this._minPos,!0)}}ba.id="timeseries",ba.defaults=ma.defaults;var _a=Object.freeze({__proto__:null,CategoryScale:qo,LinearScale:Zo,LogarithmicScale:Qo,RadialLinearScale:la,TimeScale:ma,TimeSeriesScale:ba});return dn.register(Rn,_a,no,Uo),dn.helpers={...Yi},dn._adapters=mn,dn.Animation=us,dn.Animations=gs,dn.animator=a,dn.controllers=Ws.controllers.items,dn.DatasetController=Ps,dn.Element=Ds,dn.elements=no,dn.Interaction=Ee,dn.layouts=ni,dn.platforms=hs,dn.Scale=Bs,dn.Ticks=Os,Object.assign(dn,Rn,_a,no,Uo,hs),dn.Chart=dn,"undefined"!=typeof window&&(window.Chart=dn),dn}));
includes/admin/js/chartjs-plugin-datalabels.min.js CHANGED
@@ -1,7 +1,7 @@
1
  /*!
2
- * chartjs-plugin-datalabels v2.0.0-beta.1
3
  * https://chartjs-plugin-datalabels.netlify.app
4
  * (c) 2017-2021 chartjs-plugin-datalabels contributors
5
  * Released under the MIT license
6
  */
7
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("chart.js/helpers"),require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js/helpers","chart.js"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).ChartDataLabels=e(t.Chart.helpers,t.Chart)}(this,(function(t,e){"use strict";var r=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),a=function(e){var r,a=[];for(e=[].concat(e);e.length;)"string"==typeof(r=e.pop())?a.unshift.apply(a,r.split("\n")):Array.isArray(r)?e.push.apply(e,r):t.isNullOrUndef(e)||a.unshift(""+r);return a},o=function(t,e,r){var a,o=[].concat(e),n=o.length,i=t.font,l=0;for(t.font=r.string,a=0;a<n;++a)l=Math.max(t.measureText(o[a]).width,l);return t.font=i,{height:n*r.lineHeight,width:l}},n=function(t,e,r){return Math.max(t,Math.min(e,r))},i=function(t,e){var r,a,o,n,i=t.slice(),l=[];for(r=0,o=e.length;r<o;++r)n=e[r],-1===(a=i.indexOf(n))?l.push([n,1]):i.splice(a,1);for(r=0,o=i.length;r<o;++r)l.push([i[r],-1]);return l};function l(t,e){var r=e.x,a=e.y;if(null===r)return{x:0,y:-1};if(null===a)return{x:1,y:0};var o=t.x-r,n=t.y-a,i=Math.sqrt(o*o+n*n);return{x:i?o/i:0,y:i?n/i:-1}}function s(t,e,r){var a=0;return t<r.left?a|=1:t>r.right&&(a|=2),e<r.top?a|=8:e>r.bottom&&(a|=4),a}function u(t,e){var r,a,o=e.anchor,n=t;return e.clamp&&(n=function(t,e){for(var r,a,o,n=t.x0,i=t.y0,l=t.x1,u=t.y1,d=s(n,i,e),c=s(l,u,e);d|c&&!(d&c);)8&(r=d||c)?(a=n+(l-n)*(e.top-i)/(u-i),o=e.top):4&r?(a=n+(l-n)*(e.bottom-i)/(u-i),o=e.bottom):2&r?(o=i+(u-i)*(e.right-n)/(l-n),a=e.right):1&r&&(o=i+(u-i)*(e.left-n)/(l-n),a=e.left),r===d?d=s(n=a,i=o,e):c=s(l=a,u=o,e);return{x0:n,x1:l,y0:i,y1:u}}(n,e.area)),"start"===o?(r=n.x0,a=n.y0):"end"===o?(r=n.x1,a=n.y1):(r=(n.x0+n.x1)/2,a=(n.y0+n.y1)/2),function(t,e,r,a,o){switch(o){case"center":r=a=0;break;case"bottom":r=0,a=1;break;case"right":r=1,a=0;break;case"left":r=-1,a=0;break;case"top":r=0,a=-1;break;case"start":r=-r,a=-a;break;case"end":break;default:o*=Math.PI/180,r=Math.cos(o),a=Math.sin(o)}return{x:t,y:e,vx:r,vy:a}}(r,a,t.vx,t.vy,e.align)}var d=function(t,e){var r=(t.startAngle+t.endAngle)/2,a=Math.cos(r),o=Math.sin(r),n=t.innerRadius,i=t.outerRadius;return u({x0:t.x+a*n,y0:t.y+o*n,x1:t.x+a*i,y1:t.y+o*i,vx:a,vy:o},e)},c=function(t,e){var r=l(t,e.origin),a=r.x*t.options.radius,o=r.y*t.options.radius;return u({x0:t.x-a,y0:t.y-o,x1:t.x+a,y1:t.y+o,vx:r.x,vy:r.y},e)},h=function(t,e){var r=l(t,e.origin),a=t.x,o=t.y,n=0,i=0;return t.horizontal?(a=Math.min(t.x,t.base),n=Math.abs(t.base-t.x)):(o=Math.min(t.y,t.base),i=Math.abs(t.base-t.y)),u({x0:a,y0:o+i,x1:a+n,y1:o,vx:r.x,vy:r.y},e)},f=function(t,e){var r=l(t,e.origin);return u({x0:t.x,y0:t.y,x1:t.x,y1:t.y,vx:r.x,vy:r.y},e)},x=function(t){return Math.round(t*r)/r};function v(t,e){var r=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!r)return null;if(void 0!==r.xCenter&&void 0!==r.yCenter)return{x:r.xCenter,y:r.yCenter};var a=r.getBasePixel();return t.horizontal?{x:a,y:null}:{x:null,y:a}}function y(t,e,r){var a=r.backgroundColor,o=r.borderColor,n=r.borderWidth;(a||o&&n)&&(t.beginPath(),function(t,e,r,a,o,n){var i=Math.PI/2;if(n){var l=Math.min(n,o/2,a/2),s=e+l,u=r+l,d=e+a-l,c=r+o-l;t.moveTo(e,u),s<d&&u<c?(t.arc(s,u,l,-Math.PI,-i),t.arc(d,u,l,-i,0),t.arc(d,c,l,0,i),t.arc(s,c,l,i,Math.PI)):s<d?(t.moveTo(s,r),t.arc(d,u,l,-i,i),t.arc(s,u,l,i,Math.PI+i)):u<c?(t.arc(s,u,l,-Math.PI,0),t.arc(s,c,l,0,Math.PI)):t.arc(s,u,l,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,r)}else t.rect(e,r,a,o)}(t,x(e.x)+n/2,x(e.y)+n/2,x(e.w)-n,x(e.h)-n,r.borderRadius),t.closePath(),a&&(t.fillStyle=a,t.fill()),o&&n&&(t.strokeStyle=o,t.lineWidth=n,t.lineJoin="miter",t.stroke()))}function b(t,e,r){var a=t.shadowBlur,o=r.stroked,n=x(r.x),i=x(r.y),l=x(r.w);o&&t.strokeText(e,n,i,l),r.filled&&(a&&o&&(t.shadowBlur=0),t.fillText(e,n,i,l),a&&o&&(t.shadowBlur=a))}var _=function(t,e,r,a){var o=this;o._config=t,o._index=a,o._model=null,o._rects=null,o._ctx=e,o._el=r};t.merge(_.prototype,{_modelize:function(r,a,n,i){var l,s=this,u=s._index,x=t.toFont(t.resolve([n.font,{}],i,u)),y=t.resolve([n.color,e.defaults.color],i,u);return{align:t.resolve([n.align,"center"],i,u),anchor:t.resolve([n.anchor,"center"],i,u),area:i.chart.chartArea,backgroundColor:t.resolve([n.backgroundColor,null],i,u),borderColor:t.resolve([n.borderColor,null],i,u),borderRadius:t.resolve([n.borderRadius,0],i,u),borderWidth:t.resolve([n.borderWidth,0],i,u),clamp:t.resolve([n.clamp,!1],i,u),clip:t.resolve([n.clip,!1],i,u),color:y,display:r,font:x,lines:a,offset:t.resolve([n.offset,0],i,u),opacity:t.resolve([n.opacity,1],i,u),origin:v(s._el,i),padding:t.toPadding(t.resolve([n.padding,0],i,u)),positioner:(l=s._el,l instanceof e.ArcElement?d:l instanceof e.PointElement?c:l instanceof e.BarElement?h:f),rotation:t.resolve([n.rotation,0],i,u)*(Math.PI/180),size:o(s._ctx,a,x),textAlign:t.resolve([n.textAlign,"start"],i,u),textShadowBlur:t.resolve([n.textShadowBlur,0],i,u),textShadowColor:t.resolve([n.textShadowColor,y],i,u),textStrokeColor:t.resolve([n.textStrokeColor,y],i,u),textStrokeWidth:t.resolve([n.textStrokeWidth,0],i,u)}},update:function(e){var r,o,n,i=this,l=null,s=null,u=i._index,d=i._config,c=t.resolve([d.display,!0],e,u);c&&(r=e.dataset.data[u],o=t.valueOrDefault(t.callback(d.formatter,[r,e]),r),(n=t.isNullOrUndef(o)?[]:a(o)).length&&(s=function(t){var e=t.borderWidth||0,r=t.padding,a=t.size.height,o=t.size.width,n=-o/2,i=-a/2;return{frame:{x:n-r.left-e,y:i-r.top-e,w:o+r.width+2*e,h:a+r.height+2*e},text:{x:n,y:i,w:o,h:a}}}(l=i._modelize(c,n,d,e)))),i._model=l,i._rects=s},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var r,a=t.ctx,o=this._model,i=this._rects;this.visible()&&(a.save(),o.clip&&(r=o.area,a.beginPath(),a.rect(r.left,r.top,r.right-r.left,r.bottom-r.top),a.clip()),a.globalAlpha=n(0,o.opacity,1),a.translate(x(e.x),x(e.y)),a.rotate(o.rotation),y(a,i.frame,o),function(t,e,r,a){var o,n=a.textAlign,i=a.color,l=!!i,s=a.font,u=e.length,d=a.textStrokeColor,c=a.textStrokeWidth,h=d&&c;if(u&&(l||h))for(r=function(t,e,r){var a=r.lineHeight,o=t.w,n=t.x;return"center"===e?n+=o/2:"end"!==e&&"right"!==e||(n+=o),{h:a,w:o,x:n,y:t.y+a/2}}(r,n,s),t.font=s.string,t.textAlign=n,t.textBaseline="middle",t.shadowBlur=a.textShadowBlur,t.shadowColor=a.textShadowColor,l&&(t.fillStyle=i),h&&(t.lineJoin="round",t.lineWidth=c,t.strokeStyle=d),o=0,u=e.length;o<u;++o)b(t,e[o],{stroked:h,filled:l,w:r.w,x:r.x,y:r.y+r.h*o})}(a,o.lines,i.text,o),a.restore())}});var p=Number.MIN_SAFE_INTEGER||-9007199254740991,g=Number.MAX_SAFE_INTEGER||9007199254740991;function m(t,e,r){var a=Math.cos(r),o=Math.sin(r),n=e.x,i=e.y;return{x:n+a*(t.x-n)-o*(t.y-i),y:i+o*(t.x-n)+a*(t.y-i)}}function w(t,e){var r,a,o,n,i,l=g,s=p,u=e.origin;for(r=0;r<t.length;++r)o=(a=t[r]).x-u.x,n=a.y-u.y,i=e.vx*o+e.vy*n,l=Math.min(l,i),s=Math.max(s,i);return{min:l,max:s}}function M(t,e){var r=e.x-t.x,a=e.y-t.y,o=Math.sqrt(r*r+a*a);return{vx:(e.x-t.x)/o,vy:(e.y-t.y)/o,origin:t,ln:o}}var k=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function $(t,e,r){var a=e.positioner(t,e),o=a.vx,n=a.vy;if(!o&&!n)return{x:a.x,y:a.y};var i=r.w,l=r.h,s=e.rotation,u=Math.abs(i/2*Math.cos(s))+Math.abs(l/2*Math.sin(s)),d=Math.abs(i/2*Math.sin(s))+Math.abs(l/2*Math.cos(s)),c=1/Math.max(Math.abs(o),Math.abs(n));return u*=o*c,d*=n*c,u+=e.offset*o,d+=e.offset*n,{x:a.x+u,y:a.y+d}}t.merge(k.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,r){this._rotation=r,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,r=e._rect;return!((t=m(t,e.center(),-e._rotation)).x<r.x-1||t.y<r.y-1||t.x>r.x+r.w+2||t.y>r.y+r.h+2)},intersects:function(t){var e,r,a,o=this._points(),n=t._points(),i=[M(o[0],o[1]),M(o[0],o[3])];for(this._rotation!==t._rotation&&i.push(M(n[0],n[1]),M(n[0],n[3])),e=0;e<i.length;++e)if(r=w(o,i[e]),a=w(n,i[e]),r.max<a.min||a.max<r.min)return!1;return!0},_points:function(){var t=this,e=t._rect,r=t._rotation,a=t.center();return[m({x:e.x,y:e.y},a,r),m({x:e.x+e.w,y:e.y},a,r),m({x:e.x+e.w,y:e.y+e.h},a,r),m({x:e.x,y:e.y+e.h},a,r)]}});var C={prepare:function(t){var e,r,a,o,n,i=[];for(e=0,a=t.length;e<a;++e)for(r=0,o=t[e].length;r<o;++r)n=t[e][r],i.push(n),n.$layout={_box:new k,_hidable:!1,_visible:!0,_set:e,_idx:r};return i.sort((function(t,e){var r=t.$layout,a=e.$layout;return r._idx===a._idx?a._set-r._set:a._idx-r._idx})),this.update(i),i},update:function(t){var e,r,a,o,n,i=!1;for(e=0,r=t.length;e<r;++e)o=(a=t[e]).model(),(n=a.$layout)._hidable=o&&"auto"===o.display,n._visible=a.visible(),i|=n._hidable;i&&function(t){var e,r,a,o,n,i;for(e=0,r=t.length;e<r;++e)(o=(a=t[e]).$layout)._visible&&(n=a.geometry(),i=$(a._el,a.model(),n),o._box.update(i,n,a.rotation()));(function(t,e){var r,a,o,n;for(r=t.length-1;r>=0;--r)for(o=t[r].$layout,a=r-1;a>=0&&o._visible;--a)(n=t[a].$layout)._visible&&o._box.intersects(n._box)&&e(o,n)})(t,(function(t,e){var r=t._hidable,a=e._hidable;r&&a||a?e._visible=!1:r&&(t._visible=!1)}))}(t)},lookup:function(t,e){var r,a;for(r=t.length-1;r>=0;--r)if((a=t[r].$layout)&&a._visible&&a._box.contains(e))return t[r];return null},draw:function(t,e){var r,a,o,n,i,l;for(r=0,a=e.length;r<a;++r)(n=(o=e[r]).$layout)._visible&&(i=o.geometry(),l=$(o._el,o.model(),i),n._box.update(l,i,o.rotation()),o.draw(t,l))}},S="$default";function P(e,r,a){if(r){var o,n=a.$context,i=a.$groups;r[i._set]&&(o=r[i._set][i._key])&&!0===t.callback(o,[n])&&(e.$datalabels._dirty=!0,a.update(n))}}function I(t,e){var r,a,o=t.$datalabels,n=o._listeners;if(n.enter||n.leave){if("mousemove"===e.type)a=C.lookup(o._labels,e);else if("mouseout"!==e.type)return;r=o._hovered,o._hovered=a,function(t,e,r,a){var o,n;(r||a)&&(r?a?r!==a&&(n=o=!0):n=!0:o=!0,n&&P(t,e.leave,r),o&&P(t,e.enter,a))}(t,n,r,a)}}return{id:"datalabels",defaults:{align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(e){if(t.isNullOrUndef(e))return null;var r,a,o,n=e;if(t.isObject(e))if(t.isNullOrUndef(e.label))if(t.isNullOrUndef(e.r))for(n="",o=0,a=(r=Object.keys(e)).length;o<a;++o)n+=(0!==o?", ":"")+r[o]+": "+e[r[o]];else n=e.r;else n=e.label;return""+n},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},beforeInit:function(t){t.$datalabels={_actives:[]}},beforeUpdate:function(t){var e=t.$datalabels;e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(e,r,a){var o,n,i,l,s,u,d,c,h=r.index,f=e.$datalabels,x=f._datasets[h]=[],v=e.isDatasetVisible(h),y=e.data.datasets[h],b=function(e,r){var a,o,n,i=e.datalabels,l=[];return!1===i?null:(!0===i&&(i={}),r=t.merge({},[r,i]),o=r.labels||{},n=Object.keys(o),delete r.labels,n.length?n.forEach((function(e){o[e]&&l.push(t.merge({},[r,o[e],{_key:e}]))})):l.push(r),a=l.reduce((function(e,r){return t.each(r.listeners||{},(function(t,a){e[a]=e[a]||{},e[a][r._key||S]=t})),delete r.listeners,e}),{}),{labels:l,listeners:a})}(y,a),p=r.meta.data||[],g=e.ctx;for(g.save(),o=0,i=p.length;o<i;++o)if((d=p[o]).$datalabels=[],v&&d&&e.getDataVisibility(o)&&!d.skip)for(n=0,l=b.labels.length;n<l;++n)u=(s=b.labels[n])._key,(c=new _(s,g,d,o)).$groups={_set:h,_key:u||S},c.$context={active:!1,chart:e,dataIndex:o,dataset:y,datasetIndex:h},c.update(c.$context),d.$datalabels.push(c),x.push(c);g.restore(),t.merge(f._listeners,b.listeners,{merger:function(t,e,a){e[t]=e[t]||{},e[t][r.index]=a[t],f._listened=!0}})},afterUpdate:function(t,e){t.$datalabels._labels=C.prepare(t.$datalabels._datasets,e)},afterDatasetsDraw:function(t){C.draw(t,t.$datalabels._labels)},beforeEvent:function(t,e){if(t.$datalabels._listened){var r=e.event;switch(r.type){case"mousemove":case"mouseout":I(t,r);break;case"click":!function(t,e){var r=t.$datalabels,a=r._listeners.click,o=a&&C.lookup(r._labels,e);o&&P(t,a,o)}(t,r)}}},afterEvent:function(t){var e,r,a,o,n,l,s,u=t.$datalabels,d=u._actives,c=u._actives=t.getActiveElements(),h=i(d,c);for(e=0,r=h.length;e<r;++e)if((n=h[e])[1])for(a=0,o=(s=n[0].element.$datalabels||[]).length;a<o;++a)(l=s[a]).$context.active=1===n[1],l.update(l.$context);(u._dirty||h.length)&&(C.update(u._labels),t.render()),delete u._dirty}}}));
1
  /*!
2
+ * chartjs-plugin-datalabels v2.0.0
3
  * https://chartjs-plugin-datalabels.netlify.app
4
  * (c) 2017-2021 chartjs-plugin-datalabels contributors
5
  * Released under the MIT license
6
  */
7
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("chart.js/helpers"),require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js/helpers","chart.js"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).ChartDataLabels=e(t.Chart.helpers,t.Chart)}(this,(function(t,e){"use strict";var r=function(){if("undefined"!=typeof window){if(window.devicePixelRatio)return window.devicePixelRatio;var t=window.screen;if(t)return(t.deviceXDPI||1)/(t.logicalXDPI||1)}return 1}(),a=function(e){var r,a=[];for(e=[].concat(e);e.length;)"string"==typeof(r=e.pop())?a.unshift.apply(a,r.split("\n")):Array.isArray(r)?e.push.apply(e,r):t.isNullOrUndef(e)||a.unshift(""+r);return a},o=function(t,e,r){var a,o=[].concat(e),n=o.length,i=t.font,l=0;for(t.font=r.string,a=0;a<n;++a)l=Math.max(t.measureText(o[a]).width,l);return t.font=i,{height:n*r.lineHeight,width:l}},n=function(t,e,r){return Math.max(t,Math.min(e,r))},i=function(t,e){var r,a,o,n,i=t.slice(),l=[];for(r=0,o=e.length;r<o;++r)n=e[r],-1===(a=i.indexOf(n))?l.push([n,1]):i.splice(a,1);for(r=0,o=i.length;r<o;++r)l.push([i[r],-1]);return l};function l(t,e){var r=e.x,a=e.y;if(null===r)return{x:0,y:-1};if(null===a)return{x:1,y:0};var o=t.x-r,n=t.y-a,i=Math.sqrt(o*o+n*n);return{x:i?o/i:0,y:i?n/i:-1}}function s(t,e,r){var a=0;return t<r.left?a|=1:t>r.right&&(a|=2),e<r.top?a|=8:e>r.bottom&&(a|=4),a}function u(t,e){var r,a,o=e.anchor,n=t;return e.clamp&&(n=function(t,e){for(var r,a,o,n=t.x0,i=t.y0,l=t.x1,u=t.y1,d=s(n,i,e),c=s(l,u,e);d|c&&!(d&c);)8&(r=d||c)?(a=n+(l-n)*(e.top-i)/(u-i),o=e.top):4&r?(a=n+(l-n)*(e.bottom-i)/(u-i),o=e.bottom):2&r?(o=i+(u-i)*(e.right-n)/(l-n),a=e.right):1&r&&(o=i+(u-i)*(e.left-n)/(l-n),a=e.left),r===d?d=s(n=a,i=o,e):c=s(l=a,u=o,e);return{x0:n,x1:l,y0:i,y1:u}}(n,e.area)),"start"===o?(r=n.x0,a=n.y0):"end"===o?(r=n.x1,a=n.y1):(r=(n.x0+n.x1)/2,a=(n.y0+n.y1)/2),function(t,e,r,a,o){switch(o){case"center":r=a=0;break;case"bottom":r=0,a=1;break;case"right":r=1,a=0;break;case"left":r=-1,a=0;break;case"top":r=0,a=-1;break;case"start":r=-r,a=-a;break;case"end":break;default:o*=Math.PI/180,r=Math.cos(o),a=Math.sin(o)}return{x:t,y:e,vx:r,vy:a}}(r,a,t.vx,t.vy,e.align)}var d=function(t,e){var r=(t.startAngle+t.endAngle)/2,a=Math.cos(r),o=Math.sin(r),n=t.innerRadius,i=t.outerRadius;return u({x0:t.x+a*n,y0:t.y+o*n,x1:t.x+a*i,y1:t.y+o*i,vx:a,vy:o},e)},c=function(t,e){var r=l(t,e.origin),a=r.x*t.options.radius,o=r.y*t.options.radius;return u({x0:t.x-a,y0:t.y-o,x1:t.x+a,y1:t.y+o,vx:r.x,vy:r.y},e)},h=function(t,e){var r=l(t,e.origin),a=t.x,o=t.y,n=0,i=0;return t.horizontal?(a=Math.min(t.x,t.base),n=Math.abs(t.base-t.x)):(o=Math.min(t.y,t.base),i=Math.abs(t.base-t.y)),u({x0:a,y0:o+i,x1:a+n,y1:o,vx:r.x,vy:r.y},e)},f=function(t,e){var r=l(t,e.origin);return u({x0:t.x,y0:t.y,x1:t.x,y1:t.y,vx:r.x,vy:r.y},e)},x=function(t){return Math.round(t*r)/r};function y(t,e){var r=e.chart.getDatasetMeta(e.datasetIndex).vScale;if(!r)return null;if(void 0!==r.xCenter&&void 0!==r.yCenter)return{x:r.xCenter,y:r.yCenter};var a=r.getBasePixel();return t.horizontal?{x:a,y:null}:{x:null,y:a}}function v(t,e,r){var a=r.backgroundColor,o=r.borderColor,n=r.borderWidth;(a||o&&n)&&(t.beginPath(),function(t,e,r,a,o,n){var i=Math.PI/2;if(n){var l=Math.min(n,o/2,a/2),s=e+l,u=r+l,d=e+a-l,c=r+o-l;t.moveTo(e,u),s<d&&u<c?(t.arc(s,u,l,-Math.PI,-i),t.arc(d,u,l,-i,0),t.arc(d,c,l,0,i),t.arc(s,c,l,i,Math.PI)):s<d?(t.moveTo(s,r),t.arc(d,u,l,-i,i),t.arc(s,u,l,i,Math.PI+i)):u<c?(t.arc(s,u,l,-Math.PI,0),t.arc(s,c,l,0,Math.PI)):t.arc(s,u,l,-Math.PI,Math.PI),t.closePath(),t.moveTo(e,r)}else t.rect(e,r,a,o)}(t,x(e.x)+n/2,x(e.y)+n/2,x(e.w)-n,x(e.h)-n,r.borderRadius),t.closePath(),a&&(t.fillStyle=a,t.fill()),o&&n&&(t.strokeStyle=o,t.lineWidth=n,t.lineJoin="miter",t.stroke()))}function b(t,e,r){var a=t.shadowBlur,o=r.stroked,n=x(r.x),i=x(r.y),l=x(r.w);o&&t.strokeText(e,n,i,l),r.filled&&(a&&o&&(t.shadowBlur=0),t.fillText(e,n,i,l),a&&o&&(t.shadowBlur=a))}var _=function(t,e,r,a){var o=this;o._config=t,o._index=a,o._model=null,o._rects=null,o._ctx=e,o._el=r};t.merge(_.prototype,{_modelize:function(r,a,n,i){var l,s=this,u=s._index,x=t.toFont(t.resolve([n.font,{}],i,u)),v=t.resolve([n.color,e.defaults.color],i,u);return{align:t.resolve([n.align,"center"],i,u),anchor:t.resolve([n.anchor,"center"],i,u),area:i.chart.chartArea,backgroundColor:t.resolve([n.backgroundColor,null],i,u),borderColor:t.resolve([n.borderColor,null],i,u),borderRadius:t.resolve([n.borderRadius,0],i,u),borderWidth:t.resolve([n.borderWidth,0],i,u),clamp:t.resolve([n.clamp,!1],i,u),clip:t.resolve([n.clip,!1],i,u),color:v,display:r,font:x,lines:a,offset:t.resolve([n.offset,0],i,u),opacity:t.resolve([n.opacity,1],i,u),origin:y(s._el,i),padding:t.toPadding(t.resolve([n.padding,0],i,u)),positioner:(l=s._el,l instanceof e.ArcElement?d:l instanceof e.PointElement?c:l instanceof e.BarElement?h:f),rotation:t.resolve([n.rotation,0],i,u)*(Math.PI/180),size:o(s._ctx,a,x),textAlign:t.resolve([n.textAlign,"start"],i,u),textShadowBlur:t.resolve([n.textShadowBlur,0],i,u),textShadowColor:t.resolve([n.textShadowColor,v],i,u),textStrokeColor:t.resolve([n.textStrokeColor,v],i,u),textStrokeWidth:t.resolve([n.textStrokeWidth,0],i,u)}},update:function(e){var r,o,n,i=this,l=null,s=null,u=i._index,d=i._config,c=t.resolve([d.display,!0],e,u);c&&(r=e.dataset.data[u],o=t.valueOrDefault(t.callback(d.formatter,[r,e]),r),(n=t.isNullOrUndef(o)?[]:a(o)).length&&(s=function(t){var e=t.borderWidth||0,r=t.padding,a=t.size.height,o=t.size.width,n=-o/2,i=-a/2;return{frame:{x:n-r.left-e,y:i-r.top-e,w:o+r.width+2*e,h:a+r.height+2*e},text:{x:n,y:i,w:o,h:a}}}(l=i._modelize(c,n,d,e)))),i._model=l,i._rects=s},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(t,e){var r,a=t.ctx,o=this._model,i=this._rects;this.visible()&&(a.save(),o.clip&&(r=o.area,a.beginPath(),a.rect(r.left,r.top,r.right-r.left,r.bottom-r.top),a.clip()),a.globalAlpha=n(0,o.opacity,1),a.translate(x(e.x),x(e.y)),a.rotate(o.rotation),v(a,i.frame,o),function(t,e,r,a){var o,n=a.textAlign,i=a.color,l=!!i,s=a.font,u=e.length,d=a.textStrokeColor,c=a.textStrokeWidth,h=d&&c;if(u&&(l||h))for(r=function(t,e,r){var a=r.lineHeight,o=t.w,n=t.x;return"center"===e?n+=o/2:"end"!==e&&"right"!==e||(n+=o),{h:a,w:o,x:n,y:t.y+a/2}}(r,n,s),t.font=s.string,t.textAlign=n,t.textBaseline="middle",t.shadowBlur=a.textShadowBlur,t.shadowColor=a.textShadowColor,l&&(t.fillStyle=i),h&&(t.lineJoin="round",t.lineWidth=c,t.strokeStyle=d),o=0,u=e.length;o<u;++o)b(t,e[o],{stroked:h,filled:l,w:r.w,x:r.x,y:r.y+r.h*o})}(a,o.lines,i.text,o),a.restore())}});var p=Number.MIN_SAFE_INTEGER||-9007199254740991,g=Number.MAX_SAFE_INTEGER||9007199254740991;function m(t,e,r){var a=Math.cos(r),o=Math.sin(r),n=e.x,i=e.y;return{x:n+a*(t.x-n)-o*(t.y-i),y:i+o*(t.x-n)+a*(t.y-i)}}function w(t,e){var r,a,o,n,i,l=g,s=p,u=e.origin;for(r=0;r<t.length;++r)o=(a=t[r]).x-u.x,n=a.y-u.y,i=e.vx*o+e.vy*n,l=Math.min(l,i),s=Math.max(s,i);return{min:l,max:s}}function M(t,e){var r=e.x-t.x,a=e.y-t.y,o=Math.sqrt(r*r+a*a);return{vx:(e.x-t.x)/o,vy:(e.y-t.y)/o,origin:t,ln:o}}var k=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};function $(t,e,r){var a=e.positioner(t,e),o=a.vx,n=a.vy;if(!o&&!n)return{x:a.x,y:a.y};var i=r.w,l=r.h,s=e.rotation,u=Math.abs(i/2*Math.cos(s))+Math.abs(l/2*Math.sin(s)),d=Math.abs(i/2*Math.sin(s))+Math.abs(l/2*Math.cos(s)),c=1/Math.max(Math.abs(o),Math.abs(n));return u*=o*c,d*=n*c,u+=e.offset*o,d+=e.offset*n,{x:a.x+u,y:a.y+d}}t.merge(k.prototype,{center:function(){var t=this._rect;return{x:t.x+t.w/2,y:t.y+t.h/2}},update:function(t,e,r){this._rotation=r,this._rect={x:e.x+t.x,y:e.y+t.y,w:e.w,h:e.h}},contains:function(t){var e=this,r=e._rect;return!((t=m(t,e.center(),-e._rotation)).x<r.x-1||t.y<r.y-1||t.x>r.x+r.w+2||t.y>r.y+r.h+2)},intersects:function(t){var e,r,a,o=this._points(),n=t._points(),i=[M(o[0],o[1]),M(o[0],o[3])];for(this._rotation!==t._rotation&&i.push(M(n[0],n[1]),M(n[0],n[3])),e=0;e<i.length;++e)if(r=w(o,i[e]),a=w(n,i[e]),r.max<a.min||a.max<r.min)return!1;return!0},_points:function(){var t=this,e=t._rect,r=t._rotation,a=t.center();return[m({x:e.x,y:e.y},a,r),m({x:e.x+e.w,y:e.y},a,r),m({x:e.x+e.w,y:e.y+e.h},a,r),m({x:e.x,y:e.y+e.h},a,r)]}});var C={prepare:function(t){var e,r,a,o,n,i=[];for(e=0,a=t.length;e<a;++e)for(r=0,o=t[e].length;r<o;++r)n=t[e][r],i.push(n),n.$layout={_box:new k,_hidable:!1,_visible:!0,_set:e,_idx:r};return i.sort((function(t,e){var r=t.$layout,a=e.$layout;return r._idx===a._idx?a._set-r._set:a._idx-r._idx})),this.update(i),i},update:function(t){var e,r,a,o,n,i=!1;for(e=0,r=t.length;e<r;++e)o=(a=t[e]).model(),(n=a.$layout)._hidable=o&&"auto"===o.display,n._visible=a.visible(),i|=n._hidable;i&&function(t){var e,r,a,o,n,i,l;for(e=0,r=t.length;e<r;++e)(o=(a=t[e]).$layout)._visible&&(l=new Proxy(a._el,{get:(t,e)=>t.getProps([e],!0)[e]}),n=a.geometry(),i=$(l,a.model(),n),o._box.update(i,n,a.rotation()));(function(t,e){var r,a,o,n;for(r=t.length-1;r>=0;--r)for(o=t[r].$layout,a=r-1;a>=0&&o._visible;--a)(n=t[a].$layout)._visible&&o._box.intersects(n._box)&&e(o,n)})(t,(function(t,e){var r=t._hidable,a=e._hidable;r&&a||a?e._visible=!1:r&&(t._visible=!1)}))}(t)},lookup:function(t,e){var r,a;for(r=t.length-1;r>=0;--r)if((a=t[r].$layout)&&a._visible&&a._box.contains(e))return t[r];return null},draw:function(t,e){var r,a,o,n,i,l;for(r=0,a=e.length;r<a;++r)(n=(o=e[r]).$layout)._visible&&(i=o.geometry(),l=$(o._el,o.model(),i),n._box.update(l,i,o.rotation()),o.draw(t,l))}},P="$default";function S(e,r,a){if(r){var o,n=a.$context,i=a.$groups;r[i._set]&&(o=r[i._set][i._key])&&!0===t.callback(o,[n])&&(e.$datalabels._dirty=!0,a.update(n))}}function I(t,e){var r,a,o=t.$datalabels,n=o._listeners;if(n.enter||n.leave){if("mousemove"===e.type)a=C.lookup(o._labels,e);else if("mouseout"!==e.type)return;r=o._hovered,o._hovered=a,function(t,e,r,a){var o,n;(r||a)&&(r?a?r!==a&&(n=o=!0):n=!0:o=!0,n&&S(t,e.leave,r),o&&S(t,e.enter,a))}(t,n,r,a)}}return{id:"datalabels",defaults:{align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:function(e){if(t.isNullOrUndef(e))return null;var r,a,o,n=e;if(t.isObject(e))if(t.isNullOrUndef(e.label))if(t.isNullOrUndef(e.r))for(n="",o=0,a=(r=Object.keys(e)).length;o<a;++o)n+=(0!==o?", ":"")+r[o]+": "+e[r[o]];else n=e.r;else n=e.label;return""+n},labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},beforeInit:function(t){t.$datalabels={_actives:[]}},beforeUpdate:function(t){var e=t.$datalabels;e._listened=!1,e._listeners={},e._datasets=[],e._labels=[]},afterDatasetUpdate:function(e,r,a){var o,n,i,l,s,u,d,c,h=r.index,f=e.$datalabels,x=f._datasets[h]=[],y=e.isDatasetVisible(h),v=e.data.datasets[h],b=function(e,r){var a,o,n,i=e.datalabels,l=[];return!1===i?null:(!0===i&&(i={}),r=t.merge({},[r,i]),o=r.labels||{},n=Object.keys(o),delete r.labels,n.length?n.forEach((function(e){o[e]&&l.push(t.merge({},[r,o[e],{_key:e}]))})):l.push(r),a=l.reduce((function(e,r){return t.each(r.listeners||{},(function(t,a){e[a]=e[a]||{},e[a][r._key||P]=t})),delete r.listeners,e}),{}),{labels:l,listeners:a})}(v,a),p=r.meta.data||[],g=e.ctx;for(g.save(),o=0,i=p.length;o<i;++o)if((d=p[o]).$datalabels=[],y&&d&&e.getDataVisibility(o)&&!d.skip)for(n=0,l=b.labels.length;n<l;++n)u=(s=b.labels[n])._key,(c=new _(s,g,d,o)).$groups={_set:h,_key:u||P},c.$context={active:!1,chart:e,dataIndex:o,dataset:v,datasetIndex:h},c.update(c.$context),d.$datalabels.push(c),x.push(c);g.restore(),t.merge(f._listeners,b.listeners,{merger:function(t,e,a){e[t]=e[t]||{},e[t][r.index]=a[t],f._listened=!0}})},afterUpdate:function(t,e){t.$datalabels._labels=C.prepare(t.$datalabels._datasets,e)},afterDatasetsDraw:function(t){C.draw(t,t.$datalabels._labels)},beforeEvent:function(t,e){if(t.$datalabels._listened){var r=e.event;switch(r.type){case"mousemove":case"mouseout":I(t,r);break;case"click":!function(t,e){var r=t.$datalabels,a=r._listeners.click,o=a&&C.lookup(r._labels,e);o&&S(t,a,o)}(t,r)}}},afterEvent:function(t){var e,r,a,o,n,l,s,u=t.$datalabels,d=u._actives,c=u._actives=t.getActiveElements(),h=i(d,c);for(e=0,r=h.length;e<r;++e)if((n=h[e])[1])for(a=0,o=(s=n[0].element.$datalabels||[]).length;a<o;++a)(l=s[a]).$context.active=1===n[1],l.update(l.$context);(u._dirty||h.length)&&(C.update(u._labels),t.render()),delete u._dirty}}}));
includes/admin/save-settings.php CHANGED
@@ -332,6 +332,24 @@ function tptn_sanitize_exclude_cat( $settings ) {
332
 
333
  }
334
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  return $settings;
336
  }
337
  add_filter( 'tptn_settings_sanitize', 'tptn_sanitize_exclude_cat' );
332
 
333
  }
334
 
335
+ // Sanitize exclude_on_cat_slugs to save a new entry of exclude_on_categories.
336
+ if ( isset( $settings['exclude_on_cat_slugs'] ) ) {
337
+
338
+ $exclude_on_cat_slugs = array_unique( str_getcsv( $settings['exclude_on_cat_slugs'] ) );
339
+
340
+ foreach ( $exclude_on_cat_slugs as $cat_name ) {
341
+ $cat = get_term_by( 'name', $cat_name, 'category' );
342
+
343
+ if ( isset( $cat->term_taxonomy_id ) ) {
344
+ $exclude_on_categories[] = $cat->term_taxonomy_id;
345
+ $exclude_on_categories_slugs[] = $cat->name;
346
+ }
347
+ }
348
+ $settings['exclude_on_categories'] = isset( $exclude_on_categories ) ? join( ',', $exclude_on_categories ) : '';
349
+ $settings['exclude_on_cat_slugs'] = isset( $exclude_on_categories_slugs ) ? tptn_str_putcsv( $exclude_on_categories_slugs ) : '';
350
+
351
+ }
352
+
353
  return $settings;
354
  }
355
  add_filter( 'tptn_settings_sanitize', 'tptn_sanitize_exclude_cat' );
includes/admin/settings-page.php CHANGED
@@ -448,17 +448,27 @@ function tptn_thumbsizes_callback( $args ) {
448
  );
449
  }
450
 
451
- foreach ( $args['options'] as $option ) {
452
  $checked = false;
453
 
454
- if ( isset( $tptn_settings[ $args['id'] ] ) && $tptn_settings[ $args['id'] ] === $option['name'] ) {
455
  $checked = true;
456
- } elseif ( isset( $args['default'] ) && $args['default'] === $option['name'] && ! isset( $tptn_settings[ $args['id'] ] ) ) {
457
  $checked = true;
458
  }
459
 
460
- $html .= sprintf( '<input name="tptn_settings[%1$s]" id="tptn_settings[%1$s][%2$s]" type="radio" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), $option['name'], checked( true, $checked, false ) );
461
- $html .= sprintf( '<label for="tptn_settings[%1$s][%2$s]">%3$s</label> <br />', sanitize_key( $args['id'] ), $option['name'], $option['name'] . ' (' . $option['width'] . 'x' . $option['height'] . ')' );
 
 
 
 
 
 
 
 
 
 
462
  }
463
 
464
  $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
@@ -746,4 +756,3 @@ function tptn_admin_thumbnail( $html, $args ) {
746
  return $html;
747
  }
748
  add_filter( 'tptn_after_setting_output', 'tptn_admin_thumbnail', 10, 2 );
749
-
448
  );
449
  }
450
 
451
+ foreach ( $args['options'] as $name => $option ) {
452
  $checked = false;
453
 
454
+ if ( isset( $tptn_settings[ $args['id'] ] ) && $tptn_settings[ $args['id'] ] === $name ) {
455
  $checked = true;
456
+ } elseif ( isset( $args['default'] ) && $args['default'] === $name && ! isset( $tptn_settings[ $args['id'] ] ) ) {
457
  $checked = true;
458
  }
459
 
460
+ $html .= sprintf(
461
+ '<input name="tptn_settings[%1$s]" id="tptn_settings[%1$s][%2$s]" type="radio" value="%2$s" %3$s /> ',
462
+ sanitize_key( $args['id'] ),
463
+ $name,
464
+ checked( true, $checked, false )
465
+ );
466
+ $html .= sprintf(
467
+ '<label for="tptn_settings[%1$s][%2$s]">%3$s</label> <br />',
468
+ sanitize_key( $args['id'] ),
469
+ $name,
470
+ $name . ' (' . $option['width'] . 'x' . $option['height'] . ')'
471
+ );
472
  }
473
 
474
  $html .= '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>';
756
  return $html;
757
  }
758
  add_filter( 'tptn_after_setting_output', 'tptn_admin_thumbnail', 10, 2 );
 
includes/admin/sidebar.php CHANGED
@@ -20,7 +20,7 @@
20
  <input type="hidden" name="business" value="donate@ajaydsouza.com">
21
  <input type="hidden" name="lc" value="IN">
22
  <input type="hidden" name="item_name" value="<?php esc_html_e( 'Donation for Top 10', 'top-10' ); ?>">
23
- <input type="hidden" name="item_number" value="crp_plugin_settings">
24
  <strong><?php esc_html_e( 'Enter amount in USD', 'top-10' ); ?></strong>: <input name="amount" value="15.00" size="6" type="text"><br />
25
  <input type="hidden" name="currency_code" value="USD">
26
  <input type="hidden" name="button_subtype" value="services">
20
  <input type="hidden" name="business" value="donate@ajaydsouza.com">
21
  <input type="hidden" name="lc" value="IN">
22
  <input type="hidden" name="item_name" value="<?php esc_html_e( 'Donation for Top 10', 'top-10' ); ?>">
23
+ <input type="hidden" name="item_number" value="tptn_plugin_settings">
24
  <strong><?php esc_html_e( 'Enter amount in USD', 'top-10' ); ?></strong>: <input name="amount" value="15.00" size="6" type="text"><br />
25
  <input type="hidden" name="currency_code" value="USD">
26
  <input type="hidden" name="button_subtype" value="services">
includes/blocks/popular-posts.php DELETED
@@ -1,157 +0,0 @@
1
- <?php
2
- /**
3
- * Functions to register client-side assets (scripts and stylesheets) for the
4
- * Gutenberg block.
5
- *
6
- * @package Top_Ten
7
- */
8
-
9
- /**
10
- * Renders the `top-10/popular-posts` block on server.
11
- *
12
- * @since 3.0.0
13
- * @param array $attributes The block attributes.
14
- *
15
- * @return string Returns the post content with popular posts added.
16
- */
17
- function render_tptn_block( $attributes ) {
18
-
19
- $attributes['extra_class'] = $attributes['className'];
20
-
21
- $arguments = array_merge(
22
- $attributes,
23
- array(
24
- 'is_block' => 1,
25
- )
26
- );
27
-
28
- $arguments = wp_parse_args( $attributes['other_attributes'], $arguments );
29
-
30
- /**
31
- * Filters arguments passed to get_tptn for the block.
32
- *
33
- * @since 3.0.0
34
- *
35
- * @param array $arguments Top 10 block options array.
36
- * @param array $attributes Block attributes array.
37
- */
38
- $arguments = apply_filters( 'tptn_block_options', $arguments, $attributes );
39
-
40
- return tptn_pop_posts( $arguments );
41
- }
42
-
43
- /**
44
- * Registers all block assets so that they can be enqueued through Gutenberg in
45
- * the corresponding context.
46
- *
47
- * @since 3.0.0
48
- */
49
- function tptn_block_init() {
50
- // Skip block registration if Gutenberg is not enabled/merged.
51
- if ( ! function_exists( 'register_block_type' ) ) {
52
- return;
53
- }
54
- $dir = dirname( __FILE__ );
55
-
56
- $index_js = 'popular-posts/index.min.js';
57
- wp_register_script( // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter
58
- 'popular-posts-block-editor',
59
- plugins_url( $index_js, __FILE__ ),
60
- array(
61
- 'wp-blocks',
62
- 'wp-i18n',
63
- 'wp-element',
64
- 'wp-components',
65
- 'wp-block-editor',
66
- 'wp-editor',
67
- ),
68
- filemtime( "$dir/$index_js" )
69
- );
70
-
71
- $style_array = tptn_get_style();
72
-
73
- if ( ! empty( $style_array ) ) {
74
- $style = $style_array['name'];
75
- $extra_css = $style_array['extra_css'];
76
-
77
- wp_register_style(
78
- 'popular-posts-block-editor',
79
- plugins_url( "css/{$style}.min.css", TOP_TEN_PLUGIN_FILE ),
80
- array( 'wp-edit-blocks' ),
81
- '1.0'
82
- );
83
- wp_add_inline_style( 'popular-posts-block-editor', $extra_css );
84
- }
85
-
86
- $args = array(
87
- 'editor_script' => 'popular-posts-block-editor',
88
- 'render_callback' => 'render_tptn_block',
89
- 'attributes' => array(
90
- 'className' => array(
91
- 'type' => 'string',
92
- 'default' => '',
93
- ),
94
- 'heading' => array(
95
- 'type' => 'boolean',
96
- 'default' => false,
97
- ),
98
- 'daily' => array(
99
- 'type' => 'boolean',
100
- 'default' => false,
101
- ),
102
- 'daily_range' => array(
103
- 'type' => 'number',
104
- 'default' => 1,
105
- ),
106
- 'hour_range' => array(
107
- 'type' => 'number',
108
- 'default' => 0,
109
- ),
110
- 'limit' => array(
111
- 'type' => 'number',
112
- 'default' => 6,
113
- ),
114
- 'offset' => array(
115
- 'type' => 'number',
116
- 'default' => 0,
117
- ),
118
- 'show_excerpt' => array(
119
- 'type' => 'boolean',
120
- 'default' => false,
121
- ),
122
- 'show_author' => array(
123
- 'type' => 'boolean',
124
- 'default' => false,
125
- ),
126
- 'show_date' => array(
127
- 'type' => 'boolean',
128
- 'default' => false,
129
- ),
130
- 'disp_list_count' => array(
131
- 'type' => 'boolean',
132
- 'default' => false,
133
- ),
134
- 'post_thumb_op' => array(
135
- 'type' => 'string',
136
- 'default' => 'inline',
137
- ),
138
- 'other_attributes' => array(
139
- 'type' => 'string',
140
- 'default' => '',
141
- ),
142
- ),
143
- );
144
- if ( ! empty( $style ) ) {
145
- $args['editor_style'] = 'popular-posts-block-editor';
146
- }
147
-
148
- register_block_type(
149
- 'top-10/popular-posts',
150
- $args
151
- );
152
-
153
- if ( function_exists( 'wp_set_script_translations' ) ) {
154
- wp_set_script_translations( 'popular-posts-block-editor', 'top-10' );
155
- }
156
- }
157
- add_action( 'init', 'tptn_block_init' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/blocks/popular-posts/block.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "top-10/popular-posts",
5
+ "version": "2.0.0",
6
+ "title": "Top 10 Popular Posts",
7
+ "category": "widgets",
8
+ "icon": "editor-ol",
9
+ "keywords": ["top 10", "popular posts", "popular"],
10
+ "description": "Display the Popular Posts",
11
+ "supports": {
12
+ "html": false
13
+ },
14
+ "attributes": {
15
+ "className": {
16
+ "type": "string",
17
+ "default": ""
18
+ },
19
+ "heading": {
20
+ "type": "boolean",
21
+ "default": false
22
+ },
23
+ "daily": {
24
+ "type": "boolean",
25
+ "default": false
26
+ },
27
+ "daily_range": {
28
+ "type": "number",
29
+ "default": 1
30
+ },
31
+ "hour_range": {
32
+ "type": "number",
33
+ "default": 0
34
+ },
35
+ "limit": {
36
+ "type": "number",
37
+ "default": 6
38
+ },
39
+ "offset": {
40
+ "type": "number",
41
+ "default": 0
42
+ },
43
+ "show_excerpt": {
44
+ "type": "boolean",
45
+ "default": false
46
+ },
47
+ "show_author": {
48
+ "type": "boolean",
49
+ "default": false
50
+ },
51
+ "show_date": {
52
+ "type": "boolean",
53
+ "default": false
54
+ },
55
+ "disp_list_count": {
56
+ "type": "boolean",
57
+ "default": false
58
+ },
59
+ "post_thumb_op": {
60
+ "type": "string",
61
+ "default": "text_only"
62
+ },
63
+ "other_attributes": {
64
+ "type": "string",
65
+ "default": ""
66
+ }
67
+ },
68
+ "textdomain": "top-10",
69
+ "editorScript": "file:./build/index.js"
70
+ }
includes/blocks/popular-posts/build/index.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'b737d55f4dc2398006195bc932404a85');
includes/blocks/popular-posts/build/index.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e={n:function(t){var l=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(l,{a:l}),l},d:function(t,l){for(var o in l)e.o(l,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:l[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.blocks,l=window.wp.element,o=window.wp.i18n,n=window.wp.serverSideRender,a=e.n(n),r=window.wp.blockEditor,p=window.wp.components;(0,t.registerBlockType)("top-10/popular-posts",{edit:function(e){let{attributes:t,setAttributes:n}=e;function i(e){return void 0===e||0===e||""===e||isNaN(e)?"":parseInt(e)}const{heading:_,daily:s,daily_range:u,hour_range:c,limit:d,offset:h,show_excerpt:m,show_author:w,show_date:b,disp_list_count:f,post_thumb_op:E,other_attributes:g}=t,y=(0,r.useBlockProps)();return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(r.InspectorControls,null,(0,l.createElement)(p.PanelBody,{title:(0,o.__)("Popular Posts Settings","top-10"),initialOpen:!0},(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.ToggleControl,{label:(0,o.__)("Show heading","top-10"),help:_?(0,o.__)("Heading displayed","top-10"):(0,o.__)("No Heading displayed","top-10"),checked:_,onChange:()=>{n({heading:!_})}}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.ToggleControl,{label:(0,o.__)("Custom period?","top-10"),help:s?(0,o.__)("Set range below","top-10"):(0,o.__)("Overall popular posts will be shown","top-10"),checked:s,onChange:()=>{n({daily:!s})}}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.TextControl,{label:(0,o.__)("Daily range","top-10"),value:u,onChange:e=>{n({daily_range:i(e)})},help:(0,o.__)("Number of days","top-10")}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.TextControl,{label:(0,o.__)("Hour range","top-10"),value:c,onChange:e=>{n({hour_range:i(e)})},help:(0,o.__)("Number of hours","top-10")}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.TextControl,{label:(0,o.__)("Number of posts","top-10"),value:d,onChange:e=>{n({limit:i(e)})},help:(0,o.__)("Maximum number of posts to display","top-10")}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.TextControl,{label:(0,o.__)("Offset","top-10"),value:h,onChange:e=>{n({offset:i(e)})},help:(0,o.__)("Number of posts to skip from the top","top-10")}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.ToggleControl,{label:(0,o.__)("Show excerpt","top-10"),help:m?(0,o.__)("Excerpt displayed","top-10"):(0,o.__)("No excerpt","top-10"),checked:m,onChange:()=>{n({show_excerpt:!m})}}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.ToggleControl,{label:(0,o.__)("Show author","top-10"),help:w?(0,o.__)('"by Author Name" displayed',"top-10"):(0,o.__)("No author displayed","top-10"),checked:w,onChange:()=>{n({show_author:!w})}}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.ToggleControl,{label:(0,o.__)("Show date","top-10"),help:b?(0,o.__)("Date of post displayed","top-10"):(0,o.__)("Date of post not displayed","top-10"),checked:b,onChange:()=>{n({show_date:!b})}}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.ToggleControl,{label:(0,o.__)("Show count","top-10"),help:f?(0,o.__)("Display number of visits","top-10"):(0,o.__)("Number of visits hidden","top-10"),checked:f,onChange:()=>{n({disp_list_count:!f})}}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.SelectControl,{label:(0,o.__)("Thumbnail option","top-10"),value:E,onChange:e=>{n({post_thumb_op:e})},help:(0,o.__)("Location of the post thumbnail","top-10"),options:[{value:"inline",label:(0,o.__)("Before title","top-10")},{value:"after",label:(0,o.__)("After title","top-10")},{value:"thumbs_only",label:(0,o.__)("Only thumbnail","top-10")},{value:"text_only",label:(0,o.__)("Only text","top-10")}]}))),(0,l.createElement)(p.PanelRow,null,(0,l.createElement)("fieldset",null,(0,l.createElement)(p.TextareaControl,{label:(0,o.__)("Other attributes","top-10"),value:g,onChange:e=>{n({other_attributes:void 0===e?"":e})},help:(0,o.__)("Enter other attributes in a URL-style string-query. e.g. post_types=post,page&link_nofollow=1&exclude_post_ids=5,6","top-10")}))))),(0,l.createElement)("div",y,(0,l.createElement)(a(),{block:"top-10/popular-posts",attributes:t})))},save:()=>null})}();
includes/blocks/popular-posts/index.js DELETED
@@ -1,250 +0,0 @@
1
- ( function( blocks, i18n, element, components, editor, blockEditor ) {
2
- var el = element.createElement;
3
- const {registerBlockType} = blocks;
4
- const {__} = i18n; //translation functions
5
- var ServerSideRender = wp.serverSideRender;
6
-
7
- const { RichText, InspectorControls } = blockEditor;
8
- const {
9
- TextControl,
10
- CheckboxControl,
11
- RadioControl,
12
- SelectControl,
13
- TextareaControl,
14
- ToggleControl,
15
- RangeControl,
16
- Panel,
17
- PanelBody,
18
- PanelRow,
19
- } = components;
20
-
21
- registerBlockType( 'top-10/popular-posts', {
22
- title: __( 'Popular Posts [Top 10]', 'top-10' ),
23
- description: __( 'Display popular posts by Top 10', 'top-10' ),
24
- category: 'widgets',
25
- icon: 'editor-ol',
26
- keywords: [ __( 'popular posts' ), __( 'popular' ), __( 'posts' ) ],
27
-
28
- attributes: {
29
- heading: {
30
- type: 'boolean',
31
- default: false,
32
- },
33
- daily: {
34
- type: 'boolean',
35
- default: false,
36
- },
37
- daily_range: {
38
- type: 'number',
39
- default: 1,
40
- },
41
- hour_range: {
42
- type: 'number',
43
- default: 0,
44
- },
45
- limit: {
46
- type: 'number',
47
- default: 6,
48
- },
49
- offset: {
50
- type: 'number',
51
- default: 0,
52
- },
53
- show_excerpt: {
54
- type: 'boolean',
55
- default: false,
56
- },
57
- show_author: {
58
- type: 'boolean',
59
- default: false,
60
- },
61
- show_date: {
62
- type: 'boolean',
63
- default: false,
64
- },
65
- disp_list_count: {
66
- type: 'boolean',
67
- default: false,
68
- },
69
- post_thumb_op: {
70
- type: 'string',
71
- default: 'inline',
72
- },
73
- other_attributes: {
74
- type: 'string',
75
- default: '',
76
- },
77
- },
78
-
79
- supports: {
80
- html: false,
81
- },
82
-
83
- example: { },
84
-
85
- edit: function( props ) {
86
- const attributes = props.attributes;
87
- const setAttributes = props.setAttributes;
88
-
89
- if(props.isSelected){
90
- // console.debug(props.attributes);
91
- };
92
-
93
-
94
- // Functions to update attributes.
95
- function changeHeading(heading){
96
- setAttributes({heading});
97
- }
98
-
99
- function changeExcerpt(show_excerpt){
100
- setAttributes({show_excerpt});
101
- }
102
-
103
- function changeDaily(daily){
104
- setAttributes({daily});
105
- }
106
-
107
- function changeAuthor(show_author){
108
- setAttributes({show_author});
109
- }
110
-
111
- function changeDate(show_date){
112
- setAttributes({show_date});
113
- }
114
-
115
- function changeDisplayCount(disp_list_count){
116
- setAttributes({disp_list_count});
117
- }
118
-
119
- function changeThumbnail(post_thumb_op){
120
- setAttributes({post_thumb_op});
121
- }
122
-
123
- function changeOtherAttributes(other_attributes){
124
- setAttributes({other_attributes});
125
- }
126
-
127
- return [
128
- /**
129
- * Server side render
130
- */
131
- el("div", { className: props.className },
132
- el( ServerSideRender, {
133
- block: 'top-10/popular-posts',
134
- attributes: attributes
135
- } )
136
- ),
137
-
138
- /**
139
- * Inspector
140
- */
141
- el( InspectorControls, {},
142
- el( PanelBody, { title: 'Related Posts Settings', initialOpen: true },
143
-
144
- el( ToggleControl, {
145
- label: __( 'Show heading', 'top-10' ),
146
- checked: attributes.heading,
147
- onChange: changeHeading
148
- } ),
149
- el( ToggleControl, {
150
- label: __( 'Custom period? Set range below', 'top-10' ),
151
- checked: attributes.daily,
152
- onChange: changeDaily
153
- } ),
154
- el( TextControl, {
155
- label: __( 'Daily range', 'top-10' ),
156
- value: attributes.daily_range,
157
- onChange: function( val ) {
158
- setAttributes( { daily_range: parseInt( val ) } );
159
- },
160
- type: 'number',
161
- min: 0,
162
- step: 1
163
- } ),
164
- el( TextControl, {
165
- label: __( 'Hourly range', 'top-10' ),
166
- value: attributes.hour_range,
167
- onChange: function( val ) {
168
- setAttributes( { hour_range: parseInt( val ) } );
169
- },
170
- type: 'number',
171
- min: 0,
172
- step: 1
173
- } ),
174
- el( TextControl, {
175
- label: __( 'No. of posts', 'top-10' ),
176
- value: attributes.limit,
177
- onChange: function( val ) {
178
- setAttributes( { limit: parseInt( val ) } );
179
- },
180
- type: 'number',
181
- min: 1,
182
- step: 1
183
- } ),
184
-
185
- el( TextControl, {
186
- label: __( 'Offset', 'top-10' ),
187
- value: attributes.offset,
188
- onChange: function( val ) {
189
- setAttributes( { offset: parseInt( val ) } );
190
- },
191
- type: 'number',
192
- min: 0,
193
- step: 1
194
- }),
195
-
196
- el( ToggleControl, {
197
- label: __( 'Show excerpt', 'top-10' ),
198
- checked: attributes.show_excerpt,
199
- onChange: changeExcerpt
200
- } ),
201
- el( ToggleControl, {
202
- label: __( 'Show author', 'top-10' ),
203
- checked: attributes.show_author,
204
- onChange: changeAuthor
205
- } ),
206
- el( ToggleControl, {
207
- label: __( 'Show date', 'top-10' ),
208
- checked: attributes.show_date,
209
- onChange: changeDate
210
- } ),
211
- el( ToggleControl, {
212
- label: __( 'Show count', 'top-10' ),
213
- checked: attributes.disp_list_count,
214
- onChange: changeDisplayCount
215
- } ),
216
- el(SelectControl, {
217
- value: attributes.post_thumb_op,
218
- label: __( 'Thumbnail options', 'top-10' ),
219
- onChange: changeThumbnail,
220
- options: [
221
- {value: 'inline', label: __( 'Before title', 'top-10' )},
222
- {value: 'after', label: __( 'After title', 'top-10' )},
223
- {value: 'thumbs_only', label: __( 'Only thumbnail', 'top-10' )},
224
- {value: 'text_only', label: __( 'Only text', 'top-10' )},
225
- ]
226
- } ),
227
- el( TextareaControl, {
228
- label: __( 'Other attributes', 'top-10' ),
229
- help: __( 'Enter other attributes in a URL-style string-query. e.g. post_types=post,page&link_nofollow=1&exclude_post_ids=5,6', 'top-10' ),
230
- value: attributes.other_attributes,
231
- onChange: changeOtherAttributes
232
- } )
233
- ),
234
- ),
235
- ]
236
- },
237
-
238
- save(){
239
- return null;//save has to exist. This all we need
240
- }
241
- } );
242
- } )(
243
- window.wp.blocks,
244
- window.wp.i18n,
245
- window.wp.element,
246
- window.wp.components,
247
- window.wp.editor,
248
- window.wp.blockEditor,
249
- window.wp.serverSideRender
250
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/blocks/popular-posts/index.min.js DELETED
@@ -1 +0,0 @@
1
- !function(blocks,i18n,element,components,editor,blockEditor){var el=element.createElement;const{registerBlockType:registerBlockType}=blocks,{__:__}=i18n;var ServerSideRender=wp.serverSideRender;const{RichText:RichText,InspectorControls:InspectorControls}=blockEditor,{TextControl:TextControl,CheckboxControl:CheckboxControl,RadioControl:RadioControl,SelectControl:SelectControl,TextareaControl:TextareaControl,ToggleControl:ToggleControl,RangeControl:RangeControl,Panel:Panel,PanelBody:PanelBody,PanelRow:PanelRow}=components;registerBlockType("top-10/popular-posts",{title:__("Popular Posts [Top 10]","top-10"),description:__("Display popular posts by Top 10","top-10"),category:"widgets",icon:"editor-ol",keywords:[__("popular posts"),__("popular"),__("posts")],attributes:{heading:{type:"boolean",default:!1},daily:{type:"boolean",default:!1},daily_range:{type:"number",default:1},hour_range:{type:"number",default:0},limit:{type:"number",default:6},offset:{type:"number",default:0},show_excerpt:{type:"boolean",default:!1},show_author:{type:"boolean",default:!1},show_date:{type:"boolean",default:!1},disp_list_count:{type:"boolean",default:!1},post_thumb_op:{type:"string",default:"inline"},other_attributes:{type:"string",default:""}},supports:{html:!1},example:{},edit:function(props){const attributes=props.attributes,setAttributes=props.setAttributes;function changeHeading(heading){setAttributes({heading:heading})}function changeExcerpt(show_excerpt){setAttributes({show_excerpt:show_excerpt})}function changeDaily(daily){setAttributes({daily:daily})}function changeAuthor(show_author){setAttributes({show_author:show_author})}function changeDate(show_date){setAttributes({show_date:show_date})}function changeDisplayCount(disp_list_count){setAttributes({disp_list_count:disp_list_count})}function changeThumbnail(post_thumb_op){setAttributes({post_thumb_op:post_thumb_op})}function changeOtherAttributes(other_attributes){setAttributes({other_attributes:other_attributes})}return props.isSelected,[el("div",{className:props.className},el(ServerSideRender,{block:"top-10/popular-posts",attributes:attributes})),el(InspectorControls,{},el(PanelBody,{title:"Related Posts Settings",initialOpen:!0},el(ToggleControl,{label:__("Show heading","top-10"),checked:attributes.heading,onChange:changeHeading}),el(ToggleControl,{label:__("Custom period? Set range below","top-10"),checked:attributes.daily,onChange:changeDaily}),el(TextControl,{label:__("Daily range","top-10"),value:attributes.daily_range,onChange:function(val){setAttributes({daily_range:parseInt(val)})},type:"number",min:0,step:1}),el(TextControl,{label:__("Hourly range","top-10"),value:attributes.hour_range,onChange:function(val){setAttributes({hour_range:parseInt(val)})},type:"number",min:0,step:1}),el(TextControl,{label:__("No. of posts","top-10"),value:attributes.limit,onChange:function(val){setAttributes({limit:parseInt(val)})},type:"number",min:1,step:1}),el(TextControl,{label:__("Offset","top-10"),value:attributes.offset,onChange:function(val){setAttributes({offset:parseInt(val)})},type:"number",min:0,step:1}),el(ToggleControl,{label:__("Show excerpt","top-10"),checked:attributes.show_excerpt,onChange:changeExcerpt}),el(ToggleControl,{label:__("Show author","top-10"),checked:attributes.show_author,onChange:changeAuthor}),el(ToggleControl,{label:__("Show date","top-10"),checked:attributes.show_date,onChange:changeDate}),el(ToggleControl,{label:__("Show count","top-10"),checked:attributes.disp_list_count,onChange:changeDisplayCount}),el(SelectControl,{value:attributes.post_thumb_op,label:__("Thumbnail options","top-10"),onChange:changeThumbnail,options:[{value:"inline",label:__("Before title","top-10")},{value:"after",label:__("After title","top-10")},{value:"thumbs_only",label:__("Only thumbnail","top-10")},{value:"text_only",label:__("Only text","top-10")}]}),el(TextareaControl,{label:__("Other attributes","top-10"),help:__("Enter other attributes in a URL-style string-query. e.g. post_types=post,page&link_nofollow=1&exclude_post_ids=5,6","top-10"),value:attributes.other_attributes,onChange:changeOtherAttributes})))]},save:()=>null})}(window.wp.blocks,window.wp.i18n,window.wp.element,window.wp.components,window.wp.editor,window.wp.blockEditor,window.wp.serverSideRender);
 
includes/blocks/popular-posts/index.php DELETED
@@ -1 +0,0 @@
1
- <?php // Silence is golden
 
includes/blocks/popular-posts/src/edit.js ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Retrieves the translation of text.
3
+ *
4
+ * @see https://developer.wordpress.org/block-editor/packages/packages-i18n/
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+
8
+ import ServerSideRender from '@wordpress/server-side-render';
9
+
10
+ /**
11
+ * React hook that is used to mark the block wrapper element.
12
+ * It provides all the necessary props like the class name.
13
+ *
14
+ * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps
15
+ */
16
+ import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
17
+
18
+ import {
19
+ TextControl,
20
+ TextareaControl,
21
+ ToggleControl,
22
+ PanelBody,
23
+ PanelRow,
24
+ SelectControl,
25
+ } from '@wordpress/components';
26
+
27
+ /**
28
+ * Lets webpack process CSS, SASS or SCSS files referenced in JavaScript files.
29
+ * Those files can contain any CSS code that gets applied to the editor.
30
+ *
31
+ * @see https://www.npmjs.com/package/@wordpress/scripts#using-css
32
+ */
33
+ //import './editor.scss';
34
+
35
+ /**
36
+ * The edit function describes the structure of your block in the context of the
37
+ * editor. This represents what the editor will render when the block is used.
38
+ *
39
+ * @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit
40
+ *
41
+ * @return {WPElement} Element to render.
42
+ */
43
+ export default function Edit({ attributes, setAttributes }) {
44
+ function processNumber(input) {
45
+ const output =
46
+ undefined === input || 0 === input || '' === input || isNaN(input)
47
+ ? ''
48
+ : parseInt(input);
49
+ return output;
50
+ }
51
+
52
+ const {
53
+ heading,
54
+ daily,
55
+ daily_range,
56
+ hour_range,
57
+ limit,
58
+ offset,
59
+ show_excerpt,
60
+ show_author,
61
+ show_date,
62
+ disp_list_count,
63
+ post_thumb_op,
64
+ other_attributes,
65
+ } = attributes;
66
+
67
+ const blockProps = useBlockProps();
68
+ const toggleHeading = () => {
69
+ setAttributes({ heading: !heading });
70
+ };
71
+ const toggleDaily = () => {
72
+ setAttributes({ daily: !daily });
73
+ };
74
+ const onChangeDailyRange = (newDailyRange) => {
75
+ setAttributes({ daily_range: processNumber(newDailyRange) });
76
+ };
77
+ const onChangeHourRange = (newHourRange) => {
78
+ setAttributes({ hour_range: processNumber(newHourRange) });
79
+ };
80
+ const onChangeLimit = (newLimit) => {
81
+ setAttributes({ limit: processNumber(newLimit) });
82
+ };
83
+ const onChangeOffset = (newOffset) => {
84
+ setAttributes({ offset: processNumber(newOffset) });
85
+ };
86
+ const toggleShowExcerpt = () => {
87
+ setAttributes({ show_excerpt: !show_excerpt });
88
+ };
89
+ const toggleShowAuthor = () => {
90
+ setAttributes({ show_author: !show_author });
91
+ };
92
+ const toggleShowDate = () => {
93
+ setAttributes({ show_date: !show_date });
94
+ };
95
+ const toggleShowCount = () => {
96
+ setAttributes({ disp_list_count: !disp_list_count });
97
+ };
98
+ const onChangeThumbnail = (newThumbnailLoc) => {
99
+ setAttributes({ post_thumb_op: newThumbnailLoc });
100
+ };
101
+ const onChangeOtherAttributes = (newOtherAttributes) => {
102
+ setAttributes({
103
+ other_attributes:
104
+ undefined === newOtherAttributes ? '' : newOtherAttributes,
105
+ });
106
+ };
107
+
108
+ return (
109
+ <>
110
+ <InspectorControls>
111
+ <PanelBody
112
+ title={__('Popular Posts Settings', 'top-10')}
113
+ initialOpen={true}
114
+ >
115
+ <PanelRow>
116
+ <fieldset>
117
+ <ToggleControl
118
+ label={__('Show heading', 'top-10')}
119
+ help={
120
+ heading
121
+ ? __('Heading displayed', 'top-10')
122
+ : __('No Heading displayed', 'top-10')
123
+ }
124
+ checked={heading}
125
+ onChange={toggleHeading}
126
+ />
127
+ </fieldset>
128
+ </PanelRow>
129
+ <PanelRow>
130
+ <fieldset>
131
+ <ToggleControl
132
+ label={__('Custom period?', 'top-10')}
133
+ help={
134
+ daily
135
+ ? __('Set range below', 'top-10')
136
+ : __('Overall popular posts will be shown', 'top-10')
137
+ }
138
+ checked={daily}
139
+ onChange={toggleDaily}
140
+ />
141
+ </fieldset>
142
+ </PanelRow>
143
+ <PanelRow>
144
+ <fieldset>
145
+ <TextControl
146
+ label={__('Daily range', 'top-10')}
147
+ value={daily_range}
148
+ onChange={onChangeDailyRange}
149
+ help={__('Number of days', 'top-10')}
150
+ />
151
+ </fieldset>
152
+ </PanelRow>
153
+ <PanelRow>
154
+ <fieldset>
155
+ <TextControl
156
+ label={__('Hour range', 'top-10')}
157
+ value={hour_range}
158
+ onChange={onChangeHourRange}
159
+ help={__('Number of hours', 'top-10')}
160
+ />
161
+ </fieldset>
162
+ </PanelRow>
163
+ <PanelRow>
164
+ <fieldset>
165
+ <TextControl
166
+ label={__('Number of posts', 'top-10')}
167
+ value={limit}
168
+ onChange={onChangeLimit}
169
+ help={__('Maximum number of posts to display', 'top-10')}
170
+ />
171
+ </fieldset>
172
+ </PanelRow>
173
+ <PanelRow>
174
+ <fieldset>
175
+ <TextControl
176
+ label={__('Offset', 'top-10')}
177
+ value={offset}
178
+ onChange={onChangeOffset}
179
+ help={__('Number of posts to skip from the top', 'top-10')}
180
+ />
181
+ </fieldset>
182
+ </PanelRow>
183
+ <PanelRow>
184
+ <fieldset>
185
+ <ToggleControl
186
+ label={__('Show excerpt', 'top-10')}
187
+ help={
188
+ show_excerpt
189
+ ? __('Excerpt displayed', 'top-10')
190
+ : __('No excerpt', 'top-10')
191
+ }
192
+ checked={show_excerpt}
193
+ onChange={toggleShowExcerpt}
194
+ />
195
+ </fieldset>
196
+ </PanelRow>
197
+ <PanelRow>
198
+ <fieldset>
199
+ <ToggleControl
200
+ label={__('Show author', 'top-10')}
201
+ help={
202
+ show_author
203
+ ? __('"by Author Name" displayed', 'top-10')
204
+ : __('No author displayed', 'top-10')
205
+ }
206
+ checked={show_author}
207
+ onChange={toggleShowAuthor}
208
+ />
209
+ </fieldset>
210
+ </PanelRow>
211
+ <PanelRow>
212
+ <fieldset>
213
+ <ToggleControl
214
+ label={__('Show date', 'top-10')}
215
+ help={
216
+ show_date
217
+ ? __('Date of post displayed', 'top-10')
218
+ : __('Date of post not displayed', 'top-10')
219
+ }
220
+ checked={show_date}
221
+ onChange={toggleShowDate}
222
+ />
223
+ </fieldset>
224
+ </PanelRow>
225
+ <PanelRow>
226
+ <fieldset>
227
+ <ToggleControl
228
+ label={__('Show count', 'top-10')}
229
+ help={
230
+ disp_list_count
231
+ ? __('Display number of visits', 'top-10')
232
+ : __('Number of visits hidden', 'top-10')
233
+ }
234
+ checked={disp_list_count}
235
+ onChange={toggleShowCount}
236
+ />
237
+ </fieldset>
238
+ </PanelRow>
239
+ <PanelRow>
240
+ <fieldset>
241
+ <SelectControl
242
+ label={__('Thumbnail option', 'top-10')}
243
+ value={post_thumb_op}
244
+ onChange={onChangeThumbnail}
245
+ help={__('Location of the post thumbnail', 'top-10')}
246
+ options={[
247
+ { value: 'inline', label: __('Before title', 'top-10') },
248
+ { value: 'after', label: __('After title', 'top-10') },
249
+ {
250
+ value: 'thumbs_only',
251
+ label: __('Only thumbnail', 'top-10'),
252
+ },
253
+ { value: 'text_only', label: __('Only text', 'top-10') },
254
+ ]}
255
+ />
256
+ </fieldset>
257
+ </PanelRow>
258
+ <PanelRow>
259
+ <fieldset>
260
+ <TextareaControl
261
+ label={__('Other attributes', 'top-10')}
262
+ value={other_attributes}
263
+ onChange={onChangeOtherAttributes}
264
+ help={__(
265
+ 'Enter other attributes in a URL-style string-query. e.g. post_types=post,page&link_nofollow=1&exclude_post_ids=5,6',
266
+ 'top-10'
267
+ )}
268
+ />
269
+ </fieldset>
270
+ </PanelRow>
271
+ </PanelBody>
272
+ </InspectorControls>
273
+
274
+ <div {...blockProps}>
275
+ <ServerSideRender
276
+ block="top-10/popular-posts"
277
+ attributes={attributes}
278
+ />
279
+ </div>
280
+ </>
281
+ );
282
+ }
includes/blocks/popular-posts/src/index.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Registers a new block provided a unique name and an object defining its behavior.
3
+ *
4
+ * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
5
+ */
6
+ import { registerBlockType } from '@wordpress/blocks';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import Edit from './edit';
12
+
13
+ /**
14
+ * Every block starts by registering a new block type definition.
15
+ *
16
+ * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/
17
+ */
18
+ registerBlockType('top-10/popular-posts', {
19
+ /**
20
+ * @see ./edit.js
21
+ */
22
+ edit: Edit,
23
+
24
+ save() {
25
+ return null;
26
+ },
27
+ });
includes/blocks/register-blocks.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions to register client-side assets (scripts and stylesheets) for the
4
+ * Gutenberg block.
5
+ *
6
+ * @package Top_Ten
7
+ */
8
+
9
+ // If this file is called directly, abort.
10
+ if ( ! defined( 'WPINC' ) ) {
11
+ die;
12
+ }
13
+
14
+ /**
15
+ * Registers the block using the metadata loaded from the `block.json` file.
16
+ * Behind the scenes, it registers also all assets so they can be enqueued
17
+ * through the block editor in the corresponding context.
18
+ *
19
+ * @since 3.1.0
20
+ */
21
+ function tptn_register_blocks() {
22
+ // Register Popular Posts block.
23
+ register_block_type_from_metadata(
24
+ TOP_TEN_PLUGIN_DIR . 'includes/blocks/popular-posts/',
25
+ array(
26
+ 'render_callback' => 'render_tptn_block',
27
+ )
28
+ );
29
+ }
30
+ add_action( 'init', 'tptn_register_blocks' );
31
+
32
+
33
+ /**
34
+ * Renders the `top-10/popular-posts` block on server.
35
+ *
36
+ * @since 3.0.0
37
+ * @param array $attributes The block attributes.
38
+ *
39
+ * @return string Returns the post content with popular posts added.
40
+ */
41
+ function render_tptn_block( $attributes ) {
42
+
43
+ $attributes['extra_class'] = $attributes['className'];
44
+
45
+ $arguments = array_merge(
46
+ $attributes,
47
+ array(
48
+ 'is_block' => 1,
49
+ )
50
+ );
51
+
52
+ $arguments = wp_parse_args( $attributes['other_attributes'], $arguments );
53
+
54
+ /**
55
+ * Filters arguments passed to get_tptn for the block.
56
+ *
57
+ * @since 3.0.0
58
+ *
59
+ * @param array $arguments Top 10 block options array.
60
+ * @param array $attributes Block attributes array.
61
+ */
62
+ $arguments = apply_filters( 'tptn_block_options', $arguments, $attributes );
63
+
64
+ return tptn_pop_posts( $arguments );
65
+ }
66
+
67
+ /**
68
+ * Enqueue scripts and styles for the block editor.
69
+ *
70
+ * @since 3.1.0
71
+ */
72
+ function tptn_enqueue_block_editor_assets() {
73
+
74
+ $style_array = tptn_get_style();
75
+ $file_prefix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
76
+
77
+ if ( ! empty( $style_array ) ) {
78
+ $style = $style_array['name'];
79
+ $extra_css = $style_array['extra_css'];
80
+
81
+ wp_enqueue_style(
82
+ 'popular-posts-block-editor',
83
+ plugins_url( "css/{$style}{$file_prefix}.css", TOP_TEN_PLUGIN_FILE ),
84
+ array( 'wp-edit-blocks' ),
85
+ filemtime( TOP_TEN_PLUGIN_DIR . "css/{$style}{$file_prefix}.css" )
86
+ );
87
+ wp_add_inline_style( 'popular-posts-block-editor', $extra_css );
88
+ }
89
+ }
90
+ add_action( 'enqueue_block_editor_assets', 'tptn_enqueue_block_editor_assets' );
includes/class-top-ten-query.php CHANGED
@@ -239,6 +239,10 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
239
  // Set post__not_in for WP_Query using exclude_post_ids.
240
  $exclude_post_ids = empty( $args['exclude_post_ids'] ) ? array() : wp_parse_id_list( $args['exclude_post_ids'] );
241
 
 
 
 
 
242
  /**
243
  * Filter exclude post IDs array.
244
  *
@@ -250,7 +254,7 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
250
  */
251
  $exclude_post_ids = apply_filters( 'tptn_exclude_post_ids', $exclude_post_ids, $args );
252
 
253
- $args['post__not_in'] = $exclude_post_ids;
254
 
255
  // Unset what we don't need.
256
  unset( $args['title'] );
@@ -291,8 +295,6 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
291
  * @return string Updated Fields
292
  */
293
  public function posts_fields( $fields, $query ) {
294
- global $wpdb;
295
-
296
  // Return if it is not a Top_Ten_Query.
297
  if ( true !== $query->get( 'top_ten_query' ) ) {
298
  return $fields;
@@ -441,10 +443,11 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
441
  if ( ! empty( $post_ids ) ) {
442
  $posts = get_posts(
443
  array(
444
- 'post__in' => $post_ids,
445
- 'fields' => $query->get( 'fields' ),
446
- 'orderby' => 'post__in',
447
- 'post_type' => $query->get( 'post_type' ),
 
448
  )
449
  );
450
  $query->found_posts = count( $posts );
@@ -488,10 +491,11 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
488
  if ( ! empty( $include_post_ids ) ) {
489
  $extra_posts = get_posts(
490
  array(
491
- 'post__in' => $include_post_ids,
492
- 'fields' => $query->get( 'fields' ),
493
- 'orderby' => 'post__in',
494
- 'post_type' => $query->get( 'post_type' ),
 
495
  )
496
  );
497
  $posts = array_merge( $extra_posts, $posts );
239
  // Set post__not_in for WP_Query using exclude_post_ids.
240
  $exclude_post_ids = empty( $args['exclude_post_ids'] ) ? array() : wp_parse_id_list( $args['exclude_post_ids'] );
241
 
242
+ if ( ! empty( $args['exclude_current_post'] ) ) {
243
+ array_push( $exclude_post_ids, absint( get_the_ID() ) );
244
+ }
245
+
246
  /**
247
  * Filter exclude post IDs array.
248
  *
254
  */
255
  $exclude_post_ids = apply_filters( 'tptn_exclude_post_ids', $exclude_post_ids, $args );
256
 
257
+ $args['post__not_in'] = array_filter( (array) $exclude_post_ids );
258
 
259
  // Unset what we don't need.
260
  unset( $args['title'] );
295
  * @return string Updated Fields
296
  */
297
  public function posts_fields( $fields, $query ) {
 
 
298
  // Return if it is not a Top_Ten_Query.
299
  if ( true !== $query->get( 'top_ten_query' ) ) {
300
  return $fields;
443
  if ( ! empty( $post_ids ) ) {
444
  $posts = get_posts(
445
  array(
446
+ 'include' => $post_ids,
447
+ 'fields' => $query->get( 'fields' ),
448
+ 'orderby' => 'post__in',
449
+ 'post_type' => $query->get( 'post_type' ),
450
+ 'post_status' => $query->get( 'post_status' ),
451
  )
452
  );
453
  $query->found_posts = count( $posts );
491
  if ( ! empty( $include_post_ids ) ) {
492
  $extra_posts = get_posts(
493
  array(
494
+ 'include' => $include_post_ids,
495
+ 'fields' => $query->get( 'fields' ),
496
+ 'orderby' => 'post__in',
497
+ 'post_type' => $query->get( 'post_type' ),
498
+ 'post_status' => $query->get( 'post_status' ),
499
  )
500
  );
501
  $posts = array_merge( $extra_posts, $posts );
includes/l10n.php CHANGED
@@ -16,43 +16,82 @@ function tptn_lang_init() {
16
  add_action( 'plugins_loaded', 'tptn_lang_init' );
17
 
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  /**
20
  * Fetch the post of the correct language.
21
  *
22
- * @since 2.1.0
 
23
  *
24
- * @param int $post_id Post ID.
 
25
  */
26
- function tptn_object_id_cur_lang( $post_id ) {
27
 
28
  $return_original_if_missing = false;
29
 
30
- /**
31
- * Filter to modify if the original language ID is returned.
32
- *
33
- * @since 2.2.3
34
- *
35
- * @param bool $return_original_if_missing
36
- * @param int $post_id Post ID
37
- */
38
- $return_original_if_missing = apply_filters( 'tptn_wpml_return_original', $return_original_if_missing, $post_id );
39
 
 
40
  if ( function_exists( 'pll_get_post' ) ) {
41
- $post_id = pll_get_post( $post_id );
42
- } elseif ( function_exists( 'wpml_object_id' ) ) {
43
- $post_id = apply_filters( 'wpml_object_id', $post_id, get_post_type( $post_id ), $return_original_if_missing );
44
- } elseif ( function_exists( 'icl_object_id' ) ) {
45
- $post_id = icl_object_id( $post_id, get_post_type( $post_id ), $return_original_if_missing );
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
 
48
  /**
49
- * Filters object ID for current language (WPML).
50
  *
51
- * @since 2.1.0
52
  *
53
- * @param int $post_id Post ID
54
  */
55
- return apply_filters( 'tptn_object_id_cur_lang', $post_id );
56
  }
57
-
58
-
16
  add_action( 'plugins_loaded', 'tptn_lang_init' );
17
 
18
 
19
+ /**
20
+ * Get the ID of a post in the current language. Works with WPML and PolyLang.
21
+ *
22
+ * @since 3.1.0
23
+ *
24
+ * @param array $results Array of Posts.
25
+ * @return array Updated array of WP_Post objects.
26
+ */
27
+ function tptn_translate_ids( $results ) {
28
+ $processed_ids = array();
29
+ $processed_results = array();
30
+
31
+ foreach ( (array) $results as $result ) {
32
+
33
+ $result = tptn_object_id_cur_lang( $result );
34
+
35
+ // If this is NULL or already processed ID then skip processing this loop.
36
+ if ( ! $result || in_array( $result->ID, $processed_ids ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
37
+ continue;
38
+ }
39
+
40
+ // Push the current ID into the array to ensure we're not repeating it.
41
+ array_push( $processed_ids, $result->ID );
42
+
43
+ $result = get_post( $result ); // Let's get the Post using the ID.
44
+ array_push( $processed_results, $result );
45
+ }
46
+ return $processed_results;
47
+ }
48
+ add_filter( 'top_ten_query_the_posts', 'tptn_translate_ids', 999 );
49
+
50
+
51
  /**
52
  * Fetch the post of the correct language.
53
  *
54
+ * @since 2.1.0
55
+ * @since 3.1.0 Parameter can be a WP_Post object. Return is a WP_Post object.
56
  *
57
+ * @param WP_Post|int|string $post Post object or Post ID.
58
+ * @return WP_Post Post opbject, updated if needed.
59
  */
60
+ function tptn_object_id_cur_lang( $post ) {
61
 
62
  $return_original_if_missing = false;
63
 
64
+ $post = get_post( $post );
65
+ $current_lang = apply_filters( 'wpml_current_language', null );
 
 
 
 
 
 
 
66
 
67
+ // Polylang implementation.
68
  if ( function_exists( 'pll_get_post' ) ) {
69
+ $post = pll_get_post( $post->ID );
70
+ $post = get_post( $post );
71
+ }
72
+
73
+ // WPML implementation.
74
+ if ( class_exists( 'SitePress' ) ) {
75
+ /**
76
+ * Filter to modify if the original language ID is returned.
77
+ *
78
+ * @since 2.2.3
79
+ *
80
+ * @param bool $return_original_if_missing Flag to return original post ID if translated post ID is missing.
81
+ * @param int $id Post ID
82
+ */
83
+ $return_original_if_missing = apply_filters( 'tptn_wpml_return_original', $return_original_if_missing, $post->ID );
84
+
85
+ $post = apply_filters( 'wpml_object_id', $post->ID, $post->post_type, $return_original_if_missing, $current_lang );
86
+ $post = get_post( $post );
87
  }
88
 
89
  /**
90
+ * Filters post object for current language.
91
  *
92
+ * @since 2.1.0
93
  *
94
+ * @param WP_Post $id Post object.
95
  */
96
+ return apply_filters( 'tptn_object_id_cur_lang', $post );
97
  }
 
 
includes/modules/class-top-ten-widget.php CHANGED
@@ -26,8 +26,9 @@ class Top_Ten_Widget extends WP_Widget {
26
  __( 'Popular Posts [Top 10]', 'top-10' ), // Name.
27
  array(
28
  'description' => __( 'Display popular posts', 'where-did-they-go-from-here' ),
29
- 'customize_selective_refresh' => true,
30
  'classname' => 'tptn_posts_list_widget',
 
 
31
  )
32
  );
33
 
@@ -43,28 +44,28 @@ class Top_Ten_Widget extends WP_Widget {
43
  * @param array $instance Previously saved values from database.
44
  */
45
  public function form( $instance ) {
46
- $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
47
- $limit = isset( $instance['limit'] ) ? esc_attr( $instance['limit'] ) : '';
48
- $offset = isset( $instance['offset'] ) ? esc_attr( $instance['offset'] ) : '';
49
- $disp_list_count = isset( $instance['disp_list_count'] ) ? esc_attr( $instance['disp_list_count'] ) : '';
50
- $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
51
- $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
52
- $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
53
- $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
54
- $thumb_height = isset( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : '';
55
- $thumb_width = isset( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : '';
56
- $daily = isset( $instance['daily'] ) ? esc_attr( $instance['daily'] ) : 'overall';
57
- $daily_range = isset( $instance['daily_range'] ) ? esc_attr( $instance['daily_range'] ) : '';
58
- $hour_range = isset( $instance['hour_range'] ) ? esc_attr( $instance['hour_range'] ) : '';
59
- $include_categories = isset( $instance['include_categories'] ) ? esc_attr( $instance['include_categories'] ) : '';
60
- $include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
61
- $include_post_ids = isset( $instance['include_post_ids'] ) ? esc_attr( $instance['include_post_ids'] ) : '';
62
 
63
  // Parse the Post types.
64
  $post_types = array();
65
- if ( isset( $instance['post_types'] ) ) {
66
  $post_types = $instance['post_types'];
67
- parse_str( $post_types, $post_types ); // Save post types in $post_types variable.
68
  }
69
  $wp_post_types = get_post_types(
70
  array(
@@ -75,91 +76,77 @@ class Top_Ten_Widget extends WP_Widget {
75
 
76
  ?>
77
  <p>
78
- <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
79
- <?php esc_html_e( 'Title', 'top-10' ); ?>: <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
80
- </label>
81
  </p>
82
  <p>
83
- <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>">
84
- <?php esc_html_e( 'No. of posts', 'top-10' ); ?>: <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" />
85
- </label>
86
  </p>
87
  <p>
88
- <label for="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>">
89
- <?php esc_html_e( 'Offset', 'top-10' ); ?>: <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'offset' ) ); ?>" type="text" value="<?php echo esc_attr( $offset ); ?>" />
90
- </label>
91
  </p>
92
  <p>
 
93
  <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'daily' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'daily' ) ); ?>">
94
- <option value="overall" <?php selected( 'overall', $daily, true ); ?>><?php esc_html_e( 'Overall', 'top-10' ); ?></option>
95
- <option value="daily" <?php selected( 'daily', $daily, true ); ?>><?php esc_html_e( 'Custom time period (Enter below)', 'top-10' ); ?></option>
96
  </select>
97
  </p>
98
  <p>
99
- <?php esc_html_e( 'In days and hours (applies only to custom option above)', 'top-10' ); ?>:
100
- <label for="<?php echo esc_attr( $this->get_field_id( 'daily_range' ) ); ?>">
101
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'daily_range' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'daily_range' ) ); ?>" type="text" value="<?php echo esc_attr( $daily_range ); ?>" /> <?php esc_html_e( 'days', 'top-10' ); ?>
102
- </label>
103
- <label for="<?php echo esc_attr( $this->get_field_id( 'hour_range' ) ); ?>">
104
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'hour_range' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hour_range' ) ); ?>" type="text" value="<?php echo esc_attr( $hour_range ); ?>" /> <?php esc_html_e( 'hours', 'top-10' ); ?>
105
- </label>
106
- </p>
107
- <p>
108
- <label for="<?php echo esc_attr( $this->get_field_id( 'disp_list_count' ) ); ?>">
109
- <input id="<?php echo esc_attr( $this->get_field_id( 'disp_list_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'disp_list_count' ) ); ?>" type="checkbox" <?php checked( true, $disp_list_count, true ); ?> /> <?php esc_html_e( 'Show count?', 'top-10' ); ?>
110
- </label>
111
  </p>
112
  <p>
113
- <label for="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>">
114
- <input id="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_excerpt' ) ); ?>" type="checkbox" <?php checked( true, $show_excerpt, true ); ?> /> <?php esc_html_e( 'Show excerpt?', 'top-10' ); ?>
115
- </label>
116
- </p>
117
- <p>
118
- <label for="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>">
119
- <input id="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_author' ) ); ?>" type="checkbox" <?php checked( true, $show_author, true ); ?> /> <?php esc_html_e( 'Show author?', 'top-10' ); ?>
120
- </label>
121
- </p>
122
- <p>
123
- <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>">
124
- <input id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" type="checkbox" <?php checked( true, $show_date, true ); ?> /> <?php esc_html_e( 'Show date?', 'top-10' ); ?>
125
- </label>
 
126
  </p>
 
127
  <p>
128
- <?php esc_html_e( 'Thumbnail options', 'top-10' ); ?>: <br />
129
  <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'post_thumb_op' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_thumb_op' ) ); ?>">
130
- <option value="inline" <?php selected( 'inline', $post_thumb_op, true ); ?>><?php esc_html_e( 'Thumbnails inline, before title', 'top-10' ); ?></option>
131
- <option value="after" <?php selected( 'after', $post_thumb_op, true ); ?>><?php esc_html_e( 'Thumbnails inline, after title', 'top-10' ); ?></option>
132
- <option value="thumbs_only" <?php selected( 'thumbs_only', $post_thumb_op, true ); ?>><?php esc_html_e( 'Only thumbnails, no text', 'top-10' ); ?></option>
133
- <option value="text_only" <?php selected( 'text_only', $post_thumb_op, true ); ?>><?php esc_html_e( 'No thumbnails, only text.', 'top-10' ); ?></option>
134
  </select>
135
  </p>
136
  <p>
137
- <label for="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>">
138
- <?php esc_html_e( 'Thumbnail height', 'top-10' ); ?>:
139
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_height' ) ); ?>" type="text" value="<?php echo esc_attr( $thumb_height ); ?>" />
140
- </label>
141
  </p>
142
  <p>
143
- <label for="<?php echo esc_attr( $this->get_field_id( 'thumb_width' ) ); ?>">
144
- <?php esc_html_e( 'Thumbnail width', 'top-10' ); ?>:
145
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'thumb_width' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_width' ) ); ?>" type="text" value="<?php echo esc_attr( $thumb_width ); ?>" />
146
- </label>
147
  </p>
148
  <p>
149
- <label for="<?php echo esc_attr( $this->get_field_id( 'include_categories' ) ); ?>">
150
- <?php esc_html_e( 'Only from categories', 'top-10' ); ?>:
151
- <input class="widefat category_autocomplete" id="<?php echo esc_attr( $this->get_field_id( 'include_categories' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include_categories' ) ); ?>" type="text" value="<?php echo esc_attr( $include_categories ); ?>" />
152
- </label>
153
- <input type="hidden" id="<?php echo esc_attr( $this->get_field_id( 'include_cat_ids' ) ); ?>" name="<?php echo esc_attr( $this->get_field_id( 'include_cat_ids' ) ); ?>" value="<?php echo esc_attr( $include_cat_ids ); ?>" />
154
  </p>
155
  <p>
156
- <label for="<?php echo esc_attr( $this->get_field_id( 'include_post_ids' ) ); ?>">
157
- <?php esc_html_e( 'Include IDs', 'top-10' ); ?>:
158
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include_post_ids' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include_post_ids' ) ); ?>" type="text" value="<?php echo esc_attr( $include_post_ids ); ?>" />
159
- </label>
160
  </p>
161
- <p><?php esc_html_e( 'Post types to include:', 'top-10' ); ?><br />
162
-
 
163
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
164
 
165
  <label>
@@ -196,20 +183,25 @@ class Top_Ten_Widget extends WP_Widget {
196
  * @return array Updated safe values to be saved.
197
  */
198
  public function update( $new_instance, $old_instance ) {
199
- $instance = $old_instance;
200
- $instance['title'] = wp_strip_all_tags( $new_instance['title'] );
201
- $instance['limit'] = $new_instance['limit'];
202
- $instance['offset'] = $new_instance['offset'];
203
- $instance['daily'] = $new_instance['daily'];
204
- $instance['daily_range'] = $new_instance['daily_range'];
205
- $instance['hour_range'] = $new_instance['hour_range'];
206
- $instance['disp_list_count'] = isset( $new_instance['disp_list_count'] ) ? true : false;
207
- $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? true : false;
208
- $instance['show_author'] = isset( $new_instance['show_author'] ) ? true : false;
209
- $instance['show_date'] = isset( $new_instance['show_date'] ) ? true : false;
210
- $instance['post_thumb_op'] = $new_instance['post_thumb_op'];
211
- $instance['thumb_height'] = $new_instance['thumb_height'];
212
- $instance['thumb_width'] = $new_instance['thumb_width'];
 
 
 
 
 
213
  $instance['include_post_ids'] = implode( ',', array_filter( array_map( 'absint', explode( ',', $new_instance['include_post_ids'] ) ) ) );
214
 
215
  // Process post types to be selected.
@@ -218,7 +210,7 @@ class Top_Ten_Widget extends WP_Widget {
218
  'public' => true,
219
  )
220
  );
221
- $post_types = ( isset( $new_instance['post_types'] ) ) ? $new_instance['post_types'] : array();
222
  $post_types = array_intersect( $wp_post_types, $post_types );
223
  $instance['post_types'] = http_build_query( $post_types, '', '&' );
224
 
@@ -257,44 +249,36 @@ class Top_Ten_Widget extends WP_Widget {
257
  public function widget( $args, $instance ) {
258
  global $post;
259
 
260
- // Get the post meta.
261
- if ( isset( $post ) ) {
262
- $tptn_post_meta = get_post_meta( $post->ID, 'tptn_post_meta', true );
263
-
264
- if ( isset( $tptn_post_meta['disable_here'] ) && ( $tptn_post_meta['disable_here'] ) ) {
265
- return;
266
- }
267
- }
268
-
269
- $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? wp_strip_all_tags( tptn_get_option( 'title' ) ) : $instance['title'] );
270
-
271
- $limit = isset( $instance['limit'] ) ? $instance['limit'] : tptn_get_option( 'limit' );
272
- if ( empty( $limit ) ) {
273
- $limit = tptn_get_option( 'limit' );
274
  }
275
 
276
- $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
277
- $daily_range = ( empty( $instance['daily_range'] ) ) ? tptn_get_option( 'daily_range' ) : $instance['daily_range'];
278
- $hour_range = ( empty( $instance['hour_range'] ) ) ? tptn_get_option( 'hour_range' ) : $instance['hour_range'];
279
-
280
- $daily = ( isset( $instance['daily'] ) && ( 'daily' === $instance['daily'] ) ) ? true : false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
 
282
  $output = $args['before_widget'];
283
  $output .= $args['before_title'] . $title . $args['after_title'];
284
 
285
- $post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
286
-
287
- $thumb_height = ( isset( $instance['thumb_height'] ) && '' !== $instance['thumb_height'] ) ? absint( $instance['thumb_height'] ) : tptn_get_option( 'thumb_height' );
288
- $thumb_width = ( isset( $instance['thumb_width'] ) && '' !== $instance['thumb_width'] ) ? absint( $instance['thumb_width'] ) : tptn_get_option( 'thumb_width' );
289
-
290
- $disp_list_count = isset( $instance['disp_list_count'] ) ? esc_attr( $instance['disp_list_count'] ) : '';
291
- $show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
292
- $show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
293
- $show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
294
- $post_types = isset( $instance['post_types'] ) ? $instance['post_types'] : tptn_get_option( 'post_types' );
295
- $include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
296
- $include_post_ids = isset( $instance['include_post_ids'] ) ? esc_attr( $instance['include_post_ids'] ) : '';
297
-
298
  $arguments = array(
299
  'is_widget' => 1,
300
  'instance_id' => $this->number,
26
  __( 'Popular Posts [Top 10]', 'top-10' ), // Name.
27
  array(
28
  'description' => __( 'Display popular posts', 'where-did-they-go-from-here' ),
 
29
  'classname' => 'tptn_posts_list_widget',
30
+ 'customize_selective_refresh' => true,
31
+ 'show_instance_in_rest' => true,
32
  )
33
  );
34
 
44
  * @param array $instance Previously saved values from database.
45
  */
46
  public function form( $instance ) {
47
+ $instance['title'] = isset( $instance['title'] ) ? $instance['title'] : '';
48
+ $instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : '';
49
+ $instance['offset'] = isset( $instance['offset'] ) ? $instance['offset'] : '';
50
+ $instance['disp_list_count'] = isset( $instance['disp_list_count'] ) ? $instance['disp_list_count'] : '';
51
+ $instance['show_excerpt'] = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : '';
52
+ $instance['show_author'] = isset( $instance['show_author'] ) ? $instance['show_author'] : '';
53
+ $instance['show_date'] = isset( $instance['show_date'] ) ? $instance['show_date'] : '';
54
+ $instance['post_thumb_op'] = isset( $instance['post_thumb_op'] ) ? $instance['post_thumb_op'] : 'text_only';
55
+ $instance['thumb_height'] = isset( $instance['thumb_height'] ) ? $instance['thumb_height'] : '';
56
+ $instance['thumb_width'] = isset( $instance['thumb_width'] ) ? $instance['thumb_width'] : '';
57
+ $instance['daily'] = isset( $instance['daily'] ) ? $instance['daily'] : 'overall';
58
+ $instance['daily_range'] = isset( $instance['daily_range'] ) ? $instance['daily_range'] : '';
59
+ $instance['hour_range'] = isset( $instance['hour_range'] ) ? $instance['hour_range'] : '';
60
+ $instance['include_categories'] = isset( $instance['include_categories'] ) ? $instance['include_categories'] : '';
61
+ $instance['include_cat_ids'] = isset( $instance['include_cat_ids'] ) ? $instance['include_cat_ids'] : '';
62
+ $instance['include_post_ids'] = isset( $instance['include_post_ids'] ) ? $instance['include_post_ids'] : '';
63
 
64
  // Parse the Post types.
65
  $post_types = array();
66
+ if ( ! empty( $instance['post_types'] ) ) {
67
  $post_types = $instance['post_types'];
68
+ parse_str( $post_types, $post_types ); // Save post types in $post_types variable.
69
  }
70
  $wp_post_types = get_post_types(
71
  array(
76
 
77
  ?>
78
  <p>
79
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'top-10' ); ?></label>
80
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
 
81
  </p>
82
  <p>
83
+ <label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'No. of posts', 'top-10' ); ?></label>
84
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['limit'] ); ?>" />
 
85
  </p>
86
  <p>
87
+ <label for="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>"><?php esc_html_e( 'Offset', 'top-10' ); ?></label>
88
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'offset' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'offset' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['offset'] ); ?>" />
 
89
  </p>
90
  <p>
91
+ <label for="<?php echo esc_attr( $this->get_field_id( 'daily' ) ); ?>"><?php esc_html_e( 'Select period', 'top-10' ); ?></label>
92
  <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'daily' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'daily' ) ); ?>">
93
+ <option value="overall" <?php selected( $instance['daily'], 'overall' ); ?>><?php esc_html_e( 'Overall', 'top-10' ); ?></option>
94
+ <option value="daily" <?php selected( $instance['daily'], 'daily' ); ?>><?php esc_html_e( 'Custom time period (Enter below)', 'top-10' ); ?></option>
95
  </select>
96
  </p>
97
  <p>
98
+ <label for="<?php echo esc_attr( $this->get_field_id( 'daily_range' ) ); ?>"><?php esc_html_e( 'Days', 'top-10' ); ?></label>
99
+ <input id="<?php echo esc_attr( $this->get_field_id( 'daily_range' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'daily_range' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['daily_range'] ); ?>" />
100
+ <br />
101
+ <label for="<?php echo esc_attr( $this->get_field_id( 'hour_range' ) ); ?>"><?php esc_html_e( 'Hours', 'top-10' ); ?></label>
102
+ <input id="<?php echo esc_attr( $this->get_field_id( 'hour_range' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hour_range' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['hour_range'] ); ?>" />
 
 
 
 
 
 
 
103
  </p>
104
  <p>
105
+ <input class="checkbox" type="checkbox" <?php checked( $instance['disp_list_count'], true ); ?> id="<?php echo esc_attr( $this->get_field_id( 'disp_list_count' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'disp_list_count' ) ); ?>" />
106
+ <label for="<?php echo esc_attr( $this->get_field_id( 'disp_list_count' ) ); ?>"><?php esc_html_e( 'Show count', 'top-10' ); ?></label>
107
+ <br/>
108
+
109
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_excerpt'], true ); ?> id="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_excerpt' ) ); ?>" />
110
+ <label for="<?php echo esc_attr( $this->get_field_id( 'show_excerpt' ) ); ?>"><?php esc_html_e( 'Show excerpt', 'top-10' ); ?></label>
111
+ <br/>
112
+
113
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_author'], true ); ?> id="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_author' ) ); ?>" />
114
+ <label for="<?php echo esc_attr( $this->get_field_id( 'show_author' ) ); ?>"><?php esc_html_e( 'Show author', 'top-10' ); ?></label>
115
+ <br/>
116
+
117
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_date'], true ); ?> id="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_date' ) ); ?>" />
118
+ <label for="<?php echo esc_attr( $this->get_field_id( 'show_date' ) ); ?>"><?php esc_html_e( 'Show date', 'top-10' ); ?></label>
119
  </p>
120
+
121
  <p>
122
+ <label for="<?php echo esc_attr( $this->get_field_id( 'post_thumb_op' ) ); ?>"><?php esc_html_e( 'Thumbnail options', 'top-10' ); ?></label>
123
  <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'post_thumb_op' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'post_thumb_op' ) ); ?>">
124
+ <option value="inline" <?php selected( $instance['post_thumb_op'], 'inline' ); ?>><?php esc_html_e( 'Thumbnails inline, before title', 'top-10' ); ?></option>
125
+ <option value="after" <?php selected( $instance['post_thumb_op'], 'after' ); ?>><?php esc_html_e( 'Thumbnails inline, after title', 'top-10' ); ?></option>
126
+ <option value="thumbs_only" <?php selected( $instance['post_thumb_op'], 'thumbs_only' ); ?>><?php esc_html_e( 'Only thumbnails, no text', 'top-10' ); ?></option>
127
+ <option value="text_only" <?php selected( $instance['post_thumb_op'], 'text_only' ); ?>><?php esc_html_e( 'No thumbnails, only text.', 'top-10' ); ?></option>
128
  </select>
129
  </p>
130
  <p>
131
+ <label for="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>"><?php esc_html_e( 'Thumbnail height', 'top-10' ); ?></label>
132
+ <input id="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_height' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['thumb_height'] ); ?>" />
 
 
133
  </p>
134
  <p>
135
+ <label for="<?php echo esc_attr( $this->get_field_id( 'thumb_width' ) ); ?>"><?php esc_html_e( 'Thumbnail width', 'top-10' ); ?></label>
136
+ <input id="<?php echo esc_attr( $this->get_field_id( 'thumb_width' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'thumb_width' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['thumb_width'] ); ?>" />
 
 
137
  </p>
138
  <p>
139
+ <label for="<?php echo esc_attr( $this->get_field_id( 'include_categories' ) ); ?>"><?php esc_html_e( 'Only from categories', 'top-10' ); ?>:</label>
140
+ <input class="widefat category_autocomplete" id="<?php echo esc_attr( $this->get_field_id( 'include_categories' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include_categories' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['include_categories'] ); ?>" />
141
+ <input type="hidden" id="<?php echo esc_attr( $this->get_field_id( 'include_cat_ids' ) ); ?>" name="<?php echo esc_attr( $this->get_field_id( 'include_cat_ids' ) ); ?>" value="<?php echo esc_attr( $instance['include_cat_ids'] ); ?>" />
 
 
142
  </p>
143
  <p>
144
+ <label for="<?php echo esc_attr( $this->get_field_id( 'include_post_ids' ) ); ?>"><?php esc_html_e( 'Include IDs', 'top-10' ); ?></label>
145
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include_post_ids' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include_post_ids' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['include_post_ids'] ); ?>" />
 
 
146
  </p>
147
+ <p>
148
+ <label for="<?php echo esc_attr( $this->get_field_id( 'post_types' ) ); ?>"><?php esc_html_e( 'Post types to include', 'top-10' ); ?></label>
149
+ <br />
150
  <?php foreach ( $wp_post_types as $wp_post_type ) { ?>
151
 
152
  <label>
183
  * @return array Updated safe values to be saved.
184
  */
185
  public function update( $new_instance, $old_instance ) {
186
+ $instance = $old_instance;
187
+ $instance['title'] = wp_strip_all_tags( $new_instance['title'] );
188
+ $instance['limit'] = $new_instance['limit'];
189
+ $instance['offset'] = $new_instance['offset'];
190
+ $instance['disp_list_count'] = isset( $new_instance['disp_list_count'] ) ? (bool) $new_instance['disp_list_count'] : false;
191
+ $instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? (bool) $new_instance['show_excerpt'] : false;
192
+ $instance['show_author'] = isset( $new_instance['show_author'] ) ? (bool) $new_instance['show_author'] : false;
193
+ $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
194
+ $instance['daily'] = $new_instance['daily'];
195
+ $instance['daily_range'] = $new_instance['daily_range'];
196
+ $instance['hour_range'] = $new_instance['hour_range'];
197
+ $instance['thumb_height'] = $new_instance['thumb_height'];
198
+ $instance['thumb_width'] = $new_instance['thumb_width'];
199
+
200
+ $instance['post_thumb_op'] = 'text_only';
201
+ if ( in_array( $new_instance['post_thumb_op'], array( 'inline', 'after', 'thumbs_only', 'text_only' ), true ) ) {
202
+ $instance['post_thumb_op'] = $new_instance['post_thumb_op'];
203
+ }
204
+
205
  $instance['include_post_ids'] = implode( ',', array_filter( array_map( 'absint', explode( ',', $new_instance['include_post_ids'] ) ) ) );
206
 
207
  // Process post types to be selected.
210
  'public' => true,
211
  )
212
  );
213
+ $post_types = isset( $new_instance['post_types'] ) ? (array) $new_instance['post_types'] : array();
214
  $post_types = array_intersect( $wp_post_types, $post_types );
215
  $instance['post_types'] = http_build_query( $post_types, '', '&' );
216
 
249
  public function widget( $args, $instance ) {
250
  global $post;
251
 
252
+ if ( tptn_exclude_on( $post, $args ) ) {
253
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
254
  }
255
 
256
+ $default_title = wp_strip_all_tags( tptn_get_option( 'title' ) );
257
+ $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title;
258
+
259
+ /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
260
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
261
+
262
+ $limit = ! empty( $instance['limit'] ) ? $instance['limit'] : tptn_get_option( 'limit' );
263
+
264
+ $offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
265
+ $daily_range = ( empty( $instance['daily_range'] ) ) ? tptn_get_option( 'daily_range' ) : $instance['daily_range'];
266
+ $hour_range = ( empty( $instance['hour_range'] ) ) ? tptn_get_option( 'hour_range' ) : $instance['hour_range'];
267
+ $daily = ( isset( $instance['daily'] ) && ( 'daily' === $instance['daily'] ) ) ? true : false;
268
+ $post_thumb_op = isset( $instance['post_thumb_op'] ) ? $instance['post_thumb_op'] : 'text_only';
269
+ $thumb_height = ! empty( $instance['thumb_height'] ) ? absint( $instance['thumb_height'] ) : tptn_get_option( 'thumb_height' );
270
+ $thumb_width = ! empty( $instance['thumb_width'] ) ? absint( $instance['thumb_width'] ) : tptn_get_option( 'thumb_width' );
271
+ $disp_list_count = isset( $instance['disp_list_count'] ) ? $instance['disp_list_count'] : '';
272
+ $show_excerpt = isset( $instance['show_excerpt'] ) ? $instance['show_excerpt'] : '';
273
+ $show_author = isset( $instance['show_author'] ) ? $instance['show_author'] : '';
274
+ $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : '';
275
+ $post_types = ! empty( $instance['post_types'] ) ? $instance['post_types'] : tptn_get_option( 'post_types' );
276
+ $include_cat_ids = isset( $instance['include_cat_ids'] ) ? $instance['include_cat_ids'] : '';
277
+ $include_post_ids = isset( $instance['include_post_ids'] ) ? $instance['include_post_ids'] : '';
278
 
279
  $output = $args['before_widget'];
280
  $output .= $args['before_title'] . $title . $args['after_title'];
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  $arguments = array(
283
  'is_widget' => 1,
284
  'instance_id' => $this->number,
includes/modules/exclusions.php CHANGED
@@ -45,3 +45,66 @@ function tptn_exclude_post_ids( $exclude_post_ids ) {
45
  }
46
  add_filter( 'tptn_exclude_post_ids', 'tptn_exclude_post_ids' );
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
  add_filter( 'tptn_exclude_post_ids', 'tptn_exclude_post_ids' );
47
 
48
+
49
+ /**
50
+ * Processes exclusion settings to return if the related posts should not be displayed on the current post.
51
+ *
52
+ * @since 3.1.0
53
+ *
54
+ * @param int|WP_Post|null $post Post ID or post object. Defaults to global $post. Default null.
55
+ * @param array $args Parameters in a query string format.
56
+ * @return bool True if any exclusion setting is matched.
57
+ */
58
+ function tptn_exclude_on( $post = null, $args = array() ) {
59
+ $post = get_post( $post );
60
+ if ( ! $post ) {
61
+ return false;
62
+ }
63
+
64
+ // If this post ID is in the DO NOT DISPLAY list.
65
+ $exclude_on_post_ids_list = isset( $args['exclude_on_post_ids_list'] ) ? $args['exclude_on_post_ids_list'] : tptn_get_option( 'exclude_on_post_ids_list' );
66
+ $exclude_on_post_ids_list = explode( ',', $exclude_on_post_ids_list );
67
+ if ( in_array( $post->ID, $exclude_on_post_ids_list ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
68
+ return true;
69
+ }
70
+
71
+ // If this post type is in the DO NOT DISPLAY list.
72
+ // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
73
+ $exclude_on_post_types = isset( $args['exclude_on_post_types'] ) ? $args['exclude_on_post_types'] : tptn_get_option( 'exclude_on_post_types' );
74
+ $exclude_on_post_types = $exclude_on_post_types ? explode( ',', $exclude_on_post_types ) : array();
75
+
76
+ if ( in_array( $post->post_type, $exclude_on_post_types, true ) ) {
77
+ return true;
78
+ }
79
+
80
+ // If this post's category is in the DO NOT DISPLAY list.
81
+ $exclude_on_categories = isset( $args['exclude_on_categories'] ) ? $args['exclude_on_categories'] : tptn_get_option( 'exclude_on_categories' );
82
+ $exclude_on_categories = explode( ',', $exclude_on_categories );
83
+ $post_categories = get_the_terms( $post->ID, 'category' );
84
+ $categories = array();
85
+ if ( ! empty( $post_categories ) && ! is_wp_error( $post_categories ) ) {
86
+ $categories = wp_list_pluck( $post_categories, 'term_taxonomy_id' );
87
+ }
88
+ if ( ! empty( array_intersect( $exclude_on_categories, $categories ) ) ) {
89
+ return true;
90
+ }
91
+
92
+ // If the DO NOT DISPLAY meta field is set.
93
+ if ( ( isset( $args['is_shortcode'] ) && ! $args['is_shortcode'] ) &&
94
+ ( isset( $args['is_manual'] ) && ! $args['is_manual'] ) &&
95
+ ( isset( $args['is_block'] ) && ! $args['is_block'] ) ) {
96
+ $tptn_post_meta = get_post_meta( $post->ID, 'tptn_post_meta', true );
97
+
98
+ if ( isset( $tptn_post_meta['disable_here'] ) ) {
99
+ $disable_here = $tptn_post_meta['disable_here'];
100
+ } else {
101
+ $disable_here = 0;
102
+ }
103
+
104
+ if ( $disable_here ) {
105
+ return true;
106
+ }
107
+ }
108
+
109
+ return false;
110
+ }
includes/public/display-posts.php CHANGED
@@ -19,13 +19,7 @@ if ( ! defined( 'WPINC' ) ) {
19
  * @return string HTML output of the popular posts.
20
  */
21
  function tptn_pop_posts( $args ) {
22
- global $tptn_settings;
23
-
24
- // if set, save $exclude_categories.
25
- if ( isset( $args['exclude_categories'] ) && '' != $args['exclude_categories'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
26
- $exclude_categories = explode( ',', $args['exclude_categories'] );
27
- $args['strict_limit'] = false;
28
- }
29
 
30
  $defaults = array(
31
  'daily' => false,
@@ -50,12 +44,18 @@ function tptn_pop_posts( $args ) {
50
  /**
51
  * Fires before the output processing begins.
52
  *
53
- * @since 2.2.0
54
  *
55
- * @param string $output Formatted list of top posts
56
- * @param array $args Array of arguments
 
57
  */
58
- do_action( 'pre_tptn_pop_posts', $output, $args );
 
 
 
 
 
59
 
60
  // Check if the cache is enabled and if the output exists. If so, return the output.
61
  if ( $args['cache'] ) {
@@ -78,18 +78,20 @@ function tptn_pop_posts( $args ) {
78
  }
79
 
80
  // Get thumbnail size.
81
- list( $args['thumb_width'], $args['thumb_height'] ) = tptn_get_thumb_size( $args );
82
 
83
  // Retrieve the popular posts.
84
  $results = get_tptn_posts( $args );
85
 
86
  $counter = 0;
87
 
 
88
  $daily_class = $args['daily'] ? 'tptn_posts_daily ' : 'tptn_posts ';
 
89
  $widget_class = $args['is_widget'] ? ' tptn_posts_widget tptn_posts_widget' . $args['instance_id'] : '';
90
  $shortcode_class = $args['is_shortcode'] ? ' tptn_posts_shortcode' : '';
91
 
92
- $post_classes = $daily_class . $widget_class . $shortcode_class;
93
 
94
  /**
95
  * Filter the classes added to the div wrapper of the Top 10.
@@ -108,53 +110,13 @@ function tptn_pop_posts( $args ) {
108
 
109
  $output .= tptn_before_list( $args );
110
 
111
- // We need this for WPML support.
112
- $processed_results = array();
113
-
114
  foreach ( $results as $result ) {
115
 
116
- /* Support WPML */
117
- $resultid = tptn_object_id_cur_lang( $result->ID );
118
-
119
- // If this is NULL or already processed ID or matches current post then skip processing this loop.
120
- if ( ! $resultid || in_array( $resultid, $processed_results ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
121
- continue;
122
- }
123
-
124
- // Push the current ID into the array to ensure we're not repeating it.
125
- array_push( $processed_results, $resultid );
126
-
127
  // Store the count. We'll need this later.
128
  $count = $args['daily'] ? 'daily' : 'total';
129
- $visits = empty( $result->visits ) ? get_tptn_post_count_only( $resultid, $count ) : $result->visits;
130
 
131
- /**
132
- * Filter the post ID for each result. Allows a custom function to hook in and change the ID if needed.
133
- *
134
- * @since 1.9.8.5
135
- *
136
- * @param int $resultid ID of the post
137
- */
138
- $resultid = apply_filters( 'tptn_post_id', $resultid );
139
-
140
- $result = get_post( $resultid ); // Let's get the Post using the ID.
141
-
142
- // Process the category exclusion if passed in the shortcode.
143
- if ( isset( $exclude_categories ) ) {
144
-
145
- $categorys = get_the_category( $result->ID ); // Fetch categories of the plugin.
146
-
147
- $p_in_c = false; // Variable to check if post exists in a particular category.
148
- foreach ( $categorys as $cat ) { // Loop to check if post exists in excluded category.
149
- $p_in_c = ( in_array( $cat->cat_ID, $exclude_categories ) ) ? true : false; // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
150
- if ( $p_in_c ) {
151
- break; // Skip loop execution and go to the next step.
152
- }
153
- }
154
- if ( $p_in_c ) {
155
- continue; // Skip loop execution and go to the next step.
156
- }
157
- }
158
 
159
  $output .= tptn_before_list_item( $args, $result );
160
 
19
  * @return string HTML output of the popular posts.
20
  */
21
  function tptn_pop_posts( $args ) {
22
+ global $tptn_settings, $post;
 
 
 
 
 
 
23
 
24
  $defaults = array(
25
  'daily' => false,
44
  /**
45
  * Fires before the output processing begins.
46
  *
47
+ * @since 3.1.0
48
  *
49
+ * @param string $output Formatted list of top posts.
50
+ * @param array $args Array of arguments.
51
+ * @param WP_Post $post Current Post object.
52
  */
53
+ do_action( 'pre_tptn_pop_posts', $output, $args, $post );
54
+
55
+ // Check exclusions.
56
+ if ( tptn_exclude_on( $post, $args ) ) {
57
+ return '';
58
+ }
59
 
60
  // Check if the cache is enabled and if the output exists. If so, return the output.
61
  if ( $args['cache'] ) {
78
  }
79
 
80
  // Get thumbnail size.
81
+ list( $args['thumb_width'], $args['thumb_height'] ) = tptn_get_thumb_size( $args['thumb_size'] );
82
 
83
  // Retrieve the popular posts.
84
  $results = get_tptn_posts( $args );
85
 
86
  $counter = 0;
87
 
88
+ $tptn_style = tptn_get_style();
89
  $daily_class = $args['daily'] ? 'tptn_posts_daily ' : 'tptn_posts ';
90
+ $style_class = ( ! empty( $tptn_style['name'] ) ) ? ' tptn-' . $tptn_style['name'] : '';
91
  $widget_class = $args['is_widget'] ? ' tptn_posts_widget tptn_posts_widget' . $args['instance_id'] : '';
92
  $shortcode_class = $args['is_shortcode'] ? ' tptn_posts_shortcode' : '';
93
 
94
+ $post_classes = $daily_class . $style_class . $widget_class . $shortcode_class;
95
 
96
  /**
97
  * Filter the classes added to the div wrapper of the Top 10.
110
 
111
  $output .= tptn_before_list( $args );
112
 
 
 
 
113
  foreach ( $results as $result ) {
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  // Store the count. We'll need this later.
116
  $count = $args['daily'] ? 'daily' : 'total';
117
+ $visits = empty( $result->visits ) ? get_tptn_post_count_only( $result->ID, $count ) : $result->visits;
118
 
119
+ $result = get_post( $result );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  $output .= tptn_before_list_item( $args, $result );
122
 
includes/public/media.php CHANGED
@@ -33,57 +33,55 @@ add_action( 'init', 'tptn_add_image_sizes' );
33
  * Function to get the post thumbnail.
34
  *
35
  * @since 1.8
36
- * @param array $args Query string of options related to thumbnails.
37
- * @return string Image tag
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  */
39
  function tptn_get_the_post_thumbnail( $args = array() ) {
40
 
41
  $defaults = array(
42
- 'postid' => '',
43
- 'thumb_height' => '150', // Max height of thumbnails.
44
- 'thumb_width' => '150', // Max width of thumbnails.
45
- 'thumb_meta' => 'post-image', // Meta field that is used to store the location of default thumbnail image.
46
- 'thumb_html' => 'html', // HTML / CSS for width and height attributes.
47
- 'thumb_default' => '', // Default thumbnail image.
48
- 'thumb_default_show' => true, // Show default thumb if none found (if false, don't show thumb at all).
49
- 'scan_images' => false, // Scan post for images.
50
- 'class' => 'tptn_thumb', // Class of the thumbnail.
51
  );
52
 
53
  // Parse incomming $args into an array and merge it with $defaults.
54
  $args = wp_parse_args( $args, $defaults );
55
 
56
- // Issue notice for deprecated arguments.
57
- if ( isset( $args['thumb_timthumb'] ) ) {
58
- _deprecated_argument( __FUNCTION__, '2.1', esc_html__( 'thumb_timthumb argument has been deprecated', 'top-10' ) );
59
- }
60
-
61
- if ( isset( $args['thumb_timthumb_q'] ) ) {
62
- _deprecated_argument( __FUNCTION__, '2.1', esc_html__( 'thumb_timthumb_q argument has been deprecated', 'top-10' ) );
63
- }
64
 
65
- if ( isset( $args['filter'] ) ) {
66
- _deprecated_argument( __FUNCTION__, '2.1', esc_html__( 'filter argument has been deprecated', 'top-10' ) );
67
  }
68
 
69
- if ( is_int( $args['postid'] ) ) {
70
- $result = get_post( $args['postid'] );
71
  } else {
72
- $result = $args['postid'];
 
73
  }
74
 
75
  $post_title = esc_attr( $result->post_title );
76
 
77
- /**
78
- * Filters the title and alt message for thumbnails.
79
- *
80
- * @since 2.3.0
81
- *
82
- * @param string $post_title Post tile used as thumbnail alt and title
83
- * @param object $result Post Object
84
- */
85
- $post_title = apply_filters( 'tptn_thumb_title', $post_title, $result );
86
-
87
  $output = '';
88
  $postimage = '';
89
  $pick = '';
@@ -93,42 +91,57 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
93
  $postimage = get_post_meta( $result->ID, $args['thumb_meta'], true );
94
  $pick = 'meta';
95
  if ( $postimage ) {
96
- $postimage_id = tptn_get_attachment_id_from_url( $postimage );
97
 
98
- if ( false != wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
99
- $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
100
- $postimage = $postthumb[0];
 
101
  }
102
- $pick .= 'correct';
103
  }
104
  }
105
 
106
  // If there is no thumbnail found, check the post thumbnail.
107
  if ( ! $postimage ) {
108
- if ( false != get_post_thumbnail_id( $result->ID ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
109
- $postthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $result->ID ), array( $args['thumb_width'], $args['thumb_height'] ) );
110
 
 
111
  if ( false !== $postthumb ) {
112
- $postimage = $postthumb[0];
113
- $pick = 'featured';
114
  }
115
  }
 
116
  }
117
 
118
  // If there is no thumbnail found, fetch the first image in the post, if enabled.
119
  if ( ! $postimage && $args['scan_images'] ) {
120
- preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $result->post_content, $matches );
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  if ( isset( $matches[1][0] ) && $matches[1][0] ) { // any image there?
122
  $postimage = $matches[1][0]; // we need the first one only!
123
  }
124
  $pick = 'first';
125
  if ( $postimage ) {
126
- $postimage_id = tptn_get_attachment_id_from_url( $postimage );
127
 
128
- if ( false != wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
129
- $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
130
- $postimage = $postthumb[0];
131
- $pick .= 'correct';
132
  }
133
  }
134
  }
@@ -151,6 +164,17 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
151
  $pick = 'default_thumb';
152
  }
153
 
 
 
 
 
 
 
 
 
 
 
 
154
  // Hopefully, we've found a thumbnail by now. If so, run it through the custom filter, check for SSL and create the image tag.
155
  if ( $postimage ) {
156
 
@@ -160,39 +184,20 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
160
  * Use this filter to modify the thumbnail URL that is automatically created
161
  * Before v2.1 this was used for cropping the post image using timthumb
162
  *
163
- * @since 2.1.0
 
164
  *
165
- * @param string $postimage URL of the thumbnail image
166
- * @param int $thumb_width Thumbnail width
167
- * @param int $thumb_height Thumbnail height
168
- * @param object $result Post Object
169
  */
170
- $postimage = apply_filters( 'tptn_thumb_url', $postimage, $args['thumb_width'], $args['thumb_height'], $result );
171
-
172
- /* Backward compatibility */
173
- $thumb_timthumb = false;
174
- $thumb_timthumb_q = 75;
175
-
176
- /**
177
- * Filters the thumbnail image URL.
178
- *
179
- * @since 1.8.10
180
- * @deprecated 2.1.0 Use tptn_thumb_url instead.
181
- *
182
- * @param string $postimage URL of the thumbnail image
183
- * @param int $thumb_width Thumbnail width
184
- * @param int $thumb_height Thumbnail height
185
- * @param boolean $thumb_timthumb Enable timthumb?
186
- * @param int $thumb_timthumb_q Quality of timthumb thumbnail.
187
- * @param object $result Post Object
188
- */
189
- $postimage = apply_filters( 'tptn_postimage', $postimage, $args['thumb_width'], $args['thumb_height'], $thumb_timthumb, $thumb_timthumb_q, $result );
190
 
191
  if ( is_ssl() ) {
192
  $postimage = preg_replace( '~http://~', 'https://', $postimage );
193
  }
194
 
195
- $class = $args['class'] . ' tptn_' . $pick;
196
 
197
  /**
198
  * Filters the thumbnail classes and allows a filter function to add any more classes if needed.
@@ -227,6 +232,19 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
227
 
228
  $output .= tptn_get_image_html( $postimage, $attr );
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
 
232
  /**
@@ -310,7 +328,16 @@ function tptn_get_image_html( $attachment_url, $attr = array() ) {
310
  }
311
  $html .= ' />';
312
 
313
- return apply_filters( 'tptn_get_image_html', $html );
 
 
 
 
 
 
 
 
 
314
  }
315
 
316
 
@@ -447,41 +474,41 @@ function tptn_get_attachment_id_from_url( $attachment_url = '' ) {
447
  * Function to get the correct height and width of the thumbnail.
448
  *
449
  * @since 2.2.0
 
450
  *
451
- * @param array $args Array of arguments.
452
- * @return array Width and height
453
  */
454
- function tptn_get_thumb_size( $args ) {
 
 
 
 
 
 
455
 
456
  // Get thumbnail size.
457
- $tptn_thumb_size = tptn_get_all_image_sizes( $args['thumb_size'] );
458
 
459
  if ( isset( $tptn_thumb_size['width'] ) ) {
460
  $thumb_width = $tptn_thumb_size['width'];
461
  $thumb_height = $tptn_thumb_size['height'];
462
  }
463
 
464
- if ( empty( $thumb_width ) || ( $args['is_widget'] && $thumb_width != $args['thumb_width'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
465
- $thumb_width = $args['thumb_width'];
466
- $args['thumb_html'] = 'css';
467
- }
468
-
469
- if ( empty( $thumb_height ) || ( $args['is_widget'] && $thumb_height != $args['thumb_height'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
470
- $thumb_height = $args['thumb_height'];
471
- $args['thumb_html'] = 'css';
472
  }
473
 
474
- $thumb_size = array( $thumb_width, $thumb_height );
475
-
476
  /**
477
  * Filter array of thumbnail size.
478
  *
479
  * @since 2.2.0
480
  *
481
  * @param array $thumb_size Array with width and height of thumbnail
482
- * @param array $args Array of arguments
483
  */
484
- return apply_filters( 'tptn_get_thumb_size', $thumb_size, $args );
485
 
486
  }
487
 
@@ -490,36 +517,15 @@ function tptn_get_thumb_size( $args ) {
490
  * Get all image sizes.
491
  *
492
  * @since 2.0.0
493
- * @param string $size Get specific image size.
494
- * @return array Image size names along with width, height and crop setting
 
 
 
495
  */
496
  function tptn_get_all_image_sizes( $size = '' ) {
497
- global $_wp_additional_image_sizes;
498
-
499
- /* Get the intermediate image sizes and add the full size to the array. */
500
- $intermediate_image_sizes = get_intermediate_image_sizes();
501
 
502
- foreach ( $intermediate_image_sizes as $_size ) {
503
- if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
504
-
505
- $sizes[ $_size ]['name'] = $_size;
506
- $sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
507
- $sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
508
- $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
509
-
510
- if ( ( 0 == $sizes[ $_size ]['width'] ) && ( 0 == $sizes[ $_size ]['height'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
511
- unset( $sizes[ $_size ] );
512
- }
513
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
514
-
515
- $sizes[ $_size ] = array(
516
- 'name' => $_size,
517
- 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
518
- 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
519
- 'crop' => (bool) $_wp_additional_image_sizes[ $_size ]['crop'],
520
- );
521
- }
522
- }
523
 
524
  /* Get only 1 size if found */
525
  if ( $size ) {
@@ -533,11 +539,9 @@ function tptn_get_all_image_sizes( $size = '' ) {
533
  /**
534
  * Filters array of image sizes.
535
  *
536
- * @since 2.0.0
537
  *
538
- * @param array $sizes Image sizes
539
  */
540
  return apply_filters( 'tptn_get_all_image_sizes', $sizes );
541
  }
542
-
543
-
33
  * Function to get the post thumbnail.
34
  *
35
  * @since 1.8
36
+ * @since 3.1.0 `postid` argument renamed to `post`.
37
+ * New `size` attribute added which can be a registered image size name or array of width and height.
38
+ * `thumb_width` and `thumb_height` attributes removed. These are extracted based on size.
39
+ *
40
+ * @param string|array $args {
41
+ * Optional. Array or string of Query parameters.
42
+ *
43
+ * @type int|WP_Post $post Post ID or WP_Post object.
44
+ * @type string $size Thumbnail size. Should be a pre-defined image size.
45
+ * @type string $thumb_meta Meta field that is used to store the location of default thumbnail image.
46
+ * @type string $thumb_html Accepted arguments are `html` or `css`.
47
+ * @type string $thumb_default Default thumbnail image.
48
+ * @type bool $thumb_default_show Show default thumb if none found.
49
+ * @type int $scan_images Get related posts for a specific post ID.
50
+ * @type string $class Class of the thumbnail.
51
+ * }
52
+ * @return string Image tag
53
  */
54
  function tptn_get_the_post_thumbnail( $args = array() ) {
55
 
56
  $defaults = array(
57
+ 'post' => '',
58
+ 'size' => 'thumbnail',
59
+ 'thumb_meta' => 'post-image',
60
+ 'thumb_html' => 'html',
61
+ 'thumb_default' => '',
62
+ 'thumb_default_show' => true,
63
+ 'scan_images' => false,
64
+ 'class' => 'tptn_thumb',
 
65
  );
66
 
67
  // Parse incomming $args into an array and merge it with $defaults.
68
  $args = wp_parse_args( $args, $defaults );
69
 
70
+ $result = get_post( $args['post'] );
 
 
 
 
 
 
 
71
 
72
+ if ( empty( $result ) ) {
73
+ return '';
74
  }
75
 
76
+ if ( is_string( $args['size'] ) ) {
77
+ list( $args['thumb_width'], $args['thumb_height'] ) = tptn_get_thumb_size( $args['size'] );
78
  } else {
79
+ $args['thumb_width'] = $args['size'][0];
80
+ $args['thumb_height'] = $args['size'][1];
81
  }
82
 
83
  $post_title = esc_attr( $result->post_title );
84
 
 
 
 
 
 
 
 
 
 
 
85
  $output = '';
86
  $postimage = '';
87
  $pick = '';
91
  $postimage = get_post_meta( $result->ID, $args['thumb_meta'], true );
92
  $pick = 'meta';
93
  if ( $postimage ) {
94
+ $attachment_id = tptn_get_attachment_id_from_url( $postimage );
95
 
96
+ $postthumb = wp_get_attachment_image_src( $attachment_id, $args['size'] );
97
+ if ( false !== $postthumb ) {
98
+ list( $postimage, $args['thumb_width'], $args['thumb_height'] ) = $postthumb;
99
+ $pick .= 'correct';
100
  }
 
101
  }
102
  }
103
 
104
  // If there is no thumbnail found, check the post thumbnail.
105
  if ( ! $postimage ) {
106
+ if ( false !== get_post_thumbnail_id( $result->ID ) ) {
107
+ $attachment_id = ( 'attachment' === $result->post_type ) ? $result->ID : get_post_thumbnail_id( $result->ID );
108
 
109
+ $postthumb = wp_get_attachment_image_src( $attachment_id, $args['size'] );
110
  if ( false !== $postthumb ) {
111
+ list( $postimage, $args['thumb_width'], $args['thumb_height'] ) = $postthumb;
112
+ $pick = 'featured';
113
  }
114
  }
115
+ $pick = 'featured';
116
  }
117
 
118
  // If there is no thumbnail found, fetch the first image in the post, if enabled.
119
  if ( ! $postimage && $args['scan_images'] ) {
120
+
121
+ /**
122
+ * Filters the post content that is used to scan for images.
123
+ *
124
+ * A filter function can be tapped into this to execute shortcodes, modify content, etc.
125
+ *
126
+ * @since 3.1.0
127
+ *
128
+ * @param string $post_content Post content
129
+ * @param WP_Post $result Post Object
130
+ */
131
+ $post_content = apply_filters( 'tptn_thumb_post_content', $result->post_content, $result );
132
+
133
+ preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post_content, $matches );
134
  if ( isset( $matches[1][0] ) && $matches[1][0] ) { // any image there?
135
  $postimage = $matches[1][0]; // we need the first one only!
136
  }
137
  $pick = 'first';
138
  if ( $postimage ) {
139
+ $attachment_id = tptn_get_attachment_id_from_url( $postimage );
140
 
141
+ $postthumb = wp_get_attachment_image_src( $attachment_id, $args['size'] );
142
+ if ( false !== $postthumb ) {
143
+ list( $postimage, $args['thumb_width'], $args['thumb_height'] ) = $postthumb;
144
+ $pick .= 'correct';
145
  }
146
  }
147
  }
164
  $pick = 'default_thumb';
165
  }
166
 
167
+ // If no thumb found, use site icon.
168
+ if ( ! $postimage ) {
169
+ $postimage = get_site_icon_url( max( $args['thumb_width'], $args['thumb_height'] ) );
170
+ $pick = 'site_icon_max';
171
+ }
172
+
173
+ if ( ! $postimage ) {
174
+ $postimage = get_site_icon_url( min( $args['thumb_width'], $args['thumb_height'] ) );
175
+ $pick = 'site_icon_min';
176
+ }
177
+
178
  // Hopefully, we've found a thumbnail by now. If so, run it through the custom filter, check for SSL and create the image tag.
179
  if ( $postimage ) {
180
 
184
  * Use this filter to modify the thumbnail URL that is automatically created
185
  * Before v2.1 this was used for cropping the post image using timthumb
186
  *
187
+ * @since 2.1.0
188
+ * @since 3.1.0 Second argument changed to $args array and third argument changed to Post object.
189
  *
190
+ * @param string $postimage URL of the thumbnail image
191
+ * @param array $args Arguments array.
192
+ * @param WP_Post $result Post Object
 
193
  */
194
+ $postimage = apply_filters( 'tptn_thumb_url', $postimage, $args, $result );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
 
196
  if ( is_ssl() ) {
197
  $postimage = preg_replace( '~http://~', 'https://', $postimage );
198
  }
199
 
200
+ $class = "{$args['class']} tptn_{$pick} {$args['size']}";
201
 
202
  /**
203
  * Filters the thumbnail classes and allows a filter function to add any more classes if needed.
232
 
233
  $output .= tptn_get_image_html( $postimage, $attr );
234
 
235
+ if ( function_exists( 'wp_img_tag_add_srcset_and_sizes_attr' ) ) {
236
+ if ( empty( $attachment_id ) ) {
237
+ $attachment_id = tptn_get_attachment_id_from_url( $postimage );
238
+ }
239
+
240
+ if ( ! empty( $attachment_id ) ) {
241
+ $output = wp_img_tag_add_srcset_and_sizes_attr( $output, 'tptn_thumbnail', $attachment_id );
242
+ }
243
+ }
244
+
245
+ if ( function_exists( 'wp_img_tag_add_loading_attr' ) ) {
246
+ $output = wp_img_tag_add_loading_attr( $output, 'tptn_thumbnail' );
247
+ }
248
  }
249
 
250
  /**
328
  }
329
  $html .= ' />';
330
 
331
+ /**
332
+ * Filters the img tag.
333
+ *
334
+ * @since 2.6.0
335
+ *
336
+ * @param string $html HTML img element or empty string on failure.
337
+ * @param string $attachment_url Image URL.
338
+ * @param array $attr Attributes for the image markup.
339
+ */
340
+ return apply_filters( 'tptn_get_image_html', $html, $attachment_url, $attr );
341
  }
342
 
343
 
474
  * Function to get the correct height and width of the thumbnail.
475
  *
476
  * @since 2.2.0
477
+ * @since 3.1.0 First argument is a string.
478
  *
479
+ * @param string $size Image size.
480
+ * @return array Width and height. If no width and height is found, then 150 is returned for each.
481
  */
482
+ function tptn_get_thumb_size( $size = 'thumbnail' ) {
483
+
484
+ if ( is_string( $size ) ) {
485
+ $thumb_size = $size;
486
+ } elseif ( isset( $size['thumb_size'] ) ) {
487
+ $thumb_size = $size['thumb_size'];
488
+ }
489
 
490
  // Get thumbnail size.
491
+ $tptn_thumb_size = tptn_get_all_image_sizes( $thumb_size );
492
 
493
  if ( isset( $tptn_thumb_size['width'] ) ) {
494
  $thumb_width = $tptn_thumb_size['width'];
495
  $thumb_height = $tptn_thumb_size['height'];
496
  }
497
 
498
+ if ( isset( $thumb_width ) && isset( $thumb_height ) ) {
499
+ $thumb_size = array( $thumb_width, $thumb_height );
500
+ } else {
501
+ $thumb_size = array( 150, 150 );
 
 
 
 
502
  }
503
 
 
 
504
  /**
505
  * Filter array of thumbnail size.
506
  *
507
  * @since 2.2.0
508
  *
509
  * @param array $thumb_size Array with width and height of thumbnail
 
510
  */
511
+ return apply_filters( 'tptn_get_thumb_size', $thumb_size );
512
 
513
  }
514
 
517
  * Get all image sizes.
518
  *
519
  * @since 2.0.0
520
+ *
521
+ * @param string $size Image size.
522
+ * @return array|bool If a single size is specified, then the array with width, height and crop status
523
+ * or false if size is not found;
524
+ * If no size is specified then an Associative array of the registered image sub-sizes.
525
  */
526
  function tptn_get_all_image_sizes( $size = '' ) {
 
 
 
 
527
 
528
+ $sizes = wp_get_registered_image_subsizes();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
 
530
  /* Get only 1 size if found */
531
  if ( $size ) {
539
  /**
540
  * Filters array of image sizes.
541
  *
542
+ * @since 2.0.0
543
  *
544
+ * @param array $sizes Image sizes
545
  */
546
  return apply_filters( 'tptn_get_all_image_sizes', $sizes );
547
  }
 
 
includes/public/output-generator.php CHANGED
@@ -237,7 +237,7 @@ function tptn_author( $args, $result ) {
237
  $author_name = apply_filters( 'tptn_author_name', $author_name, $author_info );
238
 
239
  if ( ! empty( $author_name ) ) {
240
- $tptn_author = '<span class="crp_author"> ' . __( ' by ', 'top-10' ) . '<a href="' . $author_link . '">' . $author_name . '</a></span> ';
241
  } else {
242
  $tptn_author = '';
243
  }
@@ -283,9 +283,8 @@ function tptn_list_link( $args, $result ) {
283
 
284
  $output .= tptn_get_the_post_thumbnail(
285
  array(
286
- 'postid' => $result,
287
- 'thumb_height' => $args['thumb_height'],
288
- 'thumb_width' => $args['thumb_width'],
289
  'thumb_meta' => $args['thumb_meta'],
290
  'thumb_html' => $args['thumb_html'],
291
  'thumb_default' => $args['thumb_default'],
@@ -374,5 +373,3 @@ function tptn_list_count( $args, $result, $visits ) {
374
  return apply_filters( 'tptn_list_count', $tptn_list_count, $visits, $result, $args, $visits );
375
 
376
  }
377
-
378
-
237
  $author_name = apply_filters( 'tptn_author_name', $author_name, $author_info );
238
 
239
  if ( ! empty( $author_name ) ) {
240
+ $tptn_author = '<span class="tptn_author"> ' . __( ' by ', 'top-10' ) . '<a href="' . $author_link . '">' . $author_name . '</a></span> ';
241
  } else {
242
  $tptn_author = '';
243
  }
283
 
284
  $output .= tptn_get_the_post_thumbnail(
285
  array(
286
+ 'post' => $result,
287
+ 'size' => $args['thumb_size'],
 
288
  'thumb_meta' => $args['thumb_meta'],
289
  'thumb_html' => $args['thumb_html'],
290
  'thumb_default' => $args['thumb_default'],
373
  return apply_filters( 'tptn_list_count', $tptn_list_count, $visits, $result, $args, $visits );
374
 
375
  }
 
 
includes/public/styles.php CHANGED
@@ -33,7 +33,12 @@ function tptn_heading_styles() {
33
  $style = $style_array['name'];
34
  $extra_css = $style_array['extra_css'];
35
 
36
- wp_register_style( "tptn-style-{$style}", plugins_url( "css/{$style}.min.css", TOP_TEN_PLUGIN_FILE ), array(), '1.0.1' );
 
 
 
 
 
37
  wp_enqueue_style( "tptn-style-{$style}" );
38
  wp_add_inline_style( "tptn-style-{$style}", $extra_css );
39
  }
@@ -60,16 +65,17 @@ function tptn_get_style() {
60
  case 'left_thumbs':
61
  $style['name'] = 'left-thumbs';
62
  $style['extra_css'] = "
63
- .tptn_related a {
64
  width: {$thumb_width}px;
65
  height: {$thumb_height}px;
66
  text-decoration: none;
67
  }
68
- .tptn_related img {
69
- max-width: {$thumb_width}px;
70
- margin: auto;
 
71
  }
72
- .tptn_related .tptn_title {
73
  width: 100%;
74
  }
75
  ";
33
  $style = $style_array['name'];
34
  $extra_css = $style_array['extra_css'];
35
 
36
+ wp_register_style(
37
+ "tptn-style-{$style}",
38
+ plugins_url( "css/{$style}.min.css", TOP_TEN_PLUGIN_FILE ),
39
+ array(),
40
+ TOP_TEN_VERSION
41
+ );
42
  wp_enqueue_style( "tptn-style-{$style}" );
43
  wp_add_inline_style( "tptn-style-{$style}", $extra_css );
44
  }
65
  case 'left_thumbs':
66
  $style['name'] = 'left-thumbs';
67
  $style['extra_css'] = "
68
+ .tptn-left-thumbs a {
69
  width: {$thumb_width}px;
70
  height: {$thumb_height}px;
71
  text-decoration: none;
72
  }
73
+ .tptn-left-thumbs img {
74
+ width: {$thumb_width}px;
75
+ max-height: {$thumb_height}px;
76
+ margin: auto;
77
  }
78
+ .tptn-left-thumbs .tptn_title {
79
  width: 100%;
80
  }
81
  ";
includes/tracker.php CHANGED
@@ -24,7 +24,7 @@ function tptn_enqueue_scripts() {
24
  if ( ( is_singular() || tptn_get_option( 'tracker_all_pages' ) ) && ( 'draft' !== $post->post_status ) && ! is_customize_preview() ) {
25
 
26
  $current_user = wp_get_current_user(); // Let's get the current user.
27
- $post_author = ( $current_user->ID === $post->post_author ) ? true : false; // Is the current user the post author?
28
  $current_user_admin = ( current_user_can( 'manage_options' ) ) ? true : false; // Is the current user an admin?
29
  $current_user_editor = ( ( current_user_can( 'edit_others_posts' ) ) && ( ! current_user_can( 'manage_options' ) ) ) ? true : false; // Is the current user an editor?
30
 
24
  if ( ( is_singular() || tptn_get_option( 'tracker_all_pages' ) ) && ( 'draft' !== $post->post_status ) && ! is_customize_preview() ) {
25
 
26
  $current_user = wp_get_current_user(); // Let's get the current user.
27
+ $post_author = ( (int) $current_user->ID === (int) $post->post_author ) ? true : false; // Is the current user the post author?
28
  $current_user_admin = ( current_user_can( 'manage_options' ) ) ? true : false; // Is the current user an admin?
29
  $current_user_editor = ( ( current_user_can( 'edit_others_posts' ) ) && ( ! current_user_can( 'manage_options' ) ) ) ? true : false; // Is the current user an editor?
30
 
languages/top-10-en_US.mo CHANGED
Binary file
languages/top-10-en_US.po CHANGED
@@ -2,16 +2,17 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2021-06-28 10:19+0100\n"
6
  "PO-Revision-Date: \n"
7
- "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
- "Language-Team: WebberZone <plugins@webberzone.com>\n"
9
  "Language: en_US\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
- "X-Poedit-KeywordsList: __;_e;_c;__ngettext;esc_html__;esc_attr__;esc_html_e;"
14
- "esc_attr_e\n"
 
15
  "X-Poedit-Basepath: ..\n"
16
  "X-Generator: Poedit 3.0\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -30,115 +31,115 @@ msgstr ""
30
  msgid "Views"
31
  msgstr ""
32
 
33
- #: includes/admin/admin-dashboard.php:62
34
  msgid "View all daily popular posts"
35
  msgstr ""
36
 
37
- #: includes/admin/admin-dashboard.php:64
38
  #: includes/admin/class-top-ten-dashboard.php:164
39
  msgid "View all popular posts"
40
  msgstr ""
41
 
42
- #: includes/admin/admin-dashboard.php:72
43
  #, php-format
44
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
45
  msgstr ""
46
 
47
- #: includes/admin/admin-dashboard.php:121 includes/admin/admin.php:40
48
  #: includes/admin/class-top-ten-network-statistics.php:114
49
  #: includes/admin/class-top-ten-statistics.php:124
50
  msgid "Popular Posts"
51
  msgstr ""
52
 
53
- #: includes/admin/admin-dashboard.php:126 includes/admin/admin.php:43
54
  msgid "Daily Popular Posts"
55
  msgstr ""
56
 
57
- #: includes/admin/admin-metabox.php:104
58
  msgid "Visit count:"
59
  msgstr ""
60
 
61
- #: includes/admin/admin-metabox.php:106
62
  msgid ""
63
  "Enter a number above to update the visit count. Leaving the above box blank "
64
  "will set the count to zero"
65
  msgstr ""
66
 
67
- #: includes/admin/admin-metabox.php:116
68
  msgid "Disable Popular Posts display:"
69
  msgstr ""
70
 
71
- #: includes/admin/admin-metabox.php:119
72
  msgid ""
73
  "If this is checked, then Top 10 will not display the popular posts widgets "
74
  "when viewing this post."
75
  msgstr ""
76
 
77
- #: includes/admin/admin-metabox.php:123
78
  msgid "Exclude this post from the popular posts list:"
79
  msgstr ""
80
 
81
- #: includes/admin/admin-metabox.php:126
82
  msgid ""
83
  "If this is checked, then this post will be excluded from the popular posts "
84
  "list."
85
  msgstr ""
86
 
87
- #: includes/admin/admin-metabox.php:130
88
  msgid "Location of thumbnail:"
89
  msgstr ""
90
 
91
- #: includes/admin/admin-metabox.php:132
92
  msgid ""
93
  "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
94
  "image will be used for the post. It will be resized to the thumbnail size "
95
  "set under Top 10 Settings &raquo; Thumbnail options."
96
  msgstr ""
97
 
98
- #: includes/admin/admin-metabox.php:133
99
  msgid "The URL above is saved in the meta field:"
100
  msgstr ""
101
 
102
- #: includes/admin/admin-metabox.php:141
103
  #, php-format
104
  msgid ""
105
  "You have %1$s installed. If you are trying to modify the thumbnail, then you "
106
  "will need to make the same change in the %1$s meta box on this page."
107
  msgstr ""
108
 
109
- #: includes/admin/admin.php:34 includes/admin/settings-page.php:32
110
  msgid "Top 10 Settings"
111
  msgstr ""
112
 
113
- #: includes/admin/admin.php:34 includes/admin/admin.php:157
114
  msgid "Settings"
115
  msgstr ""
116
 
117
- #: includes/admin/admin.php:40 includes/admin/class-top-ten-statistics.php:70
118
  msgid "Top 10 Popular Posts"
119
  msgstr ""
120
 
121
- #: includes/admin/admin.php:43
122
  msgid "Top 10 Daily Popular Posts"
123
  msgstr ""
124
 
125
- #: includes/admin/admin.php:47 includes/admin/tools.php:74
126
  msgid "Top 10 Tools"
127
  msgstr ""
128
 
129
- #: includes/admin/admin.php:47
130
  msgid "Tools"
131
  msgstr ""
132
 
133
- #: includes/admin/admin.php:50
134
  msgid "Top 10 Import Export Tables"
135
  msgstr ""
136
 
137
- #: includes/admin/admin.php:50
138
  msgid "Import/Export"
139
  msgstr ""
140
 
141
- #: includes/admin/admin.php:111
142
  #, php-format
143
  msgid ""
144
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
@@ -146,15 +147,15 @@ msgid ""
146
  "\"_blank\">WordPress.org</a>"
147
  msgstr ""
148
 
149
- #: includes/admin/admin.php:179 includes/admin/sidebar.php:55
150
  msgid "Support"
151
  msgstr ""
152
 
153
- #: includes/admin/admin.php:180
154
  msgid "Donate"
155
  msgstr ""
156
 
157
- #: includes/admin/admin.php:181
158
  msgid "Contribute"
159
  msgstr ""
160
 
@@ -162,10 +163,17 @@ msgstr ""
162
  msgid "Top 10 - Network Popular Posts"
163
  msgstr ""
164
 
165
- #: includes/admin/admin.php:199 includes/admin/class-top-ten-dashboard.php:199
166
  msgid "Top 10"
167
  msgstr ""
168
 
 
 
 
 
 
 
 
169
  #: includes/admin/class-top-ten-dashboard.php:83
170
  #: includes/admin/class-top-ten-dashboard.php:199
171
  #: includes/admin/class-top-ten-dashboard.php:201
@@ -189,7 +197,7 @@ msgid "Dashboard"
189
  msgstr ""
190
 
191
  #: includes/admin/class-top-ten-dashboard.php:242
192
- #: includes/admin/import-export.php:180
193
  msgid "Visits"
194
  msgstr ""
195
 
@@ -282,7 +290,7 @@ msgid "popular_posts"
282
  msgstr ""
283
 
284
  #: includes/admin/class-top-ten-network-statistics-table.php:183
285
- #: includes/admin/class-top-ten-statistics-table.php:213
286
  msgid "No popular posts available."
287
  msgstr ""
288
 
@@ -291,12 +299,12 @@ msgid "Invalid post ID. This post might have been deleted."
291
  msgstr ""
292
 
293
  #: includes/admin/class-top-ten-network-statistics-table.php:256
294
- #: includes/admin/class-top-ten-statistics-table.php:297
295
  msgid "Y/m/d"
296
  msgstr ""
297
 
298
  #: includes/admin/class-top-ten-network-statistics-table.php:294
299
- #: includes/admin/class-top-ten-statistics-table.php:351
300
  #: includes/modules/class-top-ten-count-widget.php:49
301
  #: includes/modules/class-top-ten-widget.php:79
302
  msgid "Title"
@@ -307,33 +315,33 @@ msgid "Blog"
307
  msgstr ""
308
 
309
  #: includes/admin/class-top-ten-network-statistics-table.php:296
310
- #: includes/admin/class-top-ten-statistics-table.php:356
311
- #: includes/admin/import-export.php:183
312
  msgid "Date"
313
  msgstr ""
314
 
315
  #: includes/admin/class-top-ten-network-statistics-table.php:297
316
- #: includes/admin/class-top-ten-statistics-table.php:352
317
  msgid "Total visits"
318
  msgstr ""
319
 
320
  #: includes/admin/class-top-ten-network-statistics-table.php:298
321
- #: includes/admin/class-top-ten-statistics-table.php:353
322
  msgid "Daily visits"
323
  msgstr ""
324
 
325
  #: includes/admin/class-top-ten-network-statistics-table.php:331
326
- #: includes/admin/class-top-ten-statistics-table.php:390
327
  msgid "Delete Count"
328
  msgstr ""
329
 
330
  #: includes/admin/class-top-ten-network-statistics-table.php:378
331
- #: includes/admin/class-top-ten-statistics-table.php:437
332
  msgid "Are you sure you want to do this"
333
  msgstr ""
334
 
335
  #: includes/admin/class-top-ten-network-statistics-table.php:420
336
- #: includes/admin/class-top-ten-statistics-table.php:504
337
  msgid "Filter"
338
  msgstr ""
339
 
@@ -345,28 +353,28 @@ msgstr ""
345
  msgid "All post types"
346
  msgstr ""
347
 
348
- #: includes/admin/class-top-ten-statistics-table.php:263
349
  msgid "View"
350
  msgstr ""
351
 
352
- #: includes/admin/class-top-ten-statistics-table.php:264
353
  msgid "Edit"
354
  msgstr ""
355
 
356
- #: includes/admin/class-top-ten-statistics-table.php:265
357
  msgid "Delete"
358
  msgstr ""
359
 
360
- #: includes/admin/class-top-ten-statistics-table.php:295
361
  #, php-format
362
  msgid "%s ago"
363
  msgstr ""
364
 
365
- #: includes/admin/class-top-ten-statistics-table.php:354
366
  msgid "Post type"
367
  msgstr ""
368
 
369
- #: includes/admin/class-top-ten-statistics-table.php:355
370
  msgid "Author"
371
  msgstr ""
372
 
@@ -379,12 +387,12 @@ msgid "Enable trackers"
379
  msgstr ""
380
 
381
  #: includes/admin/default-settings.php:72
382
- #: includes/modules/class-top-ten-widget.php:94
383
  msgid "Overall"
384
  msgstr ""
385
 
386
  #: includes/admin/default-settings.php:73
387
- #: includes/admin/default-settings.php:729
388
  msgid "Daily"
389
  msgstr ""
390
 
@@ -660,7 +668,7 @@ msgid ""
660
  msgstr ""
661
 
662
  #: includes/admin/default-settings.php:320
663
- #: includes/admin/default-settings.php:778
664
  msgid "Number of posts to display"
665
  msgstr ""
666
 
@@ -683,6 +691,7 @@ msgid ""
683
  msgstr ""
684
 
685
  #: includes/admin/default-settings.php:335
 
686
  msgid "Post types to include"
687
  msgstr ""
688
 
@@ -706,31 +715,42 @@ msgid ""
706
  msgstr ""
707
 
708
  #: includes/admin/default-settings.php:349
709
- msgid "Post/page IDs to exclude"
710
  msgstr ""
711
 
712
  #: includes/admin/default-settings.php:350
713
  msgid ""
 
 
 
 
 
 
 
 
 
 
714
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
715
  "188,320,500"
716
  msgstr ""
717
 
718
- #: includes/admin/default-settings.php:356
719
  msgid "Exclude Categories"
720
  msgstr ""
721
 
722
- #: includes/admin/default-settings.php:357
 
723
  msgid ""
724
  "Comma separated list of category slugs. The field above has an autocomplete "
725
  "so simply start typing in the starting letters and it will prompt you with "
726
  "options. Does not support custom taxonomies."
727
  msgstr ""
728
 
729
- #: includes/admin/default-settings.php:368
730
  msgid "Exclude category IDs"
731
  msgstr ""
732
 
733
- #: includes/admin/default-settings.php:369
734
  msgid ""
735
  "This is a readonly field that is automatically populated based on the above "
736
  "input when the settings are saved. These might differ from the IDs visible "
@@ -738,138 +758,143 @@ msgid ""
738
  "term_taxonomy_id which is unique to this taxonomy."
739
  msgstr ""
740
 
741
- #: includes/admin/default-settings.php:376
 
 
 
 
742
  msgid "Customize the output"
743
  msgstr ""
744
 
745
- #: includes/admin/default-settings.php:382
746
  msgid "Heading of posts"
747
  msgstr ""
748
 
749
- #: includes/admin/default-settings.php:383
750
- #: includes/admin/default-settings.php:391
751
  msgid "Displayed before the list of the posts as a the master heading"
752
  msgstr ""
753
 
754
- #: includes/admin/default-settings.php:385
755
  msgid "Popular posts:"
756
  msgstr ""
757
 
758
- #: includes/admin/default-settings.php:390
759
  msgid "Heading of posts for daily/custom period lists"
760
  msgstr ""
761
 
762
- #: includes/admin/default-settings.php:393
763
  msgid "Currently trending:"
764
  msgstr ""
765
 
766
- #: includes/admin/default-settings.php:398
767
  msgid "Show when no posts are found"
768
  msgstr ""
769
 
770
- #: includes/admin/default-settings.php:404
771
  msgid "Blank output"
772
  msgstr ""
773
 
774
- #: includes/admin/default-settings.php:405
775
  msgid "Display custom text"
776
  msgstr ""
777
 
778
- #: includes/admin/default-settings.php:410
779
  msgid "Custom text"
780
  msgstr ""
781
 
782
- #: includes/admin/default-settings.php:411
783
  msgid ""
784
  "Enter the custom text that will be displayed if the second option is "
785
  "selected above"
786
  msgstr ""
787
 
788
- #: includes/admin/default-settings.php:413 includes/deprecated.php:180
789
  msgid "No top posts yet"
790
  msgstr ""
791
 
792
- #: includes/admin/default-settings.php:417
793
  msgid "Show post excerpt"
794
  msgstr ""
795
 
796
- #: includes/admin/default-settings.php:424
797
  msgid "Length of excerpt (in words)"
798
  msgstr ""
799
 
800
- #: includes/admin/default-settings.php:432
801
- #: includes/blocks/popular-posts/index.js:207
802
- #: includes/blocks/popular-posts/index.min.js:1
803
  msgid "Show date"
804
  msgstr ""
805
 
806
- #: includes/admin/default-settings.php:439
807
- #: includes/blocks/popular-posts/index.js:202
808
- #: includes/blocks/popular-posts/index.min.js:1
809
  msgid "Show author"
810
  msgstr ""
811
 
812
- #: includes/admin/default-settings.php:446
813
  msgid "Show number of views"
814
  msgstr ""
815
 
816
- #: includes/admin/default-settings.php:453
817
  msgid "Limit post title length (in characters)"
818
  msgstr ""
819
 
820
- #: includes/admin/default-settings.php:461
821
  msgid "Open links in new window"
822
  msgstr ""
823
 
824
- #: includes/admin/default-settings.php:468
825
  msgid "Add nofollow to links"
826
  msgstr ""
827
 
828
- #: includes/admin/default-settings.php:475
829
  msgid "HTML to display"
830
  msgstr ""
831
 
832
- #: includes/admin/default-settings.php:481
833
  msgid "Before the list of posts"
834
  msgstr ""
835
 
836
- #: includes/admin/default-settings.php:488
837
  msgid "After the list of posts"
838
  msgstr ""
839
 
840
- #: includes/admin/default-settings.php:495
841
  msgid "Before each list item"
842
  msgstr ""
843
 
844
- #: includes/admin/default-settings.php:502
845
  msgid "After each list item"
846
  msgstr ""
847
 
848
- #: includes/admin/default-settings.php:532
 
849
  msgid "Location of the post thumbnail"
850
  msgstr ""
851
 
852
- #: includes/admin/default-settings.php:537
853
  msgid "Display thumbnails inline with posts, before title"
854
  msgstr ""
855
 
856
- #: includes/admin/default-settings.php:538
857
  msgid "Display thumbnails inline with posts, after title"
858
  msgstr ""
859
 
860
- #: includes/admin/default-settings.php:539
861
  msgid "Display only thumbnails, no text"
862
  msgstr ""
863
 
864
- #: includes/admin/default-settings.php:540
865
  msgid "Do not display thumbnails, only text"
866
  msgstr ""
867
 
868
- #: includes/admin/default-settings.php:545
869
  msgid "Thumbnail size"
870
  msgstr ""
871
 
872
- #: includes/admin/default-settings.php:547
873
  msgid ""
874
  "You can choose from existing image sizes above or create a custom size. If "
875
  "you have chosen Custom size above, then enter the width, height and crop "
@@ -877,123 +902,123 @@ msgid ""
877
  "width and/or height below, existing images will not be automatically resized."
878
  msgstr ""
879
 
880
- #: includes/admin/default-settings.php:547
881
  #, php-format
882
- msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
883
  msgstr ""
884
 
885
- #: includes/admin/default-settings.php:554
886
- #: includes/modules/class-top-ten-widget.php:144
887
  msgid "Thumbnail width"
888
  msgstr ""
889
 
890
- #: includes/admin/default-settings.php:562
891
- #: includes/modules/class-top-ten-widget.php:138
892
  msgid "Thumbnail height"
893
  msgstr ""
894
 
895
- #: includes/admin/default-settings.php:570
896
  msgid "Hard crop thumbnails"
897
  msgstr ""
898
 
899
- #: includes/admin/default-settings.php:571
900
  msgid ""
901
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
902
  "above vs. maintaining proportions."
903
  msgstr ""
904
 
905
- #: includes/admin/default-settings.php:577
906
  msgid "Generate thumbnail sizes"
907
  msgstr ""
908
 
909
- #: includes/admin/default-settings.php:578
910
  msgid ""
911
  "If you select this option and Custom size is selected above, the plugin will "
912
  "register the image size with WordPress to create new thumbnails. Does not "
913
  "update old images as explained above."
914
  msgstr ""
915
 
916
- #: includes/admin/default-settings.php:584
917
  msgid "Thumbnail size attributes"
918
  msgstr ""
919
 
920
- #: includes/admin/default-settings.php:590
921
  #, php-format
922
  msgid "Use CSS to set the width and height: e.g. %s"
923
  msgstr ""
924
 
925
- #: includes/admin/default-settings.php:592
926
  #, php-format
927
  msgid "Use HTML attributes to set the width and height: e.g. %s"
928
  msgstr ""
929
 
930
- #: includes/admin/default-settings.php:593
931
  msgid ""
932
  "No width or height set. You will need to use external styles to force any "
933
  "width or height of your choice."
934
  msgstr ""
935
 
936
- #: includes/admin/default-settings.php:598
937
  msgid "Thumbnail meta field name"
938
  msgstr ""
939
 
940
- #: includes/admin/default-settings.php:599
941
  msgid ""
942
  "The value of this field should contain the URL of the image and can be set "
943
  "in the metabox in the Edit Post screen"
944
  msgstr ""
945
 
946
- #: includes/admin/default-settings.php:605
947
  msgid "Get first image"
948
  msgstr ""
949
 
950
- #: includes/admin/default-settings.php:606
951
  msgid ""
952
  "The plugin will fetch the first image in the post content if this is "
953
  "enabled. This can slow down the loading of your page if the first image in "
954
  "the followed posts is large in file-size."
955
  msgstr ""
956
 
957
- #: includes/admin/default-settings.php:612
958
  msgid "Use default thumbnail?"
959
  msgstr ""
960
 
961
- #: includes/admin/default-settings.php:613
962
  msgid ""
963
  "If checked, when no thumbnail is found, show a default one from the URL "
964
  "below. If not checked and no thumbnail is found, no image will be shown."
965
  msgstr ""
966
 
967
- #: includes/admin/default-settings.php:619 includes/admin/settings-page.php:743
968
  msgid "Default thumbnail"
969
  msgstr ""
970
 
971
- #: includes/admin/default-settings.php:620
972
  msgid ""
973
  "Enter the full URL of the image that you wish to display if no thumbnail is "
974
  "found. This image will be displayed below."
975
  msgstr ""
976
 
977
- #: includes/admin/default-settings.php:650
978
  msgid "Popular posts style"
979
  msgstr ""
980
 
981
- #: includes/admin/default-settings.php:658
982
  msgid "Custom CSS"
983
  msgstr ""
984
 
985
- #: includes/admin/default-settings.php:660
986
  #, php-format
987
  msgid ""
988
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
989
  "CSS classes to style."
990
  msgstr ""
991
 
992
- #: includes/admin/default-settings.php:690
993
  msgid "Enable scheduled maintenance"
994
  msgstr ""
995
 
996
- #: includes/admin/default-settings.php:692
997
  #, php-format
998
  msgid ""
999
  "Cleaning the database at regular intervals could improve performance, "
@@ -1001,43 +1026,43 @@ msgid ""
1001
  "delete entries older than %d days in the daily tables."
1002
  msgstr ""
1003
 
1004
- #: includes/admin/default-settings.php:698
1005
  msgid "Time to run maintenance"
1006
  msgstr ""
1007
 
1008
- #: includes/admin/default-settings.php:699
1009
  msgid "The next two options allow you to set the time to run the cron."
1010
  msgstr ""
1011
 
1012
- #: includes/admin/default-settings.php:704
1013
  msgid "Hour"
1014
  msgstr ""
1015
 
1016
- #: includes/admin/default-settings.php:714
1017
  msgid "Minute"
1018
  msgstr ""
1019
 
1020
- #: includes/admin/default-settings.php:724
1021
  msgid "Run maintenance"
1022
  msgstr ""
1023
 
1024
- #: includes/admin/default-settings.php:730
1025
  msgid "Weekly"
1026
  msgstr ""
1027
 
1028
- #: includes/admin/default-settings.php:731
1029
  msgid "Fortnightly"
1030
  msgstr ""
1031
 
1032
- #: includes/admin/default-settings.php:732
1033
  msgid "Monthly"
1034
  msgstr ""
1035
 
1036
- #: includes/admin/default-settings.php:760
1037
  msgid "Permalink - Overall"
1038
  msgstr ""
1039
 
1040
- #: includes/admin/default-settings.php:762
1041
  #, php-format
1042
  msgid ""
1043
  "This will set the path of the custom feed generated by the plugin for "
@@ -1045,11 +1070,11 @@ msgid ""
1045
  "when changing this option."
1046
  msgstr ""
1047
 
1048
- #: includes/admin/default-settings.php:769
1049
  msgid "Permalink - Daily"
1050
  msgstr ""
1051
 
1052
- #: includes/admin/default-settings.php:771
1053
  #, php-format
1054
  msgid ""
1055
  "This will set the path of the custom feed generated by the plugin for daily/"
@@ -1057,37 +1082,37 @@ msgid ""
1057
  "%2$s when changing this option."
1058
  msgstr ""
1059
 
1060
- #: includes/admin/default-settings.php:779
1061
  msgid "Maximum number of posts that will be displayed in the custom feed."
1062
  msgstr ""
1063
 
1064
- #: includes/admin/default-settings.php:786
1065
  msgid "Custom period in day(s)"
1066
  msgstr ""
1067
 
1068
- #: includes/admin/default-settings.php:888
1069
  msgid "No styles"
1070
  msgstr ""
1071
 
1072
- #: includes/admin/default-settings.php:889
1073
  msgid "Select this option if you plan to add your own styles"
1074
  msgstr ""
1075
 
1076
- #: includes/admin/default-settings.php:893
1077
  msgid "Text only"
1078
  msgstr ""
1079
 
1080
- #: includes/admin/default-settings.php:894
1081
  msgid ""
1082
  "Disable thumbnails and no longer include the default style sheet included in "
1083
  "the plugin"
1084
  msgstr ""
1085
 
1086
- #: includes/admin/default-settings.php:898
1087
  msgid "Left thumbnails"
1088
  msgstr ""
1089
 
1090
- #: includes/admin/default-settings.php:899
1091
  msgid ""
1092
  "Enabling this option will set the post thumbnail to be before text. "
1093
  "Disabling this option will not revert any settings."
@@ -1222,118 +1247,130 @@ msgstr ""
1222
  msgid "Refer to the knowledge base to learn how to use this in detail."
1223
  msgstr ""
1224
 
1225
- #: includes/admin/import-export.php:29
1226
  msgid "Data has been imported into the table"
1227
  msgstr ""
1228
 
1229
- #: includes/admin/import-export.php:34
 
 
 
 
 
 
1230
  msgid "Settings have been imported successfully"
1231
  msgstr ""
1232
 
1233
- #: includes/admin/import-export.php:40
1234
  msgid "Top 10 - Import/Export tables"
1235
  msgstr ""
1236
 
1237
- #: includes/admin/import-export.php:50
1238
  msgid "Export/Import settings"
1239
  msgstr ""
1240
 
1241
- #: includes/admin/import-export.php:52
1242
  msgid ""
1243
  "Export the plugin settings for this site as a .json file. This allows you to "
1244
  "easily import the configuration into another site."
1245
  msgstr ""
1246
 
1247
- #: includes/admin/import-export.php:56
1248
  msgid "Export Settings"
1249
  msgstr ""
1250
 
1251
- #: includes/admin/import-export.php:65
1252
  msgid ""
1253
  "Import the plugin settings from a .json file. This file can be obtained by "
1254
- "exporting the settings on another site using the form above."
1255
  msgstr ""
1256
 
1257
- #: includes/admin/import-export.php:71
1258
  msgid "Import Settings"
1259
  msgstr ""
1260
 
1261
- #: includes/admin/import-export.php:80
1262
  msgid "Export tables"
1263
  msgstr ""
1264
 
1265
- #: includes/admin/import-export.php:82
1266
  msgid ""
1267
  "Click the buttons below to export the overall and the daily tables. The file "
1268
  "is downloaded as an CSV file which you should be able to edit in Excel or "
1269
  "any other compatible software."
1270
  msgstr ""
1271
 
1272
- #: includes/admin/import-export.php:83
1273
  msgid ""
1274
  "If you are using WordPress Multisite then this will include the counts "
1275
  "across all sites as the plugin uses a single table to store counts."
1276
  msgstr ""
1277
 
1278
- #: includes/admin/import-export.php:87
1279
  msgid "Export overall tables"
1280
  msgstr ""
1281
 
1282
- #: includes/admin/import-export.php:88
1283
  msgid "Export daily tables"
1284
  msgstr ""
1285
 
1286
- #: includes/admin/import-export.php:96
1287
  msgid "Import tables"
1288
  msgstr ""
1289
 
1290
- #: includes/admin/import-export.php:98
1291
  msgid ""
1292
- "This action will replace the data in your tables, so I suggest that you "
1293
- "export the existing data using the buttons above, amend it and then import "
1294
- "it. It is important to maintain the export format of the data to avoid "
1295
- "corruption."
1296
  msgstr ""
1297
 
1298
- #: includes/admin/import-export.php:101
 
 
 
 
 
 
1299
  msgid ""
1300
  "Backup your database before proceeding so you will be able to restore it in "
1301
  "case anything goes wrong."
1302
  msgstr ""
1303
 
1304
- #: includes/admin/import-export.php:103
1305
  msgid "Import Overall Table"
1306
  msgstr ""
1307
 
1308
- #: includes/admin/import-export.php:108
1309
  msgid "Import Overall CSV"
1310
  msgstr ""
1311
 
1312
- #: includes/admin/import-export.php:111
1313
  msgid "Import Daily Table"
1314
  msgstr ""
1315
 
1316
- #: includes/admin/import-export.php:116
1317
  msgid "Import Daily CSV"
1318
  msgstr ""
1319
 
1320
- #: includes/admin/import-export.php:179
1321
  msgid "Post ID"
1322
  msgstr ""
1323
 
1324
- #: includes/admin/import-export.php:185
1325
  msgid "Blog ID"
1326
  msgstr ""
1327
 
1328
- #: includes/admin/import-export.php:264
1329
  msgid "Please upload a valid .csv file"
1330
  msgstr ""
1331
 
1332
- #: includes/admin/import-export.php:270 includes/admin/import-export.php:373
1333
  msgid "Please upload a file to import"
1334
  msgstr ""
1335
 
1336
- #: includes/admin/import-export.php:367
1337
  msgid "Please upload a valid .json file"
1338
  msgstr ""
1339
 
@@ -1369,6 +1406,11 @@ msgstr ""
1369
  msgid "Modified from default setting"
1370
  msgstr ""
1371
 
 
 
 
 
 
1372
  #: includes/admin/sidebar.php:15
1373
  msgid "Support the development"
1374
  msgstr ""
@@ -1557,107 +1599,135 @@ msgstr ""
1557
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1558
  msgstr ""
1559
 
1560
- #: includes/blocks/popular-posts/index.js:22
1561
- #: includes/blocks/popular-posts/index.min.js:1
1562
- #: includes/modules/class-top-ten-widget.php:26
1563
- msgid "Popular Posts [Top 10]"
1564
  msgstr ""
1565
 
1566
- #: includes/blocks/popular-posts/index.js:23
1567
- #: includes/blocks/popular-posts/index.min.js:1
1568
- msgid "Display popular posts by Top 10"
1569
  msgstr ""
1570
 
1571
- #: includes/blocks/popular-posts/index.js:26
1572
- #: includes/blocks/popular-posts/index.min.js:1
1573
- msgid "popular posts"
1574
  msgstr ""
1575
 
1576
- #: includes/blocks/popular-posts/index.js:26
1577
- #: includes/blocks/popular-posts/index.min.js:1
1578
- msgid "popular"
1579
  msgstr ""
1580
 
1581
- #: includes/blocks/popular-posts/index.js:26
1582
- #: includes/blocks/popular-posts/index.min.js:1
1583
- msgid "posts"
1584
  msgstr ""
1585
 
1586
- #: includes/blocks/popular-posts/index.js:145
1587
- #: includes/blocks/popular-posts/index.min.js:1
1588
- msgid "Show heading"
1589
  msgstr ""
1590
 
1591
- #: includes/blocks/popular-posts/index.js:150
1592
- #: includes/blocks/popular-posts/index.min.js:1
1593
- msgid "Custom period? Set range below"
1594
  msgstr ""
1595
 
1596
- #: includes/blocks/popular-posts/index.js:155
1597
- #: includes/blocks/popular-posts/index.min.js:1
1598
  msgid "Daily range"
1599
  msgstr ""
1600
 
1601
- #: includes/blocks/popular-posts/index.js:165
1602
- #: includes/blocks/popular-posts/index.min.js:1
1603
- msgid "Hourly range"
1604
  msgstr ""
1605
 
1606
- #: includes/blocks/popular-posts/index.js:175
1607
- #: includes/blocks/popular-posts/index.min.js:1
1608
- #: includes/modules/class-top-ten-widget.php:84
1609
- msgid "No. of posts"
 
 
 
 
 
 
 
 
 
 
 
1610
  msgstr ""
1611
 
1612
- #: includes/blocks/popular-posts/index.js:186
1613
- #: includes/blocks/popular-posts/index.min.js:1
1614
- #: includes/modules/class-top-ten-widget.php:89
1615
  msgid "Offset"
1616
  msgstr ""
1617
 
1618
- #: includes/blocks/popular-posts/index.js:197
1619
- #: includes/blocks/popular-posts/index.min.js:1
 
 
 
 
1620
  msgid "Show excerpt"
1621
  msgstr ""
1622
 
1623
- #: includes/blocks/popular-posts/index.js:212
1624
- #: includes/blocks/popular-posts/index.min.js:1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1625
  msgid "Show count"
1626
  msgstr ""
1627
 
1628
- #: includes/blocks/popular-posts/index.js:218
1629
- #: includes/blocks/popular-posts/index.min.js:1
1630
- #: includes/modules/class-top-ten-widget.php:128
1631
- msgid "Thumbnail options"
 
 
 
 
 
 
1632
  msgstr ""
1633
 
1634
- #: includes/blocks/popular-posts/index.js:221
1635
- #: includes/blocks/popular-posts/index.min.js:1
1636
  msgid "Before title"
1637
  msgstr ""
1638
 
1639
- #: includes/blocks/popular-posts/index.js:222
1640
- #: includes/blocks/popular-posts/index.min.js:1
1641
  msgid "After title"
1642
  msgstr ""
1643
 
1644
- #: includes/blocks/popular-posts/index.js:223
1645
- #: includes/blocks/popular-posts/index.min.js:1
1646
  msgid "Only thumbnail"
1647
  msgstr ""
1648
 
1649
- #: includes/blocks/popular-posts/index.js:224
1650
- #: includes/blocks/popular-posts/index.min.js:1
1651
  msgid "Only text"
1652
  msgstr ""
1653
 
1654
- #: includes/blocks/popular-posts/index.js:228
1655
- #: includes/blocks/popular-posts/index.min.js:1
1656
  msgid "Other attributes"
1657
  msgstr ""
1658
 
1659
- #: includes/blocks/popular-posts/index.js:229
1660
- #: includes/blocks/popular-posts/index.min.js:1
1661
  msgid ""
1662
  "Enter other attributes in a URL-style string-query. e.g. post_types=post,"
1663
  "page&link_nofollow=1&exclude_post_ids=5,6"
@@ -1707,10 +1777,6 @@ msgstr ""
1707
  msgid "Invalid post ID."
1708
  msgstr ""
1709
 
1710
- #: includes/modules/class-top-ten-rest-api.php:212
1711
- msgid "Number of posts"
1712
- msgstr ""
1713
-
1714
  #: includes/modules/class-top-ten-rest-api.php:217
1715
  msgid "Post types"
1716
  msgstr ""
@@ -1731,88 +1797,73 @@ msgstr ""
1731
  msgid "Debug flag."
1732
  msgstr ""
1733
 
1734
- #: includes/modules/class-top-ten-widget.php:28
1735
- msgid "Display popular posts"
1736
  msgstr ""
1737
 
1738
- #: includes/modules/class-top-ten-widget.php:95
1739
- msgid "Custom time period (Enter below)"
1740
  msgstr ""
1741
 
1742
- #: includes/modules/class-top-ten-widget.php:99
1743
- msgid "In days and hours (applies only to custom option above)"
1744
  msgstr ""
1745
 
1746
- #: includes/modules/class-top-ten-widget.php:101
1747
- msgid "days"
1748
  msgstr ""
1749
 
1750
- #: includes/modules/class-top-ten-widget.php:104
1751
- msgid "hours"
1752
  msgstr ""
1753
 
1754
- #: includes/modules/class-top-ten-widget.php:109
1755
- msgid "Show count?"
1756
  msgstr ""
1757
 
1758
- #: includes/modules/class-top-ten-widget.php:114
1759
- msgid "Show excerpt?"
1760
  msgstr ""
1761
 
1762
- #: includes/modules/class-top-ten-widget.php:119
1763
- msgid "Show author?"
1764
  msgstr ""
1765
 
1766
  #: includes/modules/class-top-ten-widget.php:124
1767
- msgid "Show date?"
1768
- msgstr ""
1769
-
1770
- #: includes/modules/class-top-ten-widget.php:130
1771
  msgid "Thumbnails inline, before title"
1772
  msgstr ""
1773
 
1774
- #: includes/modules/class-top-ten-widget.php:131
1775
  msgid "Thumbnails inline, after title"
1776
  msgstr ""
1777
 
1778
- #: includes/modules/class-top-ten-widget.php:132
1779
  msgid "Only thumbnails, no text"
1780
  msgstr ""
1781
 
1782
- #: includes/modules/class-top-ten-widget.php:133
1783
  msgid "No thumbnails, only text."
1784
  msgstr ""
1785
 
1786
- #: includes/modules/class-top-ten-widget.php:150
1787
  msgid "Only from categories"
1788
  msgstr ""
1789
 
1790
- #: includes/modules/class-top-ten-widget.php:157
1791
- msgid "Include IDs"
 
1792
  msgstr ""
1793
 
1794
- #: includes/modules/class-top-ten-widget.php:161
1795
- msgid "Post types to include:"
1796
  msgstr ""
1797
 
1798
- #: includes/public/display-posts.php:211
1799
  #, php-format
1800
  msgid ""
1801
  "Popular posts by <a href=\"%1$s\" rel=\"nofollow\" %2$s>Top 10 plugin</a>"
1802
  msgstr ""
1803
 
1804
- #: includes/public/media.php:58
1805
- msgid "thumb_timthumb argument has been deprecated"
1806
- msgstr ""
1807
-
1808
- #: includes/public/media.php:62
1809
- msgid "thumb_timthumb_q argument has been deprecated"
1810
- msgstr ""
1811
-
1812
- #: includes/public/media.php:66
1813
- msgid "filter argument has been deprecated"
1814
- msgstr ""
1815
-
1816
  #: includes/public/output-generator.php:240
1817
  msgid " by "
1818
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2022-04-07 15:58+0100\n"
6
  "PO-Revision-Date: \n"
7
+ "Last-Translator: Ajay D'Souza\n"
8
+ "Language-Team: Ajay D'Souza\n"
9
  "Language: en_US\n"
10
  "MIME-Version: 1.0\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
14
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
15
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
16
  "X-Poedit-Basepath: ..\n"
17
  "X-Generator: Poedit 3.0\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
31
  msgid "Views"
32
  msgstr ""
33
 
34
+ #: includes/admin/admin-dashboard.php:65
35
  msgid "View all daily popular posts"
36
  msgstr ""
37
 
38
+ #: includes/admin/admin-dashboard.php:67
39
  #: includes/admin/class-top-ten-dashboard.php:164
40
  msgid "View all popular posts"
41
  msgstr ""
42
 
43
+ #: includes/admin/admin-dashboard.php:75
44
  #, php-format
45
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
46
  msgstr ""
47
 
48
+ #: includes/admin/admin-dashboard.php:124 includes/admin/admin.php:39
49
  #: includes/admin/class-top-ten-network-statistics.php:114
50
  #: includes/admin/class-top-ten-statistics.php:124
51
  msgid "Popular Posts"
52
  msgstr ""
53
 
54
+ #: includes/admin/admin-dashboard.php:129 includes/admin/admin.php:42
55
  msgid "Daily Popular Posts"
56
  msgstr ""
57
 
58
+ #: includes/admin/admin-metabox.php:117
59
  msgid "Visit count:"
60
  msgstr ""
61
 
62
+ #: includes/admin/admin-metabox.php:119
63
  msgid ""
64
  "Enter a number above to update the visit count. Leaving the above box blank "
65
  "will set the count to zero"
66
  msgstr ""
67
 
68
+ #: includes/admin/admin-metabox.php:129
69
  msgid "Disable Popular Posts display:"
70
  msgstr ""
71
 
72
+ #: includes/admin/admin-metabox.php:132
73
  msgid ""
74
  "If this is checked, then Top 10 will not display the popular posts widgets "
75
  "when viewing this post."
76
  msgstr ""
77
 
78
+ #: includes/admin/admin-metabox.php:136
79
  msgid "Exclude this post from the popular posts list:"
80
  msgstr ""
81
 
82
+ #: includes/admin/admin-metabox.php:139
83
  msgid ""
84
  "If this is checked, then this post will be excluded from the popular posts "
85
  "list."
86
  msgstr ""
87
 
88
+ #: includes/admin/admin-metabox.php:143
89
  msgid "Location of thumbnail:"
90
  msgstr ""
91
 
92
+ #: includes/admin/admin-metabox.php:145
93
  msgid ""
94
  "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
95
  "image will be used for the post. It will be resized to the thumbnail size "
96
  "set under Top 10 Settings &raquo; Thumbnail options."
97
  msgstr ""
98
 
99
+ #: includes/admin/admin-metabox.php:146
100
  msgid "The URL above is saved in the meta field:"
101
  msgstr ""
102
 
103
+ #: includes/admin/admin-metabox.php:154
104
  #, php-format
105
  msgid ""
106
  "You have %1$s installed. If you are trying to modify the thumbnail, then you "
107
  "will need to make the same change in the %1$s meta box on this page."
108
  msgstr ""
109
 
110
+ #: includes/admin/admin.php:33 includes/admin/settings-page.php:32
111
  msgid "Top 10 Settings"
112
  msgstr ""
113
 
114
+ #: includes/admin/admin.php:33 includes/admin/admin.php:156
115
  msgid "Settings"
116
  msgstr ""
117
 
118
+ #: includes/admin/admin.php:39 includes/admin/class-top-ten-statistics.php:70
119
  msgid "Top 10 Popular Posts"
120
  msgstr ""
121
 
122
+ #: includes/admin/admin.php:42
123
  msgid "Top 10 Daily Popular Posts"
124
  msgstr ""
125
 
126
+ #: includes/admin/admin.php:46 includes/admin/tools.php:74
127
  msgid "Top 10 Tools"
128
  msgstr ""
129
 
130
+ #: includes/admin/admin.php:46
131
  msgid "Tools"
132
  msgstr ""
133
 
134
+ #: includes/admin/admin.php:49
135
  msgid "Top 10 Import Export Tables"
136
  msgstr ""
137
 
138
+ #: includes/admin/admin.php:49
139
  msgid "Import/Export"
140
  msgstr ""
141
 
142
+ #: includes/admin/admin.php:110
143
  #, php-format
144
  msgid ""
145
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
147
  "\"_blank\">WordPress.org</a>"
148
  msgstr ""
149
 
150
+ #: includes/admin/admin.php:178 includes/admin/sidebar.php:55
151
  msgid "Support"
152
  msgstr ""
153
 
154
+ #: includes/admin/admin.php:179
155
  msgid "Donate"
156
  msgstr ""
157
 
158
+ #: includes/admin/admin.php:180
159
  msgid "Contribute"
160
  msgstr ""
161
 
163
  msgid "Top 10 - Network Popular Posts"
164
  msgstr ""
165
 
166
+ #: includes/admin/admin.php:200 includes/admin/class-top-ten-dashboard.php:199
167
  msgid "Top 10"
168
  msgstr ""
169
 
170
+ #: includes/admin/cache.php:22
171
+ #, php-format
172
+ msgid "%s entry cleared"
173
+ msgid_plural "%s entries cleared"
174
+ msgstr[0] ""
175
+ msgstr[1] ""
176
+
177
  #: includes/admin/class-top-ten-dashboard.php:83
178
  #: includes/admin/class-top-ten-dashboard.php:199
179
  #: includes/admin/class-top-ten-dashboard.php:201
197
  msgstr ""
198
 
199
  #: includes/admin/class-top-ten-dashboard.php:242
200
+ #: includes/admin/import-export.php:186
201
  msgid "Visits"
202
  msgstr ""
203
 
290
  msgstr ""
291
 
292
  #: includes/admin/class-top-ten-network-statistics-table.php:183
293
+ #: includes/admin/class-top-ten-statistics-table.php:221
294
  msgid "No popular posts available."
295
  msgstr ""
296
 
299
  msgstr ""
300
 
301
  #: includes/admin/class-top-ten-network-statistics-table.php:256
302
+ #: includes/admin/class-top-ten-statistics-table.php:305
303
  msgid "Y/m/d"
304
  msgstr ""
305
 
306
  #: includes/admin/class-top-ten-network-statistics-table.php:294
307
+ #: includes/admin/class-top-ten-statistics-table.php:359
308
  #: includes/modules/class-top-ten-count-widget.php:49
309
  #: includes/modules/class-top-ten-widget.php:79
310
  msgid "Title"
315
  msgstr ""
316
 
317
  #: includes/admin/class-top-ten-network-statistics-table.php:296
318
+ #: includes/admin/class-top-ten-statistics-table.php:364
319
+ #: includes/admin/import-export.php:189
320
  msgid "Date"
321
  msgstr ""
322
 
323
  #: includes/admin/class-top-ten-network-statistics-table.php:297
324
+ #: includes/admin/class-top-ten-statistics-table.php:360
325
  msgid "Total visits"
326
  msgstr ""
327
 
328
  #: includes/admin/class-top-ten-network-statistics-table.php:298
329
+ #: includes/admin/class-top-ten-statistics-table.php:361
330
  msgid "Daily visits"
331
  msgstr ""
332
 
333
  #: includes/admin/class-top-ten-network-statistics-table.php:331
334
+ #: includes/admin/class-top-ten-statistics-table.php:398
335
  msgid "Delete Count"
336
  msgstr ""
337
 
338
  #: includes/admin/class-top-ten-network-statistics-table.php:378
339
+ #: includes/admin/class-top-ten-statistics-table.php:445
340
  msgid "Are you sure you want to do this"
341
  msgstr ""
342
 
343
  #: includes/admin/class-top-ten-network-statistics-table.php:420
344
+ #: includes/admin/class-top-ten-statistics-table.php:512
345
  msgid "Filter"
346
  msgstr ""
347
 
353
  msgid "All post types"
354
  msgstr ""
355
 
356
+ #: includes/admin/class-top-ten-statistics-table.php:271
357
  msgid "View"
358
  msgstr ""
359
 
360
+ #: includes/admin/class-top-ten-statistics-table.php:272
361
  msgid "Edit"
362
  msgstr ""
363
 
364
+ #: includes/admin/class-top-ten-statistics-table.php:273
365
  msgid "Delete"
366
  msgstr ""
367
 
368
+ #: includes/admin/class-top-ten-statistics-table.php:303
369
  #, php-format
370
  msgid "%s ago"
371
  msgstr ""
372
 
373
+ #: includes/admin/class-top-ten-statistics-table.php:362
374
  msgid "Post type"
375
  msgstr ""
376
 
377
+ #: includes/admin/class-top-ten-statistics-table.php:363
378
  msgid "Author"
379
  msgstr ""
380
 
387
  msgstr ""
388
 
389
  #: includes/admin/default-settings.php:72
390
+ #: includes/modules/class-top-ten-widget.php:93
391
  msgid "Overall"
392
  msgstr ""
393
 
394
  #: includes/admin/default-settings.php:73
395
+ #: includes/admin/default-settings.php:751
396
  msgid "Daily"
397
  msgstr ""
398
 
668
  msgstr ""
669
 
670
  #: includes/admin/default-settings.php:320
671
+ #: includes/admin/default-settings.php:800
672
  msgid "Number of posts to display"
673
  msgstr ""
674
 
691
  msgstr ""
692
 
693
  #: includes/admin/default-settings.php:335
694
+ #: includes/modules/class-top-ten-widget.php:148
695
  msgid "Post types to include"
696
  msgstr ""
697
 
715
  msgstr ""
716
 
717
  #: includes/admin/default-settings.php:349
718
+ msgid "Exclude current post"
719
  msgstr ""
720
 
721
  #: includes/admin/default-settings.php:350
722
  msgid ""
723
+ "Enabling this will exclude the current post being browsed from being "
724
+ "displayed in the popular posts list."
725
+ msgstr ""
726
+
727
+ #: includes/admin/default-settings.php:356
728
+ msgid "Post/page IDs to exclude"
729
+ msgstr ""
730
+
731
+ #: includes/admin/default-settings.php:357
732
+ msgid ""
733
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
734
  "188,320,500"
735
  msgstr ""
736
 
737
+ #: includes/admin/default-settings.php:363
738
  msgid "Exclude Categories"
739
  msgstr ""
740
 
741
+ #: includes/admin/default-settings.php:364
742
+ #: includes/admin/default-settings.php:384
743
  msgid ""
744
  "Comma separated list of category slugs. The field above has an autocomplete "
745
  "so simply start typing in the starting letters and it will prompt you with "
746
  "options. Does not support custom taxonomies."
747
  msgstr ""
748
 
749
+ #: includes/admin/default-settings.php:375
750
  msgid "Exclude category IDs"
751
  msgstr ""
752
 
753
+ #: includes/admin/default-settings.php:376
754
  msgid ""
755
  "This is a readonly field that is automatically populated based on the above "
756
  "input when the settings are saved. These might differ from the IDs visible "
758
  "term_taxonomy_id which is unique to this taxonomy."
759
  msgstr ""
760
 
761
+ #: includes/admin/default-settings.php:383
762
+ msgid "Exclude on Categories"
763
+ msgstr ""
764
+
765
+ #: includes/admin/default-settings.php:395
766
  msgid "Customize the output"
767
  msgstr ""
768
 
769
+ #: includes/admin/default-settings.php:401
770
  msgid "Heading of posts"
771
  msgstr ""
772
 
773
+ #: includes/admin/default-settings.php:402
774
+ #: includes/admin/default-settings.php:410
775
  msgid "Displayed before the list of the posts as a the master heading"
776
  msgstr ""
777
 
778
+ #: includes/admin/default-settings.php:404
779
  msgid "Popular posts:"
780
  msgstr ""
781
 
782
+ #: includes/admin/default-settings.php:409
783
  msgid "Heading of posts for daily/custom period lists"
784
  msgstr ""
785
 
786
+ #: includes/admin/default-settings.php:412
787
  msgid "Currently trending:"
788
  msgstr ""
789
 
790
+ #: includes/admin/default-settings.php:417
791
  msgid "Show when no posts are found"
792
  msgstr ""
793
 
794
+ #: includes/admin/default-settings.php:423
795
  msgid "Blank output"
796
  msgstr ""
797
 
798
+ #: includes/admin/default-settings.php:424
799
  msgid "Display custom text"
800
  msgstr ""
801
 
802
+ #: includes/admin/default-settings.php:429
803
  msgid "Custom text"
804
  msgstr ""
805
 
806
+ #: includes/admin/default-settings.php:430
807
  msgid ""
808
  "Enter the custom text that will be displayed if the second option is "
809
  "selected above"
810
  msgstr ""
811
 
812
+ #: includes/admin/default-settings.php:432 includes/deprecated.php:180
813
  msgid "No top posts yet"
814
  msgstr ""
815
 
816
+ #: includes/admin/default-settings.php:436
817
  msgid "Show post excerpt"
818
  msgstr ""
819
 
820
+ #: includes/admin/default-settings.php:443
821
  msgid "Length of excerpt (in words)"
822
  msgstr ""
823
 
824
+ #: includes/admin/default-settings.php:451
825
+ #: includes/blocks/popular-posts/src/edit.js:214
826
+ #: includes/modules/class-top-ten-widget.php:118
827
  msgid "Show date"
828
  msgstr ""
829
 
830
+ #: includes/admin/default-settings.php:458
831
+ #: includes/blocks/popular-posts/src/edit.js:200
832
+ #: includes/modules/class-top-ten-widget.php:114
833
  msgid "Show author"
834
  msgstr ""
835
 
836
+ #: includes/admin/default-settings.php:465
837
  msgid "Show number of views"
838
  msgstr ""
839
 
840
+ #: includes/admin/default-settings.php:472
841
  msgid "Limit post title length (in characters)"
842
  msgstr ""
843
 
844
+ #: includes/admin/default-settings.php:480
845
  msgid "Open links in new window"
846
  msgstr ""
847
 
848
+ #: includes/admin/default-settings.php:487
849
  msgid "Add nofollow to links"
850
  msgstr ""
851
 
852
+ #: includes/admin/default-settings.php:494
853
  msgid "HTML to display"
854
  msgstr ""
855
 
856
+ #: includes/admin/default-settings.php:500
857
  msgid "Before the list of posts"
858
  msgstr ""
859
 
860
+ #: includes/admin/default-settings.php:507
861
  msgid "After the list of posts"
862
  msgstr ""
863
 
864
+ #: includes/admin/default-settings.php:514
865
  msgid "Before each list item"
866
  msgstr ""
867
 
868
+ #: includes/admin/default-settings.php:521
869
  msgid "After each list item"
870
  msgstr ""
871
 
872
+ #: includes/admin/default-settings.php:551
873
+ #: includes/blocks/popular-posts/src/edit.js:245
874
  msgid "Location of the post thumbnail"
875
  msgstr ""
876
 
877
+ #: includes/admin/default-settings.php:556
878
  msgid "Display thumbnails inline with posts, before title"
879
  msgstr ""
880
 
881
+ #: includes/admin/default-settings.php:557
882
  msgid "Display thumbnails inline with posts, after title"
883
  msgstr ""
884
 
885
+ #: includes/admin/default-settings.php:558
886
  msgid "Display only thumbnails, no text"
887
  msgstr ""
888
 
889
+ #: includes/admin/default-settings.php:559
890
  msgid "Do not display thumbnails, only text"
891
  msgstr ""
892
 
893
+ #: includes/admin/default-settings.php:564
894
  msgid "Thumbnail size"
895
  msgstr ""
896
 
897
+ #: includes/admin/default-settings.php:565
898
  msgid ""
899
  "You can choose from existing image sizes above or create a custom size. If "
900
  "you have chosen Custom size above, then enter the width, height and crop "
902
  "width and/or height below, existing images will not be automatically resized."
903
  msgstr ""
904
 
905
+ #: includes/admin/default-settings.php:567
906
  #, php-format
907
+ msgid "I recommend using %1$s to regenerate all image sizes."
908
  msgstr ""
909
 
910
+ #: includes/admin/default-settings.php:576
911
+ #: includes/modules/class-top-ten-widget.php:135
912
  msgid "Thumbnail width"
913
  msgstr ""
914
 
915
+ #: includes/admin/default-settings.php:584
916
+ #: includes/modules/class-top-ten-widget.php:131
917
  msgid "Thumbnail height"
918
  msgstr ""
919
 
920
+ #: includes/admin/default-settings.php:592
921
  msgid "Hard crop thumbnails"
922
  msgstr ""
923
 
924
+ #: includes/admin/default-settings.php:593
925
  msgid ""
926
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
927
  "above vs. maintaining proportions."
928
  msgstr ""
929
 
930
+ #: includes/admin/default-settings.php:599
931
  msgid "Generate thumbnail sizes"
932
  msgstr ""
933
 
934
+ #: includes/admin/default-settings.php:600
935
  msgid ""
936
  "If you select this option and Custom size is selected above, the plugin will "
937
  "register the image size with WordPress to create new thumbnails. Does not "
938
  "update old images as explained above."
939
  msgstr ""
940
 
941
+ #: includes/admin/default-settings.php:606
942
  msgid "Thumbnail size attributes"
943
  msgstr ""
944
 
945
+ #: includes/admin/default-settings.php:612
946
  #, php-format
947
  msgid "Use CSS to set the width and height: e.g. %s"
948
  msgstr ""
949
 
950
+ #: includes/admin/default-settings.php:614
951
  #, php-format
952
  msgid "Use HTML attributes to set the width and height: e.g. %s"
953
  msgstr ""
954
 
955
+ #: includes/admin/default-settings.php:615
956
  msgid ""
957
  "No width or height set. You will need to use external styles to force any "
958
  "width or height of your choice."
959
  msgstr ""
960
 
961
+ #: includes/admin/default-settings.php:620
962
  msgid "Thumbnail meta field name"
963
  msgstr ""
964
 
965
+ #: includes/admin/default-settings.php:621
966
  msgid ""
967
  "The value of this field should contain the URL of the image and can be set "
968
  "in the metabox in the Edit Post screen"
969
  msgstr ""
970
 
971
+ #: includes/admin/default-settings.php:627
972
  msgid "Get first image"
973
  msgstr ""
974
 
975
+ #: includes/admin/default-settings.php:628
976
  msgid ""
977
  "The plugin will fetch the first image in the post content if this is "
978
  "enabled. This can slow down the loading of your page if the first image in "
979
  "the followed posts is large in file-size."
980
  msgstr ""
981
 
982
+ #: includes/admin/default-settings.php:634
983
  msgid "Use default thumbnail?"
984
  msgstr ""
985
 
986
+ #: includes/admin/default-settings.php:635
987
  msgid ""
988
  "If checked, when no thumbnail is found, show a default one from the URL "
989
  "below. If not checked and no thumbnail is found, no image will be shown."
990
  msgstr ""
991
 
992
+ #: includes/admin/default-settings.php:641 includes/admin/settings-page.php:753
993
  msgid "Default thumbnail"
994
  msgstr ""
995
 
996
+ #: includes/admin/default-settings.php:642
997
  msgid ""
998
  "Enter the full URL of the image that you wish to display if no thumbnail is "
999
  "found. This image will be displayed below."
1000
  msgstr ""
1001
 
1002
+ #: includes/admin/default-settings.php:672
1003
  msgid "Popular posts style"
1004
  msgstr ""
1005
 
1006
+ #: includes/admin/default-settings.php:680
1007
  msgid "Custom CSS"
1008
  msgstr ""
1009
 
1010
+ #: includes/admin/default-settings.php:682
1011
  #, php-format
1012
  msgid ""
1013
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
1014
  "CSS classes to style."
1015
  msgstr ""
1016
 
1017
+ #: includes/admin/default-settings.php:712
1018
  msgid "Enable scheduled maintenance"
1019
  msgstr ""
1020
 
1021
+ #: includes/admin/default-settings.php:714
1022
  #, php-format
1023
  msgid ""
1024
  "Cleaning the database at regular intervals could improve performance, "
1026
  "delete entries older than %d days in the daily tables."
1027
  msgstr ""
1028
 
1029
+ #: includes/admin/default-settings.php:720
1030
  msgid "Time to run maintenance"
1031
  msgstr ""
1032
 
1033
+ #: includes/admin/default-settings.php:721
1034
  msgid "The next two options allow you to set the time to run the cron."
1035
  msgstr ""
1036
 
1037
+ #: includes/admin/default-settings.php:726
1038
  msgid "Hour"
1039
  msgstr ""
1040
 
1041
+ #: includes/admin/default-settings.php:736
1042
  msgid "Minute"
1043
  msgstr ""
1044
 
1045
+ #: includes/admin/default-settings.php:746
1046
  msgid "Run maintenance"
1047
  msgstr ""
1048
 
1049
+ #: includes/admin/default-settings.php:752
1050
  msgid "Weekly"
1051
  msgstr ""
1052
 
1053
+ #: includes/admin/default-settings.php:753
1054
  msgid "Fortnightly"
1055
  msgstr ""
1056
 
1057
+ #: includes/admin/default-settings.php:754
1058
  msgid "Monthly"
1059
  msgstr ""
1060
 
1061
+ #: includes/admin/default-settings.php:782
1062
  msgid "Permalink - Overall"
1063
  msgstr ""
1064
 
1065
+ #: includes/admin/default-settings.php:784
1066
  #, php-format
1067
  msgid ""
1068
  "This will set the path of the custom feed generated by the plugin for "
1070
  "when changing this option."
1071
  msgstr ""
1072
 
1073
+ #: includes/admin/default-settings.php:791
1074
  msgid "Permalink - Daily"
1075
  msgstr ""
1076
 
1077
+ #: includes/admin/default-settings.php:793
1078
  #, php-format
1079
  msgid ""
1080
  "This will set the path of the custom feed generated by the plugin for daily/"
1082
  "%2$s when changing this option."
1083
  msgstr ""
1084
 
1085
+ #: includes/admin/default-settings.php:801
1086
  msgid "Maximum number of posts that will be displayed in the custom feed."
1087
  msgstr ""
1088
 
1089
+ #: includes/admin/default-settings.php:808
1090
  msgid "Custom period in day(s)"
1091
  msgstr ""
1092
 
1093
+ #: includes/admin/default-settings.php:910
1094
  msgid "No styles"
1095
  msgstr ""
1096
 
1097
+ #: includes/admin/default-settings.php:911
1098
  msgid "Select this option if you plan to add your own styles"
1099
  msgstr ""
1100
 
1101
+ #: includes/admin/default-settings.php:915
1102
  msgid "Text only"
1103
  msgstr ""
1104
 
1105
+ #: includes/admin/default-settings.php:916
1106
  msgid ""
1107
  "Disable thumbnails and no longer include the default style sheet included in "
1108
  "the plugin"
1109
  msgstr ""
1110
 
1111
+ #: includes/admin/default-settings.php:920
1112
  msgid "Left thumbnails"
1113
  msgstr ""
1114
 
1115
+ #: includes/admin/default-settings.php:921
1116
  msgid ""
1117
  "Enabling this option will set the post thumbnail to be before text. "
1118
  "Disabling this option will not revert any settings."
1247
  msgid "Refer to the knowledge base to learn how to use this in detail."
1248
  msgstr ""
1249
 
1250
+ #: includes/admin/import-export.php:30
1251
  msgid "Data has been imported into the table"
1252
  msgstr ""
1253
 
1254
+ #: includes/admin/import-export.php:32
1255
+ msgid ""
1256
+ "Data import failure. Check the number of columns for the file being imported "
1257
+ "and if you are uploading it in the right section below"
1258
+ msgstr ""
1259
+
1260
+ #: includes/admin/import-export.php:38
1261
  msgid "Settings have been imported successfully"
1262
  msgstr ""
1263
 
1264
+ #: includes/admin/import-export.php:44
1265
  msgid "Top 10 - Import/Export tables"
1266
  msgstr ""
1267
 
1268
+ #: includes/admin/import-export.php:54
1269
  msgid "Export/Import settings"
1270
  msgstr ""
1271
 
1272
+ #: includes/admin/import-export.php:56
1273
  msgid ""
1274
  "Export the plugin settings for this site as a .json file. This allows you to "
1275
  "easily import the configuration into another site."
1276
  msgstr ""
1277
 
1278
+ #: includes/admin/import-export.php:60
1279
  msgid "Export Settings"
1280
  msgstr ""
1281
 
1282
+ #: includes/admin/import-export.php:69
1283
  msgid ""
1284
  "Import the plugin settings from a .json file. This file can be obtained by "
1285
+ "exporting the settings on this/another site using the form above."
1286
  msgstr ""
1287
 
1288
+ #: includes/admin/import-export.php:75
1289
  msgid "Import Settings"
1290
  msgstr ""
1291
 
1292
+ #: includes/admin/import-export.php:84
1293
  msgid "Export tables"
1294
  msgstr ""
1295
 
1296
+ #: includes/admin/import-export.php:86
1297
  msgid ""
1298
  "Click the buttons below to export the overall and the daily tables. The file "
1299
  "is downloaded as an CSV file which you should be able to edit in Excel or "
1300
  "any other compatible software."
1301
  msgstr ""
1302
 
1303
+ #: includes/admin/import-export.php:87
1304
  msgid ""
1305
  "If you are using WordPress Multisite then this will include the counts "
1306
  "across all sites as the plugin uses a single table to store counts."
1307
  msgstr ""
1308
 
1309
+ #: includes/admin/import-export.php:91
1310
  msgid "Export overall tables"
1311
  msgstr ""
1312
 
1313
+ #: includes/admin/import-export.php:92
1314
  msgid "Export daily tables"
1315
  msgstr ""
1316
 
1317
+ #: includes/admin/import-export.php:100
1318
  msgid "Import tables"
1319
  msgstr ""
1320
 
1321
+ #: includes/admin/import-export.php:102
1322
  msgid ""
1323
+ "This action will replace the data in the table being import. Best practice "
1324
+ "would be to first export the data using the buttons above. Following this, "
1325
+ "update the file with the new data and then import it. It is important to "
1326
+ "maintain the export format of the data to avoid corruption."
1327
  msgstr ""
1328
 
1329
+ #: includes/admin/import-export.php:104
1330
+ msgid ""
1331
+ "Be careful when opening the file in Excel as it tends to change the date "
1332
+ "format. Recommended date-time format is YYYY-MM-DD H."
1333
+ msgstr ""
1334
+
1335
+ #: includes/admin/import-export.php:107
1336
  msgid ""
1337
  "Backup your database before proceeding so you will be able to restore it in "
1338
  "case anything goes wrong."
1339
  msgstr ""
1340
 
1341
+ #: includes/admin/import-export.php:109
1342
  msgid "Import Overall Table"
1343
  msgstr ""
1344
 
1345
+ #: includes/admin/import-export.php:114
1346
  msgid "Import Overall CSV"
1347
  msgstr ""
1348
 
1349
+ #: includes/admin/import-export.php:117
1350
  msgid "Import Daily Table"
1351
  msgstr ""
1352
 
1353
+ #: includes/admin/import-export.php:122
1354
  msgid "Import Daily CSV"
1355
  msgstr ""
1356
 
1357
+ #: includes/admin/import-export.php:185
1358
  msgid "Post ID"
1359
  msgstr ""
1360
 
1361
+ #: includes/admin/import-export.php:191
1362
  msgid "Blog ID"
1363
  msgstr ""
1364
 
1365
+ #: includes/admin/import-export.php:272
1366
  msgid "Please upload a valid .csv file"
1367
  msgstr ""
1368
 
1369
+ #: includes/admin/import-export.php:278 includes/admin/import-export.php:397
1370
  msgid "Please upload a file to import"
1371
  msgstr ""
1372
 
1373
+ #: includes/admin/import-export.php:391
1374
  msgid "Please upload a valid .json file"
1375
  msgstr ""
1376
 
1406
  msgid "Modified from default setting"
1407
  msgstr ""
1408
 
1409
+ #: includes/admin/settings-page.php:701
1410
+ msgctxt "tag delimiter"
1411
+ msgid ","
1412
+ msgstr ""
1413
+
1414
  #: includes/admin/sidebar.php:15
1415
  msgid "Support the development"
1416
  msgstr ""
1599
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1600
  msgstr ""
1601
 
1602
+ #: includes/blocks/popular-posts/src/edit.js:112
1603
+ msgid "Popular Posts Settings"
 
 
1604
  msgstr ""
1605
 
1606
+ #: includes/blocks/popular-posts/src/edit.js:118
1607
+ msgid "Show heading"
 
1608
  msgstr ""
1609
 
1610
+ #: includes/blocks/popular-posts/src/edit.js:121
1611
+ msgid "Heading displayed"
 
1612
  msgstr ""
1613
 
1614
+ #: includes/blocks/popular-posts/src/edit.js:122
1615
+ msgid "No Heading displayed"
 
1616
  msgstr ""
1617
 
1618
+ #: includes/blocks/popular-posts/src/edit.js:132
1619
+ msgid "Custom period?"
 
1620
  msgstr ""
1621
 
1622
+ #: includes/blocks/popular-posts/src/edit.js:135
1623
+ msgid "Set range below"
 
1624
  msgstr ""
1625
 
1626
+ #: includes/blocks/popular-posts/src/edit.js:136
1627
+ msgid "Overall popular posts will be shown"
 
1628
  msgstr ""
1629
 
1630
+ #: includes/blocks/popular-posts/src/edit.js:146
 
1631
  msgid "Daily range"
1632
  msgstr ""
1633
 
1634
+ #: includes/blocks/popular-posts/src/edit.js:149
1635
+ msgid "Number of days"
 
1636
  msgstr ""
1637
 
1638
+ #: includes/blocks/popular-posts/src/edit.js:156
1639
+ msgid "Hour range"
1640
+ msgstr ""
1641
+
1642
+ #: includes/blocks/popular-posts/src/edit.js:159
1643
+ msgid "Number of hours"
1644
+ msgstr ""
1645
+
1646
+ #: includes/blocks/popular-posts/src/edit.js:166
1647
+ #: includes/modules/class-top-ten-rest-api.php:212
1648
+ msgid "Number of posts"
1649
+ msgstr ""
1650
+
1651
+ #: includes/blocks/popular-posts/src/edit.js:169
1652
+ msgid "Maximum number of posts to display"
1653
  msgstr ""
1654
 
1655
+ #: includes/blocks/popular-posts/src/edit.js:176
1656
+ #: includes/modules/class-top-ten-widget.php:87
 
1657
  msgid "Offset"
1658
  msgstr ""
1659
 
1660
+ #: includes/blocks/popular-posts/src/edit.js:179
1661
+ msgid "Number of posts to skip from the top"
1662
+ msgstr ""
1663
+
1664
+ #: includes/blocks/popular-posts/src/edit.js:186
1665
+ #: includes/modules/class-top-ten-widget.php:110
1666
  msgid "Show excerpt"
1667
  msgstr ""
1668
 
1669
+ #: includes/blocks/popular-posts/src/edit.js:189
1670
+ msgid "Excerpt displayed"
1671
+ msgstr ""
1672
+
1673
+ #: includes/blocks/popular-posts/src/edit.js:190
1674
+ msgid "No excerpt"
1675
+ msgstr ""
1676
+
1677
+ #: includes/blocks/popular-posts/src/edit.js:203
1678
+ msgid "\"by Author Name\" displayed"
1679
+ msgstr ""
1680
+
1681
+ #: includes/blocks/popular-posts/src/edit.js:204
1682
+ msgid "No author displayed"
1683
+ msgstr ""
1684
+
1685
+ #: includes/blocks/popular-posts/src/edit.js:217
1686
+ msgid "Date of post displayed"
1687
+ msgstr ""
1688
+
1689
+ #: includes/blocks/popular-posts/src/edit.js:218
1690
+ msgid "Date of post not displayed"
1691
+ msgstr ""
1692
+
1693
+ #: includes/blocks/popular-posts/src/edit.js:228
1694
+ #: includes/modules/class-top-ten-widget.php:106
1695
  msgid "Show count"
1696
  msgstr ""
1697
 
1698
+ #: includes/blocks/popular-posts/src/edit.js:231
1699
+ msgid "Display number of visits"
1700
+ msgstr ""
1701
+
1702
+ #: includes/blocks/popular-posts/src/edit.js:232
1703
+ msgid "Number of visits hidden"
1704
+ msgstr ""
1705
+
1706
+ #: includes/blocks/popular-posts/src/edit.js:242
1707
+ msgid "Thumbnail option"
1708
  msgstr ""
1709
 
1710
+ #: includes/blocks/popular-posts/src/edit.js:247
 
1711
  msgid "Before title"
1712
  msgstr ""
1713
 
1714
+ #: includes/blocks/popular-posts/src/edit.js:248
 
1715
  msgid "After title"
1716
  msgstr ""
1717
 
1718
+ #: includes/blocks/popular-posts/src/edit.js:251
 
1719
  msgid "Only thumbnail"
1720
  msgstr ""
1721
 
1722
+ #: includes/blocks/popular-posts/src/edit.js:253
 
1723
  msgid "Only text"
1724
  msgstr ""
1725
 
1726
+ #: includes/blocks/popular-posts/src/edit.js:261
 
1727
  msgid "Other attributes"
1728
  msgstr ""
1729
 
1730
+ #: includes/blocks/popular-posts/src/edit.js:265
 
1731
  msgid ""
1732
  "Enter other attributes in a URL-style string-query. e.g. post_types=post,"
1733
  "page&link_nofollow=1&exclude_post_ids=5,6"
1777
  msgid "Invalid post ID."
1778
  msgstr ""
1779
 
 
 
 
 
1780
  #: includes/modules/class-top-ten-rest-api.php:217
1781
  msgid "Post types"
1782
  msgstr ""
1797
  msgid "Debug flag."
1798
  msgstr ""
1799
 
1800
+ #: includes/modules/class-top-ten-widget.php:26
1801
+ msgid "Popular Posts [Top 10]"
1802
  msgstr ""
1803
 
1804
+ #: includes/modules/class-top-ten-widget.php:28
1805
+ msgid "Display popular posts"
1806
  msgstr ""
1807
 
1808
+ #: includes/modules/class-top-ten-widget.php:83
1809
+ msgid "No. of posts"
1810
  msgstr ""
1811
 
1812
+ #: includes/modules/class-top-ten-widget.php:91
1813
+ msgid "Select period"
1814
  msgstr ""
1815
 
1816
+ #: includes/modules/class-top-ten-widget.php:94
1817
+ msgid "Custom time period (Enter below)"
1818
  msgstr ""
1819
 
1820
+ #: includes/modules/class-top-ten-widget.php:98
1821
+ msgid "Days"
1822
  msgstr ""
1823
 
1824
+ #: includes/modules/class-top-ten-widget.php:101
1825
+ msgid "Hours"
1826
  msgstr ""
1827
 
1828
+ #: includes/modules/class-top-ten-widget.php:122
1829
+ msgid "Thumbnail options"
1830
  msgstr ""
1831
 
1832
  #: includes/modules/class-top-ten-widget.php:124
 
 
 
 
1833
  msgid "Thumbnails inline, before title"
1834
  msgstr ""
1835
 
1836
+ #: includes/modules/class-top-ten-widget.php:125
1837
  msgid "Thumbnails inline, after title"
1838
  msgstr ""
1839
 
1840
+ #: includes/modules/class-top-ten-widget.php:126
1841
  msgid "Only thumbnails, no text"
1842
  msgstr ""
1843
 
1844
+ #: includes/modules/class-top-ten-widget.php:127
1845
  msgid "No thumbnails, only text."
1846
  msgstr ""
1847
 
1848
+ #: includes/modules/class-top-ten-widget.php:139
1849
  msgid "Only from categories"
1850
  msgstr ""
1851
 
1852
+ #: includes/modules/class-top-ten-widget.php:141
1853
+ msgid ""
1854
+ "Enter a comma separated list of category, tag or other term taxonomy IDs"
1855
  msgstr ""
1856
 
1857
+ #: includes/modules/class-top-ten-widget.php:144
1858
+ msgid "Include post IDs"
1859
  msgstr ""
1860
 
1861
+ #: includes/public/display-posts.php:173
1862
  #, php-format
1863
  msgid ""
1864
  "Popular posts by <a href=\"%1$s\" rel=\"nofollow\" %2$s>Top 10 plugin</a>"
1865
  msgstr ""
1866
 
 
 
 
 
 
 
 
 
 
 
 
 
1867
  #: includes/public/output-generator.php:240
1868
  msgid " by "
1869
  msgstr ""
languages/top-10-en_US.pot CHANGED
@@ -3,16 +3,17 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2021-06-28 10:19+0100\n"
7
  "PO-Revision-Date: \n"
8
- "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
- "Language-Team: WebberZone <plugins@webberzone.com>\n"
10
  "Language: en_US\n"
11
  "MIME-Version: 1.0\n"
12
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
- "X-Poedit-KeywordsList: __;_e;_c;__ngettext;esc_html__;esc_attr__;esc_html_e;"
15
- "esc_attr_e\n"
 
16
  "X-Poedit-Basepath: ..\n"
17
  "X-Generator: Poedit 3.0\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -31,115 +32,115 @@ msgstr ""
31
  msgid "Views"
32
  msgstr ""
33
 
34
- #: includes/admin/admin-dashboard.php:62
35
  msgid "View all daily popular posts"
36
  msgstr ""
37
 
38
- #: includes/admin/admin-dashboard.php:64
39
  #: includes/admin/class-top-ten-dashboard.php:164
40
  msgid "View all popular posts"
41
  msgstr ""
42
 
43
- #: includes/admin/admin-dashboard.php:72
44
  #, php-format
45
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
46
  msgstr ""
47
 
48
- #: includes/admin/admin-dashboard.php:121 includes/admin/admin.php:40
49
  #: includes/admin/class-top-ten-network-statistics.php:114
50
  #: includes/admin/class-top-ten-statistics.php:124
51
  msgid "Popular Posts"
52
  msgstr ""
53
 
54
- #: includes/admin/admin-dashboard.php:126 includes/admin/admin.php:43
55
  msgid "Daily Popular Posts"
56
  msgstr ""
57
 
58
- #: includes/admin/admin-metabox.php:104
59
  msgid "Visit count:"
60
  msgstr ""
61
 
62
- #: includes/admin/admin-metabox.php:106
63
  msgid ""
64
  "Enter a number above to update the visit count. Leaving the above box blank "
65
  "will set the count to zero"
66
  msgstr ""
67
 
68
- #: includes/admin/admin-metabox.php:116
69
  msgid "Disable Popular Posts display:"
70
  msgstr ""
71
 
72
- #: includes/admin/admin-metabox.php:119
73
  msgid ""
74
  "If this is checked, then Top 10 will not display the popular posts widgets "
75
  "when viewing this post."
76
  msgstr ""
77
 
78
- #: includes/admin/admin-metabox.php:123
79
  msgid "Exclude this post from the popular posts list:"
80
  msgstr ""
81
 
82
- #: includes/admin/admin-metabox.php:126
83
  msgid ""
84
  "If this is checked, then this post will be excluded from the popular posts "
85
  "list."
86
  msgstr ""
87
 
88
- #: includes/admin/admin-metabox.php:130
89
  msgid "Location of thumbnail:"
90
  msgstr ""
91
 
92
- #: includes/admin/admin-metabox.php:132
93
  msgid ""
94
  "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
95
  "image will be used for the post. It will be resized to the thumbnail size "
96
  "set under Top 10 Settings &raquo; Thumbnail options."
97
  msgstr ""
98
 
99
- #: includes/admin/admin-metabox.php:133
100
  msgid "The URL above is saved in the meta field:"
101
  msgstr ""
102
 
103
- #: includes/admin/admin-metabox.php:141
104
  #, php-format
105
  msgid ""
106
  "You have %1$s installed. If you are trying to modify the thumbnail, then you "
107
  "will need to make the same change in the %1$s meta box on this page."
108
  msgstr ""
109
 
110
- #: includes/admin/admin.php:34 includes/admin/settings-page.php:32
111
  msgid "Top 10 Settings"
112
  msgstr ""
113
 
114
- #: includes/admin/admin.php:34 includes/admin/admin.php:157
115
  msgid "Settings"
116
  msgstr ""
117
 
118
- #: includes/admin/admin.php:40 includes/admin/class-top-ten-statistics.php:70
119
  msgid "Top 10 Popular Posts"
120
  msgstr ""
121
 
122
- #: includes/admin/admin.php:43
123
  msgid "Top 10 Daily Popular Posts"
124
  msgstr ""
125
 
126
- #: includes/admin/admin.php:47 includes/admin/tools.php:74
127
  msgid "Top 10 Tools"
128
  msgstr ""
129
 
130
- #: includes/admin/admin.php:47
131
  msgid "Tools"
132
  msgstr ""
133
 
134
- #: includes/admin/admin.php:50
135
  msgid "Top 10 Import Export Tables"
136
  msgstr ""
137
 
138
- #: includes/admin/admin.php:50
139
  msgid "Import/Export"
140
  msgstr ""
141
 
142
- #: includes/admin/admin.php:111
143
  #, php-format
144
  msgid ""
145
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
@@ -147,15 +148,15 @@ msgid ""
147
  "\"_blank\">WordPress.org</a>"
148
  msgstr ""
149
 
150
- #: includes/admin/admin.php:179 includes/admin/sidebar.php:55
151
  msgid "Support"
152
  msgstr ""
153
 
154
- #: includes/admin/admin.php:180
155
  msgid "Donate"
156
  msgstr ""
157
 
158
- #: includes/admin/admin.php:181
159
  msgid "Contribute"
160
  msgstr ""
161
 
@@ -163,10 +164,17 @@ msgstr ""
163
  msgid "Top 10 - Network Popular Posts"
164
  msgstr ""
165
 
166
- #: includes/admin/admin.php:199 includes/admin/class-top-ten-dashboard.php:199
167
  msgid "Top 10"
168
  msgstr ""
169
 
 
 
 
 
 
 
 
170
  #: includes/admin/class-top-ten-dashboard.php:83
171
  #: includes/admin/class-top-ten-dashboard.php:199
172
  #: includes/admin/class-top-ten-dashboard.php:201
@@ -190,7 +198,7 @@ msgid "Dashboard"
190
  msgstr ""
191
 
192
  #: includes/admin/class-top-ten-dashboard.php:242
193
- #: includes/admin/import-export.php:180
194
  msgid "Visits"
195
  msgstr ""
196
 
@@ -283,7 +291,7 @@ msgid "popular_posts"
283
  msgstr ""
284
 
285
  #: includes/admin/class-top-ten-network-statistics-table.php:183
286
- #: includes/admin/class-top-ten-statistics-table.php:213
287
  msgid "No popular posts available."
288
  msgstr ""
289
 
@@ -292,12 +300,12 @@ msgid "Invalid post ID. This post might have been deleted."
292
  msgstr ""
293
 
294
  #: includes/admin/class-top-ten-network-statistics-table.php:256
295
- #: includes/admin/class-top-ten-statistics-table.php:297
296
  msgid "Y/m/d"
297
  msgstr ""
298
 
299
  #: includes/admin/class-top-ten-network-statistics-table.php:294
300
- #: includes/admin/class-top-ten-statistics-table.php:351
301
  #: includes/modules/class-top-ten-count-widget.php:49
302
  #: includes/modules/class-top-ten-widget.php:79
303
  msgid "Title"
@@ -308,33 +316,33 @@ msgid "Blog"
308
  msgstr ""
309
 
310
  #: includes/admin/class-top-ten-network-statistics-table.php:296
311
- #: includes/admin/class-top-ten-statistics-table.php:356
312
- #: includes/admin/import-export.php:183
313
  msgid "Date"
314
  msgstr ""
315
 
316
  #: includes/admin/class-top-ten-network-statistics-table.php:297
317
- #: includes/admin/class-top-ten-statistics-table.php:352
318
  msgid "Total visits"
319
  msgstr ""
320
 
321
  #: includes/admin/class-top-ten-network-statistics-table.php:298
322
- #: includes/admin/class-top-ten-statistics-table.php:353
323
  msgid "Daily visits"
324
  msgstr ""
325
 
326
  #: includes/admin/class-top-ten-network-statistics-table.php:331
327
- #: includes/admin/class-top-ten-statistics-table.php:390
328
  msgid "Delete Count"
329
  msgstr ""
330
 
331
  #: includes/admin/class-top-ten-network-statistics-table.php:378
332
- #: includes/admin/class-top-ten-statistics-table.php:437
333
  msgid "Are you sure you want to do this"
334
  msgstr ""
335
 
336
  #: includes/admin/class-top-ten-network-statistics-table.php:420
337
- #: includes/admin/class-top-ten-statistics-table.php:504
338
  msgid "Filter"
339
  msgstr ""
340
 
@@ -346,28 +354,28 @@ msgstr ""
346
  msgid "All post types"
347
  msgstr ""
348
 
349
- #: includes/admin/class-top-ten-statistics-table.php:263
350
  msgid "View"
351
  msgstr ""
352
 
353
- #: includes/admin/class-top-ten-statistics-table.php:264
354
  msgid "Edit"
355
  msgstr ""
356
 
357
- #: includes/admin/class-top-ten-statistics-table.php:265
358
  msgid "Delete"
359
  msgstr ""
360
 
361
- #: includes/admin/class-top-ten-statistics-table.php:295
362
  #, php-format
363
  msgid "%s ago"
364
  msgstr ""
365
 
366
- #: includes/admin/class-top-ten-statistics-table.php:354
367
  msgid "Post type"
368
  msgstr ""
369
 
370
- #: includes/admin/class-top-ten-statistics-table.php:355
371
  msgid "Author"
372
  msgstr ""
373
 
@@ -380,12 +388,12 @@ msgid "Enable trackers"
380
  msgstr ""
381
 
382
  #: includes/admin/default-settings.php:72
383
- #: includes/modules/class-top-ten-widget.php:94
384
  msgid "Overall"
385
  msgstr ""
386
 
387
  #: includes/admin/default-settings.php:73
388
- #: includes/admin/default-settings.php:729
389
  msgid "Daily"
390
  msgstr ""
391
 
@@ -661,7 +669,7 @@ msgid ""
661
  msgstr ""
662
 
663
  #: includes/admin/default-settings.php:320
664
- #: includes/admin/default-settings.php:778
665
  msgid "Number of posts to display"
666
  msgstr ""
667
 
@@ -684,6 +692,7 @@ msgid ""
684
  msgstr ""
685
 
686
  #: includes/admin/default-settings.php:335
 
687
  msgid "Post types to include"
688
  msgstr ""
689
 
@@ -707,31 +716,42 @@ msgid ""
707
  msgstr ""
708
 
709
  #: includes/admin/default-settings.php:349
710
- msgid "Post/page IDs to exclude"
711
  msgstr ""
712
 
713
  #: includes/admin/default-settings.php:350
714
  msgid ""
 
 
 
 
 
 
 
 
 
 
715
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
716
  "188,320,500"
717
  msgstr ""
718
 
719
- #: includes/admin/default-settings.php:356
720
  msgid "Exclude Categories"
721
  msgstr ""
722
 
723
- #: includes/admin/default-settings.php:357
 
724
  msgid ""
725
  "Comma separated list of category slugs. The field above has an autocomplete "
726
  "so simply start typing in the starting letters and it will prompt you with "
727
  "options. Does not support custom taxonomies."
728
  msgstr ""
729
 
730
- #: includes/admin/default-settings.php:368
731
  msgid "Exclude category IDs"
732
  msgstr ""
733
 
734
- #: includes/admin/default-settings.php:369
735
  msgid ""
736
  "This is a readonly field that is automatically populated based on the above "
737
  "input when the settings are saved. These might differ from the IDs visible "
@@ -739,138 +759,143 @@ msgid ""
739
  "term_taxonomy_id which is unique to this taxonomy."
740
  msgstr ""
741
 
742
- #: includes/admin/default-settings.php:376
 
 
 
 
743
  msgid "Customize the output"
744
  msgstr ""
745
 
746
- #: includes/admin/default-settings.php:382
747
  msgid "Heading of posts"
748
  msgstr ""
749
 
750
- #: includes/admin/default-settings.php:383
751
- #: includes/admin/default-settings.php:391
752
  msgid "Displayed before the list of the posts as a the master heading"
753
  msgstr ""
754
 
755
- #: includes/admin/default-settings.php:385
756
  msgid "Popular posts:"
757
  msgstr ""
758
 
759
- #: includes/admin/default-settings.php:390
760
  msgid "Heading of posts for daily/custom period lists"
761
  msgstr ""
762
 
763
- #: includes/admin/default-settings.php:393
764
  msgid "Currently trending:"
765
  msgstr ""
766
 
767
- #: includes/admin/default-settings.php:398
768
  msgid "Show when no posts are found"
769
  msgstr ""
770
 
771
- #: includes/admin/default-settings.php:404
772
  msgid "Blank output"
773
  msgstr ""
774
 
775
- #: includes/admin/default-settings.php:405
776
  msgid "Display custom text"
777
  msgstr ""
778
 
779
- #: includes/admin/default-settings.php:410
780
  msgid "Custom text"
781
  msgstr ""
782
 
783
- #: includes/admin/default-settings.php:411
784
  msgid ""
785
  "Enter the custom text that will be displayed if the second option is "
786
  "selected above"
787
  msgstr ""
788
 
789
- #: includes/admin/default-settings.php:413 includes/deprecated.php:180
790
  msgid "No top posts yet"
791
  msgstr ""
792
 
793
- #: includes/admin/default-settings.php:417
794
  msgid "Show post excerpt"
795
  msgstr ""
796
 
797
- #: includes/admin/default-settings.php:424
798
  msgid "Length of excerpt (in words)"
799
  msgstr ""
800
 
801
- #: includes/admin/default-settings.php:432
802
- #: includes/blocks/popular-posts/index.js:207
803
- #: includes/blocks/popular-posts/index.min.js:1
804
  msgid "Show date"
805
  msgstr ""
806
 
807
- #: includes/admin/default-settings.php:439
808
- #: includes/blocks/popular-posts/index.js:202
809
- #: includes/blocks/popular-posts/index.min.js:1
810
  msgid "Show author"
811
  msgstr ""
812
 
813
- #: includes/admin/default-settings.php:446
814
  msgid "Show number of views"
815
  msgstr ""
816
 
817
- #: includes/admin/default-settings.php:453
818
  msgid "Limit post title length (in characters)"
819
  msgstr ""
820
 
821
- #: includes/admin/default-settings.php:461
822
  msgid "Open links in new window"
823
  msgstr ""
824
 
825
- #: includes/admin/default-settings.php:468
826
  msgid "Add nofollow to links"
827
  msgstr ""
828
 
829
- #: includes/admin/default-settings.php:475
830
  msgid "HTML to display"
831
  msgstr ""
832
 
833
- #: includes/admin/default-settings.php:481
834
  msgid "Before the list of posts"
835
  msgstr ""
836
 
837
- #: includes/admin/default-settings.php:488
838
  msgid "After the list of posts"
839
  msgstr ""
840
 
841
- #: includes/admin/default-settings.php:495
842
  msgid "Before each list item"
843
  msgstr ""
844
 
845
- #: includes/admin/default-settings.php:502
846
  msgid "After each list item"
847
  msgstr ""
848
 
849
- #: includes/admin/default-settings.php:532
 
850
  msgid "Location of the post thumbnail"
851
  msgstr ""
852
 
853
- #: includes/admin/default-settings.php:537
854
  msgid "Display thumbnails inline with posts, before title"
855
  msgstr ""
856
 
857
- #: includes/admin/default-settings.php:538
858
  msgid "Display thumbnails inline with posts, after title"
859
  msgstr ""
860
 
861
- #: includes/admin/default-settings.php:539
862
  msgid "Display only thumbnails, no text"
863
  msgstr ""
864
 
865
- #: includes/admin/default-settings.php:540
866
  msgid "Do not display thumbnails, only text"
867
  msgstr ""
868
 
869
- #: includes/admin/default-settings.php:545
870
  msgid "Thumbnail size"
871
  msgstr ""
872
 
873
- #: includes/admin/default-settings.php:547
874
  msgid ""
875
  "You can choose from existing image sizes above or create a custom size. If "
876
  "you have chosen Custom size above, then enter the width, height and crop "
@@ -878,123 +903,123 @@ msgid ""
878
  "width and/or height below, existing images will not be automatically resized."
879
  msgstr ""
880
 
881
- #: includes/admin/default-settings.php:547
882
  #, php-format
883
- msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
884
  msgstr ""
885
 
886
- #: includes/admin/default-settings.php:554
887
- #: includes/modules/class-top-ten-widget.php:144
888
  msgid "Thumbnail width"
889
  msgstr ""
890
 
891
- #: includes/admin/default-settings.php:562
892
- #: includes/modules/class-top-ten-widget.php:138
893
  msgid "Thumbnail height"
894
  msgstr ""
895
 
896
- #: includes/admin/default-settings.php:570
897
  msgid "Hard crop thumbnails"
898
  msgstr ""
899
 
900
- #: includes/admin/default-settings.php:571
901
  msgid ""
902
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
903
  "above vs. maintaining proportions."
904
  msgstr ""
905
 
906
- #: includes/admin/default-settings.php:577
907
  msgid "Generate thumbnail sizes"
908
  msgstr ""
909
 
910
- #: includes/admin/default-settings.php:578
911
  msgid ""
912
  "If you select this option and Custom size is selected above, the plugin will "
913
  "register the image size with WordPress to create new thumbnails. Does not "
914
  "update old images as explained above."
915
  msgstr ""
916
 
917
- #: includes/admin/default-settings.php:584
918
  msgid "Thumbnail size attributes"
919
  msgstr ""
920
 
921
- #: includes/admin/default-settings.php:590
922
  #, php-format
923
  msgid "Use CSS to set the width and height: e.g. %s"
924
  msgstr ""
925
 
926
- #: includes/admin/default-settings.php:592
927
  #, php-format
928
  msgid "Use HTML attributes to set the width and height: e.g. %s"
929
  msgstr ""
930
 
931
- #: includes/admin/default-settings.php:593
932
  msgid ""
933
  "No width or height set. You will need to use external styles to force any "
934
  "width or height of your choice."
935
  msgstr ""
936
 
937
- #: includes/admin/default-settings.php:598
938
  msgid "Thumbnail meta field name"
939
  msgstr ""
940
 
941
- #: includes/admin/default-settings.php:599
942
  msgid ""
943
  "The value of this field should contain the URL of the image and can be set "
944
  "in the metabox in the Edit Post screen"
945
  msgstr ""
946
 
947
- #: includes/admin/default-settings.php:605
948
  msgid "Get first image"
949
  msgstr ""
950
 
951
- #: includes/admin/default-settings.php:606
952
  msgid ""
953
  "The plugin will fetch the first image in the post content if this is "
954
  "enabled. This can slow down the loading of your page if the first image in "
955
  "the followed posts is large in file-size."
956
  msgstr ""
957
 
958
- #: includes/admin/default-settings.php:612
959
  msgid "Use default thumbnail?"
960
  msgstr ""
961
 
962
- #: includes/admin/default-settings.php:613
963
  msgid ""
964
  "If checked, when no thumbnail is found, show a default one from the URL "
965
  "below. If not checked and no thumbnail is found, no image will be shown."
966
  msgstr ""
967
 
968
- #: includes/admin/default-settings.php:619 includes/admin/settings-page.php:743
969
  msgid "Default thumbnail"
970
  msgstr ""
971
 
972
- #: includes/admin/default-settings.php:620
973
  msgid ""
974
  "Enter the full URL of the image that you wish to display if no thumbnail is "
975
  "found. This image will be displayed below."
976
  msgstr ""
977
 
978
- #: includes/admin/default-settings.php:650
979
  msgid "Popular posts style"
980
  msgstr ""
981
 
982
- #: includes/admin/default-settings.php:658
983
  msgid "Custom CSS"
984
  msgstr ""
985
 
986
- #: includes/admin/default-settings.php:660
987
  #, php-format
988
  msgid ""
989
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
990
  "CSS classes to style."
991
  msgstr ""
992
 
993
- #: includes/admin/default-settings.php:690
994
  msgid "Enable scheduled maintenance"
995
  msgstr ""
996
 
997
- #: includes/admin/default-settings.php:692
998
  #, php-format
999
  msgid ""
1000
  "Cleaning the database at regular intervals could improve performance, "
@@ -1002,43 +1027,43 @@ msgid ""
1002
  "delete entries older than %d days in the daily tables."
1003
  msgstr ""
1004
 
1005
- #: includes/admin/default-settings.php:698
1006
  msgid "Time to run maintenance"
1007
  msgstr ""
1008
 
1009
- #: includes/admin/default-settings.php:699
1010
  msgid "The next two options allow you to set the time to run the cron."
1011
  msgstr ""
1012
 
1013
- #: includes/admin/default-settings.php:704
1014
  msgid "Hour"
1015
  msgstr ""
1016
 
1017
- #: includes/admin/default-settings.php:714
1018
  msgid "Minute"
1019
  msgstr ""
1020
 
1021
- #: includes/admin/default-settings.php:724
1022
  msgid "Run maintenance"
1023
  msgstr ""
1024
 
1025
- #: includes/admin/default-settings.php:730
1026
  msgid "Weekly"
1027
  msgstr ""
1028
 
1029
- #: includes/admin/default-settings.php:731
1030
  msgid "Fortnightly"
1031
  msgstr ""
1032
 
1033
- #: includes/admin/default-settings.php:732
1034
  msgid "Monthly"
1035
  msgstr ""
1036
 
1037
- #: includes/admin/default-settings.php:760
1038
  msgid "Permalink - Overall"
1039
  msgstr ""
1040
 
1041
- #: includes/admin/default-settings.php:762
1042
  #, php-format
1043
  msgid ""
1044
  "This will set the path of the custom feed generated by the plugin for "
@@ -1046,11 +1071,11 @@ msgid ""
1046
  "when changing this option."
1047
  msgstr ""
1048
 
1049
- #: includes/admin/default-settings.php:769
1050
  msgid "Permalink - Daily"
1051
  msgstr ""
1052
 
1053
- #: includes/admin/default-settings.php:771
1054
  #, php-format
1055
  msgid ""
1056
  "This will set the path of the custom feed generated by the plugin for daily/"
@@ -1058,37 +1083,37 @@ msgid ""
1058
  "%2$s when changing this option."
1059
  msgstr ""
1060
 
1061
- #: includes/admin/default-settings.php:779
1062
  msgid "Maximum number of posts that will be displayed in the custom feed."
1063
  msgstr ""
1064
 
1065
- #: includes/admin/default-settings.php:786
1066
  msgid "Custom period in day(s)"
1067
  msgstr ""
1068
 
1069
- #: includes/admin/default-settings.php:888
1070
  msgid "No styles"
1071
  msgstr ""
1072
 
1073
- #: includes/admin/default-settings.php:889
1074
  msgid "Select this option if you plan to add your own styles"
1075
  msgstr ""
1076
 
1077
- #: includes/admin/default-settings.php:893
1078
  msgid "Text only"
1079
  msgstr ""
1080
 
1081
- #: includes/admin/default-settings.php:894
1082
  msgid ""
1083
  "Disable thumbnails and no longer include the default style sheet included in "
1084
  "the plugin"
1085
  msgstr ""
1086
 
1087
- #: includes/admin/default-settings.php:898
1088
  msgid "Left thumbnails"
1089
  msgstr ""
1090
 
1091
- #: includes/admin/default-settings.php:899
1092
  msgid ""
1093
  "Enabling this option will set the post thumbnail to be before text. "
1094
  "Disabling this option will not revert any settings."
@@ -1223,118 +1248,130 @@ msgstr ""
1223
  msgid "Refer to the knowledge base to learn how to use this in detail."
1224
  msgstr ""
1225
 
1226
- #: includes/admin/import-export.php:29
1227
  msgid "Data has been imported into the table"
1228
  msgstr ""
1229
 
1230
- #: includes/admin/import-export.php:34
 
 
 
 
 
 
1231
  msgid "Settings have been imported successfully"
1232
  msgstr ""
1233
 
1234
- #: includes/admin/import-export.php:40
1235
  msgid "Top 10 - Import/Export tables"
1236
  msgstr ""
1237
 
1238
- #: includes/admin/import-export.php:50
1239
  msgid "Export/Import settings"
1240
  msgstr ""
1241
 
1242
- #: includes/admin/import-export.php:52
1243
  msgid ""
1244
  "Export the plugin settings for this site as a .json file. This allows you to "
1245
  "easily import the configuration into another site."
1246
  msgstr ""
1247
 
1248
- #: includes/admin/import-export.php:56
1249
  msgid "Export Settings"
1250
  msgstr ""
1251
 
1252
- #: includes/admin/import-export.php:65
1253
  msgid ""
1254
  "Import the plugin settings from a .json file. This file can be obtained by "
1255
- "exporting the settings on another site using the form above."
1256
  msgstr ""
1257
 
1258
- #: includes/admin/import-export.php:71
1259
  msgid "Import Settings"
1260
  msgstr ""
1261
 
1262
- #: includes/admin/import-export.php:80
1263
  msgid "Export tables"
1264
  msgstr ""
1265
 
1266
- #: includes/admin/import-export.php:82
1267
  msgid ""
1268
  "Click the buttons below to export the overall and the daily tables. The file "
1269
  "is downloaded as an CSV file which you should be able to edit in Excel or "
1270
  "any other compatible software."
1271
  msgstr ""
1272
 
1273
- #: includes/admin/import-export.php:83
1274
  msgid ""
1275
  "If you are using WordPress Multisite then this will include the counts "
1276
  "across all sites as the plugin uses a single table to store counts."
1277
  msgstr ""
1278
 
1279
- #: includes/admin/import-export.php:87
1280
  msgid "Export overall tables"
1281
  msgstr ""
1282
 
1283
- #: includes/admin/import-export.php:88
1284
  msgid "Export daily tables"
1285
  msgstr ""
1286
 
1287
- #: includes/admin/import-export.php:96
1288
  msgid "Import tables"
1289
  msgstr ""
1290
 
1291
- #: includes/admin/import-export.php:98
1292
  msgid ""
1293
- "This action will replace the data in your tables, so I suggest that you "
1294
- "export the existing data using the buttons above, amend it and then import "
1295
- "it. It is important to maintain the export format of the data to avoid "
1296
- "corruption."
1297
  msgstr ""
1298
 
1299
- #: includes/admin/import-export.php:101
 
 
 
 
 
 
1300
  msgid ""
1301
  "Backup your database before proceeding so you will be able to restore it in "
1302
  "case anything goes wrong."
1303
  msgstr ""
1304
 
1305
- #: includes/admin/import-export.php:103
1306
  msgid "Import Overall Table"
1307
  msgstr ""
1308
 
1309
- #: includes/admin/import-export.php:108
1310
  msgid "Import Overall CSV"
1311
  msgstr ""
1312
 
1313
- #: includes/admin/import-export.php:111
1314
  msgid "Import Daily Table"
1315
  msgstr ""
1316
 
1317
- #: includes/admin/import-export.php:116
1318
  msgid "Import Daily CSV"
1319
  msgstr ""
1320
 
1321
- #: includes/admin/import-export.php:179
1322
  msgid "Post ID"
1323
  msgstr ""
1324
 
1325
- #: includes/admin/import-export.php:185
1326
  msgid "Blog ID"
1327
  msgstr ""
1328
 
1329
- #: includes/admin/import-export.php:264
1330
  msgid "Please upload a valid .csv file"
1331
  msgstr ""
1332
 
1333
- #: includes/admin/import-export.php:270 includes/admin/import-export.php:373
1334
  msgid "Please upload a file to import"
1335
  msgstr ""
1336
 
1337
- #: includes/admin/import-export.php:367
1338
  msgid "Please upload a valid .json file"
1339
  msgstr ""
1340
 
@@ -1370,6 +1407,11 @@ msgstr ""
1370
  msgid "Modified from default setting"
1371
  msgstr ""
1372
 
 
 
 
 
 
1373
  #: includes/admin/sidebar.php:15
1374
  msgid "Support the development"
1375
  msgstr ""
@@ -1558,107 +1600,135 @@ msgstr ""
1558
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1559
  msgstr ""
1560
 
1561
- #: includes/blocks/popular-posts/index.js:22
1562
- #: includes/blocks/popular-posts/index.min.js:1
1563
- #: includes/modules/class-top-ten-widget.php:26
1564
- msgid "Popular Posts [Top 10]"
1565
  msgstr ""
1566
 
1567
- #: includes/blocks/popular-posts/index.js:23
1568
- #: includes/blocks/popular-posts/index.min.js:1
1569
- msgid "Display popular posts by Top 10"
1570
  msgstr ""
1571
 
1572
- #: includes/blocks/popular-posts/index.js:26
1573
- #: includes/blocks/popular-posts/index.min.js:1
1574
- msgid "popular posts"
1575
  msgstr ""
1576
 
1577
- #: includes/blocks/popular-posts/index.js:26
1578
- #: includes/blocks/popular-posts/index.min.js:1
1579
- msgid "popular"
1580
  msgstr ""
1581
 
1582
- #: includes/blocks/popular-posts/index.js:26
1583
- #: includes/blocks/popular-posts/index.min.js:1
1584
- msgid "posts"
1585
  msgstr ""
1586
 
1587
- #: includes/blocks/popular-posts/index.js:145
1588
- #: includes/blocks/popular-posts/index.min.js:1
1589
- msgid "Show heading"
1590
  msgstr ""
1591
 
1592
- #: includes/blocks/popular-posts/index.js:150
1593
- #: includes/blocks/popular-posts/index.min.js:1
1594
- msgid "Custom period? Set range below"
1595
  msgstr ""
1596
 
1597
- #: includes/blocks/popular-posts/index.js:155
1598
- #: includes/blocks/popular-posts/index.min.js:1
1599
  msgid "Daily range"
1600
  msgstr ""
1601
 
1602
- #: includes/blocks/popular-posts/index.js:165
1603
- #: includes/blocks/popular-posts/index.min.js:1
1604
- msgid "Hourly range"
1605
  msgstr ""
1606
 
1607
- #: includes/blocks/popular-posts/index.js:175
1608
- #: includes/blocks/popular-posts/index.min.js:1
1609
- #: includes/modules/class-top-ten-widget.php:84
1610
- msgid "No. of posts"
 
 
 
 
 
 
 
 
 
 
 
1611
  msgstr ""
1612
 
1613
- #: includes/blocks/popular-posts/index.js:186
1614
- #: includes/blocks/popular-posts/index.min.js:1
1615
- #: includes/modules/class-top-ten-widget.php:89
1616
  msgid "Offset"
1617
  msgstr ""
1618
 
1619
- #: includes/blocks/popular-posts/index.js:197
1620
- #: includes/blocks/popular-posts/index.min.js:1
 
 
 
 
1621
  msgid "Show excerpt"
1622
  msgstr ""
1623
 
1624
- #: includes/blocks/popular-posts/index.js:212
1625
- #: includes/blocks/popular-posts/index.min.js:1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1626
  msgid "Show count"
1627
  msgstr ""
1628
 
1629
- #: includes/blocks/popular-posts/index.js:218
1630
- #: includes/blocks/popular-posts/index.min.js:1
1631
- #: includes/modules/class-top-ten-widget.php:128
1632
- msgid "Thumbnail options"
 
 
 
 
 
 
1633
  msgstr ""
1634
 
1635
- #: includes/blocks/popular-posts/index.js:221
1636
- #: includes/blocks/popular-posts/index.min.js:1
1637
  msgid "Before title"
1638
  msgstr ""
1639
 
1640
- #: includes/blocks/popular-posts/index.js:222
1641
- #: includes/blocks/popular-posts/index.min.js:1
1642
  msgid "After title"
1643
  msgstr ""
1644
 
1645
- #: includes/blocks/popular-posts/index.js:223
1646
- #: includes/blocks/popular-posts/index.min.js:1
1647
  msgid "Only thumbnail"
1648
  msgstr ""
1649
 
1650
- #: includes/blocks/popular-posts/index.js:224
1651
- #: includes/blocks/popular-posts/index.min.js:1
1652
  msgid "Only text"
1653
  msgstr ""
1654
 
1655
- #: includes/blocks/popular-posts/index.js:228
1656
- #: includes/blocks/popular-posts/index.min.js:1
1657
  msgid "Other attributes"
1658
  msgstr ""
1659
 
1660
- #: includes/blocks/popular-posts/index.js:229
1661
- #: includes/blocks/popular-posts/index.min.js:1
1662
  msgid ""
1663
  "Enter other attributes in a URL-style string-query. e.g. post_types=post,"
1664
  "page&link_nofollow=1&exclude_post_ids=5,6"
@@ -1708,10 +1778,6 @@ msgstr ""
1708
  msgid "Invalid post ID."
1709
  msgstr ""
1710
 
1711
- #: includes/modules/class-top-ten-rest-api.php:212
1712
- msgid "Number of posts"
1713
- msgstr ""
1714
-
1715
  #: includes/modules/class-top-ten-rest-api.php:217
1716
  msgid "Post types"
1717
  msgstr ""
@@ -1732,88 +1798,73 @@ msgstr ""
1732
  msgid "Debug flag."
1733
  msgstr ""
1734
 
1735
- #: includes/modules/class-top-ten-widget.php:28
1736
- msgid "Display popular posts"
1737
  msgstr ""
1738
 
1739
- #: includes/modules/class-top-ten-widget.php:95
1740
- msgid "Custom time period (Enter below)"
1741
  msgstr ""
1742
 
1743
- #: includes/modules/class-top-ten-widget.php:99
1744
- msgid "In days and hours (applies only to custom option above)"
1745
  msgstr ""
1746
 
1747
- #: includes/modules/class-top-ten-widget.php:101
1748
- msgid "days"
1749
  msgstr ""
1750
 
1751
- #: includes/modules/class-top-ten-widget.php:104
1752
- msgid "hours"
1753
  msgstr ""
1754
 
1755
- #: includes/modules/class-top-ten-widget.php:109
1756
- msgid "Show count?"
1757
  msgstr ""
1758
 
1759
- #: includes/modules/class-top-ten-widget.php:114
1760
- msgid "Show excerpt?"
1761
  msgstr ""
1762
 
1763
- #: includes/modules/class-top-ten-widget.php:119
1764
- msgid "Show author?"
1765
  msgstr ""
1766
 
1767
  #: includes/modules/class-top-ten-widget.php:124
1768
- msgid "Show date?"
1769
- msgstr ""
1770
-
1771
- #: includes/modules/class-top-ten-widget.php:130
1772
  msgid "Thumbnails inline, before title"
1773
  msgstr ""
1774
 
1775
- #: includes/modules/class-top-ten-widget.php:131
1776
  msgid "Thumbnails inline, after title"
1777
  msgstr ""
1778
 
1779
- #: includes/modules/class-top-ten-widget.php:132
1780
  msgid "Only thumbnails, no text"
1781
  msgstr ""
1782
 
1783
- #: includes/modules/class-top-ten-widget.php:133
1784
  msgid "No thumbnails, only text."
1785
  msgstr ""
1786
 
1787
- #: includes/modules/class-top-ten-widget.php:150
1788
  msgid "Only from categories"
1789
  msgstr ""
1790
 
1791
- #: includes/modules/class-top-ten-widget.php:157
1792
- msgid "Include IDs"
 
1793
  msgstr ""
1794
 
1795
- #: includes/modules/class-top-ten-widget.php:161
1796
- msgid "Post types to include:"
1797
  msgstr ""
1798
 
1799
- #: includes/public/display-posts.php:211
1800
  #, php-format
1801
  msgid ""
1802
  "Popular posts by <a href=\"%1$s\" rel=\"nofollow\" %2$s>Top 10 plugin</a>"
1803
  msgstr ""
1804
 
1805
- #: includes/public/media.php:58
1806
- msgid "thumb_timthumb argument has been deprecated"
1807
- msgstr ""
1808
-
1809
- #: includes/public/media.php:62
1810
- msgid "thumb_timthumb_q argument has been deprecated"
1811
- msgstr ""
1812
-
1813
- #: includes/public/media.php:66
1814
- msgid "filter argument has been deprecated"
1815
- msgstr ""
1816
-
1817
  #: includes/public/output-generator.php:240
1818
  msgid " by "
1819
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2022-04-07 15:58+0100\n"
7
  "PO-Revision-Date: \n"
8
+ "Last-Translator: Ajay D'Souza\n"
9
+ "Language-Team: Ajay D'Souza\n"
10
  "Language: en_US\n"
11
  "MIME-Version: 1.0\n"
12
  "Content-Type: text/plain; charset=UTF-8\n"
13
  "Content-Transfer-Encoding: 8bit\n"
14
+ "X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
15
+ "esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
16
+ "_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
17
  "X-Poedit-Basepath: ..\n"
18
  "X-Generator: Poedit 3.0\n"
19
  "X-Poedit-SourceCharset: UTF-8\n"
32
  msgid "Views"
33
  msgstr ""
34
 
35
+ #: includes/admin/admin-dashboard.php:65
36
  msgid "View all daily popular posts"
37
  msgstr ""
38
 
39
+ #: includes/admin/admin-dashboard.php:67
40
  #: includes/admin/class-top-ten-dashboard.php:164
41
  msgid "View all popular posts"
42
  msgstr ""
43
 
44
+ #: includes/admin/admin-dashboard.php:75
45
  #, php-format
46
  msgid "Popular posts by <a href=\"%s\" target=\"_blank\">Top 10 plugin</a>"
47
  msgstr ""
48
 
49
+ #: includes/admin/admin-dashboard.php:124 includes/admin/admin.php:39
50
  #: includes/admin/class-top-ten-network-statistics.php:114
51
  #: includes/admin/class-top-ten-statistics.php:124
52
  msgid "Popular Posts"
53
  msgstr ""
54
 
55
+ #: includes/admin/admin-dashboard.php:129 includes/admin/admin.php:42
56
  msgid "Daily Popular Posts"
57
  msgstr ""
58
 
59
+ #: includes/admin/admin-metabox.php:117
60
  msgid "Visit count:"
61
  msgstr ""
62
 
63
+ #: includes/admin/admin-metabox.php:119
64
  msgid ""
65
  "Enter a number above to update the visit count. Leaving the above box blank "
66
  "will set the count to zero"
67
  msgstr ""
68
 
69
+ #: includes/admin/admin-metabox.php:129
70
  msgid "Disable Popular Posts display:"
71
  msgstr ""
72
 
73
+ #: includes/admin/admin-metabox.php:132
74
  msgid ""
75
  "If this is checked, then Top 10 will not display the popular posts widgets "
76
  "when viewing this post."
77
  msgstr ""
78
 
79
+ #: includes/admin/admin-metabox.php:136
80
  msgid "Exclude this post from the popular posts list:"
81
  msgstr ""
82
 
83
+ #: includes/admin/admin-metabox.php:139
84
  msgid ""
85
  "If this is checked, then this post will be excluded from the popular posts "
86
  "list."
87
  msgstr ""
88
 
89
+ #: includes/admin/admin-metabox.php:143
90
  msgid "Location of thumbnail:"
91
  msgstr ""
92
 
93
+ #: includes/admin/admin-metabox.php:145
94
  msgid ""
95
  "Enter the full URL to the image (JPG, PNG or GIF) you'd like to use. This "
96
  "image will be used for the post. It will be resized to the thumbnail size "
97
  "set under Top 10 Settings &raquo; Thumbnail options."
98
  msgstr ""
99
 
100
+ #: includes/admin/admin-metabox.php:146
101
  msgid "The URL above is saved in the meta field:"
102
  msgstr ""
103
 
104
+ #: includes/admin/admin-metabox.php:154
105
  #, php-format
106
  msgid ""
107
  "You have %1$s installed. If you are trying to modify the thumbnail, then you "
108
  "will need to make the same change in the %1$s meta box on this page."
109
  msgstr ""
110
 
111
+ #: includes/admin/admin.php:33 includes/admin/settings-page.php:32
112
  msgid "Top 10 Settings"
113
  msgstr ""
114
 
115
+ #: includes/admin/admin.php:33 includes/admin/admin.php:156
116
  msgid "Settings"
117
  msgstr ""
118
 
119
+ #: includes/admin/admin.php:39 includes/admin/class-top-ten-statistics.php:70
120
  msgid "Top 10 Popular Posts"
121
  msgstr ""
122
 
123
+ #: includes/admin/admin.php:42
124
  msgid "Top 10 Daily Popular Posts"
125
  msgstr ""
126
 
127
+ #: includes/admin/admin.php:46 includes/admin/tools.php:74
128
  msgid "Top 10 Tools"
129
  msgstr ""
130
 
131
+ #: includes/admin/admin.php:46
132
  msgid "Tools"
133
  msgstr ""
134
 
135
+ #: includes/admin/admin.php:49
136
  msgid "Top 10 Import Export Tables"
137
  msgstr ""
138
 
139
+ #: includes/admin/admin.php:49
140
  msgid "Import/Export"
141
  msgstr ""
142
 
143
+ #: includes/admin/admin.php:110
144
  #, php-format
145
  msgid ""
146
  "Thank you for using <a href=\"%1$s\" target=\"_blank\">Top 10</a>! Please <a "
148
  "\"_blank\">WordPress.org</a>"
149
  msgstr ""
150
 
151
+ #: includes/admin/admin.php:178 includes/admin/sidebar.php:55
152
  msgid "Support"
153
  msgstr ""
154
 
155
+ #: includes/admin/admin.php:179
156
  msgid "Donate"
157
  msgstr ""
158
 
159
+ #: includes/admin/admin.php:180
160
  msgid "Contribute"
161
  msgstr ""
162
 
164
  msgid "Top 10 - Network Popular Posts"
165
  msgstr ""
166
 
167
+ #: includes/admin/admin.php:200 includes/admin/class-top-ten-dashboard.php:199
168
  msgid "Top 10"
169
  msgstr ""
170
 
171
+ #: includes/admin/cache.php:22
172
+ #, php-format
173
+ msgid "%s entry cleared"
174
+ msgid_plural "%s entries cleared"
175
+ msgstr[0] ""
176
+ msgstr[1] ""
177
+
178
  #: includes/admin/class-top-ten-dashboard.php:83
179
  #: includes/admin/class-top-ten-dashboard.php:199
180
  #: includes/admin/class-top-ten-dashboard.php:201
198
  msgstr ""
199
 
200
  #: includes/admin/class-top-ten-dashboard.php:242
201
+ #: includes/admin/import-export.php:186
202
  msgid "Visits"
203
  msgstr ""
204
 
291
  msgstr ""
292
 
293
  #: includes/admin/class-top-ten-network-statistics-table.php:183
294
+ #: includes/admin/class-top-ten-statistics-table.php:221
295
  msgid "No popular posts available."
296
  msgstr ""
297
 
300
  msgstr ""
301
 
302
  #: includes/admin/class-top-ten-network-statistics-table.php:256
303
+ #: includes/admin/class-top-ten-statistics-table.php:305
304
  msgid "Y/m/d"
305
  msgstr ""
306
 
307
  #: includes/admin/class-top-ten-network-statistics-table.php:294
308
+ #: includes/admin/class-top-ten-statistics-table.php:359
309
  #: includes/modules/class-top-ten-count-widget.php:49
310
  #: includes/modules/class-top-ten-widget.php:79
311
  msgid "Title"
316
  msgstr ""
317
 
318
  #: includes/admin/class-top-ten-network-statistics-table.php:296
319
+ #: includes/admin/class-top-ten-statistics-table.php:364
320
+ #: includes/admin/import-export.php:189
321
  msgid "Date"
322
  msgstr ""
323
 
324
  #: includes/admin/class-top-ten-network-statistics-table.php:297
325
+ #: includes/admin/class-top-ten-statistics-table.php:360
326
  msgid "Total visits"
327
  msgstr ""
328
 
329
  #: includes/admin/class-top-ten-network-statistics-table.php:298
330
+ #: includes/admin/class-top-ten-statistics-table.php:361
331
  msgid "Daily visits"
332
  msgstr ""
333
 
334
  #: includes/admin/class-top-ten-network-statistics-table.php:331
335
+ #: includes/admin/class-top-ten-statistics-table.php:398
336
  msgid "Delete Count"
337
  msgstr ""
338
 
339
  #: includes/admin/class-top-ten-network-statistics-table.php:378
340
+ #: includes/admin/class-top-ten-statistics-table.php:445
341
  msgid "Are you sure you want to do this"
342
  msgstr ""
343
 
344
  #: includes/admin/class-top-ten-network-statistics-table.php:420
345
+ #: includes/admin/class-top-ten-statistics-table.php:512
346
  msgid "Filter"
347
  msgstr ""
348
 
354
  msgid "All post types"
355
  msgstr ""
356
 
357
+ #: includes/admin/class-top-ten-statistics-table.php:271
358
  msgid "View"
359
  msgstr ""
360
 
361
+ #: includes/admin/class-top-ten-statistics-table.php:272
362
  msgid "Edit"
363
  msgstr ""
364
 
365
+ #: includes/admin/class-top-ten-statistics-table.php:273
366
  msgid "Delete"
367
  msgstr ""
368
 
369
+ #: includes/admin/class-top-ten-statistics-table.php:303
370
  #, php-format
371
  msgid "%s ago"
372
  msgstr ""
373
 
374
+ #: includes/admin/class-top-ten-statistics-table.php:362
375
  msgid "Post type"
376
  msgstr ""
377
 
378
+ #: includes/admin/class-top-ten-statistics-table.php:363
379
  msgid "Author"
380
  msgstr ""
381
 
388
  msgstr ""
389
 
390
  #: includes/admin/default-settings.php:72
391
+ #: includes/modules/class-top-ten-widget.php:93
392
  msgid "Overall"
393
  msgstr ""
394
 
395
  #: includes/admin/default-settings.php:73
396
+ #: includes/admin/default-settings.php:751
397
  msgid "Daily"
398
  msgstr ""
399
 
669
  msgstr ""
670
 
671
  #: includes/admin/default-settings.php:320
672
+ #: includes/admin/default-settings.php:800
673
  msgid "Number of posts to display"
674
  msgstr ""
675
 
692
  msgstr ""
693
 
694
  #: includes/admin/default-settings.php:335
695
+ #: includes/modules/class-top-ten-widget.php:148
696
  msgid "Post types to include"
697
  msgstr ""
698
 
716
  msgstr ""
717
 
718
  #: includes/admin/default-settings.php:349
719
+ msgid "Exclude current post"
720
  msgstr ""
721
 
722
  #: includes/admin/default-settings.php:350
723
  msgid ""
724
+ "Enabling this will exclude the current post being browsed from being "
725
+ "displayed in the popular posts list."
726
+ msgstr ""
727
+
728
+ #: includes/admin/default-settings.php:356
729
+ msgid "Post/page IDs to exclude"
730
+ msgstr ""
731
+
732
+ #: includes/admin/default-settings.php:357
733
+ msgid ""
734
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
735
  "188,320,500"
736
  msgstr ""
737
 
738
+ #: includes/admin/default-settings.php:363
739
  msgid "Exclude Categories"
740
  msgstr ""
741
 
742
+ #: includes/admin/default-settings.php:364
743
+ #: includes/admin/default-settings.php:384
744
  msgid ""
745
  "Comma separated list of category slugs. The field above has an autocomplete "
746
  "so simply start typing in the starting letters and it will prompt you with "
747
  "options. Does not support custom taxonomies."
748
  msgstr ""
749
 
750
+ #: includes/admin/default-settings.php:375
751
  msgid "Exclude category IDs"
752
  msgstr ""
753
 
754
+ #: includes/admin/default-settings.php:376
755
  msgid ""
756
  "This is a readonly field that is automatically populated based on the above "
757
  "input when the settings are saved. These might differ from the IDs visible "
759
  "term_taxonomy_id which is unique to this taxonomy."
760
  msgstr ""
761
 
762
+ #: includes/admin/default-settings.php:383
763
+ msgid "Exclude on Categories"
764
+ msgstr ""
765
+
766
+ #: includes/admin/default-settings.php:395
767
  msgid "Customize the output"
768
  msgstr ""
769
 
770
+ #: includes/admin/default-settings.php:401
771
  msgid "Heading of posts"
772
  msgstr ""
773
 
774
+ #: includes/admin/default-settings.php:402
775
+ #: includes/admin/default-settings.php:410
776
  msgid "Displayed before the list of the posts as a the master heading"
777
  msgstr ""
778
 
779
+ #: includes/admin/default-settings.php:404
780
  msgid "Popular posts:"
781
  msgstr ""
782
 
783
+ #: includes/admin/default-settings.php:409
784
  msgid "Heading of posts for daily/custom period lists"
785
  msgstr ""
786
 
787
+ #: includes/admin/default-settings.php:412
788
  msgid "Currently trending:"
789
  msgstr ""
790
 
791
+ #: includes/admin/default-settings.php:417
792
  msgid "Show when no posts are found"
793
  msgstr ""
794
 
795
+ #: includes/admin/default-settings.php:423
796
  msgid "Blank output"
797
  msgstr ""
798
 
799
+ #: includes/admin/default-settings.php:424
800
  msgid "Display custom text"
801
  msgstr ""
802
 
803
+ #: includes/admin/default-settings.php:429
804
  msgid "Custom text"
805
  msgstr ""
806
 
807
+ #: includes/admin/default-settings.php:430
808
  msgid ""
809
  "Enter the custom text that will be displayed if the second option is "
810
  "selected above"
811
  msgstr ""
812
 
813
+ #: includes/admin/default-settings.php:432 includes/deprecated.php:180
814
  msgid "No top posts yet"
815
  msgstr ""
816
 
817
+ #: includes/admin/default-settings.php:436
818
  msgid "Show post excerpt"
819
  msgstr ""
820
 
821
+ #: includes/admin/default-settings.php:443
822
  msgid "Length of excerpt (in words)"
823
  msgstr ""
824
 
825
+ #: includes/admin/default-settings.php:451
826
+ #: includes/blocks/popular-posts/src/edit.js:214
827
+ #: includes/modules/class-top-ten-widget.php:118
828
  msgid "Show date"
829
  msgstr ""
830
 
831
+ #: includes/admin/default-settings.php:458
832
+ #: includes/blocks/popular-posts/src/edit.js:200
833
+ #: includes/modules/class-top-ten-widget.php:114
834
  msgid "Show author"
835
  msgstr ""
836
 
837
+ #: includes/admin/default-settings.php:465
838
  msgid "Show number of views"
839
  msgstr ""
840
 
841
+ #: includes/admin/default-settings.php:472
842
  msgid "Limit post title length (in characters)"
843
  msgstr ""
844
 
845
+ #: includes/admin/default-settings.php:480
846
  msgid "Open links in new window"
847
  msgstr ""
848
 
849
+ #: includes/admin/default-settings.php:487
850
  msgid "Add nofollow to links"
851
  msgstr ""
852
 
853
+ #: includes/admin/default-settings.php:494
854
  msgid "HTML to display"
855
  msgstr ""
856
 
857
+ #: includes/admin/default-settings.php:500
858
  msgid "Before the list of posts"
859
  msgstr ""
860
 
861
+ #: includes/admin/default-settings.php:507
862
  msgid "After the list of posts"
863
  msgstr ""
864
 
865
+ #: includes/admin/default-settings.php:514
866
  msgid "Before each list item"
867
  msgstr ""
868
 
869
+ #: includes/admin/default-settings.php:521
870
  msgid "After each list item"
871
  msgstr ""
872
 
873
+ #: includes/admin/default-settings.php:551
874
+ #: includes/blocks/popular-posts/src/edit.js:245
875
  msgid "Location of the post thumbnail"
876
  msgstr ""
877
 
878
+ #: includes/admin/default-settings.php:556
879
  msgid "Display thumbnails inline with posts, before title"
880
  msgstr ""
881
 
882
+ #: includes/admin/default-settings.php:557
883
  msgid "Display thumbnails inline with posts, after title"
884
  msgstr ""
885
 
886
+ #: includes/admin/default-settings.php:558
887
  msgid "Display only thumbnails, no text"
888
  msgstr ""
889
 
890
+ #: includes/admin/default-settings.php:559
891
  msgid "Do not display thumbnails, only text"
892
  msgstr ""
893
 
894
+ #: includes/admin/default-settings.php:564
895
  msgid "Thumbnail size"
896
  msgstr ""
897
 
898
+ #: includes/admin/default-settings.php:565
899
  msgid ""
900
  "You can choose from existing image sizes above or create a custom size. If "
901
  "you have chosen Custom size above, then enter the width, height and crop "
903
  "width and/or height below, existing images will not be automatically resized."
904
  msgstr ""
905
 
906
+ #: includes/admin/default-settings.php:567
907
  #, php-format
908
+ msgid "I recommend using %1$s to regenerate all image sizes."
909
  msgstr ""
910
 
911
+ #: includes/admin/default-settings.php:576
912
+ #: includes/modules/class-top-ten-widget.php:135
913
  msgid "Thumbnail width"
914
  msgstr ""
915
 
916
+ #: includes/admin/default-settings.php:584
917
+ #: includes/modules/class-top-ten-widget.php:131
918
  msgid "Thumbnail height"
919
  msgstr ""
920
 
921
+ #: includes/admin/default-settings.php:592
922
  msgid "Hard crop thumbnails"
923
  msgstr ""
924
 
925
+ #: includes/admin/default-settings.php:593
926
  msgid ""
927
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
928
  "above vs. maintaining proportions."
929
  msgstr ""
930
 
931
+ #: includes/admin/default-settings.php:599
932
  msgid "Generate thumbnail sizes"
933
  msgstr ""
934
 
935
+ #: includes/admin/default-settings.php:600
936
  msgid ""
937
  "If you select this option and Custom size is selected above, the plugin will "
938
  "register the image size with WordPress to create new thumbnails. Does not "
939
  "update old images as explained above."
940
  msgstr ""
941
 
942
+ #: includes/admin/default-settings.php:606
943
  msgid "Thumbnail size attributes"
944
  msgstr ""
945
 
946
+ #: includes/admin/default-settings.php:612
947
  #, php-format
948
  msgid "Use CSS to set the width and height: e.g. %s"
949
  msgstr ""
950
 
951
+ #: includes/admin/default-settings.php:614
952
  #, php-format
953
  msgid "Use HTML attributes to set the width and height: e.g. %s"
954
  msgstr ""
955
 
956
+ #: includes/admin/default-settings.php:615
957
  msgid ""
958
  "No width or height set. You will need to use external styles to force any "
959
  "width or height of your choice."
960
  msgstr ""
961
 
962
+ #: includes/admin/default-settings.php:620
963
  msgid "Thumbnail meta field name"
964
  msgstr ""
965
 
966
+ #: includes/admin/default-settings.php:621
967
  msgid ""
968
  "The value of this field should contain the URL of the image and can be set "
969
  "in the metabox in the Edit Post screen"
970
  msgstr ""
971
 
972
+ #: includes/admin/default-settings.php:627
973
  msgid "Get first image"
974
  msgstr ""
975
 
976
+ #: includes/admin/default-settings.php:628
977
  msgid ""
978
  "The plugin will fetch the first image in the post content if this is "
979
  "enabled. This can slow down the loading of your page if the first image in "
980
  "the followed posts is large in file-size."
981
  msgstr ""
982
 
983
+ #: includes/admin/default-settings.php:634
984
  msgid "Use default thumbnail?"
985
  msgstr ""
986
 
987
+ #: includes/admin/default-settings.php:635
988
  msgid ""
989
  "If checked, when no thumbnail is found, show a default one from the URL "
990
  "below. If not checked and no thumbnail is found, no image will be shown."
991
  msgstr ""
992
 
993
+ #: includes/admin/default-settings.php:641 includes/admin/settings-page.php:753
994
  msgid "Default thumbnail"
995
  msgstr ""
996
 
997
+ #: includes/admin/default-settings.php:642
998
  msgid ""
999
  "Enter the full URL of the image that you wish to display if no thumbnail is "
1000
  "found. This image will be displayed below."
1001
  msgstr ""
1002
 
1003
+ #: includes/admin/default-settings.php:672
1004
  msgid "Popular posts style"
1005
  msgstr ""
1006
 
1007
+ #: includes/admin/default-settings.php:680
1008
  msgid "Custom CSS"
1009
  msgstr ""
1010
 
1011
+ #: includes/admin/default-settings.php:682
1012
  #, php-format
1013
  msgid ""
1014
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
1015
  "CSS classes to style."
1016
  msgstr ""
1017
 
1018
+ #: includes/admin/default-settings.php:712
1019
  msgid "Enable scheduled maintenance"
1020
  msgstr ""
1021
 
1022
+ #: includes/admin/default-settings.php:714
1023
  #, php-format
1024
  msgid ""
1025
  "Cleaning the database at regular intervals could improve performance, "
1027
  "delete entries older than %d days in the daily tables."
1028
  msgstr ""
1029
 
1030
+ #: includes/admin/default-settings.php:720
1031
  msgid "Time to run maintenance"
1032
  msgstr ""
1033
 
1034
+ #: includes/admin/default-settings.php:721
1035
  msgid "The next two options allow you to set the time to run the cron."
1036
  msgstr ""
1037
 
1038
+ #: includes/admin/default-settings.php:726
1039
  msgid "Hour"
1040
  msgstr ""
1041
 
1042
+ #: includes/admin/default-settings.php:736
1043
  msgid "Minute"
1044
  msgstr ""
1045
 
1046
+ #: includes/admin/default-settings.php:746
1047
  msgid "Run maintenance"
1048
  msgstr ""
1049
 
1050
+ #: includes/admin/default-settings.php:752
1051
  msgid "Weekly"
1052
  msgstr ""
1053
 
1054
+ #: includes/admin/default-settings.php:753
1055
  msgid "Fortnightly"
1056
  msgstr ""
1057
 
1058
+ #: includes/admin/default-settings.php:754
1059
  msgid "Monthly"
1060
  msgstr ""
1061
 
1062
+ #: includes/admin/default-settings.php:782
1063
  msgid "Permalink - Overall"
1064
  msgstr ""
1065
 
1066
+ #: includes/admin/default-settings.php:784
1067
  #, php-format
1068
  msgid ""
1069
  "This will set the path of the custom feed generated by the plugin for "
1071
  "when changing this option."
1072
  msgstr ""
1073
 
1074
+ #: includes/admin/default-settings.php:791
1075
  msgid "Permalink - Daily"
1076
  msgstr ""
1077
 
1078
+ #: includes/admin/default-settings.php:793
1079
  #, php-format
1080
  msgid ""
1081
  "This will set the path of the custom feed generated by the plugin for daily/"
1083
  "%2$s when changing this option."
1084
  msgstr ""
1085
 
1086
+ #: includes/admin/default-settings.php:801
1087
  msgid "Maximum number of posts that will be displayed in the custom feed."
1088
  msgstr ""
1089
 
1090
+ #: includes/admin/default-settings.php:808
1091
  msgid "Custom period in day(s)"
1092
  msgstr ""
1093
 
1094
+ #: includes/admin/default-settings.php:910
1095
  msgid "No styles"
1096
  msgstr ""
1097
 
1098
+ #: includes/admin/default-settings.php:911
1099
  msgid "Select this option if you plan to add your own styles"
1100
  msgstr ""
1101
 
1102
+ #: includes/admin/default-settings.php:915
1103
  msgid "Text only"
1104
  msgstr ""
1105
 
1106
+ #: includes/admin/default-settings.php:916
1107
  msgid ""
1108
  "Disable thumbnails and no longer include the default style sheet included in "
1109
  "the plugin"
1110
  msgstr ""
1111
 
1112
+ #: includes/admin/default-settings.php:920
1113
  msgid "Left thumbnails"
1114
  msgstr ""
1115
 
1116
+ #: includes/admin/default-settings.php:921
1117
  msgid ""
1118
  "Enabling this option will set the post thumbnail to be before text. "
1119
  "Disabling this option will not revert any settings."
1248
  msgid "Refer to the knowledge base to learn how to use this in detail."
1249
  msgstr ""
1250
 
1251
+ #: includes/admin/import-export.php:30
1252
  msgid "Data has been imported into the table"
1253
  msgstr ""
1254
 
1255
+ #: includes/admin/import-export.php:32
1256
+ msgid ""
1257
+ "Data import failure. Check the number of columns for the file being imported "
1258
+ "and if you are uploading it in the right section below"
1259
+ msgstr ""
1260
+
1261
+ #: includes/admin/import-export.php:38
1262
  msgid "Settings have been imported successfully"
1263
  msgstr ""
1264
 
1265
+ #: includes/admin/import-export.php:44
1266
  msgid "Top 10 - Import/Export tables"
1267
  msgstr ""
1268
 
1269
+ #: includes/admin/import-export.php:54
1270
  msgid "Export/Import settings"
1271
  msgstr ""
1272
 
1273
+ #: includes/admin/import-export.php:56
1274
  msgid ""
1275
  "Export the plugin settings for this site as a .json file. This allows you to "
1276
  "easily import the configuration into another site."
1277
  msgstr ""
1278
 
1279
+ #: includes/admin/import-export.php:60
1280
  msgid "Export Settings"
1281
  msgstr ""
1282
 
1283
+ #: includes/admin/import-export.php:69
1284
  msgid ""
1285
  "Import the plugin settings from a .json file. This file can be obtained by "
1286
+ "exporting the settings on this/another site using the form above."
1287
  msgstr ""
1288
 
1289
+ #: includes/admin/import-export.php:75
1290
  msgid "Import Settings"
1291
  msgstr ""
1292
 
1293
+ #: includes/admin/import-export.php:84
1294
  msgid "Export tables"
1295
  msgstr ""
1296
 
1297
+ #: includes/admin/import-export.php:86
1298
  msgid ""
1299
  "Click the buttons below to export the overall and the daily tables. The file "
1300
  "is downloaded as an CSV file which you should be able to edit in Excel or "
1301
  "any other compatible software."
1302
  msgstr ""
1303
 
1304
+ #: includes/admin/import-export.php:87
1305
  msgid ""
1306
  "If you are using WordPress Multisite then this will include the counts "
1307
  "across all sites as the plugin uses a single table to store counts."
1308
  msgstr ""
1309
 
1310
+ #: includes/admin/import-export.php:91
1311
  msgid "Export overall tables"
1312
  msgstr ""
1313
 
1314
+ #: includes/admin/import-export.php:92
1315
  msgid "Export daily tables"
1316
  msgstr ""
1317
 
1318
+ #: includes/admin/import-export.php:100
1319
  msgid "Import tables"
1320
  msgstr ""
1321
 
1322
+ #: includes/admin/import-export.php:102
1323
  msgid ""
1324
+ "This action will replace the data in the table being import. Best practice "
1325
+ "would be to first export the data using the buttons above. Following this, "
1326
+ "update the file with the new data and then import it. It is important to "
1327
+ "maintain the export format of the data to avoid corruption."
1328
  msgstr ""
1329
 
1330
+ #: includes/admin/import-export.php:104
1331
+ msgid ""
1332
+ "Be careful when opening the file in Excel as it tends to change the date "
1333
+ "format. Recommended date-time format is YYYY-MM-DD H."
1334
+ msgstr ""
1335
+
1336
+ #: includes/admin/import-export.php:107
1337
  msgid ""
1338
  "Backup your database before proceeding so you will be able to restore it in "
1339
  "case anything goes wrong."
1340
  msgstr ""
1341
 
1342
+ #: includes/admin/import-export.php:109
1343
  msgid "Import Overall Table"
1344
  msgstr ""
1345
 
1346
+ #: includes/admin/import-export.php:114
1347
  msgid "Import Overall CSV"
1348
  msgstr ""
1349
 
1350
+ #: includes/admin/import-export.php:117
1351
  msgid "Import Daily Table"
1352
  msgstr ""
1353
 
1354
+ #: includes/admin/import-export.php:122
1355
  msgid "Import Daily CSV"
1356
  msgstr ""
1357
 
1358
+ #: includes/admin/import-export.php:185
1359
  msgid "Post ID"
1360
  msgstr ""
1361
 
1362
+ #: includes/admin/import-export.php:191
1363
  msgid "Blog ID"
1364
  msgstr ""
1365
 
1366
+ #: includes/admin/import-export.php:272
1367
  msgid "Please upload a valid .csv file"
1368
  msgstr ""
1369
 
1370
+ #: includes/admin/import-export.php:278 includes/admin/import-export.php:397
1371
  msgid "Please upload a file to import"
1372
  msgstr ""
1373
 
1374
+ #: includes/admin/import-export.php:391
1375
  msgid "Please upload a valid .json file"
1376
  msgstr ""
1377
 
1407
  msgid "Modified from default setting"
1408
  msgstr ""
1409
 
1410
+ #: includes/admin/settings-page.php:701
1411
+ msgctxt "tag delimiter"
1412
+ msgid ","
1413
+ msgstr ""
1414
+
1415
  #: includes/admin/sidebar.php:15
1416
  msgid "Support the development"
1417
  msgstr ""
1600
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1601
  msgstr ""
1602
 
1603
+ #: includes/blocks/popular-posts/src/edit.js:112
1604
+ msgid "Popular Posts Settings"
 
 
1605
  msgstr ""
1606
 
1607
+ #: includes/blocks/popular-posts/src/edit.js:118
1608
+ msgid "Show heading"
 
1609
  msgstr ""
1610
 
1611
+ #: includes/blocks/popular-posts/src/edit.js:121
1612
+ msgid "Heading displayed"
 
1613
  msgstr ""
1614
 
1615
+ #: includes/blocks/popular-posts/src/edit.js:122
1616
+ msgid "No Heading displayed"
 
1617
  msgstr ""
1618
 
1619
+ #: includes/blocks/popular-posts/src/edit.js:132
1620
+ msgid "Custom period?"
 
1621
  msgstr ""
1622
 
1623
+ #: includes/blocks/popular-posts/src/edit.js:135
1624
+ msgid "Set range below"
 
1625
  msgstr ""
1626
 
1627
+ #: includes/blocks/popular-posts/src/edit.js:136
1628
+ msgid "Overall popular posts will be shown"
 
1629
  msgstr ""
1630
 
1631
+ #: includes/blocks/popular-posts/src/edit.js:146
 
1632
  msgid "Daily range"
1633
  msgstr ""
1634
 
1635
+ #: includes/blocks/popular-posts/src/edit.js:149
1636
+ msgid "Number of days"
 
1637
  msgstr ""
1638
 
1639
+ #: includes/blocks/popular-posts/src/edit.js:156
1640
+ msgid "Hour range"
1641
+ msgstr ""
1642
+
1643
+ #: includes/blocks/popular-posts/src/edit.js:159
1644
+ msgid "Number of hours"
1645
+ msgstr ""
1646
+
1647
+ #: includes/blocks/popular-posts/src/edit.js:166
1648
+ #: includes/modules/class-top-ten-rest-api.php:212
1649
+ msgid "Number of posts"
1650
+ msgstr ""
1651
+
1652
+ #: includes/blocks/popular-posts/src/edit.js:169
1653
+ msgid "Maximum number of posts to display"
1654
  msgstr ""
1655
 
1656
+ #: includes/blocks/popular-posts/src/edit.js:176
1657
+ #: includes/modules/class-top-ten-widget.php:87
 
1658
  msgid "Offset"
1659
  msgstr ""
1660
 
1661
+ #: includes/blocks/popular-posts/src/edit.js:179
1662
+ msgid "Number of posts to skip from the top"
1663
+ msgstr ""
1664
+
1665
+ #: includes/blocks/popular-posts/src/edit.js:186
1666
+ #: includes/modules/class-top-ten-widget.php:110
1667
  msgid "Show excerpt"
1668
  msgstr ""
1669
 
1670
+ #: includes/blocks/popular-posts/src/edit.js:189
1671
+ msgid "Excerpt displayed"
1672
+ msgstr ""
1673
+
1674
+ #: includes/blocks/popular-posts/src/edit.js:190
1675
+ msgid "No excerpt"
1676
+ msgstr ""
1677
+
1678
+ #: includes/blocks/popular-posts/src/edit.js:203
1679
+ msgid "\"by Author Name\" displayed"
1680
+ msgstr ""
1681
+
1682
+ #: includes/blocks/popular-posts/src/edit.js:204
1683
+ msgid "No author displayed"
1684
+ msgstr ""
1685
+
1686
+ #: includes/blocks/popular-posts/src/edit.js:217
1687
+ msgid "Date of post displayed"
1688
+ msgstr ""
1689
+
1690
+ #: includes/blocks/popular-posts/src/edit.js:218
1691
+ msgid "Date of post not displayed"
1692
+ msgstr ""
1693
+
1694
+ #: includes/blocks/popular-posts/src/edit.js:228
1695
+ #: includes/modules/class-top-ten-widget.php:106
1696
  msgid "Show count"
1697
  msgstr ""
1698
 
1699
+ #: includes/blocks/popular-posts/src/edit.js:231
1700
+ msgid "Display number of visits"
1701
+ msgstr ""
1702
+
1703
+ #: includes/blocks/popular-posts/src/edit.js:232
1704
+ msgid "Number of visits hidden"
1705
+ msgstr ""
1706
+
1707
+ #: includes/blocks/popular-posts/src/edit.js:242
1708
+ msgid "Thumbnail option"
1709
  msgstr ""
1710
 
1711
+ #: includes/blocks/popular-posts/src/edit.js:247
 
1712
  msgid "Before title"
1713
  msgstr ""
1714
 
1715
+ #: includes/blocks/popular-posts/src/edit.js:248
 
1716
  msgid "After title"
1717
  msgstr ""
1718
 
1719
+ #: includes/blocks/popular-posts/src/edit.js:251
 
1720
  msgid "Only thumbnail"
1721
  msgstr ""
1722
 
1723
+ #: includes/blocks/popular-posts/src/edit.js:253
 
1724
  msgid "Only text"
1725
  msgstr ""
1726
 
1727
+ #: includes/blocks/popular-posts/src/edit.js:261
 
1728
  msgid "Other attributes"
1729
  msgstr ""
1730
 
1731
+ #: includes/blocks/popular-posts/src/edit.js:265
 
1732
  msgid ""
1733
  "Enter other attributes in a URL-style string-query. e.g. post_types=post,"
1734
  "page&link_nofollow=1&exclude_post_ids=5,6"
1778
  msgid "Invalid post ID."
1779
  msgstr ""
1780
 
 
 
 
 
1781
  #: includes/modules/class-top-ten-rest-api.php:217
1782
  msgid "Post types"
1783
  msgstr ""
1798
  msgid "Debug flag."
1799
  msgstr ""
1800
 
1801
+ #: includes/modules/class-top-ten-widget.php:26
1802
+ msgid "Popular Posts [Top 10]"
1803
  msgstr ""
1804
 
1805
+ #: includes/modules/class-top-ten-widget.php:28
1806
+ msgid "Display popular posts"
1807
  msgstr ""
1808
 
1809
+ #: includes/modules/class-top-ten-widget.php:83
1810
+ msgid "No. of posts"
1811
  msgstr ""
1812
 
1813
+ #: includes/modules/class-top-ten-widget.php:91
1814
+ msgid "Select period"
1815
  msgstr ""
1816
 
1817
+ #: includes/modules/class-top-ten-widget.php:94
1818
+ msgid "Custom time period (Enter below)"
1819
  msgstr ""
1820
 
1821
+ #: includes/modules/class-top-ten-widget.php:98
1822
+ msgid "Days"
1823
  msgstr ""
1824
 
1825
+ #: includes/modules/class-top-ten-widget.php:101
1826
+ msgid "Hours"
1827
  msgstr ""
1828
 
1829
+ #: includes/modules/class-top-ten-widget.php:122
1830
+ msgid "Thumbnail options"
1831
  msgstr ""
1832
 
1833
  #: includes/modules/class-top-ten-widget.php:124
 
 
 
 
1834
  msgid "Thumbnails inline, before title"
1835
  msgstr ""
1836
 
1837
+ #: includes/modules/class-top-ten-widget.php:125
1838
  msgid "Thumbnails inline, after title"
1839
  msgstr ""
1840
 
1841
+ #: includes/modules/class-top-ten-widget.php:126
1842
  msgid "Only thumbnails, no text"
1843
  msgstr ""
1844
 
1845
+ #: includes/modules/class-top-ten-widget.php:127
1846
  msgid "No thumbnails, only text."
1847
  msgstr ""
1848
 
1849
+ #: includes/modules/class-top-ten-widget.php:139
1850
  msgid "Only from categories"
1851
  msgstr ""
1852
 
1853
+ #: includes/modules/class-top-ten-widget.php:141
1854
+ msgid ""
1855
+ "Enter a comma separated list of category, tag or other term taxonomy IDs"
1856
  msgstr ""
1857
 
1858
+ #: includes/modules/class-top-ten-widget.php:144
1859
+ msgid "Include post IDs"
1860
  msgstr ""
1861
 
1862
+ #: includes/public/display-posts.php:173
1863
  #, php-format
1864
  msgid ""
1865
  "Popular posts by <a href=\"%1$s\" rel=\"nofollow\" %2$s>Top 10 plugin</a>"
1866
  msgstr ""
1867
 
 
 
 
 
 
 
 
 
 
 
 
 
1868
  #: includes/public/output-generator.php:240
1869
  msgid " by "
1870
  msgstr ""
phpcs.ruleset.xml DELETED
@@ -1,17 +0,0 @@
1
- <?xml version="1.0"?>
2
- <ruleset name="WordPress Coding Standards for Plugins">
3
- <description>Generally-applicable sniffs for WordPress plugins</description>
4
-
5
- <exclude-pattern>*/node_modules/*</exclude-pattern>
6
- <exclude-pattern>*/vendor/*</exclude-pattern>
7
- <exclude-pattern>*/tests/*</exclude-pattern>
8
- <exclude-pattern>*/index.php</exclude-pattern>
9
-
10
- <rule ref="WordPress" />
11
-
12
- <!-- Add in some extra rules from other standards. -->
13
- <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
14
- <rule ref="Generic.Commenting.Todo"/>
15
- <rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
16
-
17
- </ruleset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
phpcs.xml.dist ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="WordPress Coding Standards for Plugins">
3
+ <description>Generally-applicable sniffs for WordPress plugins</description>
4
+
5
+ <file>.</file>
6
+ <exclude-pattern>*/node_modules/*</exclude-pattern>
7
+ <exclude-pattern>*/phpunit/*</exclude-pattern>
8
+ <exclude-pattern>*/vendor/*</exclude-pattern>
9
+ <exclude-pattern>*/tests/*</exclude-pattern>
10
+ <exclude-pattern>*/index.php</exclude-pattern>
11
+ <exclude-pattern>*/index.asset.php</exclude-pattern>
12
+
13
+ <!-- Only check PHP files. -->
14
+ <arg name="extensions" value="php"/>
15
+
16
+ <!-- Show progress, show the error codes for each message (source). -->
17
+ <arg value="ps"/>
18
+
19
+ <!-- Strip the filepaths down to the relevant bit. -->
20
+ <arg name="basepath" value="./"/>
21
+
22
+ <!-- Check up to 8 files simultaneously. -->
23
+ <arg name="parallel" value="8"/>
24
+
25
+ <!-- Use WordPress ruleset. -->
26
+ <rule ref="WordPress">
27
+ <exclude name="WordPress.WP.I18n" />
28
+ </rule>
29
+ <rule ref="WordPress.Files.FileName">
30
+ <exclude-pattern>*/phpunit/tests/*\.php$</exclude-pattern>
31
+ </rule>
32
+
33
+ <!-- Add in some extra rules from other standards. -->
34
+ <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
35
+ <rule ref="Generic.Commenting.Todo"/>
36
+ <rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
37
+
38
+ </ruleset>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics, tracker
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
- Stable tag: 3.0.0
6
- Requires at least: 5.3
7
  Tested up to: 5.9
8
  Requires PHP: 7.1
9
  License: GPLv2 or later
@@ -135,6 +135,32 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  = 3.0.0 =
139
 
140
  Release post: [https://webberzone.com/blog/top-10-v3-0-0/](https://webberzone.com/blog/top-10-v3-0-0/)
@@ -159,6 +185,6 @@ For previous changelog entries, please refer to the separate changelog.txt file
159
 
160
  == Upgrade Notice ==
161
 
162
- = 3.0.0 =
163
  Major release; Please check the plugin settings; Read all details in the release post
164
 
2
  Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics, tracker
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
+ Stable tag: 3.1.0
6
+ Requires at least: 5.6
7
  Tested up to: 5.9
8
  Requires PHP: 7.1
9
  License: GPLv2 or later
135
 
136
  == Changelog ==
137
 
138
+ = 3.1.0 =
139
+
140
+ Release post: [https://webberzone.com/blog/top-10-v3-1-0/](https://webberzone.com/blog/top-10-v3-1-0/)
141
+
142
+ * Features:
143
+ * New filter `tptn_show_meta_box` that can be set to false to disable the Top 10 meta box on Edit screens
144
+ * New option to exclude the current post from the list
145
+ * New option "Exclude on Categories" to disable the display of the popular posts on selected categories
146
+
147
+ * Enhancements/Modifications:
148
+ * Optimised import of tables particularly for larger imports
149
+ * Added wpml-config.xml file that will allow settings to be translated with WPML and PolyLang
150
+ * Upgraded block to the latest API
151
+ * Upgraded thumbnail display. If default image is disabled, then the site icon will be displayed if available
152
+ * Admin dashboard counts match with the Popular posts listings
153
+ * Updated chartjs to the latest version
154
+
155
+ * Bug fixes:
156
+ * Fixed PHP notice on widgets.php page due to the block
157
+ * Widget checkboxes are not saved in WordPress 5.8
158
+ * `post__in` argument will now remove any false/0 values
159
+ * Disabling/enabling author tracking didn't always work
160
+ * WP Multisite: Creating a new blog with automatically configure the plugin
161
+ * Widget incorrectly included all post types when no post types were selected instead of using the global settings
162
+ * Current post was incorrectly excluded when translation functions were run
163
+
164
  = 3.0.0 =
165
 
166
  Release post: [https://webberzone.com/blog/top-10-v3-0-0/](https://webberzone.com/blog/top-10-v3-0-0/)
185
 
186
  == Upgrade Notice ==
187
 
188
+ = 3.1.0 =
189
  Major release; Please check the plugin settings; Read all details in the release post
190
 
top-10.php CHANGED
@@ -8,13 +8,13 @@
8
  * @author Ajay D'Souza <me@ajaydsouza.com>
9
  * @license GPL-2.0+
10
  * @link https://webberzone.com
11
- * @copyright 2008-2021 Ajay D'Souza
12
  *
13
  * @wordpress-plugin
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
- * Version: 3.0.0
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
@@ -30,6 +30,18 @@ if ( ! defined( 'WPINC' ) ) {
30
  }
31
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * Holds the filesystem directory path (with trailing slash) for Top 10
35
  *
@@ -86,41 +98,6 @@ global $tptn_db_version;
86
  $tptn_db_version = '6.0';
87
 
88
 
89
- /**
90
- * Global variable holding the current settings for Top 10
91
- *
92
- * @since 1.9.3
93
- *
94
- * @var array
95
- */
96
- global $tptn_settings;
97
- $tptn_settings = tptn_get_settings();
98
-
99
-
100
- /**
101
- * Get Settings.
102
- *
103
- * Retrieves all plugin settings
104
- *
105
- * @since 2.5.0
106
- * @return array Top 10 settings
107
- */
108
- function tptn_get_settings() {
109
-
110
- $settings = get_option( 'tptn_settings' );
111
-
112
- /**
113
- * Settings array
114
- *
115
- * Retrieves all plugin settings
116
- *
117
- * @since 1.2.0
118
- * @param array $settings Settings array
119
- */
120
- return apply_filters( 'tptn_get_settings', $settings );
121
- }
122
-
123
-
124
  /*
125
  *---------------------------------------------------------------------------*
126
  * Top 10 modules
@@ -147,7 +124,7 @@ require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/taxonomies.php';
147
  require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-ten-widget.php';
148
  require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-ten-count-widget.php';
149
  require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-ten-rest-api.php';
150
- require_once TOP_TEN_PLUGIN_DIR . 'includes/blocks/popular-posts.php';
151
 
152
 
153
  /*
@@ -184,3 +161,37 @@ if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
184
 
185
  require_once TOP_TEN_PLUGIN_DIR . 'includes/deprecated.php';
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  * @author Ajay D'Souza <me@ajaydsouza.com>
9
  * @license GPL-2.0+
10
  * @link https://webberzone.com
11
+ * @copyright 2008-2022 Ajay D'Souza
12
  *
13
  * @wordpress-plugin
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
+ * Version: 3.1.0
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
30
  }
31
 
32
 
33
+ /**
34
+ * Holds the version of Top 10.
35
+ *
36
+ * @since 3.1.0
37
+ *
38
+ * @var string Top 10 Version.
39
+ */
40
+ if ( ! defined( 'TOP_TEN_VERSION' ) ) {
41
+ define( 'TOP_TEN_VERSION', '3.1.0' );
42
+ }
43
+
44
+
45
  /**
46
  * Holds the filesystem directory path (with trailing slash) for Top 10
47
  *
98
  $tptn_db_version = '6.0';
99
 
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  /*
102
  *---------------------------------------------------------------------------*
103
  * Top 10 modules
124
  require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-ten-widget.php';
125
  require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-ten-count-widget.php';
126
  require_once TOP_TEN_PLUGIN_DIR . 'includes/modules/class-top-ten-rest-api.php';
127
+ require_once TOP_TEN_PLUGIN_DIR . 'includes/blocks/register-blocks.php';
128
 
129
 
130
  /*
161
 
162
  require_once TOP_TEN_PLUGIN_DIR . 'includes/deprecated.php';
163
 
164
+
165
+ /**
166
+ * Global variable holding the current settings for Top 10
167
+ *
168
+ * @since 1.9.3
169
+ *
170
+ * @var array
171
+ */
172
+ global $tptn_settings;
173
+ $tptn_settings = tptn_get_settings();
174
+
175
+
176
+ /**
177
+ * Get Settings.
178
+ *
179
+ * Retrieves all plugin settings
180
+ *
181
+ * @since 2.5.0
182
+ * @return array Top 10 settings
183
+ */
184
+ function tptn_get_settings() {
185
+
186
+ $settings = get_option( 'tptn_settings' );
187
+
188
+ /**
189
+ * Settings array
190
+ *
191
+ * Retrieves all plugin settings
192
+ *
193
+ * @since 1.2.0
194
+ * @param array $settings Settings array
195
+ */
196
+ return apply_filters( 'tptn_get_settings', $settings );
197
+ }
wpml-config.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <wpml-config>
2
+ <admin-texts>
3
+ <key name="tptn_settings">
4
+ <key name="title" />
5
+ <key name="title_daily" />
6
+ <key name="blank_output_text" />
7
+ <key name="count_disp_form" />
8
+ <key name="count_disp_form_zero" />
9
+ </key>
10
+ </admin-texts>
11
+ </wpml-config>